diff --git a/README.md b/README.md index 32103fa..45bcf0c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## Table of Contents +- [Support](#support) - [API](#api) - [Handlers](#handlers) - [Setup procedure](#setup-procedure) @@ -9,6 +10,13 @@ - [Homekit](#homekit) - [Development](#development) +## Support + +I have put many hours of research in the BTicino intercom. + +Many people have been asking me if they can send me some hardware to show their support. + +If you want to support me, have a look at my [Amazon wishlist](https://www.amazon.de/registries/gl/guest-view/2S9AZ0FONMSK9?language=en_GB¤cy=EUR) ❤️🙏 and buy anything (or nothing) you see there. ## API @@ -25,7 +33,9 @@ Supports: * Exposes the voicemail videoclips * Display the videoclip * Send MQTT messages for openwebnet events and intercom status -* WebRTC bundle with embedded SIP client and SDP socket server +* WebRTC bundle with embedded SIP client and RTSP server +* Homekit bundle with support for locks, voicemail and muting intercom, doorbell +* HKSV (Homekit Secure Video) recordings on doorbell events and motion events ## Handlers @@ -249,9 +259,14 @@ In config.json add the following config: Add the `webrtc` to the linphone files if you wish to receive incoming calls. -When starting the WebRTC bundle, an additional SDP server will be available at `tcp://192.168.0.X:8081`. +When starting the WebRTC bundle, an additional RTSP server will be available at `rtsp://192.168.0.X:6554/doorbell`. + +This allows you to use `ffplay -f rtsp -i rtsp://192.168.0.X:6554/doorbell` or `ffmpeg -f rtsp -i rtsp://192.168.0.X:6554/doorbell` to setup the underlying SIP call and view the camera. + +There is also two more endpoints: -This allows you to use `ffplay -f sdp -i tcp://192.168.0.XX:8081` or `ffmpeg -f sdp -i tcp://192.168.XX:8081` to setup the underlying SIP call and view the camera. +* `rtsp://192.168.0.X:6554/doorbell-video` is a video only stream (no audio) +* `rtsp://192.168.0.X:6554/doorbell-recorder` is used internally for HKSV recordings You can use the Home Assistant add-on or integration at https://github.com/AlexxIT/WebRTC to add a WebRTC card to your dashboard. @@ -262,17 +277,25 @@ You can add a stream to the Bticino intercom by specifying the following `go2rtc ``` streams: doorbell: - - "ffmpeg:tcp://192.168.0.XX:8081#video=copy#audio=pcma" + - "ffmpeg:rtsp://192.168.0.20:6554/doorbell#video=copy#audio=pcma" - "exec:ffmpeg -re -fflags nobuffer -f alaw -ar 8000 -i - -ar 8000 -acodec speex -f rtp -payload_type 97 rtp://192.168.0.XX:40004#backchannel=1" ``` -The `ffmpeg:tcp://192.168.0.XX:8081#video=copy#audio=pcma"` line talks to the SDP server inside the c300-controller and will setup a SIP call in the background. +The `ffmpeg:rtsp://192.168.0.20:6554/doorbell#video=copy#audio=pcma"` line talks to the RTSP server inside the c300-controller and will setup a SIP call in the background. The options `#video=copy#audio=pcma` tell go2rtc to copy the `h264` and transcode the audio (from `speex`) to `pcma` The `exec:ffmpeg ...` line specifies the `backchannel`. This is the stream from your (browser) microphone towards the intercom. It will read the microphone data from the websocket and transcode it to `speex` and send it the intercom using `rtp`. The port `40004` is the port of the UDP proxy inside the c300-controller. +In `go2rtc.yaml` you might also want to configure the location of the `ffmpeg` binary if you need a more recent version. +Be aware that some `ffmpeg` binaries don't support the `speex` library. + +``` +ffmpeg: + bin: /home/hass/ffmpeg-linux-x64 # path to ffmpeg binary +``` + The WebRTC card configuration looks like this: ``` @@ -329,6 +352,30 @@ At the moment the Bridge exposes: * Mute/unmute switch * Voicemail switch (C300X only) +In addition to the bridge it will also expose a doorbell in standalone accessory mode. + +The PIN code to pair is shown in the console or in the file `config-homekit.json` after startup in the `videoConfig` section. + +You can tweak the `videoConfig` settings to change: + +* The thumbnail displayed in Homekit with `stillImageSource` + * A static image: `-i https://iili.io/JZq8pwB.jpg` + * A snapshot from the video only stream: `-i rtsp://127.0.0.1:6554/doorbell-video` +* A video filter with `videoFilter`, defaults to `select=gte(n\,6)` which is the 6th frame from the stream +* Enable/disable `Homekit Secure Video` recordings with `hksv` +* Enable debugging of the video streams with `debug` +* Enable debugging of the return audio with `debugReturn` + +Since version 2024.7.1 - you can enable `hksv` in the `videoConfig` section. This will enable Homekit recordings when someone rings the doorbell. + +To use Homekit Secure Video you need an Apple Tv 2nd Gen (wired) or Homepod. + +Once you enable the flag and started the Homekit bundle, you should be able to pair the camera and receive options to record the stream. + +Make sure you set Motion Detection to `Any motion detected`. + +When somebody rings your doorbell, a motion clip will be recorded. There will be no audio recorded, just video. + ## Development For development, open an ssh connection to you intercom and forward the `openwebnet` port. diff --git a/bundles/ffmpeg.ts b/bundles/ffmpeg.ts index 9bfb33e..6fe28ee 100644 --- a/bundles/ffmpeg.ts +++ b/bundles/ffmpeg.ts @@ -1,5 +1,5 @@ // Adapted from https://github.com/Sunoo/homebridge-camera-ffmpeg/blob/master/src/ffmpeg.ts -import child_process, { ChildProcessWithoutNullStreams, spawn } from 'child_process'; +import child_process, { ChildProcess, ChildProcessWithoutNullStreams, spawn } from 'child_process'; import os from 'os'; import fs from 'fs'; import path from 'path'; @@ -90,6 +90,10 @@ function checkCorrupted(ffmpeg) { } } +export async function sleep(ms: number) { + await new Promise(resolve => setTimeout(resolve, ms)); +} + export function fetchFffmpeg(pathName) { const platform_arch = process.platform + '-' + process.arch const ffmpeg = path.join(pathName, "ffmpeg") @@ -120,6 +124,35 @@ export function fetchFffmpeg(pathName) { return ffmpeg } +export async function safeKillFFmpeg(cp: ChildProcess) { + if (!cp) + return; + if (cp.exitCode != null) + return; + await new Promise(async resolve => { + cp.on('exit', resolve); + // this will allow ffmpeg to send rtsp TEARDOWN etc + try { + cp.stdin.on('error', () => { }); + cp.stdin.write('q\n'); + } + catch (e) { + } + + await sleep(2000); + for (const f of cp.stdio) { + try { + f?.destroy(); + } + catch (e) { + } + } + cp.kill(); + await sleep(2000); + cp.kill('SIGKILL'); + }); +} + export class FfmpegProcess { private readonly process: ChildProcessWithoutNullStreams; private killTimeout?: NodeJS.Timeout; diff --git a/bundles/homekit-camera-recording.ts b/bundles/homekit-camera-recording.ts index 42c8393..b31289d 100644 --- a/bundles/homekit-camera-recording.ts +++ b/bundles/homekit-camera-recording.ts @@ -1,20 +1,331 @@ -import { CameraRecordingConfiguration, CameraRecordingDelegate, HDSProtocolSpecificErrorReason, RecordingPacket } from "hap-nodejs"; +import { Accessory, AudioRecordingCodecType, AudioRecordingSamplerate, CameraRecordingConfiguration, CameraRecordingDelegate, Characteristic, DoorbellController, H264Level, H264Profile, HDSProtocolSpecificErrorReason, RecordingPacket, Service, VideoCodecType } from "hap-nodejs"; +import { Logger } from "./homekit-logger"; +import { VideoConfig } from "./homekit-camera"; +import { once } from "events"; +import { AddressInfo, createServer, Server, Socket } from "net"; +import { ChildProcess, spawn } from "child_process"; +import assert from "assert"; +import { safeKillFFmpeg } from "./ffmpeg"; + +// Local testing: ./ffmpeg -re -f lavfi -i "color=red:size=688x480:rate=15" -f lavfi -i "sine=frequency=1000:b=4" -profile:v baseline -preset ultrafast -g 60 -vcodec libx264 -an -tune zerolatency -f rtp "rtp://127.0.0.1:10002" -acodec speex -ar 8000 -vn -payload_type 110 -f rtp "rtp://127.0.0.1:10000" + +interface MP4Atom { + header: Buffer; + length: number; + type: string; + data: Buffer; +} + +class MP4StreamingServer { + readonly server: Server; + + /** + * This can be configured to output ffmpeg debug output! + */ + debugMode: boolean = false; + + readonly ffmpegPath: string; + readonly args: string[]; + + socket?: Socket; + childProcess?: ChildProcess; + destroyed = false; + + connectPromise: Promise; + connectResolve?: () => void; + + constructor( debugMode : boolean, ffmpegPath: string, ffmpegInput: Array, audioOutputArgs: Array, videoOutputArgs: Array) { + this.debugMode = debugMode + this.connectPromise = new Promise(resolve => this.connectResolve = resolve); + + this.server = createServer(this.handleConnection.bind(this)); + this.ffmpegPath = ffmpegPath; + this.args = []; + + this.args.push(...ffmpegInput); + + this.args.push(...audioOutputArgs); + + this.args.push("-f", "mp4"); + this.args.push(...videoOutputArgs); + this.args.push("-fflags", + "+genpts", + "-reset_timestamps", + "1"); + this.args.push( + //"-movflags", "frag_keyframe+empty_moov+default_base_moof", + "-movflags", "frag_keyframe+empty_moov+default_base_moof+skip_sidx+skip_trailer", + ); + } + + async start() { + const promise = once(this.server, "listening"); + this.server.listen(); // listen on random port + await promise; + + if (this.destroyed) { + return; + } + + const port = (this.server.address() as AddressInfo).port; + this.args.push("tcp://127.0.0.1:" + port); + + console.log(this.ffmpegPath + " " + this.args.join(" ")); + + this.childProcess = spawn(this.ffmpegPath, this.args, { env: process.env, stdio: this.debugMode? "pipe": "ignore" }); + if (!this.childProcess) { + console.error("ChildProcess is undefined directly after the init!"); + } + if(this.debugMode) { + this.childProcess.stdout?.on("data", data => console.log(data.toString())); + this.childProcess.stderr?.on("data", data => console.log(data.toString())); + } + } + + destroy() { + safeKillFFmpeg(this.childProcess) + this.socket?.destroy(); + //this.childProcess?.kill(); + + this.socket = undefined; + this.childProcess = undefined; + this.destroyed = true; + } + + handleConnection(socket: Socket): void { + this.server.close(); // don't accept any further clients + this.socket = socket; + this.connectResolve?.(); + } + + /** + * Generator for `MP4Atom`s. + * Throws error to signal EOF when socket is closed. + */ + async* generator(): AsyncGenerator { + await this.connectPromise; + + if (!this.socket || !this.childProcess) { + console.log("Socket undefined " + !!this.socket + " childProcess undefined " + !!this.childProcess); + throw new Error("Unexpected state!"); + } + + while (true) { + const header = await this.read(8); + const length = header.readInt32BE(0) - 8; + const type = header.slice(4).toString(); + const data = await this.read(length); + + yield { + header: header, + length: length, + type: type, + data: data, + }; + } + } + + async read(length: number): Promise { + if (!this.socket) { + throw Error("FFMPEG tried reading from closed socket!"); + } + + if (!length) { + return Buffer.alloc(0); + } + + const value = this.socket.read(length); + if (value) { + return value; + } + + return new Promise((resolve, reject) => { + const readHandler = () => { + const value = this.socket!.read(length); + if (value) { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + cleanup(); + resolve(value); + } + }; + + const endHandler = () => { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + cleanup(); + reject(new Error(`FFMPEG socket closed during read for ${length} bytes!`)); + }; + + const cleanup = () => { + this.socket?.removeListener("readable", readHandler); + this.socket?.removeListener("close", endHandler); + }; + + if (!this.socket) { + throw new Error("FFMPEG socket is closed now!"); + } + + this.socket.on("readable", readHandler); + this.socket.on("close", endHandler); + }); + } + } export class RecordingDelegate implements CameraRecordingDelegate { + private controller : DoorbellController + private readonly log: Logger = new Logger() + private configuration: CameraRecordingConfiguration; + private handlingStreamingRequest = false; + private server?: MP4StreamingServer; + + + constructor(private videoConfig : VideoConfig, private camera : Accessory) { + } + updateRecordingActive(active: boolean): void { - throw new Error("Method not implemented."); + this.log.debug(`Recording: ${active}`, this.videoConfig.displayName); } - updateRecordingConfiguration(configuration: CameraRecordingConfiguration): void { - throw new Error("Method not implemented."); + updateRecordingConfiguration(newConfiguration: CameraRecordingConfiguration): void { + this.configuration = newConfiguration; } - handleRecordingStreamRequest(streamId: number): AsyncGenerator { - throw new Error("Method not implemented."); + async *handleRecordingStreamRequest(streamId: number): AsyncGenerator { + assert(!!this.configuration); + /** + * With this flag you can control how the generator reacts to a reset to the motion trigger. + * If set to true, the generator will send a proper endOfStream if the motion stops. + * If set to false, the generator will run till the HomeKit Controller closes the stream. + * + * Note: In a real implementation you would most likely introduce a bit of a delay. + */ + const STOP_AFTER_MOTION_STOP = false; + + this.handlingStreamingRequest = true; + + assert(this.configuration.videoCodec.type === VideoCodecType.H264); + + const profile = this.configuration.videoCodec.parameters.profile === H264Profile.HIGH ? "high" + : this.configuration.videoCodec.parameters.profile === H264Profile.MAIN ? "main" : "baseline"; + + const level = this.configuration.videoCodec.parameters.level === H264Level.LEVEL4_0 ? "4.0" + : this.configuration.videoCodec.parameters.level === H264Level.LEVEL3_2 ? "3.2" : "3.1"; + + /* + const videoArgs: Array = [ + "-an", + "-sn", + "-dn", + "-codec:v", + "libx264", + "-pix_fmt", + "yuv420p", + + "-profile:v", profile, + "-level:v", level, + "-preset", "ultrafast", + "-g", "15", + "-b:v", `${this.configuration.videoCodec.parameters.bitRate}k`, + //"-force_key_frames", `expr:eq(t,n_forced*${this.configuration.videoCodec.parameters.iFrameInterval / 1000})`, + "-r", this.configuration.videoCodec.resolution[2].toString(), + //"-r", "15" + ]; + */ + + + //const videoArgs : Array = [ "-sn", "-dn", "-codec:v", "libx264", "-preset", "ultrafast", "-g", "60" ] + const videoArgs : Array = [ "-sn", "-dn", "-codec:v", "copy" ] + + let samplerate: string; + switch (this.configuration.audioCodec.samplerate) { + case AudioRecordingSamplerate.KHZ_8: + samplerate = "8"; + break; + case AudioRecordingSamplerate.KHZ_16: + samplerate = "16"; + break; + case AudioRecordingSamplerate.KHZ_24: + samplerate = "24"; + break; + case AudioRecordingSamplerate.KHZ_32: + samplerate = "32"; + break; + case AudioRecordingSamplerate.KHZ_44_1: + samplerate = "44.1"; + break; + case AudioRecordingSamplerate.KHZ_48: + samplerate = "48"; + break; + default: + throw new Error("Unsupported audio samplerate: " + this.configuration.audioCodec.samplerate); + } + + const audioArgs: Array = this.controller?.recordingManagement?.recordingManagementService.getCharacteristic(Characteristic.RecordingAudioActive) + ? [ + "-acodec", "libfdk_aac", + ...(this.configuration.audioCodec.type === AudioRecordingCodecType.AAC_LC ? + ["-profile:a", "aac_low"] : + ["-profile:a", "aac_eld"]), + "-ar", `${samplerate}k`, + "-b:a", `${this.configuration.audioCodec.bitrate}k`, + "-ac", `${this.configuration.audioCodec.audioChannels}`, + ] + : []; + + this.server = new MP4StreamingServer( + this.videoConfig.debug, + this.videoConfig.$internalVideoProcessor, + ('-f rtsp ' + this.videoConfig.source + '-recorder' ).split(/\s+/g), + audioArgs, + videoArgs, + ); + + await this.server.start(); + if (!this.server || this.server.destroyed) { + return; // early exit + } + + const pending: Array = []; + + try { + for await (const box of this.server.generator()) { + pending.push(box.header, box.data); + + const motionDetected = this.camera.getService(Service.MotionSensor)?.getCharacteristic(Characteristic.MotionDetected).value; + + console.log("mp4 box type " + box.type + " and length " + box.length + " motion: " + motionDetected); + if (box.type === "moov" || box.type === "mdat") { + const fragment = Buffer.concat(pending); + pending.splice(0, pending.length); + + const isLast = STOP_AFTER_MOTION_STOP && !motionDetected; + + yield { + data: fragment, + isLast: isLast, + }; + + if (isLast) { + console.log("Ending session due to motion stopped!"); + break; + } + } + } + } catch (error) { + if (!error.message.startsWith("FFMPEG")) { // cheap way of identifying our own emitted errors + console.error("Encountered unexpected error on generator " + error.stack); + } + } } acknowledgeStream?(streamId: number): void { - throw new Error("Method not implemented."); + this.closeRecordingStream(streamId) } - closeRecordingStream(streamId: number, reason: HDSProtocolSpecificErrorReason): void { - throw new Error("Method not implemented."); + closeRecordingStream(streamId: number, reason?: HDSProtocolSpecificErrorReason): void { + if (this.server) { + this.server.destroy(); + this.server = undefined; + } + this.handlingStreamingRequest = false; } + setController( controller : DoorbellController ) { + this.controller = controller + } } \ No newline at end of file diff --git a/bundles/homekit-camera.ts b/bundles/homekit-camera.ts index 4566c26..301b826 100644 --- a/bundles/homekit-camera.ts +++ b/bundles/homekit-camera.ts @@ -1,10 +1,10 @@ // Adapted from https://github.com/Sunoo/homebridge-camera-ffmpeg/blob/master/src/streamingDelegate.ts -import { SnapshotRequest, SnapshotRequestCallback, PrepareStreamCallback, PrepareStreamRequest, StreamRequestCallback, StreamingRequest, CameraStreamingDelegate, PrepareStreamResponse, StreamRequestTypes, AudioStreamingCodecType, StartStreamRequest, VideoInfo, H264Profile, H264Level, AudioStreamingSamplerate, DoorbellController, DoorbellOptions, CameraControllerOptions } from 'hap-nodejs'; +import { SnapshotRequest, SnapshotRequestCallback, PrepareStreamCallback, PrepareStreamRequest, StreamRequestCallback, StreamingRequest, CameraStreamingDelegate, PrepareStreamResponse, StreamRequestTypes, AudioStreamingCodecType, StartStreamRequest, VideoInfo, DoorbellController, ResourceRequestReason } from 'hap-nodejs'; import { spawn } from 'child_process'; import { CameraController, SRTPCryptoSuites } from 'hap-nodejs'; import pickPort, { pickPortOptions } from 'pick-port'; import { createSocket, Socket } from 'dgram'; -import { FfmpegProcess } from './ffmpeg'; +import { FfmpegProcess, safeKillFFmpeg } from './ffmpeg'; import { Logger } from './homekit-logger'; export type VideoConfig = { @@ -29,6 +29,7 @@ export type VideoConfig = { debugReturn?: boolean; videoProcessor?: string; $internalVideoProcessor: string; + hksv: boolean username?: string; pinCode: string; displayName: string; @@ -67,70 +68,28 @@ type ActiveSession = { }; export class StreamingDelegate implements CameraStreamingDelegate { - private readonly log: Logger; + private readonly log: Logger = new Logger() private readonly cameraName: string; private readonly unbridge: boolean; private readonly videoConfig: VideoConfig; private readonly videoProcessor: string; - readonly controller: DoorbellController; + controller: DoorbellController; private snapshotPromise?: Promise; // keep track of sessions pendingSessions: Map = new Map(); ongoingSessions: Map = new Map(); timeouts: Map = new Map(); - - constructor(videoConfig: VideoConfig) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types - this.log = new Logger(); - + constructor(videoConfig: VideoConfig) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types this.cameraName = videoConfig.displayName; this.unbridge = true; this.videoConfig = videoConfig!; this.videoProcessor = videoConfig.videoProcessor || videoConfig.$internalVideoProcessor; - - const options: CameraControllerOptions & DoorbellOptions = { - cameraStreamCount: this.videoConfig.maxStreams || 2, // HomeKit requires at least 2 streams, but 1 is also just fine - delegate: this, - streamingOptions: { - supportedCryptoSuites: [SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80], - video: { - resolutions: [ - [320, 180, 30], - [320, 240, 15], // Apple Watch requires this configuration - [320, 240, 30], - [480, 270, 30], - [480, 360, 30], - [640, 360, 30], - [640, 480, 30], - [1280, 720, 30], - [1280, 960, 30], - [1920, 1080, 30], - [1600, 1200, 30] - ], - codec: { - profiles: [H264Profile.BASELINE, H264Profile.MAIN, H264Profile.HIGH], - levels: [H264Level.LEVEL3_1, H264Level.LEVEL3_2, H264Level.LEVEL4_0] - } - }, - audio: { - twoWayAudio: !!this.videoConfig.returnAudioTarget, - codecs: [ - { - type: AudioStreamingCodecType.AAC_ELD, - samplerate: AudioStreamingSamplerate.KHZ_16 - //type: AudioStreamingCodecType.OPUS, - //samplerate: AudioStreamingSamplerate.KHZ_24 - } - ] - } - }, - //TODO: HKSV - //recording: {}, - //sensors: {} - }; - - this.controller = new DoorbellController(options); + } + + setController( controller : DoorbellController ) { + this.controller = controller } private determineResolution(request: SnapshotRequest | VideoInfo, isSnapshot: boolean): ResolutionInfo { @@ -173,7 +132,6 @@ export class StreamingDelegate implements CameraStreamingDelegate { fetchSnapshot(snapFilter?: string): Promise { const stillImageSourceCacheTime = this.videoConfig.stillImageSourceCacheTime || (5 * 60 * 1000) this.snapshotPromise = new Promise((resolve, reject) => { - const t = setTimeout(() => reject(new Error("Operation timed out creating snapshot")), 6000); const startTime = Date.now(); const ffmpegArgs = (this.videoConfig.stillImageSource || this.videoConfig.source!) + // Still ' -frames:v 1' + @@ -184,7 +142,10 @@ export class StreamingDelegate implements CameraStreamingDelegate { this.log.debug('Snapshot command: ' + this.videoProcessor + ' ' + ffmpegArgs, this.cameraName, this.videoConfig.debug); const ffmpeg = spawn(this.videoProcessor, ffmpegArgs.split(/\s+/), { env: process.env }); - + const t = setTimeout(() => { + safeKillFFmpeg(ffmpeg) + reject(new Error("Operation timed out creating snapshot")) + } , 6000); let snapshotBuffer = Buffer.alloc(0); ffmpeg.stdout.on('data', (data) => { snapshotBuffer = Buffer.concat([snapshotBuffer, data]); @@ -261,12 +222,13 @@ export class StreamingDelegate implements CameraStreamingDelegate { const resolution = this.determineResolution(request, true); try { - const cachedSnapshot = !!this.snapshotPromise; - - if(request.reason) { - console.log('snapshot requested for reason:', request.reason); + const reason = request.reason === ResourceRequestReason.EVENT ? 'event' : 'periodic'; + if( reason === 'event' ) { + this.snapshotPromise = undefined } + const cachedSnapshot = !!this.snapshotPromise; + const now = Date.now() //this.log.debug('Snapshot requested: ' + request.width + ' x ' + request.height, diff --git a/bundles/homekit-manager.ts b/bundles/homekit-manager.ts index 08ed92b..20dd68a 100644 --- a/bundles/homekit-manager.ts +++ b/bundles/homekit-manager.ts @@ -6,12 +6,13 @@ // This file is subjected to change without backwards compatibility and probably needs heavy refactoring // -import {Accessory, Bridge, Categories, Characteristic, Service, HAPStorage, uuid, CharacteristicEventTypes} from 'hap-nodejs' +import {Accessory, Bridge, Categories, Characteristic, Service, HAPStorage, uuid, CharacteristicEventTypes, DoorbellController, AudioRecordingCodecType, AudioRecordingSamplerate, AudioStreamingCodecType, AudioStreamingSamplerate, CameraControllerOptions, DoorbellOptions, H264Level, H264Profile, MediaContainerType, SRTPCryptoSuites, VideoCodecType, Resolution, MDNSAdvertiser} from 'hap-nodejs' import { randomBytes } from 'crypto'; import { StreamingDelegate, VideoConfig } from './homekit-camera'; -//import { RecordingDelegate } from './homekit-camera-recording'; import { fetchFffmpeg } from './ffmpeg'; import EventBus from '../lib/eventbus'; +import { RecordingDelegate } from './homekit-camera-recording'; +import { Doorbell } from 'hap-nodejs/dist/lib/definitions'; const MANUFACTURER = "c300x-controller" let BUILDNUMBER = "0.0.0" @@ -154,6 +155,7 @@ export function randomPinCode() { export class HomekitManager { bridge: Bridge + doorbell: Accessory constructor( private eventbus : EventBus, base_path : string, config, videoConfig: VideoConfig, buildNumber : string, model : string) { HAPStorage.setCustomStoragePath( base_path + "/storage") @@ -167,6 +169,7 @@ export class HomekitManager { console.log("Bridge pairing code: " + config.pinCode) this.bridge.publish({ + advertiser: MDNSAdvertiser.CIAO, username: config.username, pincode: config.pinCode, category: Categories.BRIDGE, @@ -174,22 +177,37 @@ export class HomekitManager { }); } addDoorbell(videoConfig: VideoConfig) { - const accessory = new Accessory(videoConfig.displayName, uuid.generate('hap-nodejs:accessories:doorbell:' + videoConfig.displayName)); - setAccessoryInformation(accessory) + this.doorbell = new Accessory(videoConfig.displayName, uuid.generate('hap-nodejs:accessories:doorbell:' + videoConfig.displayName)); + setAccessoryInformation(this.doorbell) const streamingDelegate = new StreamingDelegate(videoConfig) - //TODO: HKSV - //const recordingDelegate = new RecordingDelegate() + const recordingDelegate = new RecordingDelegate(videoConfig, this.doorbell) + const motionSensor = this.doorbell.addService(Service.MotionSensor) + const controller = new DoorbellController(this.getCameraControllerOptions(videoConfig, this.doorbell, streamingDelegate, recordingDelegate)); + + streamingDelegate.setController( controller ) + recordingDelegate.setController( controller ) + + this.doorbell.configureController(controller); - accessory.configureController(streamingDelegate.controller); + const doorbellService = this.doorbell.getService(Service.Doorbell); this.eventbus.on('homekit:pressed', () => { - console.log("HOMEKIT PRESSED EVENT") - const doorbellService = accessory.getService(Service.Doorbell); - doorbellService.getCharacteristic(Characteristic.ProgrammableSwitchEvent).updateValue(Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS); + console.log("HOMEKIT PRESSED EVENT AT: " + Date()) + doorbellService.getCharacteristic(Characteristic.ProgrammableSwitchEvent).updateValue(Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS); }) - accessory.publish({ + this.eventbus.on('homekit:motion', (motionTime) => { + console.log("HOMEKIT MOTION EVENT AT: " + Date()) + motionSensor.getCharacteristic(Characteristic.MotionDetected).updateValue(true); + setTimeout( () => { + console.log("SET FALSE AT: " + Date()) + motionSensor.getCharacteristic(Characteristic.MotionDetected).updateValue(false); + }, motionTime || 20000 ) + }) + + this.doorbell.publish({ + advertiser: MDNSAdvertiser.CIAO, username: videoConfig.username, pincode: videoConfig.pinCode, category: Categories.VIDEO_DOORBELL, @@ -197,7 +215,7 @@ export class HomekitManager { console.log('Camera pairing code: ' + videoConfig.pinCode); return { - doorbell: accessory, + doorbell: this.doorbell, streamingDelegate } } @@ -225,8 +243,87 @@ export class HomekitManager { updateFirmwareVersion(version) { FIRMWAREVERSION = version setAccessoryInformation(this.bridge) + setAccessoryInformation(this.doorbell) this.bridge.bridgedAccessories.forEach( (accessory) => { setAccessoryInformation(accessory) } ) } + getCameraControllerOptions(videoConfig: VideoConfig, accesorry: Accessory, streamingDelegate : StreamingDelegate, recordingDelegate : RecordingDelegate) { + const hksv = videoConfig.hksv || true + const resolutions : Resolution[] = [ + [320, 180, 30], + [320, 240, 15], // Apple Watch requires this configuration + [320, 240, 30], + [480, 270, 30], + [480, 360, 30], + [640, 360, 30], + [640, 480, 30], + [1280, 720, 30], + [1280, 960, 30], + [1920, 1080, 30], + [1600, 1200, 30] + ] + const options: CameraControllerOptions & DoorbellOptions = { + cameraStreamCount: videoConfig.maxStreams || 2, // HomeKit requires at least 2 streams, but 1 is also just fine + delegate: streamingDelegate, + streamingOptions: { + supportedCryptoSuites: [SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80], + video: { + resolutions: resolutions, + codec: { + profiles: [H264Profile.BASELINE, H264Profile.MAIN, H264Profile.HIGH], + levels: [H264Level.LEVEL3_1, H264Level.LEVEL3_2, H264Level.LEVEL4_0] + } + }, + audio: { + twoWayAudio: !!videoConfig.returnAudioTarget, + codecs: [ + { + type: AudioStreamingCodecType.AAC_ELD, + samplerate: AudioStreamingSamplerate.KHZ_16 + //type: AudioStreamingCodecType.OPUS, + //samplerate: AudioStreamingSamplerate.KHZ_24 + } + ] + } + }, + recording: hksv + ? { + options: { + prebufferLength: 4000, + mediaContainerConfiguration: [ + { + type: MediaContainerType.FRAGMENTED_MP4, + fragmentLength: 4000, + }, + ], + video: { + type: VideoCodecType.H264, + parameters: { + profiles: [H264Profile.BASELINE, H264Profile.MAIN, H264Profile.HIGH], + levels: [H264Level.LEVEL3_1, H264Level.LEVEL3_2, H264Level.LEVEL4_0], + }, + resolutions: resolutions, + }, + audio: { + codecs: { + type: AudioRecordingCodecType.AAC_LC, + samplerate: AudioRecordingSamplerate.KHZ_24, + bitrateMode: 0, + audioChannels: 1, + }, + }, + }, + delegate: recordingDelegate as RecordingDelegate, + } + : undefined, + sensors: hksv + ? { + motion: accesorry.getService(Service.MotionSensor), + occupancy: undefined, + } + : undefined, + }; + return options + } } \ No newline at end of file diff --git a/controller-homekit.js b/controller-homekit.js index 69e9dc1..4204ba6 100644 --- a/controller-homekit.js +++ b/controller-homekit.js @@ -36,9 +36,10 @@ const videoConfig = filestore.read('videoConfig', () => { vcodec: 'copy', source: '-i rtsp://127.0.0.1:6554/doorbell', // or -i rtsp://192.168.0.XX:6554/doorbell in development audio: true, - stillImageSource: '-i https://iili.io/JZq8pwB.jpg', + stillImageSource: '-i rtsp://127.0.0.1:6554/doorbell-video', debug: false, debugReturn: false, + hksv: true, videoFilter: "select=gte(n\\,6)", // select frame 6 from the stream for the snapshot image, previous frames may contain invalid images returnAudioTarget: "-codec:a speex -ar 8000 -ac 1 -f rtp -payload_type 97 rtp://127.0.0.1:4000" // or rtp://192.168.0.XX:40004 in development } @@ -134,10 +135,12 @@ const homekit = new class Api { if(q.press === "true") { base.eventbus.emit('homekit:pressed') } + if(q.motion === "true") { + base.eventbus.emit('homekit:motion', q.motionTime) + } if(q.thumbnail === "true") { if(!q.raw || q.raw !== "true" ) { - response.write("
call this endpoing with &raw=true") - + response.write("
Call this url with &raw=true") } else { const request = {} if(q.refresh === 'true'){ diff --git a/controller-webrtc.js b/controller-webrtc.js index de7f70a..1a89f83 100755 --- a/controller-webrtc.js +++ b/controller-webrtc.js @@ -11,4 +11,4 @@ const utils = require('./lib/utils') utils.verifyFlexisip('webrtc@' + utils.domain()).forEach( (e) => console.error( `* ${e}`) ) -rtspserver.create(base.registry) \ No newline at end of file +rtspserver.create(base.registry, base.eventbus) \ No newline at end of file diff --git a/lib/endpoint-registry.js b/lib/endpoint-registry.js index bc43d8d..54f0f24 100644 --- a/lib/endpoint-registry.js +++ b/lib/endpoint-registry.js @@ -62,10 +62,10 @@ class EndpointRegistry { } #foreachEndpointIp(fun) { - let items = new Map() + const items = new Map() this.#endpoints.forEach((v, k) => { - let ip = k.split("@")[2]; - if (!items.get(ip)) { + const ip = k.split("@")[2]; + if ( ip && !items.get(ip)) { console.log("Adding ENDPOINT IP: " + ip) items.set(ip, v) } diff --git a/lib/homekit/homekit-bundle.js b/lib/homekit/homekit-bundle.js index 336f5cb..d773428 100644 --- a/lib/homekit/homekit-bundle.js +++ b/lib/homekit/homekit-bundle.js @@ -1,9 +1,9 @@ // ======================================================================================================================= // DO NOT EDIT, this is a generated file, generate it with $ npm run build:homekitbundle:dev or npm run build:homekitbundle:prod // ======================================================================================================================= -(()=>{var e={141:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CiaoService=t.InternalServiceEvent=t.ServiceEvent=t.ServiceState=t.ServiceType=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(4434),s=i.__importDefault(r(9278)),c=r(1360),u=r(4495),l=r(6343),h=r(482),d=r(8225),p=r(1576),f=r(5231),m=r(8318),g=r(8937),v=r(7585),y=i.__importStar(r(9152)),C=r(9152),S=(0,o.default)("ciao:CiaoService"),E=/^(.*) \((\d+)\)$/,_=/^(.*)-\((\d+)\)(\.\w{2,}.)$/;var T,A,I,D;!function(e){e.AIRDROP="airdrop",e.AIRPLAY="airplay",e.AIRPORT="airport",e.COMPANION_LINK="companion-link",e.DACP="dacp",e.HAP="hap",e.HOMEKIT="homekit",e.HTTP="http",e.HTTP_ALT="http_alt",e.IPP="ipp",e.IPPS="ipps",e.RAOP="raop",e.scanner="scanner",e.TOUCH_ABLE="touch-able",e.DNS_SD="dns-sd",e.PRINTER="printer"}(T||(t.ServiceType=T={})),function(e){e.UNANNOUNCED="unannounced",e.PROBING="probing",e.PROBED="probed",e.ANNOUNCING="announcing",e.ANNOUNCED="announced"}(A||(t.ServiceState=A={})),function(e){e.NAME_CHANGED="name-change",e.HOSTNAME_CHANGED="hostname-change"}(I||(t.ServiceEvent=I={})),function(e){e.PUBLISH="publish",e.UNPUBLISH="unpublish",e.REPUBLISH="republish",e.RECORD_UPDATE="records-update",e.RECORD_UPDATE_ON_INTERFACE="records-update-interface"}(D||(t.InternalServiceEvent=D={}));class w extends a.EventEmitter{constructor(e,t){if(super(),this.serviceState="unannounced",this.destroyed=!1,(0,n.default)(e,"networkManager is required"),(0,n.default)(t,"parameters options is required"),(0,n.default)(t.name,"service options parameter 'name' is required"),(0,n.default)(t.type,"service options parameter 'type' is required"),(0,n.default)(t.type.length<=15,"service options parameter 'type' must not be longer than 15 characters"),this.networkManager=e,this.name=t.name,this.type=t.type,this.subTypes=t.subtypes,this.protocol=t.protocol||"tcp",this.serviceDomain=t.domain||"local",this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.typePTR=y.stringify({type:this.type,protocol:this.protocol,domain:this.serviceDomain}),this.loweredTypePTR=(0,v.dnsLowerCase)(this.typePTR),this.subTypes&&(this.subTypePTRs=this.subTypes.map((e=>y.stringify({subtype:e,type:this.type,protocol:this.protocol,domain:this.serviceDomain}))).map(v.dnsLowerCase)),this.hostname=y.formatHostname(t.hostname||this.name,this.serviceDomain).replace(/ /g,"-"),this.loweredHostname=(0,v.dnsLowerCase)(this.hostname),this.port=t.port,t.restrictedAddresses){(0,n.default)(t.restrictedAddresses.length,"The service property 'restrictedAddresses' cannot be an empty array!"),this.restrictedAddresses=new Map;for(const e of t.restrictedAddresses)if(s.default.isIP(e)){if("0.0.0.0"===e||"::"===e)throw new Error(`[${this.fqdn}] Unspecified ip address (${e}) cannot be used to restrict on to!`);const t=g.NetworkManager.resolveInterface(e);if(!t)throw new Error(`[${this.fqdn}] Could not restrict service to address ${e} as we could not resolve it to an interface name!`);const r=this.restrictedAddresses.get(t);r?r.length&&!r.includes(e)&&r.push(e):this.restrictedAddresses.set(t,[e])}else this.restrictedAddresses.set(e,[])}this.disableIpv6=t.disabledIpv6,this.txt=t.txt?w.txtBuffersFromRecord(t.txt):[],this.incrementName(!0)}advertise(){return(0,n.default)(!this.destroyed,"Cannot publish destroyed service!"),(0,n.default)(this.port,"Service port must be defined before advertising the service on the network!"),0===this.listeners("name-change").length&&S("[%s] WARN: No listeners found for a potential name change on the 'name-change' event!",this.name),new Promise(((e,t)=>{this.emit("publish",(r=>r?t(r):e()))}))}end(){return(0,n.default)(!this.destroyed,"Cannot end destroyed service!"),"unannounced"===this.serviceState?Promise.resolve():new Promise(((e,t)=>{this.emit("unpublish",(r=>r?t(r):e()))}))}async destroy(){await this.end(),this.destroyed=!0,this.removeAllListeners()}getFQDN(){return this.fqdn}getTypePTR(){return this.typePTR}getLowerCasedSubtypePTRs(){return this.subTypePTRs}getHostname(){return this.hostname}getPort(){return this.port||-1}getTXT(){return this.txt}getLowerCasedFQDN(){return this.loweredFqdn}getLowerCasedTypePTR(){return this.loweredTypePTR}getLowerCasedHostname(){return this.loweredHostname}updateTxt(e,t=!1){if((0,n.default)(!this.destroyed,"Cannot update destroyed service!"),(0,n.default)(e,"txt cannot be undefined"),this.txt=w.txtBuffersFromRecord(e),S("[%s] Updating txt record%s...",this.name,t?" silently":""),"announcing"===this.serviceState){if(this.rebuildServiceRecords(),t)return;this.currentAnnouncer.hasSentLastAnnouncement()&&this.currentAnnouncer.awaitAnnouncement().then((()=>{this.queueTxtUpdate()}))}else if("announced"===this.serviceState){if(this.rebuildServiceRecords(),t)return;this.queueTxtUpdate()}}queueTxtUpdate(){this.txtTimer||(this.txtTimer=setTimeout((()=>{this.txtTimer=void 0,"announced"===this.serviceState&&this.emit("records-update",{answers:[this.txtRecord()],additionals:[this.serviceNSECRecord()]})}),50))}updatePort(e){(0,n.default)("unannounced"===this.serviceState,"Port number cannot be changed when service is already advertised!"),this.port=e}updateName(e){return"unannounced"===this.serviceState?(this.name=e,this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),Promise.resolve()):this.end().then((()=>(this.name=e,this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.advertise())))}static txtBuffersFromRecord(e){const t=[];return Object.entries(e).forEach((([e,r])=>{const i=e+"="+r;t.push(Buffer.from(i))})),t}handleNetworkInterfaceUpdate(e){(0,n.default)(!this.destroyed,"Cannot update network of destroyed service!"),"announced"===this.serviceState?(this.rebuildServiceRecords(),(e.added||e.changes)&&this.emit("republish",(e=>{e&&(console.log("FATAL Error occurred trying to re-announce service "+this.fqdn+"! We can't recover from this!"),console.log(e.stack),process.exit(1))}))):"announcing"===this.serviceState&&(this.rebuildServiceRecords(),this.currentAnnouncer.hasSentLastAnnouncement()&&this.currentAnnouncer.awaitAnnouncement().then((()=>{this.handleNetworkInterfaceUpdate(e)})))}incrementName(e){if("unannounced"!==this.serviceState)throw new Error("Service name can only be incremented when in state UNANNOUNCED!");const t=this.name,r=this.hostname;let i,o,a,s,c;const u=this.name.match(E);u?(i=u[1],o=parseInt(u[2]),(0,n.default)(o,`Failed to extract name number from ${this.name}. Resulted in ${o}`)):(i=this.name,o=1);const l=this.hostname.match(_);if(l)a=l[1],s=l[3],c=parseInt(l[2]),(0,n.default)(c,`Failed to extract hostname number from ${this.hostname}. Resulted in ${c}`);else{const e=this.hostname.substring(0,this.hostname.length-1).lastIndexOf(".");a=this.hostname.slice(0,e),s=this.hostname.slice(e),c=1}e||(o++,c++);const h=Math.max(o,c);this.name=1===h?i:`${i} (${h})`,this.hostname=1===h?`${a}${s}`:`${a}-(${h})${s}`,this.loweredHostname=(0,v.dnsLowerCase)(this.hostname),this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.name===t&&this.hostname===r||S("[%s] Service changed name '%s' -> '%s', '%s' -> '%s'",this.name,t,this.name,r,this.hostname),e||this.rebuildServiceRecords()}informAboutNameUpdates(){const e=this.emit("name-change",this.name),t=this.emit("hostname-change",y.removeTLD(this.hostname));e||t||console.warn(`CIAO: [${this.name}] Service changed name but nobody was listening on the 'name-change' event!`)}formatFQDN(){if("unannounced"!==this.serviceState)throw new Error("Name can't be changed after service was already announced!");const e=y.stringify({name:this.name,type:this.type,protocol:this.protocol,domain:this.serviceDomain});return(0,n.default)(e.length<=255,"A fully qualified domain name cannot be longer than 255 characters"),e}rebuildServiceRecords(){(0,n.default)(this.port,"port must be set before building records"),S("[%s] Rebuilding service records...",this.name);const e={},t={},r={},i={},o={};let a;for(const[n,a]of this.networkManager.getInterfaceMap()){if(!this.advertisesOnInterface(n,!0))continue;let s=this.restrictedAddresses?this.restrictedAddresses.get(n):void 0;s&&0===s.length&&(s=void 0),!a.ipv4||s&&!s.includes(a.ipv4)||(e[n]=new u.ARecord(this.hostname,a.ipv4,!0),o[a.ipv4]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.ipv4),this.hostname)),!a.ipv6||this.disableIpv6||s&&!s.includes(a.ipv6)||(t[n]=new c.AAAARecord(this.hostname,a.ipv6,!0),o[a.ipv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.ipv6),this.hostname)),!a.globallyRoutableIpv6||this.disableIpv6||s&&!s.includes(a.globallyRoutableIpv6)||(r[n]=new c.AAAARecord(this.hostname,a.globallyRoutableIpv6,!0),o[a.globallyRoutableIpv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.globallyRoutableIpv6),this.hostname)),!a.uniqueLocalIpv6||this.disableIpv6||s&&!s.includes(a.uniqueLocalIpv6)||(i[n]=new c.AAAARecord(this.hostname,a.uniqueLocalIpv6,!0),o[a.uniqueLocalIpv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.uniqueLocalIpv6),this.hostname))}if(this.subTypePTRs){a=[];for(const e of this.subTypePTRs)a.push(new h.PTRRecord(e,this.fqdn))}this.serviceRecords={ptr:new h.PTRRecord(this.typePTR,this.fqdn),subtypePTRs:a,metaQueryPtr:new h.PTRRecord(m.Responder.SERVICE_TYPE_ENUMERATION_NAME,this.typePTR),srv:new d.SRVRecord(this.fqdn,this.hostname,this.port,!0),txt:new p.TXTRecord(this.fqdn,this.txt,!0),serviceNSEC:new l.NSECRecord(this.fqdn,this.fqdn,[16,33],4500,!0),a:e,aaaa:t,aaaaR:r,aaaaULA:i,reverseAddressPTRs:o,addressNSEC:new l.NSECRecord(this.hostname,this.hostname,[1,28],120,!0)}}advertisesOnInterface(e,t){var r,i,n,o;return!this.restrictedAddresses||this.restrictedAddresses.has(e)&&(t||!!(null===(r=this.serviceRecords)||void 0===r?void 0:r.a[e])||!!(null===(i=this.serviceRecords)||void 0===i?void 0:i.aaaa[e])||!!(null===(n=this.serviceRecords)||void 0===n?void 0:n.aaaaR[e])||!!(null===(o=this.serviceRecords)||void 0===o?void 0:o.aaaaULA[e]))}ptrRecord(){return this.serviceRecords.ptr.clone()}subtypePtrRecords(){return this.serviceRecords.subtypePTRs?f.ResourceRecord.clone(this.serviceRecords.subtypePTRs):[]}metaQueryPtrRecord(){return this.serviceRecords.metaQueryPtr.clone()}srvRecord(){return this.serviceRecords.srv.clone()}txtRecord(){return this.serviceRecords.txt.clone()}aRecord(e){const t=this.serviceRecords.a[e];return t?t.clone():void 0}aaaaRecord(e){const t=this.serviceRecords.aaaa[e];return t?t.clone():void 0}aaaaRoutableRecord(e){const t=this.serviceRecords.aaaaR[e];return t?t.clone():void 0}aaaaUniqueLocalRecord(e){const t=this.serviceRecords.aaaaULA[e];return t?t.clone():void 0}allAddressRecords(){const e=[];return Object.values(this.serviceRecords.a).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaa).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaaR).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaaULA).forEach((t=>{e.push(t.clone())})),e}addressNSECRecord(){return this.serviceRecords.addressNSEC.clone()}serviceNSECRecord(e=!1){const t=this.serviceRecords.serviceNSEC.clone();return e&&(t.ttl=120),t}hasAddress(e){return!!this.serviceRecords.reverseAddressPTRs[e]}}t.CiaoService=w},2361:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MDNSServer=t.SendResultFormatError=t.SendResultFailedRatio=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=i.__importDefault(r(7194)),s=r(4119),c=r(8937),u=r(9152),l=r(16),h=r(8390),d=(0,o.default)("ciao:MDNSServer");t.SendResultFailedRatio=function(e){if(0===e.length)return 0;let t=0;for(const r of e)"fulfilled"!==r.status&&t++;return t/e.length},t.SendResultFormatError=function(e,t,r=!1){let i=0;for(const t of e)"fulfilled"!==t.status&&i++;if(t||(t="Failed to send packets"),i{console.log("Could not bind detected network interface: "+e.stack)}));e.push(n)}return Promise.all(e).then((()=>{this.bound=!0}))}shutdown(){this.networkManager.shutdown();for(const e of this.sockets.values())e.close();this.bound=!1,this.closed=!0,this.sockets.clear()}sendQueryBroadcast(e,t){const r=s.DNSPacket.createDNSQueryPackets(e);r.length>1&&d("Query broadcast is split into %d packets!",r.length);const i=[];for(const e of r)i.push(this.sendOnAllNetworksForService(e,t));return Promise.all(i).then((e=>{const t=[];for(const r of e)t.concat(r);return t}))}sendResponseBroadcast(e,t){const r=s.DNSPacket.createDNSResponsePacketsFromRRSet(e);return this.sendOnAllNetworksForService(r,t)}sendResponse(e,t,r){this.send(e,t).then((e=>{"rejected"===e.status?r?r(new Error("Encountered socket error on "+e.reason.name+": "+e.reason.message)):p.logSocketError(e.interface,e.reason):r&&r()}))}sendOnAllNetworksForService(e,t){this.checkUnicastResponseFlag(e);const r=e.encode();this.assertBeforeSend(r,"IPv4");const i=[];for(const[e,n]of this.sockets){if(!t.advertisesOnInterface(e))continue;const o=new Promise((t=>{n.send(r,p.MDNS_PORT,p.MULTICAST_IPV4,(i=>{if(i){if(!p.isSilencedSocketError(i))return void t({status:"rejected",interface:e,reason:i})}else this.maintainSentPacketsInterface(e,r);t({status:"fulfilled",interface:e})}))}));i.push(Promise.race([o,(0,h.PromiseTimeout)(p.SEND_TIMEOUT).then((()=>({status:"timeout",interface:e})))]))}return Promise.all(i)}send(e,t){this.checkUnicastResponseFlag(e);const r=e.encode();let i,n,o;this.assertBeforeSend(r,"IPv4"),"string"==typeof t?(i=p.MULTICAST_IPV4,n=p.MDNS_PORT,o=t):(i=t.address,n=t.port,o=t.interface);const a=this.sockets.get(o);if(!a)throw new l.InterfaceNotFoundError(`Could not find socket for given network interface '${o}'`);return new Promise((e=>{a.send(r,n,i,(t=>{if(t){if(!p.isSilencedSocketError(t))return void e({status:"rejected",interface:o,reason:t})}else this.maintainSentPacketsInterface(o,r);e({status:"fulfilled",interface:o})}))}))}checkUnicastResponseFlag(e){this.suppressUnicastResponseFlag&&0===e.type&&e.questions.forEach((e=>e.unicastResponseFlag=!1))}assertBeforeSend(e,t){if(this.closed)throw new l.ServerClosedError("Cannot send packets on a closed mdns server!");(0,n.default)(this.bound,"Cannot send packets before server is not bound!");const r="IPv4"===t?p.DEFAULT_IP4_HEADER:p.DEFAULT_IP6_HEADER;(0,n.default)(r+p.UDP_HEADER+e.length<=9e3,"DNS cannot exceed the size of 9000 bytes even with IP Fragmentation!")}maintainSentPacketsInterface(e,t){const r=t.toString("base64"),i=this.sentPackets.get(e);i?i.push(r):this.sentPackets.set(e,[r])}checkIfPacketWasPreviouslySentFromUs(e,t){const r=t.toString("base64"),i=this.sentPackets.get(e);if(i){const e=i.indexOf(r);if(-1!==e)return i.splice(e,1),!0}return!1}createDgramSocket(e,t=!1,r="udp4"){const i=a.default.createSocket({type:r,reuseAddr:t});return i.on("message",this.handleMessage.bind(this,e)),i.on("error",(t=>{p.isSilencedSocketError(t)||p.logSocketError(e,t)})),i}bindSocket(e,t,r){return new Promise(((i,o)=>{const a=e=>o(new Error("Failed to bind on interface "+t.name+": "+e.message));e.once("error",a),e.on("close",(()=>{this.sockets.delete(t.name)})),e.bind(p.MDNS_PORT,(()=>{e.setRecvBufferSize(819200),e.removeListener("error",a);const s="IPv4"===r?p.MULTICAST_IPV4:p.MULTICAST_IPV6,c="IPv4"===r?t.ipv4:t.ipv6;(0,n.default)(c,"Interface address for "+t.name+" cannot be undefined!");try{e.addMembership(s,c),e.setMulticastInterface(c),e.setMulticastTTL(p.MDNS_TTL),e.setTTL(p.MDNS_TTL),e.setMulticastLoopback(!0),this.sockets.set(t.name,e),i()}catch(r){try{e.close()}catch(e){d("Error while closing socket which failed to bind. Error may be expected: "+e.message)}o(new Error("Error binding socket on "+t.name+": "+r.stack))}}))}))}handleMessage(e,t,r){if(!this.bound)return;const i=this.networkManager.getInterface(e);if(!i)return void d("Received packet on non existing network interface: %s!",e);if(this.checkIfPacketWasPreviouslySentFromUs(i.name,t))return;const n=(0,u.getNetAddress)(r.address,i.ip4Netmask);if(i.loopback){if(n!==i.ipv4Netaddress)return}else if(this.networkManager.isLoopbackNetaddressV4(n))return void d("Received packet on interface '%s' which is not coming from the same subnet: %o",e,{address:r.address,netaddress:n,interface:i.ipv4});let o;try{o=s.DNSPacket.decode(r,t)}catch(i){return void d("Received a malformed packet from %o on interface %s. This might or might not be a problem. Here is the received packet for debugging purposes '%s'. Packet decoding failed with %s",r,e,t.toString("base64"),i.stack)}if(0!==o.opcode)return;if(0!==o.rcode)return;const a={address:r.address,port:r.port,interface:e};if(0===o.type)try{this.handler.handleQuery(o,a)}catch(t){console.warn("Error occurred handling incoming (on "+e+") dns query packet: "+t.stack)}else if(1===o.type){if(r.port!==p.MDNS_PORT)return;try{this.handler.handleResponse(o,a)}catch(t){console.warn("Error occurred handling incoming (on "+e+") dns response packet: "+t.stack)}}}static isSilencedSocketError(e){const t=e.message.includes("EADDRNOTAVAIL")||e.message.includes("EHOSTDOWN")||e.message.includes("ENETUNREACH")||e.message.includes("EHOSTUNREACH")||e.message.includes("EPERM")||e.message.includes("EINVAL");return t&&d("Silenced and ignored error (This is/should not be a problem, this message is only for informational purposes): "+e.message),t}static logSocketError(e,t){console.warn(`Encountered MDNS socket error on socket '${e}' : ${t.stack}`)}handleUpdatedNetworkInterfaces(e){if(e.removed)for(const t of e.removed){const e=this.sockets.get(t.name);this.sockets.delete(t.name),e&&e.close()}if(e.changes)for(const t of e.changes){const e=this.sockets.get(t.name);if((0,n.default)(e,"Couldn't find socket for network change!"),!t.outdatedIpv4&&t.updatedIpv4)n.default.fail("Reached illegal state! IPv4 address changed from undefined to defined!");else if(t.outdatedIpv4&&!t.updatedIpv4)n.default.fail("Reached illegal state! IPV4 address change from defined to undefined!");else if(t.outdatedIpv4&&t.updatedIpv4){try{e.dropMembership(p.MULTICAST_IPV4,t.outdatedIpv4)}catch(e){d("Thrown expected error when dropping outdated address membership: "+e.message)}try{e.addMembership(p.MULTICAST_IPV4,t.updatedIpv4)}catch(e){d("Thrown expected error when adding new address membership: "+e.message)}e.setMulticastInterface(t.updatedIpv4)}}if(e.added)for(const t of e.added){const e=this.createDgramSocket(t.name,!0);this.bindSocket(e,t,"IPv4").catch((e=>{console.log("Could not bind detected network interface: "+e.stack)}))}}}t.MDNSServer=p,p.DEFAULT_IP4_HEADER=20,p.DEFAULT_IP6_HEADER=40,p.UDP_HEADER=8,p.MDNS_PORT=5353,p.MDNS_TTL=255,p.MULTICAST_IPV4="224.0.0.251",p.MULTICAST_IPV6="FF02::FB",p.SEND_TIMEOUT=200},8937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkManager=t.NetworkManagerEvent=t.WifiState=t.IPFamily=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5317)),a=i.__importDefault(r(5753)),s=r(4434),c=i.__importDefault(r(2017)),u=i.__importDefault(r(9278)),l=i.__importDefault(r(857)),h=r(9152),d=(0,a.default)("ciao:NetworkManager");var p,f,m;!function(e){e.IPv4="IPv4",e.IPv6="IPv6"}(p||(t.IPFamily=p={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.NOT_A_WIFI_INTERFACE=1]="NOT_A_WIFI_INTERFACE",e[e.NOT_ASSOCIATED=2]="NOT_ASSOCIATED",e[e.CONNECTED=3]="CONNECTED"}(f||(t.WifiState=f={})),function(e){e.NETWORK_UPDATE="network-update"}(m||(t.NetworkManagerEvent=m={}));class g extends s.EventEmitter{constructor(e){if(super(),this.currentInterfaces=new Map,this.loopbackInterfaces=new Map,this.setMaxListeners(100),e&&e.interface){let t;if("string"==typeof e.interface)t=[e.interface];else{if(!Array.isArray(e.interface))throw new Error("Found invalid type for 'interfaces' NetworkManager option!");t=e.interface}const r=[];for(const i of t)if(u.default.isIP(i)){const t=g.resolveInterface(i);t?r.push(t):console.log("CIAO: Interface was specified as ip (%s), though couldn't find a matching interface for the given address.",e.interface)}else r.push(i);0===r.length?console.log("CIAO: 'restrictedInterfaces' array was empty. Going to fallback to bind on all available interfaces."):this.restrictedInterfaces=r}this.excludeIpv6=!(!e||!e.excludeIpv6),this.excludeIpv6Only=this.excludeIpv6||!(!e||!e.excludeIpv6Only),e&&d("Created NetworkManager with options: %s",JSON.stringify(e)),this.initPromise=new Promise((e=>{this.getCurrentNetworkInterfaces().then((t=>{this.currentInterfaces=t;const r=Object.keys(l.default.networkInterfaces()),i=[];for(const e of this.currentInterfaces.keys()){i.push(e);const t=r.indexOf(e);-1!==t&&r.splice(t,1)}d("Initial networks [%s] ignoring [%s]",i.join(", "),r.join(", ")),this.initPromise=void 0,e(),this.scheduleNextJob()}))}))}async waitForInit(){this.initPromise&&await this.initPromise}shutdown(){this.currentTimer&&(clearTimeout(this.currentTimer),this.currentTimer=void 0),this.removeAllListeners()}getInterfaceMap(){return this.initPromise&&n.default.fail("Not yet initialized!"),this.currentInterfaces}getInterface(e){return this.initPromise&&n.default.fail("Not yet initialized!"),this.currentInterfaces.get(e)}isLoopbackNetaddressV4(e){for(const t of this.loopbackInterfaces.values())if(t.ipv4Netaddress===e)return!0;return!1}scheduleNextJob(){this.currentTimer=setTimeout(this.checkForNewInterfaces.bind(this),g.POLLING_TIME),this.currentTimer.unref()}async checkForNewInterfaces(){const e=await this.getCurrentNetworkInterfaces();if(!this.currentTimer)return;let t,r,i;for(const[r,n]of e){const e=this.currentInterfaces.get(r);if(e){if(!(0,c.default)(e,n)){const t={name:r};e.ipv4!==n.ipv4&&(e.ipv4&&(t.outdatedIpv4=e.ipv4),n.ipv4&&(t.updatedIpv4=n.ipv4)),e.ipv6!==n.ipv6&&(e.ipv6&&(t.outdatedIpv6=e.ipv6),n.ipv6&&(t.updatedIpv6=n.ipv6)),e.globallyRoutableIpv6!==n.globallyRoutableIpv6&&(e.globallyRoutableIpv6&&(t.outdatedGloballyRoutableIpv6=e.globallyRoutableIpv6),n.globallyRoutableIpv6&&(t.updatedGloballyRoutableIpv6=n.globallyRoutableIpv6)),e.uniqueLocalIpv6!==n.uniqueLocalIpv6&&(e.uniqueLocalIpv6&&(t.outdatedUniqueLocalIpv6=e.uniqueLocalIpv6),n.uniqueLocalIpv6&&(t.updatedUniqueLocalIpv6=n.uniqueLocalIpv6)),this.currentInterfaces.set(r,n),n.loopback&&this.loopbackInterfaces.set(r,n),(null!=i?i:i=[]).push(t)}}else this.currentInterfaces.set(r,n),n.loopback&&this.currentInterfaces.set(r,n),(null!=t?t:t=[]).push(n)}if(this.currentInterfaces.size!==e.size)for(const[t,i]of this.currentInterfaces)e.has(t)||(this.currentInterfaces.delete(t),this.loopbackInterfaces.delete(t),(null!=r?r:r=[]).push(i));if(t||r||i){const e=t?t.map((e=>e.name)).join(","):"",n=r?r.map((e=>e.name)).join(","):"",o=i?i.map((e=>{let t=`{ name: ${e.name} `;return(e.outdatedIpv4||e.updatedIpv4)&&(t+=`, ${e.outdatedIpv4} -> ${e.updatedIpv4} `),(e.outdatedIpv6||e.updatedIpv6)&&(t+=`, ${e.outdatedIpv6} -> ${e.updatedIpv6} `),(e.outdatedGloballyRoutableIpv6||e.updatedGloballyRoutableIpv6)&&(t+=`, ${e.outdatedGloballyRoutableIpv6} -> ${e.updatedGloballyRoutableIpv6} `),(e.outdatedUniqueLocalIpv6||e.updatedUniqueLocalIpv6)&&(t+=`, ${e.outdatedUniqueLocalIpv6} -> ${e.updatedUniqueLocalIpv6} `),t+"}"})).join(","):"";d("Detected network changes: added: [%s], removed: [%s], changes: [%s]!",e,n,o),this.emit("network-update",{added:t,removed:r,changes:i})}this.scheduleNextJob()}async getCurrentNetworkInterfaces(){let e;if(this.restrictedInterfaces){e=this.restrictedInterfaces;const t=g.getLoopbackInterface();e.includes(t)||e.push(t)}else try{e=await g.getNetworkInterfaceNames()}catch(t){d(`WARNING Detecting network interfaces for platform '${l.default.platform()}' failed. Trying to assume network interfaces! (${t.message})`),e=g.assumeNetworkInterfaceNames()}const t=new Map,r=l.default.networkInterfaces();for(const i of e){const e=r[i];if(!e)continue;let o,a,s,c,u=!1;for(const t of e){if(t.internal&&(u=!0),"IPv4"!==t.family&&4!==t.family||o){if("IPv6"===t.family||6===t.family){if(this.excludeIpv6)continue;t.scopeid&&!a?a=t:0===t.scopeid&&(t.address.startsWith("fc")||t.address.startsWith("fd")?c||(c=t):s||(s=t))}}else o=t;if(o&&a&&s&&c)break}if((0,n.default)(o||a,"Could not find valid addresses for interface '"+i+"'"),this.excludeIpv6Only&&!o)continue;const l={name:i,loopback:u,mac:(null==o?void 0:o.mac)||(null==a?void 0:a.mac)};o&&(l.ipv4=o.address,l.ip4Netmask=o.netmask,l.ipv4Netaddress=(0,h.getNetAddress)(o.address,o.netmask)),a&&(l.ipv6=a.address,l.ipv6Netmask=a.netmask),s&&(l.globallyRoutableIpv6=s.address,l.globallyRoutableIpv6Netmask=s.netmask),c&&(l.uniqueLocalIpv6=c.address,l.uniqueLocalIpv6Netmask=c.netmask),t.set(i,l)}return t}static resolveInterface(e){let t;e:for(const[r,i]of Object.entries(l.default.networkInterfaces()))for(const n of null!=i?i:[])if(n.address===e){t=r;break e}return t}static async getNetworkInterfaceNames(){let e,t;switch(l.default.platform()){case"win32":e=g.getWindowsNetworkInterfaces();break;case"linux":e=g.getLinuxNetworkInterfaces();break;case"darwin":e=g.getDarwinNetworkInterfaces();break;case"freebsd":e=g.getFreeBSDNetworkInterfaces();break;case"openbsd":case"sunos":e=g.getOpenBSD_SUNOS_NetworkInterfaces();break;default:return d("Found unsupported platform %s",l.default.platform()),Promise.reject(new Error("unsupported platform!"))}try{t=await e}catch(e){if(e.message!==g.NOTHING_FOUND_MESSAGE)throw e;t=[]}const r=g.getLoopbackInterface();return t.includes(r)||t.unshift(r),e}static assumeNetworkInterfaceNames(){const e=[];return Object.entries(l.default.networkInterfaces()).forEach((([t,r])=>{for(const i of null!=r?r:[])if(i.internal||"IPv4"===i.family||4===i.family||("IPv6"===i.family||6===i.family)&&0===i.scopeid){e.includes(t)||e.push(t);break}})),e}static getLoopbackInterface(){for(const[e,t]of Object.entries(l.default.networkInterfaces()))for(const r of null!=t?t:[])if(r.internal)return e;throw new Error("Could not detect loopback interface!")}static getWindowsNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec('arp -a | findstr /C:"---"',((r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e{o.default.exec("arp -a -n -l",(async(r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=1;e{if(1!==t&&3!==t){const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}));a.push(t)}await Promise.all(a),o.length?e(o):t(new Error(g.NOTHING_FOUND_MESSAGE))}))}))}static getLinuxNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec("ip neigh show",((r,i)=>{if(r)return r.message.includes("ip: not found")?(d("LINUX: ip was not found on the system. Falling back to assuming network interfaces!"),void e(g.assumeNetworkInterfaceNames())):void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e=t.length){d(`LINUX: Out of bounds when reading interface name from line ${e}: '${n[e]}'`);continue}const i=t[r+1];i?o.includes(i)||o.push(i):d(`LINUX: Failed to read interface name from line ${e}: '${n[e]}'`)}o.length?e(o):t(new Error(g.NOTHING_FOUND_MESSAGE))}))}))}static getFreeBSDNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec("arp -a -n",((r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e{o.default.exec("arp -a -n",((r,i)=>{if(r)return void t(r);const n="sunos"===l.default.platform()?0:2,o=i.split(l.default.EOL),a=[];for(let e=1;e{o.default.exec("networksetup -getairportnetwork "+e,((r,i)=>{if(r)return i.includes("not a Wi-Fi interface")?void t(1):(console.log(`CIAO WARN: While checking networksetup for ${e} encountered an error (${r.message}) with output: ${i.replace(l.default.EOL,"; ")}`),void t(0));let n=0;i.includes("not a Wi-Fi interface")?n=1:i.includes("Current Wi-Fi Network")?n=3:i.includes("not associated")?n=2:i.includes("All Wi-Fi network services are disabled")?n=1:console.log(`CIAO WARN: While checking networksetup for ${e} encountered an unknown output: ${i.replace(l.default.EOL,"; ")}`),t(n)}))}))}}t.NetworkManager=g,g.SPACE_PATTERN=/\s+/g,g.NOTHING_FOUND_MESSAGE="no interfaces found",g.POLLING_TIME=15e3},4288:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Responder=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(141),s=r(4119),c=r(5682),u=r(1360),l=r(4495),h=r(482),d=r(8225),p=r(1576),f=r(2361),m=r(9983),g=r(2475),v=r(572),y=r(8126),C=r(341),S=r(16),E=r(8390),_=r(5762),T=(0,o.default)("ciao:Responder"),A=(e,t)=>e.estimatedTimeToBeSent-t.estimatedTimeToBeSent;var I;!function(e){e[e.NO_CONFLICT=0]="NO_CONFLICT",e[e.CONFLICTING_RDATA=1]="CONFLICTING_RDATA",e[e.CONFLICTING_TTL=2]="CONFLICTING_TTL"}(I||(I={}));class D{static getResponder(e){const t=e?JSON.stringify(e):"",r=this.INSTANCES.get(t);if(r)return r.refCount++,r;{const r=new D(e);return this.INSTANCES.set(t,r),r.optionsString=t,r}}constructor(e){this.refCount=1,this.optionsString="",this.bound=!1,this.announcedServices=new Map,this.servicePointer=new Map,this.truncatedQueries={},this.delayedMulticastResponses=[],this.server=new f.MDNSServer(this,e),this.promiseChain=this.start(),this.server.getNetworkManager().on("network-update",this.handleNetworkUpdate.bind(this)),this.ignoreUnicastResponseFlag=null==e?void 0:e.ignoreUnicastResponseFlag,(null==e?void 0:e.periodicBroadcasts)&&(this.broadcastInterval=setTimeout(this.handlePeriodicBroadcasts.bind(this),3e4).unref())}handlePeriodicBroadcasts(){this.broadcastInterval=void 0,T("Sending periodic announcement on "+Array.from(this.server.getNetworkManager().getInterfaceMap().keys()).join(", "));for(const e of this.server.getNetworkManager().getInterfaceMap().values()){const t=new c.Question("_hap._tcp.local.",12,!1),r=this.answerQuestion(t,{port:5353,address:e.ipv4Netaddress||e.globallyRoutableIpv6||e.uniqueLocalIpv6||e.ipv6,interface:e.name});v.QueryResponse.combineResponses(r);for(const t of r)t.hasAnswers()&&this.server.sendResponse(t.asPacket(),e.name)}this.broadcastInterval=setTimeout(this.handlePeriodicBroadcasts.bind(this),3e3*Math.random()+27e3).unref()}createService(e){const t=new a.CiaoService(this.server.getNetworkManager(),e);return t.on("publish",this.advertiseService.bind(this,t)),t.on("unpublish",this.unpublishService.bind(this,t)),t.on("republish",this.republishService.bind(this,t)),t.on("records-update",this.handleServiceRecordUpdate.bind(this,t)),t.on("records-update-interface",this.handleServiceRecordUpdateOnInterface.bind(this,t)),t}shutdown(){if(this.refCount--,this.refCount>0)return Promise.resolve();this.currentProber&&this.currentProber.cancel(),this.broadcastInterval&&clearTimeout(this.broadcastInterval),D.INSTANCES.delete(this.optionsString),T("Shutting down Responder...");const e=[];for(const t of this.announcedServices.values())e.push(this.unpublishService(t));return Promise.all(e).then((()=>{this.server.shutdown(),this.bound=!1}))}getAnnouncedServices(){return this.announcedServices.values()}start(){if(this.bound)throw new Error("Server is already bound!");return this.bound=!0,this.server.bind()}advertiseService(e,t){if("announced"===e.serviceState)throw new Error("Can't publish a service that is already announced. Received "+e.serviceState+" for service "+e.getFQDN());return"probing"===e.serviceState?this.promiseChain.then((()=>{if(e.currentAnnouncer)return e.currentAnnouncer.awaitAnnouncement()})):"announcing"===e.serviceState?((0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!"),e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement().then((()=>this.advertiseService(e,t))):e.currentAnnouncer.cancel().then((()=>this.advertiseService(e,t)))):(T("[%s] Going to advertise service...",e.getFQDN()),this.promiseChain=this.promiseChain.then((()=>e.rebuildServiceRecords())).then((()=>this.probe(e))),this.promiseChain.then((()=>{this.announce(e).catch((t=>(console.log(`[${e.getFQDN()}] failed announcing with reason: ${t}. Trying again in 2 seconds!`),(0,E.PromiseTimeout)(2e3).then((()=>this.advertiseService(e,(()=>{}))))))),t()}),(r=>{if(r!==g.Prober.CANCEL_REASON)return console.log(`[${e.getFQDN()}] failed probing with reason: ${r}. Trying again in 2 seconds!`),(0,E.PromiseTimeout)(2e3).then((()=>this.advertiseService(e,t)));t()})))}async republishService(e,t,r=!1){if("announced"!==e.serviceState&&"announcing"!==e.serviceState)throw new Error("Can't unpublish a service which isn't announced yet. Received "+e.serviceState+" for service "+e.getFQDN());if(T("[%s] Readvertising service...",e.getFQDN()),"announcing"===e.serviceState){(0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!");return(e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement():e.currentAnnouncer.cancel()).then((()=>this.advertiseService(e,t)))}return this.clearService(e),e.serviceState="unannounced",r?(0,E.PromiseTimeout)(1e3).then((()=>this.advertiseService(e,t))):this.advertiseService(e,t)}unpublishService(e,t){if("unannounced"===e.serviceState)throw new Error("Can't unpublish a service which isn't announced yet. Received "+e.serviceState+" for service "+e.getFQDN());if("announced"===e.serviceState||"announcing"===e.serviceState){if("announcing"===e.serviceState)return(0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!"),e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement():e.currentAnnouncer.cancel().then((()=>(e.serviceState="announced",this.unpublishService(e,t))));T("[%s] Removing service from the network",e.getFQDN()),this.clearService(e),e.serviceState="unannounced";let r=this.goodbye(e);return t&&(r=r.then((()=>t()),(r=>{console.log(`[${e.getFQDN()}] failed goodbye with reason: ${r}.`),t()}))),r}return"probing"===e.serviceState&&(T("[%s] Canceling probing",e.getFQDN()),this.currentProber&&this.currentProber.getService()===e&&(this.currentProber.cancel(),this.currentProber=void 0),e.serviceState="unannounced"),t&&t(),Promise.resolve()}clearService(e){const t=e.getLowerCasedFQDN(),r=e.getLowerCasedTypePTR(),i=e.getLowerCasedSubtypePTRs();if(this.removePTR(D.SERVICE_TYPE_ENUMERATION_NAME,r),this.removePTR(r,t),i)for(const e of i)this.removePTR(e,t);this.announcedServices.delete(e.getLowerCasedFQDN())}addPTR(e,t){const r=this.servicePointer.get(e);r?r.includes(t)||r.push(t):this.servicePointer.set(e,[t])}removePTR(e,t){const r=this.servicePointer.get(e);if(r){const i=r.indexOf(t);-1!==i&&r.splice(i,1),0===r.length&&this.servicePointer.delete(e)}}probe(e){if("unannounced"!==e.serviceState)throw new Error("Can't probe for a service which is announced already. Received "+e.serviceState+" for service "+e.getFQDN());return e.serviceState="probing",(0,n.default)(void 0===this.currentProber,"Tried creating new Prober when there already was one active!"),this.currentProber=new g.Prober(this,this.server,e),this.currentProber.probe().then((()=>{this.currentProber=void 0,e.serviceState="probed"}),(t=>(e.serviceState="unannounced",this.currentProber=void 0,Promise.reject(t))))}announce(e){if("probed"!==e.serviceState)throw new Error("Cannot announce service which was not probed unique. Received "+e.serviceState+" for service "+e.getFQDN());(0,n.default)(void 0===e.currentAnnouncer,"Service "+e.getFQDN()+" is already announcing!"),e.serviceState="announcing";const t=new m.Announcer(this.server,e,{repetitions:3});e.currentAnnouncer=t;const r=e.getLowerCasedFQDN(),i=e.getLowerCasedTypePTR(),o=e.getLowerCasedSubtypePTRs();if(this.addPTR(D.SERVICE_TYPE_ENUMERATION_NAME,i),this.addPTR(i,r),o)for(const e of o)this.addPTR(e,r);return this.announcedServices.set(r,e),t.announce().then((()=>{e.serviceState="announced",e.currentAnnouncer=void 0}),(t=>{if(e.serviceState="unannounced",e.currentAnnouncer=void 0,this.clearService(e),t!==m.Announcer.CANCEL_REASON)return Promise.reject(t)}))}handleServiceRecordUpdate(e,t,r){var i;if("announced"!==e.serviceState)throw new Error("Cannot update txt of service which is not announced yet. Received "+e.serviceState+" for service "+e.getFQDN());T("[%s] Updating %d record(s) for given service!",e.getFQDN(),t.answers.length+((null===(i=t.additionals)||void 0===i?void 0:i.length)||0)),this.server.sendResponseBroadcast(t,e).then((t=>{const i=(0,f.SendResultFailedRatio)(t);if(1===i)return console.log((0,f.SendResultFormatError)(t,`Failed to send records update for '${e.getFQDN()}'`),!0),void(r&&r(new Error("Updating records failed as of socket errors!")));i>0&&T((0,f.SendResultFormatError)(t,`Some of the record updates for '${e.getFQDN()}' failed`)),r&&r()}))}handleServiceRecordUpdateOnInterface(e,t,r,i){if("announced"!==e.serviceState)throw new Error("Cannot update txt of service which is not announced yet. Received "+e.serviceState+" for service "+e.getFQDN());T("[%s] Updating %d record(s) for given service on interface %s!",e.getFQDN(),r.length,t);const n=s.DNSPacket.createDNSResponsePacketsFromRRSet({answers:r});this.server.sendResponse(n,t,i)}goodbye(e){(0,n.default)(void 0===e.currentAnnouncer,"Service "+e.getFQDN()+" is already announcing!"),e.serviceState="announcing";const t=new m.Announcer(this.server,e,{repetitions:1,goodbye:!0});return e.currentAnnouncer=t,t.announce().then((()=>{e.serviceState="unannounced",e.currentAnnouncer=void 0}),(t=>(e.serviceState="unannounced",e.currentAnnouncer=void 0,Promise.reject(t))))}handleNetworkUpdate(e){for(const t of this.announcedServices.values())t.handleNetworkInterfaceUpdate(e)}handleQuery(e,t){const r=(new Date).getTime(),i=t.address+":"+t.port+":"+t.interface,n=this.truncatedQueries[i];if(n){switch(n.appendDNSPacket(e)){case 1:return delete this.truncatedQueries[i],void T("[%s] Aborting to wait for more truncated queries. Waited a total of %d ms receiving %d queries",i,n.getTotalWaitTime(),n.getArrivedPacketCount());case 2:return void T("[%s] Received a query marked as truncated, waiting for more to arrive",i);case 3:delete this.truncatedQueries[i],e=n.getPacket(),T("[%s] Last part of the truncated query arrived. Received %d packets taking a total of %d ms",i,n.getArrivedPacketCount(),n.getTotalWaitTime())}}else if(e.flags.truncation){T("Received truncated query from "+JSON.stringify(t)+" waiting for more to come!");const r=new C.TruncatedQuery(e);return this.truncatedQueries[i]=r,void r.on("timeout",(()=>{T("[%s] Timeout passed since the last truncated query was received. Discarding %d packets received in %d ms.",i,r.getArrivedPacketCount(),r.getTotalWaitTime()),delete this.truncatedQueries[i]}))}const o=t.port!==f.MDNSServer.MDNS_PORT,a=e.authorities.size>0;let s;for(const t of e.additionals.values())if(41===t.type){s=t.udpPayloadSize;break}const c=[],u=[];if(e.questions.forEach((r=>{const i=this.answerQuestion(r,t,e.answers);o||r.unicastResponseFlag&&!this.ignoreUnicastResponseFlag?u.push(...i):c.push(...i)})),this.currentProber&&this.currentProber.handleQuery(e,t),o)for(let t=0;t1&&(u.splice(1,u.length-1),u[0].markTruncated());for(const e of u){if(!e.hasAnswers())continue;this.server.sendResponse(e.asPacket(),t);const i=(new Date).getTime()-r;T("Sending response via unicast to %s (took %d ms): %s",JSON.stringify(t),i,e.asString(s))}for(const i of c)if(i.hasAnswers())if((i.containsSharedAnswer()||e.questions.size>1)&&!a){const e=(new Date).getTime()-r;this.enqueueDelayedMulticastResponse(i.asPacket(),t.interface,e)}else{let e=!1;for(let n=0;ny.QueuedResponse.MAX_DELAY)break;if(o.combineWithUniqueResponseIfPossible(i,t.interface)){const i=(new Date).getTime()-r;e=!0,T("Multicast response on interface %s containing unique records (took %d ms) was combined with response which is sent out later",t.interface,i);break}}if(!e){this.server.sendResponse(i.asPacket(),t.interface);const e=(new Date).getTime()-r;T("Sending response via multicast on network %s (took %d ms): %s",t.interface,e,i.asString(s))}}}handleResponse(e,t){this.currentProber&&this.currentProber.handleResponse(e,t);for(const r of this.announcedServices.values()){let i=!1,n=0;for(const o of e.answers.values()){const e=D.checkRecordConflictType(r,o,t);if(1===e){i=!0;break}2===e&&n++}if(!i)for(const o of e.additionals.values()){const e=D.checkRecordConflictType(r,o,t);if(1===e){i=!0;break}2===e&&n++}if(i)this.republishService(r,(e=>{e&&(console.log(`FATAL Error occurred trying to resolve conflict for service ${r.getFQDN()}! We can't recover from this!`),console.log(e.stack),process.exit(1))}),!0);else if(n&&!r.currentAnnouncer){r.serviceState="announcing";const e=new m.Announcer(this.server,r,{repetitions:1});r.currentAnnouncer=e,e.announce().then((()=>{r.currentAnnouncer=void 0,r.serviceState="announced"}),(e=>{r.currentAnnouncer=void 0,r.serviceState="announced",e!==m.Announcer.CANCEL_REASON&&console.warn("When trying to resolve a ttl conflict on the network, we were unable to send our response packet: "+e.message)}))}}}static checkRecordConflictType(e,t,r){if(!e.advertisesOnInterface(r.interface))return 0;const i=t.getLowerCasedName();if(i===e.getLowerCasedFQDN()){if(33===t.type){const r=t;if(r.getLowerCasedHostname()!==e.getLowerCasedHostname())return T("[%s] Noticed conflicting record on the network. SRV with hostname: %s",e.getFQDN(),r.hostname),1;if(r.port!==e.getPort())return T("[%s] Noticed conflicting record on the network. SRV with port: %s",e.getFQDN(),r.port),1;if(r.ttl{const e=this.delayedMulticastResponses.indexOf(i);-1!==e&&this.delayedMulticastResponses.splice(e,1);try{this.server.sendResponse(i.getPacket(),t),T("Sending (delayed %dms) response via multicast on network interface %s (took %d ms): %s",Math.round(i.getTimeSinceCreation()),t,r,i.getPacket().asLoggingString())}catch(e){if(e.name===S.ERR_INTERFACE_NOT_FOUND)T("Multicast response (delayed %dms) was cancelled as the network interface %s is no longer available!",Math.round(i.getTimeSinceCreation()),t);else{if(e.name!==S.ERR_SERVER_CLOSED)throw e;T("Multicast response (delayed %dms) was cancelled as the server is about to be shutdown!",Math.round(i.getTimeSinceCreation()))}}}))}answerQuestion(e,t,r){if(1!==e.class&&255!==e.class)return[];const i=[];let n;if(12===e.type||255===e.type||5===e.type){const o=this.servicePointer.get(e.getLowerCasedName());if(o){for(const a of o){const o=this.announcedServices.get(a);if(o){if(o.advertisesOnInterface(t.interface)){const n=D.answerServiceQuestion(o,e,t,r);n.hasAnswers()&&i.push(n)}}else n||(n=new v.QueryResponse(r),i.unshift(n)),n.addAnswer(new h.PTRRecord(e.name,a))}return i}}for(const n of this.announcedServices.values()){if(!n.advertisesOnInterface(t.interface))continue;const o=D.answerServiceQuestion(n,e,t,r);o.hasAnswers()&&i.push(o)}return i}static answerServiceQuestion(e,t,r,i){const o=new v.QueryResponse(i),a=t.getLowerCasedName(),s=255===t.type||5===t.type,c=o.addAnswer.bind(o),u=o.addAdditional.bind(o);if(a===e.getLowerCasedTypePTR()){if(s||12===t.type){o.addAnswer(e.ptrRecord())&&(o.addAdditional(e.txtRecord(),e.srvRecord()),this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}}else if(a===e.getLowerCasedFQDN())if(s){o.addAnswer(e.txtRecord());o.addAnswer(e.srvRecord())&&(this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}else if(33===t.type){o.addAnswer(e.srvRecord())&&(this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(!0),e.addressNSECRecord()))}else 16===t.type&&(o.addAnswer(e.txtRecord()),o.addAdditional(e.serviceNSECRecord()));else if(a===e.getLowerCasedHostname()||a+"local."===e.getLowerCasedHostname()){if(s)this.addAddressRecords(e,r,1,c),this.addAddressRecords(e,r,28,c),o.addAdditional(e.addressNSECRecord());else if(1===t.type){this.addAddressRecords(e,r,1,c)&&this.addAddressRecords(e,r,28,u),o.addAdditional(e.addressNSECRecord())}else if(28===t.type){this.addAddressRecords(e,r,28,c)&&this.addAddressRecords(e,r,1,u),o.addAdditional(e.addressNSECRecord())}}else if(e.getLowerCasedSubtypePTRs()&&(s||12===t.type)){const t=e.getLowerCasedSubtypePTRs().indexOf(a);if(-1!==t){const i=e.subtypePtrRecords()[t];(0,n.default)(a===i.name,"Question Name didn't match selected sub type ptr record!");o.addAnswer(i)&&(o.addAdditional(e.txtRecord(),e.srvRecord()),this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}}return o}static addAddressRecords(e,t,r,i){if(1===r){const r=e.aRecord(t.interface);return!!r&&i(r)}if(28===r){const r=e.aaaaRecord(t.interface),n=e.aaaaRoutableRecord(t.interface),o=e.aaaaUniqueLocalRecord(t.interface);let a=!1;if(r&&(a=i(r)),n){const e=i(n);a=a||e}if(o){const e=i(o);a=a||e}return a}n.default.fail("Illegal argument!")}}t.Responder=D,D.SERVICE_TYPE_ENUMERATION_NAME="_services._dns-sd._udp.local.",D.INSTANCES=new Map},7352:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NonCompressionLabelCoder=t.DNSLabelCoder=void 0;const i=r(1635).__importDefault(r(2613));class n{constructor(e){this.trackedLengths=[],this.writtenNames=[],this.legacyUnicastEncoding=e||!1}initBuf(e){this.buffer=e}initRRLocation(e,t,r){this.startOfRR=e,this.startOfRData=t,this.rDataLength=r}clearRRLocation(){this.startOfRR=void 0,this.startOfRData=void 0,this.rDataLength=void 0}getUncompressedNameLength(e){if("."===e)return 1;(0,i.default)(e.endsWith("."),"Supplied illegal name which doesn't end with the root label!");let t=0;const r=e.split(".");for(let o=0;on.getLabelLength(e))),r={name:e,length:0,labelLengths:t};let o,a=0;for(let t=0;ta&&(o=r,a=i)}let s=0;if(o){const e=t.length-1-a;for(let r=0;rc&&(s=r,c=i)}if(s){const e=o.length-1-c,r=s.writtenLabels.length-1-c;for(let r=0;r=0&&a<255?((0,i.default)(void 0!==this.startOfRR,"Cannot decompress locally compressed name as record is not initialized!"),a+=this.startOfRR,(0,i.default)(a=256?((0,i.default)(void 0!==this.startOfRData&&void 0!==this.rDataLength,"Cannot decompress locally compressed name as record is not initialized!"),a-=-256,a+=this.startOfRData,(0,i.default)(a265 at "+(e+2)+" MUST point to a prior location!"),o+=(o?".":"")+this.decodeName(a).data):i.default.fail("Encountered unknown pointer range "+a);break}if(s===n.EXTENDED_LABEL_TYPE_ONE_BYTE){const t=a&n.NOT_POINTER_MASK_ONE_BYTE;i.default.fail("Received extended label type "+t+" at "+(e-1))}else i.default.fail("Encountered unknown pointer type: "+Buffer.from([s>>6]).toString("hex")+" (with original byte "+Buffer.from([a]).toString("hex")+")")}const c=this.buffer.toString("utf-8",e,e+a);e+=a,o+=(o?".":"")+c}return{data:o,readBytes:e-r}}static getLabelLength(e){if(e){const t=Buffer.byteLength(e);return(0,i.default)(t<=63,"Label cannot be longer than 63 bytes ("+e+")"),1+t}return 1}static writeLabel(e,t,r){if(e){const i=t.write(e,r+1);return t.writeUInt8(i,r),i+1}return t.writeUInt8(0,r),1}static computeLabelSuffixLength(e,t){(0,i.default)(0!==e.length&&0!==t.length,"Encountered empty name when comparing suffixes!");const r=e.length-1,n=t.length-1;let o=0,a=!1;for(let s=1;s<=r&&s<=n;s++){const c=e.charAt(r-s),u=t.charAt(n-s);if((0,i.default)(!!c&&!!u,"Seemingly encountered out of bounds trying to calculate suffixes"),c!==u){a=!0;break}"."===c&&o++}return a||o++,o}}t.DNSLabelCoder=n,n.DISABLE_COMPRESSION=!1,n.POINTER_MASK=49152,n.POINTER_MASK_ONE_BYTE=192,n.LOCAL_COMPRESSION_ONE_BYTE=128,n.EXTENDED_LABEL_TYPE_ONE_BYTE=64,n.NOT_POINTER_MASK=16383,n.NOT_POINTER_MASK_ONE_BYTE=63;class o extends n{getNameLength(e){return this.getUncompressedNameLength(e)}encodeName(e,t){return this.encodeUncompressedName(e,t)}}t.NonCompressionLabelCoder=o,o.INSTANCE=new o},4119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DNSPacket=t.PacketType=t.QClass=t.RClass=t.QType=t.RType=t.RCode=t.OpCode=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(1673),s=r(7352),c=r(5682);r(9577);const u=r(5231);var l,h,d,p,f,m,g;function v(e){return"answers"in e}!function(e){e[e.QUERY=0]="QUERY"}(l||(t.OpCode=l={})),function(e){e[e.NoError=0]="NoError"}(h||(t.RCode=h={})),function(e){e[e.A=1]="A",e[e.CNAME=5]="CNAME",e[e.PTR=12]="PTR",e[e.TXT=16]="TXT",e[e.AAAA=28]="AAAA",e[e.SRV=33]="SRV",e[e.OPT=41]="OPT",e[e.NSEC=47]="NSEC"}(d||(t.RType=d={})),function(e){e[e.A=1]="A",e[e.CNAME=5]="CNAME",e[e.PTR=12]="PTR",e[e.TXT=16]="TXT",e[e.AAAA=28]="AAAA",e[e.SRV=33]="SRV",e[e.NSEC=47]="NSEC",e[e.ANY=255]="ANY"}(p||(t.QType=p={})),function(e){e[e.IN=1]="IN"}(f||(t.RClass=f={})),function(e){e[e.IN=1]="IN",e[e.ANY=255]="ANY"}(m||(t.QClass=m={})),function(e){e[e.QUERY=0]="QUERY",e[e.RESPONSE=1]="RESPONSE"}(g||(t.PacketType=g={}));class y{constructor(e){this.questions=new Map,this.answers=new Map,this.authorities=new Map,this.additionals=new Map,this.estimatedEncodingLength=0,this.lastCalculatedLength=0,this.lengthDirty=!0,this.id=e.id||0,this.legacyUnicastEncoding=e.legacyUnicast||!1,this.type=e.type,this.opcode=e.opcode||0,this.flags=e.flags||{},this.rcode=e.rCode||0,1===this.type&&(this.flags.authoritativeAnswer=!0),e.questions&&this.addQuestions(...e.questions),e.answers&&this.addAnswers(...e.answers),e.authorities&&this.addAuthorities(...e.authorities),e.additionals&&this.addAdditionals(...e.additionals)}static createDNSQueryPacket(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=this.createDNSQueryPackets(e,t);return(0,n.default)(1===r.length,"Cannot user short method createDNSQueryPacket when query packets are more than one: is "+r.length),r[0]}static createDNSQueryPackets(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=[],i=new y({type:0,questions:e.questions,additionals:v(e)?e.additionals:void 0});if(r.push(i),i.getEstimatedEncodingLength()>t){const e=i.getEncodingLength();e>t&&n.default.fail("Cannot send query where already the query section is exceeding the udpPayloadSize ("+e+">"+t+")!")}if(v(e)&&e.answers){let n=i,o=0;const a=e.answers.concat([]);for(a.sort(((e,t)=>e.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)-t.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)));ot&&n.default.fail(`Probe query packet exceeds the mtu size (${r}>${t}). Can't split probe queries at the moment!`)}return r}static createDNSResponsePacketsFromRRSet(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=new y({id:e.id,legacyUnicast:e.legacyUnicast,type:1,flags:{authoritativeAnswer:!0},questions:e.questions,answers:e.answers,additionals:e.additionals});return r.getEncodingLength()>t&&n.default.fail("Couldn't construct a dns response packet from a rr set which fits in an udp payload sized packet!"),r}canBeCombinedWith(e,t=y.UDP_PAYLOAD_SIZE_IPV4){return this.id===e.id&&this.type===e.type&&this.opcode===e.opcode&&(0,o.default)(this.flags,e.flags)&&this.rcode===e.rcode&&this.getEncodingLength()+e.getEncodingLength()<=t}combineWith(e){this.setLegacyUnicastEncoding(this.legacyUnicastEncoding||e.legacyUnicastEncoding),this.addRecords(this.questions,e.questions.values()),this.addRecords(this.answers,e.answers.values(),this.additionals),this.addRecords(this.authorities,e.authorities.values()),this.addRecords(this.additionals,e.additionals.values())}addQuestions(...e){return this.addRecords(this.questions,e)}addAnswers(...e){return this.addRecords(this.answers,e,this.additionals)}addAuthorities(...e){return this.addRecords(this.authorities,e)}addAdditionals(...e){return this.addRecords(this.additionals,e)}addRecords(e,t,r){let i=!1;for(const n of t)e.has(n.asString())||(this.estimatedEncodingLength&&(this.estimatedEncodingLength+=n.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)),e.set(n.asString(),n),i=!0,this.lengthDirty=!0,r&&r.delete(n.asString()));return i}setLegacyUnicastEncoding(e){this.legacyUnicastEncoding!==e&&(this.lengthDirty=!0),this.legacyUnicastEncoding=e}legacyUnicastEncodingEnabled(){return this.legacyUnicastEncoding}getEstimatedEncodingLength(){if(this.estimatedEncodingLength)return this.estimatedEncodingLength;const e=s.NonCompressionLabelCoder.INSTANCE;let t=y.DNS_PACKET_HEADER_SIZE;for(const r of this.questions.values())t+=r.getEncodingLength(e);for(const r of this.answers.values())t+=r.getEncodingLength(e);for(const r of this.authorities.values())t+=r.getEncodingLength(e);for(const r of this.additionals.values())t+=r.getEncodingLength(e);return this.estimatedEncodingLength=t,t}getEncodingLength(e){if(!this.lengthDirty)return this.lastCalculatedLength;const t=e||new s.DNSLabelCoder(this.legacyUnicastEncoding);let r=y.DNS_PACKET_HEADER_SIZE;for(const e of this.questions.values())r+=e.getEncodingLength(t);for(const e of this.answers.values())r+=e.getEncodingLength(t);for(const e of this.authorities.values())r+=e.getEncodingLength(t);for(const e of this.additionals.values())r+=e.getEncodingLength(t);return this.lengthDirty=!1,this.lastCalculatedLength=r,this.estimatedEncodingLength=r,r}encode(){const e=new s.DNSLabelCoder(this.legacyUnicastEncoding),t=this.getEncodingLength(e),r=Buffer.allocUnsafe(t);e.initBuf(r);let i=0;r.writeUInt16BE(this.id,i),i+=2;let o=this.type<<15|this.opcode<<11|this.rcode;this.flags.authoritativeAnswer&&(o|=y.AUTHORITATIVE_ANSWER_MASK),this.flags.truncation&&(o|=y.TRUNCATION_MASK),this.flags.recursionDesired&&(o|=y.RECURSION_DESIRED_MASK),this.flags.recursionAvailable&&(o|=y.RECURSION_AVAILABLE_MASK),this.flags.zero&&(o|=y.ZERO_HEADER_MASK),this.flags.authenticData&&(o|=y.AUTHENTIC_DATA_MASK),this.flags.checkingDisabled&&(o|=y.CHECKING_DISABLED_MASK),r.writeUInt16BE(o,i),i+=2,r.writeUInt16BE(this.questions.size,i),i+=2,r.writeUInt16BE(this.answers.size,i),i+=2,r.writeUInt16BE(this.authorities.size,i),i+=2,r.writeUInt16BE(this.additionals.size,i),i+=2;for(const t of this.questions.values()){i+=t.encode(e,r,i)}for(const t of this.answers.values()){i+=t.encode(e,r,i)}for(const t of this.authorities.values()){i+=t.encode(e,r,i)}for(const t of this.additionals.values()){i+=t.encode(e,r,i)}return(0,n.default)(i===r.length,"Bytes written didn't match the buffer size!"),r}static decode(e,t,r=0){const i=new s.DNSLabelCoder;i.initBuf(t);const o=t.readUInt16BE(r);r+=2;const a=t.readUInt16BE(r);r+=2;const l=t.readUInt16BE(r);r+=2;const h=t.readUInt16BE(r);r+=2;const d=t.readUInt16BE(r);r+=2;const p=t.readUInt16BE(r);r+=2;const f=[],m=[],g=[],v=[];r+=y.decodeList(e,i,t,r,l,c.Question.decode.bind(c.Question),f),r+=y.decodeList(e,i,t,r,h,u.ResourceRecord.decode.bind(u.ResourceRecord),m),r+=y.decodeList(e,i,t,r,d,u.ResourceRecord.decode.bind(u.ResourceRecord),g),r+=y.decodeList(e,i,t,r,p,u.ResourceRecord.decode.bind(u.ResourceRecord),v),(0,n.default)(r===t.length,"Didn't read the full buffer (offset="+r+", length="+t.length+")");const C=a>>15,S=a>>11&15,E=15&a,_={};return a&this.AUTHORITATIVE_ANSWER_MASK&&(_.authoritativeAnswer=!0),a&this.TRUNCATION_MASK&&(_.truncation=!0),a&this.RECURSION_DESIRED_MASK&&(_.recursionDesired=!0),a&this.RECURSION_AVAILABLE_MASK&&(_.recursionAvailable=!0),a&this.ZERO_HEADER_MASK&&(_.zero=!0),a&this.AUTHENTIC_DATA_MASK&&(_.authenticData=!0),a&this.CHECKING_DISABLED_MASK&&(_.checkingDisabled=!0),new y({id:o,type:C,opcode:S,rCode:E,flags:_,questions:f,answers:m,authorities:g,additionals:v})}static decodeList(e,t,r,i,n,o,a){const s=i;for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Question=void 0;const i=r(7585);class n{constructor(e,t,r=!1,i=1){this.unicastResponseFlag=!1,e.endsWith(".")||(e+="."),this.name=e,this.type=t,this.class=i,this.unicastResponseFlag=r}getLowerCasedName(){return this.lowerCasedName||(this.lowerCasedName=(0,i.dnsLowerCase)(this.name))}getEncodingLength(e){return e.getNameLength(this.name)+4}encode(e,t,r){const i=r;r+=e.encodeName(this.name,r),t.writeUInt16BE(this.type,r),r+=2;let o=this.class;return this.unicastResponseFlag&&(o|=n.QU_MASK),t.writeUInt16BE(o,r),(r+=2)-i}clone(){return new n(this.name,this.type,this.unicastResponseFlag,this.class)}asString(){return`Q ${this.name} ${this.type} ${this.class}`}static decode(e,t,r,i){const o=i,a=t.decodeName(i);i+=a.readBytes;const s=r.readUInt16BE(i);i+=2;const c=r.readUInt16BE(i);i+=2;const u=c&this.NOT_QU_MASK,l=!!(c&this.QU_MASK);return{data:new n(a.data,s,l,u),readBytes:i-o}}}t.Question=n,n.QU_MASK=32768,n.NOT_QU_MASK=32767},5231:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(7585),s=r(1673),c=r(7352),u=(0,o.default)("ciao:decoder");class l{constructor(e,t,r=l.RR_DEFAULT_TTL,i=!1,n=1){this.flushFlag=!1,"string"==typeof e?(e.endsWith(".")||(e+="."),this.name=e,this.type=t,this.class=n,this.ttl=r,this.flushFlag=i):(this.name=e.name,this.type=e.type,this.class=e.class,this.ttl=e.ttl,this.flushFlag=e.flushFlag)}getLowerCasedName(){return this.lowerCasedName||(this.lowerCasedName=(0,a.dnsLowerCase)(this.name))}getEncodingLength(e){return e.getNameLength(this.name)+10+this.getRDataEncodingLength(e)}encode(e,t,r){const i=r;r+=e.encodeName(this.name,r),t.writeUInt16BE(this.type,r),r+=2;let n=this.class;this.flushFlag&&(n|=l.FLUSH_MASK),t.writeUInt16BE(n,r),r+=2,t.writeUInt32BE(this.ttl,r),r+=4;const o=this.encodeRData(e,t,r+2);return t.writeUInt16BE(o,r),(r+=2+o)-i}getRawData(){const e=c.NonCompressionLabelCoder.INSTANCE,t=this.getRDataEncodingLength(e),r=Buffer.allocUnsafe(t);e.initBuf(r);const i=this.encodeRData(e,r,0);return(0,n.default)(i===r.length,"Didn't completely write to the buffer! ("+i+"!="+r.length+")"),e.initBuf(),r}static clone(e){return e.map((e=>e.clone()))}getRecordRepresentation(){return{name:this.name,type:this.type,class:this.class,ttl:this.ttl,flushFlag:this.flushFlag}}aboutEqual(e){return this.type===e.type&&this.name===e.name&&this.class===e.class&&this.dataEquals(e)}representsSameData(e){return this.type===e.type&&this.name===e.name&&this.class===e.class}asString(){return`RR ${this.name} ${this.type} ${this.class} ${this.dataAsString()}`}static decode(e,t,r,i){const n=i,o=this.decodeRecordHeader(t,r,i);i+=o.readBytes;const a=o.data,c=this.typeToRecordDecoder.get(a.type);if(!c)return{readBytes:i+a.rDataLength-n};t.initRRLocation(n,i,a.rDataLength);const l=r.subarray(0,i+a.rDataLength);let h;try{h=c(t,a,l,i)}catch(t){return u(`Received malformed rdata section for ${(0,s.dnsTypeToString)(a.type)} ${a.name} ${a.ttl} from ${e.address}:${e.port} with data '${l.subarray(i).toString("hex")}': ${t.stack}`),{readBytes:i+a.rDataLength-n}}return i+=h.readBytes,t.clearRRLocation(),{data:h.data,readBytes:i-n}}static decodeRecordHeader(e,t,r){const i=r,n=e.decodeName(r);r+=n.readBytes;const o=t.readUInt16BE(r);r+=2;const a=t.readUInt16BE(r);let s;r+=2;let c=!1;41!==o?(s=a&this.NOT_FLUSH_MASK,c=!!(a&this.FLUSH_MASK)):s=a;const u=t.readUInt32BE(r);r+=4;const l=t.readUInt16BE(r);r+=2;return{data:{name:n.data,type:o,class:s,ttl:u,flushFlag:c,rDataLength:l},readBytes:r-i}}}t.ResourceRecord=l,l.typeToRecordDecoder=new Map,l.FLUSH_MASK=32768,l.NOT_FLUSH_MASK=32767,l.RR_DEFAULT_TTL_SHORT=120,l.RR_DEFAULT_TTL=4500},1673:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dnsTypeToString=void 0,t.dnsTypeToString=function(e){switch(e){case 1:return"A";case 5:return"CNAME";case 12:return"PTR";case 16:return"TXT";case 28:return"AAAA";case 33:return"SRV";case 41:return"OPT";case 47:return"NSEC";case 255:return"ANY"}return"UNSUPPORTED_"+e}},1360:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AAAARecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278)),a=r(9152),s=r(5231);class c extends s.ResourceRecord{constructor(e,t,r,i){"string"==typeof e?super(e,28,i||c.RR_DEFAULT_TTL_SHORT,r):((0,n.default)(28===e.type),super(e)),(0,n.default)(o.default.isIPv6(t),"IP address is not in v6 format!"),this.ipAddress=t}getRDataEncodingLength(){return 16}encodeRData(e,t,r){const i=r,o=(0,a.enlargeIPv6)(this.ipAddress).split(":");(0,n.default)(8===o.length,"invalid ip address");for(const e of o){const i=parseInt(e,16);t.writeUInt16BE(i,r),r+=2}return r-i}static decodeData(e,t,r,i){const n=i,o=new Array(8);for(let e=0;e<8;e++){const t=r.readUInt16BE(i);i+=2,o[e]=t.toString(16)}const s=(0,a.shortenIPv6)(o.join(":"));return{data:new c(t,s),readBytes:i-n}}clone(){return new c(this.getRecordRepresentation(),this.ipAddress)}dataAsString(){return this.ipAddress}dataEquals(e){return this.ipAddress===e.ipAddress}}t.AAAARecord=c,c.DEFAULT_TTL=120},4495:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ARecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278)),a=r(5231);class s extends a.ResourceRecord{constructor(e,t,r,i){"string"==typeof e?super(e,1,i||s.RR_DEFAULT_TTL_SHORT,r):((0,n.default)(1===e.type),super(e)),(0,n.default)(o.default.isIPv4(t),"IP address is not in v4 format!"),this.ipAddress=t}getRDataEncodingLength(){return 4}encodeRData(e,t,r){const i=r,o=this.ipAddress.split(".");(0,n.default)(4===o.length,"invalid ip address");for(const e of o){const i=parseInt(e,10);t.writeUInt8(i,r++)}return r-i}static decodeData(e,t,r,i){const n=i,o=new Array(4);for(let e=0;e<4;e++){const t=r.readUInt8(i++);o[e]=t.toString(10)}const a=o.join(".");return{data:new s(t,a),readBytes:i-n}}clone(){return new s(this.getRecordRepresentation(),this.ipAddress)}dataAsString(){return this.ipAddress}dataEquals(e){return this.ipAddress===e.ipAddress}}t.ARecord=s,s.DEFAULT_TTL=120},5102:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CNAMERecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,5,n,r):((0,i.default)(5===e.type),super(e)),t.endsWith(".")||(t+="."),this.cname=t}getLowerCasedCName(){return this.lowerCasedCName||(this.lowerCasedCName=(0,n.dnsLowerCase)(this.cname))}getRDataEncodingLength(e){return e.getNameLength(this.cname)}encodeRData(e,t,r){const i=r;return(r+=e.encodeName(this.cname,r))-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i);return i+=o.readBytes,{data:new a(t,o.data),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.cname)}dataAsString(){return this.cname}dataEquals(e){return this.getLowerCasedCName()===e.getLowerCasedCName()}}t.CNAMERecord=a,a.DEFAULT_TTL=o.ResourceRecord.RR_DEFAULT_TTL},6343:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NSECRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(7585),s=r(5231);class c extends s.ResourceRecord{constructor(e,t,r,i,o){"string"==typeof e?super(e,47,i||c.RR_DEFAULT_TTL_SHORT,o):((0,n.default)(47===e.type),super(e)),t.endsWith(".")||(t+="."),this.nextDomainName=t,this.rrTypeWindows=c.rrTypesToWindowMap(r)}getLowerCasedNextDomainName(){return this.lowerCasedNextDomainName||(this.lowerCasedNextDomainName=(0,a.dnsLowerCase)(this.nextDomainName))}getRRTypesBitMapEncodingLength(){let e=0;for(const t of this.rrTypeWindows)(0,n.default)(t.rrtypes.length>0,"types array for windowId "+t.windowId+" cannot be empty!"),e+=2+t.bitMapSize;return e}getRDataEncodingLength(e){return e.legacyUnicastEncoding,e.getUncompressedNameLength(this.nextDomainName)+this.getRRTypesBitMapEncodingLength()}encodeRData(e,t,r){const i=r;r+=(e.legacyUnicastEncoding,e.encodeUncompressedName(this.nextDomainName,r));for(const e of this.rrTypeWindows){t.writeUInt8(e.windowId,r++),t.writeUInt8(e.bitMapSize,r++);const i=Buffer.alloc(e.bitMapSize);for(const t of e.rrtypes){const e=(255&t)>>3;let r=i.readUInt8(e);r|=1<<7-(7&t),i.writeUInt8(r,e)}i.copy(t,r),r+=i.length}return r-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i,!1);i+=o.readBytes;const a=[];for(;i""+e)).join(",")}]`}dataEquals(e){return this.getLowerCasedNextDomainName()===e.getLowerCasedNextDomainName()&&(0,o.default)(this.rrTypeWindows,e.rrTypeWindows)}static rrTypesToWindowMap(e){const t=[];for(const r of e){const e=r>>8;let i;for(const r of t)if(r.windowId===e){i=r;break}if(i){i.rrtypes.push(r);const e=Math.ceil((255&r)/8);e>i.bitMapSize&&(i.bitMapSize=e)}else i={windowId:e,bitMapSize:Math.ceil((255&r)/8),rrtypes:[r]},t.push(i)}return t.sort(((e,t)=>e.windowId-t.windowId)),t.forEach((e=>e.rrtypes.sort(((e,t)=>e-t)))),t}static windowsToRRTypes(e){const t=[];for(const r of e)t.push(...r.rrtypes);return t}}t.NSECRecord=c},6141:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OPTRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(5231);class s extends a.ResourceRecord{constructor(e,t,r,i,o,a){"number"==typeof e?(super(".",41,a,!1,e),this.udpPayloadSize=e):((0,n.default)(41===e.type),super(e),this.udpPayloadSize=e.class),this.extendedRCode=r||0,this.ednsVersion=o||s.EDNS_VERSION,this.flags={dnsSecOK:(null==i?void 0:i.dnsSecOK)||!1,zero:(null==i?void 0:i.zero)||0,...i},this.options=t||[]}getRDataEncodingLength(){let e=0;for(const t of this.options)e+=4+t.data.length;return e}encodeRData(e,t,r){const i=r,n=r-8,o=r-6;t.writeUInt16BE(this.udpPayloadSize,n),t.writeUInt8(this.extendedRCode,o),t.writeUInt8(this.ednsVersion,o+1);let a=this.flags.zero||0;this.flags.dnsSecOK&&(a|=s.DNS_SEC_OK_MASK),t.writeUInt16BE(a,o+2);for(const e of this.options)t.writeUInt16BE(e.code,r),r+=2,t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;return r-i}static decodeData(e,t,r,i){const n=i,o=i-8,a=i-6,c=r.readUInt16BE(o),u=r.readUInt8(a),l=r.readUInt8(a+1),h=r.readUInt16BE(a+2),d={dnsSecOK:!!(h&s.DNS_SEC_OK_MASK),zero:h&s.NOT_DNS_SEC_OK_MASK},p=[];for(;i`${e.code} ${e.data.toString("base64")}`)).join(",")}]`}dataEquals(e){return this.udpPayloadSize===e.udpPayloadSize&&this.extendedRCode===e.extendedRCode&&this.ednsVersion===e.ednsVersion&&s.optionsEquality(this.options,e.options)&&(0,o.default)(this.flags,e.flags)}static optionsEquality(e,t){if(e.length!==t.length)return!1;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PTRRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,12,n,r):((0,i.default)(12===e.type),super(e)),t.endsWith(".")||(t+="."),this.ptrName=t}getLowerCasedPTRName(){return this.lowerCasedPtrName||(this.lowerCasedPtrName=(0,n.dnsLowerCase)(this.ptrName))}getRDataEncodingLength(e){return e.getNameLength(this.ptrName)}encodeRData(e,t,r){const i=r;return(r+=e.encodeName(this.ptrName,r))-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i);return i+=o.readBytes,{data:new a(t,o.data),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.ptrName)}dataAsString(){return this.ptrName}dataEquals(e){return this.getLowerCasedPTRName()===e.getLowerCasedPTRName()}}t.PTRRecord=a,a.DEFAULT_TTL=o.ResourceRecord.RR_DEFAULT_TTL},8225:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SRVRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n,o){"string"==typeof e?super(e,33,o||a.RR_DEFAULT_TTL_SHORT,n):((0,i.default)(33===e.type),super(e)),t.endsWith(".")?this.hostname=t:this.hostname=t+".",this.port=r,this.priority=0,this.weight=0}getLowerCasedHostname(){return this.lowerCasedHostname||(this.lowerCasedHostname=(0,n.dnsLowerCase)(this.hostname))}getRDataEncodingLength(e){return 6+(e.legacyUnicastEncoding?e.getUncompressedNameLength(this.hostname):e.getNameLength(this.hostname))}encodeRData(e,t,r){const i=r;t.writeUInt16BE(this.priority,r),r+=2,t.writeUInt16BE(this.weight,r),r+=2,t.writeUInt16BE(this.port,r),r+=2;return(r+=e.legacyUnicastEncoding?e.encodeUncompressedName(this.hostname,r):e.encodeName(this.hostname,r))-i}static decodeData(e,t,r,i){const n=i;i+=2,i+=2;const o=r.readUInt16BE(i);i+=2;const s=e.decodeName(i);return i+=s.readBytes,{data:new a(t,s.data,o),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.hostname,this.port)}dataAsString(){return`${this.hostname} ${this.port} ${this.priority} ${this.weight}`}dataEquals(e){return this.getLowerCasedHostname()===e.getLowerCasedHostname()&&this.port===e.port&&this.weight===e.weight&&this.priority===e.priority}}t.SRVRecord=a,a.DEFAULT_TTL=120},1576:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TXTRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(5231);class o extends n.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,16,n,r):((0,i.default)(16===e.type),super(e)),this.txt=0===t.length?[Buffer.from([])]:t}getRDataEncodingLength(){let e=0;for(const t of this.txt)e+=1+t.length,(0,i.default)(t.length<=255,"One txt character-string can only have a length of 255 chars");return e}encodeRData(e,t,r){const i=r;for(const e of this.txt)t.writeUInt8(e.length,r++),e.copy(t,r),r+=e.length;return r-i}clone(){return new o(this.getRecordRepresentation(),this.txt)}dataAsString(){return`[${this.txt.map((e=>`${e.toString("base64")}`)).join(",")}]`}dataEquals(e){if(this.txt.length!==e.txt.length)return!1;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(5231),n=r(1360),o=r(4495),a=r(5102),s=r(6343),c=r(6141),u=r(482),l=r(8225),h=r(1576);i.ResourceRecord.typeToRecordDecoder.set(28,n.AAAARecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(1,o.ARecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(5,a.CNAMERecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(47,s.NSECRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(12,u.PTRRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(33,l.SRVRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(41,c.OPTRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(16,h.TXTRecord.decodeData)},8318:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getResponder=t.Protocol=void 0;const i=r(1635);r(3476);const n=i.__importDefault(r(5753)),o=r(3325).rE;if(o.includes("beta")||process.env.BCT){const e=process.env.DEBUG;e&&e.includes("ciao")||(e?n.default.enable(e+",ciao:*"):n.default.enable("ciao:*"))}r(9577);const a=r(4288);var s;function c(e){return a.Responder.getResponder(e)}i.__exportStar(r(141),t),i.__exportStar(r(4288),t),(0,n.default)("ciao:init")("Loading ciao v"+o+"..."),function(e){e.TCP="tcp",e.UDP="udp"}(s||(t.Protocol=s={})),t.getResponder=c,t.default={getResponder:c}},9983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Announcer=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(4119),s=r(2361),c=r(8390),u=(0,o.default)("ciao:Announcer");class l{constructor(e,t,r){this.repetitions=1,this.announceIntervalIncreaseFactor=2,this.goodbye=!1,this.sentAnnouncements=0,this.sentLastAnnouncement=!1,this.nextInterval=1e3,this.nextAnnouncementTime=0,(0,n.default)(e,"server must be defined"),(0,n.default)(t,"service must be defined"),this.server=e,this.service=t,r&&(void 0!==r.repetitions&&(this.repetitions=r.repetitions),r.goodbye&&(this.goodbye=!0)),(0,n.default)(this.repetitions>0&&this.repetitions<=8,"repetitions must in [1;8]")}announce(){return u("[%s] Sending %s for service",this.service.getFQDN(),this.goodbye?"goodbye":"announcement"),this.goodbye||this.service.rebuildServiceRecords(),this.promise=new Promise(((e,t)=>{this.promiseResolve=e,this.promiseReject=t,this.timer=setTimeout(this.sendAnnouncement.bind(this),0),this.timer.unref(),this.nextAnnouncementTime=(new Date).getTime()}))}async cancel(){return u("[%s] Canceling %s",this.service.getFQDN(),this.goodbye?"goodbye":"announcement"),this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.promiseReject(l.CANCEL_REASON),this.awaitAnnouncement().catch((e=>{if(e!==l.CANCEL_REASON)return Promise.reject(e)}))}hasSentLastAnnouncement(){return this.sentLastAnnouncement}async awaitAnnouncement(){await this.promise}isSendingGoodbye(){return this.goodbye}sendAnnouncement(){u("[%s] Sending %s number %d",this.service.getFQDN(),this.goodbye?"goodbye":"announcement",this.sentAnnouncements+1);const e=[this.service.ptrRecord(),...this.service.subtypePtrRecords(),this.service.srvRecord(),this.service.txtRecord()];if(this.goodbye)for(const t of e)t.ttl=0;else e.push(this.service.metaQueryPtrRecord());this.sentAnnouncements+1>=this.repetitions&&(this.sentLastAnnouncement=!0),l.sendResponseAddingAddressRecords(this.server,this.service,e,this.goodbye).then((e=>{const t=(0,s.SendResultFailedRatio)(e);if(1===t)return console.error((0,s.SendResultFormatError)(e,`[${this.service.getFQDN()}] Failed to send ${this.goodbye?"goodbye":"announcement"} requests`),!0),void this.promiseReject(new Error((this.goodbye?"Goodbye":"Announcement")+" failed as of socket errors!"));t>0&&u((0,s.SendResultFormatError)(e,`Some of the ${this.goodbye?"goodbye":"announcement"} requests for '${this.service.getFQDN()}' encountered an error`)),"announcing"===this.service.serviceState?(this.sentAnnouncements++,this.sentAnnouncements>=this.repetitions?this.promiseResolve():(this.timer=setTimeout(this.sendAnnouncement.bind(this),this.nextInterval),this.timer.unref(),this.nextAnnouncementTime=(new Date).getTime()+this.nextInterval,this.nextInterval*=this.announceIntervalIncreaseFactor)):u("[%s] Service is no longer in announcing state. Stopping. (Received %s)",this.service.getFQDN(),this.service.serviceState)}))}static sendResponseAddingAddressRecords(e,t,r,i){const n=[];for(const o of e.getBoundInterfaceNames()){if(!t.advertisesOnInterface(o))continue;const u=r.concat([]),l=t.aRecord(o),h=t.aaaaRecord(o),d=t.aaaaRoutableRecord(o),p=t.aaaaUniqueLocalRecord(o),f=t.addressNSECRecord(),m=t.serviceNSECRecord();l&&(i&&(l.ttl=0),u.push(l)),h&&(i&&(h.ttl=0),u.push(h)),d&&(i&&(d.ttl=0),u.push(d)),p&&(i&&(p.ttl=0),u.push(p)),i&&(f.ttl=0,m.ttl=0);const g=[];g.push(f,m);const v=a.DNSPacket.createDNSResponsePacketsFromRRSet({answers:u,additionals:g});n.push(Promise.race([e.send(v,o),(0,c.PromiseTimeout)(s.MDNSServer.SEND_TIMEOUT).then((()=>({status:"timeout",interface:o})))]))}return Promise.all(n)}}t.Announcer=l,l.CANCEL_REASON="CIAO ANNOUNCEMENT CANCELLED"},2475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Prober=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(5682),s=r(2361),c=i.__importStar(r(6948)),u=r(6948),l=(0,o.default)("ciao:Prober");class h{constructor(e,t,r){this.records=[],this.currentInterval=250,this.serviceEncounteredNameChange=!1,this.sentFirstProbeQuery=!1,this.sentQueriesForCurrentTry=0,this.sentQueries=0,(0,n.default)(e,"responder must be defined"),(0,n.default)(t,"server must be defined"),(0,n.default)(r,"service must be defined"),this.responder=e,this.server=t,this.service=r}getService(){return this.service}probe(){return l("Starting to probe for '%s'...",this.service.getFQDN()),new Promise(((e,t)=>{this.promiseResolve=e,this.promiseReject=t,this.timer=setTimeout(this.sendProbeRequest.bind(this),250*Math.random()),this.timer.unref()}))}cancel(){this.clear(),this.promiseReject(h.CANCEL_REASON)}clear(){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.sentFirstProbeQuery=!1,this.sentQueriesForCurrentTry=0}endProbing(e){this.clear(),e&&(l("Probing for '%s' finished successfully",this.service.getFQDN()),this.promiseResolve(),this.serviceEncounteredNameChange&&this.service.informAboutNameUpdates())}sendProbeRequest(){if(0===this.sentQueriesForCurrentTry&&(this.records=[this.service.srvRecord(),this.service.txtRecord(),this.service.ptrRecord(),...this.service.subtypePtrRecords(),...this.service.allAddressRecords()].sort(u.rrComparator),this.records.forEach((e=>e.flushFlag=!1))),this.sentQueriesForCurrentTry>=3)return void this.endProbing(!0);this.sentQueries>=15&&(this.currentInterval=1e3),l("Sending prober query number %d for '%s'...",this.sentQueriesForCurrentTry+1,this.service.getFQDN()),(0,n.default)(this.records.length>0,"Tried sending probing request for zero record length!");const e=[new a.Question(this.service.getFQDN(),255,!0),new a.Question(this.service.getHostname(),255,!0)];this.server.sendQueryBroadcast({questions:e,authorities:this.records},this.service).then((e=>{const t=(0,s.SendResultFailedRatio)(e);if(1===t)return console.error((0,s.SendResultFormatError)(e,`Failed to send probe queries for '${this.service.getFQDN()}'`),!0),this.endProbing(!1),void this.promiseReject(new Error("Probing failed as of socket errors!"));t>0&&l((0,s.SendResultFormatError)(e,`Some of the probe queries for '${this.service.getFQDN()}' encountered an error`)),"probing"===this.service.serviceState?(this.sentFirstProbeQuery=!0,this.sentQueriesForCurrentTry++,this.sentQueries++,this.timer=setTimeout(this.sendProbeRequest.bind(this),this.currentInterval),this.timer.unref(),this.checkLocalConflicts()):l("Service '%s' is no longer in probing state. Stopping.",this.service.getFQDN())}))}checkLocalConflicts(){let e=!1;for(const t of this.responder.getAnnouncedServices())if(t.getLowerCasedFQDN()===this.service.getLowerCasedFQDN()||t.getLowerCasedHostname()===this.service.getLowerCasedHostname()){e=!0;break}e&&(l("Probing for '%s' failed as of local service. Doing a name change",this.service.getFQDN()),this.handleNameChange())}handleResponse(e,t){if(!this.sentFirstProbeQuery||!this.service.advertisesOnInterface(t.interface))return;let r=!1;for(const t of e.answers.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}for(const t of e.additionals.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}r&&(l("Probing for '%s' failed. Doing a name change",this.service.getFQDN()),this.handleNameChange())}handleNameChange(){this.endProbing(!1),this.service.serviceState="unannounced",this.service.incrementName(),this.service.serviceState="probing",this.serviceEncounteredNameChange=!0,this.timer=setTimeout(this.sendProbeRequest.bind(this),1e3),this.timer.unref()}handleQuery(e,t){if(!this.sentFirstProbeQuery||!this.service.advertisesOnInterface(t.interface))return;let r=!1;for(const t of e.questions.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}r&&this.doTiebreaking(e)}doTiebreaking(e){if(!this.sentFirstProbeQuery)return;let t=0===e.authorities.size;for(const r of e.authorities.values())if(r.getLowerCasedName()===this.service.getLowerCasedFQDN()||r.getLowerCasedName()===this.service.getLowerCasedHostname()){t=!0;break}if(!t)return;const r=this.records,i=Array.from(e.authorities.values()).sort(c.rrComparator),n=c.runTiebreaking(r,i);1===n?l("'%s' won the tiebreak. We gonna ignore the other probing request!",this.service.getFQDN()):-1===n&&(l("'%s' lost the tiebreak. We are waiting a second and try to probe again...",this.service.getFQDN()),this.endProbing(!1),this.timer=setTimeout(this.sendProbeRequest.bind(this),1e3),this.timer.unref())}}t.Prober=h,h.CANCEL_REASON="CIAO PROBING CANCELLED"},572:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryResponse=void 0;const i=r(4119);t.QueryResponse=class{constructor(e){this.sharedAnswer=!1,this.dnsPacket=new i.DNSPacket({type:1}),this.knownAnswers=e}asPacket(){return this.dnsPacket}asString(e){return this.dnsPacket.asLoggingString(e)}containsSharedAnswer(){return this.sharedAnswer}addAnswer(...e){let t=!1;for(const r of e){if(this.isKnownAnswer(r))continue;this.dnsPacket.addAnswers(r)&&(t=!0,r.flushFlag||(this.sharedAnswer=!0))}return t}addAdditional(...e){let t=!1;for(const r of e){if(this.isKnownAnswer(r))continue;if(this.dnsPacket.answers.has(r.asString()))continue;this.dnsPacket.addAdditionals(r)&&(t=!0)}return t}markLegacyUnicastResponse(e,t){this.dnsPacket.id=e,t&&this.dnsPacket.addQuestions(...t),this.dnsPacket.answers.forEach((e=>{e.flushFlag=!1,e.ttl=10})),this.dnsPacket.additionals.forEach((e=>{e.flushFlag=!1,e.ttl=10})),this.dnsPacket.setLegacyUnicastEncoding(!0)}markTruncated(){this.dnsPacket.flags.truncation=!0}hasAnswers(){return this.dnsPacket.answers.size>0}isKnownAnswer(e){if(!this.knownAnswers)return!1;const t=this.knownAnswers.get(e.asString());return void 0!==t&&t.ttl>e.ttl/2}static combineResponses(e,t){for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuedResponse=void 0;class r{constructor(e,t){this.timeOfCreation=(new Date).getTime(),this.estimatedTimeToBeSent=0,this.delay=-1,this.packet=e,this.interfaceName=t}getPacket(){return this.packet}getTimeSinceCreation(){return(new Date).getTime()-this.timeOfCreation}getTimeTillSent(){return Math.max(0,this.estimatedTimeToBeSent-(new Date).getTime())}calculateRandomDelay(){this.delay=100*Math.random()+20,this.estimatedTimeToBeSent=(new Date).getTime()+this.delay}scheduleResponse(e){this.timer=setTimeout(e,this.delay),this.timer.unref()}delayWouldBeInTimelyManner(e){return e.estimatedTimeToBeSent-this.timeOfCreation<=r.MAX_DELAY}combineWithNextPacketIfPossible(e){return this.interfaceName===e.interfaceName&&(!!e.packet.canBeCombinedWith(this.packet)&&(e.packet.combineWith(this.packet),e.timeOfCreation=Math.min(this.timeOfCreation,e.timeOfCreation),this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.delayed=!0,!0))}combineWithUniqueResponseIfPossible(e,t){return this.interfaceName===t&&(!!this.packet.canBeCombinedWith(e.asPacket())&&(this.packet.combineWith(e.asPacket()),!0))}}t.QueuedResponse=r,r.MAX_DELAY=500},341:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TruncatedQuery=t.TruncatedQueryEvent=t.TruncatedQueryResult=void 0;const i=r(4434);var n,o;!function(e){e[e.ABORT=1]="ABORT",e[e.AGAIN_TRUNCATED=2]="AGAIN_TRUNCATED",e[e.FINISHED=3]="FINISHED"}(n||(t.TruncatedQueryResult=n={})),function(e){e.TIMEOUT="timeout"}(o||(t.TruncatedQueryEvent=o={}));class a extends i.EventEmitter{constructor(e){super(),this.arrivedPackets=1,this.timeOfArrival=(new Date).getTime(),this.packet=e,this.timer=this.resetTimer()}getPacket(){return this.packet}getArrivedPacketCount(){return this.arrivedPackets}getTotalWaitTime(){return(new Date).getTime()-this.timeOfArrival}appendDNSPacket(e){if(this.packet.combineWith(e),this.arrivedPackets++,e.flags.truncation){return(new Date).getTime()-this.timeOfArrival>5e3?1:(this.resetTimer(),2)}return clearTimeout(this.timer),this.removeAllListeners(),3}resetTimer(){return this.timer&&clearTimeout(this.timer),this.timer=setTimeout(this.timeout.bind(this),400+100*Math.random())}timeout(){this.emit("timeout"),this.removeAllListeners()}}t.TruncatedQuery=a},7585:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dnsLowerCase=void 0;const r=/[A-Z]/g;t.dnsLowerCase=function(e){return e.replace(r,(e=>e.toLowerCase()))}},9152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNetAddress=t.ipAddressFromReversAddressName=t.formatReverseAddressPTRName=t.shortenIPv6=t.enlargeIPv6=t.removeTLD=t.formatHostname=t.stringify=t.parseFQDN=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278));function a(e){return e.startsWith("_")?e.slice(1):e}function s(e){(0,n.default)(o.default.isIPv6(e),"Illegal argument. Must be ipv6 address!"),(0,n.default)(!e.includes("."),"ipv4-mapped ipv6 addresses are currently unsupported!");const t=e.split(":");if(""===t[0])for(t.splice(0,1);t.length<8;)t.unshift("0000");else if(""===t[t.length-1])for(t.splice(t.length-1,1);t.length<8;)t.push("0000");else if(t.length<8){let e;for(e=0;er&&(t=i,r=n),i=o}if(-1!==t){const i=0===t||t+r===8;e[t]=i?":":"",r>1&&e.splice(t+1,r-1)}const i=e.join(":");return":"===i?"::":i}t.parseFQDN=function(e){const t=e.split(".");(0,n.default)(t.length>=3,"Received illegal fqdn: "+e);let r=t.length-1,i="";for(;"_tcp"!==(o=t[r])&&"_udp"!==o;)i=a(t[r])+(i?"."+i:""),r--;var o;(0,n.default)(r>=1,"Failed to parse illegal fqdn: "+e);const s=a(t[r--]),c=a(t[r--]);if(r<0)return{domain:i,protocol:s,type:c};if(function(e){return"_sub"===e}(t[r])){r--,(0,n.default)(0===r,"Received illegal formatted sub type fqdn: "+e);return{domain:i,protocol:s,type:c,subtype:a(t[r])}}return{domain:i,protocol:s,type:c,name:a(t.slice(0,r+1).join("."))}},t.stringify=function(e){let t;return(0,n.default)(e.type,"type cannot be undefined"),(0,n.default)(e.type.length<=15,"type must not be longer than 15 characters"),t=function(e){return"subtype"in e}(e)?`_${e.subtype}._sub.`:e.name?`${e.name}.`:"",`${t}_${e.type}._${e.protocol||"tcp"}.${e.domain||"local"}.`},t.formatHostname=function(e,t="local"){(0,n.default)(!e.endsWith("."),"hostname must not end with the root label!");const r="."+t;return(e.endsWith(r)?e:e+r)+"."},t.removeTLD=function(e){e.endsWith(".")&&(e=e.substring(0,e.length-1));const t=e.lastIndexOf(".");return e.slice(0,t)},t.enlargeIPv6=s,t.shortenIPv6=c,t.formatReverseAddressPTRName=function(e){if(o.default.isIPv4(e)){return e.split(".").reverse().join(".")+".in-addr.arpa"}if(o.default.isIPv6(e)){const t=(e=s(e).toUpperCase()).replace(/:/g,"").split("").reverse();return(0,n.default)(32===t.length,"Encountered invalid ipv6 address length! "+t.length),t.join(".")+".ip6.arpa"}throw new Error("Supplied illegal ip address format: "+e)},t.ipAddressFromReversAddressName=function(e){if((e=e.toLowerCase()).endsWith(".in-addr.arpa")){return e.replace(".in-addr.arpa","").split(".").reverse().join(".")}if(e.endsWith(".ip6.arpa")){const t=e.replace(".ip6.arpa","").split(".").reverse();(0,n.default)(32===t.length,"Encountered illegal length for .ip6.arpa split!");const r=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerClosedError=t.InterfaceNotFoundError=t.ERR_SERVER_CLOSED=t.ERR_INTERFACE_NOT_FOUND=void 0,t.ERR_INTERFACE_NOT_FOUND="ERR_INTERFACE_NOT_FOUND",t.ERR_SERVER_CLOSED="ERR_SERVER_CLOSED";class r extends Error{constructor(e){super(e),this.name="ERR_INTERFACE_NOT_FOUND"}}t.InterfaceNotFoundError=r;class i extends Error{constructor(e){super(e),this.name=t.ERR_SERVER_CLOSED}}t.ServerClosedError=i},8390:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromiseTimeout=void 0,t.PromiseTimeout=function(e){return new Promise((t=>{setTimeout((()=>t()),e)}))}},5762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sortedInsert=void 0,t.sortedInsert=function(e,t,r){let i=0,n=e.length-1,o=-1;for(;i0?i+1:i),e.splice(o,0,t)}},6948:(e,t)=>{"use strict";function r(e,t){if(e.class!==t.class)return e.class-t.class;if(e.type!==t.type)return e.type-t.type;const r=e.getRawData(),i=t.getRawData(),n=Math.max(r.length,i.length);for(let e=0;e=r.length&&e=i.length&&e=e.length&&n=t.length&&n{const i=r(4434).EventEmitter,n=r(9278),o=r(1145),a=r(9343),s=r(2293),c=r(9453),u=r(454),l=r(5657);function h(e){var t=new i;e||(e={});var o=t.stream=function(e){if(e.stream)return e.stream;var t=e.host,i=e.port,o=e.socket;if(o)return n.createConnection(o);if(i)return n.createConnection(i,t);var a=e.busAddress||process.env.DBUS_SESSION_BUS_ADDRESS;if(!a)throw new Error("unknown bus address");for(var s=a.split(";"),c=0;c{const i=r(2861).Buffer;t.M=function(e,t){var r=t-e._offset%t;if(0!==r&&r!==t){var n=i.alloc(r);e.put(i.from(n)),e._offset+=r}}},454:(e,t,r)=>{const i=r(4434).EventEmitter,n=r(1145),o=r(8894),a=r(5769).introspectBus;e.exports=function e(t,r){if(!(this instanceof e))return new e(t);r||(r={});var s=this;function c(e,t){this.name=e,this.service=t,this.as=function(e){return this.proxy[e]}}function u(e,t){this.name=e,this.bus=t,this.getObject=function(e,t){if(void 0===e)return t(new Error("Object name is null or undefined"));var r=new c(e,this);a(r,(function(e,i,n){if(e)return t(e);r.proxy=i,r.nodes=n,t(null,r)}))},this.getInterface=function(e,t,r){this.getObject(e,(function(e,i){if(e)return r(e);r(null,i.as(t))}))}}this.connection=t,this.serial=1,this.cookies={},this.methodCallHandlers={},this.signals=new i,this.exportedObjects={},this.invoke=function(e,t){e.type||(e.type=n.messageType.methodCall),e.serial=s.serial++,this.cookies[e.serial]=t,s.connection.message(e)},this.invokeDbus=function(e,t){e.path||(e.path="/org/freedesktop/DBus"),e.destination||(e.destination="org.freedesktop.DBus"),e.interface||(e.interface="org.freedesktop.DBus"),s.invoke(e,t)},this.mangle=function(e,t,r){var i={};return"object"==typeof e?(i.path=e.path,i.interface=e.interface,i.member=e.member):(i.path=e,i.interface=t,i.member=r),JSON.stringify(i)},this.sendSignal=function(e,t,r,i,o){var a={type:n.messageType.signal,serial:s.serial++,interface:t,path:e,member:r};i&&(a.signature=i,a.body=o),s.connection.message(a)},this.sendError=function(e,t,r){var i={type:n.messageType.error,serial:s.serial++,replySerial:e.serial,destination:e.sender,errorName:t,signature:"s",body:[r]};this.connection.message(i)},this.sendReply=function(e,t,r){var i={type:n.messageType.methodReturn,serial:s.serial++,replySerial:e.serial,destination:e.sender,signature:t,body:r};this.connection.message(i)},this.connection.on("message",(function(e){function t(t,r,i){Promise.resolve().then((function(){return r.apply(t,(e.body||[]).concat(e))})).then((function(t){var r={type:n.messageType.methodReturn,serial:s.serial++,destination:e.sender,replySerial:e.serial};null!==t&&(r.signature=i,r.body=[t]),s.connection.message(r)}),(function(t){s.sendError(e,t.dbusName||"org.freedesktop.DBus.Error.Failed",t.message||"")}))}var r;if(e.type===n.messageType.methodReturn||e.type===n.messageType.error){if(r=s.cookies[e.replySerial]){delete s.cookies[e.replySerial];var i={connection:s.connection,bus:s,message:e,signature:e.signature},a=e.body||[];e.type===n.messageType.methodReturn?(a=[null].concat(a),r.apply(i,a)):r.call(i,{name:e.errorName,message:a})}}else if(e.type===n.messageType.signal)s.signals.emit(s.mangle(e),e.body,e.signature);else{if(o(e,s))return;var c,u,l;if(c=s.exportedObjects[e.path]){if(u=c[e.interface]){var h=(l=u[1])[e.member];return h?void t(l,h,u[0].methods[e.member][1]):void s.sendError(e,"org.freedesktop.DBus.Error.UnknownMethod",`Method "${e.member}" on interface "${e.interface}" doesn't exist`)}console.error(`Interface ${e.interface} is not supported`)}(r=s.methodCallHandlers[s.mangle(e)])?t(null,r[0],r[1]):s.sendError(e,"org.freedesktop.DBus.Error.UnknownService","Uh oh oh")}})),this.setMethodCallHandler=function(e,t,r,i){var n=s.mangle(e,t,r);s.methodCallHandlers[n]=i},this.exportInterface=function(e,t,r){if((s.exportedObjects[t]?s.exportedObjects[t]:s.exportedObjects[t]={})[r.name]=[r,e],"function"==typeof e.emit){var i=e.emit;e.emit=function(){var o,a=Array.prototype.slice.apply(arguments),c=a[0];if(!c)throw new Error("Trying to emit undefined signa");if(r.signals&&r.signals[c]){o=r.signals[c];var u={type:n.messageType.signal,serial:s.serial++,interface:r.name,path:t,member:c};o[0]&&(u.signature=o[0],u.body=a.slice(1)),s.connection.message(u),s.serial++}i.apply(e,a)}}},!0!==r.direct?this.invokeDbus({member:"Hello"},(function(e,t){if(e)throw new Error(e);s.name=t})):s.name=null,this.getService=function(e){return new u(e,this)},this.getObject=function(e,t,r){return this.getService(e).getObject(t,r)},this.getInterface=function(e,t,r,i){return this.getObject(e,t,(function(e,t){if(e)return i(e);i(null,t.as(r))}))},this.addMatch=function(e,t){this.invokeDbus({member:"AddMatch",signature:"s",body:[e]},t)},this.removeMatch=function(e,t){this.invokeDbus({member:"RemoveMatch",signature:"s",body:[e]},t)},this.getId=function(e){this.invokeDbus({member:"GetId"},e)},this.requestName=function(e,t,r){this.invokeDbus({member:"RequestName",signature:"su",body:[e,t]},(function(e,t){r&&r(e,t)}))},this.releaseName=function(e,t){this.invokeDbus({member:"ReleaseName",signature:"s",body:[e]},t)},this.listNames=function(e){this.invokeDbus({member:"ListNames"},e)},this.listActivatableNames=function(e){this.invokeDbus({member:"ListActivatableNames"},e)},this.updateActivationEnvironment=function(e,t){this.invokeDbus({member:"UpdateActivationEnvironment",signature:"a{ss}",body:[e]},t)},this.startServiceByName=function(e,t,r){this.invokeDbus({member:"StartServiceByName",signature:"su",body:[e,t]},r)},this.getConnectionUnixUser=function(e,t){this.invokeDbus({member:"GetConnectionUnixUser",signature:"s",body:[e]},t)},this.getConnectionUnixProcessId=function(e,t){this.invokeDbus({member:"GetConnectionUnixProcessID",signature:"s",body:[e]},t)},this.getNameOwner=function(e,t){this.invokeDbus({member:"GetNameOwner",signature:"s",body:[e]},t)},this.nameHasOwner=function(e,t){this.invokeDbus({member:"NameHasOwner",signature:"s",body:[e]},t)}}},1145:e=>{e.exports={messageType:{invalid:0,methodCall:1,methodReturn:2,error:3,signal:4},headerTypeName:[null,"path","interface","member","errorName","replySerial","destination","sender","signature"],fieldSignature:{path:"o",interface:"s",member:"s",errorName:"s",replySerial:"u",destination:"s",sender:"s",signature:"g"},headerTypeId:{path:1,interface:2,member:3,errorName:4,replySerial:5,destination:6,sender:7,signature:8},protocolVersion:1,flags:{noReplyExpected:1,noAutoStart:2},endianness:{le:108,be:66},messageSignature:"yyyyuua(yv)",defaultAuthMethods:["EXTERNAL","DBUS_COOKIE_SHA1","ANONYMOUS"]}},191:(e,t,r)=>{const i=r(6094),n=r(5970);function o(e,t,r){"object"!=typeof r?r={ayBuffer:!0,ReturnLongjs:!1}:void 0===r.ayBuffer&&(r.ayBuffer=!0),this.options=r,this.buffer=e,this.startPos=t||0,this.pos=0}o.prototype.align=function(e){var t=(1<>e<{const i=r(2861).Buffer,n=r(6982),o=r(9896),a=r(6928),s=r(1145),c=r(4888);function u(e,t,r){var i=a.join(process.env[process.platform.match(/$win/)?"USERPROFILE":"HOME"],".dbus-keyrings");0===e.length&&(e="org_freedesktop_general");var n=a.join(i,e);o.stat(i,(function(e,i){return e?r(e):18&i.mode?r(new Error("User keyrings directory is writeable by other users. Aborting authentication")):process.hasOwnProperty("getuid")&&i.uid!==process.getuid()?r(new Error("Keyrings directory is not owned by the current user. Aborting authentication!")):void o.readFile(n,"ascii",(function(e,i){if(e)return r(e);for(var n=i.split("\n"),o=0;o{const i=r(8805);function n(e,t){this.$parent=e,this.$name=t,this.$methods={},this.$properties={},this.$callbacks=[],this.$sigHandlers=[]}function o(e,t,r){return`type='signal',path='${e}',interface='${t}',member='${r}'`}e.exports.introspectBus=function(t,r){t.service.bus.invoke({destination:t.service.name,path:t.name,interface:"org.freedesktop.DBus.Introspectable",member:"Introspect"},(function(i,n){e.exports.processXML(i,n,t,r)}))},e.exports.processXML=function(t,r,o,a){if(t)return a(t);(new i.Parser).parseString(r,(function(t,r){if(t)return a(t);if(!r.node)throw new Error("No root XML node");if(!(r=r.node).interface){if(r.node&&r.node.length>0&&r.node[0].$){var i=Object.assign(o,{});return"/"!==i.name.slice(-1)&&(i.name+="/"),i.name+=r.node[0].$.name,e.exports.introspectBus(i,a)}return a(new Error("No such interface found"))}for(var s,c,u,l,h,d,p,f={},m=[],g=r.interface,v=r.node||[],y=1;yt=>this.$readProp(e,t),set:function(t){this.$writeProp(e,t)}})},n.prototype.$readProp=function(e,t){this.$parent.service.bus.invoke({destination:this.$parent.service.name,path:this.$parent.name,interface:"org.freedesktop.DBus.Properties",member:"Get",signature:"ss",body:[this.$name,e]},(function(e,r){e?t(e):1===r[0].length?t(e,r[1][0]):t(e,r[1])}))},n.prototype.$writeProp=function(e,t){this.$parent.service.bus.invoke({destination:this.$parent.service.name,path:this.$parent.name,interface:"org.freedesktop.DBus.Properties",member:"Set",signature:"ssv",body:[this.$name,e,[this.$properties[e].type,t]]})}},5068:(e,t,r)=>{const i=r(2613),n=r(5970),o=r(7019),a=r(7030),s=r(3597).M;function c(e,t,r){if(t.length!==r.length)throw new Error("Invalid struct data");for(var i=0;i{const i=r(2861).Buffer,n=r(3597).M,o=r(5970),a=r(6094);t.MakeSimpleMarshaller=function(e){var t={};function r(e){if("string"!=typeof e)throw new Error(`Data: ${e} was not of type string`);if(-1!==e.indexOf("\0"))throw new Error("String contains null byte")}switch(e){case"o":case"s":t.check=function(e){r(e)},t.marshall=function(e,t){this.check(t),n(e,4);const r=i.from(t,"utf8");e.word32le(r.length).put(r).word8(0),e._offset+=5+r.length};break;case"g":t.check=function(e){r(e),function(e){if(e.length>255)throw new Error(`Data: ${e} is too long for signature type (${e.length} > 255)`);for(var t=0,r=0;r32)throw new Error(`Maximum container type nesting exceeded in signature type:${e}`);switch(e[r]){case"(":++t;break;case")":--t}}o(e)}(e)},t.marshall=function(e,t){this.check(t);const r=i.from(t,"ascii");e.word8(t.length).put(r).word8(0),e._offset+=2+r.length};break;case"y":t.check=function(e){c(e),s(0,255,e)},t.marshall=function(e,t){this.check(t),e.word8(t),e._offset++};break;case"b":t.check=function(e){u(e)},t.marshall=function(e,t){this.check(t),t=t?1:0,n(e,4),e.word32le(t),e._offset+=4};break;case"n":t.check=function(e){c(e),s(-32768,32767,e)},t.marshall=function(e,t){this.check(t),n(e,2);const r=i.alloc(2);r.writeInt16LE(parseInt(t),0),e.put(r),e._offset+=2};break;case"q":t.check=function(e){c(e),s(0,65535,e)},t.marshall=function(e,t){this.check(t),n(e,2),e.word16le(t),e._offset+=2};break;case"i":t.check=function(e){c(e),s(-2147483648,2147483647,e)},t.marshall=function(e,t){this.check(t),n(e,4);const r=i.alloc(4);r.writeInt32LE(parseInt(t),0),e.put(r),e._offset+=4};break;case"u":t.check=function(e){c(e),s(0,4294967295,e)},t.marshall=function(e,t){this.check(t),n(e,4),e.word32le(t),e._offset+=4};break;case"t":t.check=function(e){return l(e,!1)},t.marshall=function(e,t){t=this.check(t),n(e,8),e.word32le(t.low),e.word32le(t.high),e._offset+=8};break;case"x":t.check=function(e){return l(e,!0)},t.marshall=function(e,t){t=this.check(t),n(e,8),e.word32le(t.low),e.word32le(t.high),e._offset+=8};break;case"d":t.check=function(e){if("number"!=typeof e)throw new Error(`Data: ${e} was not of type number`);if(Number.isNaN(e))throw new Error(`Data: ${e} was not a number`);if(!Number.isFinite(e))throw new Error("Number outside range")},t.marshall=function(e,t){this.check(t),n(e,8);const r=i.alloc(8);r.writeDoubleLE(parseFloat(t),0),e.put(r),e._offset+=8};break;default:throw new Error(`Unknown data type format: ${e}`)}return t};var s=function(e,t,r){if(r>t||r{const i=r(2861).Buffer,n=r(5068),o=r(1145),a=r(191),s=r(5783);e.exports.unmarshalMessages=function(e,t,r){var i,n,c,u,l=0,h=0,d=0;e.on("readable",(function(){for(;;)if(0===l){if(!(i=e.read(16)))break;l=1,c=i.readUInt32LE(12),u=c+7>>3<<3,d=i.readUInt32LE(4),h=u+d}else{if(!(n=e.read(h)))break;l=0;var p=new a(n,void 0,r),f=p.readArray(s[0].child[0],c);p.align(3);var m={};m.serial=i.readUInt32LE(8);for(var g=0;g0&&m.signature&&(m.body=p.read(m.signature)),t(m)}}))},e.exports.unmarshall=function(e,t){for(var r=new a(e,void 0,t),i=r.read("yyyyuua(yv)"),n={},s=0;s>3<<3,p=d+s,f=i.alloc(p);return u.copy(f),h.copy(f,u.length),s>0&&t.copy(f,d),f}},4888:(e,t,r)=>{const i=r(2861).Buffer;e.exports=function(e,t){var r=[];e.on("readable",(function n(){for(;;){var o=e.read(1);if(!o)return;var a=o[0];if(10===a){try{t(i.from(r))}catch(t){e.emit("error",t)}return void e.removeListener("readable",n)}r.push(a)}}))}},9453:(e,t,r)=>{const i=r(2861).Buffer,n=r(4888);e.exports=function(e,t,r){e.name="SERVER SERVER",n(e,(function(t){console.log(["hello string: ",t.toString(),t]),e.write("REJECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS\r\n"),n(e,(function(){e.write(`DATA ${i.from("org_freedesktop_general 642038150 b9ce247a275f427c8586e4c9de9bb951").toString("hex")}\r\n`),n(e,(function(){e.write("OK 6f72675f667265656465736b746f705f67656e6572616c20353631303331333937206239636532343761323735663432376338353836653463396465396262393531\r\n"),n(e,(function(e){console.log(["AFTER begin: ",e.toString()]),r(null)}))}))}))}))}},5657:(e,t,r)=>{const i=r(9640),n=r(9278);e.exports.createServer=function(e){return new function(){var t=123;this.server=n.createServer((function(r){r.idd=t,t++;var n=i.createConnection({stream:r,server:!0});e&&e(n)})),this.listen=this.server.listen.bind(this.server)}}},5970:e=>{var t={"{":"}","(":")"},r={};"(){}ybnqiuxtdsogarvehm*?@&^".split("").forEach((function(e){r[e]=!0})),e.exports=function(e){var i=0;function n(){if(i{const i=r(1145),n=r(5970);var o;function a(e){var t=[],r=function(e,r,i){e&&n(e).forEach((function(e,n){var o=r?r[n]:i+n,a="signal"===i?"":`" direction="${i}`;t.push(` `)}))};if(t.push(` `),e.methods)for(var i in e.methods){var o=e.methods[i];t.push(` `),r(o[0],o[2],"in"),r(o[1],o[3],"out"),t.push(" ")}if(e.signals)for(var a in e.signals){var c=e.signals[a];t.push(` `),r(c[0],c.slice(1),"signal"),t.push(" ")}if(e.properties)for(const r in e.properties)t.push(` `);return t.push(" "),t.join("\n")}function s(e){var t=[];return e.forEach((function(e){t.push(e.type+s(e.child)),"{"===e.type&&t.push("}"),"("===e.type&&t.push(")")})),t.join("")}e.exports=function(e,t){if("org.freedesktop.DBus.Introspectable"===e.interface&&"Introspect"===e.member){"/"===e.path&&(e.path="");var r=[''],n={};for(var s in t.exportedObjects)if(0===s.indexOf(e.path)){var c=t.exportedObjects[e.path];if(c)n[e.path]=c;else{if("/"!==s[e.path.length])continue;n[s.substr(e.path.length).split("/")[1]]=null}}var u=Object.keys(n).length;if(0===u)r.push("");else if(1===u){var l=n[Object.keys(n)[0]];if(l){for(var h in r.push(""),l)r.push(a(l[h][0]));r.push(o),r.push("")}else r.push(`\n \n `)}else{for(var d in r.push(""),n)if(null===n[d])r.push(` `);else{for(var p in l=n[d],r.push(` `),l)r.push(a(l[p][0]));r.push(o),r.push(" ")}r.push("")}const f={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender,signature:"s",body:[r.join("\n")]};return t.connection.message(f),1}if("org.freedesktop.DBus.Properties"===e.interface){var f=e.body[0],m=t.exportedObjects[e.path];if(!m||!m[f])return t.sendError(e,"org.freedesktop.DBus.Error.UnknownMethod","Uh oh oh"),1;var g=m[f][1];const r={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender};if("Get"===e.member||"Set"===e.member){var v=e.body[1],y=m[f][0].properties[v];if("Get"===e.member){var C=g[v];r.signature="v",r.body=[[y,C]]}else g[v]=1234}else if("GetAll"===e.member){r.signature="a{sv}";var S=[];for(var E in m[f][0].properties){var _=m[f][0].properties[E];S.push([E,[_,g[E]]])}r.body=[S]}return t.connection.message(r),1}if("org.freedesktop.DBus.Peer"===e.interface){const r={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender};return"Ping"===e.member||"GetMachineId"===e.member&&(r.signature="s",r.body=["This is a machine id. TODO: implement"]),t.connection.message(r),1}return 0},o=' \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '},7019:(e,t,r)=>{const i=r(2613);e.exports=function e(){if(!(this instanceof e))return new e;var t=[],r=0;this.put=function(e){return t.push({buffer:e}),r+=e.length,this},this.word8=function(e){return t.push({bytes:1,value:e}),r+=1,this},this.floatle=function(e){return t.push({bytes:"float",endian:"little",value:e}),r+=4,this},[8,16,24,32,64].forEach(function(e){this["word"+e+"be"]=function(i){return t.push({endian:"big",bytes:e/8,value:i}),r+=e/8,this},this["word"+e+"le"]=function(i){return t.push({endian:"little",bytes:e/8,value:i}),r+=e/8,this}}.bind(this)),this.pad=function(e){return i(Number.isInteger(e),"pad(bytes) must be supplied with an integer!"),t.push({endian:"big",bytes:e,value:0}),r+=e,this},this.length=function(){return r},this.buffer=function(){var e=Buffer.alloc(r),i=0;return t.forEach((function(t){if(t.buffer)t.buffer.copy(e,i,0),i+=t.buffer.length;else if("float"===t.bytes){var r=Math.abs(t.value),n=1*(t.value>=0),o=Math.ceil(Math.log(r)/Math.LN2),a=r/(1<=0:u<8*t.bytes;u+=c[1])e[i++]=u>=32?255&Math.floor(t.value/Math.pow(2,u)):t.value>>u&255})),e},this.write=function(e){e.write(this.buffer())}}},9511:(e,t,r)=>{"use strict";var i=r(8075)("ArrayBuffer.prototype.byteLength",!0),n=r(4670);e.exports=function(e){return n(e)?i?i(e):e.byteLength:NaN}},3031:e=>{"use strict";function t(e){return i(e,[])}function r(e,t){if("number"!=typeof t)throw new TypeError("Expected the depth to be a number");return n(e,[],t)}function i(e,t){for(var r=0;r-1&&Array.isArray(o)?n(o,t,r):t.push(o)}return t}e.exports=function(e){if(!Array.isArray(e))throw new TypeError("Expected value to be an array");return t(e)},e.exports.from=t,e.exports.depth=function(e,t){if(!Array.isArray(e))throw new TypeError("Expected value to be an array");return r(e,t)},e.exports.fromDepth=r},8404:(e,t,r)=>{"use strict";const i=r(4033),n=r(8525),o=r(4060);function a(e){if(!(this instanceof a))return new a(e);this._server=new n(e),this._registry=new i(this._server)}a.prototype={publish:function(e){return this._registry.publish(e)},unpublishAll:function(e){this._registry.unpublishAll(e)},find:function(e,t){return new o(this._server.mdns,e,t)},findOne:function(e,t){const r=new o(this._server.mdns,e);return r.once("up",(function(e){r.stop(),t&&t(e)})),r},destroy:function(){this._registry.destroy(),this._server.mdns.destroy()}},e.exports=a},4060:(e,t,r)=>{"use strict";const i=r(9023),n=r(4434).EventEmitter,o=r(2781),a=r(6917),s=r(3272),c=".local",u="_services._dns-sd._udp"+c;function l(e,t,r){if("function"==typeof t)return new l(e,null,t);n.call(this),this._mdns=e,this._onresponse=null,this._serviceMap={},this._txt=s(t.txt),t&&t.type?(this._name=o.stringify(t.type,t.protocol||"tcp")+c,t.name&&(this._name=t.name+"."+this._name),this._wildcard=!1):(this._name=u,this._wildcard=!0),this.services=[],r&&this.on("up",r),this.start()}e.exports=l,i.inherits(l,n),l.prototype.start=function(){if(this._onresponse)return;const e=this,t={};this._wildcard||(t[this._name]=!0),this._onresponse=function(r,i){e._wildcard&&r.answers.forEach((function(r){"PTR"!==r.type||r.name!==e._name||r.name in t||(t[r.data]=!0,e._mdns.query(r.data,"PTR"))})),Object.keys(t).forEach((function(t){(function(e,t){return t.answers.concat(t.additionals).filter((function(t){return"PTR"===t.type&&0===t.ttl&&a(t.name,e)})).map((function(e){return e.data}))})(t,r).forEach(e._removeService.bind(e));const n=function(e,t,r,i){const n=t.answers.concat(t.additionals).filter((function(e){return e.ttl>0}));return n.filter((function(t){return"PTR"===t.type&&a(t.name,e)})).map((function(e){const t={addresses:[]};if(n.filter((function(t){return("SRV"===t.type||"TXT"===t.type)&&a(t.name,e.data)})).forEach((function(e){if("SRV"===e.type){const r=e.name.split("."),n=r[0],a=o.parse(r.slice(1,-1).join("."));t.name=n,t.fqdn=e.name,t.host=e.data.target,t.referer=i,t.port=e.data.port,t.type=a.name,t.protocol=a.protocol,t.subtypes=a.subtypes}else"TXT"===e.type&&(t.rawTxt=e.data,t.txt=r.decodeBlocks(t.rawTxt))})),t.name)return n.filter((function(e){return("A"===e.type||"AAAA"===e.type)&&a(e.name,t.host)})).forEach((function(e){t.addresses.push(e.data)})),t})).filter((function(e){return!!e}))}(t,r,e._txt,i);0!==n.length&&n.forEach((function(t){e._serviceMap[t.fqdn]?e._updateService(t):e._addService(t)}))}))},this._mdns.on("response",this._onresponse),this.update()},l.prototype.stop=function(){this._onresponse&&(this._mdns.removeListener("response",this._onresponse),this._onresponse=null)},l.prototype.update=function(){this._mdns.query(this._name,"PTR")},l.prototype._addService=function(e){this.services.push(e),this._serviceMap[e.fqdn]=!0,this.emit("up",e)},l.prototype._updateService=function(e){let t,r;this.services.some((function(i,n){return!!a(i.fqdn,e.fqdn)&&(t=i,r=n,!0)})),t&&(this.services[r]=e,this.emit("update",e))},l.prototype._removeService=function(e){let t,r;this.services.some((function(i,n){return!!a(i.fqdn,e)&&(t=i,r=n,!0)})),t&&(this.services.splice(r,1),delete this._serviceMap[e],this.emit("down",t))}},2754:(e,t,r)=>{"use strict";const i=r(6917),n=function(e,t,r){this.sent=!1,this.retries=0,this.timer=null,this.cb=r,this.mdns=e,this.service=t,this.bound=this.onMDNSresponse.bind(this),this.matchRRBound=this.matchRR.bind(this)};n.prototype={start:function(){this.mdns.on("response",this.bound),setTimeout(this.try.bind(this),250*Math.random())},try:function(){this.service._activated&&!this.service._destroyed&&this.mdns.query(this.service.fqdn,"ANY",function(){this.sent=!0,this.timer=setTimeout(++this.retries<3?this.try.bind(this):this.done.bind(this,!1),250),this.timer.unref()}.bind(this))},matchRR:function(e){return i(e.name,this.service.fqdn)},onMDNSresponse:function(e){this.sent&&(e.answers.some(this.matchRRBound)||e.additionals.some(this.matchRRBound))&&this.done(!0)},done:function(e){this.mdns.removeListener("response",this.bound),clearTimeout(this.timer),this.cb(e)}},e.exports=n},4033:(e,t,r)=>{"use strict";const i=r(3031),n=r(5259),o=r(2754),a=function(e){this._server=e,this._services=[]};a.prototype={publish:function(e){const t=new n(e=e||{});return t.on("service-publish",this._onServicePublish.bind(this)),t.on("service-unpublish",this._onServiceUnpublish.bind(this)),t.on("service-announce-request",this._onAnnounceRequest.bind(this)),t.on("service-packet-change",this._onServiceChange.bind(this)),t.start(),t},unpublishAll:function(e){this._tearDown(this._services,e),this._services=[]},destroy:function(){for(let e=0;e{"use strict";const i=r(2567),n=r(6917),o=r(3031),a=r(3805),s=function(e){this.mdns=i(e),this.mdns.setMaxListeners(0),this.registry={},this.mdns.on("query",this._respondToQuery.bind(this))};s.prototype={_respondToQuery:function(e){for(let t=0;t{"PTR"===e.type&&(c=c.concat(this._recordsFor(e.data,"SRV")).concat(this._recordsFor(e.data,"TXT")))})),c.filter((e=>"SRV"===e.type)).map((e=>e.data.target)).filter(a.unique()).forEach((e=>{c=c.concat(this._recordsFor(e,"A")).concat(this._recordsFor(e,"AAAA"))}))),this.mdns.respond({answers:s,additionals:c},(e=>{if(e)throw e}))}},register:function(e){Array.isArray(e)||(e=[e]);for(let t=0;te.name!==r.name)))}},_recordsFor:function(e,t){return t in this.registry?this.registry[t].filter((t=>{const r=~e.indexOf(".")?t.name:t.name.split(".")[0];return n(r,e)})):[]}},e.exports=s},5259:(e,t,r)=>{"use strict";const i=r(857),n=r(9023),o=r(9278),a=r(2613),s=r(4434).EventEmitter,c=r(2781),u=r(6480),l=".local",h=function(e){if(!e.name)throw new Error("Required name not given");if(!e.type)throw new Error("Required type not given");if(!e.port)throw new Error("Required port not given");if(this.name=e.name,this.protocol=e.protocol||"tcp",this.probe=!1!==e.probe,this.type=c.stringify(e.type,this.protocol),this.host=e.host||i.hostname(),this.port=e.port,this.fqdn=this.name+"."+this.type+l,this.subtypes=e.subtypes||null,this.txt=e.txt||null,this.published=!1,this.addUnsafeServiceEnumerationRecord=e.addUnsafeServiceEnumerationRecord||!1,this.restrictedAddresses=void 0,e.restrictedAddresses){a(e.restrictedAddresses.length,"The service property 'restrictedAddresses' cannot be an empty array!"),this.restrictedAddresses=new Map;for(const t of e.restrictedAddresses)if(o.isIP(t)){if("0.0.0.0"===t||"::"===t)throw new Error(`[${this.fqdn}] Unspecified ip address (${t}) cannot be used to restrict on to!`);const e=u.resolveInterface(t);if(!e)throw new Error(`[${this.fqdn}] Could not restrict service to address ${t} as we could not resolve it to an interface name!`);const r=this.restrictedAddresses.get(e);r?r.length&&!r.includes(t)&&r.push(t):this.restrictedAddresses.set(e,[t])}else this.restrictedAddresses.set(t,[])}this.disabledIpv6=e.disabledIpv6||!1,this._activated=!1};n.inherits(h,s);const d={start:function(){this._activated||(this._activated=!0,this.emit("service-publish",this))},stop:function(e){this._activated?this.emit("service-unpublish",this,e):e()},updateTxt:function(e,t){this.packet&&this.emit("service-packet-change",this.packet,this.onAnnounceComplete.bind(this)),this.packet=null,this.txt=e,this.published&&(this._unpublish(),this.announce(t))},announce:function(e){this._destroyed||(this.packet||(this.packet=this._records()),this.timer&&clearTimeout(this.timer),this.delay=1e3,this.emit("service-announce-request",this.packet,e||!1,this.onAnnounceComplete.bind(this)))},onAnnounceComplete:function(){this.published||(this._activated=!0,this.published=!0,this.emit("up")),this.delay=3*this.delay,this.delay<36e5&&!this._destroyed&&this._activated?this.timer=setTimeout(this.announce.bind(this),this.delay).unref():(this.timer=void 0,this.delay=void 0)},deactivate:function(){this._unpublish(),this._activated=!1},destroy:function(){this._unpublish(),this.removeAllListeners(),this._destroyed=!0},_unpublish:function(){this.timer&&clearTimeout(this.timer),this.published=!1},_records:function(e){const t=[this._rrPtr(),this._rrSrv(),this._rrTxt()];return t.push(...this._addressRecords()),!e&&this.addUnsafeServiceEnumerationRecord&&t.push(this._rrMetaPtr()),t},_addressRecords:function(){const e=[],t=[];return Object.entries(i.networkInterfaces()).forEach((([r,i])=>{let n=this.restrictedAddresses?this.restrictedAddresses.get(r):void 0;this.restrictedAddresses&&!n||(n&&0===n.length&&(n=void 0),i.forEach((r=>{r.internal||t.includes(r.address)||n&&n.includes(r.address)||("IPv4"===r.family?(e.push(this._rrA(r.address)),t.push(r.address)):this.disabledIpv6||(e.push(this._rrAaaa(r.address)),t.push(r.address)))})))})),e},_rrMetaPtr:function(){return{name:"_services._dns-sd._udp.local",type:"PTR",ttl:4500,data:this.type+l}},_rrPtr:function(){return{name:this.type+l,type:"PTR",ttl:4500,data:this.fqdn}},_rrSrv:function(){return{name:this.fqdn,type:"SRV",ttl:120,flush:!0,data:{port:this.port,target:this.host}}},_rrTxt:function(){const e=[];if(this.txt){const t=this.txt;Object.keys(t).forEach((r=>{const i=t[r];e.push(r+"="+i)}))}return{name:this.fqdn,type:"TXT",ttl:4500,flush:!0,data:e}},_rrA:function(e){return{name:this.host,type:"A",ttl:120,flush:!0,data:e}},_rrAaaa:function(e){return{name:this.host,type:"AAAA",ttl:120,flush:!0,data:e}}};for(const e in d)h.prototype[e]=d[e];e.exports=h},3805:(e,t,r)=>{const i=r(4982);e.exports={isDuplicateRecord:function(e){return function(t){return e.type===t.type&&e.name===t.name&&i(e.data,t.data)}},unique:function(){const e=[];return function(t){return!~e.indexOf(t)&&(e.push(t),!0)}}}},6917:e=>{"use strict";const t=/[A-Z]/g;function r(e){return e.toLowerCase()}e.exports=function(e,i){return(e=e.replace(t,r))===(i=i.replace(t,r))}},6480:(e,t,r)=>{const i=r(857);e.exports={resolveInterface:function(e){for(const[t,r]of Object.entries(i.networkInterfaces()))for(const i of r)if(i.address===e)return t}}},3272:e=>{"use strict";const t=Buffer.from("=");e.exports=function(e){const r=!!e&&e.binary,i={decodeBlocks:function(e){const i={};return e.forEach((e=>{if(0===e.length)return;const n=e.indexOf(t);if(-1===n)i[e.toString().toLowerCase()]=!0;else if(n>0){const t=e.slice(0,n).toString().toLowerCase();if(t in i)return;const o=e.slice(n+1);i[t]=r?o:o.toString()}})),i}};return i}},2746:e=>{var t=Object.prototype.toString,r="undefined"!=typeof Buffer&&"function"==typeof Buffer.alloc&&"function"==typeof Buffer.allocUnsafe&&"function"==typeof Buffer.from;e.exports=function(e,i,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return o=e,"ArrayBuffer"===t.call(o).slice(8,-1)?function(e,t,i){t>>>=0;var n=e.byteLength-t;if(n<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=n;else if((i>>>=0)>n)throw new RangeError("'length' is out of bounds");return r?Buffer.from(e.slice(t,t+i)):new Buffer(new Uint8Array(e.slice(t,t+i)))}(e,i,n):"string"==typeof e?function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return r?Buffer.from(e,t):new Buffer(e,t)}(e,i):r?Buffer.from(e):new Buffer(e);var o}},8075:(e,t,r)=>{"use strict";var i=r(453),n=r(487),o=n(i("String.prototype.indexOf"));e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},487:(e,t,r)=>{"use strict";var i=r(6743),n=r(453),o=r(6897),a=r(9675),s=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||i.call(c,s),l=r(655),h=n("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(i,c,arguments);return o(t,1+h(0,e.length-(arguments.length-1)),!0)};var d=function(){return u(i,s,arguments)};l?l(e.exports,"apply",{value:d}):e.exports.apply=d},7833:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(736)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},736:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,a=null;function s(...e){if(!s.enabled)return;const i=s,n=Number(new Date),o=n-(r||n);i.diff=o,i.prev=r,i.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";a++;const o=t.formatters[n];if("function"==typeof o){const t=e[a];r=o.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=i,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function i(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r(7833):e.exports=r(6033)},6033:(e,t,r)=>{const i=r(2018),n=r(9023);t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let i=0;i{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=r(7687);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let i=process.env[t];return i=!!/^(yes|on|true|enabled)$/i.test(i)||!/^(no|off|false|disabled)$/i.test(i)&&("null"===i?null:Number(i)),e[r]=i,e}),{}),e.exports=r(736)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)}},4982:(e,t,r)=>{"use strict";var i=r(6525),n=r(8075),o=r(1589),a=r(453),s=r(1158),c=r(920),u=r(7653),l=r(7244),h=r(4634),d=r(4670),p=r(2120),f=r(4035),m=r(7070),g=r(1189),v=r(1539),y=r(593),C=r(5767),S=r(9511),E=n("SharedArrayBuffer.prototype.byteLength",!0),_=n("Date.prototype.getTime"),T=Object.getPrototypeOf,A=n("Object.prototype.toString"),I=a("%Set%",!0),D=n("Map.prototype.has",!0),w=n("Map.prototype.get",!0),b=n("Map.prototype.size",!0),U=n("Set.prototype.add",!0),R=n("Set.prototype.delete",!0),O=n("Set.prototype.has",!0),N=n("Set.prototype.size",!0);function P(e,t,r,i){for(var n,o=s(e);(n=o.next())&&!n.done;)if(F(t,n.value,r,i))return R(e,n.value),!0;return!1}function B(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function L(e,t,r,n,o,a){var s=B(r);if(null!=s)return s;var c=w(t,s),u=i({},o,{strict:!1});return!(void 0===c&&!D(t,s)||!F(n,c,u,a))&&(!D(e,s)&&F(n,c,u,a))}function x(e,t,r){var i=B(r);return null!=i?i:O(t,i)&&!O(e,i)}function M(e,t,r,i,n,o){for(var a,c,u=s(e);(a=u.next())&&!a.done;)if(F(r,c=a.value,n,o)&&F(i,w(t,c),n,o))return R(e,c),!0;return!1}function F(e,t,r,n){var a=r||{};if(a.strict?u(e,t):e===t)return!0;if(v(e)!==v(t))return!1;if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return a.strict?u(e,t):e==t;var c,R=n.has(e),B=n.has(t);if(R&&B){if(n.get(e)===n.get(t))return!0}else c={};return R||n.set(e,c),B||n.set(t,c),function(e,t,r,n){var a,c;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(A(e)!==A(t))return!1;if(l(e)!==l(t))return!1;var u=h(e),v=h(t);if(u!==v)return!1;var R=e instanceof Error,B=t instanceof Error;if(R!==B)return!1;if((R||B)&&(e.name!==t.name||e.message!==t.message))return!1;var V=f(e),H=f(t);if(V!==H)return!1;if((V||H)&&(e.source!==t.source||o(e)!==o(t)))return!1;var j=p(e),G=p(t);if(j!==G)return!1;if((j||G)&&_(e)!==_(t))return!1;if(r.strict&&T&&T(e)!==T(t))return!1;var W=C(e),Y=C(t);if(W!==Y)return!1;if(W||Y){if(e.length!==t.length)return!1;for(a=0;a=0;a--)if(J[a]!=Z[a])return!1;for(a=J.length-1;a>=0;a--)if(!F(e[c=J[a]],t[c],r,n))return!1;var ee=y(e),te=y(t);if(ee!==te)return!1;if("Set"===ee||"Set"===te)return function(e,t,r,i){if(N(e)!==N(t))return!1;var n,o,a,c=s(e),u=s(t);for(;(n=c.next())&&!n.done;)if(n.value&&"object"==typeof n.value)a||(a=new I),U(a,n.value);else if(!O(t,n.value)){if(r.strict)return!1;if(!x(e,t,n.value))return!1;a||(a=new I),U(a,n.value)}if(a){for(;(o=u.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!P(a,o.value,r.strict,i))return!1}else if(!r.strict&&!O(e,o.value)&&!P(a,o.value,r.strict,i))return!1;return 0===N(a)}return!0}(e,t,r,n);if("Map"===ee)return function(e,t,r,n){if(b(e)!==b(t))return!1;var o,a,c,u,l,h,d=s(e),p=s(t);for(;(o=d.next())&&!o.done;)if(u=o.value[0],l=o.value[1],u&&"object"==typeof u)c||(c=new I),U(c,u);else if(void 0===(h=w(t,u))&&!D(t,u)||!F(l,h,r,n)){if(r.strict)return!1;if(!L(e,t,u,l,r,n))return!1;c||(c=new I),U(c,u)}if(c){for(;(a=p.next())&&!a.done;)if(u=a.value[0],h=a.value[1],u&&"object"==typeof u){if(!M(c,e,u,h,r,n))return!1}else if(!(r.strict||e.has(u)&&F(w(e,u),h,r,n)||M(c,e,u,h,i({},r,{strict:!1}),n)))return!1;return 0===N(c)}return!0}(e,t,r,n);return!0}(e,t,a,n)}function k(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0&&"number"!=typeof e[0])&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))))}e.exports=function(e,t,r){return F(e,t,r,c())}},41:(e,t,r)=>{"use strict";var i=r(655),n=r(8068),o=r(9675),a=r(5795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],h=!!a&&a(e,t);if(i)i(e,t,{configurable:null===u&&h?h.configurable:!u,enumerable:null===s&&h?h.enumerable:!s,value:r,writable:null===c&&h?h.writable:!c});else{if(!l&&(s||c||u))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},8452:(e,t,r)=>{"use strict";var i=r(1189),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=r(41),c=r(592)(),u=function(e,t,r,i){if(t in e)if(!0===i){if(e[t]===r)return}else if("function"!=typeof(n=i)||"[object Function]"!==o.call(n)||!i())return;var n;c?s(e,t,r,!0):s(e,t,r)},l=function(e,t){var r=arguments.length>2?arguments[2]:{},o=i(t);n&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";t.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e},t.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}},3843:(e,t,r)=>{"use strict";const i=r(181).Buffer,n=r(834),o=r(2111),a=r(628),s=r(4731),c=r(5874),u=r(26),l=32768,h=t.name={};h.encode=function(e,t,r,{mail:n=!1}={}){t||(t=i.alloc(h.encodingLength(e))),r||(r=0);const o=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let e=[];if(n){let t="";a.split(".").forEach((r=>{r.endsWith("\\")?t+=(t.length?".":"")+r.slice(0,-1):0===e.length&&t.length?e.push(t+"."+r):e.push(r)}))}else e=a.split(".");for(let i=0;i=e.length)throw new Error("Cannot decode name (buffer overflow)");const c=e[t++];if(a+=s?0:1,0===c)break;if(192&c){if(192&~c)throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const r=e.readUInt16BE(t-1)-49152;if(r>=n)throw new Error("Cannot decode name (bad pointer)");t=r,n=r,a+=s?0:1,s=!0}}else{if(t+c>e.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=c+1,o>254)throw new Error("Cannot decode name (name too long)");let n=e.toString("utf-8",t,t+c);r&&(n=n.replace(/\./g,"\\.")),i.push(n),t+=c,a+=s?0:c}}return h.decode.bytes=a,0===i.length?".":i.join(".")},h.decode.bytes=0,h.encodingLength=function(e){return"."===e||".."===e?1:i.byteLength(e.replace(/^\.|\.$/gm,""))+2};const d={encode:function(e,t,r){t||(t=i.alloc(d.encodingLength(e))),r||(r=0);const n=t.write(e,r+1);return t[r]=n,d.encode.bytes=n+1,t}};d.encode.bytes=0,d.decode=function(e,t){t||(t=0);const r=e[t],i=e.toString("utf-8",t+1,t+1+r);return d.decode.bytes=r+1,i},d.decode.bytes=0,d.encodingLength=function(e){return i.byteLength(e)+1};const p={encode:function(e,t,r){t||(t=p.encodingLength(e)),r||(r=0);const i=32767&(e.flags||0),n="response"===e.type?32768:0;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(i|n,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t}};p.encode.bytes=12,p.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1==(r>>15&1),opcode:a.toString(r>>11&15),flag_aa:1==(r>>10&1),flag_tc:1==(r>>9&1),flag_rd:1==(r>>8&1),flag_ra:1==(r>>7&1),flag_z:1==(r>>6&1),flag_ad:1==(r>>5&1),flag_cd:1==(r>>4&1),rcode:o.toString(15&r),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}},p.decode.bytes=12,p.encodingLength=function(){return 12};const f=t.unknown={};f.encode=function(e,t,r){return t||(t=i.alloc(f.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),f.encode.bytes=e.length+2,t},f.encode.bytes=0,f.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),i=e.slice(t+2,t+2+r);return f.decode.bytes=r+2,i},f.decode.bytes=0,f.encodingLength=function(e){return e.length+2};const m=t.ns={};m.encode=function(e,t,r){return t||(t=i.alloc(m.encodingLength(e))),r||(r=0),h.encode(e,t,r+2),t.writeUInt16BE(h.encode.bytes,r),m.encode.bytes=h.encode.bytes+2,t},m.encode.bytes=0,m.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),i=h.decode(e,t+2);return m.decode.bytes=r+2,i},m.decode.bytes=0,m.encodingLength=function(e){return h.encodingLength(e)+2};const g=t.soa={};g.encode=function(e,t,r){t||(t=i.alloc(g.encodingLength(e))),r||(r=0);const n=r;return r+=2,h.encode(e.mname,t,r),r+=h.encode.bytes,h.encode(e.rname,t,r,{mail:!0}),r+=h.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),g.encode.bytes=r-n,t},g.encode.bytes=0,g.decode=function(e,t){t||(t=0);const r=t,i={};return t+=2,i.mname=h.decode(e,t),t+=h.decode.bytes,i.rname=h.decode(e,t,{mail:!0}),t+=h.decode.bytes,i.serial=e.readUInt32BE(t),t+=4,i.refresh=e.readUInt32BE(t),t+=4,i.retry=e.readUInt32BE(t),t+=4,i.expire=e.readUInt32BE(t),t+=4,i.minimum=e.readUInt32BE(t),t+=4,g.decode.bytes=t-r,i},g.decode.bytes=0,g.encodingLength=function(e){return 22+h.encodingLength(e.mname)+h.encodingLength(e.rname)};const v=t.txt={};v.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let t=0;t0;){const r=e[t++];if(--i,i0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let i=0;i0;)i[o++]=b.decode(e,t),t+=b.decode.bytes,n-=b.decode.bytes;return U.decode.bytes=t-r,i},U.decode.bytes=0,U.encodingLength=function(e){return 2+G(e||[],b)};const R=t.dnskey={};R.PROTOCOL_DNSSEC=3,R.ZONE_KEY=128,R.SECURE_ENTRYPOINT=32768,R.encode=function(e,t,r){t||(t=i.alloc(R.encodingLength(e))),r||(r=0);const n=r,o=e.key;if(!i.isBuffer(o))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(R.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,R.encode.bytes=r-n,t.writeUInt16BE(R.encode.bytes-2,n),t},R.encode.bytes=0,R.decode=function(e,t){t||(t=0);const r=t;var i={},n=e.readUInt16BE(t);if(t+=2,i.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==R.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,i.algorithm=e.readUInt8(t),t+=1,i.key=e.slice(t,r+n+2),t+=i.key.length,R.decode.bytes=t-r,i},R.decode.bytes=0,R.encodingLength=function(e){return 6+i.byteLength(e.key)};const O=t.rrsig={};O.encode=function(e,t,r){t||(t=i.alloc(O.encodingLength(e))),r||(r=0);const o=r,a=e.signature;if(!i.isBuffer(a))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(n.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,h.encode(e.signersName,t,r),r+=h.encode.bytes,a.copy(t,r,0,a.length),r+=a.length,O.encode.bytes=r-o,t.writeUInt16BE(O.encode.bytes-2,o),t},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const r=t;var i={},o=e.readUInt16BE(t);return t+=2,i.typeCovered=n.toString(e.readUInt16BE(t)),t+=2,i.algorithm=e.readUInt8(t),t+=1,i.labels=e.readUInt8(t),t+=1,i.originalTTL=e.readUInt32BE(t),t+=4,i.expiration=e.readUInt32BE(t),t+=4,i.inception=e.readUInt32BE(t),t+=4,i.keyTag=e.readUInt16BE(t),t+=2,i.signersName=h.decode(e,t),t+=h.decode.bytes,i.signature=e.slice(t,r+o+2),t+=i.signature.length,O.decode.bytes=t-r,i},O.decode.bytes=0,O.encodingLength=function(e){return 20+h.encodingLength(e.signersName)+i.byteLength(e.signature)};const N=t.rp={};N.encode=function(e,t,r){t||(t=i.alloc(N.encodingLength(e))),r||(r=0);const n=r;return r+=2,h.encode(e.mbox||".",t,r,{mail:!0}),r+=h.encode.bytes,h.encode(e.txt||".",t,r),r+=h.encode.bytes,N.encode.bytes=r-n,t.writeUInt16BE(N.encode.bytes-2,n),t},N.encode.bytes=0,N.decode=function(e,t){t||(t=0);const r=t,i={};return t+=2,i.mbox=h.decode(e,t,{mail:!0})||".",t+=h.decode.bytes,i.txt=h.decode(e,t)||".",t+=h.decode.bytes,N.decode.bytes=t-r,i},N.decode.bytes=0,N.encodingLength=function(e){return 2+h.encodingLength(e.mbox||".")+h.encodingLength(e.txt||".")};const P={encode:function(e,t,r){t||(t=i.alloc(P.encodingLength(e))),r||(r=0);const o=r;for(var a=[],s=0;s>8]&&(a[c>>8]=[]),a[c>>8][c>>3&31]|=1<<7-(7&c)}for(s=0;s>8]=Math.max(t[i>>8]||0,255&i)}var o=0;for(r=0;r>15&1),r.options=U.decode(e,t+8),t+=8+U.decode.bytes;else{const i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=s.toString(-32769&i),r.flush=!!(i&l);const n=V(r.type);r.data=n.decode(e,t+8),t+=8+n.decode.bytes}return H.decode.bytes=t-i,r},H.decode.bytes=0,H.encodingLength=function(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return h.encodingLength(e.name)+8+V(e.type).encodingLength(t)};const j=t.question={};function G(e,t){let r=0;for(let i=0;i{"use strict";t.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e},t.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}},5874:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`},t.toCode=function(e){if("number"==typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}},2111:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e},t.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}},834:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e},t.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}},4928:(e,t,r)=>{var i=r(2203),n=["write","end","destroy"],o=["resume","pause"],a=["data","close"],s=Array.prototype.slice;function c(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r{"use strict";var i=r(453)("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},1237:e=>{"use strict";e.exports=EvalError},9383:e=>{"use strict";e.exports=Error},9290:e=>{"use strict";e.exports=RangeError},9538:e=>{"use strict";e.exports=ReferenceError},8068:e=>{"use strict";e.exports=SyntaxError},9675:e=>{"use strict";e.exports=TypeError},5345:e=>{"use strict";e.exports=URIError},8954:(e,t,r)=>{var i=r(2203).Stream,n=t,o=r(1094),a=r(1813),s=r(4928),c=r(9292),u=r(6736),l=r(175),h=r(8497),d=global.setImmediate||process.nextTick;n.Stream=i,n.through=o,n.from=a,n.duplex=s,n.map=c,n.pause=u,n.split=l,n.pipeline=n.connect=n.pipe=h,n.concat=n.merge=function(){var e=[].slice.call(arguments);1===e.length&&e[0]instanceof Array&&(e=e[0]);var t=new i;t.setMaxListeners(0);var r=0;return t.writable=t.readable=!0,e.length?e.forEach((function(i){i.pipe(t,{end:!1});var n=!1;i.on("end",(function(){n||(n=!0,++r==e.length&&t.emit("end"))}))})):process.nextTick((function(){t.emit("end")})),t.write=function(e){this.emit("data",e)},t.destroy=function(){e.forEach((function(e){e.destroy&&e.destroy()}))},t},n.collect=n.writeArray=function(e){if("function"!=typeof e)throw new Error("function writeArray (done): done must be function");var t=new i,r=[],n=!1;return t.write=function(e){r.push(e)},t.end=function(){n=!0,e(null,r)},t.writable=!0,t.readable=!1,t.destroy=function(){t.writable=t.readable=!1,n||e(new Error("destroyed before end"),r)},t},n.readArray=function(e){var t=new i,r=0,n=!1,o=!1;if(t.readable=!0,t.writable=!1,!Array.isArray(e))throw new Error("event-stream.read expects an array");return t.resume=function(){if(!o){n=!1;for(var i=e.length;r1&&r.emit("data",u),d((function(){if(!(a||o||s))try{s=!0,e.call(r,n++,(function(){s=!1,c.apply(null,arguments)}))}catch(e){r.emit("error",e)}}))}return r.on("end",(function(){a=!0})),r.resume=function(){o=!1,c()},process.nextTick(c),r.pause=function(){o=!0},r.destroy=function(){r.emit("end"),r.emit("close"),a=!0},r},n.mapSync=function(e){return n.through((function(t){var r;try{r=e(t)}catch(e){return this.emit("error",e)}void 0!==r&&this.emit("data",r)}))},n.filterSync=function(e){return n.through((function(t){e(t)&&this.queue(t)}))},n.flatmapSync=function(e){return n.through((function(t){var r=this;t.forEach((function(t){r.queue(e(t))}))}))},n.log=function(e){return n.through((function(t){[].slice.call(arguments);e?console.error(e,t):console.error(t),this.emit("data",t)}))},n.child=function(e){return n.duplex(e.stdin,e.stdout)},n.parse=function(e){var t=!(!e||!e.error);return n.through((function(e){var r;try{e&&(r=JSON.parse(e.toString()))}catch(r){return t?this.emit("error",r):console.error(r,"attempting to parse:",e)}void 0!==r&&this.emit("data",r)}))},n.stringify=function(){var e=r(181).Buffer;return n.mapSync((function(t){return JSON.stringify(e.isBuffer(t)?t.toString():t)+"\n"}))},n.replace=function(e,t){return n.pipeline(n.split(e),n.join(t))},n.join=function(e){if("function"==typeof e)return n.wait(e);var t=!0;return n.through((function(r){return t||this.emit("data",e),t=!1,this.emit("data",r),!0}))},n.wait=function(e){var t=[];return n.through((function(e){t.push(e)}),(function(){var r=Buffer.isBuffer(t[0])?Buffer.concat(t):t.join("");this.emit("data",r),this.emit("end"),e&&e(null,r)}))},n.pipeable=function(){throw new Error("[EVENT-STREAM] es.pipeable is deprecated")}},2017:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;0!=n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},2986:(e,t,r)=>{var i=r(6982);function n(e,t){null!=e&&("number"==typeof e?this.fromNumber(e,t):Buffer.isBuffer(e)?this.fromBuffer(e):null==t&&"string"!=typeof e?this.fromByteArray(e):this.fromString(e,t))}function o(){return new n(null)}n.prototype.am=function(e,t,r,i,n,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],u=this[e++]>>14,l=s*c+u*a;n=((c=a*c+((16383&l)<<14)+r[i]+n)>>28)+(l>>14)+s*u,r[i++]=268435455&c}return n},n.prototype.DB=28,n.prototype.DM=268435455,n.prototype.DV=1<<28;n.prototype.FV=Math.pow(2,52),n.prototype.F1=24,n.prototype.F2=4;var a,s,c="0123456789abcdefghijklmnopqrstuvwxyz",u=new Array;for(a="0".charCodeAt(0),s=0;s<=9;++s)u[a++]=s;for(a="a".charCodeAt(0),s=10;s<36;++s)u[a++]=s;for(a="A".charCodeAt(0),s=10;s<36;++s)u[a++]=s;function l(e){return c.charAt(e)}function h(e,t){var r=u[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function f(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function E(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function T(e){return e}function A(e){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}f.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},f.prototype.revert=function(e){return e},f.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},f.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},f.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},_.prototype.convert=T,_.prototype.revert=T,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/I[I.length-1];n.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},n.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+DV:this.t=0},n.prototype.fromString=function(e,t,r){var i;switch(t){case 2:i=1;break;case 4:i=2;break;case 8:i=3;break;case 16:i=4;break;case 32:i=5;break;case 256:i=8;break;default:return void this.fromRadix(e,t)}this.t=0,this.s=0;for(var o=e.length,a=!1,s=0;--o>=0;){var c=8==i?255&e[o]:h(e,o);c<0?"-"==e.charAt(o)&&(a=!0):(a=!1,0===s?this[this.t++]=c:s+i>this.DB?(this[this.t-1]|=(c&(1<>this.DB-s):this[this.t-1]|=c<=this.DB&&(s-=this.DB))}!r&&8==i&&128&e[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},n.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},n.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t[r+a+1]=this[r]>>n|s,s=(this[r]&o)<=0;--r)t[r]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},n.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var i=e%this.DB,n=this.DB-i,o=(1<>i;for(var a=r+1;a>i;i>0&&(t[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()},n.prototype.multiplyTo=function(e,t){var r=this.abs(),i=e.abs(),o=r.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},n.prototype.divRemTo=function(e,t,r){var i=e.abs();if(!(i.t<=0)){var a=this.abs();if(a.t0?(i.lShiftTo(l,s),a.lShiftTo(l,r)):(i.copyTo(s),a.copyTo(r));var h=s.t,d=s[h-1];if(0!==d){var f=d*(1<1?s[h-2]>>this.F2:0),m=this.FV/f,g=(1<=0&&(r[r.t++]=1,r.subTo(S,r)),n.ONE.dlShiftTo(h,S),S.subTo(s,s);s.t=0;){var E=r[--y]==d?this.DM:Math.floor(r[y]*m+(r[y-1]+v)*g);if((r[y]+=s.am(0,E,r,C,0,h))0&&r.rShiftTo(l,r),c<0&&n.ZERO.subTo(r,r)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},n.prototype.isEven=function(){return 0===(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(e,t){if(e>4294967295||e<1)return n.ONE;var r=o(),i=o(),a=t.convert(this),s=p(e)-1;for(a.copyTo(r);--s>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,a,r);else{var c=r;r=i,i=c}return t.revert(r)},n.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},n.prototype.toRadix=function(e){if(null==e&&(e=10),0===this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=d(r),n=o(),a=o(),s="";for(this.divRemTo(i,n,a);n.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,n.divRemTo(i,n,a);return a.intValue().toString(e)+s},n.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),o=!1,a=0,s=0,c=0;c=r&&(this.dMultiply(i),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),o&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(e,t){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var r=i.randomBytes(1+(e>>3)),o=7&e;o>0?r[0]&=(1<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i),t.t=r,t.clamp()},n.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(e,t){if(0!==e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},n.prototype.multiplyLowerTo=function(e,t,r){var i,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(t-this.t,0);i0)if(0===t)r=this[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this[i])%e;return r},n.prototype.millerRabin=function(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var i=t.shiftRight(r);(e=e+1>>1)>I.length&&(e=I.length);for(var a=o(),s=0;s0)for(s>s)>0&&(n=!0,o=l(r));a>=0;)s>(s+=this.DB-t)):(r=this[a]>>(s-=t)&i,s<=0&&(s+=this.DB,--a)),r>0&&(n=!0),n&&(o+=l(r)); +(()=>{var e={141:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CiaoService=t.InternalServiceEvent=t.ServiceEvent=t.ServiceState=t.ServiceType=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(4434),s=i.__importDefault(r(9278)),c=r(1360),u=r(4495),l=r(6343),h=r(482),d=r(8225),p=r(1576),f=r(5231),g=r(8318),m=r(8937),v=r(7585),y=i.__importStar(r(9152)),C=r(9152),S=(0,o.default)("ciao:CiaoService"),E=/^(.*) \((\d+)\)$/,_=/^(.*)-\((\d+)\)(\.\w{2,}.)$/;var T,A,I,D;!function(e){e.AIRDROP="airdrop",e.AIRPLAY="airplay",e.AIRPORT="airport",e.COMPANION_LINK="companion-link",e.DACP="dacp",e.HAP="hap",e.HOMEKIT="homekit",e.HTTP="http",e.HTTP_ALT="http_alt",e.IPP="ipp",e.IPPS="ipps",e.RAOP="raop",e.scanner="scanner",e.TOUCH_ABLE="touch-able",e.DNS_SD="dns-sd",e.PRINTER="printer"}(T||(t.ServiceType=T={})),function(e){e.UNANNOUNCED="unannounced",e.PROBING="probing",e.PROBED="probed",e.ANNOUNCING="announcing",e.ANNOUNCED="announced"}(A||(t.ServiceState=A={})),function(e){e.NAME_CHANGED="name-change",e.HOSTNAME_CHANGED="hostname-change"}(I||(t.ServiceEvent=I={})),function(e){e.PUBLISH="publish",e.UNPUBLISH="unpublish",e.REPUBLISH="republish",e.RECORD_UPDATE="records-update",e.RECORD_UPDATE_ON_INTERFACE="records-update-interface"}(D||(t.InternalServiceEvent=D={}));class w extends a.EventEmitter{constructor(e,t){if(super(),this.serviceState="unannounced",this.destroyed=!1,(0,n.default)(e,"networkManager is required"),(0,n.default)(t,"parameters options is required"),(0,n.default)(t.name,"service options parameter 'name' is required"),(0,n.default)(t.type,"service options parameter 'type' is required"),(0,n.default)(t.type.length<=15,"service options parameter 'type' must not be longer than 15 characters"),this.networkManager=e,this.name=t.name,this.type=t.type,this.subTypes=t.subtypes,this.protocol=t.protocol||"tcp",this.serviceDomain=t.domain||"local",this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.typePTR=y.stringify({type:this.type,protocol:this.protocol,domain:this.serviceDomain}),this.loweredTypePTR=(0,v.dnsLowerCase)(this.typePTR),this.subTypes&&(this.subTypePTRs=this.subTypes.map((e=>y.stringify({subtype:e,type:this.type,protocol:this.protocol,domain:this.serviceDomain}))).map(v.dnsLowerCase)),this.hostname=y.formatHostname(t.hostname||this.name,this.serviceDomain).replace(/ /g,"-"),this.loweredHostname=(0,v.dnsLowerCase)(this.hostname),this.port=t.port,t.restrictedAddresses){(0,n.default)(t.restrictedAddresses.length,"The service property 'restrictedAddresses' cannot be an empty array!"),this.restrictedAddresses=new Map;for(const e of t.restrictedAddresses)if(s.default.isIP(e)){if("0.0.0.0"===e||"::"===e)throw new Error(`[${this.fqdn}] Unspecified ip address (${e}) cannot be used to restrict on to!`);const t=m.NetworkManager.resolveInterface(e);if(!t)throw new Error(`[${this.fqdn}] Could not restrict service to address ${e} as we could not resolve it to an interface name!`);const r=this.restrictedAddresses.get(t);r?r.length&&!r.includes(e)&&r.push(e):this.restrictedAddresses.set(t,[e])}else this.restrictedAddresses.set(e,[])}this.disableIpv6=t.disabledIpv6,this.txt=t.txt?w.txtBuffersFromRecord(t.txt):[],this.incrementName(!0)}advertise(){return(0,n.default)(!this.destroyed,"Cannot publish destroyed service!"),(0,n.default)(this.port,"Service port must be defined before advertising the service on the network!"),0===this.listeners("name-change").length&&S("[%s] WARN: No listeners found for a potential name change on the 'name-change' event!",this.name),new Promise(((e,t)=>{this.emit("publish",(r=>r?t(r):e()))}))}end(){return(0,n.default)(!this.destroyed,"Cannot end destroyed service!"),"unannounced"===this.serviceState?Promise.resolve():new Promise(((e,t)=>{this.emit("unpublish",(r=>r?t(r):e()))}))}async destroy(){await this.end(),this.destroyed=!0,this.removeAllListeners()}getFQDN(){return this.fqdn}getTypePTR(){return this.typePTR}getLowerCasedSubtypePTRs(){return this.subTypePTRs}getHostname(){return this.hostname}getPort(){return this.port||-1}getTXT(){return this.txt}getLowerCasedFQDN(){return this.loweredFqdn}getLowerCasedTypePTR(){return this.loweredTypePTR}getLowerCasedHostname(){return this.loweredHostname}updateTxt(e,t=!1){if((0,n.default)(!this.destroyed,"Cannot update destroyed service!"),(0,n.default)(e,"txt cannot be undefined"),this.txt=w.txtBuffersFromRecord(e),S("[%s] Updating txt record%s...",this.name,t?" silently":""),"announcing"===this.serviceState){if(this.rebuildServiceRecords(),t)return;this.currentAnnouncer.hasSentLastAnnouncement()&&this.currentAnnouncer.awaitAnnouncement().then((()=>{this.queueTxtUpdate()}))}else if("announced"===this.serviceState){if(this.rebuildServiceRecords(),t)return;this.queueTxtUpdate()}}queueTxtUpdate(){this.txtTimer||(this.txtTimer=setTimeout((()=>{this.txtTimer=void 0,"announced"===this.serviceState&&this.emit("records-update",{answers:[this.txtRecord()],additionals:[this.serviceNSECRecord()]})}),50))}updatePort(e){(0,n.default)("unannounced"===this.serviceState,"Port number cannot be changed when service is already advertised!"),this.port=e}updateName(e){return"unannounced"===this.serviceState?(this.name=e,this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),Promise.resolve()):this.end().then((()=>(this.name=e,this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.advertise())))}static txtBuffersFromRecord(e){const t=[];return Object.entries(e).forEach((([e,r])=>{const i=e+"="+r;t.push(Buffer.from(i))})),t}handleNetworkInterfaceUpdate(e){(0,n.default)(!this.destroyed,"Cannot update network of destroyed service!"),"announced"===this.serviceState?(this.rebuildServiceRecords(),(e.added||e.changes)&&this.emit("republish",(e=>{e&&(console.log("FATAL Error occurred trying to re-announce service "+this.fqdn+"! We can't recover from this!"),console.log(e.stack),process.exit(1))}))):"announcing"===this.serviceState&&(this.rebuildServiceRecords(),this.currentAnnouncer.hasSentLastAnnouncement()&&this.currentAnnouncer.awaitAnnouncement().then((()=>{this.handleNetworkInterfaceUpdate(e)})))}incrementName(e){if("unannounced"!==this.serviceState)throw new Error("Service name can only be incremented when in state UNANNOUNCED!");const t=this.name,r=this.hostname;let i,o,a,s,c;const u=this.name.match(E);u?(i=u[1],o=parseInt(u[2]),(0,n.default)(o,`Failed to extract name number from ${this.name}. Resulted in ${o}`)):(i=this.name,o=1);const l=this.hostname.match(_);if(l)a=l[1],s=l[3],c=parseInt(l[2]),(0,n.default)(c,`Failed to extract hostname number from ${this.hostname}. Resulted in ${c}`);else{const e=this.hostname.substring(0,this.hostname.length-1).lastIndexOf(".");a=this.hostname.slice(0,e),s=this.hostname.slice(e),c=1}e||(o++,c++);const h=Math.max(o,c);this.name=1===h?i:`${i} (${h})`,this.hostname=1===h?`${a}${s}`:`${a}-(${h})${s}`,this.loweredHostname=(0,v.dnsLowerCase)(this.hostname),this.fqdn=this.formatFQDN(),this.loweredFqdn=(0,v.dnsLowerCase)(this.fqdn),this.name===t&&this.hostname===r||S("[%s] Service changed name '%s' -> '%s', '%s' -> '%s'",this.name,t,this.name,r,this.hostname),e||this.rebuildServiceRecords()}informAboutNameUpdates(){const e=this.emit("name-change",this.name),t=this.emit("hostname-change",y.removeTLD(this.hostname));e||t||console.warn(`CIAO: [${this.name}] Service changed name but nobody was listening on the 'name-change' event!`)}formatFQDN(){if("unannounced"!==this.serviceState)throw new Error("Name can't be changed after service was already announced!");const e=y.stringify({name:this.name,type:this.type,protocol:this.protocol,domain:this.serviceDomain});return(0,n.default)(e.length<=255,"A fully qualified domain name cannot be longer than 255 characters"),e}rebuildServiceRecords(){(0,n.default)(this.port,"port must be set before building records"),S("[%s] Rebuilding service records...",this.name);const e={},t={},r={},i={},o={};let a;for(const[n,a]of this.networkManager.getInterfaceMap()){if(!this.advertisesOnInterface(n,!0))continue;let s=this.restrictedAddresses?this.restrictedAddresses.get(n):void 0;s&&0===s.length&&(s=void 0),!a.ipv4||s&&!s.includes(a.ipv4)||(e[n]=new u.ARecord(this.hostname,a.ipv4,!0),o[a.ipv4]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.ipv4),this.hostname)),!a.ipv6||this.disableIpv6||s&&!s.includes(a.ipv6)||(t[n]=new c.AAAARecord(this.hostname,a.ipv6,!0),o[a.ipv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.ipv6),this.hostname)),!a.globallyRoutableIpv6||this.disableIpv6||s&&!s.includes(a.globallyRoutableIpv6)||(r[n]=new c.AAAARecord(this.hostname,a.globallyRoutableIpv6,!0),o[a.globallyRoutableIpv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.globallyRoutableIpv6),this.hostname)),!a.uniqueLocalIpv6||this.disableIpv6||s&&!s.includes(a.uniqueLocalIpv6)||(i[n]=new c.AAAARecord(this.hostname,a.uniqueLocalIpv6,!0),o[a.uniqueLocalIpv6]=new h.PTRRecord((0,C.formatReverseAddressPTRName)(a.uniqueLocalIpv6),this.hostname))}if(this.subTypePTRs){a=[];for(const e of this.subTypePTRs)a.push(new h.PTRRecord(e,this.fqdn))}this.serviceRecords={ptr:new h.PTRRecord(this.typePTR,this.fqdn),subtypePTRs:a,metaQueryPtr:new h.PTRRecord(g.Responder.SERVICE_TYPE_ENUMERATION_NAME,this.typePTR),srv:new d.SRVRecord(this.fqdn,this.hostname,this.port,!0),txt:new p.TXTRecord(this.fqdn,this.txt,!0),serviceNSEC:new l.NSECRecord(this.fqdn,this.fqdn,[16,33],4500,!0),a:e,aaaa:t,aaaaR:r,aaaaULA:i,reverseAddressPTRs:o,addressNSEC:new l.NSECRecord(this.hostname,this.hostname,[1,28],120,!0)}}advertisesOnInterface(e,t){var r,i,n,o;return!this.restrictedAddresses||this.restrictedAddresses.has(e)&&(t||!!(null===(r=this.serviceRecords)||void 0===r?void 0:r.a[e])||!!(null===(i=this.serviceRecords)||void 0===i?void 0:i.aaaa[e])||!!(null===(n=this.serviceRecords)||void 0===n?void 0:n.aaaaR[e])||!!(null===(o=this.serviceRecords)||void 0===o?void 0:o.aaaaULA[e]))}ptrRecord(){return this.serviceRecords.ptr.clone()}subtypePtrRecords(){return this.serviceRecords.subtypePTRs?f.ResourceRecord.clone(this.serviceRecords.subtypePTRs):[]}metaQueryPtrRecord(){return this.serviceRecords.metaQueryPtr.clone()}srvRecord(){return this.serviceRecords.srv.clone()}txtRecord(){return this.serviceRecords.txt.clone()}aRecord(e){const t=this.serviceRecords.a[e];return t?t.clone():void 0}aaaaRecord(e){const t=this.serviceRecords.aaaa[e];return t?t.clone():void 0}aaaaRoutableRecord(e){const t=this.serviceRecords.aaaaR[e];return t?t.clone():void 0}aaaaUniqueLocalRecord(e){const t=this.serviceRecords.aaaaULA[e];return t?t.clone():void 0}allAddressRecords(){const e=[];return Object.values(this.serviceRecords.a).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaa).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaaR).forEach((t=>{e.push(t.clone())})),Object.values(this.serviceRecords.aaaaULA).forEach((t=>{e.push(t.clone())})),e}addressNSECRecord(){return this.serviceRecords.addressNSEC.clone()}serviceNSECRecord(e=!1){const t=this.serviceRecords.serviceNSEC.clone();return e&&(t.ttl=120),t}hasAddress(e){return!!this.serviceRecords.reverseAddressPTRs[e]}}t.CiaoService=w},2361:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MDNSServer=t.SendResultFormatError=t.SendResultFailedRatio=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=i.__importDefault(r(7194)),s=r(4119),c=r(8937),u=r(9152),l=r(16),h=r(8390),d=(0,o.default)("ciao:MDNSServer");t.SendResultFailedRatio=function(e){if(0===e.length)return 0;let t=0;for(const r of e)"fulfilled"!==r.status&&t++;return t/e.length},t.SendResultFormatError=function(e,t,r=!1){let i=0;for(const t of e)"fulfilled"!==t.status&&i++;if(t||(t="Failed to send packets"),i{console.log("Could not bind detected network interface: "+e.stack)}));e.push(n)}return Promise.all(e).then((()=>{this.bound=!0}))}shutdown(){this.networkManager.shutdown();for(const e of this.sockets.values())e.close();this.bound=!1,this.closed=!0,this.sockets.clear()}sendQueryBroadcast(e,t){const r=s.DNSPacket.createDNSQueryPackets(e);r.length>1&&d("Query broadcast is split into %d packets!",r.length);const i=[];for(const e of r)i.push(this.sendOnAllNetworksForService(e,t));return Promise.all(i).then((e=>{const t=[];for(const r of e)t.concat(r);return t}))}sendResponseBroadcast(e,t){const r=s.DNSPacket.createDNSResponsePacketsFromRRSet(e);return this.sendOnAllNetworksForService(r,t)}sendResponse(e,t,r){this.send(e,t).then((e=>{"rejected"===e.status?r?r(new Error("Encountered socket error on "+e.reason.name+": "+e.reason.message)):p.logSocketError(e.interface,e.reason):r&&r()}))}sendOnAllNetworksForService(e,t){this.checkUnicastResponseFlag(e);const r=e.encode();this.assertBeforeSend(r,"IPv4");const i=[];for(const[e,n]of this.sockets){if(!t.advertisesOnInterface(e))continue;const o=new Promise((t=>{n.send(r,p.MDNS_PORT,p.MULTICAST_IPV4,(i=>{if(i){if(!p.isSilencedSocketError(i))return void t({status:"rejected",interface:e,reason:i})}else this.maintainSentPacketsInterface(e,r);t({status:"fulfilled",interface:e})}))}));i.push(Promise.race([o,(0,h.PromiseTimeout)(p.SEND_TIMEOUT).then((()=>({status:"timeout",interface:e})))]))}return Promise.all(i)}send(e,t){this.checkUnicastResponseFlag(e);const r=e.encode();let i,n,o;this.assertBeforeSend(r,"IPv4"),"string"==typeof t?(i=p.MULTICAST_IPV4,n=p.MDNS_PORT,o=t):(i=t.address,n=t.port,o=t.interface);const a=this.sockets.get(o);if(!a)throw new l.InterfaceNotFoundError(`Could not find socket for given network interface '${o}'`);return new Promise((e=>{a.send(r,n,i,(t=>{if(t){if(!p.isSilencedSocketError(t))return void e({status:"rejected",interface:o,reason:t})}else this.maintainSentPacketsInterface(o,r);e({status:"fulfilled",interface:o})}))}))}checkUnicastResponseFlag(e){this.suppressUnicastResponseFlag&&0===e.type&&e.questions.forEach((e=>e.unicastResponseFlag=!1))}assertBeforeSend(e,t){if(this.closed)throw new l.ServerClosedError("Cannot send packets on a closed mdns server!");(0,n.default)(this.bound,"Cannot send packets before server is not bound!");const r="IPv4"===t?p.DEFAULT_IP4_HEADER:p.DEFAULT_IP6_HEADER;(0,n.default)(r+p.UDP_HEADER+e.length<=9e3,"DNS cannot exceed the size of 9000 bytes even with IP Fragmentation!")}maintainSentPacketsInterface(e,t){const r=t.toString("base64"),i=this.sentPackets.get(e);i?i.push(r):this.sentPackets.set(e,[r])}checkIfPacketWasPreviouslySentFromUs(e,t){const r=t.toString("base64"),i=this.sentPackets.get(e);if(i){const e=i.indexOf(r);if(-1!==e)return i.splice(e,1),!0}return!1}createDgramSocket(e,t=!1,r="udp4"){const i=a.default.createSocket({type:r,reuseAddr:t});return i.on("message",this.handleMessage.bind(this,e)),i.on("error",(t=>{p.isSilencedSocketError(t)||p.logSocketError(e,t)})),i}bindSocket(e,t,r){return new Promise(((i,o)=>{const a=e=>o(new Error("Failed to bind on interface "+t.name+": "+e.message));e.once("error",a),e.on("close",(()=>{this.sockets.delete(t.name)})),e.bind(p.MDNS_PORT,(()=>{e.setRecvBufferSize(819200),e.removeListener("error",a);const s="IPv4"===r?p.MULTICAST_IPV4:p.MULTICAST_IPV6,c="IPv4"===r?t.ipv4:t.ipv6;(0,n.default)(c,"Interface address for "+t.name+" cannot be undefined!");try{e.addMembership(s,c),e.setMulticastInterface(c),e.setMulticastTTL(p.MDNS_TTL),e.setTTL(p.MDNS_TTL),e.setMulticastLoopback(!0),this.sockets.set(t.name,e),i()}catch(r){try{e.close()}catch(e){d("Error while closing socket which failed to bind. Error may be expected: "+e.message)}o(new Error("Error binding socket on "+t.name+": "+r.stack))}}))}))}handleMessage(e,t,r){if(!this.bound)return;const i=this.networkManager.getInterface(e);if(!i)return void d("Received packet on non existing network interface: %s!",e);if(this.checkIfPacketWasPreviouslySentFromUs(i.name,t))return;const n=(0,u.getNetAddress)(r.address,i.ip4Netmask);if(i.loopback){if(n!==i.ipv4Netaddress)return}else if(this.networkManager.isLoopbackNetaddressV4(n))return void d("Received packet on interface '%s' which is not coming from the same subnet: %o",e,{address:r.address,netaddress:n,interface:i.ipv4});let o;try{o=s.DNSPacket.decode(r,t)}catch(i){return void d("Received a malformed packet from %o on interface %s. This might or might not be a problem. Here is the received packet for debugging purposes '%s'. Packet decoding failed with %s",r,e,t.toString("base64"),i.stack)}if(0!==o.opcode)return;if(0!==o.rcode)return;const a={address:r.address,port:r.port,interface:e};if(0===o.type)try{this.handler.handleQuery(o,a)}catch(t){console.warn("Error occurred handling incoming (on "+e+") dns query packet: "+t.stack)}else if(1===o.type){if(r.port!==p.MDNS_PORT)return;try{this.handler.handleResponse(o,a)}catch(t){console.warn("Error occurred handling incoming (on "+e+") dns response packet: "+t.stack)}}}static isSilencedSocketError(e){const t=e.message.includes("EADDRNOTAVAIL")||e.message.includes("EHOSTDOWN")||e.message.includes("ENETUNREACH")||e.message.includes("EHOSTUNREACH")||e.message.includes("EPERM")||e.message.includes("EINVAL");return t&&d("Silenced and ignored error (This is/should not be a problem, this message is only for informational purposes): "+e.message),t}static logSocketError(e,t){console.warn(`Encountered MDNS socket error on socket '${e}' : ${t.stack}`)}handleUpdatedNetworkInterfaces(e){if(e.removed)for(const t of e.removed){const e=this.sockets.get(t.name);this.sockets.delete(t.name),e&&e.close()}if(e.changes)for(const t of e.changes){const e=this.sockets.get(t.name);if((0,n.default)(e,"Couldn't find socket for network change!"),!t.outdatedIpv4&&t.updatedIpv4)n.default.fail("Reached illegal state! IPv4 address changed from undefined to defined!");else if(t.outdatedIpv4&&!t.updatedIpv4)n.default.fail("Reached illegal state! IPV4 address change from defined to undefined!");else if(t.outdatedIpv4&&t.updatedIpv4){try{e.dropMembership(p.MULTICAST_IPV4,t.outdatedIpv4)}catch(e){d("Thrown expected error when dropping outdated address membership: "+e.message)}try{e.addMembership(p.MULTICAST_IPV4,t.updatedIpv4)}catch(e){d("Thrown expected error when adding new address membership: "+e.message)}e.setMulticastInterface(t.updatedIpv4)}}if(e.added)for(const t of e.added){const e=this.createDgramSocket(t.name,!0);this.bindSocket(e,t,"IPv4").catch((e=>{console.log("Could not bind detected network interface: "+e.stack)}))}}}t.MDNSServer=p,p.DEFAULT_IP4_HEADER=20,p.DEFAULT_IP6_HEADER=40,p.UDP_HEADER=8,p.MDNS_PORT=5353,p.MDNS_TTL=255,p.MULTICAST_IPV4="224.0.0.251",p.MULTICAST_IPV6="FF02::FB",p.SEND_TIMEOUT=200},8937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkManager=t.NetworkManagerEvent=t.WifiState=t.IPFamily=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5317)),a=i.__importDefault(r(5753)),s=r(4434),c=i.__importDefault(r(2017)),u=i.__importDefault(r(9278)),l=i.__importDefault(r(857)),h=r(9152),d=(0,a.default)("ciao:NetworkManager");var p,f,g;!function(e){e.IPv4="IPv4",e.IPv6="IPv6"}(p||(t.IPFamily=p={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.NOT_A_WIFI_INTERFACE=1]="NOT_A_WIFI_INTERFACE",e[e.NOT_ASSOCIATED=2]="NOT_ASSOCIATED",e[e.CONNECTED=3]="CONNECTED"}(f||(t.WifiState=f={})),function(e){e.NETWORK_UPDATE="network-update"}(g||(t.NetworkManagerEvent=g={}));class m extends s.EventEmitter{constructor(e){if(super(),this.currentInterfaces=new Map,this.loopbackInterfaces=new Map,this.setMaxListeners(100),e&&e.interface){let t;if("string"==typeof e.interface)t=[e.interface];else{if(!Array.isArray(e.interface))throw new Error("Found invalid type for 'interfaces' NetworkManager option!");t=e.interface}const r=[];for(const i of t)if(u.default.isIP(i)){const t=m.resolveInterface(i);t?r.push(t):console.log("CIAO: Interface was specified as ip (%s), though couldn't find a matching interface for the given address.",e.interface)}else r.push(i);0===r.length?console.log("CIAO: 'restrictedInterfaces' array was empty. Going to fallback to bind on all available interfaces."):this.restrictedInterfaces=r}this.excludeIpv6=!(!e||!e.excludeIpv6),this.excludeIpv6Only=this.excludeIpv6||!(!e||!e.excludeIpv6Only),e&&d("Created NetworkManager with options: %s",JSON.stringify(e)),this.initPromise=new Promise((e=>{this.getCurrentNetworkInterfaces().then((t=>{this.currentInterfaces=t;const r=Object.keys(l.default.networkInterfaces()),i=[];for(const e of this.currentInterfaces.keys()){i.push(e);const t=r.indexOf(e);-1!==t&&r.splice(t,1)}d("Initial networks [%s] ignoring [%s]",i.join(", "),r.join(", ")),this.initPromise=void 0,e(),this.scheduleNextJob()}))}))}async waitForInit(){this.initPromise&&await this.initPromise}shutdown(){this.currentTimer&&(clearTimeout(this.currentTimer),this.currentTimer=void 0),this.removeAllListeners()}getInterfaceMap(){return this.initPromise&&n.default.fail("Not yet initialized!"),this.currentInterfaces}getInterface(e){return this.initPromise&&n.default.fail("Not yet initialized!"),this.currentInterfaces.get(e)}isLoopbackNetaddressV4(e){for(const t of this.loopbackInterfaces.values())if(t.ipv4Netaddress===e)return!0;return!1}scheduleNextJob(){this.currentTimer=setTimeout(this.checkForNewInterfaces.bind(this),m.POLLING_TIME),this.currentTimer.unref()}async checkForNewInterfaces(){const e=await this.getCurrentNetworkInterfaces();if(!this.currentTimer)return;let t,r,i;for(const[r,n]of e){const e=this.currentInterfaces.get(r);if(e){if(!(0,c.default)(e,n)){const t={name:r};e.ipv4!==n.ipv4&&(e.ipv4&&(t.outdatedIpv4=e.ipv4),n.ipv4&&(t.updatedIpv4=n.ipv4)),e.ipv6!==n.ipv6&&(e.ipv6&&(t.outdatedIpv6=e.ipv6),n.ipv6&&(t.updatedIpv6=n.ipv6)),e.globallyRoutableIpv6!==n.globallyRoutableIpv6&&(e.globallyRoutableIpv6&&(t.outdatedGloballyRoutableIpv6=e.globallyRoutableIpv6),n.globallyRoutableIpv6&&(t.updatedGloballyRoutableIpv6=n.globallyRoutableIpv6)),e.uniqueLocalIpv6!==n.uniqueLocalIpv6&&(e.uniqueLocalIpv6&&(t.outdatedUniqueLocalIpv6=e.uniqueLocalIpv6),n.uniqueLocalIpv6&&(t.updatedUniqueLocalIpv6=n.uniqueLocalIpv6)),this.currentInterfaces.set(r,n),n.loopback&&this.loopbackInterfaces.set(r,n),(null!=i?i:i=[]).push(t)}}else this.currentInterfaces.set(r,n),n.loopback&&this.currentInterfaces.set(r,n),(null!=t?t:t=[]).push(n)}if(this.currentInterfaces.size!==e.size)for(const[t,i]of this.currentInterfaces)e.has(t)||(this.currentInterfaces.delete(t),this.loopbackInterfaces.delete(t),(null!=r?r:r=[]).push(i));if(t||r||i){const e=t?t.map((e=>e.name)).join(","):"",n=r?r.map((e=>e.name)).join(","):"",o=i?i.map((e=>{let t=`{ name: ${e.name} `;return(e.outdatedIpv4||e.updatedIpv4)&&(t+=`, ${e.outdatedIpv4} -> ${e.updatedIpv4} `),(e.outdatedIpv6||e.updatedIpv6)&&(t+=`, ${e.outdatedIpv6} -> ${e.updatedIpv6} `),(e.outdatedGloballyRoutableIpv6||e.updatedGloballyRoutableIpv6)&&(t+=`, ${e.outdatedGloballyRoutableIpv6} -> ${e.updatedGloballyRoutableIpv6} `),(e.outdatedUniqueLocalIpv6||e.updatedUniqueLocalIpv6)&&(t+=`, ${e.outdatedUniqueLocalIpv6} -> ${e.updatedUniqueLocalIpv6} `),t+"}"})).join(","):"";d("Detected network changes: added: [%s], removed: [%s], changes: [%s]!",e,n,o),this.emit("network-update",{added:t,removed:r,changes:i})}this.scheduleNextJob()}async getCurrentNetworkInterfaces(){let e;if(this.restrictedInterfaces){e=this.restrictedInterfaces;const t=m.getLoopbackInterface();e.includes(t)||e.push(t)}else try{e=await m.getNetworkInterfaceNames()}catch(t){d(`WARNING Detecting network interfaces for platform '${l.default.platform()}' failed. Trying to assume network interfaces! (${t.message})`),e=m.assumeNetworkInterfaceNames()}const t=new Map,r=l.default.networkInterfaces();for(const i of e){const e=r[i];if(!e)continue;let o,a,s,c,u=!1;for(const t of e){if(t.internal&&(u=!0),"IPv4"!==t.family&&4!==t.family||o){if("IPv6"===t.family||6===t.family){if(this.excludeIpv6)continue;t.scopeid&&!a?a=t:0===t.scopeid&&(t.address.startsWith("fc")||t.address.startsWith("fd")?c||(c=t):s||(s=t))}}else o=t;if(o&&a&&s&&c)break}if((0,n.default)(o||a,"Could not find valid addresses for interface '"+i+"'"),this.excludeIpv6Only&&!o)continue;const l={name:i,loopback:u,mac:(null==o?void 0:o.mac)||(null==a?void 0:a.mac)};o&&(l.ipv4=o.address,l.ip4Netmask=o.netmask,l.ipv4Netaddress=(0,h.getNetAddress)(o.address,o.netmask)),a&&(l.ipv6=a.address,l.ipv6Netmask=a.netmask),s&&(l.globallyRoutableIpv6=s.address,l.globallyRoutableIpv6Netmask=s.netmask),c&&(l.uniqueLocalIpv6=c.address,l.uniqueLocalIpv6Netmask=c.netmask),t.set(i,l)}return t}static resolveInterface(e){let t;e:for(const[r,i]of Object.entries(l.default.networkInterfaces()))for(const n of null!=i?i:[])if(n.address===e){t=r;break e}return t}static async getNetworkInterfaceNames(){let e,t;switch(l.default.platform()){case"win32":e=m.getWindowsNetworkInterfaces();break;case"linux":e=m.getLinuxNetworkInterfaces();break;case"darwin":e=m.getDarwinNetworkInterfaces();break;case"freebsd":e=m.getFreeBSDNetworkInterfaces();break;case"openbsd":case"sunos":e=m.getOpenBSD_SUNOS_NetworkInterfaces();break;default:return d("Found unsupported platform %s",l.default.platform()),Promise.reject(new Error("unsupported platform!"))}try{t=await e}catch(e){if(e.message!==m.NOTHING_FOUND_MESSAGE)throw e;t=[]}const r=m.getLoopbackInterface();return t.includes(r)||t.unshift(r),e}static assumeNetworkInterfaceNames(){const e=[];return Object.entries(l.default.networkInterfaces()).forEach((([t,r])=>{for(const i of null!=r?r:[])if(i.internal||"IPv4"===i.family||4===i.family||("IPv6"===i.family||6===i.family)&&0===i.scopeid){e.includes(t)||e.push(t);break}})),e}static getLoopbackInterface(){for(const[e,t]of Object.entries(l.default.networkInterfaces()))for(const r of null!=t?t:[])if(r.internal)return e;throw new Error("Could not detect loopback interface!")}static getWindowsNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec('arp -a | findstr /C:"---"',((r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e{o.default.exec("arp -a -n -l",(async(r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=1;e{if(1!==t&&3!==t){const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}));a.push(t)}await Promise.all(a),o.length?e(o):t(new Error(m.NOTHING_FOUND_MESSAGE))}))}))}static getLinuxNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec("ip neigh show",((r,i)=>{if(r)return r.message.includes("ip: not found")?(d("LINUX: ip was not found on the system. Falling back to assuming network interfaces!"),void e(m.assumeNetworkInterfaceNames())):void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e=t.length){d(`LINUX: Out of bounds when reading interface name from line ${e}: '${n[e]}'`);continue}const i=t[r+1];i?o.includes(i)||o.push(i):d(`LINUX: Failed to read interface name from line ${e}: '${n[e]}'`)}o.length?e(o):t(new Error(m.NOTHING_FOUND_MESSAGE))}))}))}static getFreeBSDNetworkInterfaces(){return new Promise(((e,t)=>{o.default.exec("arp -a -n",((r,i)=>{if(r)return void t(r);const n=i.split(l.default.EOL),o=[];for(let e=0;e{o.default.exec("arp -a -n",((r,i)=>{if(r)return void t(r);const n="sunos"===l.default.platform()?0:2,o=i.split(l.default.EOL),a=[];for(let e=1;e{o.default.exec("networksetup -getairportnetwork "+e,((r,i)=>{if(r)return i.includes("not a Wi-Fi interface")?void t(1):(console.log(`CIAO WARN: While checking networksetup for ${e} encountered an error (${r.message}) with output: ${i.replace(l.default.EOL,"; ")}`),void t(0));let n=0;i.includes("not a Wi-Fi interface")?n=1:i.includes("Current Wi-Fi Network")?n=3:i.includes("not associated")?n=2:i.includes("All Wi-Fi network services are disabled")?n=1:console.log(`CIAO WARN: While checking networksetup for ${e} encountered an unknown output: ${i.replace(l.default.EOL,"; ")}`),t(n)}))}))}}t.NetworkManager=m,m.SPACE_PATTERN=/\s+/g,m.NOTHING_FOUND_MESSAGE="no interfaces found",m.POLLING_TIME=15e3},4288:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Responder=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(141),s=r(4119),c=r(5682),u=r(1360),l=r(4495),h=r(482),d=r(8225),p=r(1576),f=r(2361),g=r(9983),m=r(2475),v=r(572),y=r(8126),C=r(341),S=r(16),E=r(8390),_=r(5762),T=(0,o.default)("ciao:Responder"),A=(e,t)=>e.estimatedTimeToBeSent-t.estimatedTimeToBeSent;var I;!function(e){e[e.NO_CONFLICT=0]="NO_CONFLICT",e[e.CONFLICTING_RDATA=1]="CONFLICTING_RDATA",e[e.CONFLICTING_TTL=2]="CONFLICTING_TTL"}(I||(I={}));class D{static getResponder(e){const t=e?JSON.stringify(e):"",r=this.INSTANCES.get(t);if(r)return r.refCount++,r;{const r=new D(e);return this.INSTANCES.set(t,r),r.optionsString=t,r}}constructor(e){this.refCount=1,this.optionsString="",this.bound=!1,this.announcedServices=new Map,this.servicePointer=new Map,this.truncatedQueries={},this.delayedMulticastResponses=[],this.server=new f.MDNSServer(this,e),this.promiseChain=this.start(),this.server.getNetworkManager().on("network-update",this.handleNetworkUpdate.bind(this)),this.ignoreUnicastResponseFlag=null==e?void 0:e.ignoreUnicastResponseFlag,(null==e?void 0:e.periodicBroadcasts)&&(this.broadcastInterval=setTimeout(this.handlePeriodicBroadcasts.bind(this),3e4).unref())}handlePeriodicBroadcasts(){this.broadcastInterval=void 0,T("Sending periodic announcement on "+Array.from(this.server.getNetworkManager().getInterfaceMap().keys()).join(", "));for(const e of this.server.getNetworkManager().getInterfaceMap().values()){const t=new c.Question("_hap._tcp.local.",12,!1),r=this.answerQuestion(t,{port:5353,address:e.ipv4Netaddress||e.globallyRoutableIpv6||e.uniqueLocalIpv6||e.ipv6,interface:e.name});v.QueryResponse.combineResponses(r);for(const t of r)t.hasAnswers()&&this.server.sendResponse(t.asPacket(),e.name)}this.broadcastInterval=setTimeout(this.handlePeriodicBroadcasts.bind(this),3e3*Math.random()+27e3).unref()}createService(e){const t=new a.CiaoService(this.server.getNetworkManager(),e);return t.on("publish",this.advertiseService.bind(this,t)),t.on("unpublish",this.unpublishService.bind(this,t)),t.on("republish",this.republishService.bind(this,t)),t.on("records-update",this.handleServiceRecordUpdate.bind(this,t)),t.on("records-update-interface",this.handleServiceRecordUpdateOnInterface.bind(this,t)),t}shutdown(){if(this.refCount--,this.refCount>0)return Promise.resolve();this.currentProber&&this.currentProber.cancel(),this.broadcastInterval&&clearTimeout(this.broadcastInterval),D.INSTANCES.delete(this.optionsString),T("Shutting down Responder...");const e=[];for(const t of this.announcedServices.values())e.push(this.unpublishService(t));return Promise.all(e).then((()=>{this.server.shutdown(),this.bound=!1}))}getAnnouncedServices(){return this.announcedServices.values()}start(){if(this.bound)throw new Error("Server is already bound!");return this.bound=!0,this.server.bind()}advertiseService(e,t){if("announced"===e.serviceState)throw new Error("Can't publish a service that is already announced. Received "+e.serviceState+" for service "+e.getFQDN());return"probing"===e.serviceState?this.promiseChain.then((()=>{if(e.currentAnnouncer)return e.currentAnnouncer.awaitAnnouncement()})):"announcing"===e.serviceState?((0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!"),e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement().then((()=>this.advertiseService(e,t))):e.currentAnnouncer.cancel().then((()=>this.advertiseService(e,t)))):(T("[%s] Going to advertise service...",e.getFQDN()),this.promiseChain=this.promiseChain.then((()=>e.rebuildServiceRecords())).then((()=>this.probe(e))),this.promiseChain.then((()=>{this.announce(e).catch((t=>(console.log(`[${e.getFQDN()}] failed announcing with reason: ${t}. Trying again in 2 seconds!`),(0,E.PromiseTimeout)(2e3).then((()=>this.advertiseService(e,(()=>{}))))))),t()}),(r=>{if(r!==m.Prober.CANCEL_REASON)return console.log(`[${e.getFQDN()}] failed probing with reason: ${r}. Trying again in 2 seconds!`),(0,E.PromiseTimeout)(2e3).then((()=>this.advertiseService(e,t)));t()})))}async republishService(e,t,r=!1){if("announced"!==e.serviceState&&"announcing"!==e.serviceState)throw new Error("Can't unpublish a service which isn't announced yet. Received "+e.serviceState+" for service "+e.getFQDN());if(T("[%s] Readvertising service...",e.getFQDN()),"announcing"===e.serviceState){(0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!");return(e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement():e.currentAnnouncer.cancel()).then((()=>this.advertiseService(e,t)))}return this.clearService(e),e.serviceState="unannounced",r?(0,E.PromiseTimeout)(1e3).then((()=>this.advertiseService(e,t))):this.advertiseService(e,t)}unpublishService(e,t){if("unannounced"===e.serviceState)throw new Error("Can't unpublish a service which isn't announced yet. Received "+e.serviceState+" for service "+e.getFQDN());if("announced"===e.serviceState||"announcing"===e.serviceState){if("announcing"===e.serviceState)return(0,n.default)(e.currentAnnouncer,"Service is in state ANNOUNCING though has no linked announcer!"),e.currentAnnouncer.isSendingGoodbye()?e.currentAnnouncer.awaitAnnouncement():e.currentAnnouncer.cancel().then((()=>(e.serviceState="announced",this.unpublishService(e,t))));T("[%s] Removing service from the network",e.getFQDN()),this.clearService(e),e.serviceState="unannounced";let r=this.goodbye(e);return t&&(r=r.then((()=>t()),(r=>{console.log(`[${e.getFQDN()}] failed goodbye with reason: ${r}.`),t()}))),r}return"probing"===e.serviceState&&(T("[%s] Canceling probing",e.getFQDN()),this.currentProber&&this.currentProber.getService()===e&&(this.currentProber.cancel(),this.currentProber=void 0),e.serviceState="unannounced"),t&&t(),Promise.resolve()}clearService(e){const t=e.getLowerCasedFQDN(),r=e.getLowerCasedTypePTR(),i=e.getLowerCasedSubtypePTRs();if(this.removePTR(D.SERVICE_TYPE_ENUMERATION_NAME,r),this.removePTR(r,t),i)for(const e of i)this.removePTR(e,t);this.announcedServices.delete(e.getLowerCasedFQDN())}addPTR(e,t){const r=this.servicePointer.get(e);r?r.includes(t)||r.push(t):this.servicePointer.set(e,[t])}removePTR(e,t){const r=this.servicePointer.get(e);if(r){const i=r.indexOf(t);-1!==i&&r.splice(i,1),0===r.length&&this.servicePointer.delete(e)}}probe(e){if("unannounced"!==e.serviceState)throw new Error("Can't probe for a service which is announced already. Received "+e.serviceState+" for service "+e.getFQDN());return e.serviceState="probing",(0,n.default)(void 0===this.currentProber,"Tried creating new Prober when there already was one active!"),this.currentProber=new m.Prober(this,this.server,e),this.currentProber.probe().then((()=>{this.currentProber=void 0,e.serviceState="probed"}),(t=>(e.serviceState="unannounced",this.currentProber=void 0,Promise.reject(t))))}announce(e){if("probed"!==e.serviceState)throw new Error("Cannot announce service which was not probed unique. Received "+e.serviceState+" for service "+e.getFQDN());(0,n.default)(void 0===e.currentAnnouncer,"Service "+e.getFQDN()+" is already announcing!"),e.serviceState="announcing";const t=new g.Announcer(this.server,e,{repetitions:3});e.currentAnnouncer=t;const r=e.getLowerCasedFQDN(),i=e.getLowerCasedTypePTR(),o=e.getLowerCasedSubtypePTRs();if(this.addPTR(D.SERVICE_TYPE_ENUMERATION_NAME,i),this.addPTR(i,r),o)for(const e of o)this.addPTR(e,r);return this.announcedServices.set(r,e),t.announce().then((()=>{e.serviceState="announced",e.currentAnnouncer=void 0}),(t=>{if(e.serviceState="unannounced",e.currentAnnouncer=void 0,this.clearService(e),t!==g.Announcer.CANCEL_REASON)return Promise.reject(t)}))}handleServiceRecordUpdate(e,t,r){var i;if("announced"!==e.serviceState)throw new Error("Cannot update txt of service which is not announced yet. Received "+e.serviceState+" for service "+e.getFQDN());T("[%s] Updating %d record(s) for given service!",e.getFQDN(),t.answers.length+((null===(i=t.additionals)||void 0===i?void 0:i.length)||0)),this.server.sendResponseBroadcast(t,e).then((t=>{const i=(0,f.SendResultFailedRatio)(t);if(1===i)return console.log((0,f.SendResultFormatError)(t,`Failed to send records update for '${e.getFQDN()}'`),!0),void(r&&r(new Error("Updating records failed as of socket errors!")));i>0&&T((0,f.SendResultFormatError)(t,`Some of the record updates for '${e.getFQDN()}' failed`)),r&&r()}))}handleServiceRecordUpdateOnInterface(e,t,r,i){if("announced"!==e.serviceState)throw new Error("Cannot update txt of service which is not announced yet. Received "+e.serviceState+" for service "+e.getFQDN());T("[%s] Updating %d record(s) for given service on interface %s!",e.getFQDN(),r.length,t);const n=s.DNSPacket.createDNSResponsePacketsFromRRSet({answers:r});this.server.sendResponse(n,t,i)}goodbye(e){(0,n.default)(void 0===e.currentAnnouncer,"Service "+e.getFQDN()+" is already announcing!"),e.serviceState="announcing";const t=new g.Announcer(this.server,e,{repetitions:1,goodbye:!0});return e.currentAnnouncer=t,t.announce().then((()=>{e.serviceState="unannounced",e.currentAnnouncer=void 0}),(t=>(e.serviceState="unannounced",e.currentAnnouncer=void 0,Promise.reject(t))))}handleNetworkUpdate(e){for(const t of this.announcedServices.values())t.handleNetworkInterfaceUpdate(e)}handleQuery(e,t){const r=(new Date).getTime(),i=t.address+":"+t.port+":"+t.interface,n=this.truncatedQueries[i];if(n){switch(n.appendDNSPacket(e)){case 1:return delete this.truncatedQueries[i],void T("[%s] Aborting to wait for more truncated queries. Waited a total of %d ms receiving %d queries",i,n.getTotalWaitTime(),n.getArrivedPacketCount());case 2:return void T("[%s] Received a query marked as truncated, waiting for more to arrive",i);case 3:delete this.truncatedQueries[i],e=n.getPacket(),T("[%s] Last part of the truncated query arrived. Received %d packets taking a total of %d ms",i,n.getArrivedPacketCount(),n.getTotalWaitTime())}}else if(e.flags.truncation){T("Received truncated query from "+JSON.stringify(t)+" waiting for more to come!");const r=new C.TruncatedQuery(e);return this.truncatedQueries[i]=r,void r.on("timeout",(()=>{T("[%s] Timeout passed since the last truncated query was received. Discarding %d packets received in %d ms.",i,r.getArrivedPacketCount(),r.getTotalWaitTime()),delete this.truncatedQueries[i]}))}const o=t.port!==f.MDNSServer.MDNS_PORT,a=e.authorities.size>0;let s;for(const t of e.additionals.values())if(41===t.type){s=t.udpPayloadSize;break}const c=[],u=[];if(e.questions.forEach((r=>{const i=this.answerQuestion(r,t,e.answers);o||r.unicastResponseFlag&&!this.ignoreUnicastResponseFlag?u.push(...i):c.push(...i)})),this.currentProber&&this.currentProber.handleQuery(e,t),o)for(let t=0;t1&&(u.splice(1,u.length-1),u[0].markTruncated());for(const e of u){if(!e.hasAnswers())continue;this.server.sendResponse(e.asPacket(),t);const i=(new Date).getTime()-r;T("Sending response via unicast to %s (took %d ms): %s",JSON.stringify(t),i,e.asString(s))}for(const i of c)if(i.hasAnswers())if((i.containsSharedAnswer()||e.questions.size>1)&&!a){const e=(new Date).getTime()-r;this.enqueueDelayedMulticastResponse(i.asPacket(),t.interface,e)}else{let e=!1;for(let n=0;ny.QueuedResponse.MAX_DELAY)break;if(o.combineWithUniqueResponseIfPossible(i,t.interface)){const i=(new Date).getTime()-r;e=!0,T("Multicast response on interface %s containing unique records (took %d ms) was combined with response which is sent out later",t.interface,i);break}}if(!e){this.server.sendResponse(i.asPacket(),t.interface);const e=(new Date).getTime()-r;T("Sending response via multicast on network %s (took %d ms): %s",t.interface,e,i.asString(s))}}}handleResponse(e,t){this.currentProber&&this.currentProber.handleResponse(e,t);for(const r of this.announcedServices.values()){let i=!1,n=0;for(const o of e.answers.values()){const e=D.checkRecordConflictType(r,o,t);if(1===e){i=!0;break}2===e&&n++}if(!i)for(const o of e.additionals.values()){const e=D.checkRecordConflictType(r,o,t);if(1===e){i=!0;break}2===e&&n++}if(i)this.republishService(r,(e=>{e&&(console.log(`FATAL Error occurred trying to resolve conflict for service ${r.getFQDN()}! We can't recover from this!`),console.log(e.stack),process.exit(1))}),!0);else if(n&&!r.currentAnnouncer){r.serviceState="announcing";const e=new g.Announcer(this.server,r,{repetitions:1});r.currentAnnouncer=e,e.announce().then((()=>{r.currentAnnouncer=void 0,r.serviceState="announced"}),(e=>{r.currentAnnouncer=void 0,r.serviceState="announced",e!==g.Announcer.CANCEL_REASON&&console.warn("When trying to resolve a ttl conflict on the network, we were unable to send our response packet: "+e.message)}))}}}static checkRecordConflictType(e,t,r){if(!e.advertisesOnInterface(r.interface))return 0;const i=t.getLowerCasedName();if(i===e.getLowerCasedFQDN()){if(33===t.type){const r=t;if(r.getLowerCasedHostname()!==e.getLowerCasedHostname())return T("[%s] Noticed conflicting record on the network. SRV with hostname: %s",e.getFQDN(),r.hostname),1;if(r.port!==e.getPort())return T("[%s] Noticed conflicting record on the network. SRV with port: %s",e.getFQDN(),r.port),1;if(r.ttl{const e=this.delayedMulticastResponses.indexOf(i);-1!==e&&this.delayedMulticastResponses.splice(e,1);try{this.server.sendResponse(i.getPacket(),t),T("Sending (delayed %dms) response via multicast on network interface %s (took %d ms): %s",Math.round(i.getTimeSinceCreation()),t,r,i.getPacket().asLoggingString())}catch(e){if(e.name===S.ERR_INTERFACE_NOT_FOUND)T("Multicast response (delayed %dms) was cancelled as the network interface %s is no longer available!",Math.round(i.getTimeSinceCreation()),t);else{if(e.name!==S.ERR_SERVER_CLOSED)throw e;T("Multicast response (delayed %dms) was cancelled as the server is about to be shutdown!",Math.round(i.getTimeSinceCreation()))}}}))}answerQuestion(e,t,r){if(1!==e.class&&255!==e.class)return[];const i=[];let n;if(12===e.type||255===e.type||5===e.type){const o=this.servicePointer.get(e.getLowerCasedName());if(o){for(const a of o){const o=this.announcedServices.get(a);if(o){if(o.advertisesOnInterface(t.interface)){const n=D.answerServiceQuestion(o,e,t,r);n.hasAnswers()&&i.push(n)}}else n||(n=new v.QueryResponse(r),i.unshift(n)),n.addAnswer(new h.PTRRecord(e.name,a))}return i}}for(const n of this.announcedServices.values()){if(!n.advertisesOnInterface(t.interface))continue;const o=D.answerServiceQuestion(n,e,t,r);o.hasAnswers()&&i.push(o)}return i}static answerServiceQuestion(e,t,r,i){const o=new v.QueryResponse(i),a=t.getLowerCasedName(),s=255===t.type||5===t.type,c=o.addAnswer.bind(o),u=o.addAdditional.bind(o);if(a===e.getLowerCasedTypePTR()){if(s||12===t.type){o.addAnswer(e.ptrRecord())&&(o.addAdditional(e.txtRecord(),e.srvRecord()),this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}}else if(a===e.getLowerCasedFQDN())if(s){o.addAnswer(e.txtRecord());o.addAnswer(e.srvRecord())&&(this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}else if(33===t.type){o.addAnswer(e.srvRecord())&&(this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(!0),e.addressNSECRecord()))}else 16===t.type&&(o.addAnswer(e.txtRecord()),o.addAdditional(e.serviceNSECRecord()));else if(a===e.getLowerCasedHostname()||a+"local."===e.getLowerCasedHostname()){if(s)this.addAddressRecords(e,r,1,c),this.addAddressRecords(e,r,28,c),o.addAdditional(e.addressNSECRecord());else if(1===t.type){this.addAddressRecords(e,r,1,c)&&this.addAddressRecords(e,r,28,u),o.addAdditional(e.addressNSECRecord())}else if(28===t.type){this.addAddressRecords(e,r,28,c)&&this.addAddressRecords(e,r,1,u),o.addAdditional(e.addressNSECRecord())}}else if(e.getLowerCasedSubtypePTRs()&&(s||12===t.type)){const t=e.getLowerCasedSubtypePTRs().indexOf(a);if(-1!==t){const i=e.subtypePtrRecords()[t];(0,n.default)(a===i.name,"Question Name didn't match selected sub type ptr record!");o.addAnswer(i)&&(o.addAdditional(e.txtRecord(),e.srvRecord()),this.addAddressRecords(e,r,1,u),this.addAddressRecords(e,r,28,u),o.addAdditional(e.serviceNSECRecord(),e.addressNSECRecord()))}}return o}static addAddressRecords(e,t,r,i){if(1===r){const r=e.aRecord(t.interface);return!!r&&i(r)}if(28===r){const r=e.aaaaRecord(t.interface),n=e.aaaaRoutableRecord(t.interface),o=e.aaaaUniqueLocalRecord(t.interface);let a=!1;if(r&&(a=i(r)),n){const e=i(n);a=a||e}if(o){const e=i(o);a=a||e}return a}n.default.fail("Illegal argument!")}}t.Responder=D,D.SERVICE_TYPE_ENUMERATION_NAME="_services._dns-sd._udp.local.",D.INSTANCES=new Map},7352:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NonCompressionLabelCoder=t.DNSLabelCoder=void 0;const i=r(1635).__importDefault(r(2613));class n{constructor(e){this.trackedLengths=[],this.writtenNames=[],this.legacyUnicastEncoding=e||!1}initBuf(e){this.buffer=e}initRRLocation(e,t,r){this.startOfRR=e,this.startOfRData=t,this.rDataLength=r}clearRRLocation(){this.startOfRR=void 0,this.startOfRData=void 0,this.rDataLength=void 0}getUncompressedNameLength(e){if("."===e)return 1;(0,i.default)(e.endsWith("."),"Supplied illegal name which doesn't end with the root label!");let t=0;const r=e.split(".");for(let o=0;on.getLabelLength(e))),r={name:e,length:0,labelLengths:t};let o,a=0;for(let t=0;ta&&(o=r,a=i)}let s=0;if(o){const e=t.length-1-a;for(let r=0;rc&&(s=r,c=i)}if(s){const e=o.length-1-c,r=s.writtenLabels.length-1-c;for(let r=0;r=0&&a<255?((0,i.default)(void 0!==this.startOfRR,"Cannot decompress locally compressed name as record is not initialized!"),a+=this.startOfRR,(0,i.default)(a=256?((0,i.default)(void 0!==this.startOfRData&&void 0!==this.rDataLength,"Cannot decompress locally compressed name as record is not initialized!"),a-=-256,a+=this.startOfRData,(0,i.default)(a265 at "+(e+2)+" MUST point to a prior location!"),o+=(o?".":"")+this.decodeName(a).data):i.default.fail("Encountered unknown pointer range "+a);break}if(s===n.EXTENDED_LABEL_TYPE_ONE_BYTE){const t=a&n.NOT_POINTER_MASK_ONE_BYTE;i.default.fail("Received extended label type "+t+" at "+(e-1))}else i.default.fail("Encountered unknown pointer type: "+Buffer.from([s>>6]).toString("hex")+" (with original byte "+Buffer.from([a]).toString("hex")+")")}const c=this.buffer.toString("utf-8",e,e+a);e+=a,o+=(o?".":"")+c}return{data:o,readBytes:e-r}}static getLabelLength(e){if(e){const t=Buffer.byteLength(e);return(0,i.default)(t<=63,"Label cannot be longer than 63 bytes ("+e+")"),1+t}return 1}static writeLabel(e,t,r){if(e){const i=t.write(e,r+1);return t.writeUInt8(i,r),i+1}return t.writeUInt8(0,r),1}static computeLabelSuffixLength(e,t){(0,i.default)(0!==e.length&&0!==t.length,"Encountered empty name when comparing suffixes!");const r=e.length-1,n=t.length-1;let o=0,a=!1;for(let s=1;s<=r&&s<=n;s++){const c=e.charAt(r-s),u=t.charAt(n-s);if((0,i.default)(!!c&&!!u,"Seemingly encountered out of bounds trying to calculate suffixes"),c!==u){a=!0;break}"."===c&&o++}return a||o++,o}}t.DNSLabelCoder=n,n.DISABLE_COMPRESSION=!1,n.POINTER_MASK=49152,n.POINTER_MASK_ONE_BYTE=192,n.LOCAL_COMPRESSION_ONE_BYTE=128,n.EXTENDED_LABEL_TYPE_ONE_BYTE=64,n.NOT_POINTER_MASK=16383,n.NOT_POINTER_MASK_ONE_BYTE=63;class o extends n{getNameLength(e){return this.getUncompressedNameLength(e)}encodeName(e,t){return this.encodeUncompressedName(e,t)}}t.NonCompressionLabelCoder=o,o.INSTANCE=new o},4119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DNSPacket=t.PacketType=t.QClass=t.RClass=t.QType=t.RType=t.RCode=t.OpCode=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(1673),s=r(7352),c=r(5682);r(9577);const u=r(5231);var l,h,d,p,f,g,m;function v(e){return"answers"in e}!function(e){e[e.QUERY=0]="QUERY"}(l||(t.OpCode=l={})),function(e){e[e.NoError=0]="NoError"}(h||(t.RCode=h={})),function(e){e[e.A=1]="A",e[e.CNAME=5]="CNAME",e[e.PTR=12]="PTR",e[e.TXT=16]="TXT",e[e.AAAA=28]="AAAA",e[e.SRV=33]="SRV",e[e.OPT=41]="OPT",e[e.NSEC=47]="NSEC"}(d||(t.RType=d={})),function(e){e[e.A=1]="A",e[e.CNAME=5]="CNAME",e[e.PTR=12]="PTR",e[e.TXT=16]="TXT",e[e.AAAA=28]="AAAA",e[e.SRV=33]="SRV",e[e.NSEC=47]="NSEC",e[e.ANY=255]="ANY"}(p||(t.QType=p={})),function(e){e[e.IN=1]="IN"}(f||(t.RClass=f={})),function(e){e[e.IN=1]="IN",e[e.ANY=255]="ANY"}(g||(t.QClass=g={})),function(e){e[e.QUERY=0]="QUERY",e[e.RESPONSE=1]="RESPONSE"}(m||(t.PacketType=m={}));class y{constructor(e){this.questions=new Map,this.answers=new Map,this.authorities=new Map,this.additionals=new Map,this.estimatedEncodingLength=0,this.lastCalculatedLength=0,this.lengthDirty=!0,this.id=e.id||0,this.legacyUnicastEncoding=e.legacyUnicast||!1,this.type=e.type,this.opcode=e.opcode||0,this.flags=e.flags||{},this.rcode=e.rCode||0,1===this.type&&(this.flags.authoritativeAnswer=!0),e.questions&&this.addQuestions(...e.questions),e.answers&&this.addAnswers(...e.answers),e.authorities&&this.addAuthorities(...e.authorities),e.additionals&&this.addAdditionals(...e.additionals)}static createDNSQueryPacket(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=this.createDNSQueryPackets(e,t);return(0,n.default)(1===r.length,"Cannot user short method createDNSQueryPacket when query packets are more than one: is "+r.length),r[0]}static createDNSQueryPackets(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=[],i=new y({type:0,questions:e.questions,additionals:v(e)?e.additionals:void 0});if(r.push(i),i.getEstimatedEncodingLength()>t){const e=i.getEncodingLength();e>t&&n.default.fail("Cannot send query where already the query section is exceeding the udpPayloadSize ("+e+">"+t+")!")}if(v(e)&&e.answers){let n=i,o=0;const a=e.answers.concat([]);for(a.sort(((e,t)=>e.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)-t.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)));ot&&n.default.fail(`Probe query packet exceeds the mtu size (${r}>${t}). Can't split probe queries at the moment!`)}return r}static createDNSResponsePacketsFromRRSet(e,t=this.UDP_PAYLOAD_SIZE_IPV4){const r=new y({id:e.id,legacyUnicast:e.legacyUnicast,type:1,flags:{authoritativeAnswer:!0},questions:e.questions,answers:e.answers,additionals:e.additionals});return r.getEncodingLength()>t&&n.default.fail("Couldn't construct a dns response packet from a rr set which fits in an udp payload sized packet!"),r}canBeCombinedWith(e,t=y.UDP_PAYLOAD_SIZE_IPV4){return this.id===e.id&&this.type===e.type&&this.opcode===e.opcode&&(0,o.default)(this.flags,e.flags)&&this.rcode===e.rcode&&this.getEncodingLength()+e.getEncodingLength()<=t}combineWith(e){this.setLegacyUnicastEncoding(this.legacyUnicastEncoding||e.legacyUnicastEncoding),this.addRecords(this.questions,e.questions.values()),this.addRecords(this.answers,e.answers.values(),this.additionals),this.addRecords(this.authorities,e.authorities.values()),this.addRecords(this.additionals,e.additionals.values())}addQuestions(...e){return this.addRecords(this.questions,e)}addAnswers(...e){return this.addRecords(this.answers,e,this.additionals)}addAuthorities(...e){return this.addRecords(this.authorities,e)}addAdditionals(...e){return this.addRecords(this.additionals,e)}addRecords(e,t,r){let i=!1;for(const n of t)e.has(n.asString())||(this.estimatedEncodingLength&&(this.estimatedEncodingLength+=n.getEncodingLength(s.NonCompressionLabelCoder.INSTANCE)),e.set(n.asString(),n),i=!0,this.lengthDirty=!0,r&&r.delete(n.asString()));return i}setLegacyUnicastEncoding(e){this.legacyUnicastEncoding!==e&&(this.lengthDirty=!0),this.legacyUnicastEncoding=e}legacyUnicastEncodingEnabled(){return this.legacyUnicastEncoding}getEstimatedEncodingLength(){if(this.estimatedEncodingLength)return this.estimatedEncodingLength;const e=s.NonCompressionLabelCoder.INSTANCE;let t=y.DNS_PACKET_HEADER_SIZE;for(const r of this.questions.values())t+=r.getEncodingLength(e);for(const r of this.answers.values())t+=r.getEncodingLength(e);for(const r of this.authorities.values())t+=r.getEncodingLength(e);for(const r of this.additionals.values())t+=r.getEncodingLength(e);return this.estimatedEncodingLength=t,t}getEncodingLength(e){if(!this.lengthDirty)return this.lastCalculatedLength;const t=e||new s.DNSLabelCoder(this.legacyUnicastEncoding);let r=y.DNS_PACKET_HEADER_SIZE;for(const e of this.questions.values())r+=e.getEncodingLength(t);for(const e of this.answers.values())r+=e.getEncodingLength(t);for(const e of this.authorities.values())r+=e.getEncodingLength(t);for(const e of this.additionals.values())r+=e.getEncodingLength(t);return this.lengthDirty=!1,this.lastCalculatedLength=r,this.estimatedEncodingLength=r,r}encode(){const e=new s.DNSLabelCoder(this.legacyUnicastEncoding),t=this.getEncodingLength(e),r=Buffer.allocUnsafe(t);e.initBuf(r);let i=0;r.writeUInt16BE(this.id,i),i+=2;let o=this.type<<15|this.opcode<<11|this.rcode;this.flags.authoritativeAnswer&&(o|=y.AUTHORITATIVE_ANSWER_MASK),this.flags.truncation&&(o|=y.TRUNCATION_MASK),this.flags.recursionDesired&&(o|=y.RECURSION_DESIRED_MASK),this.flags.recursionAvailable&&(o|=y.RECURSION_AVAILABLE_MASK),this.flags.zero&&(o|=y.ZERO_HEADER_MASK),this.flags.authenticData&&(o|=y.AUTHENTIC_DATA_MASK),this.flags.checkingDisabled&&(o|=y.CHECKING_DISABLED_MASK),r.writeUInt16BE(o,i),i+=2,r.writeUInt16BE(this.questions.size,i),i+=2,r.writeUInt16BE(this.answers.size,i),i+=2,r.writeUInt16BE(this.authorities.size,i),i+=2,r.writeUInt16BE(this.additionals.size,i),i+=2;for(const t of this.questions.values()){i+=t.encode(e,r,i)}for(const t of this.answers.values()){i+=t.encode(e,r,i)}for(const t of this.authorities.values()){i+=t.encode(e,r,i)}for(const t of this.additionals.values()){i+=t.encode(e,r,i)}return(0,n.default)(i===r.length,"Bytes written didn't match the buffer size!"),r}static decode(e,t,r=0){const i=new s.DNSLabelCoder;i.initBuf(t);const o=t.readUInt16BE(r);r+=2;const a=t.readUInt16BE(r);r+=2;const l=t.readUInt16BE(r);r+=2;const h=t.readUInt16BE(r);r+=2;const d=t.readUInt16BE(r);r+=2;const p=t.readUInt16BE(r);r+=2;const f=[],g=[],m=[],v=[];r+=y.decodeList(e,i,t,r,l,c.Question.decode.bind(c.Question),f),r+=y.decodeList(e,i,t,r,h,u.ResourceRecord.decode.bind(u.ResourceRecord),g),r+=y.decodeList(e,i,t,r,d,u.ResourceRecord.decode.bind(u.ResourceRecord),m),r+=y.decodeList(e,i,t,r,p,u.ResourceRecord.decode.bind(u.ResourceRecord),v),(0,n.default)(r===t.length,"Didn't read the full buffer (offset="+r+", length="+t.length+")");const C=a>>15,S=a>>11&15,E=15&a,_={};return a&this.AUTHORITATIVE_ANSWER_MASK&&(_.authoritativeAnswer=!0),a&this.TRUNCATION_MASK&&(_.truncation=!0),a&this.RECURSION_DESIRED_MASK&&(_.recursionDesired=!0),a&this.RECURSION_AVAILABLE_MASK&&(_.recursionAvailable=!0),a&this.ZERO_HEADER_MASK&&(_.zero=!0),a&this.AUTHENTIC_DATA_MASK&&(_.authenticData=!0),a&this.CHECKING_DISABLED_MASK&&(_.checkingDisabled=!0),new y({id:o,type:C,opcode:S,rCode:E,flags:_,questions:f,answers:g,authorities:m,additionals:v})}static decodeList(e,t,r,i,n,o,a){const s=i;for(let s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Question=void 0;const i=r(7585);class n{constructor(e,t,r=!1,i=1){this.unicastResponseFlag=!1,e.endsWith(".")||(e+="."),this.name=e,this.type=t,this.class=i,this.unicastResponseFlag=r}getLowerCasedName(){return this.lowerCasedName||(this.lowerCasedName=(0,i.dnsLowerCase)(this.name))}getEncodingLength(e){return e.getNameLength(this.name)+4}encode(e,t,r){const i=r;r+=e.encodeName(this.name,r),t.writeUInt16BE(this.type,r),r+=2;let o=this.class;return this.unicastResponseFlag&&(o|=n.QU_MASK),t.writeUInt16BE(o,r),(r+=2)-i}clone(){return new n(this.name,this.type,this.unicastResponseFlag,this.class)}asString(){return`Q ${this.name} ${this.type} ${this.class}`}static decode(e,t,r,i){const o=i,a=t.decodeName(i);i+=a.readBytes;const s=r.readUInt16BE(i);i+=2;const c=r.readUInt16BE(i);i+=2;const u=c&this.NOT_QU_MASK,l=!!(c&this.QU_MASK);return{data:new n(a.data,s,l,u),readBytes:i-o}}}t.Question=n,n.QU_MASK=32768,n.NOT_QU_MASK=32767},5231:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(7585),s=r(1673),c=r(7352),u=(0,o.default)("ciao:decoder");class l{constructor(e,t,r=l.RR_DEFAULT_TTL,i=!1,n=1){this.flushFlag=!1,"string"==typeof e?(e.endsWith(".")||(e+="."),this.name=e,this.type=t,this.class=n,this.ttl=r,this.flushFlag=i):(this.name=e.name,this.type=e.type,this.class=e.class,this.ttl=e.ttl,this.flushFlag=e.flushFlag)}getLowerCasedName(){return this.lowerCasedName||(this.lowerCasedName=(0,a.dnsLowerCase)(this.name))}getEncodingLength(e){return e.getNameLength(this.name)+10+this.getRDataEncodingLength(e)}encode(e,t,r){const i=r;r+=e.encodeName(this.name,r),t.writeUInt16BE(this.type,r),r+=2;let n=this.class;this.flushFlag&&(n|=l.FLUSH_MASK),t.writeUInt16BE(n,r),r+=2,t.writeUInt32BE(this.ttl,r),r+=4;const o=this.encodeRData(e,t,r+2);return t.writeUInt16BE(o,r),(r+=2+o)-i}getRawData(){const e=c.NonCompressionLabelCoder.INSTANCE,t=this.getRDataEncodingLength(e),r=Buffer.allocUnsafe(t);e.initBuf(r);const i=this.encodeRData(e,r,0);return(0,n.default)(i===r.length,"Didn't completely write to the buffer! ("+i+"!="+r.length+")"),e.initBuf(),r}static clone(e){return e.map((e=>e.clone()))}getRecordRepresentation(){return{name:this.name,type:this.type,class:this.class,ttl:this.ttl,flushFlag:this.flushFlag}}aboutEqual(e){return this.type===e.type&&this.name===e.name&&this.class===e.class&&this.dataEquals(e)}representsSameData(e){return this.type===e.type&&this.name===e.name&&this.class===e.class}asString(){return`RR ${this.name} ${this.type} ${this.class} ${this.dataAsString()}`}static decode(e,t,r,i){const n=i,o=this.decodeRecordHeader(t,r,i);i+=o.readBytes;const a=o.data,c=this.typeToRecordDecoder.get(a.type);if(!c)return{readBytes:i+a.rDataLength-n};t.initRRLocation(n,i,a.rDataLength);const l=r.subarray(0,i+a.rDataLength);let h;try{h=c(t,a,l,i)}catch(t){return u(`Received malformed rdata section for ${(0,s.dnsTypeToString)(a.type)} ${a.name} ${a.ttl} from ${e.address}:${e.port} with data '${l.subarray(i).toString("hex")}': ${t.stack}`),{readBytes:i+a.rDataLength-n}}return i+=h.readBytes,t.clearRRLocation(),{data:h.data,readBytes:i-n}}static decodeRecordHeader(e,t,r){const i=r,n=e.decodeName(r);r+=n.readBytes;const o=t.readUInt16BE(r);r+=2;const a=t.readUInt16BE(r);let s;r+=2;let c=!1;41!==o?(s=a&this.NOT_FLUSH_MASK,c=!!(a&this.FLUSH_MASK)):s=a;const u=t.readUInt32BE(r);r+=4;const l=t.readUInt16BE(r);r+=2;return{data:{name:n.data,type:o,class:s,ttl:u,flushFlag:c,rDataLength:l},readBytes:r-i}}}t.ResourceRecord=l,l.typeToRecordDecoder=new Map,l.FLUSH_MASK=32768,l.NOT_FLUSH_MASK=32767,l.RR_DEFAULT_TTL_SHORT=120,l.RR_DEFAULT_TTL=4500},1673:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dnsTypeToString=void 0,t.dnsTypeToString=function(e){switch(e){case 1:return"A";case 5:return"CNAME";case 12:return"PTR";case 16:return"TXT";case 28:return"AAAA";case 33:return"SRV";case 41:return"OPT";case 47:return"NSEC";case 255:return"ANY"}return"UNSUPPORTED_"+e}},1360:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AAAARecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278)),a=r(9152),s=r(5231);class c extends s.ResourceRecord{constructor(e,t,r,i){"string"==typeof e?super(e,28,i||c.RR_DEFAULT_TTL_SHORT,r):((0,n.default)(28===e.type),super(e)),(0,n.default)(o.default.isIPv6(t),"IP address is not in v6 format!"),this.ipAddress=t}getRDataEncodingLength(){return 16}encodeRData(e,t,r){const i=r,o=(0,a.enlargeIPv6)(this.ipAddress).split(":");(0,n.default)(8===o.length,"invalid ip address");for(const e of o){const i=parseInt(e,16);t.writeUInt16BE(i,r),r+=2}return r-i}static decodeData(e,t,r,i){const n=i,o=new Array(8);for(let e=0;e<8;e++){const t=r.readUInt16BE(i);i+=2,o[e]=t.toString(16)}const s=(0,a.shortenIPv6)(o.join(":"));return{data:new c(t,s),readBytes:i-n}}clone(){return new c(this.getRecordRepresentation(),this.ipAddress)}dataAsString(){return this.ipAddress}dataEquals(e){return this.ipAddress===e.ipAddress}}t.AAAARecord=c,c.DEFAULT_TTL=120},4495:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ARecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278)),a=r(5231);class s extends a.ResourceRecord{constructor(e,t,r,i){"string"==typeof e?super(e,1,i||s.RR_DEFAULT_TTL_SHORT,r):((0,n.default)(1===e.type),super(e)),(0,n.default)(o.default.isIPv4(t),"IP address is not in v4 format!"),this.ipAddress=t}getRDataEncodingLength(){return 4}encodeRData(e,t,r){const i=r,o=this.ipAddress.split(".");(0,n.default)(4===o.length,"invalid ip address");for(const e of o){const i=parseInt(e,10);t.writeUInt8(i,r++)}return r-i}static decodeData(e,t,r,i){const n=i,o=new Array(4);for(let e=0;e<4;e++){const t=r.readUInt8(i++);o[e]=t.toString(10)}const a=o.join(".");return{data:new s(t,a),readBytes:i-n}}clone(){return new s(this.getRecordRepresentation(),this.ipAddress)}dataAsString(){return this.ipAddress}dataEquals(e){return this.ipAddress===e.ipAddress}}t.ARecord=s,s.DEFAULT_TTL=120},5102:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CNAMERecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,5,n,r):((0,i.default)(5===e.type),super(e)),t.endsWith(".")||(t+="."),this.cname=t}getLowerCasedCName(){return this.lowerCasedCName||(this.lowerCasedCName=(0,n.dnsLowerCase)(this.cname))}getRDataEncodingLength(e){return e.getNameLength(this.cname)}encodeRData(e,t,r){const i=r;return(r+=e.encodeName(this.cname,r))-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i);return i+=o.readBytes,{data:new a(t,o.data),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.cname)}dataAsString(){return this.cname}dataEquals(e){return this.getLowerCasedCName()===e.getLowerCasedCName()}}t.CNAMERecord=a,a.DEFAULT_TTL=o.ResourceRecord.RR_DEFAULT_TTL},6343:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NSECRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(7585),s=r(5231);class c extends s.ResourceRecord{constructor(e,t,r,i,o){"string"==typeof e?super(e,47,i||c.RR_DEFAULT_TTL_SHORT,o):((0,n.default)(47===e.type),super(e)),t.endsWith(".")||(t+="."),this.nextDomainName=t,this.rrTypeWindows=c.rrTypesToWindowMap(r)}getLowerCasedNextDomainName(){return this.lowerCasedNextDomainName||(this.lowerCasedNextDomainName=(0,a.dnsLowerCase)(this.nextDomainName))}getRRTypesBitMapEncodingLength(){let e=0;for(const t of this.rrTypeWindows)(0,n.default)(t.rrtypes.length>0,"types array for windowId "+t.windowId+" cannot be empty!"),e+=2+t.bitMapSize;return e}getRDataEncodingLength(e){return e.legacyUnicastEncoding,e.getUncompressedNameLength(this.nextDomainName)+this.getRRTypesBitMapEncodingLength()}encodeRData(e,t,r){const i=r;r+=(e.legacyUnicastEncoding,e.encodeUncompressedName(this.nextDomainName,r));for(const e of this.rrTypeWindows){t.writeUInt8(e.windowId,r++),t.writeUInt8(e.bitMapSize,r++);const i=Buffer.alloc(e.bitMapSize);for(const t of e.rrtypes){const e=(255&t)>>3;let r=i.readUInt8(e);r|=1<<7-(7&t),i.writeUInt8(r,e)}i.copy(t,r),r+=i.length}return r-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i,!1);i+=o.readBytes;const a=[];for(;i""+e)).join(",")}]`}dataEquals(e){return this.getLowerCasedNextDomainName()===e.getLowerCasedNextDomainName()&&(0,o.default)(this.rrTypeWindows,e.rrTypeWindows)}static rrTypesToWindowMap(e){const t=[];for(const r of e){const e=r>>8;let i;for(const r of t)if(r.windowId===e){i=r;break}if(i){i.rrtypes.push(r);const e=Math.ceil((255&r)/8);e>i.bitMapSize&&(i.bitMapSize=e)}else i={windowId:e,bitMapSize:Math.ceil((255&r)/8),rrtypes:[r]},t.push(i)}return t.sort(((e,t)=>e.windowId-t.windowId)),t.forEach((e=>e.rrtypes.sort(((e,t)=>e-t)))),t}static windowsToRRTypes(e){const t=[];for(const r of e)t.push(...r.rrtypes);return t}}t.NSECRecord=c},6141:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OPTRecord=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(2017)),a=r(5231);class s extends a.ResourceRecord{constructor(e,t,r,i,o,a){"number"==typeof e?(super(".",41,a,!1,e),this.udpPayloadSize=e):((0,n.default)(41===e.type),super(e),this.udpPayloadSize=e.class),this.extendedRCode=r||0,this.ednsVersion=o||s.EDNS_VERSION,this.flags={dnsSecOK:(null==i?void 0:i.dnsSecOK)||!1,zero:(null==i?void 0:i.zero)||0,...i},this.options=t||[]}getRDataEncodingLength(){let e=0;for(const t of this.options)e+=4+t.data.length;return e}encodeRData(e,t,r){const i=r,n=r-8,o=r-6;t.writeUInt16BE(this.udpPayloadSize,n),t.writeUInt8(this.extendedRCode,o),t.writeUInt8(this.ednsVersion,o+1);let a=this.flags.zero||0;this.flags.dnsSecOK&&(a|=s.DNS_SEC_OK_MASK),t.writeUInt16BE(a,o+2);for(const e of this.options)t.writeUInt16BE(e.code,r),r+=2,t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;return r-i}static decodeData(e,t,r,i){const n=i,o=i-8,a=i-6,c=r.readUInt16BE(o),u=r.readUInt8(a),l=r.readUInt8(a+1),h=r.readUInt16BE(a+2),d={dnsSecOK:!!(h&s.DNS_SEC_OK_MASK),zero:h&s.NOT_DNS_SEC_OK_MASK},p=[];for(;i`${e.code} ${e.data.toString("base64")}`)).join(",")}]`}dataEquals(e){return this.udpPayloadSize===e.udpPayloadSize&&this.extendedRCode===e.extendedRCode&&this.ednsVersion===e.ednsVersion&&s.optionsEquality(this.options,e.options)&&(0,o.default)(this.flags,e.flags)}static optionsEquality(e,t){if(e.length!==t.length)return!1;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PTRRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,12,n,r):((0,i.default)(12===e.type),super(e)),t.endsWith(".")||(t+="."),this.ptrName=t}getLowerCasedPTRName(){return this.lowerCasedPtrName||(this.lowerCasedPtrName=(0,n.dnsLowerCase)(this.ptrName))}getRDataEncodingLength(e){return e.getNameLength(this.ptrName)}encodeRData(e,t,r){const i=r;return(r+=e.encodeName(this.ptrName,r))-i}static decodeData(e,t,r,i){const n=i,o=e.decodeName(i);return i+=o.readBytes,{data:new a(t,o.data),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.ptrName)}dataAsString(){return this.ptrName}dataEquals(e){return this.getLowerCasedPTRName()===e.getLowerCasedPTRName()}}t.PTRRecord=a,a.DEFAULT_TTL=o.ResourceRecord.RR_DEFAULT_TTL},8225:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SRVRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(7585),o=r(5231);class a extends o.ResourceRecord{constructor(e,t,r,n,o){"string"==typeof e?super(e,33,o||a.RR_DEFAULT_TTL_SHORT,n):((0,i.default)(33===e.type),super(e)),t.endsWith(".")?this.hostname=t:this.hostname=t+".",this.port=r,this.priority=0,this.weight=0}getLowerCasedHostname(){return this.lowerCasedHostname||(this.lowerCasedHostname=(0,n.dnsLowerCase)(this.hostname))}getRDataEncodingLength(e){return 6+(e.legacyUnicastEncoding?e.getUncompressedNameLength(this.hostname):e.getNameLength(this.hostname))}encodeRData(e,t,r){const i=r;t.writeUInt16BE(this.priority,r),r+=2,t.writeUInt16BE(this.weight,r),r+=2,t.writeUInt16BE(this.port,r),r+=2;return(r+=e.legacyUnicastEncoding?e.encodeUncompressedName(this.hostname,r):e.encodeName(this.hostname,r))-i}static decodeData(e,t,r,i){const n=i;i+=2,i+=2;const o=r.readUInt16BE(i);i+=2;const s=e.decodeName(i);return i+=s.readBytes,{data:new a(t,s.data,o),readBytes:i-n}}clone(){return new a(this.getRecordRepresentation(),this.hostname,this.port)}dataAsString(){return`${this.hostname} ${this.port} ${this.priority} ${this.weight}`}dataEquals(e){return this.getLowerCasedHostname()===e.getLowerCasedHostname()&&this.port===e.port&&this.weight===e.weight&&this.priority===e.priority}}t.SRVRecord=a,a.DEFAULT_TTL=120},1576:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TXTRecord=void 0;const i=r(1635).__importDefault(r(2613)),n=r(5231);class o extends n.ResourceRecord{constructor(e,t,r,n){"string"==typeof e?super(e,16,n,r):((0,i.default)(16===e.type),super(e)),this.txt=0===t.length?[Buffer.from([])]:t}getRDataEncodingLength(){let e=0;for(const t of this.txt)e+=1+t.length,(0,i.default)(t.length<=255,"One txt character-string can only have a length of 255 chars");return e}encodeRData(e,t,r){const i=r;for(const e of this.txt)t.writeUInt8(e.length,r++),e.copy(t,r),r+=e.length;return r-i}clone(){return new o(this.getRecordRepresentation(),this.txt)}dataAsString(){return`[${this.txt.map((e=>`${e.toString("base64")}`)).join(",")}]`}dataEquals(e){if(this.txt.length!==e.txt.length)return!1;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(5231),n=r(1360),o=r(4495),a=r(5102),s=r(6343),c=r(6141),u=r(482),l=r(8225),h=r(1576);i.ResourceRecord.typeToRecordDecoder.set(28,n.AAAARecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(1,o.ARecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(5,a.CNAMERecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(47,s.NSECRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(12,u.PTRRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(33,l.SRVRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(41,c.OPTRecord.decodeData),i.ResourceRecord.typeToRecordDecoder.set(16,h.TXTRecord.decodeData)},8318:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getResponder=t.Protocol=void 0;const i=r(1635);r(3476);const n=i.__importDefault(r(5753)),o=r(3325).rE;if(o.includes("beta")||process.env.BCT){const e=process.env.DEBUG;e&&e.includes("ciao")||(e?n.default.enable(e+",ciao:*"):n.default.enable("ciao:*"))}r(9577);const a=r(4288);var s;function c(e){return a.Responder.getResponder(e)}i.__exportStar(r(141),t),i.__exportStar(r(4288),t),(0,n.default)("ciao:init")("Loading ciao v"+o+"..."),function(e){e.TCP="tcp",e.UDP="udp"}(s||(t.Protocol=s={})),t.getResponder=c,t.default={getResponder:c}},9983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Announcer=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(4119),s=r(2361),c=r(8390),u=(0,o.default)("ciao:Announcer");class l{constructor(e,t,r){this.repetitions=1,this.announceIntervalIncreaseFactor=2,this.goodbye=!1,this.sentAnnouncements=0,this.sentLastAnnouncement=!1,this.nextInterval=1e3,this.nextAnnouncementTime=0,(0,n.default)(e,"server must be defined"),(0,n.default)(t,"service must be defined"),this.server=e,this.service=t,r&&(void 0!==r.repetitions&&(this.repetitions=r.repetitions),r.goodbye&&(this.goodbye=!0)),(0,n.default)(this.repetitions>0&&this.repetitions<=8,"repetitions must in [1;8]")}announce(){return u("[%s] Sending %s for service",this.service.getFQDN(),this.goodbye?"goodbye":"announcement"),this.goodbye||this.service.rebuildServiceRecords(),this.promise=new Promise(((e,t)=>{this.promiseResolve=e,this.promiseReject=t,this.timer=setTimeout(this.sendAnnouncement.bind(this),0),this.timer.unref(),this.nextAnnouncementTime=(new Date).getTime()}))}async cancel(){return u("[%s] Canceling %s",this.service.getFQDN(),this.goodbye?"goodbye":"announcement"),this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.promiseReject(l.CANCEL_REASON),this.awaitAnnouncement().catch((e=>{if(e!==l.CANCEL_REASON)return Promise.reject(e)}))}hasSentLastAnnouncement(){return this.sentLastAnnouncement}async awaitAnnouncement(){await this.promise}isSendingGoodbye(){return this.goodbye}sendAnnouncement(){u("[%s] Sending %s number %d",this.service.getFQDN(),this.goodbye?"goodbye":"announcement",this.sentAnnouncements+1);const e=[this.service.ptrRecord(),...this.service.subtypePtrRecords(),this.service.srvRecord(),this.service.txtRecord()];if(this.goodbye)for(const t of e)t.ttl=0;else e.push(this.service.metaQueryPtrRecord());this.sentAnnouncements+1>=this.repetitions&&(this.sentLastAnnouncement=!0),l.sendResponseAddingAddressRecords(this.server,this.service,e,this.goodbye).then((e=>{const t=(0,s.SendResultFailedRatio)(e);if(1===t)return console.error((0,s.SendResultFormatError)(e,`[${this.service.getFQDN()}] Failed to send ${this.goodbye?"goodbye":"announcement"} requests`),!0),void this.promiseReject(new Error((this.goodbye?"Goodbye":"Announcement")+" failed as of socket errors!"));t>0&&u((0,s.SendResultFormatError)(e,`Some of the ${this.goodbye?"goodbye":"announcement"} requests for '${this.service.getFQDN()}' encountered an error`)),"announcing"===this.service.serviceState?(this.sentAnnouncements++,this.sentAnnouncements>=this.repetitions?this.promiseResolve():(this.timer=setTimeout(this.sendAnnouncement.bind(this),this.nextInterval),this.timer.unref(),this.nextAnnouncementTime=(new Date).getTime()+this.nextInterval,this.nextInterval*=this.announceIntervalIncreaseFactor)):u("[%s] Service is no longer in announcing state. Stopping. (Received %s)",this.service.getFQDN(),this.service.serviceState)}))}static sendResponseAddingAddressRecords(e,t,r,i){const n=[];for(const o of e.getBoundInterfaceNames()){if(!t.advertisesOnInterface(o))continue;const u=r.concat([]),l=t.aRecord(o),h=t.aaaaRecord(o),d=t.aaaaRoutableRecord(o),p=t.aaaaUniqueLocalRecord(o),f=t.addressNSECRecord(),g=t.serviceNSECRecord();l&&(i&&(l.ttl=0),u.push(l)),h&&(i&&(h.ttl=0),u.push(h)),d&&(i&&(d.ttl=0),u.push(d)),p&&(i&&(p.ttl=0),u.push(p)),i&&(f.ttl=0,g.ttl=0);const m=[];m.push(f,g);const v=a.DNSPacket.createDNSResponsePacketsFromRRSet({answers:u,additionals:m});n.push(Promise.race([e.send(v,o),(0,c.PromiseTimeout)(s.MDNSServer.SEND_TIMEOUT).then((()=>({status:"timeout",interface:o})))]))}return Promise.all(n)}}t.Announcer=l,l.CANCEL_REASON="CIAO ANNOUNCEMENT CANCELLED"},2475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Prober=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(5682),s=r(2361),c=i.__importStar(r(6948)),u=r(6948),l=(0,o.default)("ciao:Prober");class h{constructor(e,t,r){this.records=[],this.currentInterval=250,this.serviceEncounteredNameChange=!1,this.sentFirstProbeQuery=!1,this.sentQueriesForCurrentTry=0,this.sentQueries=0,(0,n.default)(e,"responder must be defined"),(0,n.default)(t,"server must be defined"),(0,n.default)(r,"service must be defined"),this.responder=e,this.server=t,this.service=r}getService(){return this.service}probe(){return l("Starting to probe for '%s'...",this.service.getFQDN()),new Promise(((e,t)=>{this.promiseResolve=e,this.promiseReject=t,this.timer=setTimeout(this.sendProbeRequest.bind(this),250*Math.random()),this.timer.unref()}))}cancel(){this.clear(),this.promiseReject(h.CANCEL_REASON)}clear(){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.sentFirstProbeQuery=!1,this.sentQueriesForCurrentTry=0}endProbing(e){this.clear(),e&&(l("Probing for '%s' finished successfully",this.service.getFQDN()),this.promiseResolve(),this.serviceEncounteredNameChange&&this.service.informAboutNameUpdates())}sendProbeRequest(){if(0===this.sentQueriesForCurrentTry&&(this.records=[this.service.srvRecord(),this.service.txtRecord(),this.service.ptrRecord(),...this.service.subtypePtrRecords(),...this.service.allAddressRecords()].sort(u.rrComparator),this.records.forEach((e=>e.flushFlag=!1))),this.sentQueriesForCurrentTry>=3)return void this.endProbing(!0);this.sentQueries>=15&&(this.currentInterval=1e3),l("Sending prober query number %d for '%s'...",this.sentQueriesForCurrentTry+1,this.service.getFQDN()),(0,n.default)(this.records.length>0,"Tried sending probing request for zero record length!");const e=[new a.Question(this.service.getFQDN(),255,!0),new a.Question(this.service.getHostname(),255,!0)];this.server.sendQueryBroadcast({questions:e,authorities:this.records},this.service).then((e=>{const t=(0,s.SendResultFailedRatio)(e);if(1===t)return console.error((0,s.SendResultFormatError)(e,`Failed to send probe queries for '${this.service.getFQDN()}'`),!0),this.endProbing(!1),void this.promiseReject(new Error("Probing failed as of socket errors!"));t>0&&l((0,s.SendResultFormatError)(e,`Some of the probe queries for '${this.service.getFQDN()}' encountered an error`)),"probing"===this.service.serviceState?(this.sentFirstProbeQuery=!0,this.sentQueriesForCurrentTry++,this.sentQueries++,this.timer=setTimeout(this.sendProbeRequest.bind(this),this.currentInterval),this.timer.unref(),this.checkLocalConflicts()):l("Service '%s' is no longer in probing state. Stopping.",this.service.getFQDN())}))}checkLocalConflicts(){let e=!1;for(const t of this.responder.getAnnouncedServices())if(t.getLowerCasedFQDN()===this.service.getLowerCasedFQDN()||t.getLowerCasedHostname()===this.service.getLowerCasedHostname()){e=!0;break}e&&(l("Probing for '%s' failed as of local service. Doing a name change",this.service.getFQDN()),this.handleNameChange())}handleResponse(e,t){if(!this.sentFirstProbeQuery||!this.service.advertisesOnInterface(t.interface))return;let r=!1;for(const t of e.answers.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}for(const t of e.additionals.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}r&&(l("Probing for '%s' failed. Doing a name change",this.service.getFQDN()),this.handleNameChange())}handleNameChange(){this.endProbing(!1),this.service.serviceState="unannounced",this.service.incrementName(),this.service.serviceState="probing",this.serviceEncounteredNameChange=!0,this.timer=setTimeout(this.sendProbeRequest.bind(this),1e3),this.timer.unref()}handleQuery(e,t){if(!this.sentFirstProbeQuery||!this.service.advertisesOnInterface(t.interface))return;let r=!1;for(const t of e.questions.values())if(t.getLowerCasedName()===this.service.getLowerCasedFQDN()||t.getLowerCasedName()===this.service.getLowerCasedHostname()){r=!0;break}r&&this.doTiebreaking(e)}doTiebreaking(e){if(!this.sentFirstProbeQuery)return;let t=0===e.authorities.size;for(const r of e.authorities.values())if(r.getLowerCasedName()===this.service.getLowerCasedFQDN()||r.getLowerCasedName()===this.service.getLowerCasedHostname()){t=!0;break}if(!t)return;const r=this.records,i=Array.from(e.authorities.values()).sort(c.rrComparator),n=c.runTiebreaking(r,i);1===n?l("'%s' won the tiebreak. We gonna ignore the other probing request!",this.service.getFQDN()):-1===n&&(l("'%s' lost the tiebreak. We are waiting a second and try to probe again...",this.service.getFQDN()),this.endProbing(!1),this.timer=setTimeout(this.sendProbeRequest.bind(this),1e3),this.timer.unref())}}t.Prober=h,h.CANCEL_REASON="CIAO PROBING CANCELLED"},572:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryResponse=void 0;const i=r(4119);t.QueryResponse=class{constructor(e){this.sharedAnswer=!1,this.dnsPacket=new i.DNSPacket({type:1}),this.knownAnswers=e}asPacket(){return this.dnsPacket}asString(e){return this.dnsPacket.asLoggingString(e)}containsSharedAnswer(){return this.sharedAnswer}addAnswer(...e){let t=!1;for(const r of e){if(this.isKnownAnswer(r))continue;this.dnsPacket.addAnswers(r)&&(t=!0,r.flushFlag||(this.sharedAnswer=!0))}return t}addAdditional(...e){let t=!1;for(const r of e){if(this.isKnownAnswer(r))continue;if(this.dnsPacket.answers.has(r.asString()))continue;this.dnsPacket.addAdditionals(r)&&(t=!0)}return t}markLegacyUnicastResponse(e,t){this.dnsPacket.id=e,t&&this.dnsPacket.addQuestions(...t),this.dnsPacket.answers.forEach((e=>{e.flushFlag=!1,e.ttl=10})),this.dnsPacket.additionals.forEach((e=>{e.flushFlag=!1,e.ttl=10})),this.dnsPacket.setLegacyUnicastEncoding(!0)}markTruncated(){this.dnsPacket.flags.truncation=!0}hasAnswers(){return this.dnsPacket.answers.size>0}isKnownAnswer(e){if(!this.knownAnswers)return!1;const t=this.knownAnswers.get(e.asString());return void 0!==t&&t.ttl>e.ttl/2}static combineResponses(e,t){for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuedResponse=void 0;class r{constructor(e,t){this.timeOfCreation=(new Date).getTime(),this.estimatedTimeToBeSent=0,this.delay=-1,this.packet=e,this.interfaceName=t}getPacket(){return this.packet}getTimeSinceCreation(){return(new Date).getTime()-this.timeOfCreation}getTimeTillSent(){return Math.max(0,this.estimatedTimeToBeSent-(new Date).getTime())}calculateRandomDelay(){this.delay=100*Math.random()+20,this.estimatedTimeToBeSent=(new Date).getTime()+this.delay}scheduleResponse(e){this.timer=setTimeout(e,this.delay),this.timer.unref()}delayWouldBeInTimelyManner(e){return e.estimatedTimeToBeSent-this.timeOfCreation<=r.MAX_DELAY}combineWithNextPacketIfPossible(e){return this.interfaceName===e.interfaceName&&(!!e.packet.canBeCombinedWith(this.packet)&&(e.packet.combineWith(this.packet),e.timeOfCreation=Math.min(this.timeOfCreation,e.timeOfCreation),this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.delayed=!0,!0))}combineWithUniqueResponseIfPossible(e,t){return this.interfaceName===t&&(!!this.packet.canBeCombinedWith(e.asPacket())&&(this.packet.combineWith(e.asPacket()),!0))}}t.QueuedResponse=r,r.MAX_DELAY=500},341:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TruncatedQuery=t.TruncatedQueryEvent=t.TruncatedQueryResult=void 0;const i=r(4434);var n,o;!function(e){e[e.ABORT=1]="ABORT",e[e.AGAIN_TRUNCATED=2]="AGAIN_TRUNCATED",e[e.FINISHED=3]="FINISHED"}(n||(t.TruncatedQueryResult=n={})),function(e){e.TIMEOUT="timeout"}(o||(t.TruncatedQueryEvent=o={}));class a extends i.EventEmitter{constructor(e){super(),this.arrivedPackets=1,this.timeOfArrival=(new Date).getTime(),this.packet=e,this.timer=this.resetTimer()}getPacket(){return this.packet}getArrivedPacketCount(){return this.arrivedPackets}getTotalWaitTime(){return(new Date).getTime()-this.timeOfArrival}appendDNSPacket(e){if(this.packet.combineWith(e),this.arrivedPackets++,e.flags.truncation){return(new Date).getTime()-this.timeOfArrival>5e3?1:(this.resetTimer(),2)}return clearTimeout(this.timer),this.removeAllListeners(),3}resetTimer(){return this.timer&&clearTimeout(this.timer),this.timer=setTimeout(this.timeout.bind(this),400+100*Math.random())}timeout(){this.emit("timeout"),this.removeAllListeners()}}t.TruncatedQuery=a},7585:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dnsLowerCase=void 0;const r=/[A-Z]/g;t.dnsLowerCase=function(e){return e.replace(r,(e=>e.toLowerCase()))}},9152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNetAddress=t.ipAddressFromReversAddressName=t.formatReverseAddressPTRName=t.shortenIPv6=t.enlargeIPv6=t.removeTLD=t.formatHostname=t.stringify=t.parseFQDN=void 0;const i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(9278));function a(e){return e.startsWith("_")?e.slice(1):e}function s(e){(0,n.default)(o.default.isIPv6(e),"Illegal argument. Must be ipv6 address!"),(0,n.default)(!e.includes("."),"ipv4-mapped ipv6 addresses are currently unsupported!");const t=e.split(":");if(""===t[0])for(t.splice(0,1);t.length<8;)t.unshift("0000");else if(""===t[t.length-1])for(t.splice(t.length-1,1);t.length<8;)t.push("0000");else if(t.length<8){let e;for(e=0;er&&(t=i,r=n),i=o}if(-1!==t){const i=0===t||t+r===8;e[t]=i?":":"",r>1&&e.splice(t+1,r-1)}const i=e.join(":");return":"===i?"::":i}t.parseFQDN=function(e){const t=e.split(".");(0,n.default)(t.length>=3,"Received illegal fqdn: "+e);let r=t.length-1,i="";for(;"_tcp"!==(o=t[r])&&"_udp"!==o;)i=a(t[r])+(i?"."+i:""),r--;var o;(0,n.default)(r>=1,"Failed to parse illegal fqdn: "+e);const s=a(t[r--]),c=a(t[r--]);if(r<0)return{domain:i,protocol:s,type:c};if(function(e){return"_sub"===e}(t[r])){r--,(0,n.default)(0===r,"Received illegal formatted sub type fqdn: "+e);return{domain:i,protocol:s,type:c,subtype:a(t[r])}}return{domain:i,protocol:s,type:c,name:a(t.slice(0,r+1).join("."))}},t.stringify=function(e){let t;return(0,n.default)(e.type,"type cannot be undefined"),(0,n.default)(e.type.length<=15,"type must not be longer than 15 characters"),t=function(e){return"subtype"in e}(e)?`_${e.subtype}._sub.`:e.name?`${e.name}.`:"",`${t}_${e.type}._${e.protocol||"tcp"}.${e.domain||"local"}.`},t.formatHostname=function(e,t="local"){(0,n.default)(!e.endsWith("."),"hostname must not end with the root label!");const r="."+t;return(e.endsWith(r)?e:e+r)+"."},t.removeTLD=function(e){e.endsWith(".")&&(e=e.substring(0,e.length-1));const t=e.lastIndexOf(".");return e.slice(0,t)},t.enlargeIPv6=s,t.shortenIPv6=c,t.formatReverseAddressPTRName=function(e){if(o.default.isIPv4(e)){return e.split(".").reverse().join(".")+".in-addr.arpa"}if(o.default.isIPv6(e)){const t=(e=s(e).toUpperCase()).replace(/:/g,"").split("").reverse();return(0,n.default)(32===t.length,"Encountered invalid ipv6 address length! "+t.length),t.join(".")+".ip6.arpa"}throw new Error("Supplied illegal ip address format: "+e)},t.ipAddressFromReversAddressName=function(e){if((e=e.toLowerCase()).endsWith(".in-addr.arpa")){return e.replace(".in-addr.arpa","").split(".").reverse().join(".")}if(e.endsWith(".ip6.arpa")){const t=e.replace(".ip6.arpa","").split(".").reverse();(0,n.default)(32===t.length,"Encountered illegal length for .ip6.arpa split!");const r=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerClosedError=t.InterfaceNotFoundError=t.ERR_SERVER_CLOSED=t.ERR_INTERFACE_NOT_FOUND=void 0,t.ERR_INTERFACE_NOT_FOUND="ERR_INTERFACE_NOT_FOUND",t.ERR_SERVER_CLOSED="ERR_SERVER_CLOSED";class r extends Error{constructor(e){super(e),this.name="ERR_INTERFACE_NOT_FOUND"}}t.InterfaceNotFoundError=r;class i extends Error{constructor(e){super(e),this.name=t.ERR_SERVER_CLOSED}}t.ServerClosedError=i},8390:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromiseTimeout=void 0,t.PromiseTimeout=function(e){return new Promise((t=>{setTimeout((()=>t()),e)}))}},5762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sortedInsert=void 0,t.sortedInsert=function(e,t,r){let i=0,n=e.length-1,o=-1;for(;i0?i+1:i),e.splice(o,0,t)}},6948:(e,t)=>{"use strict";function r(e,t){if(e.class!==t.class)return e.class-t.class;if(e.type!==t.type)return e.type-t.type;const r=e.getRawData(),i=t.getRawData(),n=Math.max(r.length,i.length);for(let e=0;e=r.length&&e=i.length&&e=e.length&&n=t.length&&n{const i=r(4434).EventEmitter,n=r(9278),o=r(1145),a=r(9343),s=r(2293),c=r(9453),u=r(454),l=r(5657);function h(e){var t=new i;e||(e={});var o=t.stream=function(e){if(e.stream)return e.stream;var t=e.host,i=e.port,o=e.socket;if(o)return n.createConnection(o);if(i)return n.createConnection(i,t);var a=e.busAddress||process.env.DBUS_SESSION_BUS_ADDRESS;if(!a)throw new Error("unknown bus address");for(var s=a.split(";"),c=0;c{const i=r(2861).Buffer;t.M=function(e,t){var r=t-e._offset%t;if(0!==r&&r!==t){var n=i.alloc(r);e.put(i.from(n)),e._offset+=r}}},454:(e,t,r)=>{const i=r(4434).EventEmitter,n=r(1145),o=r(8894),a=r(5769).introspectBus;e.exports=function e(t,r){if(!(this instanceof e))return new e(t);r||(r={});var s=this;function c(e,t){this.name=e,this.service=t,this.as=function(e){return this.proxy[e]}}function u(e,t){this.name=e,this.bus=t,this.getObject=function(e,t){if(void 0===e)return t(new Error("Object name is null or undefined"));var r=new c(e,this);a(r,(function(e,i,n){if(e)return t(e);r.proxy=i,r.nodes=n,t(null,r)}))},this.getInterface=function(e,t,r){this.getObject(e,(function(e,i){if(e)return r(e);r(null,i.as(t))}))}}this.connection=t,this.serial=1,this.cookies={},this.methodCallHandlers={},this.signals=new i,this.exportedObjects={},this.invoke=function(e,t){e.type||(e.type=n.messageType.methodCall),e.serial=s.serial++,this.cookies[e.serial]=t,s.connection.message(e)},this.invokeDbus=function(e,t){e.path||(e.path="/org/freedesktop/DBus"),e.destination||(e.destination="org.freedesktop.DBus"),e.interface||(e.interface="org.freedesktop.DBus"),s.invoke(e,t)},this.mangle=function(e,t,r){var i={};return"object"==typeof e?(i.path=e.path,i.interface=e.interface,i.member=e.member):(i.path=e,i.interface=t,i.member=r),JSON.stringify(i)},this.sendSignal=function(e,t,r,i,o){var a={type:n.messageType.signal,serial:s.serial++,interface:t,path:e,member:r};i&&(a.signature=i,a.body=o),s.connection.message(a)},this.sendError=function(e,t,r){var i={type:n.messageType.error,serial:s.serial++,replySerial:e.serial,destination:e.sender,errorName:t,signature:"s",body:[r]};this.connection.message(i)},this.sendReply=function(e,t,r){var i={type:n.messageType.methodReturn,serial:s.serial++,replySerial:e.serial,destination:e.sender,signature:t,body:r};this.connection.message(i)},this.connection.on("message",(function(e){function t(t,r,i){Promise.resolve().then((function(){return r.apply(t,(e.body||[]).concat(e))})).then((function(t){var r={type:n.messageType.methodReturn,serial:s.serial++,destination:e.sender,replySerial:e.serial};null!==t&&(r.signature=i,r.body=[t]),s.connection.message(r)}),(function(t){s.sendError(e,t.dbusName||"org.freedesktop.DBus.Error.Failed",t.message||"")}))}var r;if(e.type===n.messageType.methodReturn||e.type===n.messageType.error){if(r=s.cookies[e.replySerial]){delete s.cookies[e.replySerial];var i={connection:s.connection,bus:s,message:e,signature:e.signature},a=e.body||[];e.type===n.messageType.methodReturn?(a=[null].concat(a),r.apply(i,a)):r.call(i,{name:e.errorName,message:a})}}else if(e.type===n.messageType.signal)s.signals.emit(s.mangle(e),e.body,e.signature);else{if(o(e,s))return;var c,u,l;if(c=s.exportedObjects[e.path]){if(u=c[e.interface]){var h=(l=u[1])[e.member];return h?void t(l,h,u[0].methods[e.member][1]):void s.sendError(e,"org.freedesktop.DBus.Error.UnknownMethod",`Method "${e.member}" on interface "${e.interface}" doesn't exist`)}console.error(`Interface ${e.interface} is not supported`)}(r=s.methodCallHandlers[s.mangle(e)])?t(null,r[0],r[1]):s.sendError(e,"org.freedesktop.DBus.Error.UnknownService","Uh oh oh")}})),this.setMethodCallHandler=function(e,t,r,i){var n=s.mangle(e,t,r);s.methodCallHandlers[n]=i},this.exportInterface=function(e,t,r){if((s.exportedObjects[t]?s.exportedObjects[t]:s.exportedObjects[t]={})[r.name]=[r,e],"function"==typeof e.emit){var i=e.emit;e.emit=function(){var o,a=Array.prototype.slice.apply(arguments),c=a[0];if(!c)throw new Error("Trying to emit undefined signa");if(r.signals&&r.signals[c]){o=r.signals[c];var u={type:n.messageType.signal,serial:s.serial++,interface:r.name,path:t,member:c};o[0]&&(u.signature=o[0],u.body=a.slice(1)),s.connection.message(u),s.serial++}i.apply(e,a)}}},!0!==r.direct?this.invokeDbus({member:"Hello"},(function(e,t){if(e)throw new Error(e);s.name=t})):s.name=null,this.getService=function(e){return new u(e,this)},this.getObject=function(e,t,r){return this.getService(e).getObject(t,r)},this.getInterface=function(e,t,r,i){return this.getObject(e,t,(function(e,t){if(e)return i(e);i(null,t.as(r))}))},this.addMatch=function(e,t){this.invokeDbus({member:"AddMatch",signature:"s",body:[e]},t)},this.removeMatch=function(e,t){this.invokeDbus({member:"RemoveMatch",signature:"s",body:[e]},t)},this.getId=function(e){this.invokeDbus({member:"GetId"},e)},this.requestName=function(e,t,r){this.invokeDbus({member:"RequestName",signature:"su",body:[e,t]},(function(e,t){r&&r(e,t)}))},this.releaseName=function(e,t){this.invokeDbus({member:"ReleaseName",signature:"s",body:[e]},t)},this.listNames=function(e){this.invokeDbus({member:"ListNames"},e)},this.listActivatableNames=function(e){this.invokeDbus({member:"ListActivatableNames"},e)},this.updateActivationEnvironment=function(e,t){this.invokeDbus({member:"UpdateActivationEnvironment",signature:"a{ss}",body:[e]},t)},this.startServiceByName=function(e,t,r){this.invokeDbus({member:"StartServiceByName",signature:"su",body:[e,t]},r)},this.getConnectionUnixUser=function(e,t){this.invokeDbus({member:"GetConnectionUnixUser",signature:"s",body:[e]},t)},this.getConnectionUnixProcessId=function(e,t){this.invokeDbus({member:"GetConnectionUnixProcessID",signature:"s",body:[e]},t)},this.getNameOwner=function(e,t){this.invokeDbus({member:"GetNameOwner",signature:"s",body:[e]},t)},this.nameHasOwner=function(e,t){this.invokeDbus({member:"NameHasOwner",signature:"s",body:[e]},t)}}},1145:e=>{e.exports={messageType:{invalid:0,methodCall:1,methodReturn:2,error:3,signal:4},headerTypeName:[null,"path","interface","member","errorName","replySerial","destination","sender","signature"],fieldSignature:{path:"o",interface:"s",member:"s",errorName:"s",replySerial:"u",destination:"s",sender:"s",signature:"g"},headerTypeId:{path:1,interface:2,member:3,errorName:4,replySerial:5,destination:6,sender:7,signature:8},protocolVersion:1,flags:{noReplyExpected:1,noAutoStart:2},endianness:{le:108,be:66},messageSignature:"yyyyuua(yv)",defaultAuthMethods:["EXTERNAL","DBUS_COOKIE_SHA1","ANONYMOUS"]}},191:(e,t,r)=>{const i=r(6094),n=r(5970);function o(e,t,r){"object"!=typeof r?r={ayBuffer:!0,ReturnLongjs:!1}:void 0===r.ayBuffer&&(r.ayBuffer=!0),this.options=r,this.buffer=e,this.startPos=t||0,this.pos=0}o.prototype.align=function(e){var t=(1<>e<{const i=r(2861).Buffer,n=r(6982),o=r(9896),a=r(6928),s=r(1145),c=r(4888);function u(e,t,r){var i=a.join(process.env[process.platform.match(/$win/)?"USERPROFILE":"HOME"],".dbus-keyrings");0===e.length&&(e="org_freedesktop_general");var n=a.join(i,e);o.stat(i,(function(e,i){return e?r(e):18&i.mode?r(new Error("User keyrings directory is writeable by other users. Aborting authentication")):process.hasOwnProperty("getuid")&&i.uid!==process.getuid()?r(new Error("Keyrings directory is not owned by the current user. Aborting authentication!")):void o.readFile(n,"ascii",(function(e,i){if(e)return r(e);for(var n=i.split("\n"),o=0;o{const i=r(8805);function n(e,t){this.$parent=e,this.$name=t,this.$methods={},this.$properties={},this.$callbacks=[],this.$sigHandlers=[]}function o(e,t,r){return`type='signal',path='${e}',interface='${t}',member='${r}'`}e.exports.introspectBus=function(t,r){t.service.bus.invoke({destination:t.service.name,path:t.name,interface:"org.freedesktop.DBus.Introspectable",member:"Introspect"},(function(i,n){e.exports.processXML(i,n,t,r)}))},e.exports.processXML=function(t,r,o,a){if(t)return a(t);(new i.Parser).parseString(r,(function(t,r){if(t)return a(t);if(!r.node)throw new Error("No root XML node");if(!(r=r.node).interface){if(r.node&&r.node.length>0&&r.node[0].$){var i=Object.assign(o,{});return"/"!==i.name.slice(-1)&&(i.name+="/"),i.name+=r.node[0].$.name,e.exports.introspectBus(i,a)}return a(new Error("No such interface found"))}for(var s,c,u,l,h,d,p,f={},g=[],m=r.interface,v=r.node||[],y=1;yt=>this.$readProp(e,t),set:function(t){this.$writeProp(e,t)}})},n.prototype.$readProp=function(e,t){this.$parent.service.bus.invoke({destination:this.$parent.service.name,path:this.$parent.name,interface:"org.freedesktop.DBus.Properties",member:"Get",signature:"ss",body:[this.$name,e]},(function(e,r){e?t(e):1===r[0].length?t(e,r[1][0]):t(e,r[1])}))},n.prototype.$writeProp=function(e,t){this.$parent.service.bus.invoke({destination:this.$parent.service.name,path:this.$parent.name,interface:"org.freedesktop.DBus.Properties",member:"Set",signature:"ssv",body:[this.$name,e,[this.$properties[e].type,t]]})}},5068:(e,t,r)=>{const i=r(2613),n=r(5970),o=r(7019),a=r(7030),s=r(3597).M;function c(e,t,r){if(t.length!==r.length)throw new Error("Invalid struct data");for(var i=0;i{const i=r(2861).Buffer,n=r(3597).M,o=r(5970),a=r(6094);t.MakeSimpleMarshaller=function(e){var t={};function r(e){if("string"!=typeof e)throw new Error(`Data: ${e} was not of type string`);if(-1!==e.indexOf("\0"))throw new Error("String contains null byte")}switch(e){case"o":case"s":t.check=function(e){r(e)},t.marshall=function(e,t){this.check(t),n(e,4);const r=i.from(t,"utf8");e.word32le(r.length).put(r).word8(0),e._offset+=5+r.length};break;case"g":t.check=function(e){r(e),function(e){if(e.length>255)throw new Error(`Data: ${e} is too long for signature type (${e.length} > 255)`);for(var t=0,r=0;r32)throw new Error(`Maximum container type nesting exceeded in signature type:${e}`);switch(e[r]){case"(":++t;break;case")":--t}}o(e)}(e)},t.marshall=function(e,t){this.check(t);const r=i.from(t,"ascii");e.word8(t.length).put(r).word8(0),e._offset+=2+r.length};break;case"y":t.check=function(e){c(e),s(0,255,e)},t.marshall=function(e,t){this.check(t),e.word8(t),e._offset++};break;case"b":t.check=function(e){u(e)},t.marshall=function(e,t){this.check(t),t=t?1:0,n(e,4),e.word32le(t),e._offset+=4};break;case"n":t.check=function(e){c(e),s(-32768,32767,e)},t.marshall=function(e,t){this.check(t),n(e,2);const r=i.alloc(2);r.writeInt16LE(parseInt(t),0),e.put(r),e._offset+=2};break;case"q":t.check=function(e){c(e),s(0,65535,e)},t.marshall=function(e,t){this.check(t),n(e,2),e.word16le(t),e._offset+=2};break;case"i":t.check=function(e){c(e),s(-2147483648,2147483647,e)},t.marshall=function(e,t){this.check(t),n(e,4);const r=i.alloc(4);r.writeInt32LE(parseInt(t),0),e.put(r),e._offset+=4};break;case"u":t.check=function(e){c(e),s(0,4294967295,e)},t.marshall=function(e,t){this.check(t),n(e,4),e.word32le(t),e._offset+=4};break;case"t":t.check=function(e){return l(e,!1)},t.marshall=function(e,t){t=this.check(t),n(e,8),e.word32le(t.low),e.word32le(t.high),e._offset+=8};break;case"x":t.check=function(e){return l(e,!0)},t.marshall=function(e,t){t=this.check(t),n(e,8),e.word32le(t.low),e.word32le(t.high),e._offset+=8};break;case"d":t.check=function(e){if("number"!=typeof e)throw new Error(`Data: ${e} was not of type number`);if(Number.isNaN(e))throw new Error(`Data: ${e} was not a number`);if(!Number.isFinite(e))throw new Error("Number outside range")},t.marshall=function(e,t){this.check(t),n(e,8);const r=i.alloc(8);r.writeDoubleLE(parseFloat(t),0),e.put(r),e._offset+=8};break;default:throw new Error(`Unknown data type format: ${e}`)}return t};var s=function(e,t,r){if(r>t||r{const i=r(2861).Buffer,n=r(5068),o=r(1145),a=r(191),s=r(5783);e.exports.unmarshalMessages=function(e,t,r){var i,n,c,u,l=0,h=0,d=0;e.on("readable",(function(){for(;;)if(0===l){if(!(i=e.read(16)))break;l=1,c=i.readUInt32LE(12),u=c+7>>3<<3,d=i.readUInt32LE(4),h=u+d}else{if(!(n=e.read(h)))break;l=0;var p=new a(n,void 0,r),f=p.readArray(s[0].child[0],c);p.align(3);var g={};g.serial=i.readUInt32LE(8);for(var m=0;m0&&g.signature&&(g.body=p.read(g.signature)),t(g)}}))},e.exports.unmarshall=function(e,t){for(var r=new a(e,void 0,t),i=r.read("yyyyuua(yv)"),n={},s=0;s>3<<3,p=d+s,f=i.alloc(p);return u.copy(f),h.copy(f,u.length),s>0&&t.copy(f,d),f}},4888:(e,t,r)=>{const i=r(2861).Buffer;e.exports=function(e,t){var r=[];e.on("readable",(function n(){for(;;){var o=e.read(1);if(!o)return;var a=o[0];if(10===a){try{t(i.from(r))}catch(t){e.emit("error",t)}return void e.removeListener("readable",n)}r.push(a)}}))}},9453:(e,t,r)=>{const i=r(2861).Buffer,n=r(4888);e.exports=function(e,t,r){e.name="SERVER SERVER",n(e,(function(t){console.log(["hello string: ",t.toString(),t]),e.write("REJECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS\r\n"),n(e,(function(){e.write(`DATA ${i.from("org_freedesktop_general 642038150 b9ce247a275f427c8586e4c9de9bb951").toString("hex")}\r\n`),n(e,(function(){e.write("OK 6f72675f667265656465736b746f705f67656e6572616c20353631303331333937206239636532343761323735663432376338353836653463396465396262393531\r\n"),n(e,(function(e){console.log(["AFTER begin: ",e.toString()]),r(null)}))}))}))}))}},5657:(e,t,r)=>{const i=r(9640),n=r(9278);e.exports.createServer=function(e){return new function(){var t=123;this.server=n.createServer((function(r){r.idd=t,t++;var n=i.createConnection({stream:r,server:!0});e&&e(n)})),this.listen=this.server.listen.bind(this.server)}}},5970:e=>{var t={"{":"}","(":")"},r={};"(){}ybnqiuxtdsogarvehm*?@&^".split("").forEach((function(e){r[e]=!0})),e.exports=function(e){var i=0;function n(){if(i{const i=r(1145),n=r(5970);var o;function a(e){var t=[],r=function(e,r,i){e&&n(e).forEach((function(e,n){var o=r?r[n]:i+n,a="signal"===i?"":`" direction="${i}`;t.push(` `)}))};if(t.push(` `),e.methods)for(var i in e.methods){var o=e.methods[i];t.push(` `),r(o[0],o[2],"in"),r(o[1],o[3],"out"),t.push(" ")}if(e.signals)for(var a in e.signals){var c=e.signals[a];t.push(` `),r(c[0],c.slice(1),"signal"),t.push(" ")}if(e.properties)for(const r in e.properties)t.push(` `);return t.push(" "),t.join("\n")}function s(e){var t=[];return e.forEach((function(e){t.push(e.type+s(e.child)),"{"===e.type&&t.push("}"),"("===e.type&&t.push(")")})),t.join("")}e.exports=function(e,t){if("org.freedesktop.DBus.Introspectable"===e.interface&&"Introspect"===e.member){"/"===e.path&&(e.path="");var r=[''],n={};for(var s in t.exportedObjects)if(0===s.indexOf(e.path)){var c=t.exportedObjects[e.path];if(c)n[e.path]=c;else{if("/"!==s[e.path.length])continue;n[s.substr(e.path.length).split("/")[1]]=null}}var u=Object.keys(n).length;if(0===u)r.push("");else if(1===u){var l=n[Object.keys(n)[0]];if(l){for(var h in r.push(""),l)r.push(a(l[h][0]));r.push(o),r.push("")}else r.push(`\n \n `)}else{for(var d in r.push(""),n)if(null===n[d])r.push(` `);else{for(var p in l=n[d],r.push(` `),l)r.push(a(l[p][0]));r.push(o),r.push(" ")}r.push("")}const f={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender,signature:"s",body:[r.join("\n")]};return t.connection.message(f),1}if("org.freedesktop.DBus.Properties"===e.interface){var f=e.body[0],g=t.exportedObjects[e.path];if(!g||!g[f])return t.sendError(e,"org.freedesktop.DBus.Error.UnknownMethod","Uh oh oh"),1;var m=g[f][1];const r={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender};if("Get"===e.member||"Set"===e.member){var v=e.body[1],y=g[f][0].properties[v];if("Get"===e.member){var C=m[v];r.signature="v",r.body=[[y,C]]}else m[v]=1234}else if("GetAll"===e.member){r.signature="a{sv}";var S=[];for(var E in g[f][0].properties){var _=g[f][0].properties[E];S.push([E,[_,m[E]]])}r.body=[S]}return t.connection.message(r),1}if("org.freedesktop.DBus.Peer"===e.interface){const r={type:i.messageType.methodReturn,serial:t.serial++,replySerial:e.serial,destination:e.sender};return"Ping"===e.member||"GetMachineId"===e.member&&(r.signature="s",r.body=["This is a machine id. TODO: implement"]),t.connection.message(r),1}return 0},o=' \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '},7019:(e,t,r)=>{const i=r(2613);e.exports=function e(){if(!(this instanceof e))return new e;var t=[],r=0;this.put=function(e){return t.push({buffer:e}),r+=e.length,this},this.word8=function(e){return t.push({bytes:1,value:e}),r+=1,this},this.floatle=function(e){return t.push({bytes:"float",endian:"little",value:e}),r+=4,this},[8,16,24,32,64].forEach(function(e){this["word"+e+"be"]=function(i){return t.push({endian:"big",bytes:e/8,value:i}),r+=e/8,this},this["word"+e+"le"]=function(i){return t.push({endian:"little",bytes:e/8,value:i}),r+=e/8,this}}.bind(this)),this.pad=function(e){return i(Number.isInteger(e),"pad(bytes) must be supplied with an integer!"),t.push({endian:"big",bytes:e,value:0}),r+=e,this},this.length=function(){return r},this.buffer=function(){var e=Buffer.alloc(r),i=0;return t.forEach((function(t){if(t.buffer)t.buffer.copy(e,i,0),i+=t.buffer.length;else if("float"===t.bytes){var r=Math.abs(t.value),n=1*(t.value>=0),o=Math.ceil(Math.log(r)/Math.LN2),a=r/(1<=0:u<8*t.bytes;u+=c[1])e[i++]=u>=32?255&Math.floor(t.value/Math.pow(2,u)):t.value>>u&255})),e},this.write=function(e){e.write(this.buffer())}}},9511:(e,t,r)=>{"use strict";var i=r(8075)("ArrayBuffer.prototype.byteLength",!0),n=r(4670);e.exports=function(e){return n(e)?i?i(e):e.byteLength:NaN}},804:(e,t,r)=>{"use strict";function i(e){var t=[];return n(e,t),t}function n(e,t){for(var r=0;ri})},8404:(e,t,r)=>{"use strict";const i=r(4033),n=r(8525),o=r(4060);function a(e){if(!(this instanceof a))return new a(e);this._server=new n(e),this._registry=new i(this._server)}a.prototype={publish:function(e){return this._registry.publish(e)},unpublishAll:function(e){this._registry.unpublishAll(e)},find:function(e,t){return new o(this._server.mdns,e,t)},findOne:function(e,t){const r=new o(this._server.mdns,e);return r.once("up",(function(e){r.stop(),t&&t(e)})),r},destroy:function(){this._registry.destroy(),this._server.mdns.destroy()}},e.exports=a},4060:(e,t,r)=>{"use strict";const i=r(9023),n=r(4434).EventEmitter,o=r(2781),a=r(6917),s=r(3272),c=".local",u="_services._dns-sd._udp"+c;function l(e,t,r){if("function"==typeof t)return new l(e,null,t);n.call(this),this._mdns=e,this._onresponse=null,this._serviceMap={},this._txt=s(t.txt),t&&t.type?(this._name=o.stringify(t.type,t.protocol||"tcp")+c,t.name&&(this._name=t.name+"."+this._name),this._wildcard=!1):(this._name=u,this._wildcard=!0),this.services=[],r&&this.on("up",r),this.start()}e.exports=l,i.inherits(l,n),l.prototype.start=function(){if(this._onresponse)return;const e=this,t={};this._wildcard||(t[this._name]=!0),this._onresponse=function(r,i){e._wildcard&&r.answers.forEach((function(r){"PTR"!==r.type||r.name!==e._name||r.name in t||(t[r.data]=!0,e._mdns.query(r.data,"PTR"))})),Object.keys(t).forEach((function(t){(function(e,t){return t.answers.concat(t.additionals).filter((function(t){return"PTR"===t.type&&0===t.ttl&&a(t.name,e)})).map((function(e){return e.data}))})(t,r).forEach(e._removeService.bind(e));const n=function(e,t,r,i){const n=t.answers.concat(t.additionals).filter((function(e){return e.ttl>0}));return n.filter((function(t){return"PTR"===t.type&&a(t.name,e)})).map((function(e){const t={addresses:[]};if(n.filter((function(t){return("SRV"===t.type||"TXT"===t.type)&&a(t.name,e.data)})).forEach((function(e){if("SRV"===e.type){const r=e.name.split("."),n=r[0],a=o.parse(r.slice(1,-1).join("."));t.name=n,t.fqdn=e.name,t.host=e.data.target,t.referer=i,t.port=e.data.port,t.type=a.name,t.protocol=a.protocol,t.subtypes=a.subtypes}else"TXT"===e.type&&(t.rawTxt=e.data,t.txt=r.decodeBlocks(t.rawTxt))})),t.name)return n.filter((function(e){return("A"===e.type||"AAAA"===e.type)&&a(e.name,t.host)})).forEach((function(e){t.addresses.push(e.data)})),t})).filter((function(e){return!!e}))}(t,r,e._txt,i);0!==n.length&&n.forEach((function(t){e._serviceMap[t.fqdn]?e._updateService(t):e._addService(t)}))}))},this._mdns.on("response",this._onresponse),this.update()},l.prototype.stop=function(){this._onresponse&&(this._mdns.removeListener("response",this._onresponse),this._onresponse=null)},l.prototype.update=function(){this._mdns.query(this._name,"PTR")},l.prototype._addService=function(e){this.services.push(e),this._serviceMap[e.fqdn]=!0,this.emit("up",e)},l.prototype._updateService=function(e){let t,r;this.services.some((function(i,n){return!!a(i.fqdn,e.fqdn)&&(t=i,r=n,!0)})),t&&(this.services[r]=e,this.emit("update",e))},l.prototype._removeService=function(e){let t,r;this.services.some((function(i,n){return!!a(i.fqdn,e)&&(t=i,r=n,!0)})),t&&(this.services.splice(r,1),delete this._serviceMap[e],this.emit("down",t))}},2754:(e,t,r)=>{"use strict";const i=r(6917),n=function(e,t,r){this.sent=!1,this.retries=0,this.timer=null,this.cb=r,this.mdns=e,this.service=t,this.bound=this.onMDNSresponse.bind(this),this.matchRRBound=this.matchRR.bind(this)};n.prototype={start:function(){this.mdns.on("response",this.bound),setTimeout(this.try.bind(this),250*Math.random())},try:function(){this.service._activated&&!this.service._destroyed&&this.mdns.query(this.service.fqdn,"ANY",function(){this.sent=!0,this.timer=setTimeout(++this.retries<3?this.try.bind(this):this.done.bind(this,!1),250),this.timer.unref()}.bind(this))},matchRR:function(e){return i(e.name,this.service.fqdn)},onMDNSresponse:function(e){this.sent&&(e.answers.some(this.matchRRBound)||e.additionals.some(this.matchRRBound))&&this.done(!0)},done:function(e){this.mdns.removeListener("response",this.bound),clearTimeout(this.timer),this.cb(e)}},e.exports=n},4033:(e,t,r)=>{"use strict";const i=r(804).B,n=r(5259),o=r(2754),a=function(e){this._server=e,this._services=[]};a.prototype={publish:function(e){const t=new n(e=e||{});return t.on("service-publish",this._onServicePublish.bind(this)),t.on("service-unpublish",this._onServiceUnpublish.bind(this)),t.on("service-announce-request",this._onAnnounceRequest.bind(this)),t.on("service-packet-change",this._onServiceChange.bind(this)),t.start(),t},unpublishAll:function(e){this._tearDown(this._services,e),this._services=[]},destroy:function(){for(let e=0;e{"use strict";const i=r(2567),n=r(6917),o=r(804).B,a=r(3805),s=function(e){this.mdns=i(e),this.mdns.setMaxListeners(0),this.registry={},this.mdns.on("query",this._respondToQuery.bind(this))};s.prototype={_respondToQuery:function(e){for(let t=0;t{"PTR"===e.type&&(c=c.concat(this._recordsFor(e.data,"SRV")).concat(this._recordsFor(e.data,"TXT")))})),c.filter((e=>"SRV"===e.type)).map((e=>e.data.target)).filter(a.unique()).forEach((e=>{c=c.concat(this._recordsFor(e,"A")).concat(this._recordsFor(e,"AAAA"))}))),this.mdns.respond({answers:s,additionals:c},(e=>{if(e)throw e}))}},register:function(e){Array.isArray(e)||(e=[e]);for(let t=0;te.name!==r.name)))}},_recordsFor:function(e,t){return t in this.registry?this.registry[t].filter((t=>{const r=~e.indexOf(".")?t.name:t.name.split(".")[0];return n(r,e)})):[]}},e.exports=s},5259:(e,t,r)=>{"use strict";const i=r(857),n=r(9023),o=r(9278),a=r(2613),s=r(4434).EventEmitter,c=r(2781),u=r(6480),l=".local",h=function(e){if(!e.name)throw new Error("Required name not given");if(!e.type)throw new Error("Required type not given");if(!e.port)throw new Error("Required port not given");if(this.name=e.name,this.protocol=e.protocol||"tcp",this.probe=!1!==e.probe,this.type=c.stringify(e.type,this.protocol),this.host=e.host||i.hostname(),this.port=e.port,this.fqdn=this.name+"."+this.type+l,this.subtypes=e.subtypes||null,this.txt=e.txt||null,this.published=!1,this.addUnsafeServiceEnumerationRecord=e.addUnsafeServiceEnumerationRecord||!1,this.restrictedAddresses=void 0,e.restrictedAddresses){a(e.restrictedAddresses.length,"The service property 'restrictedAddresses' cannot be an empty array!"),this.restrictedAddresses=new Map;for(const t of e.restrictedAddresses)if(o.isIP(t)){if("0.0.0.0"===t||"::"===t)throw new Error(`[${this.fqdn}] Unspecified ip address (${t}) cannot be used to restrict on to!`);const e=u.resolveInterface(t);if(!e)throw new Error(`[${this.fqdn}] Could not restrict service to address ${t} as we could not resolve it to an interface name!`);const r=this.restrictedAddresses.get(e);r?r.length&&!r.includes(t)&&r.push(t):this.restrictedAddresses.set(e,[t])}else this.restrictedAddresses.set(t,[])}this.disabledIpv6=e.disabledIpv6||!1,this._activated=!1};n.inherits(h,s);const d={start:function(){this._activated||(this._activated=!0,this.emit("service-publish",this))},stop:function(e){this._activated?this.emit("service-unpublish",this,e):e()},updateTxt:function(e,t){this.packet&&this.emit("service-packet-change",this.packet,this.onAnnounceComplete.bind(this)),this.packet=null,this.txt=e,this.published&&(this._unpublish(),this.announce(t))},announce:function(e){this._destroyed||(this.packet||(this.packet=this._records()),this.timer&&clearTimeout(this.timer),this.delay=1e3,this.emit("service-announce-request",this.packet,e||!1,this.onAnnounceComplete.bind(this)))},onAnnounceComplete:function(){this.published||(this._activated=!0,this.published=!0,this.emit("up")),this.delay=3*this.delay,this.delay<36e5&&!this._destroyed&&this._activated?this.timer=setTimeout(this.announce.bind(this),this.delay).unref():(this.timer=void 0,this.delay=void 0)},deactivate:function(){this._unpublish(),this._activated=!1},destroy:function(){this._unpublish(),this.removeAllListeners(),this._destroyed=!0},_unpublish:function(){this.timer&&clearTimeout(this.timer),this.published=!1},_records:function(e){const t=[this._rrPtr(),this._rrSrv(),this._rrTxt()];return t.push(...this._addressRecords()),!e&&this.addUnsafeServiceEnumerationRecord&&t.push(this._rrMetaPtr()),t},_addressRecords:function(){const e=[],t=[];return Object.entries(i.networkInterfaces()).forEach((([r,i])=>{let n=this.restrictedAddresses?this.restrictedAddresses.get(r):void 0;this.restrictedAddresses&&!n||(n&&0===n.length&&(n=void 0),i.forEach((r=>{r.internal||t.includes(r.address)||n&&n.includes(r.address)||("IPv4"===r.family?(e.push(this._rrA(r.address)),t.push(r.address)):this.disabledIpv6||(e.push(this._rrAaaa(r.address)),t.push(r.address)))})))})),e},_rrMetaPtr:function(){return{name:"_services._dns-sd._udp.local",type:"PTR",ttl:4500,data:this.type+l}},_rrPtr:function(){return{name:this.type+l,type:"PTR",ttl:4500,data:this.fqdn}},_rrSrv:function(){return{name:this.fqdn,type:"SRV",ttl:120,flush:!0,data:{port:this.port,target:this.host}}},_rrTxt:function(){const e=[];if(this.txt){const t=this.txt;Object.keys(t).forEach((r=>{const i=t[r];e.push(r+"="+i)}))}return{name:this.fqdn,type:"TXT",ttl:4500,flush:!0,data:e}},_rrA:function(e){return{name:this.host,type:"A",ttl:120,flush:!0,data:e}},_rrAaaa:function(e){return{name:this.host,type:"AAAA",ttl:120,flush:!0,data:e}}};for(const e in d)h.prototype[e]=d[e];e.exports=h},3805:(e,t,r)=>{const i=r(4982);e.exports={isDuplicateRecord:function(e){return function(t){return e.type===t.type&&e.name===t.name&&i(e.data,t.data)}},unique:function(){const e=[];return function(t){return!~e.indexOf(t)&&(e.push(t),!0)}}}},6917:e=>{"use strict";const t=/[A-Z]/g;function r(e){return e.toLowerCase()}e.exports=function(e,i){return(e=e.replace(t,r))===(i=i.replace(t,r))}},6480:(e,t,r)=>{const i=r(857);e.exports={resolveInterface:function(e){for(const[t,r]of Object.entries(i.networkInterfaces()))for(const i of r)if(i.address===e)return t}}},3272:e=>{"use strict";const t=Buffer.from("=");e.exports=function(e){const r=!!e&&e.binary,i={decodeBlocks:function(e){const i={};return e.forEach((e=>{if(0===e.length)return;const n=e.indexOf(t);if(-1===n)i[e.toString().toLowerCase()]=!0;else if(n>0){const t=e.slice(0,n).toString().toLowerCase();if(t in i)return;const o=e.slice(n+1);i[t]=r?o:o.toString()}})),i}};return i}},2746:e=>{var t=Object.prototype.toString,r="undefined"!=typeof Buffer&&"function"==typeof Buffer.alloc&&"function"==typeof Buffer.allocUnsafe&&"function"==typeof Buffer.from;e.exports=function(e,i,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return o=e,"ArrayBuffer"===t.call(o).slice(8,-1)?function(e,t,i){t>>>=0;var n=e.byteLength-t;if(n<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=n;else if((i>>>=0)>n)throw new RangeError("'length' is out of bounds");return r?Buffer.from(e.slice(t,t+i)):new Buffer(new Uint8Array(e.slice(t,t+i)))}(e,i,n):"string"==typeof e?function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return r?Buffer.from(e,t):new Buffer(e,t)}(e,i):r?Buffer.from(e):new Buffer(e);var o}},8075:(e,t,r)=>{"use strict";var i=r(453),n=r(487),o=n(i("String.prototype.indexOf"));e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},487:(e,t,r)=>{"use strict";var i=r(6743),n=r(453),o=r(6897),a=r(9675),s=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||i.call(c,s),l=r(655),h=n("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(i,c,arguments);return o(t,1+h(0,e.length-(arguments.length-1)),!0)};var d=function(){return u(i,s,arguments)};l?l(e.exports,"apply",{value:d}):e.exports.apply=d},7833:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(736)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},736:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,a=null;function s(...e){if(!s.enabled)return;const i=s,n=Number(new Date),o=n-(r||n);i.diff=o,i.prev=r,i.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";a++;const o=t.formatters[n];if("function"==typeof o){const t=e[a];r=o.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=i,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function i(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r(7833):e.exports=r(6033)},6033:(e,t,r)=>{const i=r(2018),n=r(9023);t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let i=0;i{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=r(7687);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let i=process.env[t];return i=!!/^(yes|on|true|enabled)$/i.test(i)||!/^(no|off|false|disabled)$/i.test(i)&&("null"===i?null:Number(i)),e[r]=i,e}),{}),e.exports=r(736)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)}},4982:(e,t,r)=>{"use strict";var i=r(6525),n=r(8075),o=r(1589),a=r(453),s=r(1158),c=r(920),u=r(7653),l=r(7244),h=r(4634),d=r(4670),p=r(2120),f=r(4035),g=r(7070),m=r(1189),v=r(1539),y=r(593),C=r(5767),S=r(9511),E=n("SharedArrayBuffer.prototype.byteLength",!0),_=n("Date.prototype.getTime"),T=Object.getPrototypeOf,A=n("Object.prototype.toString"),I=a("%Set%",!0),D=n("Map.prototype.has",!0),w=n("Map.prototype.get",!0),b=n("Map.prototype.size",!0),U=n("Set.prototype.add",!0),R=n("Set.prototype.delete",!0),O=n("Set.prototype.has",!0),N=n("Set.prototype.size",!0);function P(e,t,r,i){for(var n,o=s(e);(n=o.next())&&!n.done;)if(F(t,n.value,r,i))return R(e,n.value),!0;return!1}function B(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function L(e,t,r,n,o,a){var s=B(r);if(null!=s)return s;var c=w(t,s),u=i({},o,{strict:!1});return!(void 0===c&&!D(t,s)||!F(n,c,u,a))&&(!D(e,s)&&F(n,c,u,a))}function x(e,t,r){var i=B(r);return null!=i?i:O(t,i)&&!O(e,i)}function M(e,t,r,i,n,o){for(var a,c,u=s(e);(a=u.next())&&!a.done;)if(F(r,c=a.value,n,o)&&F(i,w(t,c),n,o))return R(e,c),!0;return!1}function F(e,t,r,n){var a=r||{};if(a.strict?u(e,t):e===t)return!0;if(v(e)!==v(t))return!1;if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return a.strict?u(e,t):e==t;var c,R=n.has(e),B=n.has(t);if(R&&B){if(n.get(e)===n.get(t))return!0}else c={};return R||n.set(e,c),B||n.set(t,c),function(e,t,r,n){var a,c;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(A(e)!==A(t))return!1;if(l(e)!==l(t))return!1;var u=h(e),v=h(t);if(u!==v)return!1;var R=e instanceof Error,B=t instanceof Error;if(R!==B)return!1;if((R||B)&&(e.name!==t.name||e.message!==t.message))return!1;var V=f(e),H=f(t);if(V!==H)return!1;if((V||H)&&(e.source!==t.source||o(e)!==o(t)))return!1;var j=p(e),G=p(t);if(j!==G)return!1;if((j||G)&&_(e)!==_(t))return!1;if(r.strict&&T&&T(e)!==T(t))return!1;var W=C(e),Y=C(t);if(W!==Y)return!1;if(W||Y){if(e.length!==t.length)return!1;for(a=0;a=0;a--)if(J[a]!=Z[a])return!1;for(a=J.length-1;a>=0;a--)if(!F(e[c=J[a]],t[c],r,n))return!1;var ee=y(e),te=y(t);if(ee!==te)return!1;if("Set"===ee||"Set"===te)return function(e,t,r,i){if(N(e)!==N(t))return!1;var n,o,a,c=s(e),u=s(t);for(;(n=c.next())&&!n.done;)if(n.value&&"object"==typeof n.value)a||(a=new I),U(a,n.value);else if(!O(t,n.value)){if(r.strict)return!1;if(!x(e,t,n.value))return!1;a||(a=new I),U(a,n.value)}if(a){for(;(o=u.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!P(a,o.value,r.strict,i))return!1}else if(!r.strict&&!O(e,o.value)&&!P(a,o.value,r.strict,i))return!1;return 0===N(a)}return!0}(e,t,r,n);if("Map"===ee)return function(e,t,r,n){if(b(e)!==b(t))return!1;var o,a,c,u,l,h,d=s(e),p=s(t);for(;(o=d.next())&&!o.done;)if(u=o.value[0],l=o.value[1],u&&"object"==typeof u)c||(c=new I),U(c,u);else if(void 0===(h=w(t,u))&&!D(t,u)||!F(l,h,r,n)){if(r.strict)return!1;if(!L(e,t,u,l,r,n))return!1;c||(c=new I),U(c,u)}if(c){for(;(a=p.next())&&!a.done;)if(u=a.value[0],h=a.value[1],u&&"object"==typeof u){if(!M(c,e,u,h,r,n))return!1}else if(!(r.strict||e.has(u)&&F(w(e,u),h,r,n)||M(c,e,u,h,i({},r,{strict:!1}),n)))return!1;return 0===N(c)}return!0}(e,t,r,n);return!0}(e,t,a,n)}function k(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0&&"number"!=typeof e[0])&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))))}e.exports=function(e,t,r){return F(e,t,r,c())}},41:(e,t,r)=>{"use strict";var i=r(655),n=r(8068),o=r(9675),a=r(5795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],h=!!a&&a(e,t);if(i)i(e,t,{configurable:null===u&&h?h.configurable:!u,enumerable:null===s&&h?h.enumerable:!s,value:r,writable:null===c&&h?h.writable:!c});else{if(!l&&(s||c||u))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},8452:(e,t,r)=>{"use strict";var i=r(1189),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=r(41),c=r(592)(),u=function(e,t,r,i){if(t in e)if(!0===i){if(e[t]===r)return}else if("function"!=typeof(n=i)||"[object Function]"!==o.call(n)||!i())return;var n;c?s(e,t,r,!0):s(e,t,r)},l=function(e,t){var r=arguments.length>2?arguments[2]:{},o=i(t);n&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";t.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e},t.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}},3843:(e,t,r)=>{"use strict";const i=r(181).Buffer,n=r(834),o=r(2111),a=r(628),s=r(4731),c=r(5874),u=r(26),l=32768,h=t.name={};h.encode=function(e,t,r,{mail:n=!1}={}){t||(t=i.alloc(h.encodingLength(e))),r||(r=0);const o=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let e=[];if(n){let t="";a.split(".").forEach((r=>{r.endsWith("\\")?t+=(t.length?".":"")+r.slice(0,-1):0===e.length&&t.length?e.push(t+"."+r):e.push(r)}))}else e=a.split(".");for(let i=0;i=e.length)throw new Error("Cannot decode name (buffer overflow)");const c=e[t++];if(a+=s?0:1,0===c)break;if(192&c){if(192&~c)throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const r=e.readUInt16BE(t-1)-49152;if(r>=n)throw new Error("Cannot decode name (bad pointer)");t=r,n=r,a+=s?0:1,s=!0}}else{if(t+c>e.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=c+1,o>254)throw new Error("Cannot decode name (name too long)");let n=e.toString("utf-8",t,t+c);r&&(n=n.replace(/\./g,"\\.")),i.push(n),t+=c,a+=s?0:c}}return h.decode.bytes=a,0===i.length?".":i.join(".")},h.decode.bytes=0,h.encodingLength=function(e){return"."===e||".."===e?1:i.byteLength(e.replace(/^\.|\.$/gm,""))+2};const d={encode:function(e,t,r){t||(t=i.alloc(d.encodingLength(e))),r||(r=0);const n=t.write(e,r+1);return t[r]=n,d.encode.bytes=n+1,t}};d.encode.bytes=0,d.decode=function(e,t){t||(t=0);const r=e[t],i=e.toString("utf-8",t+1,t+1+r);return d.decode.bytes=r+1,i},d.decode.bytes=0,d.encodingLength=function(e){return i.byteLength(e)+1};const p={encode:function(e,t,r){t||(t=p.encodingLength(e)),r||(r=0);const i=32767&(e.flags||0),n="response"===e.type?32768:0;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(i|n,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t}};p.encode.bytes=12,p.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1==(r>>15&1),opcode:a.toString(r>>11&15),flag_aa:1==(r>>10&1),flag_tc:1==(r>>9&1),flag_rd:1==(r>>8&1),flag_ra:1==(r>>7&1),flag_z:1==(r>>6&1),flag_ad:1==(r>>5&1),flag_cd:1==(r>>4&1),rcode:o.toString(15&r),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}},p.decode.bytes=12,p.encodingLength=function(){return 12};const f=t.unknown={};f.encode=function(e,t,r){return t||(t=i.alloc(f.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),f.encode.bytes=e.length+2,t},f.encode.bytes=0,f.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),i=e.slice(t+2,t+2+r);return f.decode.bytes=r+2,i},f.decode.bytes=0,f.encodingLength=function(e){return e.length+2};const g=t.ns={};g.encode=function(e,t,r){return t||(t=i.alloc(g.encodingLength(e))),r||(r=0),h.encode(e,t,r+2),t.writeUInt16BE(h.encode.bytes,r),g.encode.bytes=h.encode.bytes+2,t},g.encode.bytes=0,g.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),i=h.decode(e,t+2);return g.decode.bytes=r+2,i},g.decode.bytes=0,g.encodingLength=function(e){return h.encodingLength(e)+2};const m=t.soa={};m.encode=function(e,t,r){t||(t=i.alloc(m.encodingLength(e))),r||(r=0);const n=r;return r+=2,h.encode(e.mname,t,r),r+=h.encode.bytes,h.encode(e.rname,t,r,{mail:!0}),r+=h.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),m.encode.bytes=r-n,t},m.encode.bytes=0,m.decode=function(e,t){t||(t=0);const r=t,i={};return t+=2,i.mname=h.decode(e,t),t+=h.decode.bytes,i.rname=h.decode(e,t,{mail:!0}),t+=h.decode.bytes,i.serial=e.readUInt32BE(t),t+=4,i.refresh=e.readUInt32BE(t),t+=4,i.retry=e.readUInt32BE(t),t+=4,i.expire=e.readUInt32BE(t),t+=4,i.minimum=e.readUInt32BE(t),t+=4,m.decode.bytes=t-r,i},m.decode.bytes=0,m.encodingLength=function(e){return 22+h.encodingLength(e.mname)+h.encodingLength(e.rname)};const v=t.txt={};v.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let t=0;t0;){const r=e[t++];if(--i,i0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let i=0;i0;)i[o++]=b.decode(e,t),t+=b.decode.bytes,n-=b.decode.bytes;return U.decode.bytes=t-r,i},U.decode.bytes=0,U.encodingLength=function(e){return 2+G(e||[],b)};const R=t.dnskey={};R.PROTOCOL_DNSSEC=3,R.ZONE_KEY=128,R.SECURE_ENTRYPOINT=32768,R.encode=function(e,t,r){t||(t=i.alloc(R.encodingLength(e))),r||(r=0);const n=r,o=e.key;if(!i.isBuffer(o))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(R.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,R.encode.bytes=r-n,t.writeUInt16BE(R.encode.bytes-2,n),t},R.encode.bytes=0,R.decode=function(e,t){t||(t=0);const r=t;var i={},n=e.readUInt16BE(t);if(t+=2,i.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==R.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,i.algorithm=e.readUInt8(t),t+=1,i.key=e.slice(t,r+n+2),t+=i.key.length,R.decode.bytes=t-r,i},R.decode.bytes=0,R.encodingLength=function(e){return 6+i.byteLength(e.key)};const O=t.rrsig={};O.encode=function(e,t,r){t||(t=i.alloc(O.encodingLength(e))),r||(r=0);const o=r,a=e.signature;if(!i.isBuffer(a))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(n.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,h.encode(e.signersName,t,r),r+=h.encode.bytes,a.copy(t,r,0,a.length),r+=a.length,O.encode.bytes=r-o,t.writeUInt16BE(O.encode.bytes-2,o),t},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const r=t;var i={},o=e.readUInt16BE(t);return t+=2,i.typeCovered=n.toString(e.readUInt16BE(t)),t+=2,i.algorithm=e.readUInt8(t),t+=1,i.labels=e.readUInt8(t),t+=1,i.originalTTL=e.readUInt32BE(t),t+=4,i.expiration=e.readUInt32BE(t),t+=4,i.inception=e.readUInt32BE(t),t+=4,i.keyTag=e.readUInt16BE(t),t+=2,i.signersName=h.decode(e,t),t+=h.decode.bytes,i.signature=e.slice(t,r+o+2),t+=i.signature.length,O.decode.bytes=t-r,i},O.decode.bytes=0,O.encodingLength=function(e){return 20+h.encodingLength(e.signersName)+i.byteLength(e.signature)};const N=t.rp={};N.encode=function(e,t,r){t||(t=i.alloc(N.encodingLength(e))),r||(r=0);const n=r;return r+=2,h.encode(e.mbox||".",t,r,{mail:!0}),r+=h.encode.bytes,h.encode(e.txt||".",t,r),r+=h.encode.bytes,N.encode.bytes=r-n,t.writeUInt16BE(N.encode.bytes-2,n),t},N.encode.bytes=0,N.decode=function(e,t){t||(t=0);const r=t,i={};return t+=2,i.mbox=h.decode(e,t,{mail:!0})||".",t+=h.decode.bytes,i.txt=h.decode(e,t)||".",t+=h.decode.bytes,N.decode.bytes=t-r,i},N.decode.bytes=0,N.encodingLength=function(e){return 2+h.encodingLength(e.mbox||".")+h.encodingLength(e.txt||".")};const P={encode:function(e,t,r){t||(t=i.alloc(P.encodingLength(e))),r||(r=0);const o=r;for(var a=[],s=0;s>8]&&(a[c>>8]=[]),a[c>>8][c>>3&31]|=1<<7-(7&c)}for(s=0;s>8]=Math.max(t[i>>8]||0,255&i)}var o=0;for(r=0;r>15&1),r.options=U.decode(e,t+8),t+=8+U.decode.bytes;else{const i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=s.toString(-32769&i),r.flush=!!(i&l);const n=V(r.type);r.data=n.decode(e,t+8),t+=8+n.decode.bytes}return H.decode.bytes=t-i,r},H.decode.bytes=0,H.encodingLength=function(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return h.encodingLength(e.name)+8+V(e.type).encodingLength(t)};const j=t.question={};function G(e,t){let r=0;for(let i=0;i{"use strict";t.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e},t.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}},5874:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`},t.toCode=function(e){if("number"==typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}},2111:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e},t.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}},834:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e},t.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}},4928:(e,t,r)=>{var i=r(2203),n=["write","end","destroy"],o=["resume","pause"],a=["data","close"],s=Array.prototype.slice;function c(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r{"use strict";var i=r(453)("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},1237:e=>{"use strict";e.exports=EvalError},9383:e=>{"use strict";e.exports=Error},9290:e=>{"use strict";e.exports=RangeError},9538:e=>{"use strict";e.exports=ReferenceError},8068:e=>{"use strict";e.exports=SyntaxError},9675:e=>{"use strict";e.exports=TypeError},5345:e=>{"use strict";e.exports=URIError},8954:(e,t,r)=>{var i=r(2203).Stream,n=t,o=r(1094),a=r(1813),s=r(4928),c=r(9292),u=r(6736),l=r(175),h=r(8497),d=global.setImmediate||process.nextTick;n.Stream=i,n.through=o,n.from=a,n.duplex=s,n.map=c,n.pause=u,n.split=l,n.pipeline=n.connect=n.pipe=h,n.concat=n.merge=function(){var e=[].slice.call(arguments);1===e.length&&e[0]instanceof Array&&(e=e[0]);var t=new i;t.setMaxListeners(0);var r=0;return t.writable=t.readable=!0,e.length?e.forEach((function(i){i.pipe(t,{end:!1});var n=!1;i.on("end",(function(){n||(n=!0,++r==e.length&&t.emit("end"))}))})):process.nextTick((function(){t.emit("end")})),t.write=function(e){this.emit("data",e)},t.destroy=function(){e.forEach((function(e){e.destroy&&e.destroy()}))},t},n.collect=n.writeArray=function(e){if("function"!=typeof e)throw new Error("function writeArray (done): done must be function");var t=new i,r=[],n=!1;return t.write=function(e){r.push(e)},t.end=function(){n=!0,e(null,r)},t.writable=!0,t.readable=!1,t.destroy=function(){t.writable=t.readable=!1,n||e(new Error("destroyed before end"),r)},t},n.readArray=function(e){var t=new i,r=0,n=!1,o=!1;if(t.readable=!0,t.writable=!1,!Array.isArray(e))throw new Error("event-stream.read expects an array");return t.resume=function(){if(!o){n=!1;for(var i=e.length;r1&&r.emit("data",u),d((function(){if(!(a||o||s))try{s=!0,e.call(r,n++,(function(){s=!1,c.apply(null,arguments)}))}catch(e){r.emit("error",e)}}))}return r.on("end",(function(){a=!0})),r.resume=function(){o=!1,c()},process.nextTick(c),r.pause=function(){o=!0},r.destroy=function(){r.emit("end"),r.emit("close"),a=!0},r},n.mapSync=function(e){return n.through((function(t){var r;try{r=e(t)}catch(e){return this.emit("error",e)}void 0!==r&&this.emit("data",r)}))},n.filterSync=function(e){return n.through((function(t){e(t)&&this.queue(t)}))},n.flatmapSync=function(e){return n.through((function(t){var r=this;t.forEach((function(t){r.queue(e(t))}))}))},n.log=function(e){return n.through((function(t){[].slice.call(arguments);e?console.error(e,t):console.error(t),this.emit("data",t)}))},n.child=function(e){return n.duplex(e.stdin,e.stdout)},n.parse=function(e){var t=!(!e||!e.error);return n.through((function(e){var r;try{e&&(r=JSON.parse(e.toString()))}catch(r){return t?this.emit("error",r):console.error(r,"attempting to parse:",e)}void 0!==r&&this.emit("data",r)}))},n.stringify=function(){var e=r(181).Buffer;return n.mapSync((function(t){return JSON.stringify(e.isBuffer(t)?t.toString():t)+"\n"}))},n.replace=function(e,t){return n.pipeline(n.split(e),n.join(t))},n.join=function(e){if("function"==typeof e)return n.wait(e);var t=!0;return n.through((function(r){return t||this.emit("data",e),t=!1,this.emit("data",r),!0}))},n.wait=function(e){var t=[];return n.through((function(e){t.push(e)}),(function(){var r=Buffer.isBuffer(t[0])?Buffer.concat(t):t.join("");this.emit("data",r),this.emit("end"),e&&e(null,r)}))},n.pipeable=function(){throw new Error("[EVENT-STREAM] es.pipeable is deprecated")}},2017:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;0!=n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},2986:(e,t,r)=>{var i=r(6982);function n(e,t){null!=e&&("number"==typeof e?this.fromNumber(e,t):Buffer.isBuffer(e)?this.fromBuffer(e):null==t&&"string"!=typeof e?this.fromByteArray(e):this.fromString(e,t))}function o(){return new n(null)}n.prototype.am=function(e,t,r,i,n,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],u=this[e++]>>14,l=s*c+u*a;n=((c=a*c+((16383&l)<<14)+r[i]+n)>>28)+(l>>14)+s*u,r[i++]=268435455&c}return n},n.prototype.DB=28,n.prototype.DM=268435455,n.prototype.DV=1<<28;n.prototype.FV=Math.pow(2,52),n.prototype.F1=24,n.prototype.F2=4;var a,s,c="0123456789abcdefghijklmnopqrstuvwxyz",u=new Array;for(a="0".charCodeAt(0),s=0;s<=9;++s)u[a++]=s;for(a="a".charCodeAt(0),s=10;s<36;++s)u[a++]=s;for(a="A".charCodeAt(0),s=10;s<36;++s)u[a++]=s;function l(e){return c.charAt(e)}function h(e,t){var r=u[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function f(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function E(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function T(e){return e}function A(e){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}f.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},f.prototype.revert=function(e){return e},f.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},f.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},f.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},_.prototype.convert=T,_.prototype.revert=T,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/I[I.length-1];n.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},n.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+DV:this.t=0},n.prototype.fromString=function(e,t,r){var i;switch(t){case 2:i=1;break;case 4:i=2;break;case 8:i=3;break;case 16:i=4;break;case 32:i=5;break;case 256:i=8;break;default:return void this.fromRadix(e,t)}this.t=0,this.s=0;for(var o=e.length,a=!1,s=0;--o>=0;){var c=8==i?255&e[o]:h(e,o);c<0?"-"==e.charAt(o)&&(a=!0):(a=!1,0===s?this[this.t++]=c:s+i>this.DB?(this[this.t-1]|=(c&(1<>this.DB-s):this[this.t-1]|=c<=this.DB&&(s-=this.DB))}!r&&8==i&&128&e[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},n.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},n.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t[r+a+1]=this[r]>>n|s,s=(this[r]&o)<=0;--r)t[r]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},n.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var i=e%this.DB,n=this.DB-i,o=(1<>i;for(var a=r+1;a>i;i>0&&(t[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()},n.prototype.multiplyTo=function(e,t){var r=this.abs(),i=e.abs(),o=r.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},n.prototype.divRemTo=function(e,t,r){var i=e.abs();if(!(i.t<=0)){var a=this.abs();if(a.t0?(i.lShiftTo(l,s),a.lShiftTo(l,r)):(i.copyTo(s),a.copyTo(r));var h=s.t,d=s[h-1];if(0!==d){var f=d*(1<1?s[h-2]>>this.F2:0),g=this.FV/f,m=(1<=0&&(r[r.t++]=1,r.subTo(S,r)),n.ONE.dlShiftTo(h,S),S.subTo(s,s);s.t=0;){var E=r[--y]==d?this.DM:Math.floor(r[y]*g+(r[y-1]+v)*m);if((r[y]+=s.am(0,E,r,C,0,h))0&&r.rShiftTo(l,r),c<0&&n.ZERO.subTo(r,r)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},n.prototype.isEven=function(){return 0===(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(e,t){if(e>4294967295||e<1)return n.ONE;var r=o(),i=o(),a=t.convert(this),s=p(e)-1;for(a.copyTo(r);--s>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,a,r);else{var c=r;r=i,i=c}return t.revert(r)},n.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},n.prototype.toRadix=function(e){if(null==e&&(e=10),0===this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=d(r),n=o(),a=o(),s="";for(this.divRemTo(i,n,a);n.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,n.divRemTo(i,n,a);return a.intValue().toString(e)+s},n.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),o=!1,a=0,s=0,c=0;c=r&&(this.dMultiply(i),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),o&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(e,t){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var r=i.randomBytes(1+(e>>3)),o=7&e;o>0?r[0]&=(1<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i),t.t=r,t.clamp()},n.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(e,t){if(0!==e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},n.prototype.multiplyLowerTo=function(e,t,r){var i,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(t-this.t,0);i0)if(0===t)r=this[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this[i])%e;return r},n.prototype.millerRabin=function(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var i=t.shiftRight(r);(e=e+1>>1)>I.length&&(e=I.length);for(var a=o(),s=0;s0)for(s>s)>0&&(n=!0,o=l(r));a>=0;)s>(s+=this.DB-t)):(r=this[a]>>(s-=t)&i,s<=0&&(s+=this.DB,--a)),r>0&&(n=!0),n&&(o+=l(r)); //! Fix to be compatible with node >0.12.7 Buffer.js -return 16==e&&o.length%2!=0&&(o="0"+o),n?o:"0"},n.prototype.negate=function(){var e=o();return n.ZERO.subTo(this,e),e},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t},n.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new f(t):new m(t),this.exp(e,r)},n.prototype.clone=function(){var e=o();return this.copyTo(e),e},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0===this.t)return-1}else{if(1==this.t)return this[0];if(0===this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,i=this.DB-e*this.DB%8,n=0;if(e-- >0)for(i>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<=0;)i<8?(r=(this[e]&(1<>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),128&r&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},n.prototype.toBuffer=function(e){var t=Buffer.from(this.toByteArray());if(!0===e&&0===t[0])t=t.slice(1);else if("number"==typeof e){if(t.length>e){for(var r=0;r0},n.prototype.gte=function(e){return this.compareTo(e)>=0},n.prototype.lt=function(e){return this.compareTo(e)<0},n.prototype.lte=function(e){return this.compareTo(e)<=0},n.prototype.min=function(e){return this.compareTo(e)<0?this:e},n.prototype.max=function(e){return this.compareTo(e)>0?this:e},n.prototype.and=function(e){var t=o();return this.bitwiseTo(e,g,t),t},n.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},n.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,y,t),t},n.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,C,t),t},n.prototype.not=function(){for(var e=o(),t=0;t=this.t?0!=this.s:!!(this[t]&1<1){var h=o();for(i.sqrTo(s[1],h);c<=l;)s[c]=o(),i.mulTo(h,s[c-2],s[c]),c+=2}var g,v,y=e.t-1,C=!0,S=o();for(n=p(e[y])-1;y>=0;){for(n>=u?g=e[y]>>n-u&l:(g=(e[y]&(1<0&&(g|=e[y-1]>>this.DB+n-u)),c=r;!(1&g);)g>>=1,--c;if((n-=c)<0&&(n+=this.DB,--y),C)s[g].copyTo(a),C=!1;else{for(;c>1;)i.sqrTo(a,S),i.sqrTo(S,a),c-=2;c>0?i.sqrTo(a,S):(v=a,a=S,S=v),i.mulTo(S,s[g],a)}for(;y>=0&&!(e[y]&1<=0?(r.subTo(i,r),t&&o.subTo(s,o),a.subTo(c,a)):(i.subTo(r,i),t&&s.subTo(o,s),c.subTo(a,c))}return 0!=i.compareTo(n.ONE)?n.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},n.prototype.pow=function(e){return this.exp(e,new _)},n.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(n0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},n.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.params=t.hex=void 0;const i=r(2986);function n(e){return new i(e.split(/\s|\n/).join(""),16)}t.hex=n,t.params={1024:{N_length_bits:1024,N:n("\n EEAF0AB9 ADB38DD6 9C33F80A FA8FC5E8 60726187 75FF3C0B 9EA2314C\n 9C256576 D674DF74 96EA81D3 383B4813 D692C6E0 E0D5D8E2 50B98BE4\n 8E495C1D 6089DAD1 5DC7D7B4 6154D6B6 CE8EF4AD 69B15D49 82559B29\n 7BCF1885 C529F566 660E57EC 68EDBC3C 05726CC0 2FD4CBF4 976EAA9A\n FD5138FE 8376435B 9FC61D2F C0EB06E3\n "),g:n("02"),hash:"sha1"},1536:{N_length_bits:1536,N:n("\n 9DEF3CAF B939277A B1F12A86 17A47BBB DBA51DF4 99AC4C80 BEEEA961\n 4B19CC4D 5F4F5F55 6E27CBDE 51C6A94B E4607A29 1558903B A0D0F843\n 80B655BB 9A22E8DC DF028A7C EC67F0D0 8134B1C8 B9798914 9B609E0B\n E3BAB63D 47548381 DBC5B1FC 764E3F4B 53DD9DA1 158BFD3E 2B9C8CF5\n 6EDF0195 39349627 DB2FD53D 24B7C486 65772E43 7D6C7F8C E442734A\n F7CCB7AE 837C264A E3A9BEB8 7F8A2FE9 B8B5292E 5A021FFF 5E91479E\n 8CE7A28C 2442C6F3 15180F93 499A234D CF76E3FE D135F9BB\n "),g:n("02"),hash:"sha1"},2048:{N_length_bits:2048,N:n("\n AC6BDB41 324A9A9B F166DE5E 1389582F AF72B665 1987EE07 FC319294\n 3DB56050 A37329CB B4A099ED 8193E075 7767A13D D52312AB 4B03310D\n CD7F48A9 DA04FD50 E8083969 EDB767B0 CF609517 9A163AB3 661A05FB\n D5FAAAE8 2918A996 2F0B93B8 55F97993 EC975EEA A80D740A DBF4FF74\n 7359D041 D5C33EA7 1D281E44 6B14773B CA97B43A 23FB8016 76BD207A\n 436C6481 F1D2B907 8717461A 5B9D32E6 88F87748 544523B5 24B0D57D\n 5EA77A27 75D2ECFA 032CFBDB F52FB378 61602790 04E57AE6 AF874E73\n 03CE5329 9CCC041C 7BC308D8 2A5698F3 A8D0C382 71AE35F8 E9DBFBB6\n 94B5C803 D89F7AE4 35DE236D 525F5475 9B65E372 FCD68EF2 0FA7111F\n 9E4AFF73\n "),g:n("02"),hash:"sha256"},3072:{N_length_bits:3072,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},hap:{N_length_bits:3072,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha512"},4096:{N_length_bits:4096,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34063199\n FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},6244:{N_length_bits:6244,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DCC4024 FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},8192:{N_length_bits:8192,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DBE1159 74A3926F 12FEE5E4 38777CB6 A932DF8C D8BEC4D0 73B931BA\n 3BC832B6 8D9DD300 741FA7BF 8AFC47ED 2576F693 6BA42466 3AAB639C\n 5AE4F568 3423B474 2BF1C978 238F16CB E39D652D E3FDB8BE FC848AD9\n 22222E04 A4037C07 13EB57A8 1A23F0C7 3473FC64 6CEA306B 4BCBC886\n 2F8385DD FA9D4B7F A2C087E8 79683303 ED5BDD3A 062B3CF5 B3A278A6\n 6D2A13F8 3F44F82D DF310EE0 74AB6A36 4597E899 A0255DC1 64F31CC5\n 0846851D F9AB4819 5DED7EA1 B1D510BD 7EE74D73 FAF36BC3 1ECFA268\n 359046F4 EB879F92 4009438B 481C6CD7 889A002E D5EE382B C9190DA6\n FC026E47 9558E447 5677E9AA 9E3050E2 765694DF C81F56E8 80B96E71\n 60C980DD 98EDD3DF FFFFFFFF FFFFFFFF\n "),g:n("13"),hash:"sha256"}},t.default=t.params},4618:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SrpServer=t.SrpClient=t.SRP=void 0;const n=i(r(6982)),o=i(r(2613)),a=r(2986),s=r(1799),c=new a(0,10);function u(e,t){if(!e)throw new Error(t||"assertion")}function l(e,t="arg"){u(Buffer.isBuffer(e),`Type error: ${t} must be a buffer`)}function h(e,t="arg"){u(e instanceof a,`Type error: ${t} must be a BigInteger`)}function d(e,t){l(e,"n");const r=t-e.length;u(r>-1,"Negative padding. Very uncomfortable.");const i=Buffer.alloc(t);return i.fill(0,0,r),e.copy(i,r),o.default.strictEqual(i.length,t),i}function p(e,t){h(e);const r=e.toString(16).length%2!=0?"0"+e.toString(16):e.toString(16);return d(Buffer.from(r,"hex"),t.N_length_bits/8)}function f(e,t,r,i){l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)");const o=n.default.createHash(e.hash).update(Buffer.concat([r,Buffer.from(":"),i])).digest(),s=n.default.createHash(e.hash).update(t).update(o).digest();return new a(s)}class m{static computeVerifier(e,t,r,i){l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)");return e.g.modPow(f(e,t,r,i),e.N).toBuffer(e.N_length_bits/8)}static genKey(e=32,t){if("number"!=typeof e&&(t=e,e=32),!t)return new Promise(((t,r)=>m.genKey(e,((e,i)=>e?r(e):t(i)))));n.default.randomBytes(e,((e,r)=>e?t(e,null):t(null,r)))}}function g(e){const t=n.default.createHash(e.hash).update(p(e.N,e)).update(p(e.g,e)).digest();return new a(t)}function v(e,t,r){l(t,"A"),l(r,"B");const i=n.default.createHash(e.hash).update(d(t,e.N_length_bits/8)).update(d(r,e.N_length_bits/8)).digest();return new a(i)}function y(e,t){return l(t,"S"),"sha1"===e.hash?Buffer.concat([n.default.createHash(e.hash).update(t).update(Buffer.from([0,0,0,0])).digest(),n.default.createHash(e.hash).update(t).update(Buffer.from([0,0,0,1])).digest()]):n.default.createHash(e.hash).update(t).digest()}function C(e,t,r,i,o,a){if(arguments.length>4){l(t,"identity (I)"),l(r,"salt (s)"),l(i,"client public key (A)"),l(o,"server public key (B)"),l(a,"session key (K)");const s=n.default.createHash(e.hash).update(e.N.toBuffer(!0)).digest(),c=n.default.createHash(e.hash).update(e.g.toBuffer(!0)).digest();for(let e=0;e=0||e.N.compareTo(n)<=0)throw new Error('invalid server-supplied "B", must be 1..N-1');return n.subtract(t.multiply(e.g.modPow(r,e.N))).modPow(i.add(o.multiply(r)),e.N).mod(e.N).toBuffer(e.N_length_bits/8)}(this._params,this._k,this._x,this._a,new a(e),t);this._K=y(this._params,r),this._u=t,this._S=r,this._B=e,this._I&&this._s?this._M1=C(this._params,this._I,this._s,this._A,this._B,this._K):this._M1=C(this._params,this._A,this._B,this._S),this._M2=S(this._params,this._A,this._M1,this._K)}computeM1(){if(void 0===this._M1)throw new Error("incomplete protocol");return this._M1}checkM2(e){if(!E(this._M2,e))throw new Error("server is not authentic")}computeK(){if(void 0===this._K)throw new Error("incomplete protocol");return this._K}};t.SrpServer=class{constructor(e,t,r,i,n){if(this._params=e,this._k=g(e),arguments.length>3)l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)"),l(n,"secret2"),this._b=new a(n),this._v=new a(m.computeVerifier(e,t,r,i)),this._I=r,this._s=t;else if(t instanceof Buffer){const e=t;[n,t,r,i]=[r,void 0,void 0,void 0],l(e,"verifier (v)"),l(n,"secret2"),this._b=new a(n),this._v=new a(e)}else{const s=t;[n,t,r,i]=[r,void 0,void 0,void 0],(0,o.default)(s.username instanceof Buffer||"string"==typeof s.username,"identity.username (I) must be a string or Buffer"),l(s.salt,"identity.salt (s)"),(0,o.default)("password"in s||"verifier"in s,"identity requires a password or verifier"),"verifier"in s?l(s.verifier,"identity.verifier (v)"):(0,o.default)(s.password instanceof Buffer||"string"==typeof s.password,"identity.password (p) must be a string or Buffer"),l(n,"secret2");const c="string"==typeof s.username?Buffer.from(s.username):s.username;this._b=new a(n),this._v=new a("verifier"in s?s.verifier:m.computeVerifier(e,s.salt,c,"string"==typeof s.password?Buffer.from(s.password):s.password)),this._I=c,this._s=s.salt}this._B=function(e,t,r,i){return h(r),h(t),h(i),t.multiply(r).add(e.g.modPow(i,e.N)).mod(e.N).toBuffer(e.N_length_bits/8)}(e,this._k,this._v,this._b)}computeB(){return this._B}setA(e){const t=v(this._params,e,this._B),r=function(e,t,r,i,n){if(h(t),h(r),h(i),h(n),c.compareTo(r)>=0||e.N.compareTo(r)<=0)throw new Error('invalid client-supplied "A", must be 1..N-1');return r.multiply(t.modPow(n,e.N)).modPow(i,e.N).mod(e.N).toBuffer(e.N_length_bits/8)}(this._params,this._v,new a(e),this._b,t);this._K=y(this._params,r),this._u=t,this._S=r,this._I&&this._s?this._M1=C(this._params,this._I,this._s,e,this._B,this._K):this._M1=C(this._params,e,this._B,this._S),this._M2=S(this._params,e,this._M1,this._K)}checkM1(e){if(void 0===this._M1)throw new Error("incomplete protocol");if(!E(this._M1,e))throw new Error("client did not use the same password")}computeK(){if(void 0===this._K)throw new Error("incomplete protocol");return this._K}computeM2(){if(void 0===this._M2)throw new Error("incomplete protocol");return this._M2}}},2682:(e,t,r)=>{"use strict";var i=r(9600),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){if(!i(t))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===n.call(e)?function(e,t,r){for(var i=0,n=e.length;i{"use strict";var i=r(2203);e.exports=function e(t){if(Array.isArray(t)){var r=0,n=t.length;return e((function(e){return r{"use strict";var t=Object.prototype.toString,r=Math.max,i=function(e,t){for(var r=[],i=0;i{"use strict";var i=r(9353);e.exports=Function.prototype.bind||i},4462:e=>{"use strict";var t=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(e){r=null}t.functionsHaveConfigurableNames=function(){if(!t()||!r)return!1;var e=r((function(){}),"name");return!!e&&!!e.configurable};var i=Function.prototype.bind;t.boundFunctionsHaveNames=function(){return t()&&"function"==typeof i&&""!==function(){}.bind().name},e.exports=t},6871:(e,t,r)=>{"use strict";const{Buffer:i}=r(181),{createHash:n,createHmac:o}=r(6982),a={},s=e=>{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=a[e];return void 0===t&&(t=n(e).digest().length,a[e]=t),t}}},c=(e,t,r,n)=>{const a=i.isBuffer(r)?r:i.from(r),s=n&&n.length?i.from(n):i.alloc(t,0);return o(e,s).update(a).digest()},u=(e,t,r,n,a)=>{const s=i.isBuffer(a)?a:i.from(a||""),c=s.length,u=Math.ceil(n/t);if(u>255)throw new Error(`OKM length ${n} is too long for ${e} hash`);const l=i.alloc(t*u+c+1);for(let i=1,n=0,a=0;i<=u;++i)s.copy(l,a),l[a+c]=i,o(e,r).update(l.slice(n,a+c+1)).digest().copy(l,a),n=a,a+=t;return l.slice(0,n)};function l(e,t,{salt:r="",info:i="",hash:n="SHA-256"}={}){n=n.toLowerCase().replace("-","");const o=s(n),a=c(n,o,e,r);return u(n,o,a,t,i)}Object.defineProperties(l,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:s},extract:{configurable:!1,enumerable:!1,writable:!1,value:c},expand:{configurable:!1,enumerable:!1,writable:!1,value:u}}),e.exports=l},453:(e,t,r)=>{"use strict";var i,n=r(9383),o=r(1237),a=r(9290),s=r(9538),c=r(8068),u=r(9675),l=r(5345),h=Function,d=function(e){try{return h('"use strict"; return ('+e+").constructor;")()}catch(e){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(e){p=null}var f=function(){throw new u},m=p?function(){try{return f}catch(e){try{return p(arguments,"callee").get}catch(e){return f}}}():f,g=r(4039)(),v=r(24)(),y=Object.getPrototypeOf||(v?function(e){return e.__proto__}:null),C={},S="undefined"!=typeof Uint8Array&&y?y(Uint8Array):i,E={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":g&&y?y([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":C,"%AsyncGenerator%":C,"%AsyncGeneratorFunction%":C,"%AsyncIteratorPrototype%":C,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":C,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&y?y(y([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&y?y((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&y?y((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&y?y(""[Symbol.iterator]()):i,"%Symbol%":g?Symbol:i,"%SyntaxError%":c,"%ThrowTypeError%":m,"%TypedArray%":S,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":l,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet};if(y)try{null.error}catch(e){var _=y(y(e));E["%Error.prototype%"]=_}var T=function e(t){var r;if("%AsyncFunction%"===t)r=d("async function () {}");else if("%GeneratorFunction%"===t)r=d("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=d("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&y&&(r=y(n.prototype))}return E[t]=r,r},A={__proto__:null,"%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"]},I=r(6743),D=r(9957),w=I.call(Function.call,Array.prototype.concat),b=I.call(Function.apply,Array.prototype.splice),U=I.call(Function.call,String.prototype.replace),R=I.call(Function.call,String.prototype.slice),O=I.call(Function.call,RegExp.prototype.exec),N=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,B=function(e,t){var r,i=e;if(D(A,i)&&(i="%"+(r=A[i])[0]+"%"),D(E,i)){var n=E[i];if(n===C&&(n=T(i)),void 0===n&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new c("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=R(e,0,1),r=R(e,-1);if("%"===t&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new c("invalid intrinsic syntax, expected opening `%`");var i=[];return U(e,N,(function(e,t,r,n){i[i.length]=r?U(n,P,"$1"):t||e})),i}(e),i=r.length>0?r[0]:"",n=B("%"+i+"%",t),o=n.name,a=n.value,s=!1,l=n.alias;l&&(i=l[0],b(r,w([0,1],l)));for(var h=1,d=!0;h=r.length){var v=p(a,f);a=(d=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:a[f]}else d=D(a,f),a=a[f];d&&!s&&(E[o]=a)}}return a}},5795:(e,t,r)=>{"use strict";var i=r(453)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},135:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MANUFACTURER_CTYPE=t.LOGS_CTYPE=t.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE=t.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE=t.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE=t.IDENTIFY_CTYPE=t.HUE_CTYPE=t.HEATING_THRESHOLD_CTYPE=t.CURRENT_TEMPERATURE_CTYPE=t.CURRENT_RELATIVE_HUMIDITY_CTYPE=t.CURRENT_LOCK_MECHANISM_STATE_CTYPE=t.CURRENT_DOOR_STATE_CTYPE=t.CONTACT_SENSOR_STATE_CTYPE=t.COOLING_THRESHOLD_CTYPE=t.BATTERY_LEVEL_CTYPE=t.BRIGHTNESS_CTYPE=t.AUDIO_FEEDBACK_CTYPE=t.ADMIN_ONLY_ACCESS_CTYPE=t.ALARM_TARGET_STATE_CTYPE=t.ALARM_CURRENT_STATE_CTYPE=t.TEMPERATURE_SENSOR_STYPE=t.HUMIDITY_SENSOR_STYPE=t.MOTION_SENSOR_STYPE=t.CONTACT_SENSOR_STYPE=t.OCCUPANCY_SENSOR_STYPE=t.WINDOW_COVERING_STYPE=t.ALARM_STYPE=t.LOCK_MANAGEMENT_STYPE=t.LOCK_MECHANISM_STYPE=t.OUTLET_STYPE=t.FAN_STYPE=t.ACCESSORY_INFORMATION_STYPE=t.GARAGE_DOOR_OPENER_STYPE=t.THERMOSTAT_STYPE=t.SWITCH_STYPE=t.LIGHTBULB_STYPE=t.PROGRAMMABLE_SWITCH_TCTYPE=t.WINDOW_COVERING_TCTYPE=t.WINDOW_TCTYPE=t.DOOR_TCTYPE=t.ALARM_SYSTEM_TCTYPE=t.SENSOR_TCTYPE=t.THERMOSTAT_TCTYPE=t.SWITCH_TCTYPE=t.OUTLET_TCTYPE=t.DOOR_LOCK_TCTYPE=t.LIGHTBULB_TCTYPE=t.GARAGE_DOOR_OPENER_TCTYPE=t.FAN_TCTYPE=t.OTHER_TCTYPE=void 0,t.TARGETHEATINGCOOLING_CTYPE=t.CURRENTHEATINGCOOLING_CTYPE=t.WINDOW_COVERING_OPERATION_STATE_CTYPE=t.WINDOW_COVERING_CURRENT_POSITION_CTYPE=t.WINDOW_COVERING_TARGET_POSITION_CTYPE=t.VERSION_CTYPE=t.TEMPERATURE_UNITS_CTYPE=t.TARGET_TEMPERATURE_CTYPE=t.TARGET_RELATIVE_HUMIDITY_CTYPE=t.TARGET_LOCK_MECHANISM_STATE_CTYPE=t.TARGET_DOORSTATE_CTYPE=t.STATUS_FAULT_CTYPE=t.STATUS_LOW_BATTERY_CTYPE=t.FIRMWARE_REVISION_CTYPE=t.SERIAL_NUMBER_CTYPE=t.SATURATION_CTYPE=t.ROTATION_SPEED_CTYPE=t.ROTATION_DIRECTION_CTYPE=t.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE=t.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE=t.POWER_STATE_CTYPE=t.OCCUPANCY_DETECTED_CTYPE=t.OUTLET_IN_USE_CTYPE=t.OBSTRUCTION_DETECTED_CTYPE=t.NAME_CTYPE=t.MOTION_DETECTED_CTYPE=t.MODEL_CTYPE=void 0;var r="000000",i="-0000-1000-8000-0026BB765291";t.OTHER_TCTYPE=1,t.FAN_TCTYPE=3,t.GARAGE_DOOR_OPENER_TCTYPE=4,t.LIGHTBULB_TCTYPE=5,t.DOOR_LOCK_TCTYPE=6,t.OUTLET_TCTYPE=7,t.SWITCH_TCTYPE=8,t.THERMOSTAT_TCTYPE=9,t.SENSOR_TCTYPE=10,t.ALARM_SYSTEM_TCTYPE=11,t.DOOR_TCTYPE=12,t.WINDOW_TCTYPE=13,t.WINDOW_COVERING_TCTYPE=14,t.PROGRAMMABLE_SWITCH_TCTYPE=15,t.LIGHTBULB_STYPE=r+"43"+i,t.SWITCH_STYPE=r+"49"+i,t.THERMOSTAT_STYPE=r+"4A"+i,t.GARAGE_DOOR_OPENER_STYPE=r+"41"+i,t.ACCESSORY_INFORMATION_STYPE=r+"3E"+i,t.FAN_STYPE=r+"40"+i,t.OUTLET_STYPE=r+"47"+i,t.LOCK_MECHANISM_STYPE=r+"45"+i,t.LOCK_MANAGEMENT_STYPE=r+"44"+i,t.ALARM_STYPE=r+"7E"+i,t.WINDOW_COVERING_STYPE=r+"8C"+i,t.OCCUPANCY_SENSOR_STYPE=r+"86"+i,t.CONTACT_SENSOR_STYPE=r+"80"+i,t.MOTION_SENSOR_STYPE=r+"85"+i,t.HUMIDITY_SENSOR_STYPE=r+"82"+i,t.TEMPERATURE_SENSOR_STYPE=r+"8A"+i,t.ALARM_CURRENT_STATE_CTYPE=r+"66"+i,t.ALARM_TARGET_STATE_CTYPE=r+"67"+i,t.ADMIN_ONLY_ACCESS_CTYPE=r+"01"+i,t.AUDIO_FEEDBACK_CTYPE=r+"05"+i,t.BRIGHTNESS_CTYPE=r+"08"+i,t.BATTERY_LEVEL_CTYPE=r+"68"+i,t.COOLING_THRESHOLD_CTYPE=r+"0D"+i,t.CONTACT_SENSOR_STATE_CTYPE=r+"6A"+i,t.CURRENT_DOOR_STATE_CTYPE=r+"0E"+i,t.CURRENT_LOCK_MECHANISM_STATE_CTYPE=r+"1D"+i,t.CURRENT_RELATIVE_HUMIDITY_CTYPE=r+"10"+i,t.CURRENT_TEMPERATURE_CTYPE=r+"11"+i,t.HEATING_THRESHOLD_CTYPE=r+"12"+i,t.HUE_CTYPE=r+"13"+i,t.IDENTIFY_CTYPE=r+"14"+i,t.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE=r+"1A"+i,t.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE=r+"19"+i,t.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE=r+"1C"+i,t.LOGS_CTYPE=r+"1F"+i,t.MANUFACTURER_CTYPE=r+"20"+i,t.MODEL_CTYPE=r+"21"+i,t.MOTION_DETECTED_CTYPE=r+"22"+i,t.NAME_CTYPE=r+"23"+i,t.OBSTRUCTION_DETECTED_CTYPE=r+"24"+i,t.OUTLET_IN_USE_CTYPE=r+"26"+i,t.OCCUPANCY_DETECTED_CTYPE=r+"71"+i,t.POWER_STATE_CTYPE=r+"25"+i,t.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE=r+"73"+i,t.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE=r+"74"+i,t.ROTATION_DIRECTION_CTYPE=r+"28"+i,t.ROTATION_SPEED_CTYPE=r+"29"+i,t.SATURATION_CTYPE=r+"2F"+i,t.SERIAL_NUMBER_CTYPE=r+"30"+i,t.FIRMWARE_REVISION_CTYPE=r+"52"+i,t.STATUS_LOW_BATTERY_CTYPE=r+"79"+i,t.STATUS_FAULT_CTYPE=r+"77"+i,t.TARGET_DOORSTATE_CTYPE=r+"32"+i,t.TARGET_LOCK_MECHANISM_STATE_CTYPE=r+"1E"+i,t.TARGET_RELATIVE_HUMIDITY_CTYPE=r+"34"+i,t.TARGET_TEMPERATURE_CTYPE=r+"35"+i,t.TEMPERATURE_UNITS_CTYPE=r+"36"+i,t.VERSION_CTYPE=r+"37"+i,t.WINDOW_COVERING_TARGET_POSITION_CTYPE=r+"7C"+i,t.WINDOW_COVERING_CURRENT_POSITION_CTYPE=r+"6D"+i,t.WINDOW_COVERING_OPERATION_STATE_CTYPE=r+"72"+i,t.CURRENTHEATINGCOOLING_CTYPE=r+"0F"+i,t.TARGETHEATINGCOOLING_CTYPE=r+"33"+i},3103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.init=t.HAPLibraryVersion=t.LegacyTypes=t.uuid=t.AccessoryLoader=void 0;var i=r(1635);r(3476),r(8086);var n=i.__importDefault(r(5753)),o=r(4299);t.AccessoryLoader=i.__importStar(r(1370)),t.uuid=i.__importStar(r(2997)),i.__exportStar(r(4299),t),i.__exportStar(r(5745),t),i.__exportStar(r(3186),t),i.__exportStar(r(5876),t),i.__exportStar(r(9826),t),i.__exportStar(r(1370),t),i.__exportStar(r(8591),t),i.__exportStar(r(4910),t),i.__exportStar(r(589),t),i.__exportStar(r(9948),t),i.__exportStar(r(1068),t),i.__exportStar(r(5579),t),i.__exportStar(r(9621),t),i.__exportStar(r(7739),t),i.__exportStar(r(3314),t),i.__exportStar(r(8073),t),i.__exportStar(r(2175),t),i.__exportStar(r(1579),t),i.__exportStar(r(9593),t),i.__exportStar(r(4310),t),t.LegacyTypes=i.__importStar(r(135));var a=(0,n.default)("HAP-NodeJS:Advertiser");function s(){return r(8389).version}t.HAPLibraryVersion=s,a("Initializing HAP-NodeJS v%s ...",s()),t.init=function(e){console.log("DEPRECATED: The need to manually initialize HAP (by calling the init method) was removed. If you want to set a custom storage path location, please ust HAPStorage.setCustomStoragePath directly. This method will be removed in the next major update!"),e&&o.HAPStorage.setCustomStoragePath(e)};i.__importStar(r(1647)),i.__importStar(r(651))},8602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPMimeTypes=t.PairingStates=t.PairMethods=t.TLVValues=t.consideredTrue=void 0,t.consideredTrue=function(e){return!!e&&("true"===e||"1"===e)},function(e){e[e.REQUEST_TYPE=0]="REQUEST_TYPE",e[e.METHOD=0]="METHOD",e[e.USERNAME=1]="USERNAME",e[e.IDENTIFIER=1]="IDENTIFIER",e[e.SALT=2]="SALT",e[e.PUBLIC_KEY=3]="PUBLIC_KEY",e[e.PASSWORD_PROOF=4]="PASSWORD_PROOF",e[e.ENCRYPTED_DATA=5]="ENCRYPTED_DATA",e[e.SEQUENCE_NUM=6]="SEQUENCE_NUM",e[e.STATE=6]="STATE",e[e.ERROR_CODE=7]="ERROR_CODE",e[e.RETRY_DELAY=8]="RETRY_DELAY",e[e.CERTIFICATE=9]="CERTIFICATE",e[e.PROOF=10]="PROOF",e[e.SIGNATURE=10]="SIGNATURE",e[e.PERMISSIONS=11]="PERMISSIONS",e[e.FRAGMENT_DATA=12]="FRAGMENT_DATA",e[e.FRAGMENT_LAST=13]="FRAGMENT_LAST",e[e.SEPARATOR=255]="SEPARATOR"}(t.TLVValues||(t.TLVValues={})),function(e){e[e.PAIR_SETUP=0]="PAIR_SETUP",e[e.PAIR_SETUP_WITH_AUTH=1]="PAIR_SETUP_WITH_AUTH",e[e.PAIR_VERIFY=2]="PAIR_VERIFY",e[e.ADD_PAIRING=3]="ADD_PAIRING",e[e.REMOVE_PAIRING=4]="REMOVE_PAIRING",e[e.LIST_PAIRINGS=5]="LIST_PAIRINGS"}(t.PairMethods||(t.PairMethods={})),function(e){e[e.M1=1]="M1",e[e.M2=2]="M2",e[e.M3=3]="M3",e[e.M4=4]="M4",e[e.M5=5]="M5",e[e.M6=6]="M6"}(t.PairingStates||(t.PairingStates={})),function(e){e.PAIRING_TLV8="application/pairing+tlv8",e.HAP_JSON="application/hap+json",e.IMAGE_JPEG="image/jpeg"}(t.HAPMimeTypes||(t.HAPMimeTypes={}))},5745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Accessory=t.AccessoryEventTypes=t.MDNSAdvertiser=t.CharacteristicWarningType=t.Categories=void 0;var i,n,o=r(1635),a=o.__importDefault(r(2613)),s=o.__importDefault(r(6982)),c=o.__importDefault(r(5753)),u=r(4434),l=o.__importDefault(r(9278)),h=r(310),d=r(8591),p=r(9826),f=r(1068),m=r(589),g=r(5579),v=r(292),y=r(2738),C=r(5876),S=r(9621),E=r(8066),_=o.__importStar(r(2997)),T=r(2997),A=(0,c.default)("HAP-NodeJS:Accessory");!function(e){e[e.OTHER=1]="OTHER",e[e.BRIDGE=2]="BRIDGE",e[e.FAN=3]="FAN",e[e.GARAGE_DOOR_OPENER=4]="GARAGE_DOOR_OPENER",e[e.LIGHTBULB=5]="LIGHTBULB",e[e.DOOR_LOCK=6]="DOOR_LOCK",e[e.OUTLET=7]="OUTLET",e[e.SWITCH=8]="SWITCH",e[e.THERMOSTAT=9]="THERMOSTAT",e[e.SENSOR=10]="SENSOR",e[e.ALARM_SYSTEM=11]="ALARM_SYSTEM",e[e.SECURITY_SYSTEM=11]="SECURITY_SYSTEM",e[e.DOOR=12]="DOOR",e[e.WINDOW=13]="WINDOW",e[e.WINDOW_COVERING=14]="WINDOW_COVERING",e[e.PROGRAMMABLE_SWITCH=15]="PROGRAMMABLE_SWITCH",e[e.RANGE_EXTENDER=16]="RANGE_EXTENDER",e[e.CAMERA=17]="CAMERA",e[e.IP_CAMERA=17]="IP_CAMERA",e[e.VIDEO_DOORBELL=18]="VIDEO_DOORBELL",e[e.AIR_PURIFIER=19]="AIR_PURIFIER",e[e.AIR_HEATER=20]="AIR_HEATER",e[e.AIR_CONDITIONER=21]="AIR_CONDITIONER",e[e.AIR_HUMIDIFIER=22]="AIR_HUMIDIFIER",e[e.AIR_DEHUMIDIFIER=23]="AIR_DEHUMIDIFIER",e[e.APPLE_TV=24]="APPLE_TV",e[e.HOMEPOD=25]="HOMEPOD",e[e.SPEAKER=26]="SPEAKER",e[e.AIRPORT=27]="AIRPORT",e[e.SPRINKLER=28]="SPRINKLER",e[e.FAUCET=29]="FAUCET",e[e.SHOWER_HEAD=30]="SHOWER_HEAD",e[e.TELEVISION=31]="TELEVISION",e[e.TARGET_CONTROLLER=32]="TARGET_CONTROLLER",e[e.ROUTER=33]="ROUTER",e[e.AUDIO_RECEIVER=34]="AUDIO_RECEIVER",e[e.TV_SET_TOP_BOX=35]="TV_SET_TOP_BOX",e[e.TV_STREAMING_STICK=36]="TV_STREAMING_STICK"}(i=t.Categories||(t.Categories={})),function(e){e.SLOW_WRITE="slow-write",e.TIMEOUT_WRITE="timeout-write",e.SLOW_READ="slow-read",e.TIMEOUT_READ="timeout-read",e.WARN_MESSAGE="warn-message",e.ERROR_MESSAGE="error-message",e.DEBUG_MESSAGE="debug-message"}(t.CharacteristicWarningType||(t.CharacteristicWarningType={})),function(e){e.CIAO="ciao",e.BONJOUR="bonjour-hap",e.AVAHI="avahi",e.RESOLVED="resolved"}(t.MDNSAdvertiser||(t.MDNSAdvertiser={})),function(e){e[e.REGULAR_REQUEST=0]="REGULAR_REQUEST",e[e.TIMED_WRITE_AUTHENTICATED=1]="TIMED_WRITE_AUTHENTICATED",e[e.TIMED_WRITE_REJECTED=2]="TIMED_WRITE_REJECTED"}(n||(n={})),function(e){e.IDENTIFY="identify",e.LISTENING="listening",e.ADVERTISED="advertised",e.SERVICE_CONFIGURATION_CHANGE="service-configurationChange",e.SERVICE_CHARACTERISTIC_CHANGE="service-characteristic-change",e.PAIRED="paired",e.UNPAIRED="unpaired",e.CHARACTERISTIC_WARNING="characteristic-warning"}(t.AccessoryEventTypes||(t.AccessoryEventTypes={}));var I=function(e){function t(t,r){var i=e.call(this)||this;return i.displayName=t,i.UUID=r,i.aid=null,i._isBridge=!1,i.bridged=!1,i.bridgedAccessories=[],i.reachable=!0,i.category=1,i.services=[],i.shouldPurgeUnusedIDs=!0,i.initialized=!1,i.controllers={},i._setupID=null,i.controllerStorage=new v.ControllerStorage(i),i.lastAccessoriesRequest=0,i.getPrimaryAccessory=function(){return i.bridged?i.bridge:i},(0,a.default)(t,"Accessories must be created with a non-empty displayName."),(0,a.default)(r,"Accessories must be created with a valid UUID."),(0,a.default)(_.isValid(r),"UUID '"+r+"' is not a valid UUID. Try using the provided 'generateUUID' function to create a valid UUID from any arbitrary string, like a serial number."),i.addService(C.Service.AccessoryInformation).setCharacteristic(p.Characteristic.Name,t),i.getService(C.Service.AccessoryInformation).getCharacteristic(p.Characteristic.Identify).on("set",(function(e,t){if(e){i.identificationRequest(!0,t)}})),i}return o.__extends(t,e),t.prototype.identificationRequest=function(e,t){A("[%s] Identification request",this.displayName),this.listeners("identify").length>0?this.emit("identify",e,t):(A("[%s] Identification request ignored; no listeners to 'identify' event",this.displayName),t())},t.prototype.addService=function(e){for(var t,r,i=[],n=1;n=100)throw new Error("Cannot add more than 100 services to a single accessory!");return this.services.push(a),a.isPrimaryService&&(void 0!==this.primaryService&&(this.primaryService.isPrimaryService=!1),this.primaryService=a),this.bridged?this.emit("service-configurationChange",{service:a}):this.enqueueConfigurationUpdate(),this.setupServiceEventHandlers(a),a},t.prototype.setPrimaryService=function(e){e.setPrimaryService()},t.prototype.removeService=function(e){var t=this.services.indexOf(e);t>=0&&(this.services.splice(t,1),this.primaryService===e&&(this.primaryService=void 0),this.removeLinkedService(e),this.bridged?this.emit("service-configurationChange",{service:e}):this.enqueueConfigurationUpdate(),e.removeAllListeners())},t.prototype.removeLinkedService=function(e){var t,r;try{for(var i=o.__values(this.services),n=i.next();!n.done;n=i.next()){n.value.removeLinkedService(e)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getService=function(e){var t,r;try{for(var i=o.__values(this.services),n=i.next();!n.done;n=i.next()){var a=n.value;if("string"==typeof e&&(a.displayName===e||a.name===e||a.subtype===e))return a;if("function"==typeof e&&(a instanceof e||e.UUID===a.UUID))return a}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getServiceById=function(e,t){var r,i;try{for(var n=o.__values(this.services),a=n.next();!a.done;a=n.next()){var s=a.value;if("string"==typeof e&&(s.displayName===e||s.name===e)&&s.subtype===t)return s;if("function"==typeof e&&(s instanceof e||e.UUID===s.UUID)&&s.subtype===t)return s}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},t.prototype.updateReachability=function(e){if(!this.bridged)throw new Error("Cannot update reachability on non-bridged accessory!");this.reachable=e,A("Reachability update is no longer being supported.")},t.prototype.addBridgedAccessory=function(e,t){var r=this;if(void 0===t&&(t=!1),e._isBridge||e===this)throw new Error("Illegal state: either trying to bridge a bridge or trying to bridge itself!");if(e.initialized)throw new Error("Tried to bridge an accessory which was already published once!");if(null!=e.bridge)throw new Error("Tried to bridge "+e.displayName+" while it was already bridged by "+e.bridge.displayName);if(this.bridgedAccessories.length>=149)throw new Error("Cannot Bridge more than 149 Accessories");return e.on("service-characteristic-change",(function(t){return r.handleCharacteristicChangeEvent(e,t.service,t)})),e.on("service-configurationChange",this.enqueueConfigurationUpdate.bind(this)),e.on("characteristic-warning",this.handleCharacteristicWarning.bind(this)),e.bridged=!0,e.bridge=this,this.bridgedAccessories.push(e),this.controllerStorage.linkAccessory(e),t||this.enqueueConfigurationUpdate(),e},t.prototype.addBridgedAccessories=function(e){var t,r;try{for(var i=o.__values(e),n=i.next();!n.done;n=i.next()){var a=n.value;this.addBridgedAccessory(a,!0)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.enqueueConfigurationUpdate()},t.prototype.removeBridgedAccessory=function(e,t){void 0===t&&(t=!1);var r=this.bridgedAccessories.indexOf(e);if(-1===r)throw new Error("Cannot find the bridged Accessory to remove.");this.bridgedAccessories.splice(r,1),e.bridged=!1,e.bridge=void 0,e.removeAllListeners(),t||this.enqueueConfigurationUpdate()},t.prototype.removeBridgedAccessories=function(e){var t,r;try{for(var i=o.__values(e),n=i.next();!n.done;n=i.next()){var a=n.value;this.removeBridgedAccessory(a,!0)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.enqueueConfigurationUpdate()},t.prototype.removeAllBridgedAccessories=function(){for(var e=this.bridgedAccessories.length-1;e>=0;e--)this.removeBridgedAccessory(this.bridgedAccessories[e],!0);this.enqueueConfigurationUpdate()},t.prototype.getCharacteristicByIID=function(e){var t,r;try{for(var i=o.__values(this.services),n=i.next();!n.done;n=i.next()){var a=n.value.getCharacteristicByIID(e);if(a)return a}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getAccessoryByAID=function(e){return this.aid===e?this:this.bridgedAccessories.find((function(t){return t.aid===e}))},t.prototype.findCharacteristic=function(e,t){var r=this.getAccessoryByAID(e);return r&&r.getCharacteristicByIID(t)},t.prototype.configureCameraSource=function(e){var t=this;if(0===e.streamControllers.length)throw new Error("Malformed legacy CameraSource. Did not expose any StreamControllers!");var r=e.streamControllers[0].options,i={cameraStreamCount:e.streamControllers.length,streamingOptions:r,delegate:new d.LegacyCameraSourceAdapter(e)},n=new f.CameraController(i,!0);return this.configureController(n),e.services.forEach((function(e){e.UUID!==C.Service.CameraRTPStreamManagement.UUID&&e.UUID!==C.Service.CameraOperatingMode.UUID&&e.UUID!==C.Service.CameraRecordingManagement.UUID&&t.addService(e)})),e.streamControllers=n.streamManagements,n},t.prototype.configureController=function(e){var t=this,r="function"==typeof e?new e:e,i=r.controllerId();if(this.controllers[i])throw new Error("A Controller with the type/id '".concat(i,"' was already added to the accessory ").concat(this.displayName));var n,o=this.serializedControllers&&this.serializedControllers[i];if(o){var a=(0,S.clone)(o),s=r.initWithServices(o);n=s||o,s&&this.handleUpdatedControllerServiceMap(a,s),r.configureServices(),delete this.serializedControllers[i],0===Object.entries(this.serializedControllers).length&&(this.serializedControllers=void 0)}else n=r.constructServices(),r.configureServices(),Object.values(n).forEach((function(e){e&&!t.services.includes(e)&&t.addService(e)}));var c={controller:r,serviceMap:n};(0,f.isSerializableController)(r)&&this.controllerStorage.trackController(r),this.controllers[i]=c,r instanceof f.CameraController&&(this.activeCameraController=r)},t.prototype.removeController=function(e){var t=this,r=e.controllerId(),i=this.controllers[r];if(i){if(i.controller!==e)throw new Error("["+this.displayName+"] tried removing a controller with the id/type '"+r+"' though provided controller isn't the same instance that is registered!");(0,f.isSerializableController)(e)&&this.controllerStorage.untrackController(e),e.handleFactoryReset&&e.handleFactoryReset(),e.handleControllerRemoved(),delete this.controllers[r],this.activeCameraController===e&&(this.activeCameraController=void 0),Object.values(i.serviceMap).forEach((function(e){e&&t.removeService(e)}))}this.serializedControllers&&delete this.serializedControllers[r]},t.prototype.handleAccessoryUnpairedForControllers=function(){var e,t;try{for(var r=o.__values(Object.values(this.controllers)),i=r.next();!i.done;i=r.next()){var n=i.value.controller;n.handleFactoryReset&&n.handleFactoryReset(),(0,f.isSerializableController)(n)&&this.controllerStorage.purgeControllerData(n)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.handleUpdatedControllerServiceMap=function(e,t){var r=this;t=(0,S.clone)(t),Object.keys(e).forEach((function(i){var n=e[i],o=t[i];n&&o&&(delete e[i],delete t[i],n!==o&&(r.removeService(n),r.addService(o)))})),Object.values(e).forEach((function(e){e&&r.removeService(e)})),Object.values(t).forEach((function(e){e&&r.addService(e)}))},t.prototype.setupURI=function(){if(this._setupURI)return this._setupURI;(0,a.default)(!!this._accessoryInfo,"Cannot generate setupURI on an accessory that isn't published yet!");var e=Buffer.alloc(8),t=parseInt(this._accessoryInfo.pincode.replace(/-/g,""),10),r=this._accessoryInfo.category>>1;t|=1<<28,e.writeUInt32BE(t,4),1&this._accessoryInfo.category&&(e[4]=128|e[4]),e.writeUInt32BE(r,0);var i=(e.readUInt32BE(4)+4294967296*e.readUInt32BE(0)).toString(36).toUpperCase();if(9!==i.length)for(var n=0;n<=9-i.length;n++)i="0"+i;return this._setupURI="X-HM://"+i+this._setupID,this._setupURI},t.prototype.validateAccessory=function(e){var t=this,r=this.getService(C.Service.AccessoryInformation);if(r){var i=function(e,r){r||console.log("HAP-NodeJS WARNING: The accessory '"+t.displayName+"' is getting published with the characteristic '"+e+"' (of the AccessoryInformation service) not having a value set. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!")},n=r.getCharacteristic(p.Characteristic.Model).value,o=r.getCharacteristic(p.Characteristic.SerialNumber).value,s=r.getCharacteristic(p.Characteristic.FirmwareRevision).value,c=r.getCharacteristic(p.Characteristic.Name).value;i("Model",n),i("SerialNumber",o),i("FirmwareRevision",s),i("Name",c)}else console.log("HAP-NodeJS WARNING: The accessory '"+this.displayName+"' is getting published without a AccessoryInformation service. This might prevent the accessory from being added to the Home app or leading to the accessory being unresponsive!");e&&(0,a.default)(Buffer.from(this.displayName,"utf8").length<=63,"Accessory displayName cannot be longer than 63 bytes!"),this.bridged&&this.bridgedAccessories.forEach((function(e){return e.validateAccessory()}))},t.prototype._assignIDs=function(e){var t,r,i,n;this._identifierCache&&this.shouldPurgeUnusedIDs&&this._identifierCache.startTrackingUsage(),this.bridged?this.aid=e.getAID(this.UUID):this.aid=1;try{for(var a=o.__values(this.services),s=a.next();!s.done;s=a.next()){var c=s.value;this._isBridge?c._assignIDs(e,this.UUID,2e9):c._assignIDs(e,this.UUID)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}try{for(var u=o.__values(this.bridgedAccessories),l=u.next();!l.done;l=u.next()){l.value._assignIDs(e)}}catch(e){i={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}this._identifierCache&&(this.shouldPurgeUnusedIDs&&this._identifierCache.stopTrackingUsageAndExpireUnused(),this._identifierCache.save())},t.prototype.disableUnusedIDPurge=function(){this.shouldPurgeUnusedIDs=!1},t.prototype.enableUnusedIDPurge=function(){this.shouldPurgeUnusedIDs=!0},t.prototype.purgeUnusedIDs=function(){var e=this.shouldPurgeUnusedIDs;this.shouldPurgeUnusedIDs=!0,this._assignIDs(this._identifierCache),this.shouldPurgeUnusedIDs=e},t.prototype.toHAP=function(e,t){return void 0===t&&(t=!0),o.__awaiter(this,void 0,void 0,(function(){var r,i,n,s,c,u;return o.__generator(this,(function(l){switch(l.label){case 0:return(0,a.default)(this.aid,"aid cannot be undefined for accessory '"+this.displayName+"'"),(0,a.default)(this.services.length,"accessory '"+this.displayName+"' does not have any services!"),u={aid:this.aid},[4,Promise.all(this.services.map((function(r){return r.toHAP(e,t)})))];case 1:return u.services=l.sent(),r=[u],this.bridged?[3,3]:(n=(i=r.push).apply,s=[r],c=[[]],[4,Promise.all(this.bridgedAccessories.map((function(r){return r.toHAP(e,t).then((function(e){return e[0]}))})))]);case 2:n.apply(i,s.concat([o.__spreadArray.apply(void 0,c.concat([o.__read.apply(void 0,[l.sent()]),!1]))])),l.label=3;case 3:return[2,r]}}))}))},t.prototype.internalHAPRepresentation=function(e){var t,r;void 0===e&&(e=!0),e&&this._assignIDs(this._identifierCache),(0,a.default)(this.aid,"aid cannot be undefined for accessory '"+this.displayName+"'"),(0,a.default)(this.services.length,"accessory '"+this.displayName+"' does not have any services!");var i=[{aid:this.aid,services:this.services.map((function(e){return e.internalHAPRepresentation()}))}];if(!this.bridged)try{for(var n=o.__values(this.bridgedAccessories),s=n.next();!s.done;s=n.next()){var c=s.value;i.push(c.internalHAPRepresentation(!1)[0])}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},t.prototype.publish=function(e,r){var i,n,a;return o.__awaiter(this,void 0,void 0,(function(){var c,u,l,d,f,v,S,E=this;return o.__generator(this,(function(o){switch(o.label){case 0:if(this.bridged)throw new Error("Can't publish in accessory which is bridged by another accessory. Bridged by "+(null===(i=this.bridge)||void 0===i?void 0:i.displayName));return e.advertiser||null==e.useLegacyAdvertiser||(e.advertiser=e.useLegacyAdvertiser?"bonjour-hap":"ciao",console.warn('DEPRECATED The PublishInfo.useLegacyAdvertiser option has been removed. Please use the PublishInfo.advertiser property to enable "ciao" (useLegacyAdvertiser=false) or "bonjour-hap" (useLegacyAdvertiser=true) mdns advertiser libraries!')),e.mdns&&"bonjour-hap"!==e.advertiser&&console.log("DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. Please move to the new 'bind' option."),(c=this.getService(C.Service.ProtocolInformation))||(c=this.addService(C.Service.ProtocolInformation)),c.setCharacteristic(p.Characteristic.Version,h.CiaoAdvertiser.protocolVersionService),this.lastKnownUsername&&this.lastKnownUsername!==e.username&&t.cleanupAccessoryData(this.lastKnownUsername),this.initialized||null!==(n=e.addIdentifyingMaterial)&&void 0!==n&&!n||(this.displayName=this.displayName+" "+s.default.createHash("sha512").update(e.username,"utf8").digest("hex").slice(0,4).toUpperCase(),this.getService(C.Service.AccessoryInformation).updateCharacteristic(p.Characteristic.Name,this.displayName)),this._accessoryInfo=g.AccessoryInfo.load(e.username),this._accessoryInfo||(A("[%s] Creating new AccessoryInfo for our HAP server",this.displayName),this._accessoryInfo=g.AccessoryInfo.create(e.username)),e.setupID?this._setupID=e.setupID:void 0===this._accessoryInfo.setupID||""===this._accessoryInfo.setupID?this._setupID=t._generateSetupID():this._setupID=this._accessoryInfo.setupID,this._accessoryInfo.setupID=this._setupID,this._accessoryInfo.displayName=this.displayName,this._accessoryInfo.model=this.getService(C.Service.AccessoryInformation).getCharacteristic(p.Characteristic.Model).value,this._accessoryInfo.category=e.category||1,this._accessoryInfo.pincode=e.pincode,this._accessoryInfo.save(),this._identifierCache=y.IdentifierCache.load(e.username),this._identifierCache||(A("[%s] Creating new IdentifierCache",this.displayName),this._identifierCache=new y.IdentifierCache(e.username)),this._isBridge&&0===this.bridgedAccessories.length&&(this.disableUnusedIDPurge(),this.controllerStorage.purgeUnidentifiedAccessoryData=!1),this.initialized||this.controllerStorage.load(e.username),this._assignIDs(this._identifierCache),u=this.internalHAPRepresentation(!1),this._accessoryInfo.checkForCurrentConfigurationNumberIncrement(u,!0),this.validateAccessory(!0),l=t.parseBindOption(e),d=null!==(a=e.advertiser)&&void 0!==a?a:"bonjour-hap",(v="avahi"===e.advertiser)?[4,h.AvahiAdvertiser.isAvailable()]:[3,2];case 1:v=!o.sent(),o.label=2;case 2:return(f=v)?[3,5]:(S="resolved"===e.advertiser)?[4,h.ResolvedAdvertiser.isAvailable()]:[3,4];case 3:S=!o.sent(),o.label=4;case 4:f=S,o.label=5;case 5:switch(f&&(console.error("[".concat(this.displayName,'] The selected advertiser, "').concat(e.advertiser,"\", isn't available on this platform. ")+'Reverting to "'.concat("bonjour-hap",'"')),d="bonjour-hap"),d){case"ciao":this._advertiser=new h.CiaoAdvertiser(this._accessoryInfo,{interface:l.advertiserAddress},{restrictedAddresses:l.serviceRestrictedAddress,disabledIpv6:l.serviceDisableIpv6});break;case"bonjour-hap":this._advertiser=new h.BonjourHAPAdvertiser(this._accessoryInfo,e.mdns,{restrictedAddresses:l.serviceRestrictedAddress,disabledIpv6:l.serviceDisableIpv6});break;case"avahi":this._advertiser=new h.AvahiAdvertiser(this._accessoryInfo);break;case"resolved":this._advertiser=new h.ResolvedAdvertiser(this._accessoryInfo);break;default:throw new Error("Unsupported advertiser setting: '"+e.advertiser+"'")}return this._advertiser.on("updated-name",(function(e){E.displayName=e,E._accessoryInfo&&(E._accessoryInfo.displayName=e,E._accessoryInfo.save()),E.getService(C.Service.AccessoryInformation).updateCharacteristic(p.Characteristic.Name,e)})),this._server=new m.HAPServer(this._accessoryInfo),this._server.allowInsecureRequest=!!r,this._server.on("listening",this.onListening.bind(this)),this._server.on("identify",this.identificationRequest.bind(this,!1)),this._server.on("pair",this.handleInitialPairSetupFinished.bind(this)),this._server.on("add-pairing",this.handleAddPairing.bind(this)),this._server.on("remove-pairing",this.handleRemovePairing.bind(this)),this._server.on("list-pairings",this.handleListPairings.bind(this)),this._server.on("accessories",this.handleAccessories.bind(this)),this._server.on("get-characteristics",this.handleGetCharacteristics.bind(this)),this._server.on("set-characteristics",this.handleSetCharacteristics.bind(this)),this._server.on("connection-closed",this.handleHAPConnectionClosed.bind(this)),this._server.on("request-resource",this.handleResource.bind(this)),this._server.listen(e.port,l.serverAddress),this.initialized=!0,[2]}}))}))},t.prototype.destroy=function(){var e=this.unpublish();return this._accessoryInfo&&(t.cleanupAccessoryData(this._accessoryInfo.username),this._accessoryInfo=void 0,this._identifierCache=void 0,this.controllerStorage=new v.ControllerStorage(this)),this.removeAllListeners(),e},t.prototype.unpublish=function(){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(e){switch(e.label){case 0:return this._server&&(this._server.destroy(),this._server=void 0),this._advertiser?[4,this._advertiser.destroy()]:[3,2];case 1:e.sent(),this._advertiser=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.enqueueConfigurationUpdate=function(){var e=this;this.configurationChangeDebounceTimeout||(this.configurationChangeDebounceTimeout=setTimeout((function(){var t;if(e.configurationChangeDebounceTimeout=void 0,e._advertiser&&e._advertiser){var r=e.internalHAPRepresentation();(null===(t=e._accessoryInfo)||void 0===t?void 0:t.checkForCurrentConfigurationNumberIncrement(r))&&e._advertiser.updateAdvertisement()}}),1e3),this.configurationChangeDebounceTimeout.unref())},t.prototype.onListening=function(e,t){var r=this;(0,a.default)(this._advertiser,"Advertiser wasn't created at onListening!"),this._advertiser.initPort(e),this._advertiser.startAdvertising().then((function(){return r.emit("advertised")})).catch((function(e){console.error("Could not create mDNS advertisement. The HAP-Server won't be discoverable: "+e),e.stack&&A("Detailed error: "+e.stack)})),this.emit("listening",e,t)},t.prototype.handleInitialPairSetupFinished=function(e,t,r){A("[%s] Paired with client %s",this.displayName,e),this._accessoryInfo&&this._accessoryInfo.addPairedClient(e,t,1),this._accessoryInfo&&this._accessoryInfo.save(),this._advertiser&&this._advertiser.updateAdvertisement(),r(),this.emit("paired")},t.prototype.handleAddPairing=function(e,t,r,i,n){if(this._accessoryInfo)if(this._accessoryInfo.hasAdminPermissions(e.username)){var o=this._accessoryInfo.getClientPublicKey(t);if(o){if(o.toString()!==r.toString())return void n(1);this._accessoryInfo.updatePermission(t,i)}else this._accessoryInfo.addPairedClient(t,r,i);this._accessoryInfo.save(),n(0)}else n(2);else n(6)},t.prototype.handleRemovePairing=function(e,t,r){var i,n;if(this._accessoryInfo)if(this._accessoryInfo.hasAdminPermissions(e.username)){if(this._accessoryInfo.removePairedClient(e,t),this._accessoryInfo.save(),r(0),!this._accessoryInfo.paired()){this._advertiser&&this._advertiser.updateAdvertisement(),this.emit("unpaired"),this.handleAccessoryUnpairedForControllers();try{for(var a=o.__values(this.bridgedAccessories),s=a.next();!s.done;s=a.next()){s.value.handleAccessoryUnpairedForControllers()}}catch(e){i={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}}}else r(2);else r(6)},t.prototype.handleListPairings=function(e,t){this._accessoryInfo?this._accessoryInfo.hasAdminPermissions(e.username)?t(0,this._accessoryInfo.listPairings()):t(2):t(6)},t.prototype.handleAccessories=function(e,t){var r=this;this._assignIDs(this._identifierCache);var i=Date.now(),n=i-this.lastAccessoriesRequest>5e3;this.lastAccessoriesRequest=i,this.toHAP(e,n).then((function(e){t(void 0,{accessories:e})}),(function(e){console.error("["+r.displayName+"] /accessories request error with: "+e.stack),t({httpCode:500,status:-70402})}))},t.prototype.handleGetCharacteristics=function(e,r,i){var n,a,s=this,c=[],u={characteristics:c},l=new Set(r.ids.map((function(e){return e.aid+"."+e.iid})));if(l.size===r.ids.length){var h=setTimeout((function(){var e,r;try{for(var n=o.__values(l),a=n.next();!a.done;a=n.next()){var d=a.value.split("."),p=parseInt(d[0],10),f=parseInt(d[1],10),m=s.getAccessoryByAID(p),g=m.getCharacteristicByIID(f);s.sendCharacteristicWarning(g,"slow-read","The read handler for the characteristic '"+g.displayName+"' on the accessory '"+m.displayName+"' was slow to respond!")}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}h=setTimeout((function(){var e,t;h=void 0;try{for(var r=o.__values(l),n=r.next();!n.done;n=r.next()){var a=n.value.split("."),d=parseInt(a[0],10),p=parseInt(a[1],10),f=s.getAccessoryByAID(d),m=f.getCharacteristicByIID(p);s.sendCharacteristicWarning(m,"timeout-read","The read handler for the characteristic '"+m.displayName+"' on the accessory '"+f.displayName+"' didn't respond at all!. Please check that you properly call the callback!"),c.push({aid:d,iid:p,status:-70408})}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}l.clear(),i(void 0,u)}),t.TIMEOUT_AFTER_WARNING),h.unref()}),t.TIMEOUT_WARNING);h.unref();var d=function(t){var n=t.aid+"."+t.iid;p.handleCharacteristicRead(e,t,r).then((function(e){return o.__assign({aid:t.aid,iid:t.iid},e)}),(function(e){return console.error("[".concat(s.displayName,"] Read request for characteristic ").concat(n," encountered an error: ").concat(e.stack)),{aid:t.aid,iid:t.iid,status:-70402}})).then((function(e){h&&(l.delete(n),c.push(e),0===l.size&&(h&&(clearTimeout(h),h=void 0),i(void 0,u)))}))},p=this;try{for(var f=o.__values(r.ids),m=f.next();!m.done;m=f.next()){d(m.value)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}}else i({httpCode:422,status:-70410})},t.prototype.handleCharacteristicRead=function(e,t,r){return o.__awaiter(this,void 0,void 0,(function(){var i,n,a=this;return o.__generator(this,(function(o){return(i=this.findCharacteristic(t.aid,t.iid))?i.props.perms.includes("pr")?i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(0)&&((n=this._accessoryInfo&&e.username)||A("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for reading (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!n||!this._accessoryInfo.hasAdminPermissions(e.username))?[2,{status:-70401}]:[2,i.handleGetRequest(e).then((function(n){n=(0,E.formatOutgoingCharacteristicValue)(n,i.props),A('[%s] Got Characteristic "%s" value: "%s"',a.displayName,i.displayName,n);var o={value:null==n?null:n};return r.includeMeta&&(o.format=i.props.format,o.unit=i.props.unit,o.minValue=i.props.minValue,o.maxValue=i.props.maxValue,o.minStep=i.props.minStep,o.maxLen=i.props.maxLen||i.props.maxDataLen),r.includePerms&&(o.perms=i.props.perms),r.includeType&&(o.type=(0,T.toShortForm)(i.UUID)),r.includeEvent&&(o.ev=e.hasEventNotifications(t.aid,t.iid)),o}),(function(e){return A('[%s] Error getting value for characteristic "%s": %s',a.displayName,i.displayName,m.HAPStatus[e]),{status:e}}))]:(A("[%s] Tried reading from characteristic which does not allow reading (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70405}]):(A("[%s] Could not find a Characteristic with aid of %s and iid of %s",this.displayName,t.aid,t.iid),[2,{status:-70410}])}))}))},t.prototype.handleSetCharacteristics=function(e,r,i){var n,a,s=this;A("[%s] Processing characteristic set: %s",this.displayName,JSON.stringify(r));var c=0;void 0!==r.pid&&(e.timedWritePid===r.pid?(c=1,clearTimeout(e.timedWriteTimeout),e.timedWritePid=void 0,e.timedWriteTimeout=void 0,A("[%s] Timed write request got acknowledged for pid %d",this.displayName,r.pid)):(c=2,A("[%s] TTL for timed write request has probably expired for pid %d",this.displayName,r.pid)));var u=[],l={characteristics:u},h=new Set(r.characteristics.map((function(e){return e.aid+"."+e.iid})));if(h.size===r.characteristics.length){var d=setTimeout((function(){var e,r;try{for(var n=o.__values(h),a=n.next();!a.done;a=n.next()){var c=a.value.split("."),p=parseInt(c[0],10),f=parseInt(c[1],10),m=s.getAccessoryByAID(p),g=m.getCharacteristicByIID(f);s.sendCharacteristicWarning(g,"slow-write","The write handler for the characteristic '"+g.displayName+"' on the accessory '"+m.displayName+"' was slow to respond!")}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}d=setTimeout((function(){var e,t;d=void 0;try{for(var r=o.__values(h),n=r.next();!n.done;n=r.next()){var a=n.value.split("."),c=parseInt(a[0],10),p=parseInt(a[1],10),f=s.getAccessoryByAID(c),m=f.getCharacteristicByIID(p);s.sendCharacteristicWarning(m,"timeout-write","The write handler for the characteristic '"+m.displayName+"' on the accessory '"+f.displayName+"' didn't respond at all!. Please check that you properly call the callback!"),u.push({aid:c,iid:p,status:-70408})}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}h.clear(),i(void 0,l)}),t.TIMEOUT_AFTER_WARNING),d.unref()}),t.TIMEOUT_WARNING);d.unref();var p=function(t){var r=t.aid+"."+t.iid;f.handleCharacteristicWrite(e,t,c).then((function(e){return o.__assign({aid:t.aid,iid:t.iid},e)}),(function(e){return console.error("[".concat(s.displayName,"] Write request for characteristic ").concat(r," encountered an error: ").concat(e.stack)),{aid:t.aid,iid:t.iid,status:-70402}})).then((function(e){d&&(h.delete(r),u.push(e),0===h.size&&(d&&(clearTimeout(d),d=void 0),i(void 0,l)))}))},f=this;try{for(var m=o.__values(r.characteristics),g=m.next();!g.done;g=m.next()){p(g.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(a=m.return)&&a.call(m)}finally{if(n)throw n.error}}}else i({httpCode:422,status:-70410})},t.prototype.handleCharacteristicWrite=function(e,t,r){return o.__awaiter(this,void 0,void 0,(function(){var i,n,a,s,c=this;return o.__generator(this,(function(o){if(!(i=this.findCharacteristic(t.aid,t.iid)))return A("[%s] Could not find a Characteristic with aid of %s and iid of %s",this.displayName,t.aid,t.iid),[2,{status:-70410}];if(2===r)return[2,{status:-70410}];if(null==t.ev&&null==t.value)return[2,{status:-70410}];if(null!=t.ev){if(!i.props.perms.includes("ev"))return A("[%s] Tried %s notifications for Characteristic which does not allow notify (aid of %s and iid of %s)",this.displayName,t.ev?"enabling":"disabling",t.aid,t.iid),[2,{status:-70406}];if(i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(2)&&((a=e.username&&this._accessoryInfo)||A("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for notify (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!a||!this._accessoryInfo.hasAdminPermissions(e.username)))return[2,{status:-70401}];n=e.hasEventNotifications(t.aid,t.iid),t.ev&&!n?(e.enableEventNotifications(t.aid,t.iid),i.subscribe(),A('[%s] Registered Characteristic "%s" on "%s" for events',e.remoteAddress,i.displayName,this.displayName)):!t.ev&&n&&(i.unsubscribe(),e.disableEventNotifications(t.aid,t.iid),A('[%s] Unregistered Characteristic "%s" on "%s" for events',e.remoteAddress,i.displayName,this.displayName))}if(null!=t.value){if(!i.props.perms.includes("pw"))return A("[%s] Tried writing to Characteristic which does not allow writing (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70404}];if(i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(1)&&((a=e.username&&this._accessoryInfo)||A("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for write (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!a||!this._accessoryInfo.hasAdminPermissions(e.username)))return[2,{status:-70401}];if(i.props.perms.includes("aa")&&i.additionalAuthorizationHandler){s=void 0;try{s=i.additionalAuthorizationHandler(t.authData)}catch(e){console.warn("["+this.displayName+"] Additional authorization handler has thrown an error when checking authData: "+e.stack),s=!1}if(!s)return[2,{status:-70411}]}return i.props.perms.includes("tw")&&1!==r?(A("[%s] Tried writing to a timed write only Characteristic without properly preparing (iid of %s and aid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70410}]):[2,i.handleSetRequest(t.value,e).then((function(e){return A('[%s] Setting Characteristic "%s" to value %s',c.displayName,i.displayName,t.value),{value:t.r&&e?(0,E.formatOutgoingCharacteristicValue)(e,i.props):void 0,status:0}}),(function(e){return A('[%s] Error setting Characteristic "%s" to value %s: ',c.displayName,i.displayName,t.value,m.HAPStatus[e]),{status:e}}))]}return[2,{status:0}]}))}))},t.prototype.handleResource=function(e,t){var r;if("image"===e["resource-type"]){var i=e.aid,n=void 0,o=void 0;return i?(n=this.getAccessoryByAID(i))&&n.activeCameraController&&(o=n.activeCameraController):this.activeCameraController&&(n=this,o=this.activeCameraController),o?void o.handleSnapshotRequest(e["image-height"],e["image-width"],null==n?void 0:n.displayName,e.reason).then((function(e){t(void 0,e)}),(function(e){t({httpCode:207,status:e})})):(A("[%s] received snapshot request though no camera controller was associated!"),void t({httpCode:404,status:-70409}))}A("[%s] received request for unsupported image type: "+e["resource-type"],null===(r=this._accessoryInfo)||void 0===r?void 0:r.username),t({httpCode:404,status:-70409})},t.prototype.handleHAPConnectionClosed=function(e){var t,r;this.activeCameraController&&this.activeCameraController.handleCloseConnection(e.sessionID);try{for(var i=o.__values(e.getRegisteredEvents()),n=i.next();!n.done;n=i.next()){var a=n.value.split("."),s=parseInt(a[0],10),c=parseInt(a[1],10),u=this.findCharacteristic(s,c);u&&u.unsubscribe()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.clearRegisteredEvents()},t.prototype.handleServiceConfigurationChangeEvent=function(e){e.isPrimaryService||e!==this.primaryService?e.isPrimaryService&&e!==this.primaryService&&(void 0!==this.primaryService&&(this.primaryService.isPrimaryService=!1),this.primaryService=e):this.primaryService=void 0,this.bridged?this.emit("service-configurationChange",{service:e}):this.enqueueConfigurationUpdate()},t.prototype.handleCharacteristicChangeEvent=function(e,t,r){if(this.bridged)this.emit("service-characteristic-change",o.__assign(o.__assign({},r),{service:t}));else{if(!this._server)return;if(null==e.aid||null==r.characteristic.iid)return void A("[%s] Muting event notification for %s as ids aren't yet assigned!",e.displayName,r.characteristic.displayName);if(null!=r.context&&"object"==typeof r.context&&r.context.omitEventUpdate)return void A("[%s] Omitting event updates for %s as specified in the context object!",e.displayName,r.characteristic.displayName);if("event"!==r.reason&&r.oldValue===r.newValue&&r.characteristic.UUID!==p.Characteristic.ProgrammableSwitchEvent.UUID&&r.characteristic.UUID!==p.Characteristic.ButtonEvent.UUID)return;var i=r.characteristic.UUID,n=i===p.Characteristic.ButtonEvent.UUID||i===p.Characteristic.ProgrammableSwitchEvent.UUID||i===p.Characteristic.MotionDetected.UUID||i===p.Characteristic.ContactSensorState.UUID,a=(0,E.formatOutgoingCharacteristicValue)(r.newValue,r.characteristic.props);this._server.sendEventNotifications(e.aid,r.characteristic.iid,a,r.originator,n)}},t.prototype.sendCharacteristicWarning=function(e,t,r){this.handleCharacteristicWarning({characteristic:e,type:t,message:r,originatorChain:[e.displayName],stack:(new Error).stack})},t.prototype.handleCharacteristicWarning=function(e){var t;if(e.originatorChain=o.__spreadArray([this.displayName],o.__read(e.originatorChain),!1),!this.emit("characteristic-warning",e)){var r="[".concat(e.originatorChain.join("@"),"] ").concat(e.message);"error-message"===e.type||"timeout-read"===e.type||"timeout-write"===e.type?console.error(r):console.warn(r),A("[%s] Above characteristic warning was thrown at: %s",this.displayName,null!==(t=e.stack)&&void 0!==t?t:"unknown")}},t.prototype.setupServiceEventHandlers=function(e){e.on("service-configurationChange",this.handleServiceConfigurationChangeEvent.bind(this,e)),e.on("characteristic-change",this.handleCharacteristicChangeEvent.bind(this,this,e)),e.on("characteristic-warning",this.handleCharacteristicWarning.bind(this))},t.prototype._sideloadServices=function(e){var t,r,i=this;try{for(var n=o.__values(e),a=n.next();!a.done;a=n.next()){var s=a.value;this.setupServiceEventHandlers(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.services=e.slice(),this.getService(C.Service.AccessoryInformation).getCharacteristic(p.Characteristic.Identify).on("set",(function(e,t){if(e){i.identificationRequest(!0,t)}}))},t._generateSetupID=function(){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",t="",r=0;r<4;r++){var i=Math.floor(36*Math.random());t+=e.charAt(i)}return t},t.serialize=function(e){var r={displayName:e.displayName,UUID:e.UUID,lastKnownUsername:e._accessoryInfo?e._accessoryInfo.username:void 0,category:e.category,services:[]},i={},n=!1;e.services.forEach((function(e){r.services.push(C.Service.serialize(e));var t=[];e.linkedServices.forEach((function(e){t.push(e.getServiceId())})),t.length>0&&(i[e.getServiceId()]=t,n=!0)})),n&&(r.linkedServices=i);var a=[];return Object.values(e.controllers).forEach((function(e){a.push({type:e.controller.controllerId(),services:t.serializeServiceMap(e.serviceMap)})})),e.serializedControllers&&Object.entries(e.serializedControllers).forEach((function(e){var r=o.__read(e,2),i=r[0],n=r[1];a.push({type:i,services:t.serializeServiceMap(n)})})),a.length>0&&(r.controllers=a),r},t.deserialize=function(e){var r,i,n=new t(e.displayName,e.UUID);n.lastKnownUsername=e.lastKnownUsername,n.category=e.category;var a=[],s={};if(e.services.forEach((function(e){var t=C.Service.deserialize(e);a.push(t),s[t.getServiceId()]=t})),e.linkedServices){var c=function(e,t){var r=s[e];if(!r)return"continue";t.forEach((function(e){var t=s[e];t&&r.addLinkedService(t)}))};try{for(var u=o.__values(Object.entries(e.linkedServices)),l=u.next();!l.done;l=u.next()){var h=o.__read(l.value,2);c(h[0],h[1])}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}return e.controllers&&(n.serializedControllers={},e.controllers.forEach((function(e){n.serializedControllers[e.type]=t.deserializeServiceMap(e.services,s)}))),n._sideloadServices(a),n},t.cleanupAccessoryData=function(e){y.IdentifierCache.remove(e),g.AccessoryInfo.remove(e),v.ControllerStorage.remove(e)},t.serializeServiceMap=function(e){var t={};return Object.entries(e).forEach((function(e){var r=o.__read(e,2),i=r[0],n=r[1];n&&(t[i]=n.getServiceId())})),t},t.deserializeServiceMap=function(e,t){var r={};return Object.entries(e).forEach((function(e){var i=o.__read(e,2),n=i[0],a=i[1],s=t[a];s&&(r[n]=s)})),r},t.parseBindOption=function(e){var t,r,i=void 0,n=void 0,a=void 0;if(e.bind){var s=new Set(Array.isArray(e.bind)?e.bind:[e.bind]);if(s.has("::"))a="::",s.delete("::"),s.size&&(i=Array.from(s));else if(s.has("0.0.0.0"))n=!0,a="0.0.0.0",s.delete("0.0.0.0"),s.size&&(i=Array.from(s));else if(1===s.size){i=Array.from(s);var c=s.values().next().value;a=(p=l.default.isIP(c))&&4===p?"0.0.0.0":"::"}else if(s.size>1){i=Array.from(s);var u=!1;try{for(var h=o.__values(s),d=h.next();!d.done;d=h.next()){var p;c=d.value;if(0===(p=l.default.isIP(c))||6===p){u=!0;break}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}a=u?"::":"0.0.0.0"}}return{advertiserAddress:i,serviceRestrictedAddress:i,serviceDisableIpv6:n,serverAddress:a}},t.Categories=i,t.TIMEOUT_WARNING=3e3,t.TIMEOUT_AFTER_WARNING=6e3,t}(u.EventEmitter);t.Accessory=I},1370:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadDirectory=t.parseAccessoryJSON=t.parseServiceJSON=t.parseCharacteristicJSON=void 0;var i=r(1635),n=i.__importDefault(r(5753)),o=i.__importDefault(r(9896)),a=i.__importDefault(r(6928)),s=r(5745),c=r(9826),u=r(5876),l=i.__importStar(r(2997)),h=(0,n.default)("HAP-NodeJS:AccessoryLoader");function d(e){var t=e.cType,r=new c.Characteristic(e.manfDescription||t,t,{format:e.format,minValue:e.designedMinValue,maxValue:e.designedMaxValue,minStep:e.designedMinStep,unit:e.unit,perms:e.perms});r.value=e.initialValue,r.locals=e.locals;var i=e.onUpdate,n=e.onRead,o=e.onRegister;return i&&r.on("set",(function(e,t){i(e),t&&t()})),n&&r.on("get",(function(e){n((function(t){e(null,t)}))})),o&&o(r),r}function p(e){var t=e.sType,r=[];e.characteristics.forEach((function(e){var t=d(e);r.push(t)}));var i=null;r.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"===e.UUID&&(i=e.value)}));var n=new u.Service(i||t,t,"".concat(i));return r.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"!==e.UUID&&n.addCharacteristic(e)})),n}function f(e){var t=[];e.services.forEach((function(e){var r=p(e);t.push(r)}));var r=e.displayName;t.forEach((function(e){"0000003E-0000-1000-8000-0026BB765291"===e.UUID&&e.characteristics.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"===e.UUID&&(r=e.value)}))}));var i=new s.Accessory(r,l.generate(r));return i.username=e.username,i.pincode=e.pincode,i.services.length=0,t.forEach((function(e){i.addService(e)})),i}t.parseCharacteristicJSON=d,t.parseServiceJSON=p,t.parseAccessoryJSON=f,t.loadDirectory=function(e){var t=[];return o.default.readdirSync(e).forEach((function(i){var n=i.split("_").pop();if("accessory.js"===n||"accessory.ts"===n){h("Parsing accessory: %s",i);var o=r(7506)(a.default.join(e,i)).accessory;t.push(o)}else if("accfactory.js"===n||"accfactory.ts"===n){h("Parsing accessory factory: %s",i);var s=r(7506)(a.default.join(e,i));t=t.concat(s)}})),t.map((function(e){return null==e?(console.log("Invalid accessory!"),!1):e instanceof s.Accessory?e:f(e)})).filter((function(e){return!!e}))}},310:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvedAdvertiser=t.AvahiAdvertiser=t.DBusInvokeError=t.BonjourHAPAdvertiser=t.CiaoAdvertiser=t.AdvertiserEvent=t.PairingFeatureFlag=t.StatusFlag=void 0;var i=r(1635),n=i.__importDefault(r(8318)),o=i.__importDefault(r(9640)),a=i.__importDefault(r(2613)),s=i.__importDefault(r(8404)),c=i.__importDefault(r(6982)),u=i.__importDefault(r(5753)),l=r(4434),h=r(4009),d=(0,u.default)("HAP-NodeJS:Advertiser");!function(e){e[e.NOT_PAIRED=1]="NOT_PAIRED",e[e.NOT_JOINED_WIFI=2]="NOT_JOINED_WIFI",e[e.PROBLEM_DETECTED=4]="PROBLEM_DETECTED"}(t.StatusFlag||(t.StatusFlag={})),function(e){e[e.SUPPORTS_HARDWARE_AUTHENTICATION=1]="SUPPORTS_HARDWARE_AUTHENTICATION",e[e.SUPPORTS_SOFTWARE_AUTHENTICATION=2]="SUPPORTS_SOFTWARE_AUTHENTICATION"}(t.PairingFeatureFlag||(t.PairingFeatureFlag={})),function(e){e.UPDATED_NAME="updated-name"}(t.AdvertiserEvent||(t.AdvertiserEvent={}));var p=function(e){function t(r,o,a){var s=e.call(this)||this;return s.accessoryInfo=r,s.setupHash=t.computeSetupHash(r),s.responder=n.default.getResponder(i.__assign({},o)),s.advertisedService=s.responder.createService(i.__assign({name:s.accessoryInfo.displayName,type:"hap",txt:t.createTxt(r,s.setupHash)},a)),s.advertisedService.on("name-change",s.emit.bind(s,"updated-name")),d("Preparing Advertiser for '".concat(s.accessoryInfo.displayName,"' using ciao backend!")),s}return i.__extends(t,e),t.prototype.initPort=function(e){this.advertisedService.updatePort(e)},t.prototype.startAdvertising=function(){return d("Starting to advertise '".concat(this.accessoryInfo.displayName,"' using ciao backend!")),this.advertisedService.advertise()},t.prototype.updateAdvertisement=function(e){var r=t.createTxt(this.accessoryInfo,this.setupHash);d("Updating txt record (txt: %o, silent: %d)",r,e),this.advertisedService.updateTxt(r,e)},t.prototype.destroy=function(){return i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(e){switch(e.label){case 0:return[4,this.responder.shutdown()];case 1:return e.sent(),this.removeAllListeners(),[2]}}))}))},t.createTxt=function(e,r){var n=[];return e.paired()||n.push(1),{"c#":e.getConfigVersion(),ff:t.ff(),id:e.username,md:e.model,pv:t.protocolVersion,"s#":1,sf:t.sf.apply(t,i.__spreadArray([],i.__read(n),!1)),ci:e.category,sh:r}},t.computeSetupHash=function(e){var t=c.default.createHash("sha512");return t.update(e.setupID+e.username.toUpperCase()),t.digest().slice(0,4).toString("base64")},t.ff=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bridge=void 0;var i=r(1635),n=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i._isBridge=!0,i}return i.__extends(t,e),t}(r(5745).Accessory);t.Bridge=n},9826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Characteristic=t.CharacteristicEventTypes=t.ChangeReason=t.Access=t.Perms=t.Units=t.Formats=void 0;var i,n,o,a=r(1635),s=a.__importDefault(r(2613)),c=a.__importDefault(r(5753)),u=r(4434),l=r(589),h=r(9621),d=r(8073),p=r(7739),f=r(8066),m=r(2997),g=(0,c.default)("HAP-NodeJS:Characteristic");!function(e){e.BOOL="bool",e.INT="int",e.FLOAT="float",e.STRING="string",e.UINT8="uint8",e.UINT16="uint16",e.UINT32="uint32",e.UINT64="uint64",e.DATA="data",e.TLV8="tlv8",e.ARRAY="array",e.DICTIONARY="dict"}(i=t.Formats||(t.Formats={})),function(e){e.CELSIUS="celsius",e.PERCENTAGE="percentage",e.ARC_DEGREE="arcdegrees",e.LUX="lux",e.SECONDS="seconds"}(n=t.Units||(t.Units={})),function(e){e.READ="pr",e.WRITE="pw",e.PAIRED_READ="pr",e.PAIRED_WRITE="pw",e.NOTIFY="ev",e.EVENTS="ev",e.ADDITIONAL_AUTHORIZATION="aa",e.TIMED_WRITE="tw",e.HIDDEN="hd",e.WRITE_RESPONSE="wr"}(o=t.Perms||(t.Perms={})),function(e){e[e.READ=0]="READ",e[e.WRITE=1]="WRITE",e[e.NOTIFY=2]="NOTIFY"}(t.Access||(t.Access={})),function(e){e.WRITE="write",e.UPDATE="update",e.READ="read",e.EVENT="event"}(t.ChangeReason||(t.ChangeReason={})),function(e){e.GET="get",e.SET="set",e.CHANGE="change",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e.CHARACTERISTIC_WARNING="characteristic-warning"}(t.CharacteristicEventTypes||(t.CharacteristicEventTypes={}));var v=function(){function e(e){(0,s.default)((0,f.isNumericFormat)(e.format),"Cannot instantiate valid values iterable when format is not numeric. Found "+e.format),this.props=e}return e.prototype[Symbol.iterator]=function(){var e,t,r,i,n,o,s,c,u;return a.__generator(this,(function(l){switch(l.label){case 0:if(!this.props.validValues)return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),e=a.__values(this.props.validValues),t=e.next(),l.label=2;case 2:return t.done?[3,5]:[4,t.value];case 3:l.sent(),l.label=4;case 4:return t=e.next(),[3,2];case 5:return[3,8];case 6:return r=l.sent(),c={error:r},[3,8];case 7:try{t&&!t.done&&(u=e.return)&&u.call(e)}finally{if(c)throw c.error}return[7];case 8:return[3,13];case 9:if(i=0,n=void 0,o=1,this.props.validValueRanges)i=this.props.validValueRanges[0],n=this.props.validValueRanges[1];else if(null!=this.props.minValue&&null!=this.props.maxValue)i=this.props.minValue,n=this.props.maxValue,null!=this.props.minStep&&(o=this.props.minStep);else{if(!(0,f.isUnsignedNumericFormat)(this.props.format))throw new Error("Could not find valid iterator strategy for props: "+JSON.stringify(this.props));n=(0,f.numericUpperBound)(this.props.format)}s=i,l.label=10;case 10:return s<=n?[4,s]:[3,13];case 11:l.sent(),l.label=12;case 12:return s+=o,[3,10];case 13:return[2]}}))},e}(),y=/^-?\d+$/;function C(e){var t=-70402;if(y.test(e.message)){var r=parseInt(e.message,10);(0,l.IsKnownHAPStatusError)(r)&&(t=r)}return t}function S(e,t){return null==e?t:null==t?e:Math.max(e,t)}function E(e,t){return null==e?t:null==t?e:Math.min(e,t)}var _=function(e){function t(t,r,i){var n=e.call(this)||this;return n.iid=null,n.value=null,n.status=null,n.statusCode=0,n.subscriptions=0,n.displayName=t,n.UUID=r,n.props={format:"int",perms:["ev"]},n.setProps(i||{}),n}return a.__extends(t,e),t.prototype.onGet=function(e){return"function"!=typeof e?(this.characteristicWarning(".onGet handler must be a function"),this):(this.getHandler=e,this)},t.prototype.removeOnGet=function(){return this.getHandler=void 0,this},t.prototype.onSet=function(e){return"function"!=typeof e?(this.characteristicWarning(".onSet handler must be a function"),this):(this.setHandler=e,this)},t.prototype.removeOnSet=function(){return this.setHandler=void 0,this},t.prototype.setProps=function(e){(0,s.default)(e,"props cannot be undefined when setting props");var r=!1;if(e.format&&(r=this.props.format!==e.format,this.props.format=e.format),e.perms&&((0,s.default)(e.perms.length>0,"characteristic prop perms cannot be empty array"),this.props.perms=e.perms),void 0!==e.unit&&(this.props.unit=null!=e.unit?e.unit:void 0),void 0!==e.description&&(this.props.description=null!=e.description?e.description:void 0),void 0!==e.minValue&&(null===e.minValue?e.minValue=void 0:(0,f.isNumericFormat)(this.props.format)?"number"==typeof e.minValue&&Number.isFinite(e.minValue)?e.minValue<(0,f.numericLowerBound)(this.props.format)?(this.characteristicWarning("Characteristic Property 'minValue' was set to "+e.minValue+", but for numeric format "+this.props.format+" minimum possible is "+(0,f.numericLowerBound)(this.props.format),"error-message"),e.minValue=(0,f.numericLowerBound)(this.props.format)):e.minValue>(0,f.numericUpperBound)(this.props.format)&&(this.characteristicWarning("Characteristic Property 'minValue' was set to "+e.minValue+", but for numeric format "+this.props.format+" maximum possible is "+(0,f.numericUpperBound)(this.props.format),"error-message"),e.minValue=(0,f.numericLowerBound)(this.props.format)):(this.characteristicWarning("Characteristic Property 'minValue' must be a finite number, received \"".concat(e.minValue,'" (').concat(typeof e.minValue,")"),"error-message"),e.minValue=void 0):(this.characteristicWarning("Characteristic Property 'minValue' can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message"),e.minValue=void 0),this.props.minValue=e.minValue),void 0!==e.maxValue&&(null===e.maxValue?e.maxValue=void 0:(0,f.isNumericFormat)(this.props.format)?"number"==typeof e.maxValue&&Number.isFinite(e.maxValue)?e.maxValue>(0,f.numericUpperBound)(this.props.format)?(this.characteristicWarning("Characteristic Property 'maxValue' was set to "+e.maxValue+", but for numeric format "+this.props.format+" maximum possible is "+(0,f.numericUpperBound)(this.props.format),"error-message"),e.maxValue=(0,f.numericUpperBound)(this.props.format)):e.maxValue<(0,f.numericLowerBound)(this.props.format)&&(this.characteristicWarning("Characteristic Property 'maxValue' was set to "+e.maxValue+", but for numeric format "+this.props.format+" minimum possible is "+(0,f.numericLowerBound)(this.props.format),"error-message"),e.maxValue=(0,f.numericUpperBound)(this.props.format)):(this.characteristicWarning("Characteristic Property 'maxValue' must be a finite number, received \"".concat(e.maxValue,'" (').concat(typeof e.maxValue,")"),"error-message"),e.maxValue=void 0):(this.characteristicWarning("Characteristic Property 'maxValue' can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message"),e.maxValue=void 0),this.props.maxValue=e.maxValue),void 0!==e.minStep&&(null===e.minStep?this.props.minStep=void 0:(0,f.isNumericFormat)(this.props.format)?(e.minStep<1&&(0,f.isIntegerNumericFormat)(this.props.format)&&this.characteristicWarning("Characteristic Property `minStep` was set to a value lower than 1, this will have no effect on format `"+this.props.format),this.props.minStep=e.minStep):this.characteristicWarning("Characteristic Property `minStep` can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message")),void 0!==e.maxLen&&(null===e.maxLen?this.props.maxLen=void 0:"string"!==this.props.format?this.characteristicWarning("Characteristic Property `maxLen` can only be set for characteristics with format `STRING`, but not for "+this.props.format,"error-message"):(e.maxLen>256&&(this.characteristicWarning("Characteristic Property string `maxLen` cannot be bigger than 256"),e.maxLen=256),this.props.maxLen=e.maxLen)),void 0!==e.maxDataLen&&(null===e.maxDataLen?this.props.maxDataLen=void 0:"data"!==this.props.format?this.characteristicWarning("Characteristic Property `maxDataLen` can only be set for characteristics with format `DATA`, but not for "+this.props.format,"error-message"):this.props.maxDataLen=e.maxDataLen),void 0!==e.validValues&&(null===e.validValues?this.props.validValues=void 0:(0,f.isNumericFormat)(this.props.format)?((0,s.default)(e.validValues.length,"characteristic prop validValues cannot be empty array"),this.props.validValues=e.validValues):this.characteristicWarning("Characteristic Property `validValues` was supplied for non numeric format "+this.props.format)),void 0!==e.validValueRanges&&(null===e.validValueRanges?this.props.validValueRanges=void 0:(0,f.isNumericFormat)(this.props.format)?((0,s.default)(2===e.validValueRanges.length,"characteristic prop validValueRanges must have a length of 2"),this.props.validValueRanges=e.validValueRanges):this.characteristicWarning("Characteristic Property `validValueRanges` was supplied for non numeric format "+this.props.format)),void 0!==e.adminOnlyAccess&&(this.props.adminOnlyAccess=null!=e.adminOnlyAccess?e.adminOnlyAccess:void 0),null!=this.props.minValue&&null!=this.props.maxValue&&this.props.minValue>this.props.maxValue)throw this.props.minValue=void 0,this.props.maxValue=void 0,new Error("Error setting CharacteristicsProps for '"+this.displayName+"': 'minValue' cannot be greater or equal the 'maxValue'!");if(((0,f.isNumericFormat)(this.props.format)||"string"===this.props.format)&&null!=this.value&&!r&&0===this.statusCode&&this.UUID!==t.ProgrammableSwitchEvent.UUID){var i=this.validateUserInput(this.value,"debug-message");i!==this.value&&this.updateValue(i)}return this},t.prototype.validValuesIterator=function(){return new v(this.props)},t.prototype.setupAdditionalAuthorization=function(e){this.props.perms.includes("aa")||this.props.perms.push("aa"),this.additionalAuthorizationHandler=e},t.prototype.getValue=function(e,t){this.handleGetRequest(void 0,t).then((function(t){e&&e(null,t)}),(function(t){e&&e(t)}))},t.prototype.setValue=function(e,t,r){if(e instanceof Error)return this.statusCode=e instanceof d.HapStatusError?e.hapStatus:C(e),this.status=e,t&&t(),this;t&&!r&&"function"!=typeof t&&(r=t,t=void 0);try{e=this.validateUserInput(e)}catch(e){return this.characteristicWarning((null==e?void 0:e.message)+"","error-message",null==e?void 0:e.stack),t&&t(e),this}return this.handleSetRequest(e,void 0,r).then((function(e){t&&(e?t(null,e):t(null))}),(function(e){t&&t(e)})),this},t.prototype.updateValue=function(e,t,r){if(e instanceof Error)return this.statusCode=e instanceof d.HapStatusError?e.hapStatus:C(e),this.status=e,t&&t(),this;t&&!r&&"function"!=typeof t&&(r=t,t=void 0);try{e=this.validateUserInput(e)}catch(e){return this.characteristicWarning((null==e?void 0:e.message)+"","error-message",null==e?void 0:e.stack),t&&t(),this}this.statusCode=0,this.status=null;var i=this.value;return this.value=e,t&&t(),this.emit("change",{originator:void 0,oldValue:i,newValue:e,reason:"update",context:r}),this},t.prototype.sendEventNotification=function(e,t){this.statusCode=0,this.status=null,e=this.validateUserInput(e);var r=this.value;return this.value=e,this.emit("change",{originator:void 0,oldValue:r,newValue:e,reason:"event",context:t}),this},t.prototype.handleGetRequest=function(e,r){return a.__awaiter(this,void 0,void 0,(function(){var i,n,o,s,c=this;return a.__generator(this,(function(a){switch(a.label){case 0:if(!this.props.perms.includes("pr"))throw-70405;if(this.UUID===t.ProgrammableSwitchEvent.UUID)return[2,null];if(!this.getHandler)return[3,4];this.listeners("get").length>0&&this.characteristicWarning("Ignoring on('get') handler as onGet handler was defined instead"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.getHandler(r,e)];case 2:i=a.sent(),this.statusCode=0,this.status=null;try{i=this.validateUserInput(i)}catch(e){return this.characteristicWarning("An illegal value was supplied by the read handler for characteristic: ".concat(null==e?void 0:e.message),"warn-message",null==e?void 0:e.stack),this.statusCode=-70402,this.status=e,[2,Promise.reject(-70402)]}return n=this.value,this.value=i,n!==i&&this.emit("change",{originator:e,oldValue:n,newValue:i,reason:"read",context:r}),[2,i];case 3:throw"number"==typeof(o=a.sent())?(s=new d.HapStatusError(o),this.statusCode=s.hapStatus,this.status=s):o instanceof d.HapStatusError?(this.statusCode=o.hapStatus,this.status=o):(this.characteristicWarning("Unhandled error thrown inside read handler for characteristic: ".concat(null==o?void 0:o.message),"error-message",null==o?void 0:o.stack),this.statusCode=-70402,this.status=o),this.statusCode;case 4:if(0===this.listeners("get").length){if(this.statusCode)throw this.statusCode;try{return[2,this.validateUserInput(this.value)]}catch(e){return this.characteristicWarning("An illegal value was supplied by setting `value` for characteristic: ".concat(null==e?void 0:e.message),"warn-message",null==e?void 0:e.stack),[2,Promise.reject(-70402)]}}return[2,new Promise((function(t,i){try{c.emit("get",(0,p.once)((function(n,o){if(n){if("number"==typeof n){var a=new d.HapStatusError(n);c.statusCode=a.hapStatus,c.status=a}else n instanceof d.HapStatusError?(c.statusCode=n.hapStatus,c.status=n):(g("[%s] Received error from get handler %s",c.displayName,n.stack),c.statusCode=C(n),c.status=n);i(c.statusCode)}else{c.statusCode=0,c.status=null,o=c.validateUserInput(o);var s=c.value;c.value=o,t(o),s!==o&&c.emit("change",{originator:e,oldValue:s,newValue:o,reason:"read",context:r})}})),r,e)}catch(e){c.characteristicWarning("Unhandled error thrown inside read handler for characteristic: ".concat(null==e?void 0:e.message),"error-message",null==e?void 0:e.stack),c.statusCode=-70402,c.status=e,i(-70402)}}))]}}))}))},t.prototype.handleSetRequest=function(e,t,r){return a.__awaiter(this,void 0,void 0,(function(){var i,n,o,s,c=this;return a.__generator(this,(function(a){switch(a.label){case 0:if(this.statusCode=0,this.status=null,void 0!==t)try{e=this.validateClientSuppliedValue(e)}catch(e){return g("[".concat(this.displayName,"]"),e.message),[2,Promise.reject(-70410)]}if(i=this.value,!this.setHandler)return[3,4];this.listeners("set").length>0&&this.characteristicWarning("Ignoring on('set') handler as onSet handler was defined instead"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.setHandler(e,r,t)];case 2:return n=a.sent(),this.statusCode=0,this.status=null,null!=n&&this.props.perms.includes("wr")?(this.value=this.validateUserInput(n),[2,this.value]):(null!=n&&this.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response","debug-message"),this.value=e,this.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}),[2]);case 3:throw"number"==typeof(o=a.sent())?(s=new d.HapStatusError(o),this.statusCode=s.hapStatus,this.status=s):o instanceof d.HapStatusError?(this.statusCode=o.hapStatus,this.status=o):(this.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(null==o?void 0:o.message),"error-message",null==o?void 0:o.stack),this.statusCode=-70402,this.status=o),this.statusCode;case 4:return 0===this.listeners("set").length?(this.value=e,this.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}),[2,Promise.resolve()]):[2,new Promise((function(n,o){try{c.emit("set",e,(0,p.once)((function(a,s){if(a){if("number"==typeof a){var u=new d.HapStatusError(a);c.statusCode=u.hapStatus,c.status=u}else a instanceof d.HapStatusError?(c.statusCode=a.hapStatus,c.status=a):(g("[%s] Received error from set handler %s",c.displayName,a.stack),c.statusCode=C(a),c.status=a);o(c.statusCode)}else c.statusCode=0,c.status=null,null!=s&&c.props.perms.includes("wr")?(c.value=c.validateUserInput(s),n(c.value)):(null!=s&&c.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response","debug-message"),c.value=e,n(),c.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}))})),r,t)}catch(e){c.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(null==e?void 0:e.message),"error-message",null==e?void 0:e.stack),c.statusCode=-70402,c.status=e,o(-70402)}}))]}}))}))},t.prototype.subscribe=function(){0===this.subscriptions&&this.emit("subscribe"),this.subscriptions++},t.prototype.unsubscribe=function(){var e=1===this.subscriptions;this.subscriptions--,this.subscriptions=Math.max(this.subscriptions,0),e&&this.emit("unsubscribe")},t.prototype.getDefaultValue=function(){var e;switch(this.props.format){case"bool":return!1;case"string":switch(this.UUID){case t.Manufacturer.UUID:return"Default-Manufacturer";case t.Model.UUID:return"Default-Model";case t.SerialNumber.UUID:return"Default-SerialNumber";case t.FirmwareRevision.UUID:return"0.0.0";default:return""}case"data":case"tlv8":return"";case"dict":return{};case"array":return[];case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":return this.UUID===t.CurrentTemperature.UUID?0:(null===(e=this.props.validValues)||void 0===e?void 0:e.length)&&"number"==typeof this.props.validValues[0]?this.props.validValues[0]:"number"==typeof this.props.minValue&&Number.isFinite(this.props.minValue)?this.props.minValue:0;default:return 0}},t.prototype.validateClientSuppliedValue=function(e){if(null==e)throw new Error("Client supplied invalid value for ".concat(this.props.format,": ").concat(e));switch(this.props.format){case"bool":if("boolean"==typeof e)return e;if("number"==typeof e&&(1===e||0===e))return Boolean(e);throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":if("boolean"==typeof e&&(e=e?1:0),"number"!=typeof e||!Number.isFinite(e))throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));var t=S(this.props.minValue,(0,f.numericLowerBound)(this.props.format)),r=E(this.props.maxValue,(0,f.numericUpperBound)(this.props.format));if("number"==typeof t&&er)throw new Error("Client supplied value of ".concat(e," is greater than the maximum allowed value of ").concat(r));if(this.props.validValues&&!this.props.validValues.includes(e))throw new Error("Client supplied value of ".concat(e," is not in ").concat(this.props.validValues.toString()));if(this.props.validValueRanges&&2===this.props.validValueRanges.length){if(ethis.props.validValueRanges[1])throw new Error("Client supplied value of ".concat(e," is greater than the maximum allowed value of ").concat(this.props.validValueRanges[1]))}return e;case"string":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));var i=null!=this.props.maxLen?this.props.maxLen:64;if(e.length>i)throw new Error("Client supplied value length of ".concat(e.length," exceeds maximum length allowed of ").concat(i));return e;case"data":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));i=null!=this.props.maxDataLen?this.props.maxDataLen:2097152;if(e.length>i)throw new Error("Client supplied value length of ".concat(e.length," exceeds maximum length allowed of ").concat(i));return e;case"tlv8":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));return e}return e},t.prototype.validateUserInput=function(e,r){var i;if(void 0===r&&(r="warn-message"),null===e){if(this.UUID===t.Model.UUID||this.UUID===t.SerialNumber.UUID)return this.characteristicWarning("characteristic must have a non null value otherwise HomeKit will reject this accessory, ignoring new value","error-message"),this.value;if("data"===this.props.format||"tlv8"===this.props.format)return e;if(!this.UUID.endsWith(m.BASE_UUID))return e;if(this.UUID===t.ProgrammableSwitchEvent.UUID)return e;if(this.characteristicWarning("characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics",r),null!==this.value)return this.value}switch(this.props.format){case"bool":return"boolean"==typeof e?e:"number"==typeof e?1===e:"string"==typeof e?"1"===e||"true"===e:(this.characteristicWarning("characteristic value expected boolean and received "+typeof e,r),!1);case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":"boolean"==typeof e&&(e=e?1:0),"string"==typeof e&&(e="float"===this.props.format?parseFloat(e):parseInt(e,10)),"number"==typeof e&&Number.isFinite(e)||(this.characteristicWarning('characteristic value expected valid finite number and received "'.concat(e,'" (').concat(typeof e,")"),r),e="number"==typeof this.value?this.value:this.props.minValue||0);var n=S(this.props.minValue,(0,f.numericLowerBound)(this.props.format)),o=E(this.props.maxValue,(0,f.numericUpperBound)(this.props.format)),a=void 0;if(null!=(a="float"===this.props.format?this.props.minStep:S(this.props.minStep,1))&&a>0){var s=null!=this.props.minValue?this.props.minValue:0;e=a*Math.round((e-s)/a)+s}return null!=n&&eo&&(this.characteristicWarning("characteristic was supplied illegal value: number ".concat(e," exceeded maximum of ").concat(o),r),e=o),this.props.validValues&&!this.props.validValues.includes(e)?(this.characteristicWarning("characteristic value ".concat(e," is not contained in valid values array"),r),this.props.validValues.includes(this.value)?this.value:this.props.validValues[0]||0):(this.props.validValueRanges&&2===this.props.validValueRanges.length&&(ethis.props.validValueRanges[1]&&(this.characteristicWarning("characteristic was supplied illegal value: number ".concat(e," not contained in valid value range of ").concat(this.props.validValueRanges,", supplying illegal values will throw errors in the future"),r),e=this.props.validValueRanges[1])),e);case"string":if("number"==typeof e&&(this.characteristicWarning("characteristic was supplied illegal value: number instead of string, supplying illegal values will throw errors in the future",r),e=String(e)),"string"!=typeof e&&(this.characteristicWarning("characteristic value expected string and received "+typeof e,r),e="string"==typeof this.value?this.value:e+""),e.length<=1&&(this.UUID===t.Model.UUID||this.UUID===t.SerialNumber.UUID))return this.characteristicWarning("[".concat(this.displayName,"] characteristic must have a length of more than 1 character otherwise HomeKit will reject this accessory, ignoring new value"),r),this.value;var c=null!==(i=this.props.maxLen)&&void 0!==i?i:64;return e.length>c&&(this.characteristicWarning("characteristic was supplied illegal value: string '".concat(e,"' exceeded max length of ").concat(c),r),e=e.substring(0,c)),e;case"data":if("string"!=typeof e)throw new Error("characteristic with DATA format must have string value");if(null!=this.props.maxDataLen&&e.length>this.props.maxDataLen)throw new Error("characteristic with DATA format exceeds specified maxDataLen");return e;case"tlv8":return void 0===e?(this.characteristicWarning("characteristic was supplied illegal value: undefined",r),this.value):e}return void 0===e?(this.characteristicWarning("characteristic was supplied illegal value: undefined","error-message"),this.value):e},t.prototype._assignID=function(e,t,r,i){this.iid=e.getIID(t,r,i,this.UUID)},t.prototype.characteristicWarning=function(e,t,r){void 0===t&&(t="warn-message"),void 0===r&&(r=(new Error).stack),this.emit("characteristic-warning",t,e,r)},t.prototype.removeAllListeners=function(t){return t||(this.removeOnGet(),this.removeOnSet()),e.prototype.removeAllListeners.call(this,t)},t.prototype.replaceBy=function(e){var t=this;this.props=e.props,this.updateValue(e.value);var r=e.listeners("get");r.length&&(this.removeAllListeners("get"),r.forEach((function(e){return t.addListener("get",e)}))),this.removeOnGet(),e.getHandler&&this.onGet(e.getHandler);var i=e.listeners("set");i.length&&(this.removeAllListeners("set"),i.forEach((function(e){return t.addListener("set",e)}))),this.removeOnSet(),e.setHandler&&this.onSet(e.setHandler)},t.prototype.toHAP=function(e,r){return void 0===r&&(r=!0),a.__awaiter(this,void 0,void 0,(function(){var i,n,o,s=this;return a.__generator(this,(function(a){switch(a.label){case 0:return i=this.internalHAPRepresentation(),this.props.perms.includes("pr")?[3,1]:(i.value=void 0,[3,6]);case 1:return this.UUID!==t.ProgrammableSwitchEvent.UUID?[3,2]:(i.value=null,[3,6]);case 2:return r?[4,this.handleGetRequest(e).catch((function(){var e=s.getDefaultValue();return g("[%s] Error getting value for characteristic on /accessories request. Returning default value instead: %s",s.displayName,"".concat(e)),e}))]:[3,4];case 3:return o=a.sent(),[3,5];case 4:o=this.value,a.label=5;case 5:n=o,i.value=(0,f.formatOutgoingCharacteristicValue)(n,this.props),a.label=6;case 6:return[2,i]}}))}))},t.prototype.internalHAPRepresentation=function(){return(0,s.default)(this.iid,"iid cannot be undefined for characteristic '"+this.displayName+"'"),{type:(0,m.toShortForm)(this.UUID),iid:this.iid,value:null,perms:this.props.perms,description:this.props.description||this.displayName,format:this.props.format,unit:this.props.unit,minValue:this.props.minValue,maxValue:this.props.maxValue,minStep:this.props.minStep,maxLen:this.props.maxLen,maxDataLen:this.props.maxDataLen,"valid-values":this.props.validValues,"valid-values-range":this.props.validValueRanges}},t.serialize=function(e){var r;return"Characteristic"!==e.constructor.name&&(r=e.constructor.name),{displayName:e.displayName,UUID:e.UUID,eventOnlyCharacteristic:e.UUID===t.ProgrammableSwitchEvent.UUID,constructorName:r,value:e.value,props:(0,h.clone)({},e.props)}},t.deserialize=function(e){var r;e.constructorName&&e.constructorName.charAt(0).toUpperCase()===e.constructorName.charAt(0)&&t[e.constructorName]?((r=new(0,t[e.constructorName])).displayName=e.displayName,r.setProps(e.props)):r=new t(e.displayName,e.UUID,e.props);return r.value=e.value,r},t.Formats=i,t.Units=n,t.Perms=o,t}(u.EventEmitter);t.Characteristic=_,r(651)},589:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPServer=t.HAPServerEventTypes=t.HAPPairingHTTPCode=t.HAPHTTPCode=t.Status=t.Codes=t.IsKnownHAPStatusError=t.HAPStatus=t.TLVErrorCode=void 0;var i,n,o=r(1635),a=o.__importDefault(r(6982)),s=o.__importDefault(r(5753)),c=r(4434),u=r(4618),l=o.__importDefault(r(8947)),h=r(7016),d=r(8602),p=r(9593),f=o.__importStar(r(8)),m=r(7739),g=o.__importStar(r(3314)),v=(0,s.default)("HAP-NodeJS:HAPServer");!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.INVALID_REQUEST=2]="INVALID_REQUEST",e[e.AUTHENTICATION=2]="AUTHENTICATION",e[e.BACKOFF=3]="BACKOFF",e[e.MAX_PEERS=4]="MAX_PEERS",e[e.MAX_TRIES=5]="MAX_TRIES",e[e.UNAVAILABLE=6]="UNAVAILABLE",e[e.BUSY=7]="BUSY"}(i=t.TLVErrorCode||(t.TLVErrorCode={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.INSUFFICIENT_PRIVILEGES=-70401]="INSUFFICIENT_PRIVILEGES",e[e.SERVICE_COMMUNICATION_FAILURE=-70402]="SERVICE_COMMUNICATION_FAILURE",e[e.RESOURCE_BUSY=-70403]="RESOURCE_BUSY",e[e.READ_ONLY_CHARACTERISTIC=-70404]="READ_ONLY_CHARACTERISTIC",e[e.WRITE_ONLY_CHARACTERISTIC=-70405]="WRITE_ONLY_CHARACTERISTIC",e[e.NOTIFICATION_NOT_SUPPORTED=-70406]="NOTIFICATION_NOT_SUPPORTED",e[e.OUT_OF_RESOURCE=-70407]="OUT_OF_RESOURCE",e[e.OPERATION_TIMED_OUT=-70408]="OPERATION_TIMED_OUT",e[e.RESOURCE_DOES_NOT_EXIST=-70409]="RESOURCE_DOES_NOT_EXIST",e[e.INVALID_VALUE_IN_REQUEST=-70410]="INVALID_VALUE_IN_REQUEST",e[e.INSUFFICIENT_AUTHORIZATION=-70411]="INSUFFICIENT_AUTHORIZATION",e[e.NOT_ALLOWED_IN_CURRENT_STATE=-70412]="NOT_ALLOWED_IN_CURRENT_STATE"}(n=t.HAPStatus||(t.HAPStatus={})),t.IsKnownHAPStatusError=function(e){return e>=-70412&&e<=-70401},t.Codes=i,t.Status=n,function(e){e[e.OK=200]="OK",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE"}(t.HAPHTTPCode||(t.HAPHTTPCode={})),function(e){e[e.OK=200]="OK",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.CONNECTION_AUTHORIZATION_REQUIRED=470]="CONNECTION_AUTHORIZATION_REQUIRED",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR"}(t.HAPPairingHTTPCode||(t.HAPPairingHTTPCode={})),function(e){e.LISTENING="listening",e.IDENTIFY="identify",e.ADD_PAIRING="add-pairing",e.REMOVE_PAIRING="remove-pairing",e.LIST_PAIRINGS="list-pairings",e.PAIR="pair",e.ACCESSORIES="accessories",e.GET_CHARACTERISTICS="get-characteristics",e.SET_CHARACTERISTICS="set-characteristics",e.REQUEST_RESOURCE="request-resource",e.CONNECTION_CLOSED="connection-closed"}(t.HAPServerEventTypes||(t.HAPServerEventTypes={}));var y=function(e){function t(t){var r=e.call(this)||this;return r.unsuccessfulPairAttempts=0,r.accessoryInfo=t,r.allowInsecureRequest=!1,r.httpServer=new p.EventedHTTPServer,r.httpServer.on("listening",r.onListening.bind(r)),r.httpServer.on("request",r.handleRequestOnHAPConnection.bind(r)),r.httpServer.on("connection-closed",r.handleConnectionClosed.bind(r)),r}return o.__extends(t,e),t.prototype.listen=function(e,t){void 0===e&&(e=0),"::"===t&&(t=void 0),this.httpServer.listen(e,t)},t.prototype.stop=function(){this.httpServer.stop()},t.prototype.destroy=function(){this.stop(),this.removeAllListeners()},t.prototype.sendEventNotifications=function(e,t,r,i,n){try{this.httpServer.broadcastEvent(e,t,r,i,n)}catch(e){console.warn("["+this.accessoryInfo.username+"] Error when sending event notifications: "+e.message)}},t.prototype.onListening=function(e,t){this.emit("listening",e,t)},t.prototype.handleRequestOnHAPConnection=function(e,t,r){var i=this;v("[%s] HAP Request: %s %s",this.accessoryInfo.username,t.method,t.url);var n=[];t.on("data",(function(e){return n.push(e)})),t.on("end",(function(){var o=new h.URL(t.url,"http://hap-nodejs.local"),a=i.getHandler(o);if(a){var s=Buffer.concat(n);try{a(e,o,t,s,r)}catch(e){v("[%s] Error executing route handler: %s",i.accessoryInfo.username,e.stack),r.writeHead(500,{"Content-Type":"application/hap+json"}),r.end(JSON.stringify({status:-70403}))}}else v("[%s] WARNING: Handler for %s not implemented",i.accessoryInfo.username,t.url),r.writeHead(404,{"Content-Type":"application/hap+json"}),r.end(JSON.stringify({status:-70409}))}))},t.prototype.handleConnectionClosed=function(e){this.emit("connection-closed",e)},t.prototype.getHandler=function(e){switch(e.pathname.toLowerCase()){case"/identify":return this.handleIdentifyRequest.bind(this);case"/pair-setup":return this.handlePairSetup.bind(this);case"/pair-verify":return this.handlePairVerify.bind(this);case"/pairings":return this.handlePairings.bind(this);case"/accessories":return this.handleAccessories.bind(this);case"/characteristics":return this.handleCharacteristics.bind(this);case"/prepare":return this.handlePrepareWrite.bind(this);case"/resource":return this.handleResource.bind(this);default:return}},t.prototype.handleIdentifyRequest=function(e,t,r,i,n){var o=this;if(this.accessoryInfo.paired()&&!this.allowInsecureRequest)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));this.emit("identify",(0,m.once)((function(e){e?(v("[%s] Identification error: %s",o.accessoryInfo.username,e.message),n.writeHead(500,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70403}))):(v("[%s] Identification success",o.accessoryInfo.username),n.writeHead(204),n.end())})))},t.prototype.handlePairSetup=function(e,t,r,i,n){if(!this.allowInsecureRequest&&this.accessoryInfo.paired())return n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,2,7,6));if(this.unsuccessfulPairAttempts>100)return v("[%s] Reached maximum amount of unsuccessful pair attempts!",this.accessoryInfo.username),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,2,7,5));var o=g.decode(i),a=o[6][0];if(1===a)this.handlePairSetupM1(e,r,n);else if(3===a&&2===e._pairSetupState)this.handlePairSetupM3(e,r,n,o);else{if(5!==a||4!==e._pairSetupState)return n.writeHead(400,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,a+1,7,1));this.handlePairSetupM5(e,r,n,o)}},t.prototype.handlePairSetupM1=function(e,t,r){var i=this;v("[%s] Pair step 1/5",this.accessoryInfo.username);var n=a.default.randomBytes(16),o=u.SRP.params.hap;u.SRP.genKey(32).then((function(t){var a=new u.SrpServer(o,n,Buffer.from("Pair-Setup"),Buffer.from(i.accessoryInfo.pincode),t),s=a.computeB();e.srpServer=a,r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,2,2,n,3,s)),e._pairSetupState=2})).catch((function(e){v("[%s] Error occurred when generating srp key: %s",i.accessoryInfo.username,e.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,2,7,1))}))},t.prototype.handlePairSetupM3=function(e,t,r,i){v("[%s] Pair step 2/5",this.accessoryInfo.username);var n=i[3],o=i[4],a=e.srpServer;a.setA(n);try{a.checkM1(o)}catch(t){return this.unsuccessfulPairAttempts++,v("[%s] Error while checking pincode: %s",this.accessoryInfo.username,t.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,7,2)),void(e._pairSetupState=void 0)}var s=a.computeM2();r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,4,s)),e._pairSetupState=4},t.prototype.handlePairSetupM5=function(e,t,r,i){v("[%s] Pair step 3/5",this.accessoryInfo.username);var n=e.srpServer,o=i[5],a=Buffer.alloc(o.length-16),s=Buffer.alloc(16);o.copy(a,0,0,o.length-16),o.copy(s,0,o.length-16,o.length);var c,u=n.computeK(),l=Buffer.from("Pair-Setup-Encrypt-Salt"),h=Buffer.from("Pair-Setup-Encrypt-Info"),d=f.HKDF("sha512",l,u,h,32);try{c=f.chacha20_poly1305_decryptAndVerify(d,Buffer.from("PS-Msg05"),null,a,s)}catch(t){return v("[%s] Error while decrypting and verifying M5 subTlv: %s",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,7,2)),void(e._pairSetupState=void 0)}var p=g.decode(c),m=p[1],y=p[3],C=p[10];this.handlePairSetupM5_2(e,t,r,m,y,C,d)},t.prototype.handlePairSetupM5_2=function(e,t,r,i,n,o,a){v("[%s] Pair step 4/5",this.accessoryInfo.username);var s=e.srpServer.computeK(),c=Buffer.from("Pair-Setup-Controller-Sign-Salt"),u=Buffer.from("Pair-Setup-Controller-Sign-Info"),h=f.HKDF("sha512",c,s,u,32),d=Buffer.concat([h,i,n]);if(!l.default.sign.detached.verify(d,o,n))return v("[%s] Invalid signature",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,6,7,2)),void(e._pairSetupState=void 0);this.handlePairSetupM5_3(e,t,r,i,n,a)},t.prototype.handlePairSetupM5_3=function(e,t,r,i,n,o){var a=this;v("[%s] Pair step 5/5",this.accessoryInfo.username);var s=e.srpServer.computeK(),c=Buffer.from("Pair-Setup-Accessory-Sign-Salt"),u=Buffer.from("Pair-Setup-Accessory-Sign-Info"),h=f.HKDF("sha512",c,s,u,32),d=this.accessoryInfo.signPk,p=Buffer.from(this.accessoryInfo.username),y=Buffer.concat([h,p,d]),C=Buffer.from(this.accessoryInfo.signSk),S=l.default.sign.detached(y,C),E=g.encode(1,p,3,d,10,S),_=f.chacha20_poly1305_encryptAndSeal(o,Buffer.from("PS-Msg06"),null,E);this.emit("pair",i.toString(),n,(0,m.once)((function(t){if(t)return v("[%s] Error adding pairing info: %s",a.accessoryInfo.username,t.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,6,7,1)),void(e._pairSetupState=void 0);r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,6,5,Buffer.concat([_.ciphertext,_.authTag]))),e._pairSetupState=void 0})))},t.prototype.handlePairVerify=function(e,t,r,i,n){var o=g.decode(i),a=o[6][0];if(1===a)this.handlePairVerifyM1(e,r,n,o);else{if(3!==a||2!==e._pairVerifyState)return n.writeHead(400,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,a+1,7,1));this.handlePairVerifyM3(e,r,n,o)}},t.prototype.handlePairVerifyM1=function(e,t,r,i){v("[%s] Pair verify step 1/2",this.accessoryInfo.username);var n=i[3],o=f.generateCurve25519KeyPair(),a=Buffer.from(o.secretKey),s=Buffer.from(o.publicKey),c=Buffer.from(f.generateCurve25519SharedSecKey(a,n)),u=Buffer.from(this.accessoryInfo.username),h=Buffer.concat([s,u,n]),d=Buffer.from(this.accessoryInfo.signSk),m=l.default.sign.detached(h,d),y=Buffer.from("Pair-Verify-Encrypt-Salt"),C=Buffer.from("Pair-Verify-Encrypt-Info"),S=f.HKDF("sha512",y,c,C,32).slice(0,32);e.encryption=new p.HAPEncryption(n,a,s,c,S);var E=g.encode(1,u,10,m),_=f.chacha20_poly1305_encryptAndSeal(S,Buffer.from("PV-Msg02"),null,E);r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,2,5,Buffer.concat([_.ciphertext,_.authTag]),3,s)),e._pairVerifyState=2},t.prototype.handlePairVerifyM3=function(e,t,r,i){v("[%s] Pair verify step 2/2",this.accessoryInfo.username);var n=i[5],o=Buffer.alloc(n.length-16),a=Buffer.alloc(16);n.copy(o,0,0,n.length-16),n.copy(a,0,n.length-16,n.length);var s,c=e.encryption;try{s=f.chacha20_poly1305_decryptAndVerify(c.hkdfPairEncryptionKey,Buffer.from("PV-Msg03"),null,o,a)}catch(t){return v("[%s] M3: Failed to decrypt and/or verify",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,7,2)),void(e._pairVerifyState=void 0)}var u=g.decode(s),h=u[1],d=u[10],p=Buffer.concat([c.clientPublicKey,h,c.publicKey]),m=this.accessoryInfo.getClientPublicKey(h.toString());if(!m)return v("[%s] Client %s attempting to verify, but we are not paired; rejecting client",this.accessoryInfo.username,h),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,7,2)),void(e._pairVerifyState=void 0);if(!l.default.sign.detached.verify(p,d,m))return v("[%s] Client %s provided an invalid signature",this.accessoryInfo.username,h),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4,7,2)),void(e._pairVerifyState=void 0);v("[%s] Client %s verification complete",this.accessoryInfo.username,h),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(g.encode(6,4));var y=Buffer.from("Control-Salt"),C=Buffer.from("Control-Read-Encryption-Key"),S=Buffer.from("Control-Write-Encryption-Key");c.accessoryToControllerKey=f.HKDF("sha512",y,c.sharedSecret,C,32),c.controllerToAccessoryKey=f.HKDF("sha512",y,c.sharedSecret,S,32),e.connectionAuthenticated(h.toString()),e._pairVerifyState=void 0},t.prototype.handlePairings=function(e,t,r,i,n){var a=this;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));var s=g.decode(i),c=s[0][0];if(1===s[6][0])if(3===c){var u=s[1].toString(),l=s[3],h=s[11][0];this.emit("add-pairing",e,u,l,h,(0,m.once)((function(e){if(e>0)return v("[%s] Pairings: failed ADD_PAIRING with code %d",a.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,2,7,e));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(g.encode(6,2)),v("[%s] Pairings: successfully executed ADD_PAIRING",a.accessoryInfo.username)})))}else if(4===c){u=s[1].toString();this.emit("remove-pairing",e,u,(0,m.once)((function(e){if(e>0)return v("[%s] Pairings: failed REMOVE_PAIRING with code %d",a.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,2,7,e));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(g.encode(6,2)),v("[%s] Pairings: successfully executed REMOVE_PAIRING",a.accessoryInfo.username)})))}else 5===c&&this.emit("list-pairings",e,(0,m.once)((function(e,t){if(e>0)return v("[%s] Pairings: failed LIST_PAIRINGS with code %d",a.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(g.encode(6,2,7,e));var r=[];t.forEach((function(e,t){t>0&&r.push(255,Buffer.alloc(0)),r.push(1,e.username,3,e.publicKey,11,e.permission)}));var i=g.encode.apply(g,o.__spreadArray([6,2],o.__read(r),!1));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(i),v("[%s] Pairings: successfully executed LIST_PAIRINGS",a.accessoryInfo.username)})))},t.prototype.handleAccessories=function(e,t,r,i,n){if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));this.emit("accessories",e,(0,m.once)((function(e,t){e?(n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:e.status}))):(n.writeHead(200,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify(t)))})))},t.prototype.handleCharacteristics=function(e,t,r,i,n){var a,s;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("GET"===r.method){var c=t.searchParams,u=c.get("id");if(!u)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var l=[];try{for(var h=o.__values(u.split(",")),p=h.next();!p.done;p=h.next()){var f=p.value.split(".");l.push({aid:parseInt(f[0],10),iid:parseInt(f[1],10)})}}catch(e){a={error:e}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}var g={ids:l,includeMeta:(0,d.consideredTrue)(c.get("meta")),includePerms:(0,d.consideredTrue)(c.get("perms")),includeType:(0,d.consideredTrue)(c.get("type")),includeEvent:(0,d.consideredTrue)(c.get("ev"))};this.emit("get-characteristics",e,g,(0,m.once)((function(e,t){var r,i,a,s;if(e)return n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:e.status}));var c=t.characteristics,u=!1;try{for(var l=o.__values(c),h=l.next();!h.done;h=l.next()){if(h.value.status){u=!0;break}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(u)try{for(var d=o.__values(c),p=d.next();!p.done;p=d.next()){var f=p.value;f.status||(f.status=0)}}catch(e){a={error:e}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}n.writeHead(u?207:200,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({characteristics:c}))})))}else if("PUT"===r.method){if(!e.isAuthenticated()&&(!r.headers||r.headers&&r.headers.authorization!==this.accessoryInfo.pincode))return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var v=JSON.parse(i.toString("utf8"));this.emit("set-characteristics",e,v,(0,m.once)((function(e,t){var r,i;if(e)return n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:e.status}));var a=t.characteristics,s=!1;try{for(var c=o.__values(a),u=c.next();!u.done;u=c.next()){var l=u.value;if(l.status||void 0!==l.value){s=!0;break}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}s?(n.writeHead(207,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({characteristics:a}))):(n.writeHead(204),n.end())})))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t.prototype.handlePrepareWrite=function(e,t,r,i,n){var o=this;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("PUT"===r.method){if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var a=JSON.parse(i.toString());if(a.pid&&a.ttl)return v("[%s] Received prepare write request with pid %d and ttl %d",this.accessoryInfo.username,a.pid,a.ttl),e.timedWriteTimeout&&clearTimeout(e.timedWriteTimeout),e.timedWritePid=a.pid,e.timedWriteTimeout=setTimeout((function(){v("[%s] Timed write request timed out for pid %d",o.accessoryInfo.username,a.pid),e.timedWritePid=void 0,e.timedWriteTimeout=void 0}),a.ttl),n.writeHead(200,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:0}));n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t.prototype.handleResource=function(e,t,r,i,n){if(!(e.isAuthenticated()||this.allowInsecureRequest&&r.headers&&r.headers.authorization===this.accessoryInfo.pincode))return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("POST"===r.method){if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var o=JSON.parse(i.toString());this.emit("request-resource",o,(0,m.once)((function(e,t){e?(n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:e.status}))):(n.writeHead(200,{"Content-Type":"image/jpeg"}),n.end(t))})))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t}(c.EventEmitter);t.HAPServer=y},5876:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Service=t.ServiceEventTypes=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(5753)),a=r(4434),s=r(9826),c=r(2997),u=(0,o.default)("HAP-NodeJS:Service");!function(e){e.CHARACTERISTIC_CHANGE="characteristic-change",e.SERVICE_CONFIGURATION_CHANGE="service-configurationChange",e.CHARACTERISTIC_WARNING="characteristic-warning"}(t.ServiceEventTypes||(t.ServiceEventTypes={}));var l=function(e){function t(t,r,i){void 0===t&&(t="");var o=e.call(this)||this;(o.iid=null,o.name=null,o.characteristics=[],o.optionalCharacteristics=[],o.isHiddenService=!1,o.isPrimaryService=!1,o.linkedServices=[],(0,n.default)(r,"Services must be created with a valid UUID."),o.displayName=t,o.UUID=r,o.subtype=i,t)&&(o.getCharacteristic(s.Characteristic.Name)||o.addCharacteristic(s.Characteristic.Name)).updateValue(t);return o}return i.__extends(t,e),t.prototype.getServiceId=function(){return this.UUID+(this.subtype||"")},t.prototype.addCharacteristic=function(e){for(var t,r,n=[],o=1;o=100)throw new Error("Cannot add more than 100 characteristics to a single service!");return this.setupCharacteristicEventHandlers(a),this.characteristics.push(a),this.emit("service-configurationChange"),a},t.prototype.setPrimaryService=function(e){void 0===e&&(e=!0),this.isPrimaryService=e,this.emit("service-configurationChange")},t.prototype.setHiddenService=function(e){void 0===e&&(e=!0),this.isHiddenService=e,this.emit("service-configurationChange")},t.prototype.addLinkedService=function(e){this.linkedServices.includes(e)||this.linkedServices.push(e),this.emit("service-configurationChange")},t.prototype.removeLinkedService=function(e){var t=this.linkedServices.indexOf(e);-1!==t&&this.linkedServices.splice(t,1),this.emit("service-configurationChange")},t.prototype.removeCharacteristic=function(e){var t=this.characteristics.indexOf(e);-1!==t&&(this.characteristics.splice(t,1),e.removeAllListeners(),this.emit("service-configurationChange"))},t.prototype.getCharacteristic=function(e){var t,r,n,o;try{for(var a=i.__values(this.characteristics),c=a.next();!c.done;c=a.next()){var u=c.value;if("string"==typeof e&&u.displayName===e)return u;if("function"==typeof e&&(u instanceof e||e.UUID===u.UUID))return u}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}if("function"==typeof e){try{for(var l=i.__values(this.optionalCharacteristics),h=l.next();!h.done;h=l.next()){if((u=h.value)instanceof e||e.UUID===u.UUID)return this.addCharacteristic(e)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}var d=this.addCharacteristic(e);return e.UUID!==s.Characteristic.Name.UUID&&this.emitCharacteristicWarningEvent(d,"warn-message","Characteristic not in required or optional characteristic section for service "+this.constructor.name+". Adding anyway."),d}},t.prototype.testCharacteristic=function(e){var t,r;try{for(var n=i.__values(this.characteristics),o=n.next();!o.done;o=n.next()){var a=o.value;if("string"==typeof e&&a.displayName===e)return!0;if("function"==typeof e&&(a instanceof e||e.UUID===a.UUID))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},t.prototype.setCharacteristic=function(e,t){return this.getCharacteristic(e).setValue(t),this},t.prototype.updateCharacteristic=function(e,t){return this.getCharacteristic(e).updateValue(t),this},t.prototype.addOptionalCharacteristic=function(e){"function"==typeof e&&(e=new e),this.optionalCharacteristics.push(e)},t.prototype.replaceCharacteristicsFromService=function(e){var t=this;if(this.UUID!==e.UUID)throw new Error("Incompatible services. Tried replacing characteristics of ".concat(this.UUID," with characteristics from ").concat(e.UUID));var r={};e.characteristics.forEach((function(e){return r[e.UUID]=e})),this.characteristics.forEach((function(e){var t=r[e.UUID];if(t){if(delete r[e.UUID],!t.value&&0!==t.value&&!1!==t.value)return;e.replaceBy(t)}})),Object.values(r).forEach((function(e){return t.addCharacteristic(e)}))},t.prototype.getCharacteristicByIID=function(e){var t,r;try{for(var n=i.__values(this.characteristics),o=n.next();!o.done;o=n.next()){var a=o.value;if(a.iid===e)return a}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},t.prototype._assignIDs=function(e,t,r){var n,o;void 0===r&&(r=0),"0000003E-0000-1000-8000-0026BB765291"===this.UUID?this.iid=1:this.iid=r+e.getIID(t,this.UUID,this.subtype);try{for(var a=i.__values(this.characteristics),s=a.next();!s.done;s=a.next()){s.value._assignID(e,t,this.UUID,this.subtype)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},t.prototype.toHAP=function(e,t){var r=this;return void 0===t&&(t=!0),new Promise((function(o){var a,s,l,h;(0,n.default)(r.iid,"iid cannot be undefined for service '"+r.displayName+"'"),(0,n.default)(r.characteristics.length,"service '"+r.displayName+"' does not have any characteristics!");var d={type:(0,c.toShortForm)(r.UUID),iid:r.iid,characteristics:[],hidden:!!r.isHiddenService||void 0,primary:!!r.isPrimaryService||void 0};if(r.linkedServices.length){d.linked=[];try{for(var p=i.__values(r.linkedServices),f=p.next();!f.done;f=p.next()){var m=f.value;m.iid?d.linked.push(m.iid):u("iid of linked service '".concat(m.displayName,"' ").concat(m.UUID," is undefined on service '").concat(r.displayName,"'"))}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}}var g=new Set,v=setTimeout((function(){var e,t;try{for(var n=i.__values(g),a=n.next();!a.done;a=n.next()){var s=a.value;r.emitCharacteristicWarningEvent(s,"slow-read","The read handler for the characteristic '".concat(s.displayName,"' was slow to respond!"))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}v=setTimeout((function(){var e,t;v=void 0;try{for(var n=i.__values(g),a=n.next();!a.done;a=n.next()){var s=a.value;r.emitCharacteristicWarningEvent(s,"timeout-read","The read handler for the characteristic '"+(null==s?void 0:s.displayName)+"' didn't respond at all!. Please check that you properly call the callback!"),d.characteristics.push(s.internalHAPRepresentation())}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}g.clear(),o(d)}),6e3)}),3e3),y=function(r){g.add(r),r.toHAP(e,t).then((function(e){v&&(g.delete(r),d.characteristics.push(e),0===g.size&&(v&&(clearTimeout(v),v=void 0),o(d)))}))};try{for(var C=i.__values(r.characteristics),S=C.next();!S.done;S=C.next()){y(S.value)}}catch(e){l={error:e}}finally{try{S&&!S.done&&(h=C.return)&&h.call(C)}finally{if(l)throw l.error}}}))},t.prototype.internalHAPRepresentation=function(){var e,t;(0,n.default)(this.iid,"iid cannot be undefined for service '"+this.displayName+"'"),(0,n.default)(this.characteristics.length,"service '"+this.displayName+"' does not have any characteristics!");var r={type:(0,c.toShortForm)(this.UUID),iid:this.iid,characteristics:this.characteristics.map((function(e){return e.internalHAPRepresentation()})),hidden:!!this.isHiddenService||void 0,primary:!!this.isPrimaryService||void 0};if(this.linkedServices.length){r.linked=[];try{for(var o=i.__values(this.linkedServices),a=o.next();!a.done;a=o.next()){var s=a.value;s.iid?r.linked.push(s.iid):u("iid of linked service '".concat(s.displayName,"' ").concat(s.UUID," is undefined on service '").concat(this.displayName,"'"))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}return r},t.prototype.setupCharacteristicEventHandlers=function(e){var t=this;e.on("change",(function(r){t.emit("characteristic-change",i.__assign(i.__assign({},r),{characteristic:e}))})),e.on("characteristic-warning",this.emitCharacteristicWarningEvent.bind(this,e))},t.prototype.emitCharacteristicWarningEvent=function(e,t,r,i){this.emit("characteristic-warning",{characteristic:e,type:t,message:r,originatorChain:[this.displayName,e.displayName],stack:i})},t.prototype._sideloadCharacteristics=function(e){var t,r;try{for(var n=i.__values(e),o=n.next();!o.done;o=n.next()){var a=o.value;this.setupCharacteristicEventHandlers(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.characteristics=e.slice()},t.serialize=function(e){var t;return"Service"!==e.constructor.name&&(t=e.constructor.name),{displayName:e.displayName,UUID:e.UUID,subtype:e.subtype,constructorName:t,hiddenService:e.isHiddenService,primaryService:e.isPrimaryService,characteristics:e.characteristics.map((function(e){return s.Characteristic.serialize(e)})),optionalCharacteristics:e.optionalCharacteristics.map((function(e){return s.Characteristic.serialize(e)}))}},t.deserialize=function(e){var r;e.constructorName&&e.constructorName.charAt(0).toUpperCase()===e.constructorName.charAt(0)&&t[e.constructorName]?r=new(0,t[e.constructorName])(e.displayName,e.subtype):r=new t(e.displayName,e.UUID,e.subtype);r.isHiddenService=!!e.hiddenService,r.isPrimaryService=!!e.primaryService;var i=e.characteristics.map((function(e){return s.Characteristic.deserialize(e)}));return r._sideloadCharacteristics(i),e.optionalCharacteristics&&(r.optionalCharacteristics=e.optionalCharacteristics.map((function(e){return s.Characteristic.deserialize(e)}))),r},t}(a.EventEmitter);t.Service=l,r(1647)},9672:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyCameraSourceAdapter=void 0;var r=function(){function e(e){this.cameraSource=e}return e.prototype.handleSnapshotRequest=function(e,t){this.cameraSource.handleSnapshotRequest(e,(function(e,r){t(e||void 0,r)}))},e.prototype.prepareStream=function(e,t){this.cameraSource.prepareStream(e,(function(e){t(void 0,e)}))},e.prototype.handleStreamRequest=function(e,t){this.cameraSource.handleStreamRequest(e),t()},e.prototype.forwardCloseConnection=function(e){this.cameraSource.handleCloseConnection(e)},e}();t.LegacyCameraSourceAdapter=r},5989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635).__importDefault(r(7194)),n=function(){function e(e){this.options=e,this.startingPort=1e4,this.type=e.isIPV6?"udp6":"udp4",this.startingPort=1e4,this.outgoingAddress=e.outgoingAddress,this.outgoingPort=e.outgoingPort,this.incomingPayloadType=0,this.outgoingSSRC=e.outgoingSSRC,this.disabled=e.disabled,this.incomingSSRC=null,this.outgoingPayloadType=null}return e.prototype.setup=function(){var e=this;return this.createSocketPair(this.type).then((function(t){return e.incomingRTPSocket=t[0],e.incomingRTCPSocket=t[1],e.createSocket(e.type)})).then((function(t){e.outgoingSocket=t,e.onBound()}))},e.prototype.destroy=function(){this.incomingRTPSocket&&this.incomingRTPSocket.close(),this.incomingRTCPSocket&&this.incomingRTCPSocket.close(),this.outgoingSocket&&this.outgoingSocket.close()},e.prototype.incomingRTPPort=function(){var e=this.incomingRTPSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.incomingRTCPPort=function(){var e=this.incomingRTCPSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.outgoingLocalPort=function(){var e=this.outgoingSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.setServerAddress=function(e){this.serverAddress=e},e.prototype.setServerRTPPort=function(e){this.serverRTPPort=e},e.prototype.setServerRTCPPort=function(e){this.serverRTCPPort=e},e.prototype.setIncomingPayloadType=function(e){this.incomingPayloadType=e},e.prototype.setOutgoingPayloadType=function(e){this.outgoingPayloadType=e},e.prototype.sendOut=function(e){this.outgoingAddress&&this.outgoingPort&&this.outgoingSocket.send(e,this.outgoingPort,this.outgoingAddress)},e.prototype.sendBack=function(e){this.serverAddress&&this.serverRTCPPort&&this.outgoingSocket.send(e,this.serverRTCPPort,this.serverAddress)},e.prototype.onBound=function(){var e=this;this.disabled||(this.incomingRTPSocket.on("message",(function(t){e.rtpMessage(t)})),this.incomingRTCPSocket.on("message",(function(t){e.rtcpMessage(t)})),this.outgoingSocket.on("message",(function(t){e.rtcpReply(t)})))},e.prototype.rtpMessage=function(e){if(e.length<12)this.sendOut(e);else{var t=e.readUInt8(1);(127&t)===this.incomingPayloadType&&(t=128&t|this.outgoingPayloadType,e.writeUInt8(t,1)),null===this.incomingSSRC&&(this.incomingSSRC=e.readUInt32BE(4)),e.writeUInt32BE(this.outgoingSSRC,8),this.sendOut(e)}},e.prototype.processRTCPMessage=function(e,t){for(var r=[],i=0;i+4<=e.length;){var n=e.readUInt8(i+1),o=4*e.readUInt16BE(i+2);if(i+4+o>e.length)break;var a=e.slice(i,i+4+o);(a=t(n,a))&&r.push(a),i+=4+o}return r.length>0?Buffer.concat(r):null},e.prototype.rtcpMessage=function(e){var t=this,r=this.processRTCPMessage(e,(function(e,r){return 200!==e||r.length<8||(null===t.incomingSSRC&&(t.incomingSSRC=r.readUInt32BE(4)),r.writeUInt32BE(t.outgoingSSRC,4)),r}));r&&this.sendOut(r)},e.prototype.rtcpReply=function(e){var t=this,r=this.processRTCPMessage(e,(function(e,r){return 201!==e||r.length<12||r.writeUInt32BE(t.incomingSSRC,8),r}));r&&this.sendOut(r)},e.prototype.createSocket=function(e){var t=this;return new Promise((function(r){var n=function(){var o=i.default.createSocket(e);o.once("error",(function(){65535===t.startingPort?t.startingPort=1e4:++t.startingPort,o.close(),n()})),o.on("listening",(function(){r(o)})),o.bind(t.startingPort)};n()}))},e.prototype.createSocketPair=function(e){var t=this;return new Promise((function(r){var n=function(){var o=i.default.createSocket(e),a=i.default.createSocket(e),s={socket1:0,socket2:0},c=function(){0!==s.socket1&&0!==s.socket2&&(2!==s.socket1||2!==s.socket2?(65534===t.startingPort?t.startingPort=1e4:++t.startingPort,o.close(),a.close(),n()):r([o,a]))};o.once("error",(function(){s.socket1=1,c()})),a.once("error",(function(){s.socket2=1,c()})),o.once("listening",(function(){s.socket1=2,c()})),a.once("listening",(function(){s.socket2=2,c()})),o.bind(t.startingPort),a.bind(t.startingPort+1)};n()}))},e}();t.default=n},8598:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamController=t.RTPStreamManagement=t.StreamRequestTypes=t.AudioStreamingSamplerate=t.AudioStreamingCodecType=t.SRTPCryptoSuites=t.AudioSamplerate=t.AudioBitrate=t.VideoCodecPacketizationMode=t.H264Level=t.H264Profile=t.VideoCodecType=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,m,g,v,y,C,S,E,_,T,A,I,D,w,b,U,R=r(1635),O=R.__importDefault(r(2613)),N=R.__importDefault(r(6982)),P=R.__importDefault(r(5753)),B=R.__importDefault(r(9278)),L=r(9826),x=r(1068),M=r(5876),F=r(8073),k=r(7739),V=R.__importStar(r(3314)),H=R.__importStar(r(2997)),j=r(9672),G=R.__importDefault(r(5989)),W=(0,P.default)("HAP-NodeJS:Camera:RTPStreamManagement");!function(e){e[e.STATUS=1]="STATUS"}(i||(i={})),function(e){e[e.AVAILABLE=0]="AVAILABLE",e[e.IN_USE=1]="IN_USE",e[e.UNAVAILABLE=2]="UNAVAILABLE"}(n||(n={})),function(e){e[e.VIDEO_CODEC_CONFIGURATION=1]="VIDEO_CODEC_CONFIGURATION"}(o||(o={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES"}(a||(a={})),function(e){e[e.PROFILE_ID=1]="PROFILE_ID",e[e.LEVEL=2]="LEVEL",e[e.PACKETIZATION_MODE=3]="PACKETIZATION_MODE",e[e.CVO_ENABLED=4]="CVO_ENABLED",e[e.CVO_ID=5]="CVO_ID"}(s||(s={})),function(e){e[e.IMAGE_WIDTH=1]="IMAGE_WIDTH",e[e.IMAGE_HEIGHT=2]="IMAGE_HEIGHT",e[e.FRAME_RATE=3]="FRAME_RATE"}(c||(c={})),function(e){e[e.H264=0]="H264"}(t.VideoCodecType||(t.VideoCodecType={})),function(e){e[e.BASELINE=0]="BASELINE",e[e.MAIN=1]="MAIN",e[e.HIGH=2]="HIGH"}(u=t.H264Profile||(t.H264Profile={})),function(e){e[e.LEVEL3_1=0]="LEVEL3_1",e[e.LEVEL3_2=1]="LEVEL3_2",e[e.LEVEL4_0=2]="LEVEL4_0"}(t.H264Level||(t.H264Level={})),function(e){e[e.NON_INTERLEAVED=0]="NON_INTERLEAVED"}(t.VideoCodecPacketizationMode||(t.VideoCodecPacketizationMode={})),function(e){e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.SUPPORTED=1]="SUPPORTED"}(l||(l={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION",e[e.COMFORT_NOISE_SUPPORT=2]="COMFORT_NOISE_SUPPORT"}(h||(h={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(d||(d={})),function(e){e[e.PCMU=0]="PCMU",e[e.PCMA=1]="PCMA",e[e.AAC_ELD=2]="AAC_ELD",e[e.OPUS=3]="OPUS",e[e.MSBC=4]="MSBC",e[e.AMR=5]="AMR",e[e.AMR_WB=6]="AMR_WB"}(p||(p={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.PACKET_TIME=4]="PACKET_TIME"}(f||(f={})),function(e){e[e.VARIABLE=0]="VARIABLE",e[e.CONSTANT=1]="CONSTANT"}(t.AudioBitrate||(t.AudioBitrate={})),function(e){e[e.KHZ_8=0]="KHZ_8",e[e.KHZ_16=1]="KHZ_16",e[e.KHZ_24=2]="KHZ_24"}(t.AudioSamplerate||(t.AudioSamplerate={})),function(e){e[e.SRTP_CRYPTO_SUITE=2]="SRTP_CRYPTO_SUITE"}(m||(m={})),function(e){e[e.AES_CM_128_HMAC_SHA1_80=0]="AES_CM_128_HMAC_SHA1_80",e[e.AES_CM_256_HMAC_SHA1_80=1]="AES_CM_256_HMAC_SHA1_80",e[e.NONE=2]="NONE"}(g=t.SRTPCryptoSuites||(t.SRTPCryptoSuites={})),function(e){e[e.SESSION_ID=1]="SESSION_ID",e[e.CONTROLLER_ADDRESS=3]="CONTROLLER_ADDRESS",e[e.VIDEO_SRTP_PARAMETERS=4]="VIDEO_SRTP_PARAMETERS",e[e.AUDIO_SRTP_PARAMETERS=5]="AUDIO_SRTP_PARAMETERS"}(v||(v={})),function(e){e[e.ADDRESS_VERSION=1]="ADDRESS_VERSION",e[e.ADDRESS=2]="ADDRESS",e[e.VIDEO_RTP_PORT=3]="VIDEO_RTP_PORT",e[e.AUDIO_RTP_PORT=4]="AUDIO_RTP_PORT"}(y||(y={})),function(e){e[e.IPV4=0]="IPV4",e[e.IPV6=1]="IPV6"}(C||(C={})),function(e){e[e.SRTP_CRYPTO_SUITE=1]="SRTP_CRYPTO_SUITE",e[e.MASTER_KEY=2]="MASTER_KEY",e[e.MASTER_SALT=3]="MASTER_SALT"}(S||(S={})),function(e){e[e.SESSION_ID=1]="SESSION_ID",e[e.STATUS=2]="STATUS",e[e.ACCESSORY_ADDRESS=3]="ACCESSORY_ADDRESS",e[e.VIDEO_SRTP_PARAMETERS=4]="VIDEO_SRTP_PARAMETERS",e[e.AUDIO_SRTP_PARAMETERS=5]="AUDIO_SRTP_PARAMETERS",e[e.VIDEO_SSRC=6]="VIDEO_SSRC",e[e.AUDIO_SSRC=7]="AUDIO_SSRC"}(E||(E={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.BUSY=1]="BUSY",e[e.ERROR=2]="ERROR"}(_||(_={})),function(e){e[e.SESSION_CONTROL=1]="SESSION_CONTROL",e[e.SELECTED_VIDEO_PARAMETERS=2]="SELECTED_VIDEO_PARAMETERS",e[e.SELECTED_AUDIO_PARAMETERS=3]="SELECTED_AUDIO_PARAMETERS"}(T||(T={})),function(e){e[e.SESSION_IDENTIFIER=1]="SESSION_IDENTIFIER",e[e.COMMAND=2]="COMMAND"}(A||(A={})),function(e){e[e.END_SESSION=0]="END_SESSION",e[e.START_SESSION=1]="START_SESSION",e[e.SUSPEND_SESSION=2]="SUSPEND_SESSION",e[e.RESUME_SESSION=3]="RESUME_SESSION",e[e.RECONFIGURE_SESSION=4]="RECONFIGURE_SESSION"}(I||(I={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES",e[e.RTP_PARAMETERS=4]="RTP_PARAMETERS"}(D||(D={})),function(e){e[e.PAYLOAD_TYPE=1]="PAYLOAD_TYPE",e[e.SYNCHRONIZATION_SOURCE=2]="SYNCHRONIZATION_SOURCE",e[e.MAX_BIT_RATE=3]="MAX_BIT_RATE",e[e.MIN_RTCP_INTERVAL=4]="MIN_RTCP_INTERVAL",e[e.MAX_MTU=5]="MAX_MTU"}(w||(w={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.RTP_PARAMETERS=3]="RTP_PARAMETERS",e[e.COMFORT_NOISE=4]="COMFORT_NOISE"}(b||(b={})),function(e){e[e.PAYLOAD_TYPE=1]="PAYLOAD_TYPE",e[e.SYNCHRONIZATION_SOURCE=2]="SYNCHRONIZATION_SOURCE",e[e.MAX_BIT_RATE=3]="MAX_BIT_RATE",e[e.MIN_RTCP_INTERVAL=4]="MIN_RTCP_INTERVAL",e[e.COMFORT_NOISE_PAYLOAD_TYPE=6]="COMFORT_NOISE_PAYLOAD_TYPE"}(U||(U={})),function(e){e.PCMU="PCMU",e.PCMA="PCMA",e.AAC_ELD="AAC-eld",e.OPUS="OPUS",e.MSBC="mSBC",e.AMR="AMR",e.AMR_WB="AMR-WB"}(t.AudioStreamingCodecType||(t.AudioStreamingCodecType={})),function(e){e[e.KHZ_8=8]="KHZ_8",e[e.KHZ_16=16]="KHZ_16",e[e.KHZ_24=24]="KHZ_24"}(t.AudioStreamingSamplerate||(t.AudioStreamingSamplerate={})),function(e){e.RECONFIGURE="reconfigure",e.START="start",e.STOP="stop"}(t.StreamRequestTypes||(t.StreamRequestTypes={}));var Y=function(){function e(t,r,i,n,o){if(this.videoOnly=!1,this.sessionIdentifier=void 0,this.streamStatus=0,this.selectedConfiguration="",this.setupEndpointsResponse="",this.id=t,this.delegate=i,this.requireProxy=r.proxy||!1,this.disableAudioProxy=r.disable_audio_proxy||!1,!function(e){return"srtp"in e}(r)?this.supportedCryptoSuites=r.supportedCryptoSuites:this.supportedCryptoSuites=[r.srtp?0:2],0===this.supportedCryptoSuites.length&&this.supportedCryptoSuites.push(2),!r.video)throw new Error("Video parameters cannot be undefined in options");this.supportedRTPConfiguration=e._supportedRTPConfiguration(this.supportedCryptoSuites),this.supportedVideoStreamConfiguration=e._supportedVideoStreamConfiguration(r.video),this.supportedAudioStreamConfiguration=this._supportedAudioStreamConfiguration(r.audio),this.activeConnectionClosedListener=this._handleStopStream.bind(this),this.service=n||this.constructService(t),this.setupServiceHandlers(),this.resetSetupEndpointsResponse(),this.resetSelectedStreamConfiguration(),this.disabledThroughOperatingMode=o}return e.prototype.forceStop=function(){this.handleSessionClosed()},e.prototype.getService=function(){return this.service},e.prototype.handleCloseConnection=function(e){},e.prototype.handleFactoryReset=function(){this.resetSelectedStreamConfiguration(),this.resetSetupEndpointsResponse(),this.service.updateCharacteristic(L.Characteristic.Active,!0)},e.prototype.destroy=function(){this.activeConnection&&this._handleStopStream()},e.prototype.constructService=function(e){var t=new M.Service.CameraRTPStreamManagement("",e.toString());return t.setCharacteristic(L.Characteristic.Active,!0),t},e.prototype.setupServiceHandlers=function(){var e=this;this.service.testCharacteristic(L.Characteristic.Active)||this.service.setCharacteristic(L.Characteristic.Active,!0),this.service.getCharacteristic(L.Characteristic.Active).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.service.setCharacteristic(L.Characteristic.SupportedRTPConfiguration,this.supportedRTPConfiguration),this.service.setCharacteristic(L.Characteristic.SupportedVideoStreamConfiguration,this.supportedVideoStreamConfiguration),this.service.setCharacteristic(L.Characteristic.SupportedAudioStreamConfiguration,this.supportedAudioStreamConfiguration),this._updateStreamStatus(0),this.service.setCharacteristic(L.Characteristic.SetupEndpoints,this.setupEndpointsResponse),this.service.getCharacteristic(L.Characteristic.SelectedRTPStreamConfiguration).on("get",(function(t){e.streamingIsDisabled()?t(null,V.encode(1,V.encode(2,I.SUSPEND_SESSION)).toString("base64")):t(null,e.selectedConfiguration)})).on("set",this._handleSelectedStreamConfigurationWrite.bind(this)),this.service.getCharacteristic(L.Characteristic.SetupEndpoints).on("get",(function(t){e.streamingIsDisabled()?t(null,V.encode(2,2).toString("base64")):t(null,e.setupEndpointsResponse)})).on("set",(function(t,r,i,n){if(!n)return W("Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!"),void r(-70410);e.handleSetupEndpoints(t,r,n)}))},e.prototype.handleSessionClosed=function(){this.resetSelectedStreamConfiguration(),this.resetSetupEndpointsResponse(),this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionClosedListener),this.activeConnection=void 0),this._updateStreamStatus(0),this.sessionIdentifier=void 0,this.connectionID=void 0,this.ipVersion=void 0,this.videoProxy&&(this.videoProxy.destroy(),this.videoProxy=void 0),this.audioProxy&&(this.audioProxy.destroy(),this.audioProxy=void 0)},e.prototype.streamingIsDisabled=function(e){var t;return this.service.getCharacteristic(L.Characteristic.Active).value?!!(null===(t=this.disabledThroughOperatingMode)||void 0===t?void 0:t.call(this))&&(e&&e(new F.HapStatusError(-70412)),!0):(e&&e(new F.HapStatusError(-70412)),!0)},e.prototype._handleSelectedStreamConfigurationWrite=function(e,t){var r=this;if(!this.streamingIsDisabled(t)){var i=Buffer.from(e,"base64"),n=V.decode(i),o=V.decode(n[1]),a=H.unparse(o[1]),s=o[2][0];if(a!==this.sessionIdentifier)return W("Received unknown session Identifier with request to ".concat(I[s])),void t(-70410);this.selectedConfiguration=e;var c=function(e,i){t(e,i),e&&r.handleSessionClosed()};switch(s){case I.START_SESSION:var u=V.decode(n[2]),l=V.decode(n[3]);this._handleStartStream(u,l,c);break;case I.RECONFIGURE_SESSION:var h=V.decode(n[2]);this.handleReconfigureStream(h,c);break;case I.END_SESSION:this._handleStopStream(c);break;case I.RESUME_SESSION:case I.SUSPEND_SESSION:default:return W("Unhandled request type ".concat(I[s])),void t(-70410)}}},e.prototype._handleStartStream=function(e,t,r){var i=e[1],n=e[2],o=e[3],a=e[4],s=V.decode(n),c=s[1][0],u=s[2][0],l=s[3][0],h=s[4],d=void 0;h&&1===h[0]&&(d=s[5].readUInt8(0));var p=V.decode(o),f=p[1].readUInt16LE(0),m=p[2].readUInt16LE(0),g=p[3].readUInt8(0),v=V.decode(a),y=v[1].readUInt8(0),C=v[2].readUInt32LE(0),S=v[3].readUInt16LE(0),E=v[4].readFloatLE(0),_="ipv6"===this.ipVersion?1228:1378;v[5]&&(_=v[5].readUInt16LE(0));var T=t[1][0],A=t[2],I=t[3],D=!!t[4].readUInt8(0),w=V.decode(A),b=w[1][0],U=w[2][0],R=w[3][0],O=w[4].readUInt8(0),N=V.decode(I),P=N[1].readUInt8(0),B=N[2].readUInt32LE(0),L=N[3].readUInt16LE(0),x=N[4].readFloatLE(0),M=N[6].readUInt8(0);this.requireProxy&&(this.videoProxy.setOutgoingPayloadType(y),this.disableAudioProxy||this.audioProxy.setOutgoingPayloadType(P));var F,k,H={codec:i.readUInt8(0),profile:c,level:u,packetizationMode:l,cvoId:d,width:f,height:m,fps:g,pt:y,ssrc:C,max_bit_rate:S,rtcp_interval:E,mtu:_};switch(T){case 0:F="PCMU";break;case 1:F="PCMA";break;case 2:F="AAC-eld";break;case 3:F="OPUS";break;case 4:F="mSBC";break;case 5:F="AMR";break;case 6:F="AMR-WB";break;default:throw new Error("Encountered unknown selected audio codec ".concat(T))}switch(R){case 0:k=8;break;case 1:k=16;break;case 2:k=24;break;default:throw new Error("Encountered unknown selected audio samplerate ".concat(R))}var j={codec:F,channel:b,bit_rate:U,sample_rate:k,packet_time:O,pt:P,ssrc:B,max_bit_rate:L,rtcp_interval:x,comfort_pt:M,comfortNoiseEnabled:D},G={sessionID:this.sessionIdentifier,type:"start",video:H,audio:j};this.delegate.handleStreamRequest(G,(function(e){return r(e)}))},e.prototype.handleReconfigureStream=function(e,t){var r=e[3],i=e[4],n=V.decode(r),o=n[1].readUInt16LE(0),a=n[2].readUInt16LE(0),s=n[3].readUInt8(0),c=V.decode(i),u={width:o,height:a,fps:s,max_bit_rate:c[3].readUInt16LE(0),rtcp_interval:c[4].readFloatLE(0)||.5},l={sessionID:this.sessionIdentifier,type:"reconfigure",video:u};this.delegate.handleStreamRequest(l,(function(e){return t(e)}))},e.prototype._handleStopStream=function(e){var t={sessionID:this.sessionIdentifier,type:"stop"};this.handleSessionClosed(),this.delegate.handleStreamRequest(t,(function(t){return e?e(t):void 0}))},e.prototype.handleSetupEndpoints=function(e,t,r){var i=this;if(!this.streamingIsDisabled(t)){var n=Buffer.from(e,"base64"),o=V.decode(n),a=H.unparse(o[1]);if(0!==this.streamStatus)return this.setupEndpointsResponse=V.encode(1,H.write(a),2,1).toString("base64"),void t();(0,O.default)(null==this.activeConnection,"Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!"),this.activeConnection=r,this.activeConnection.on("closed",this.activeConnectionClosedListener),this.connectionID=r.sessionID,this.sessionIdentifier=a,this._updateStreamStatus(1);var s=o[3],c=V.decode(s),u=c[1][0],l=c[2].toString("utf8"),h=c[3].readUInt16LE(0),d=c[4].readUInt16LE(0),p=o[4],f=V.decode(p),m=f[1][0],g=f[2],v=f[3],y=o[5],C=V.decode(y),S=C[1][0],E=C[2],_=C[3];W("Session: ",a,"\nControllerAddress: ",l,"\nVideoPort: ",h,"\nAudioPort: ",d,"\nVideo Crypto: ",m,"\nVideo Master Key: ",g,"\nVideo Master Salt: ",v,"\nAudio Crypto: ",S,"\nAudio Master Key: ",E,"\nAudio Master Salt: ",_);var T={sessionID:a,sourceAddress:r.localAddress,targetAddress:l,addressVersion:1===u?"ipv6":"ipv4",video:{port:h,srtpCryptoSuite:m,srtp_key:g,srtp_salt:v},audio:{port:d,srtpCryptoSuite:S,srtp_key:E,srtp_salt:_}},A=[];this.requireProxy&&(T.targetAddress=r.getLocalAddress(1===u?"ipv6":"ipv4"),this.videoProxy=new G.default({outgoingAddress:l,outgoingPort:h,outgoingSSRC:N.default.randomBytes(4).readUInt32LE(0),disabled:!1}),A.push(this.videoProxy.setup().then((function(){T.video.proxy_rtp=i.videoProxy.incomingRTPPort(),T.video.proxy_rtcp=i.videoProxy.incomingRTCPPort()}))),this.disableAudioProxy||(this.audioProxy=new G.default({outgoingAddress:l,outgoingPort:d,outgoingSSRC:N.default.randomBytes(4).readUInt32LE(0),disabled:this.videoOnly}),A.push(this.audioProxy.setup().then((function(){T.audio.proxy_rtp=i.audioProxy.incomingRTPPort(),T.audio.proxy_rtcp=i.audioProxy.incomingRTCPPort()}))))),Promise.all(A).then((function(){i.delegate.prepareStream(T,(0,k.once)((function(e,n){e||!n?(W("PrepareStream request encountered an error: ".concat(e?e.message:void 0)),i.setupEndpointsResponse=V.encode(1,H.write(a),2,2).toString("base64"),i.handleSessionClosed(),t(e)):i.generateSetupEndpointResponse(r,a,T,n,t)})))}))}},e.prototype.generateSetupEndpointResponse=function(e,t,r,i,n){var o,a,s,c,u,l,h,d,p,f,m,g=r.addressVersion;if(!this.videoOnly&&!i.audio)throw new Error("Audio was enabled but not supplied in PrepareStreamResponse!");var v=i.audio||{port:r.audio.port,ssrc:x.CameraController.generateSynchronisationSource(),srtp_key:r.audio.srtp_key,srtp_salt:r.audio.srtp_salt};if(this.requireProxy){C=i.video;if(o=e.getLocalAddress(r.addressVersion),c=2,u=Buffer.alloc(0),l=Buffer.alloc(0),h=2,d=Buffer.alloc(0),p=Buffer.alloc(0),this.videoProxy.setIncomingPayloadType(C.proxy_pt),this.videoProxy.setServerAddress(C.proxy_server_address),this.videoProxy.setServerRTPPort(C.proxy_server_rtp),this.videoProxy.setServerRTCPPort(C.proxy_server_rtcp),a=this.videoProxy.outgoingLocalPort(),f=this.videoProxy.outgoingSSRC,this.disableAudioProxy){s=(y=i.audio).port,m=y.ssrc}else{var y=i.audio;this.audioProxy.setIncomingPayloadType(y.proxy_pt),this.audioProxy.setServerAddress(y.proxy_server_address),this.audioProxy.setServerRTPPort(y.proxy_server_rtp),this.audioProxy.setServerRTCPPort(y.proxy_server_rtcp),s=this.audioProxy.outgoingLocalPort(),m=this.audioProxy.outgoingSSRC}}else{var C=i.video,y=v;if(i.addressOverride?(g=B.default.isIPv4(i.addressOverride)?"ipv4":"ipv6",o=i.addressOverride):o=e.getLocalAddress(g),r.addressVersion!==g)throw new Error("Incoming and outgoing ip address versions must match! Expected ".concat(r.addressVersion," but got ").concat(g));if(a=C.port,s=y.port,2!==r.video.srtpCryptoSuite&&(void 0===C.srtp_key||void 0===C.srtp_salt))throw new Error("SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!");if(2!==r.audio.srtpCryptoSuite&&(void 0===y.srtp_key||void 0===y.srtp_salt))throw new Error("SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!");c=r.video.srtpCryptoSuite,u=C.srtp_key||Buffer.alloc(0),l=C.srtp_salt||Buffer.alloc(0),h=r.audio.srtpCryptoSuite,d=y.srtp_key||Buffer.alloc(0),p=y.srtp_salt||Buffer.alloc(0),f=C.ssrc,m=y.ssrc}this.ipVersion=g;var S=V.encode(1,"ipv4"===g?0:1,2,o,3,V.writeUInt16(a),4,V.writeUInt16(s)),E=V.encode(1,c,2,u,3,l),_=V.encode(1,h,2,d,3,p);this.setupEndpointsResponse=V.encode(1,H.write(t),2,0,3,S,4,E,5,_,6,V.writeUInt32(f),7,V.writeUInt32(m)).toString("base64"),n()},e.prototype._updateStreamStatus=function(e){this.streamStatus=e,this.service.updateCharacteristic(L.Characteristic.StreamingStatus,V.encode(1,this.streamStatus).toString("base64"))},e._supportedRTPConfiguration=function(e){return 1===e.length&&2===e[0]&&W("Client claims it doesn't support SRTP. The stream may stops working with future iOS releases."),V.encode(2,e).toString("base64")},e._supportedVideoStreamConfiguration=function(e){if(!e.codec)throw new Error("Video codec cannot be undefined");if(!e.resolutions)throw new Error("Video resolutions cannot be undefined");var t=V.encode(1,e.codec.profiles,2,e.codec.levels,3,0);null!=e.cvoId&&(t=Buffer.concat([t,V.encode(4,1,5,e.cvoId)]));var r=V.encode(1,0,2,t,3,e.resolutions.map((function(e){if(3!==e.length)throw new Error("Unexpected video resolution");var t=Buffer.alloc(2),r=Buffer.alloc(2),i=Buffer.alloc(1);return t.writeUInt16LE(e[0],0),r.writeUInt16LE(e[1],0),i.writeUInt8(e[2],0),V.encode(1,t,2,r,3,i)})));return V.encode(1,r).toString("base64")},e.prototype.checkForLegacyAudioCodecRepresentation=function(e){var t={};e.slice().forEach((function(r){var i=t[r.type];if(i){"number"==typeof i.samplerate&&(i.samplerate=[i.samplerate]),i.samplerate=i.samplerate.concat(r.samplerate);var n=e.indexOf(r);n>=0&&e.splice(n,1)}else t[r.type]=r}))},e.prototype._supportedAudioStreamConfiguration=function(e){var t=e&&!!e.comfort_noise,r=e&&e.codecs||[];this.checkForLegacyAudioCodecRepresentation(r),0===r.length&&(W("Client doesn't support any audio codec that HomeKit supports."),this.videoOnly=!0,r.push({type:"OPUS",samplerate:[16,24]}));var i=r.map((function(e){var t;switch(e.type){case"OPUS":t=3;break;case"AAC-eld":t=2;break;case"PCMA":t=1;break;case"PCMU":t=0;break;case"mSBC":t=4;break;case"AMR":t=5;break;case"AMR-WB":t=6;break;default:throw new Error("Unsupported codec: "+e.type)}var r=("number"==typeof e.samplerate?[e.samplerate]:e.samplerate).map((function(t){var r;switch(t){case 8:r=0;break;case 16:r=1;break;case 24:r=2;break;default:console.log("Unsupported sample rate: ",e.samplerate),r=-1}return r})).filter((function(e){return-1!==e}));if(0===r.length)throw new Error("Audio samplerate cannot be empty!");var i=V.encode(1,Math.max(1,e.audioChannels||1),2,e.bitrate||0,3,r);return V.encode(1,t,2,i)}));return V.encode(1,i,2,t?1:0).toString("base64")},e.prototype.resetSetupEndpointsResponse=function(){this.setupEndpointsResponse=V.encode(2,2).toString("base64"),this.service.updateCharacteristic(L.Characteristic.SetupEndpoints,this.setupEndpointsResponse)},e.prototype.resetSelectedStreamConfiguration=function(){this.selectedConfiguration=V.encode(1,V.encode(2,I.SUSPEND_SESSION)).toString("base64"),this.service.updateCharacteristic(L.Characteristic.SelectedRTPStreamConfiguration,this.selectedConfiguration)},e.prototype.serialize=function(){var e=this.service.getCharacteristic(L.Characteristic.Active).value;if(!0!==e)return{id:this.id,active:!!e}},e.prototype.deserialize=function(e){(0,O.default)(e.id===this.id,"Tried to initialize RTPStreamManagement ".concat(this.id," with data from management with id ").concat(e.id,"!")),this.service.updateCharacteristic(L.Characteristic.Active,e.active)},e.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},e.SRTPCryptoSuites=g,e.VideoCodecParamProfileIDTypes=u,e.VideoCodecParamLevelTypes=Object.freeze({TYPE3_1:0,TYPE3_2:1,TYPE4_0:2}),e}();t.RTPStreamManagement=Y;var q=function(e){function t(t,r,i,n){var o=e.call(this,t,r,new j.LegacyCameraSourceAdapter(i),n)||this;return o.options=r,o}return R.__extends(t,e),t}(Y);t.StreamController=q},6859:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RecordingManagement=t.PacketDataType=t.AudioRecordingSamplerate=t.AudioRecordingCodecType=t.MediaContainerType=t.EventTriggerOption=void 0;var i,n,o,a,s,c,u,l,h,d,p,f=r(1635),m=f.__importDefault(r(6982)),g=f.__importDefault(r(5753)),v=r(4434),y=r(9826),C=r(9948),S=r(5876),E=r(8073),_=f.__importStar(r(3314)),T=(0,g.default)("HAP-NodeJS:Camera:RecordingManagement");!function(e){e[e.MOTION=1]="MOTION",e[e.DOORBELL=2]="DOORBELL"}(t.EventTriggerOption||(t.EventTriggerOption={})),function(e){e[e.FRAGMENTED_MP4=0]="FRAGMENTED_MP4"}(t.MediaContainerType||(t.MediaContainerType={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES"}(i||(i={})),function(e){e[e.PROFILE_ID=1]="PROFILE_ID",e[e.LEVEL=2]="LEVEL",e[e.BITRATE=3]="BITRATE",e[e.IFRAME_INTERVAL=4]="IFRAME_INTERVAL"}(n||(n={})),function(e){e[e.IMAGE_WIDTH=1]="IMAGE_WIDTH",e[e.IMAGE_HEIGHT=2]="IMAGE_HEIGHT",e[e.FRAME_RATE=3]="FRAME_RATE"}(o||(o={})),function(e){e[e.SELECTED_RECORDING_CONFIGURATION=1]="SELECTED_RECORDING_CONFIGURATION",e[e.SELECTED_VIDEO_CONFIGURATION=2]="SELECTED_VIDEO_CONFIGURATION",e[e.SELECTED_AUDIO_CONFIGURATION=3]="SELECTED_AUDIO_CONFIGURATION"}(a||(a={})),function(e){e[e.AAC_LC=0]="AAC_LC",e[e.AAC_ELD=1]="AAC_ELD"}(t.AudioRecordingCodecType||(t.AudioRecordingCodecType={})),function(e){e[e.KHZ_8=0]="KHZ_8",e[e.KHZ_16=1]="KHZ_16",e[e.KHZ_24=2]="KHZ_24",e[e.KHZ_32=3]="KHZ_32",e[e.KHZ_44_1=4]="KHZ_44_1",e[e.KHZ_48=5]="KHZ_48"}(t.AudioRecordingSamplerate||(t.AudioRecordingSamplerate={})),function(e){e[e.VIDEO_CODEC_CONFIGURATION=1]="VIDEO_CODEC_CONFIGURATION"}(s||(s={})),function(e){e[e.PREBUFFER_LENGTH=1]="PREBUFFER_LENGTH",e[e.EVENT_TRIGGER_OPTIONS=2]="EVENT_TRIGGER_OPTIONS",e[e.MEDIA_CONTAINER_CONFIGURATIONS=3]="MEDIA_CONTAINER_CONFIGURATIONS"}(c||(c={})),function(e){e[e.MEDIA_CONTAINER_TYPE=1]="MEDIA_CONTAINER_TYPE",e[e.MEDIA_CONTAINER_PARAMETERS=2]="MEDIA_CONTAINER_PARAMETERS"}(u||(u={})),function(e){e[e.FRAGMENT_LENGTH=1]="FRAGMENT_LENGTH"}(l||(l={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.MAX_AUDIO_BITRATE=4]="MAX_AUDIO_BITRATE"}(h||(h={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(d||(d={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION"}(p||(p={})),function(e){e.MEDIA_INITIALIZATION="mediaInitialization",e.MEDIA_FRAGMENT="mediaFragment"}(t.PacketDataType||(t.PacketDataType={}));var A,I=function(){function e(e,t,r,i){var n,o;this.sensorServices=[],this.recordingActive=!1,this.options=e,this.delegate=t;var a=i||this.constructService();this.recordingManagementService=a.recordingManagement,this.operatingModeService=a.operatingMode,this.dataStreamManagement=a.dataStreamManagement,this.eventTriggerOptions=0;try{for(var s=f.__values(r),c=s.next();!c.done;c=s.next()){var u=c.value;this.eventTriggerOptions|=u}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}this.supportedCameraRecordingConfiguration=this._supportedCameraRecordingConfiguration(e),this.supportedVideoRecordingConfiguration=this._supportedVideoRecordingConfiguration(e.video),this.supportedAudioRecordingConfiguration=this._supportedAudioStreamConfiguration(e.audio),this.setupServiceHandlers()}return e.prototype.constructService=function(){var e=new S.Service.CameraRecordingManagement("","");e.setCharacteristic(y.Characteristic.Active,!1),e.setCharacteristic(y.Characteristic.RecordingAudioActive,!1);var t=new S.Service.CameraOperatingMode("","");t.setCharacteristic(y.Characteristic.EventSnapshotsActive,!0),t.setCharacteristic(y.Characteristic.HomeKitCameraActive,!0),t.setCharacteristic(y.Characteristic.PeriodicSnapshotsActive,!0);var r=new C.DataStreamManagement;return e.addLinkedService(r.getService()),{recordingManagement:e,operatingMode:t,dataStreamManagement:r}},e.prototype.setupServiceHandlers=function(){var e=this;this.recordingManagementService.setCharacteristic(y.Characteristic.SupportedCameraRecordingConfiguration,this.supportedCameraRecordingConfiguration),this.recordingManagementService.setCharacteristic(y.Characteristic.SupportedVideoRecordingConfiguration,this.supportedVideoRecordingConfiguration),this.recordingManagementService.setCharacteristic(y.Characteristic.SupportedAudioRecordingConfiguration,this.supportedAudioRecordingConfiguration),this.recordingManagementService.getCharacteristic(y.Characteristic.SelectedCameraRecordingConfiguration).onGet(this.handleSelectedCameraRecordingConfigurationRead.bind(this)).onSet(this.handleSelectedCameraRecordingConfigurationWrite.bind(this)).setProps({adminOnlyAccess:[1]}),this.recordingManagementService.getCharacteristic(y.Characteristic.Active).onSet((function(t){!!t!==e.recordingActive&&(e.recordingActive=!!t,e.delegate.updateRecordingActive(e.recordingActive))})).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.recordingManagementService.getCharacteristic(y.Characteristic.RecordingAudioActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})),this.operatingModeService.getCharacteristic(y.Characteristic.HomeKitCameraActive).on("change",(function(t){var r,i,n;try{for(var o=f.__values(e.sensorServices),a=o.next();!a.done;a=o.next()){a.value.setCharacteristic(y.Characteristic.StatusActive,!!t.newValue)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}!t.newValue&&e.recordingStream&&e.recordingStream.close(1),null===(n=e.stateChangeDelegate)||void 0===n||n.call(e)})).setProps({adminOnlyAccess:[1]}),this.operatingModeService.getCharacteristic(y.Characteristic.EventSnapshotsActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.operatingModeService.getCharacteristic(y.Characteristic.PeriodicSnapshotsActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.dataStreamManagement.onRequestMessage("dataSend","open",this.handleDataSendOpen.bind(this))},e.prototype.handleDataSendOpen=function(e,t,r){var i=this,n=r.streamId,o=r.type,a=r.target,s=r.reason;if("controller"!==a||"ipcamera.recording"!==o)return T("[HDS %s] Received data send with unexpected target: %s or type: %d. Rejecting...",e.remoteAddress,a,o),void e.sendResponse("dataSend","open",t,C.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:5});if(this.recordingActive){if(this.operatingModeService.getCharacteristic(y.Characteristic.HomeKitCameraActive).value)return this.recordingStream?(T("[HDS %s] Rejecting DATA_SEND OPEN as another stream (%s) is already recording with streamId %d!",e.remoteAddress,this.recordingStream.connection.remoteAddress,this.recordingStream.streamId),void e.sendResponse("dataSend","open",t,C.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:2})):void(this.selectedConfiguration?(T("[HDS %s] HDS DATA_SEND Open with reason '%s'.",e.remoteAddress,s),this.recordingStream=new D(e,this.delegate,t,n),this.recordingStream.on("closed",(function(){T("[HDS %s] Removing active recoding session from recording management!"),i.recordingStream=void 0})),this.recordingStream.startStreaming()):e.sendResponse("dataSend","open",t,C.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:9}));e.sendResponse("dataSend","open",t,C.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:1})}else e.sendResponse("dataSend","open",t,C.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:1})},e.prototype.handleSelectedCameraRecordingConfigurationRead=function(){if(!this.selectedConfiguration)throw new E.HapStatusError(-70402);return this.selectedConfiguration.base64},e.prototype.handleSelectedCameraRecordingConfigurationWrite=function(e){var t,r,i=this.parseSelectedConfiguration(e),n=(null===(t=this.selectedConfiguration)||void 0===t?void 0:t.base64)!==e;this.selectedConfiguration={parsed:i,base64:e},n&&(this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed),null===(r=this.stateChangeDelegate)||void 0===r||r.call(this))},e.prototype.parseSelectedConfiguration=function(e){for(var t=_.decode(Buffer.from(e,"base64")),r=_.decode(t[1]),i=_.decode(t[2]),n=_.decode(t[3]),o=r[1].readInt32LE(0),a=r[2].readInt32LE(0),s=_.decode(r[3]),c=s[1][0],u=_.decode(s[2])[1].readInt32LE(0),l=i[1][0],h=_.decode(i[2]),d=_.decode(i[3]),p=h[1][0],f=h[2][0],m=h[3].readInt32LE(0),g=h[4].readInt32LE(0),v=d[1].readInt16LE(0),y=d[2].readInt16LE(0),C=d[3][0],S=n[1][0],E=_.decode(n[2]),T=E[1][0],A=E[3][0],I=E[2][0],D=E[4].readUInt32LE(0),w=[],b=0;a>0;)1&a&&w.push(1<>=1,b+=1;return{prebufferLength:o,eventTriggerTypes:w,mediaContainerConfiguration:{type:c,fragmentLength:u},videoCodec:{type:l,parameters:{profile:p,level:f,bitRate:m,iFrameInterval:g},resolution:[v,y,C]},audioCodec:{audioChannels:T,type:S,samplerate:A,bitrateMode:I,bitrate:D}}},e.prototype._supportedCameraRecordingConfiguration=function(e){var t=Array.isArray(e.mediaContainerConfiguration)?e.mediaContainerConfiguration:[e.mediaContainerConfiguration],r=Buffer.alloc(4),i=Buffer.alloc(8);return r.writeInt32LE(e.prebufferLength,0),i.writeInt32LE(this.eventTriggerOptions,0),_.encode(1,r,2,i,3,t.map((function(e){var t=Buffer.alloc(4);return t.writeInt32LE(e.fragmentLength,0),_.encode(1,e.type,2,_.encode(1,t))}))).toString("base64")},e.prototype._supportedVideoRecordingConfiguration=function(e){if(!e.parameters)throw new Error("Video parameters cannot be undefined");if(!e.resolutions)throw new Error("Video resolutions cannot be undefined");var t=_.encode(1,e.parameters.profiles,2,e.parameters.levels),r=_.encode(1,e.type,2,t,3,e.resolutions.map((function(e){if(3!==e.length)throw new Error("Unexpected video resolution");var t=Buffer.alloc(2),r=Buffer.alloc(2),i=Buffer.alloc(1);return t.writeUInt16LE(e[0],0),r.writeUInt16LE(e[1],0),i.writeUInt8(e[2],0),_.encode(1,t,2,r,3,i)})));return _.encode(1,r).toString("base64")},e.prototype._supportedAudioStreamConfiguration=function(e){var t=Array.isArray(e.codecs)?e.codecs:[e.codecs];if(0===t.length)throw Error("CameraRecordingOptions.audio: At least one audio codec configuration must be specified!");var r=t.map((function(e){var t=Array.isArray(e.samplerate)?e.samplerate:[e.samplerate];if(0===t.length)throw new Error("CameraRecordingOptions.audio.codecs: Audio samplerate cannot be empty!");var r=_.encode(1,Math.max(1,e.audioChannels||1),2,e.bitrateMode||0,3,t);return _.encode(1,e.type,2,r)}));return _.encode(1,r).toString("base64")},e.prototype.computeConfigurationHash=function(e){void 0===e&&(e="sha256");var t=m.default.createHash(e);return t.update(this.supportedCameraRecordingConfiguration),t.update(this.supportedVideoRecordingConfiguration),t.update(this.supportedAudioRecordingConfiguration),t.digest().toString("hex")},e.prototype.serialize=function(){var e;return{configurationHash:{algorithm:"sha256",hash:this.computeConfigurationHash("sha256")},selectedConfiguration:null===(e=this.selectedConfiguration)||void 0===e?void 0:e.base64,recordingActive:this.recordingActive,recordingAudioActive:!!this.recordingManagementService.getCharacteristic(y.Characteristic.RecordingAudioActive).value,eventSnapshotsActive:!!this.operatingModeService.getCharacteristic(y.Characteristic.EventSnapshotsActive).value,homeKitCameraActive:!!this.operatingModeService.getCharacteristic(y.Characteristic.HomeKitCameraActive).value,periodicSnapshotsActive:!!this.operatingModeService.getCharacteristic(y.Characteristic.PeriodicSnapshotsActive).value}},e.prototype.deserialize=function(e){var t,r,i,n=!1,o=this.computeConfigurationHash(e.configurationHash.algorithm);e.selectedConfiguration&&(o===e.configurationHash.hash?this.selectedConfiguration={base64:e.selectedConfiguration,parsed:this.parseSelectedConfiguration(e.selectedConfiguration)}:n=!0),this.recordingActive=e.recordingActive,this.recordingManagementService.updateCharacteristic(y.Characteristic.Active,e.recordingActive),this.recordingManagementService.updateCharacteristic(y.Characteristic.RecordingAudioActive,e.recordingAudioActive),this.operatingModeService.updateCharacteristic(y.Characteristic.EventSnapshotsActive,e.eventSnapshotsActive),this.operatingModeService.updateCharacteristic(y.Characteristic.PeriodicSnapshotsActive,e.periodicSnapshotsActive),this.operatingModeService.updateCharacteristic(y.Characteristic.HomeKitCameraActive,e.homeKitCameraActive);try{for(var a=f.__values(this.sensorServices),s=a.next();!s.done;s=a.next()){s.value.setCharacteristic(y.Characteristic.StatusActive,e.homeKitCameraActive)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}try{this.selectedConfiguration&&this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed),e.recordingActive&&this.delegate.updateRecordingActive(e.recordingActive)}catch(e){console.error("Failed to properly initialize CameraRecordingDelegate from persistent storage: "+e.stack)}n&&(null===(i=this.stateChangeDelegate)||void 0===i||i.call(this))},e.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},e.prototype.destroy=function(){this.dataStreamManagement.destroy()},e.prototype.handleFactoryReset=function(){var e,t;this.selectedConfiguration=void 0,this.recordingManagementService.updateCharacteristic(y.Characteristic.Active,!1),this.recordingManagementService.updateCharacteristic(y.Characteristic.RecordingAudioActive,!1),this.operatingModeService.updateCharacteristic(y.Characteristic.EventSnapshotsActive,!0),this.operatingModeService.updateCharacteristic(y.Characteristic.PeriodicSnapshotsActive,!0),this.operatingModeService.updateCharacteristic(y.Characteristic.HomeKitCameraActive,!0);try{for(var r=f.__values(this.sensorServices),i=r.next();!i.done;i=r.next()){i.value.setCharacteristic(y.Characteristic.StatusActive,!0)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}try{this.delegate.updateRecordingActive(!1),this.delegate.updateRecordingConfiguration(void 0)}catch(e){console.error("CameraRecordingDelegate failed to update state after handleFactoryReset: "+e.stack)}},e}();t.RecordingManagement=I,function(e){e.CLOSED="closed"}(A||(A={}));var D=function(e){function t(t,r,i,n){var o,a=e.call(this)||this;return a.closed=!1,a.eventHandler=((o={}).close=a.handleDataSendClose.bind(a),o.ack=a.handleDataSendAck.bind(a),o),a.requestHandler=void 0,a.connection=t,a.delegate=r,a.hdsRequestId=i,a.streamId=n,a.connection.on("closed",a.closeListener=a.handleDataStreamConnectionClosed.bind(a)),a.connection.addProtocolHandler("dataSend",a),a}return f.__extends(t,e),t.prototype.startStreaming=function(){this._startStreaming()},t.prototype._startStreaming=function(){var e,t,r,i;return f.__awaiter(this,void 0,void 0,(function(){var n,o,a,s,c,u,l,h,d,p,m,g,v,y,S,E;return f.__generator(this,(function(_){switch(_.label){case 0:T("[HDS %s] Sending DATA_SEND OPEN response for streamId %d",this.connection.remoteAddress,this.streamId),this.connection.sendResponse("dataSend","open",this.hdsRequestId,C.HDSStatus.SUCCESS,{status:C.HDSStatus.SUCCESS}),n=262144,o=!0,a=1,s=!1,_.label=1;case 1:_.trys.push([1,14,15,16]),this.generator=this.delegate.handleRecordingStreamRequest(this.streamId),_.label=2;case 2:_.trys.push([2,7,8,13]),c=!0,u=f.__asyncValues(this.generator),_.label=3;case 3:return[4,u.next()];case 4:if(l=_.sent(),e=l.done)return[3,6];i=l.value,c=!1;try{if(h=i,this.closed)return console.error("[HDS ".concat(this.connection.remoteAddress,"] Delegate yielded fragment after stream ").concat(this.streamId," was already closed!")),[3,6];if(s)return console.error("[HDS ".concat(this.connection.remoteAddress,"] Delegate yielded fragment for stream ").concat(this.streamId," after already signaling end of stream!")),[3,6];for(d=h.data,p=0,m=1;p=d.length,dataTotalSize:1===m?d.length:void 0}}],endOfStream:p>=d.length?Boolean(h.isLast).valueOf():void 0},T("[HDS %s] Sending DATA_SEND DATA for stream %d with metadata: %o and length %d; EoS: %s",this.connection.remoteAddress,this.streamId,v.packets[0].metadata,g.length,v.endOfStream),this.connection.sendEvent("dataSend","data",v),m++,o=!1;if(s=h.isLast,h.isLast)return[3,6];a++}finally{c=!0}_.label=5;case 5:return[3,3];case 6:return[3,13];case 7:return y=_.sent(),t={error:y},[3,13];case 8:return _.trys.push([8,,11,12]),c||e||!(r=u.return)?[3,10]:[4,r.call(u)];case 9:_.sent(),_.label=10;case 10:return[3,12];case 11:if(t)throw t.error;return[7];case 12:return[7];case 13:return s||this.closed||console.warn("[HDS ".concat(this.connection.remoteAddress,"] Delegate finished streaming for ").concat(this.streamId," without setting RecordingPacket.isLast. Can't notify Controller about endOfStream!")),[3,16];case 14:if(S=_.sent(),this.closed)console.warn("[HDS ".concat(this.connection.remoteAddress,"] Encountered unexpected error on already closed recording stream ").concat(this.streamId,": ").concat(S.stack));else{if(E=5,S instanceof C.HDSProtocolError)E=S.reason,T("[HDS %s] Delegate signaled to close the recording stream %d.",this.connection.remoteAddress,this.streamId);else{if(S instanceof C.HDSConnectionError&&2===S.type)return T("[HDS %s] Exited recording stream due to closed HDS socket: stream id %d.",this.connection.remoteAddress,this.streamId),[2];console.error("[HDS ".concat(this.connection.remoteAddress,"] Encountered unexpected error for recording stream ").concat(this.streamId,": ").concat(S.stack))}this.close(E)}return[2];case 15:return this.generator=void 0,this.generatorTimeout&&clearTimeout(this.generatorTimeout),this.closed||this.kickOffCloseTimeout(),[7];case 16:return o&&console.warn("[HDS ".concat(this.connection.remoteAddress,"] Delegate finished recording stream ").concat(this.streamId," without sending anything out. Controller will CANCEL.")),T("[HDS %s] Finished DATA_SEND transmission for stream %d!",this.connection.remoteAddress,this.streamId),[2]}}))}))},t.prototype.handleDataSendAck=function(e){var t=this,r=e.streamId,i=e.endOfStream;T("[HDS %s] Received DATA_SEND ACK packet for streamId %s. Acknowledged %s.",this.connection.remoteAddress,r,i),this.handleClosed((function(){var e,r;return null===(r=(e=t.delegate).acknowledgeStream)||void 0===r?void 0:r.call(e,t.streamId)}))},t.prototype.handleDataSendClose=function(e){var t=this,r=e.streamId,i=e.reason;r===this.streamId&&(T("[HDS %s] Received DATA_SEND CLOSE for streamId %d with reason %s",this.connection.remoteAddress,r,C.HDSProtocolSpecificErrorReason[i]),this.handleClosed((function(){return t.delegate.closeRecordingStream(r,i)})))},t.prototype.handleDataStreamConnectionClosed=function(){var e=this;T("[HDS %s] The HDS connection of the stream %d closed.",this.connection.remoteAddress,this.streamId),this.handleClosed((function(){return e.delegate.closeRecordingStream(e.streamId,void 0)}))},t.prototype.handleClosed=function(e){var t=this;this.closed=!0,this.closingTimeout&&(clearTimeout(this.closingTimeout),this.closingTimeout=void 0),this.connection.removeProtocolHandler("dataSend",this),this.connection.removeListener("closed",this.closeListener),this.generator&&(this.generatorTimeout=setTimeout((function(){console.error("[HDS %s] Recording download stream %d is still awaiting generator although stream was closed 10s ago! This is a programming mistake by the camera implementation which prevents freeing up resources.",t.connection.remoteAddress,t.streamId)}),1e4));try{e()}catch(e){console.error("[HDS ".concat(this.connection.remoteAddress,"] CameraRecordingDelegated failed to handle closing the stream ").concat(this.streamId,": ").concat(e.stack))}this.emit("closed")},t.prototype.close=function(e){var t=this;this.closed||(T("[HDS %s] Recording stream %d was closed manually with reason %s.",this.connection.remoteAddress,this.streamId,e?C.HDSProtocolSpecificErrorReason[e]:"CLOSED"),this.connection.isConsideredClosed()||this.connection.sendEvent("dataSend","close",{streamId:this.streamId,reason:e}),this.handleClosed((function(){return t.delegate.closeRecordingStream(t.streamId,e)})))},t.prototype.kickOffCloseTimeout=function(){var e=this;this.closingTimeout&&clearTimeout(this.closingTimeout),this.closingTimeout=setTimeout((function(){e.closed||(T("[HDS %s] Recording stream %d took longer than expected to fully close. Force closing now!",e.connection.remoteAddress,e.streamId),e.close(3))}),12e3)},t}(v.EventEmitter)},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(9672),t),i.__exportStar(r(5989),t),i.__exportStar(r(8598),t),i.__exportStar(r(6859),t)},6864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdaptiveLightingController=t.AdaptiveLightingControllerEvents=t.AdaptiveLightingControllerMode=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,m,g=r(1635),v=g.__importDefault(r(2613)),y=r(2175),C=r(8073),S=r(1579),E=g.__importStar(r(2997)),_=g.__importDefault(r(5753)),T=r(4434),A=r(9826),I=g.__importStar(r(3314)),D=(0,_.default)("HAP-NodeJS:Controller:TransitionControl");!function(e){e[e.SUPPORTED_TRANSITION_CONFIGURATION=1]="SUPPORTED_TRANSITION_CONFIGURATION"}(i||(i={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_TYPE=2]="TRANSITION_TYPE"}(n||(n={})),function(e){e[e.BRIGHTNESS=1]="BRIGHTNESS",e[e.COLOR_TEMPERATURE=2]="COLOR_TEMPERATURE"}(o||(o={})),function(e){e[e.READ_CURRENT_VALUE_TRANSITION_CONFIGURATION=1]="READ_CURRENT_VALUE_TRANSITION_CONFIGURATION",e[e.UPDATE_VALUE_TRANSITION_CONFIGURATION=2]="UPDATE_VALUE_TRANSITION_CONFIGURATION"}(a||(a={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID"}(s||(s={})),function(e){e[e.VALUE_TRANSITION_CONFIGURATION=1]="VALUE_TRANSITION_CONFIGURATION"}(c||(c={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_PARAMETERS=2]="TRANSITION_PARAMETERS",e[e.UNKNOWN_3=3]="UNKNOWN_3",e[e.UNKNOWN_4=4]="UNKNOWN_4",e[e.TRANSITION_CURVE_CONFIGURATION=5]="TRANSITION_CURVE_CONFIGURATION",e[e.UPDATE_INTERVAL=6]="UPDATE_INTERVAL",e[e.UNKNOWN_7=7]="UNKNOWN_7",e[e.NOTIFY_INTERVAL_THRESHOLD=8]="NOTIFY_INTERVAL_THRESHOLD"}(u||(u={})),function(e){e[e.TRANSITION_ID=1]="TRANSITION_ID",e[e.START_TIME=2]="START_TIME",e[e.UNKNOWN_3=3]="UNKNOWN_3"}(l||(l={})),function(e){e[e.TRANSITION_ENTRY=1]="TRANSITION_ENTRY",e[e.ADJUSTMENT_CHARACTERISTIC_IID=2]="ADJUSTMENT_CHARACTERISTIC_IID",e[e.ADJUSTMENT_MULTIPLIER_RANGE=3]="ADJUSTMENT_MULTIPLIER_RANGE"}(h||(h={})),function(e){e[e.ADJUSTMENT_FACTOR=1]="ADJUSTMENT_FACTOR",e[e.VALUE=2]="VALUE",e[e.TRANSITION_OFFSET=3]="TRANSITION_OFFSET",e[e.DURATION=4]="DURATION"}(d||(d={})),function(e){e[e.MINIMUM_ADJUSTMENT_MULTIPLIER=1]="MINIMUM_ADJUSTMENT_MULTIPLIER",e[e.MAXIMUM_ADJUSTMENT_MULTIPLIER=2]="MAXIMUM_ADJUSTMENT_MULTIPLIER"}(p||(p={})),function(e){e[e.VALUE_CONFIGURATION_STATUS=1]="VALUE_CONFIGURATION_STATUS"}(f||(f={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_PARAMETERS=2]="TRANSITION_PARAMETERS",e[e.TIME_SINCE_START=3]="TIME_SINCE_START"}(m||(m={})),function(e){e[e.AUTOMATIC=1]="AUTOMATIC",e[e.MANUAL=2]="MANUAL"}(t.AdaptiveLightingControllerMode||(t.AdaptiveLightingControllerMode={})),function(e){e.UPDATE="update",e.DISABLED="disable"}(t.AdaptiveLightingControllerEvents||(t.AdaptiveLightingControllerEvents={}));var w=function(e){function t(t,r){var i,n,o=this;return(o=e.call(this)||this).didRunFirstInitializationStep=!1,o.lastEventNotificationSent=0,o.lastNotifiedTemperatureValue=0,o.lastNotifiedSaturationValue=0,o.lastNotifiedHueValue=0,o.lightbulb=t,o.mode=null!==(i=null==r?void 0:r.controllerMode)&&void 0!==i?i:1,o.customTemperatureAdjustment=null!==(n=null==r?void 0:r.customTemperatureAdjustment)&&void 0!==n?n:0,(0,v.default)(o.lightbulb.testCharacteristic(A.Characteristic.ColorTemperature),"Lightbulb must have the ColorTemperature characteristic added!"),(0,v.default)(o.lightbulb.testCharacteristic(A.Characteristic.Brightness),"Lightbulb must have the Brightness characteristic added!"),o.adjustmentFactorChangedListener=o.handleAdjustmentFactorChanged.bind(o),o.characteristicManualWrittenChangeListener=o.handleCharacteristicManualWritten.bind(o),o}return g.__extends(t,e),t.prototype.controllerId=function(){return"characteristic-transition-"+this.lightbulb.getServiceId()},t.prototype.isAdaptiveLightingActive=function(){return!!this.activeTransition},t.prototype.disableAdaptiveLighting=function(){var e;this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),this.activeTransition&&(this.colorTemperatureCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.brightnessCharacteristic.removeListener("change",this.adjustmentFactorChangedListener),this.hueCharacteristic&&this.hueCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.saturationCharacteristic&&this.saturationCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.activeTransition=void 0,null===(e=this.stateChangeDelegate)||void 0===e||e.call(this)),this.colorTemperatureCharacteristic=void 0,this.brightnessCharacteristic=void 0,this.hueCharacteristic=void 0,this.saturationCharacteristic=void 0,this.lastTransitionPointInfo=void 0,this.lastEventNotificationSent=0,this.lastNotifiedTemperatureValue=0,this.lastNotifiedSaturationValue=0,this.lastNotifiedHueValue=0,this.didRunFirstInitializationStep=!1,this.activeTransitionCount.sendEventNotification(0),D("[%s] Disabling adaptive lighting",this.lightbulb.displayName)},t.prototype.getAdaptiveLightingStartTimeOfTransition=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.transitionStartMillis},t.prototype.getAdaptiveLightingTimeOffset=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.timeMillisOffset},t.prototype.getAdaptiveLightingTransitionCurve=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.transitionCurve},t.prototype.getAdaptiveLightingBrightnessMultiplierRange=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.brightnessAdjustmentRange},t.prototype.getAdaptiveLightingUpdateInterval=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.updateInterval},t.prototype.getAdaptiveLightingNotifyIntervalThreshold=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.notifyIntervalThreshold},t.prototype.handleActiveTransitionUpdated=function(e){var t;if(void 0===e&&(e=!1),e?this.activeTransitionCount.value=1:this.activeTransitionCount.sendEventNotification(1),1===this.mode)this.scheduleNextUpdate();else{if(2!==this.mode)throw new Error("Unsupported adaptive lighting controller mode: "+this.mode);this.emit("update")}e||null===(t=this.stateChangeDelegate)||void 0===t||t.call(this)},t.prototype.handleAdaptiveLightingEnabled=function(){if(!this.activeTransition)throw new Error("There is no active transition!");this.colorTemperatureCharacteristic=this.lightbulb.getCharacteristic(A.Characteristic.ColorTemperature),this.brightnessCharacteristic=this.lightbulb.getCharacteristic(A.Characteristic.Brightness),this.colorTemperatureCharacteristic.on("change",this.characteristicManualWrittenChangeListener),this.brightnessCharacteristic.on("change",this.adjustmentFactorChangedListener),this.lightbulb.testCharacteristic(A.Characteristic.Hue)&&(this.hueCharacteristic=this.lightbulb.getCharacteristic(A.Characteristic.Hue).on("change",this.characteristicManualWrittenChangeListener)),this.lightbulb.testCharacteristic(A.Characteristic.Saturation)&&(this.saturationCharacteristic=this.lightbulb.getCharacteristic(A.Characteristic.Saturation).on("change",this.characteristicManualWrittenChangeListener))},t.prototype.handleAdaptiveLightingDisabled=function(){2===this.mode&&this.activeTransition&&this.emit("disable"),this.disableAdaptiveLighting()},t.prototype.handleAdjustmentFactorChanged=function(e){var t=this;e.newValue!==e.oldValue&&("read"===e.reason?setTimeout((function(){t.activeTransition&&t.scheduleNextUpdate(!0)}),1e3).unref():this.scheduleNextUpdate(!0))},t.prototype.handleCharacteristicManualWritten=function(e){var t;"write"!==e.reason||(t=e.context)&&"controller"in t&&e.context.controller===this||(D("[%s] Received a manual write to an characteristic (newValue: %d, oldValue: %d, reason: %s). Thus disabling adaptive lighting!",this.lightbulb.displayName,e.newValue,e.oldValue,e.reason),this.disableAdaptiveLighting())},t.prototype.getCurrentAdaptiveLightingTransitionPoint=function(){var e,t,r,i,n;if(!this.activeTransition)throw new Error("Cannot calculate current transition point if no transition is active!");for(var o=Date.now()-this.activeTransition.timeMillisOffset-this.activeTransition.transitionStartMillis,a=null!==(t=null===(e=this.lastTransitionPointInfo)||void 0===e?void 0:e.curveIndex)&&void 0!==t?t:0,s=null!==(i=null===(r=this.lastTransitionPointInfo)||void 0===r?void 0:r.lowerBoundTimeOffset)&&void 0!==i?i:0,c=void 0,u=void 0;a+1=(s+=l.transitionTime)){if(o<=s+d+h.transitionTime){c=l,u=h;break}}else if(this.lastTransitionPointInfo)return this.lastTransitionPointInfo=void 0,this.getCurrentAdaptiveLightingTransitionPoint();s+=d}if(c&&u)return this.lastTransitionPointInfo={curveIndex:a,lowerBoundTimeOffset:s-c.transitionTime},{lowerBoundTimeOffset:s,transitionOffset:o-s,lowerBound:c,upperBound:u};this.lastTransitionPointInfo=void 0},t.prototype.scheduleNextUpdate=function(e){var t,r,i,n,o,a=this;if(void 0===e&&(e=!1),!this.activeTransition)throw new Error("tried scheduling transition when no transition was active!");e||(this.updateTimeout=void 0),this.didRunFirstInitializationStep||(this.didRunFirstInitializationStep=!0,this.handleAdaptiveLightingEnabled());var s=this.getCurrentAdaptiveLightingTransitionPoint();if(!s)return D("[%s] Reached end of transition curve!",this.lightbulb.displayName),void(e||this.disableAdaptiveLighting());var c,u,l=s.lowerBound,h=s.upperBound;if(l.duration&&s.transitionOffset<=l.duration)c=l.temperature,u=l.brightnessAdjustmentFactor;else{var d=(s.transitionOffset-(null!==(t=l.duration)&&void 0!==t?t:0))/h.transitionTime;c=l.temperature+(h.temperature-l.temperature)*d,u=l.brightnessAdjustmentFactor+(h.brightnessAdjustmentFactor-l.brightnessAdjustmentFactor)*d}var p=Math.max(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue,Math.min(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue,this.brightnessCharacteristic.value)),f=Math.round(c+u*p);f+=this.customTemperatureAdjustment;var m=null!==(i=null===(r=this.colorTemperatureCharacteristic)||void 0===r?void 0:r.props.minValue)&&void 0!==i?i:140,g=null!==(o=null===(n=this.colorTemperatureCharacteristic)||void 0===n?void 0:n.props.maxValue)&&void 0!==o?o:500;f=Math.max(m,Math.min(g,f));var v=y.ColorUtils.colorTemperatureToHueAndSaturation(f);D("[%s] Next temperature value is %d (for brightness %d adj: %s)",this.lightbulb.displayName,f,p,this.customTemperatureAdjustment);var C={controller:this,omitEventUpdate:!0};if(this.saturationCharacteristic&&(this.saturationCharacteristic.value=v.saturation),this.hueCharacteristic&&(this.hueCharacteristic.value=v.hue),this.colorTemperatureCharacteristic.handleSetRequest(f,void 0,C).catch((function(e){D("[%s] Failed to next adaptive lighting transition point: %d",a.lightbulb.displayName,e)})),this.activeTransition){var S=Date.now();if(!e&&S-this.lastEventNotificationSent>=this.activeTransition.notifyIntervalThreshold){D("[%s] Sending event notifications for current transition!",this.lightbulb.displayName),this.lastEventNotificationSent=S;var E={controller:this};this.lastNotifiedTemperatureValue!==f&&(this.colorTemperatureCharacteristic.sendEventNotification(f,E),this.lastNotifiedTemperatureValue=f),this.saturationCharacteristic&&this.lastNotifiedSaturationValue!==v.saturation&&(this.saturationCharacteristic.sendEventNotification(v.saturation,E),this.lastNotifiedSaturationValue=v.saturation),this.hueCharacteristic&&this.lastNotifiedHueValue!==v.hue&&(this.hueCharacteristic.sendEventNotification(v.hue,E),this.lastNotifiedHueValue=v.hue)}e||(this.updateTimeout=setTimeout(this.scheduleNextUpdate.bind(this),this.activeTransition.updateInterval))}else console.warn("["+this.lightbulb.displayName+"] Adaptive Lighting was probably disable my mistake by some call in the SET handler of the ColorTemperature characteristic! Please check that you don't call setValue/setCharacteristic on the Hue, Saturation or ColorTemperature characteristic!")},t.prototype.constructServices=function(){return{}},t.prototype.initWithServices=function(e){},t.prototype.configureServices=function(){var e=this;this.supportedTransitionConfiguration=this.lightbulb.getCharacteristic(A.Characteristic.SupportedCharacteristicValueTransitionConfiguration),this.transitionControl=this.lightbulb.getCharacteristic(A.Characteristic.CharacteristicValueTransitionControl).updateValue(""),this.activeTransitionCount=this.lightbulb.getCharacteristic(A.Characteristic.CharacteristicValueActiveTransitionCount).updateValue(0),this.supportedTransitionConfiguration.onGet(this.handleSupportedTransitionConfigurationRead.bind(this)),this.transitionControl.onGet((function(){return e.buildTransitionControlResponseBuffer().toString("base64")})).onSet((function(t){try{return e.handleTransitionControlWrite(t)}catch(r){throw console.warn("[%s] DEBUG: '".concat(t,"'")),console.warn("[%s] Encountered error on CharacteristicValueTransitionControl characteristic: "+r.stack),e.disableAdaptiveLighting(),new C.HapStatusError(-70402)}}))},t.prototype.handleControllerRemoved=function(){this.lightbulb.removeCharacteristic(this.supportedTransitionConfiguration),this.lightbulb.removeCharacteristic(this.transitionControl),this.lightbulb.removeCharacteristic(this.activeTransitionCount),this.supportedTransitionConfiguration=void 0,this.transitionControl=void 0,this.activeTransitionCount=void 0,this.removeAllListeners()},t.prototype.handleFactoryReset=function(){this.handleAdaptiveLightingDisabled()},t.prototype.serialize=function(){if(this.activeTransition)return{activeTransition:this.activeTransition}},t.prototype.deserialize=function(e){this.activeTransition=e.activeTransition,this.activeTransition.transitionId||(this.activeTransition.transitionId=this.activeTransition.id1,delete this.activeTransition.id1),this.activeTransition.timeMillisOffset||(this.activeTransition.timeMillisOffset=0),this.handleActiveTransitionUpdated(!0)},t.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},t.prototype.handleSupportedTransitionConfigurationRead=function(){var e=this.lightbulb.getCharacteristic(A.Characteristic.Brightness).iid,t=this.lightbulb.getCharacteristic(A.Characteristic.ColorTemperature).iid;return(0,v.default)(e,"iid for brightness characteristic is undefined"),(0,v.default)(t,"iid for temperature characteristic is undefined"),I.encode(1,[I.encode(1,I.writeVariableUIntLE(e),2,1),I.encode(1,I.writeVariableUIntLE(t),2,2)]).toString("base64")},t.prototype.buildTransitionControlResponseBuffer=function(e){if(!this.activeTransition)return Buffer.alloc(0);var t=this.activeTransition,r=null!=e?e:Date.now()-t.timeMillisOffset-t.transitionStartMillis,i=I.writeVariableUIntLE(r),n=I.encode(1,E.write(t.transitionId),2,Buffer.from(t.transitionStartBuffer,"hex"));t.id3&&(n=Buffer.concat([n,I.encode(3,Buffer.from(t.id3,"hex"))]));var o=I.encode(1,I.writeVariableUIntLE(t.iid),2,n,3,i);return I.encode(1,o)},t.prototype.handleTransitionControlWrite=function(e){if("string"!=typeof e)throw new C.HapStatusError(-70410);var t=I.decode(Buffer.from(e,"base64")),r=[],i=t[1];if(i){var n=this.handleTransitionControlReadTransition(i);n&&r.push(n)}var o=t[2];if(o){var a=this.handleTransitionControlUpdateTransition(o);a&&r.push(a)}return Buffer.concat(r).toString("base64")},t.prototype.handleTransitionControlReadTransition=function(e){var t=I.decode(e),r=I.readVariableUIntLE(t[1]);if(this.activeTransition){if(this.activeTransition.iid!==r)throw console.warn("["+this.lightbulb.displayName+"] iid of current adaptive lighting transition ("+this.activeTransition.iid+") doesn't match the requested one "+r),new C.HapStatusError(-70410);var i=I.encode(1,E.write(this.activeTransition.transitionId),2,Buffer.from(this.activeTransition.transitionStartBuffer,"hex"));return this.activeTransition.id3&&(i=Buffer.concat([i,I.encode(3,Buffer.from(this.activeTransition.id3,"hex"))])),I.encode(1,I.encode(1,I.writeVariableUIntLE(this.activeTransition.iid),2,i,3,1,5,I.encode(1,this.activeTransition.transitionCurve.map((function(e,t,r){var i,n,o=null!==(n=null===(i=r[t-1])||void 0===i?void 0:i.duration)&&void 0!==n?n:0;return I.encode(1,I.writeFloat32LE(e.brightnessAdjustmentFactor),2,I.writeFloat32LE(e.temperature),3,I.writeVariableUIntLE(e.transitionTime),4,I.writeVariableUIntLE(o))})),2,I.writeVariableUIntLE(this.activeTransition.brightnessCharacteristicIID),3,I.encode(1,I.writeUInt32(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue),2,I.writeUInt32(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue))),6,I.writeVariableUIntLE(this.activeTransition.updateInterval),8,I.writeVariableUIntLE(this.activeTransition.notifyIntervalThreshold)))}},t.prototype.handleTransitionControlUpdateTransition=function(e){var t,r,i,n,o=I.decode(e),a=I.decode(o[1]),s=I.readVariableUIntLE(a[1]);if(!this.lightbulb.getCharacteristicByIID(s))throw new C.HapStatusError(-70410);if(!(null===(i=a[3])||void 0===i?void 0:i.readUInt8(0)))return this.handleAdaptiveLightingDisabled(),I.encode(2,Buffer.alloc(0));var c=I.decode(a[2]),u=I.decodeWithLists(a[5]),l=null===(n=a[6])||void 0===n?void 0:n.readUInt16LE(0),h=a[8].readUInt32LE(0),d=c[1],p=c[2],f=c[3],m=(0,S.epochMillisFromMillisSince2001_01_01Buffer)(p),v=Date.now()-m,y=[],_=void 0,T=u[1];try{for(var A=g.__values(T),w=A.next();!w.done;w=A.next()){var b=w.value,U=I.decode(b),R=U[1].readFloatLE(0),O=U[2].readFloatLE(0),N=I.readVariableUIntLE(U[3]),P=U[4]?I.readVariableUIntLE(U[4]):void 0;_&&(_.duration=P),_={temperature:O,brightnessAdjustmentFactor:R,transitionTime:N},y.push(_)}}catch(e){t={error:e}}finally{try{w&&!w.done&&(r=A.return)&&r.call(A)}finally{if(t)throw t.error}}var B=I.readVariableUIntLE(u[2]),L=I.decode(u[3]),x=L[1].readUInt32LE(0),M=L[2].readUInt32LE(0);return this.activeTransition={iid:s,transitionStartMillis:m,timeMillisOffset:v,transitionId:E.unparse(d),transitionStartBuffer:p.toString("hex"),id3:null==f?void 0:f.toString("hex"),brightnessCharacteristicIID:B,brightnessAdjustmentRange:{minBrightnessValue:x,maxBrightnessValue:M},transitionCurve:y,updateInterval:null!=l?l:6e4,notifyIntervalThreshold:h},this.updateTimeout?(clearTimeout(this.updateTimeout),this.updateTimeout=void 0,D("[%s] Adaptive lighting was renewed.",this.lightbulb.displayName)):D("[%s] Adaptive lighting was enabled.",this.lightbulb.displayName),this.handleActiveTransitionUpdated(),I.encode(2,this.buildTransitionControlResponseBuffer(0))},t}(T.EventEmitter);t.AdaptiveLightingController=w},2405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CameraController=t.CameraControllerEvents=t.ResourceRequestReason=void 0;var i=r(1635),n=i.__importDefault(r(6982)),o=i.__importDefault(r(5753)),a=r(4434),s=r(8591),c=r(9826),u=r(9948),l=r(5876),h=r(8073),d=(0,o.default)("HAP-NodeJS:Camera:Controller");!function(e){e[e.PERIODIC=0]="PERIODIC",e[e.EVENT=1]="EVENT"}(t.ResourceRequestReason||(t.ResourceRequestReason={})),function(e){e.MICROPHONE_PROPERTIES_CHANGED="microphone-change",e.SPEAKER_PROPERTIES_CHANGED="speaker-change"}(t.CameraControllerEvents||(t.CameraControllerEvents={}));var p=function(e){function t(t,r){void 0===r&&(r=!1);var i=e.call(this)||this;return i.legacyMode=!1,i.streamManagements=[],i.microphoneMuted=!1,i.microphoneVolume=100,i.speakerMuted=!1,i.speakerVolume=100,i.motionServiceExternallySupplied=!1,i.occupancyServiceExternallySupplied=!1,i.streamCount=Math.max(1,t.cameraStreamCount||1),i.delegate=t.delegate,i.streamingOptions=t.streamingOptions,i.recording=t.recording,i.sensorOptions=t.sensors,i.legacyMode=r,i}return i.__extends(t,e),t.prototype.controllerId=function(){return"camera"},t.prototype.forceStopStreamingSession=function(e){this.streamManagements.forEach((function(t){t.sessionIdentifier===e&&t.forceStop()}))},t.generateSynchronisationSource=function(){var e=n.default.randomBytes(4);return e[0]=0,e.readInt32BE(0)},t.prototype.setMicrophoneMuted=function(e){void 0===e&&(e=!0),this.microphoneService&&(this.microphoneMuted=e,this.microphoneService.updateCharacteristic(c.Characteristic.Mute,e))},t.prototype.setMicrophoneVolume=function(e){this.microphoneService&&(this.microphoneVolume=e,this.microphoneService.updateCharacteristic(c.Characteristic.Volume,e))},t.prototype.setSpeakerMuted=function(e){void 0===e&&(e=!0),this.speakerService&&(this.speakerMuted=e,this.speakerService.updateCharacteristic(c.Characteristic.Mute,e))},t.prototype.setSpeakerVolume=function(e){this.speakerService&&(this.speakerVolume=e,this.speakerService.updateCharacteristic(c.Characteristic.Volume,e))},t.prototype.emitMicrophoneChange=function(){this.emit("microphone-change",this.microphoneMuted,this.microphoneVolume)},t.prototype.emitSpeakerChange=function(){this.emit("speaker-change",this.speakerMuted,this.speakerVolume)},t.prototype.constructServices=function(){for(var e,r,i,n,o=0;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableController=t.DefaultControllerType=void 0,function(e){e.CAMERA="camera",e.REMOTE="remote",e.TV="tv",e.ROUTER="router",e.LOCK="lock",e.CHARACTERISTIC_TRANSITION="characteristic-transition"}(t.DefaultControllerType||(t.DefaultControllerType={})),t.isSerializableController=function(e){return"serialize"in e&&"deserialize"in e&&"setupStateChangeDelegate"in e}},7959:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DoorbellController=void 0;var i=r(1635),n=r(9826),o=r(5876),a=function(e){function t(t){var r=e.call(this,t)||this;return r.doorbellServiceExternallySupplied=!1,r.doorbellOptions={name:t.name,externalDoorbellService:t.externalDoorbellService},r}return i.__extends(t,e),t.prototype.ringDoorbell=function(){this.doorbellService.updateCharacteristic(n.Characteristic.ProgrammableSwitchEvent,n.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)},t.prototype.constructServices=function(){var t,r,i;(null===(t=this.doorbellOptions)||void 0===t?void 0:t.externalDoorbellService)?(this.doorbellService=this.doorbellOptions.externalDoorbellService,this.doorbellServiceExternallySupplied=!0):this.doorbellService=new o.Service.Doorbell(null!==(i=null===(r=this.doorbellOptions)||void 0===r?void 0:r.name)&&void 0!==i?i:"",""),this.doorbellService.setPrimaryService();var n=e.prototype.constructServices.call(this);return this.doorbellServiceExternallySupplied||(n.doorbell=this.doorbellService),n},t.prototype.initWithServices=function(t){var r,i,n,a=e.prototype._initWithServices.call(this,t);if((null===(r=this.doorbellOptions)||void 0===r?void 0:r.externalDoorbellService)?(this.doorbellService=this.doorbellOptions.externalDoorbellService,this.doorbellServiceExternallySupplied=!0,a.serviceMap.doorbell&&(delete a.serviceMap.doorbell,a.updated=!0)):(this.doorbellService=a.serviceMap.doorbell,this.doorbellService||(this.doorbellService=new o.Service.Doorbell(null!==(n=null===(i=this.doorbellOptions)||void 0===i?void 0:i.name)&&void 0!==n?n:"",""),a.serviceMap.doorbell=this.doorbellService,a.updated=!0)),this.doorbellService.setPrimaryService(),a.updated)return a.serviceMap},t.prototype.migrateFromDoorbell=function(e){return!1},t.prototype.retrieveEventTriggerOptions=function(){var t=e.prototype.retrieveEventTriggerOptions.call(this);return t.add(2),t},t.prototype.handleControllerRemoved=function(){e.prototype.handleControllerRemoved.call(this),this.doorbellService=void 0},t.prototype.configureServices=function(){e.prototype.configureServices.call(this),this.doorbellService.getCharacteristic(n.Characteristic.ProgrammableSwitchEvent).onGet((function(){return null})),this.doorbellOptions=void 0},t}(r(2405).CameraController);t.DoorbellController=a},9352:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SiriAudioSession=t.SiriAudioSessionEvents=t.HomeKitRemoteController=t.RemoteController=t.RemoteControllerEvents=t.TargetUpdates=t.AudioCodecTypes=t.ButtonState=t.TargetCategory=t.ButtonType=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,m,g=r(1635),v=g.__importDefault(r(2613)),y=g.__importDefault(r(5753)),C=r(4434),S=r(9826),E=r(9948),_=r(5876),T=g.__importStar(r(3314)),A=(0,y.default)("HAP-NodeJS:Remote:Controller");!function(e){e[e.MAXIMUM_TARGETS=1]="MAXIMUM_TARGETS",e[e.TICKS_PER_SECOND=2]="TICKS_PER_SECOND",e[e.SUPPORTED_BUTTON_CONFIGURATION=3]="SUPPORTED_BUTTON_CONFIGURATION",e[e.TYPE=4]="TYPE"}(i||(i={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_TYPE=2]="BUTTON_TYPE"}(n||(n={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.MENU=1]="MENU",e[e.PLAY_PAUSE=2]="PLAY_PAUSE",e[e.TV_HOME=3]="TV_HOME",e[e.SELECT=4]="SELECT",e[e.ARROW_UP=5]="ARROW_UP",e[e.ARROW_RIGHT=6]="ARROW_RIGHT",e[e.ARROW_DOWN=7]="ARROW_DOWN",e[e.ARROW_LEFT=8]="ARROW_LEFT",e[e.VOLUME_UP=9]="VOLUME_UP",e[e.VOLUME_DOWN=10]="VOLUME_DOWN",e[e.SIRI=11]="SIRI",e[e.POWER=12]="POWER",e[e.GENERIC=13]="GENERIC"}(o=t.ButtonType||(t.ButtonType={})),function(e){e[e.OPERATION=1]="OPERATION",e[e.TARGET_CONFIGURATION=2]="TARGET_CONFIGURATION"}(a||(a={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.LIST=1]="LIST",e[e.ADD=2]="ADD",e[e.REMOVE=3]="REMOVE",e[e.RESET=4]="RESET",e[e.UPDATE=5]="UPDATE"}(s||(s={})),function(e){e[e.TARGET_IDENTIFIER=1]="TARGET_IDENTIFIER",e[e.TARGET_NAME=2]="TARGET_NAME",e[e.TARGET_CATEGORY=3]="TARGET_CATEGORY",e[e.BUTTON_CONFIGURATION=4]="BUTTON_CONFIGURATION"}(c||(c={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.APPLE_TV=24]="APPLE_TV"}(t.TargetCategory||(t.TargetCategory={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_TYPE=2]="BUTTON_TYPE",e[e.BUTTON_NAME=3]="BUTTON_NAME"}(u||(u={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_STATE=2]="BUTTON_STATE",e[e.TIMESTAMP=3]="TIMESTAMP",e[e.ACTIVE_IDENTIFIER=4]="ACTIVE_IDENTIFIER"}(l||(l={})),function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(t.ButtonState||(t.ButtonState={})),function(e){e[e.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION=1]="SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION"}(h||(h={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION",e[e.COMFORT_NOISE_SUPPORT=2]="COMFORT_NOISE_SUPPORT"}(d||(d={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(p||(p={})),function(e){e[e.PCMU=0]="PCMU",e[e.PCMA=1]="PCMA",e[e.AAC_ELD=2]="AAC_ELD",e[e.OPUS=3]="OPUS",e[e.MSBC=4]="MSBC",e[e.AMR=5]="AMR",e[e.AMR_WB=6]="AMR_WB"}(t.AudioCodecTypes||(t.AudioCodecTypes={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.PACKET_TIME=4]="PACKET_TIME"}(f||(f={})),function(e){e[e.STARTING=0]="STARTING",e[e.SENDING=1]="SENDING",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(m||(m={})),function(e){e[e.NAME=0]="NAME",e[e.CATEGORY=1]="CATEGORY",e[e.UPDATED_BUTTONS=2]="UPDATED_BUTTONS",e[e.REMOVED_BUTTONS=3]="REMOVED_BUTTONS"}(t.TargetUpdates||(t.TargetUpdates={})),function(e){e.ACTIVE_CHANGE="active-change",e.ACTIVE_IDENTIFIER_CHANGE="active-identifier-change",e.TARGET_ADDED="target-add",e.TARGET_UPDATED="target-update",e.TARGET_REMOVED="target-remove",e.TARGETS_RESET="targets-reset"}(t.RemoteControllerEvents||(t.RemoteControllerEvents={}));var I=function(e){function t(r,i){var n=e.call(this)||this;n.buttons={},n.targetConfigurations=new Map,n.targetConfigurationsString="",n.lastButtonEvent="",n.activeIdentifier=0,n.dataStreamConnections=new Map,n.audioSupported=void 0!==r,n.audioProducerConstructor=r,n.audioProducerOptions=i;var o=n.constructSupportedConfiguration();n.supportedConfiguration=n.buildTargetControlSupportedConfigurationTLV(o);var a=n.constructSupportedAudioConfiguration();return n.supportedAudioConfiguration=t.buildSupportedAudioConfigurationTLV(a),n.selectedAudioConfiguration={codecType:3,parameters:{channels:1,bitrate:0,samplerate:1,rtpTime:20}},n.selectedAudioConfigurationString=t.buildSelectedAudioConfigurationTLV({audioCodecConfiguration:n.selectedAudioConfiguration}),n}return g.__extends(t,e),t.prototype.controllerId=function(){return"remote"},t.prototype.setActiveIdentifier=function(e){var t=this;if(e!==this.activeIdentifier){if(0!==e&&!this.targetConfigurations.has(e))throw Error("Tried setting unconfigured targetIdentifier to active");A("%d is now the active target",e),this.activeIdentifier=e,this.targetControlService.getCharacteristic(S.Characteristic.ActiveIdentifier).updateValue(e),this.activeAudioSession&&this.handleSiriAudioStop(),setTimeout((function(){return t.emit("active-identifier-change",e)}),0),this.setInactive()}},t.prototype.isActive=function(){return!!this.activeConnection},t.prototype.isConfigured=function(e){return this.targetConfigurations.has(e)},t.prototype.getTargetIdentifierByName=function(e){var t,r;try{for(var i=g.__values(Object.entries(this.targetConfigurations)),n=i.next();!n.done;n=i.next()){var o=g.__read(n.value,2),a=o[0];if(o[1].targetName===e)return parseInt(a,10)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.pushButton=function(e){this.sendButtonEvent(e,1)},t.prototype.releaseButton=function(e){this.sendButtonEvent(e,0)},t.prototype.pushAndReleaseButton=function(e,t){var r=this;void 0===t&&(t=200),this.pushButton(e),setTimeout((function(){return r.releaseButton(e)}),t)},t.prototype.addServicesToAccessory=function(e){e.configureController(this)},t.prototype.constructSupportedConfiguration=function(){var e=this,t={maximumTargets:10,ticksPerSecond:1e3,supportedButtonConfiguration:[],hardwareImplemented:this.audioSupported},r=[1,2,3,4,5,6,7,8,9,10,12,13];return this.audioSupported&&r.push(11),r.forEach((function(r){var i={buttonID:100+r,buttonType:r};t.supportedButtonConfiguration.push(i),e.buttons[r]=i.buttonID})),t},t.prototype.constructSupportedAudioConfiguration=function(){return{audioCodecConfiguration:{codecType:3,parameters:{channels:1,bitrate:0,samplerate:1}}}},t.prototype.handleTargetControlWrite=function(e,t){var r,i=Buffer.from(e,"base64"),n=T.decode(i),o=n[1][0],a=void 0;switch(n[2]&&(a=this.parseTargetConfigurationTLV(n[2])),A("Received TargetControl write operation %s",s[o]),o){case s.ADD:r=this.handleAddTarget.bind(this);break;case s.UPDATE:r=this.handleUpdateTarget.bind(this);break;case s.REMOVE:r=this.handleRemoveTarget.bind(this);break;case s.RESET:r=this.handleResetTargets.bind(this);break;case s.LIST:r=this.handleListTargets.bind(this);break;default:return void t(-70410,void 0)}var c=r(a);0===c?(t(void 0,this.targetConfigurationsString),o===s.ADD&&0===this.activeIdentifier&&this.setActiveIdentifier(a.targetIdentifier)):t(new Error(c+""))},t.prototype.handleAddTarget=function(e){var t=this;return e?(this.targetConfigurations.set(e.targetIdentifier,e),A("Configured new target '"+e.targetName+"' with targetIdentifier '"+e.targetIdentifier+"'"),setTimeout((function(){return t.emit("target-add",e)}),0),this.updatedTargetConfiguration(),0):-70410},t.prototype.handleUpdateTarget=function(e){var t,r,i=this;if(!e)return-70410;var n=[],o=this.targetConfigurations.get(e.targetIdentifier);if(!o)return-70410;if(e.targetName&&(A("Target name was updated '%s' => '%s' (%d)",o.targetName,e.targetName,o.targetIdentifier),o.targetName=e.targetName,n.push(0)),e.targetCategory&&(A("Target category was updated '%d' => '%d' for target '%s' (%d)",o.targetCategory,e.targetCategory,o.targetName,o.targetIdentifier),o.targetCategory=e.targetCategory,n.push(1)),e.buttonConfiguration){A("%d button configurations were updated for target '%s' (%d)",Object.keys(e.buttonConfiguration).length,o.targetName,o.targetIdentifier);try{for(var a=g.__values(Object.values(e.buttonConfiguration)),s=a.next();!s.done;s=a.next()){var c=s.value,u=o.buttonConfiguration[c.buttonID];u.buttonType=c.buttonType,u.buttonName=c.buttonName}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}n.push(2)}return setTimeout((function(){return i.emit("target-update",e,n)}),0),this.updatedTargetConfiguration(),0},t.prototype.handleRemoveTarget=function(e){var t=this;if(!e)return-70410;var r=this.targetConfigurations.get(e.targetIdentifier);if(!r)return-70410;if(e.buttonConfiguration){for(var i in e.buttonConfiguration)Object.prototype.hasOwnProperty.call(e.buttonConfiguration,i)&&delete r.buttonConfiguration[i];A("Removed %d button configurations of target '%s' (%d)",Object.keys(e.buttonConfiguration).length,r.targetName,r.targetIdentifier),setTimeout((function(){return t.emit("target-update",r,[3])}),0)}else{this.targetConfigurations.delete(e.targetIdentifier),A("Target '%s' (%d) was removed",r.targetName,r.targetIdentifier),setTimeout((function(){return t.emit("target-remove",e.targetIdentifier)}),0);var n=Object.keys(this.targetConfigurations);this.setActiveIdentifier(0===n.length?0:parseInt(n[0],10))}return this.updatedTargetConfiguration(),0},t.prototype.handleResetTargets=function(e){var t=this;return e?-70410:(A("Resetting all target configurations"),this.targetConfigurations=new Map,this.updatedTargetConfiguration(),setTimeout((function(){return t.emit("targets-reset")}),0),this.setActiveIdentifier(0),0)},t.prototype.handleListTargets=function(e){return e?-70410:(A("Returning "+Object.keys(this.targetConfigurations).length+" target configurations"),0)},t.prototype.handleActiveWrite=function(e,t,r){if(0===this.activeIdentifier)return A("Tried to change active state. There is no active target set though"),void t(-70410);this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionDisconnectListener),this.activeConnection=void 0,this.activeConnectionDisconnectListener=void 0),this.activeConnection=e?r:void 0,this.activeConnection&&(this.activeConnectionDisconnectListener=this.handleActiveSessionDisconnected.bind(this,this.activeConnection),this.activeConnection.on("closed",this.activeConnectionDisconnectListener));var i=this.targetConfigurations.get(this.activeIdentifier);i?(A("Remote with activeTarget '%s' (%d) was set to %s",i.targetName,this.activeIdentifier,e?"ACTIVE":"INACTIVE"),t(),this.emit("active-change",e)):t(-70410)},t.prototype.setInactive=function(){var e=this;void 0!==this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionDisconnectListener),this.activeConnection=void 0,this.activeConnectionDisconnectListener=void 0,this.targetControlService.getCharacteristic(S.Characteristic.Active).updateValue(!1),A("Remote was set to INACTIVE"),setTimeout((function(){return e.emit("active-change",!1)}),0))},t.prototype.handleActiveSessionDisconnected=function(e){e===this.activeConnection&&(A("Active hap session disconnected!"),this.setInactive())},t.prototype.sendButtonEvent=function(e,t){var r=this.buttons[e];if(void 0===r||0===r)throw new Error("Tried sending button event for unsupported button ("+e+")");if(0===this.activeIdentifier)throw new Error("Tried sending button event although no target was selected");if(!this.isActive())throw new Error("Tried sending button event although target was not marked as active");if(11===e&&this.audioSupported)1===t?this.handleSiriAudioStart():0===t&&this.handleSiriAudioStop();else{var i=T.encode(1,r),n=T.encode(2,t),o=T.encode(3,T.writeVariableUIntLE((new Date).getTime())),a=T.encode(4,T.writeUInt32(this.activeIdentifier));this.lastButtonEvent=Buffer.concat([i,n,o,a]).toString("base64"),this.targetControlService.getCharacteristic(S.Characteristic.ButtonEvent).sendEventNotification(this.lastButtonEvent)}},t.prototype.parseTargetConfigurationTLV=function(e){var t=T.decode(e),r=T.readUInt32(t[1]),i=void 0;t[2]&&(i=t[2].toString());var n=void 0;t[3]&&(n=T.readUInt16(t[3]));var a={};t[4]&&T.decodeList(t[4],1).forEach((function(e){var t,r=e[1][0],i=T.readUInt16(e[2]);t=e[3]?e[3].toString():o[i],a[r]={buttonID:r,buttonType:i,buttonName:t}}));return{targetIdentifier:r,targetName:i,targetCategory:n,buttonConfiguration:a}},t.prototype.updatedTargetConfiguration=function(){var e,t,r,i,n,o=[];try{for(var a=g.__values(Object.values(this.targetConfigurations)),s=a.next();!s.done;s=a.next()){var c=s.value,u=T.encode(1,T.writeUInt32(c.targetIdentifier)),l=T.encode(2,c.targetName),h=T.encode(3,T.writeUInt16(c.targetCategory)),d=[];try{for(var p=(r=void 0,g.__values(c.buttonConfiguration.values())),f=p.next();!f.done;f=p.next()){var m=f.value,v=T.encode(1,m.buttonID,2,T.writeUInt16(m.buttonType));m.buttonName&&(v=Buffer.concat([v,T.encode(3,m.buttonName)])),d.push(v)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}var y=T.encode(4,Buffer.concat(d)),C=Buffer.concat([u,l,h,y]);o.push(T.encode(2,C))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}this.targetConfigurationsString=Buffer.concat(o).toString("base64"),null===(n=this.stateChangeDelegate)||void 0===n||n.call(this)},t.prototype.buildTargetControlSupportedConfigurationTLV=function(e){var t=T.encode(1,e.maximumTargets),r=T.encode(2,T.writeVariableUIntLE(e.ticksPerSecond)),i=[];e.supportedButtonConfiguration.forEach((function(e){var t=T.encode(1,e.buttonID,2,T.writeUInt16(e.buttonType));i.push(t)}));var n=T.encode(3,Buffer.concat(i)),o=T.encode(4,e.hardwareImplemented?1:0);return Buffer.concat([t,r,n,o]).toString("base64")},t.prototype.handleTargetControlWhoAmI=function(e,t){var r=t.identifier;this.dataStreamConnections.set(r,e),A("Discovered HDS connection for targetIdentifier %s",r),e.addProtocolHandler("dataSend",this)},t.prototype.handleSiriAudioStart=function(){if(!this.audioSupported)throw new Error("Cannot start siri stream on remote where siri is not supported");if(this.isActive())if(!this.activeAudioSession||this.activeAudioSession.isClosing()&&!this.nextAudioSession){var e=this.dataStreamConnections.get(this.activeIdentifier);if(void 0!==e){var t=new w(e,this.selectedAudioConfiguration,this.audioProducerConstructor,this.audioProducerOptions);this.activeAudioSession?this.nextAudioSession=t:this.activeAudioSession=t,t.on("close",this.handleSiriAudioSessionClosed.bind(this,t)),t.start()}else A("Tried opening Siri audio stream however target is not connected via HDS")}else A("Tried opening Siri audio stream, however there is already one in progress");else A("Tried opening Siri audio stream, however no controller is connected!")},t.prototype.handleSiriAudioStop=function(){if(this.activeAudioSession){if(!this.activeAudioSession.isClosing())return void this.activeAudioSession.stop();if(this.nextAudioSession&&!this.nextAudioSession.isClosing())return void this.nextAudioSession.stop()}A("handleSiriAudioStop called although no audio session was started")},t.prototype.handleDataSendAckEvent=function(e){var t=e.streamId,r=e.endOfStream;this.activeAudioSession&&this.activeAudioSession.streamId===t?this.activeAudioSession.handleDataSendAckEvent(r):this.nextAudioSession&&this.nextAudioSession.streamId===t?this.nextAudioSession.handleDataSendAckEvent(r):A("Received dataSend acknowledgment event for unknown streamId '%s'",t)},t.prototype.handleDataSendCloseEvent=function(e){var t=e.streamId,r=e.reason;this.activeAudioSession&&this.activeAudioSession.streamId===t?this.activeAudioSession.handleDataSendCloseEvent(r):this.nextAudioSession&&this.nextAudioSession.streamId===t?this.nextAudioSession.handleDataSendCloseEvent(r):A("Received dataSend close event for unknown streamId '%s'",t)},t.prototype.handleSiriAudioSessionClosed=function(e){e===this.activeAudioSession?(this.activeAudioSession=this.nextAudioSession,this.nextAudioSession=void 0):e===this.nextAudioSession&&(this.nextAudioSession=void 0)},t.prototype.handleDataStreamConnectionClosed=function(e){var t,r;try{for(var i=g.__values(this.dataStreamConnections),n=i.next();!n.done;n=i.next()){var o=g.__read(n.value,2),a=o[0];if(e===o[1]){A("HDS connection disconnected for targetIdentifier %s",a),this.dataStreamConnections.delete(a);break}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.handleSelectedAudioConfigurationWrite=function(e,r){var i=Buffer.from(e,"base64"),n=T.decode(i),o=T.decode(n[1]),a=o[1][0],s=T.decode(o[2]),c=s[1][0],u=s[2][0],l=s[3][0];this.selectedAudioConfiguration={codecType:a,parameters:{channels:c,bitrate:u,samplerate:l,rtpTime:20}},this.selectedAudioConfigurationString=t.buildSelectedAudioConfigurationTLV({audioCodecConfiguration:this.selectedAudioConfiguration}),r()},t.buildSupportedAudioConfigurationTLV=function(e){var r=t.buildCodecConfigurationTLV(e.audioCodecConfiguration);return T.encode(1,r).toString("base64")},t.buildSelectedAudioConfigurationTLV=function(e){var r=t.buildCodecConfigurationTLV(e.audioCodecConfiguration);return T.encode(1,r).toString("base64")},t.buildCodecConfigurationTLV=function(e){var t=e.parameters,r=T.encode(1,t.channels,2,t.bitrate,3,t.samplerate);return t.rtpTime&&(r=Buffer.concat([r,T.encode(4,t.rtpTime)])),T.encode(1,e.codecType,2,r)},t.prototype.constructServices=function(){var e;return this.targetControlManagementService=new _.Service.TargetControlManagement("",""),this.targetControlManagementService.setCharacteristic(S.Characteristic.TargetControlSupportedConfiguration,this.supportedConfiguration),this.targetControlManagementService.setCharacteristic(S.Characteristic.TargetControlList,this.targetConfigurationsString),this.targetControlManagementService.setPrimaryService(),this.targetControlService=new _.Service.TargetControl("",""),this.targetControlService.setCharacteristic(S.Characteristic.ActiveIdentifier,0),this.targetControlService.setCharacteristic(S.Characteristic.Active,!1),this.targetControlService.setCharacteristic(S.Characteristic.ButtonEvent,this.lastButtonEvent),this.audioSupported&&(this.siriService=new _.Service.Siri("",""),this.siriService.setCharacteristic(S.Characteristic.SiriInputType,S.Characteristic.SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV),this.audioStreamManagementService=new _.Service.AudioStreamManagement("",""),this.audioStreamManagementService.setCharacteristic(S.Characteristic.SupportedAudioStreamConfiguration,this.supportedAudioConfiguration),this.audioStreamManagementService.setCharacteristic(S.Characteristic.SelectedAudioStreamConfiguration,this.selectedAudioConfigurationString),this.dataStreamManagement=new E.DataStreamManagement,this.siriService.addLinkedService(this.dataStreamManagement.getService()),this.siriService.addLinkedService(this.audioStreamManagementService)),{targetControlManagement:this.targetControlManagementService,targetControl:this.targetControlService,siri:this.siriService,audioStreamManagement:this.audioStreamManagementService,dataStreamTransportManagement:null===(e=this.dataStreamManagement)||void 0===e?void 0:e.getService()}},t.prototype.initWithServices=function(e){this.targetControlManagementService=e.targetControlManagement,this.targetControlService=e.targetControl,this.siriService=e.siri,this.audioStreamManagementService=e.audioStreamManagement,this.dataStreamManagement=new E.DataStreamManagement(e.dataStreamTransportManagement)},t.prototype.configureServices=function(){var e,t=this;if(!this.targetControlManagementService||!this.targetControlService)throw new Error("Unexpected state: Services not configured!");this.targetControlManagementService.getCharacteristic(S.Characteristic.TargetControlList).on("get",(function(e){e(null,t.targetConfigurationsString)})).on("set",this.handleTargetControlWrite.bind(this)),this.targetControlService.getCharacteristic(S.Characteristic.ActiveIdentifier).on("get",(function(e){e(void 0,t.activeIdentifier)})),this.targetControlService.getCharacteristic(S.Characteristic.Active).on("get",(function(e){e(void 0,t.isActive())})).on("set",(function(e,r,i,n){if(!n)return A("Set event handler for Remote.Active cannot be called from plugin. Connection undefined!"),void r(-70410);t.handleActiveWrite(e,r,n)})),this.targetControlService.getCharacteristic(S.Characteristic.ButtonEvent).on("get",(function(e){e(void 0,t.lastButtonEvent)})),this.audioSupported&&(this.audioStreamManagementService.getCharacteristic(S.Characteristic.SelectedAudioStreamConfiguration).on("get",(function(e){e(null,t.selectedAudioConfigurationString)})).on("set",this.handleSelectedAudioConfigurationWrite.bind(this)).updateValue(this.selectedAudioConfigurationString),this.dataStreamManagement.onEventMessage("targetControl","whoami",this.handleTargetControlWhoAmI.bind(this)).onServerEvent("connection-closed",this.handleDataStreamConnectionClosed.bind(this)),this.eventHandler=((e={}).ack=this.handleDataSendAckEvent.bind(this),e.close=this.handleDataSendCloseEvent.bind(this),e))},t.prototype.handleControllerRemoved=function(){var e;this.targetControlManagementService=void 0,this.targetControlService=void 0,this.siriService=void 0,this.audioStreamManagementService=void 0,this.eventHandler=void 0,this.requestHandler=void 0,null===(e=this.dataStreamManagement)||void 0===e||e.destroy(),this.dataStreamManagement=void 0},t.prototype.handleFactoryReset=function(){A("Running factory reset. Resetting targets..."),this.handleResetTargets(void 0),this.lastButtonEvent=""},t.prototype.serialize=function(){if(this.activeIdentifier||0!==Object.keys(this.targetConfigurations).length)return{activeIdentifier:this.activeIdentifier,targetConfigurations:g.__spreadArray([],g.__read(this.targetConfigurations),!1).reduce((function(e,t){var r=g.__read(t,2),i=r[0],n=r[1];return e[i]=n,e}),{})}},t.prototype.deserialize=function(e){this.activeIdentifier=e.activeIdentifier,this.targetConfigurations=Object.entries(e.targetConfigurations).reduce((function(e,t){var r=g.__read(t,2),i=r[0],n=r[1],o=parseInt(i,10);return e.set(o,n),e}),new Map),this.updatedTargetConfiguration()},t.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},t}(C.EventEmitter);t.RemoteController=I;var D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g.__extends(t,e),t}(I);t.HomeKitRemoteController=D,function(e){e.CLOSE="close"}(t.SiriAudioSessionEvents||(t.SiriAudioSessionEvents={}));var w=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o.producerRunning=!1,o.state=0,o.endOfStream=!1,o.audioFrameQueue=[],o.maxQueueSize=1024,o.sequenceNumber=0,o.connection=t,o.selectedAudioConfiguration=r,o.producer=new i(o.handleSiriAudioFrame.bind(o),o.handleProducerError.bind(o),n),o.connection.on("closed",o.closeListener=o.handleDataStreamConnectionClosed.bind(o)),o}return g.__extends(t,e),t.prototype.start=function(){var e=this;A("Sending request to start siri audio stream"),this.connection.sendRequest("dataSend","open",{target:"controller",type:"audio.siri"},(function(t,r,i){3!==e.state?(v.default.strictEqual(e.state,0),e.state=1,t||r?(t?A("Error occurred trying to start siri audio stream: %s",t.message):r&&A("Controller responded with non-zero status code: %s",E.HDSStatus[r]),e.closed()):(e.streamId=i.streamId,e.producerRunning?A("Successfully setup siri audio stream with streamId %d",e.streamId):e.sendDataSendCloseEvent(3))):A("Ignoring dataSend open response as the session is already closed")})),this.startAudioProducer()},t.prototype.isClosing=function(){return this.state>=2},t.prototype.stop=function(){(0,v.default)(this.state<=1,"state was higher than SENDING"),A("Stopping siri audio stream with streamId %d",this.streamId),this.endOfStream=!0,this.stopAudioProducer(),1===this.state?(this.handleSiriAudioFrame(void 0),this.state=2):this.closed()},t.prototype.startAudioProducer=function(){var e=this;this.producer.startAudioProduction(this.selectedAudioConfiguration),this.producerRunning=!0,this.producerTimer=setTimeout((function(){A("Didn't receive any frames from audio producer for stream with streamId %s. Canceling the stream now.",e.streamId),e.producerTimer=void 0,e.handleProducerError(3)}),3e3),this.producerTimer.unref()},t.prototype.stopAudioProducer=function(){this.producer.stopAudioProduction(),this.producerRunning=!1,this.producerTimer&&(clearTimeout(this.producerTimer),this.producerTimer=void 0)},t.prototype.handleSiriAudioFrame=function(e){var t=this;if(!(this.state>=2)&&(this.producerTimer&&(clearTimeout(this.producerTimer),this.producerTimer=void 0),e&&this.audioFrameQueue.length=2||(this.stopAudioProducer(),1===this.state&&this.sendDataSendCloseEvent(e))},t.prototype.handleDataSendAckEvent=function(e){v.default.strictEqual(e,!0),A("Received acknowledgment for siri audio stream with streamId %s, closing it now",this.streamId),this.sendDataSendCloseEvent(0)},t.prototype.handleDataSendCloseEvent=function(e){A("Received close event from controller with reason %s for stream with streamId %s",E.HDSProtocolSpecificErrorReason[e],this.streamId),this.state<=1&&this.stopAudioProducer(),this.closed()},t.prototype.sendDataSendCloseEvent=function(e){(0,v.default)(this.state>=1,"state was less than SENDING"),(0,v.default)(this.state<=2,"state was higher than CLOSING"),this.connection.sendEvent("dataSend","close",{streamId:new E.Int64(this.streamId),reason:new E.Int64(e)}),this.closed()},t.prototype.handleDataStreamConnectionClosed=function(){A("Closing audio session with streamId %d",this.streamId),this.state<=1&&this.stopAudioProducer(),this.closed()},t.prototype.closed=function(){var e=this.state;this.state=3,3!==e&&(this.emit("close"),this.connection.removeListener("closed",this.closeListener)),this.removeAllListeners()},t.prototype.popSome=function(){if(this.audioFrameQueue.length<5&&!this.endOfStream)return null;for(var e=Math.min(this.audioFrameQueue.length,5),t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(9414),t),i.__exportStar(r(6864),t),i.__exportStar(r(9352),t),i.__exportStar(r(2405),t),i.__exportStar(r(7959),t)},733:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamManagement=t.DataStreamStatus=void 0;var i,n,o,a,s,c,u,l=r(1635),h=l.__importDefault(r(5753)),d=r(9826),p=r(5876),f=l.__importStar(r(3314)),m=r(4097),g=(0,h.default)("HAP-NodeJS:DataStream:Management");!function(e){e[e.TRANSFER_TRANSPORT_CONFIGURATION=1]="TRANSFER_TRANSPORT_CONFIGURATION"}(i||(i={})),function(e){e[e.TRANSPORT_TYPE=1]="TRANSPORT_TYPE"}(n||(n={})),function(e){e[e.SESSION_COMMAND_TYPE=1]="SESSION_COMMAND_TYPE",e[e.TRANSPORT_TYPE=2]="TRANSPORT_TYPE",e[e.CONTROLLER_KEY_SALT=3]="CONTROLLER_KEY_SALT"}(o||(o={})),function(e){e[e.STATUS=1]="STATUS",e[e.TRANSPORT_TYPE_SESSION_PARAMETERS=2]="TRANSPORT_TYPE_SESSION_PARAMETERS",e[e.ACCESSORY_KEY_SALT=3]="ACCESSORY_KEY_SALT"}(a||(a={})),function(e){e[e.TCP_LISTENING_PORT=1]="TCP_LISTENING_PORT"}(s||(s={})),function(e){e[e.HOMEKIT_DATA_STREAM=0]="HOMEKIT_DATA_STREAM"}(c||(c={})),function(e){e[e.START_SESSION=0]="START_SESSION"}(u||(u={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.GENERIC_ERROR=1]="GENERIC_ERROR",e[e.BUSY=2]="BUSY"}(t.DataStreamStatus||(t.DataStreamStatus={}));var v=function(){function e(e){this.dataStreamServer=new m.DataStreamServer,this.lastSetupDataStreamTransportResponse="";var t=[c.HOMEKIT_DATA_STREAM];this.supportedDataStreamTransportConfiguration=this.buildSupportedDataStreamTransportConfigurationTLV(t),this.dataStreamTransportManagementService=e||this.constructService(),this.setupServiceHandlers()}return e.prototype.destroy=function(){this.dataStreamServer.destroy(),this.dataStreamTransportManagementService.getCharacteristic(d.Characteristic.SetupDataStreamTransport).removeOnGet().removeAllListeners("set"),this.lastSetupDataStreamTransportResponse=""},e.prototype.getService=function(){return this.dataStreamTransportManagementService},e.prototype.onEventMessage=function(e,t,r){return this.dataStreamServer.onEventMessage(e,t,r),this},e.prototype.removeEventHandler=function(e,t,r){return this.dataStreamServer.removeEventHandler(e,t,r),this},e.prototype.onRequestMessage=function(e,t,r){return this.dataStreamServer.onRequestMessage(e,t,r),this},e.prototype.removeRequestHandler=function(e,t,r){return this.dataStreamServer.removeRequestHandler(e,t,r),this},e.prototype.onServerEvent=function(e,t){return this.dataStreamServer.on(e,t),this},e.prototype.handleSetupDataStreamTransportWrite=function(e,t,r){var i=this,n=Buffer.from(e,"base64"),o=f.decode(n),a=o[1][0],s=o[2][0],l=o[3];g("Received setup write with command %s and transport type %s",u[a],c[s]),a===u.START_SESSION&&s===c.HOMEKIT_DATA_STREAM&&32===l.length?this.dataStreamServer.prepareSession(r,l,(function(e,r){if(!e&&r){var n=f.encode(1,f.writeUInt16(r.port)),o=Buffer.concat([f.encode(1,0),f.encode(2,n)]);i.lastSetupDataStreamTransportResponse=o.toString("base64"),o=Buffer.concat([o,f.encode(3,r.accessoryKeySalt)]),t(null,o.toString("base64"))}else t(null!=e?e:new Error("PreparedSession was undefined!"))})):t(-70410)},e.prototype.buildSupportedDataStreamTransportConfigurationTLV=function(e){var t=[];return e.forEach((function(e){var r=f.encode(1,e),i=f.encode(1,r);t.push(i)})),Buffer.concat(t).toString("base64")},e.prototype.constructService=function(){var e=new p.Service.DataStreamTransportManagement("","");return e.setCharacteristic(d.Characteristic.SupportedDataStreamTransportConfiguration,this.supportedDataStreamTransportConfiguration),e.setCharacteristic(d.Characteristic.Version,m.DataStreamServer.version),e},e.prototype.setupServiceHandlers=function(){var e=this;this.dataStreamTransportManagementService.getCharacteristic(d.Characteristic.SetupDataStreamTransport).onGet((function(){return e.lastSetupDataStreamTransportResponse})).on("set",(function(t,r,i,n){if(!n)return g("Set event handler for SetupDataStreamTransport cannot be called from plugin! Connection undefined!"),void r(-70410);e.handleSetupDataStreamTransportWrite(t,r,n)})).updateValue(this.lastSetupDataStreamTransportResponse)},e}();t.DataStreamManagement=v},7881:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamWriter=t.DataStreamReader=t.DataStreamParser=t.DataFormatTags=t.UUID=t.SecondsSince2001=t.Float64=t.Float32=t.Int64=t.Int32=t.Int16=t.Int8=t.ValueWrapper=void 0;var i=r(1635),n=i.__importStar(r(2997)),o=i.__importStar(r(8)),a=i.__importDefault(r(2613)),s=(0,i.__importDefault(r(5753)).default)("HAP-NodeJS:DataStream:Parser"),c=function(){function e(){}return e.TERMINATOR={type:"terminator"},e}(),u=function(){function e(e){this.value=e}return e.prototype.equals=function(e){return this.constructor.name===e.constructor.name&&e.value===this.value},e}();t.ValueWrapper=u;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int8=l;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int16=h;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int32=d;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int64=p;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Float32=f;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Float64=m;var g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.SecondsSince2001=g;var v=function(e){function t(t){return(0,a.default)(n.isValid(t),"invalid uuid format"),e.call(this,t)||this}return i.__extends(t,e),t}(u);t.UUID=v,function(e){e[e.INVALID=0]="INVALID",e[e.TRUE=1]="TRUE",e[e.FALSE=2]="FALSE",e[e.TERMINATOR=3]="TERMINATOR",e[e.NULL=4]="NULL",e[e.UUID=5]="UUID",e[e.DATE=6]="DATE",e[e.INTEGER_MINUS_ONE=7]="INTEGER_MINUS_ONE",e[e.INTEGER_RANGE_START_0=8]="INTEGER_RANGE_START_0",e[e.INTEGER_RANGE_STOP_39=46]="INTEGER_RANGE_STOP_39",e[e.INT8=48]="INT8",e[e.INT16LE=49]="INT16LE",e[e.INT32LE=50]="INT32LE",e[e.INT64LE=51]="INT64LE",e[e.FLOAT32LE=53]="FLOAT32LE",e[e.FLOAT64LE=54]="FLOAT64LE",e[e.UTF8_LENGTH_START=64]="UTF8_LENGTH_START",e[e.UTF8_LENGTH_STOP=96]="UTF8_LENGTH_STOP",e[e.UTF8_LENGTH8=97]="UTF8_LENGTH8",e[e.UTF8_LENGTH16LE=98]="UTF8_LENGTH16LE",e[e.UTF8_LENGTH32LE=99]="UTF8_LENGTH32LE",e[e.UTF8_LENGTH64LE=100]="UTF8_LENGTH64LE",e[e.UTF8_NULL_TERMINATED=111]="UTF8_NULL_TERMINATED",e[e.DATA_LENGTH_START=112]="DATA_LENGTH_START",e[e.DATA_LENGTH_STOP=144]="DATA_LENGTH_STOP",e[e.DATA_LENGTH8=145]="DATA_LENGTH8",e[e.DATA_LENGTH16LE=146]="DATA_LENGTH16LE",e[e.DATA_LENGTH32LE=147]="DATA_LENGTH32LE",e[e.DATA_LENGTH64LE=148]="DATA_LENGTH64LE",e[e.DATA_TERMINATED=159]="DATA_TERMINATED",e[e.COMPRESSION_START=160]="COMPRESSION_START",e[e.COMPRESSION_STOP=207]="COMPRESSION_STOP",e[e.ARRAY_LENGTH_START=208]="ARRAY_LENGTH_START",e[e.ARRAY_LENGTH_STOP=222]="ARRAY_LENGTH_STOP",e[e.ARRAY_TERMINATED=223]="ARRAY_TERMINATED",e[e.DICTIONARY_LENGTH_START=224]="DICTIONARY_LENGTH_START",e[e.DICTIONARY_LENGTH_STOP=238]="DICTIONARY_LENGTH_STOP",e[e.DICTIONARY_TERMINATED=239]="DICTIONARY_TERMINATED"}(t.DataFormatTags||(t.DataFormatTags={}));var y=function(){function e(){}return e.decode=function(e){var t=e.readTag();if(0===t)throw new Error("HDSDecoder: zero tag detected on index "+e.readerIndex);if(1===t)return e.readTrue();if(2===t)return e.readFalse();if(3===t)return c.TERMINATOR;if(4===t)return null;if(5===t)return e.readUUID();if(6===t)return e.readSecondsSince2001_01_01();if(7===t)return e.readNegOne();if(t>=8&&t<=46)return e.readIntRange(t);if(48===t)return e.readInt8();if(49===t)return e.readInt16LE();if(50===t)return e.readInt32LE();if(51===t)return e.readInt64LE();if(53===t)return e.readFloat32LE();if(54===t)return e.readFloat64LE();if(t>=64&&t<=96){var r=t-64;return e.readUTF8(r)}if(97===t)return e.readUTF8_Length8();if(98===t)return e.readUTF8_Length16LE();if(99===t)return e.readUTF8_Length32LE();if(100===t)return e.readUTF8_Length64LE();if(111===t)return e.readUTF8_NULL_terminated();if(!(t>=112&&t<=144)){if(145===t)return e.readData_Length8();if(146===t)return e.readData_Length16LE();if(147===t)return e.readData_Length32LE();if(148===t)return e.readData_Length64LE();if(159===t)return e.readData_terminated();if(t>=160&&t<=207){var i=t-160;return e.decompressData(i)}if(t>=208&&t<=222){r=t-208;for(var n=[],o=0;o=224&&t<=238){r=t-224;var s={};for(o=0;o12&&t.writeTag(3)}else if(e instanceof u)if(e instanceof l)t.writeInt8(e);else if(e instanceof h)t.writeInt16LE(e);else if(e instanceof d)t.writeInt32LE(e);else if(e instanceof p)t.writeInt64LE(e);else if(e instanceof f)t.writeFloat32LE(e);else if(e instanceof m)t.writeFloat64LE(e);else if(e instanceof g)t.writeSecondsSince2001_01_01(e);else{if(!(e instanceof v))throw new Error("Unknown wrapped object 'ValueWrapper' of class "+e.constructor.name);t.writeUUID(e.value)}else if(e instanceof Buffer)t.writeData(e);else{var n=Object.entries(e).filter((function(e){return void 0!==e[1]}));n.length<=14?t.writeTag(224+n.length):t.writeTag(239),n.forEach((function(e){r.encode(e[0],t),r.encode(e[1],t)})),n.length>14&&t.writeTag(3)}break;default:throw new Error("HDSEncoder: no idea how to encode value of type '"+typeof e+"': "+e)}else t.writeTag(4)},e}();t.DataStreamParser=y;var C=function(){function e(e){this.trackedCompressedData=[],this.data=e,this.readerIndex=0}return e.prototype.finished=function(){if(this.readerIndex=this.trackedCompressedData.length)throw new Error("HDSDecoder: Tried decompression of data for an index out of range (index "+e+" and got "+this.trackedCompressedData.length+" elements)");return this.trackedCompressedData[e]},e.prototype.trackData=function(e){return this.trackedCompressedData.push(e),e},e.prototype.ensureLength=function(e){if(this.readerIndex+e>this.data.length){var t=this.data.length-this.readerIndex;throw new Error("HDSDecoder: End of data stream. Tried reading "+e+" bytes however got only "+t+" remaining!")}},e.prototype.readTag=function(){return this.ensureLength(1),this.data.readUInt8(this.readerIndex++)},e.prototype.readTrue=function(){return this.trackData(!0)},e.prototype.readFalse=function(){return this.trackData(!1)},e.prototype.readNegOne=function(){return this.trackData(-1)},e.prototype.readIntRange=function(e){return this.trackData(e-8)},e.prototype.readInt8=function(){return this.ensureLength(1),this.trackData(this.data.readInt8(this.readerIndex++))},e.prototype.readInt16LE=function(){this.ensureLength(2);var e=this.data.readInt16LE(this.readerIndex);return this.readerIndex+=2,this.trackData(e)},e.prototype.readInt32LE=function(){this.ensureLength(4);var e=this.data.readInt32LE(this.readerIndex);return this.readerIndex+=4,this.trackData(e)},e.prototype.readInt64LE=function(){this.ensureLength(8);var e=this.data.readInt32LE(this.readerIndex),t=4294967296*this.data.readInt32LE(this.readerIndex+4)+e;return e<0&&(t+=4294967296),this.readerIndex+=8,this.trackData(t)},e.prototype.readFloat32LE=function(){this.ensureLength(4);var e=this.data.readFloatLE(this.readerIndex);return this.readerIndex+=4,this.trackData(e)},e.prototype.readFloat64LE=function(){this.ensureLength(8);var e=this.data.readDoubleLE(this.readerIndex);return this.trackData(e)},e.prototype.readLength8=function(){return this.ensureLength(1),this.data.readUInt8(this.readerIndex++)},e.prototype.readLength16LE=function(){this.ensureLength(2);var e=this.data.readUInt16LE(this.readerIndex);return this.readerIndex+=2,e},e.prototype.readLength32LE=function(){this.ensureLength(4);var e=this.data.readUInt32LE(this.readerIndex);return this.readerIndex+=4,e},e.prototype.readLength64LE=function(){this.ensureLength(8);var e=this.data.readUInt32LE(this.readerIndex),t=4294967296*this.data.readUInt32LE(this.readerIndex+4)+e;return this.readerIndex+=8,t},e.prototype.readUTF8=function(e){this.ensureLength(e);var t=this.data.toString("utf8",this.readerIndex,this.readerIndex+e);return this.readerIndex+=e,this.trackData(t)},e.prototype.readUTF8_Length8=function(){var e=this.readLength8();return this.readUTF8(e)},e.prototype.readUTF8_Length16LE=function(){var e=this.readLength16LE();return this.readUTF8(e)},e.prototype.readUTF8_Length32LE=function(){var e=this.readLength32LE();return this.readUTF8(e)},e.prototype.readUTF8_Length64LE=function(){var e=this.readLength64LE();return this.readUTF8(e)},e.prototype.readUTF8_NULL_terminated=function(){for(var e,t=this.readerIndex;;){if(void 0===(e=this.data[t]))throw new Error("HDSDecoder: Reached end of data stream while reading NUL terminated string!");if(0===e)break;t++}var r=this.data.toString("utf8",this.readerIndex,t);return this.readerIndex=t+1,this.trackData(r)},e.prototype.readData=function(e){this.ensureLength(e);var t=this.data.slice(this.readerIndex,this.readerIndex+e);return this.readerIndex+=e,this.trackData(t)},e.prototype.readData_Length8=function(){var e=this.readLength8();return this.readData(e)},e.prototype.readData_Length16LE=function(){var e=this.readLength16LE();return this.readData(e)},e.prototype.readData_Length32LE=function(){var e=this.readLength32LE();return this.readData(e)},e.prototype.readData_Length64LE=function(){var e=this.readLength64LE();return this.readData(e)},e.prototype.readData_terminated=function(){for(var e,t=this.readerIndex;;){if(void 0===(e=this.data[t]))throw new Error("HDSDecoder: Reached end of data stream while reading terminated data!");if(3===e)break;t++}var r=this.data.slice(this.readerIndex,t);return this.readerIndex=t+1,this.trackData(r)},e.prototype.readSecondsSince2001_01_01=function(){return this.readFloat64LE()},e.prototype.readUUID=function(){this.ensureLength(16);var e=n.unparse(this.data,this.readerIndex);return this.readerIndex+=16,this.trackData(e)},e}();t.DataStreamReader=C;var S=function(){function e(){this.writtenData=[]}return e.prototype.push=function(e){this.writtenData.push(e)},e.prototype.indexOf=function(e){for(var t=0;t0){var i=Math.ceil(r/e.chunkSize);this.data=Buffer.concat([this.data,Buffer.alloc(i*e.chunkSize)])}},e.prototype.compressDataIfPossible=function(e){var t=this.writtenData.indexOf(e);return t<0?(this.writtenData.push(e),!1):t<=47&&(this.writeTag(160+t),!0)},e.prototype.writeTag=function(e){this.ensureLength(1),this.data.writeUInt8(e,this.writerIndex++)},e.prototype.writeTrue=function(){this.writeTag(1)},e.prototype.writeFalse=function(){this.writeTag(2)},e.prototype.writeNumber=function(e){if(-1===e)this.writeTag(7);else if(e>=0&&e<=39)this.writeTag(8+e);else if(e>=-128&&e<=127)this.writeInt8(new l(e));else if(e>=-32768&&e<=32767)this.writeInt16LE(new h(e));else if(e>=-2147483648&&e<=-2147483648)this.writeInt32LE(new d(e));else{if(!(e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER))throw new Error("Tried writing unrepresentable number ("+e+")");this.writeInt64LE(new p(e))}},e.prototype.writeInt8=function(e){this.compressDataIfPossible(e)||(this.ensureLength(2),this.writeTag(48),this.data.writeInt8(e.value,this.writerIndex++))},e.prototype.writeInt16LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(3),this.writeTag(49),this.data.writeInt16LE(e.value,this.writerIndex),this.writerIndex+=2)},e.prototype.writeInt32LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(5),this.writeTag(50),this.data.writeInt32LE(e.value,this.writerIndex),this.writerIndex+=4)},e.prototype.writeInt64LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(9),this.writeTag(51),this.data.writeUInt32LE(e.value,this.writerIndex),this.data.writeUInt32LE(0,this.writerIndex+4),this.writerIndex+=8)},e.prototype.writeFloat32LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(5),this.writeTag(53),this.data.writeFloatLE(e.value,this.writerIndex),this.writerIndex+=4)},e.prototype.writeFloat64LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(9),this.writeTag(54),this.data.writeDoubleLE(e.value,this.writerIndex),this.writerIndex+=8)},e.prototype.writeLength8=function(e){this.ensureLength(1),this.data.writeUInt8(e,this.writerIndex++)},e.prototype.writeLength16LE=function(e){this.ensureLength(2),this.data.writeUInt16LE(e,this.writerIndex),this.writerIndex+=2},e.prototype.writeLength32LE=function(e){this.ensureLength(4),this.data.writeUInt32LE(e,this.writerIndex),this.writerIndex+=4},e.prototype.writeLength64LE=function(e){this.ensureLength(8),o.writeUInt64LE(e,this.data,this.writerIndex),this.writerIndex+=8},e.prototype.writeUTF8=function(e){if(!this.compressDataIfPossible(e)){var t=Buffer.byteLength(e);t<=32?(this.ensureLength(1+t),this.writeTag(64+e.length),this._writeUTF8(e)):t<=255?this.writeUTF8_Length8(e):t<=65535?this.writeUTF8_Length16LE(e):t<=4294967295?this.writeUTF8_Length32LE(e):t<=Number.MAX_SAFE_INTEGER?this.writeUTF8_Length64LE(e):this.writeUTF8_NULL_terminated(e)}},e.prototype._writeUTF8=function(e){var t=Buffer.byteLength(e);this.ensureLength(t),this.data.write(e,this.writerIndex,void 0,"utf8"),this.writerIndex+=t},e.prototype.writeUTF8_Length8=function(e){var t=Buffer.byteLength(e);this.ensureLength(2+t),this.writeTag(97),this.writeLength8(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length16LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(3+t),this.writeTag(98),this.writeLength16LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length32LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(5+t),this.writeTag(99),this.writeLength32LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length64LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(9+t),this.writeTag(100),this.writeLength64LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_NULL_terminated=function(e){this.ensureLength(1+Buffer.byteLength(e)+1),this.writeTag(111),this._writeUTF8(e),this.data.writeUInt8(0,this.writerIndex++)},e.prototype.writeData=function(e){this.compressDataIfPossible(e)||(e.length<=32?(this.writeTag(112+e.length),this._writeData(e)):e.length<=255?this.writeData_Length8(e):e.length<=65535?this.writeData_Length16LE(e):e.length<=4294967295?this.writeData_Length32LE(e):e.length<=Number.MAX_SAFE_INTEGER?this.writeData_Length64LE(e):this.writeData_terminated(e))},e.prototype._writeData=function(e){this.ensureLength(e.length);for(var t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamConnection=t.HDSConnectionError=t.HDSConnectionErrorType=t.DataStreamConnectionEvent=t.DataStreamServer=t.DataStreamServerEvent=t.MessageType=t.HDSProtocolError=t.HDSProtocolSpecificErrorReason=t.HDSStatus=t.Topics=t.Protocols=void 0;var i,n=r(1635),o=n.__importDefault(r(2613)),a=n.__importDefault(r(6982)),s=n.__importDefault(r(5753)),c=r(4434),u=n.__importDefault(r(9278)),l=n.__importStar(r(8)),h=r(7881),d=(0,s.default)("HAP-NodeJS:DataStream:Server");!function(e){e.CONTROL="control",e.TARGET_CONTROL="targetControl",e.DATA_SEND="dataSend"}(t.Protocols||(t.Protocols={})),function(e){e.HELLO="hello",e.WHOAMI="whoami",e.OPEN="open",e.DATA="data",e.ACK="ack",e.CLOSE="close"}(t.Topics||(t.Topics={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.OUT_OF_MEMORY=1]="OUT_OF_MEMORY",e[e.TIMEOUT=2]="TIMEOUT",e[e.HEADER_ERROR=3]="HEADER_ERROR",e[e.PAYLOAD_ERROR=4]="PAYLOAD_ERROR",e[e.MISSING_PROTOCOL=5]="MISSING_PROTOCOL",e[e.PROTOCOL_SPECIFIC_ERROR=6]="PROTOCOL_SPECIFIC_ERROR"}(i=t.HDSStatus||(t.HDSStatus={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.NOT_ALLOWED=1]="NOT_ALLOWED",e[e.BUSY=2]="BUSY",e[e.CANCELLED=3]="CANCELLED",e[e.UNSUPPORTED=4]="UNSUPPORTED",e[e.UNEXPECTED_FAILURE=5]="UNEXPECTED_FAILURE",e[e.TIMEOUT=6]="TIMEOUT",e[e.BAD_DATA=7]="BAD_DATA",e[e.PROTOCOL_ERROR=8]="PROTOCOL_ERROR",e[e.INVALID_CONFIGURATION=9]="INVALID_CONFIGURATION"}(t.HDSProtocolSpecificErrorReason||(t.HDSProtocolSpecificErrorReason={}));var p,f,m=function(e){function t(t){var r=e.call(this,"HDSProtocolError: "+t)||this;return(0,o.default)(0!==t,"Cannot initialize a HDSProtocolError with NORMAL!"),r.reason=t,r}return n.__extends(t,e),t}(Error);t.HDSProtocolError=m,function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.BINDING=1]="BINDING",e[e.LISTENING=2]="LISTENING",e[e.CLOSING=3]="CLOSING"}(p||(p={})),function(e){e[e.UNIDENTIFIED=0]="UNIDENTIFIED",e[e.EXPECTING_HELLO=1]="EXPECTING_HELLO",e[e.READY=2]="READY",e[e.CLOSING=3]="CLOSING",e[e.CLOSED=4]="CLOSED"}(f||(f={})),function(e){e[e.EVENT=1]="EVENT",e[e.REQUEST=2]="REQUEST",e[e.RESPONSE=3]="RESPONSE"}(t.MessageType||(t.MessageType={})),function(e){e.CONNECTION_OPENED="connection-opened",e.CONNECTION_CLOSED="connection-closed"}(t.DataStreamServerEvent||(t.DataStreamServerEvent={}));var g=function(e){function t(){var t=e.call(this)||this;return t.state=0,t.preparedSessions=[],t.connections=[],t.removeListenersOnceClosed=!1,t.internalEventEmitter=new c.EventEmitter,t}return n.__extends(t,e),t.prototype.onEventMessage=function(e,t,r){return this.internalEventEmitter.on(e+"-e-"+t,r),this},t.prototype.removeEventHandler=function(e,t,r){return this.internalEventEmitter.removeListener(e+"-e-"+t,r),this},t.prototype.onRequestMessage=function(e,t,r){return this.internalEventEmitter.on(e+"-r-"+t,r),this},t.prototype.removeRequestHandler=function(e,t,r){return this.internalEventEmitter.removeListener(e+"-r-"+t,r),this},t.prototype.prepareSession=function(e,r,i){var n=this;d("Preparing for incoming HDS connection from %s",e.sessionID);var o=a.default.randomBytes(32),s=Buffer.concat([r,o]),c={connection:e,accessoryToControllerEncryptionKey:l.HKDF("sha512",s,e.encryption.sharedSecret,t.accessoryToControllerInfo,32),controllerToAccessoryEncryptionKey:l.HKDF("sha512",s,e.encryption.sharedSecret,t.controllerToAccessoryInfo,32),accessoryKeySalt:o,connectTimeout:setTimeout((function(){return n.timeoutPreparedSession(c)}),1e4)};c.connectTimeout.unref(),this.preparedSessions.push(c),this.checkTCPServerEstablished(c,(function(e){e?i(e):i(void 0,c)}))},t.prototype.timeoutPreparedSession=function(e){d("Prepared HDS session timed out out since no connection was opened for 10 seconds (%s)",e.connection.sessionID);var t=this.preparedSessions.indexOf(e);t>=0&&this.preparedSessions.splice(t,1),this.checkCloseable()},t.prototype.checkTCPServerEstablished=function(e,t){var r=this;switch(this.state){case 0:d("Starting up TCP server."),this.tcpServer=u.default.createServer(),this.tcpServer.once("listening",this.listening.bind(this,e,t)),this.tcpServer.on("connection",this.onConnection.bind(this)),this.tcpServer.on("close",this.closed.bind(this)),this.tcpServer.listen(),this.state=1;break;case 1:d("TCP server already running. Waiting for it to bind."),this.tcpServer.once("listening",this.listening.bind(this,e,t));break;case 2:d("Instructing client to connect to already running TCP server"),e.port=this.tcpPort,t();break;case 3:d("TCP socket is currently closing. Trying again when server is fully closed and opening a new one then."),this.tcpServer.once("close",(function(){return setTimeout((function(){return r.checkTCPServerEstablished(e,t)}),10)}))}},t.prototype.listening=function(e,t){this.state=2;var r=this.tcpServer.address();r&&"string"!=typeof r&&(this.tcpPort=r.port,e.port=r.port,d("TCP server is now listening for new data stream connections on port %s",r.port),t())},t.prototype.onConnection=function(e){d("[%s] New DataStream connection was established",e.remoteAddress);var t=new y(e);t.on("identification",this.handleSessionIdentification.bind(this,t)),t.on("handle-message-globally",this.handleMessageGlobally.bind(this,t)),t.on("closed",this.connectionClosed.bind(this,t)),this.connections.push(t),this.emit("connection-opened",t)},t.prototype.handleSessionIdentification=function(e,t,r){for(var i=void 0,n=0;n=0&&this.preparedSessions.splice(a,1),clearTimeout(i.connectTimeout),i.connectTimeout=void 0}else d("[%s] Could not identify connection. Terminating.",e.remoteAddress),e.close()},t.prototype.handleMessageGlobally=function(e,t){var r;o.default.notStrictEqual(t.type,3);var i,a="",s=[];1===t.type?a="-e-":2===t.type&&(a="-r-",s.push(t.id)),s.push(t.message);try{i=(r=this.internalEventEmitter).emit.apply(r,n.__spreadArray([t.protocol+a+t.topic,e],n.__read(s),!1))}catch(r){i=!0,d("[%s] Error occurred while dispatching handler for HDS message: %o",e.remoteAddress,t),d(r.stack)}i||d("[%s] WARNING no handler was found for message: %o",e.remoteAddress,t)},t.prototype.connectionClosed=function(e){d("[%s] DataStream connection closed",e.remoteAddress),this.connections.splice(this.connections.indexOf(e),1),this.emit("connection-closed",e),this.checkCloseable(),3===this.state&&this.removeListenersOnceClosed&&0===this.connections.length&&this.removeAllListeners()},t.prototype.checkCloseable=function(){0===this.connections.length&&0===this.preparedSessions.length&&this.state<3&&(d("Last connection disconnected. Closing the server now."),this.state=3,this.tcpServer.close())},t.prototype.destroy=function(){var e,t;if(this.state>0&&this.state<3){this.tcpServer.close();try{for(var r=n.__values(this.connections),i=r.next();!i.done;i=r.next()){i.value.close()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}}this.state=3,this.removeListenersOnceClosed=!0,this.internalEventEmitter.removeAllListeners()},t.prototype.closed=function(){this.tcpServer=void 0,this.tcpPort=void 0,this.state=0},t.version="1.0",t.accessoryToControllerInfo=Buffer.from("HDS-Read-Encryption-Key"),t.controllerToAccessoryInfo=Buffer.from("HDS-Write-Encryption-Key"),t}(c.EventEmitter);t.DataStreamServer=g,function(e){e.IDENTIFICATION="identification",e.HANDLE_MESSAGE_GLOBALLY="handle-message-globally",e.CLOSED="closed"}(t.DataStreamConnectionEvent||(t.DataStreamConnectionEvent={})),function(e){e[e.ILLEGAL_STATE=1]="ILLEGAL_STATE",e[e.CLOSED_SOCKET=2]="CLOSED_SOCKET",e[e.MAX_PAYLOAD_LENGTH=3]="MAX_PAYLOAD_LENGTH"}(t.HDSConnectionErrorType||(t.HDSConnectionErrorType={}));var v=function(e){function t(t,r){var i=e.call(this,t)||this;return i.type=r,i}return n.__extends(t,e),t}(Error);t.HDSConnectionError=v;var y=function(e){function t(t){var r,i=e.call(this)||this;return i.state=0,i.protocolHandlers={},i.responseHandlers={},i.responseTimers={},i.socket=t,i.remoteAddress=t.remoteAddress,i.socket.setNoDelay(!0),i.socket.setKeepAlive(!0),i.accessoryToControllerNonce=0,i.accessoryToControllerNonceBuffer=Buffer.alloc(8),i.controllerToAccessoryNonce=0,i.controllerToAccessoryNonceBuffer=Buffer.alloc(8),i.hapConnectionClosedListener=i.onHAPSessionClosed.bind(i),i.addProtocolHandler("control",{requestHandler:(r={},r.hello=i.handleHello.bind(i),r)}),i.helloTimer=setTimeout((function(){d("[%s] Hello message did not arrive in time. Killing the connection",i.remoteAddress),i.close()}),1e4),i.socket.on("data",i.onSocketData.bind(i)),i.socket.on("error",i.onSocketError.bind(i)),i.socket.on("close",i.onSocketClose.bind(i)),i.setMaxListeners(100),i}return n.__extends(t,e),t.prototype.handleHello=function(e,t){d("[%s] Received hello message from client: %o",this.remoteAddress,t),clearTimeout(this.helloTimer),this.helloTimer=void 0,this.state=2,this.sendResponse("control","hello",e)},t.prototype.addProtocolHandler=function(e,t){return void 0===this.protocolHandlers[e]&&(this.protocolHandlers[e]=t,!0)},t.prototype.removeProtocolHandler=function(e,t){this.protocolHandlers[e]===t&&delete this.protocolHandlers[e]},t.prototype.sendEvent=function(e,t,r){void 0===r&&(r={});var i={};i.protocol=e,i.event=t,this.sendHDSFrame(i,r)},t.prototype.sendRequest=function(e,t,r,i){var n,o=this;void 0===r&&(r={});do{n=Math.floor(4294967295*Math.random())}while(void 0!==this.responseHandlers[n]);this.responseHandlers[n]=i,this.responseTimers[n]=setTimeout((function(){o.close();var e=o.responseHandlers[n];delete o.responseHandlers[n],delete o.responseTimers[n],e(new Error("timeout"),void 0,{})}),1e4);var a={};a.protocol=e,a.request=t,a.id=new h.Int64(n),this.sendHDSFrame(a,r)},t.prototype.sendResponse=function(e,t,r,n,o){void 0===n&&(n=i.SUCCESS),void 0===o&&(o={});var a={};a.protocol=e,a.response=t,a.id=new h.Int64(r),a.status=new h.Int64(n),this.sendHDSFrame(a,o)},t.prototype.onSocketData=function(e){var t=this;if(!(this.state>=3)){var r=0,i=this.decodeHDSFrames(e);if(0!==i.length){if(0===this.state){var n=i[r++];if(this.emit("identification",n,(function(e){e&&(t.connection=e.connection,t.accessoryToControllerEncryptionKey=e.accessoryToControllerEncryptionKey,t.controllerToAccessoryEncryptionKey=e.controllerToAccessoryEncryptionKey,t.state=1,t.connection.setMaxListeners(t.connection.getMaxListeners()+1),t.connection.on("closed",t.hapConnectionClosedListener),d("[%s] Registering CLOSED handler to HAP connection. Connection currently has %d close handlers!",t.remoteAddress,t.connection.listeners("closed").length))})),0===this.state)return}for(;rr){this.frameBuffer=e.slice(n);break}var o=e.readUInt8(n),a=e.readUIntBE(n+1,3);if(a>t.MAX_PAYLOAD_LENGTH)return d("[%s] Connection send payload with size bigger than the maximum allow for data stream",this.remoteAddress),this.close(),[];if(a+16>r-n-4){this.frameBuffer=e.slice(n);break}var s=n+4,c=s+a,u=e.slice(n,s),l=e.slice(s,c),h=Buffer.alloc(a),p=e.slice(c,c+16);if(n=c+16,1===o){var f={header:u,cipheredPayload:l,authTag:p};i.push(f)}else d("[%s] Encountered unknown payload type %d for payload: %s",this.remoteAddress,h.toString("hex"))}return i},t.prototype.decryptHDSFrame=function(e,t){l.writeUInt64LE(this.controllerToAccessoryNonce,this.controllerToAccessoryNonceBuffer,0);var r=t||this.controllerToAccessoryEncryptionKey;try{return e.plaintextPayload=l.chacha20_poly1305_decryptAndVerify(r,this.controllerToAccessoryNonceBuffer,e.header,e.cipheredPayload,e.authTag),this.controllerToAccessoryNonce++,!0}catch(e){return!1}},t.prototype.decodePayloads=function(e){var t=this,r=[];return e.forEach((function(e){var i=e.plaintextPayload;if(!i)throw new v("Reached illegal state. Encountered HDSFrame with wasn't decrypted yet!",1);var n,o,a,s=i.readUInt8(0),c=i.length-s-1,u=1+s,l=new h.DataStreamReader(i.slice(1,1+s)),p=new h.DataStreamReader(i.slice(u,u+c));try{n=h.DataStreamParser.decode(l),l.finished()}catch(e){return void d("[%s] Failed to decode header payload: %s",t.remoteAddress,e.message)}try{o=h.DataStreamParser.decode(p),p.finished()}catch(e){return void d("[%s] Failed to decode message payload: %s (header: %o)",t.remoteAddress,e.message,n)}var f,m=n.protocol,g=void 0,y=void 0;if(void 0!==n.event)a=1,f=n.event;else if(void 0!==n.request)a=2,f=n.request,g=n.id;else{if(void 0===n.response)return void d("[%s] Encountered unknown payload header format: %o (message: %o)",t.remoteAddress,n,o);a=3,f=n.response,g=n.id,y=n.status}var C={type:a,protocol:m,topic:f,id:g,status:y,message:o};r.push(C)})),r},t.prototype.sendHDSFrame=function(e,r){if(this.state>=3)throw new v("Cannot send message on closing/closed socket!",2);var i=new h.DataStreamWriter,n=new h.DataStreamWriter;h.DataStreamParser.encode(e,i),h.DataStreamParser.encode(r,n);var o=Buffer.alloc(1);o.writeUInt8(i.length(),0);var a=Buffer.concat([o,i.getData(),n.getData()]);if(a.length>t.MAX_PAYLOAD_LENGTH)throw new v("Tried sending payload with length larger than the maximum allowed for data stream",3);var s=Buffer.alloc(1);s.writeUInt8(1,0);var c=Buffer.alloc(4);c.writeUInt32BE(a.length,0),c=c.slice(1,4);var u=Buffer.concat([s,c]);l.writeUInt64LE(this.accessoryToControllerNonce++,this.accessoryToControllerNonceBuffer);var d=l.chacha20_poly1305_encryptAndSeal(this.accessoryToControllerEncryptionKey,this.accessoryToControllerNonceBuffer,u,a);this.socket.write(Buffer.concat([u,d.ciphertext,d.authTag]))},t.prototype.close=function(){this.state>=3||(this.state=3,this.socket.end())},t.prototype.isConsideredClosed=function(){return this.state>=3},t.prototype.onHAPSessionClosed=function(){d("[%s] HAP connection disconnected. Also closing DataStream connection now.",this.remoteAddress),this.close()},t.prototype.onSocketError=function(e){d("[%s] Encountered socket error: %s",this.remoteAddress,e.message)},t.prototype.onSocketClose=function(){var e,t;this.state=4,this.emit("closed"),null===(e=this.connection)||void 0===e||e.removeListener("closed",this.hapConnectionClosedListener),null===(t=this.connection)||void 0===t||t.setMaxListeners(this.connection.getMaxListeners()-1),this.removeAllListeners()},t.MAX_PAYLOAD_LENGTH=1048575,t}(c.EventEmitter);t.DataStreamConnection=y},9948:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(733),t),i.__exportStar(r(4097),t),i.__exportStar(r(7881),t)},651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CurrentMediaState=t.CurrentHumidifierDehumidifierState=t.CurrentHorizontalTiltAngle=t.CurrentHeatingCoolingState=t.CurrentHeaterCoolerState=t.CurrentFanState=t.CurrentDoorState=t.CurrentAmbientLightLevel=t.CurrentAirPurifierState=t.CryptoHash=t.CoolingThresholdTemperature=t.ContactSensorState=t.ConfiguredName=t.ConfigureBridgedAccessoryStatus=t.ConfigureBridgedAccessory=t.ConfigurationState=t.ColorTemperature=t.ClosedCaptions=t.ChargingState=t.CharacteristicValueTransitionControl=t.CharacteristicValueActiveTransitionCount=t.CCASignalDetectThreshold=t.CCAEnergyDetectThreshold=t.Category=t.CarbonMonoxidePeakLevel=t.CarbonMonoxideLevel=t.CarbonMonoxideDetected=t.CarbonDioxidePeakLevel=t.CarbonDioxideLevel=t.CarbonDioxideDetected=t.CameraOperatingModeIndicator=t.ButtonEvent=t.Brightness=t.BatteryLevel=t.AudioFeedback=t.AssetUpdateReadiness=t.AppMatchingIdentifier=t.AirQuality=t.AirPlayEnable=t.AirParticulateSize=t.AirParticulateDensity=t.AdministratorOnlyAccess=t.ActivityInterval=t.ActiveIdentifier=t.Active=t.AccessoryIdentifier=t.AccessoryFlags=t.AccessControlLevel=t.AccessCodeSupportedConfiguration=t.AccessCodeControlPoint=void 0,t.Logs=t.LockTargetState=t.LockPhysicalControls=t.LockManagementAutoSecurityTimeout=t.LockLastKnownAction=t.LockCurrentState=t.LockControlPoint=t.ListPairings=t.LinkQuality=t.LeakDetected=t.IsConfigured=t.InUse=t.InputSourceType=t.InputDeviceType=t.ImageRotation=t.ImageMirroring=t.Identify=t.Identifier=t.Hue=t.HomeKitCameraActive=t.HoldPosition=t.HeatingThresholdTemperature=t.HeartBeat=t.HardwareRevision=t.HardwareFinish=t.FirmwareUpdateStatus=t.FirmwareUpdateReadiness=t.FirmwareRevision=t.FilterLifeLevel=t.FilterChangeIndication=t.EventTransmissionCounters=t.EventSnapshotsActive=t.EventRetransmissionMaximum=t.DisplayOrder=t.DiscoveredBridgedAccessories=t.DiscoverBridgedAccessories=t.DigitalZoom=t.DiagonalFieldOfView=t.DayoftheWeek=t.DataStreamHAPTransportInterrupt=t.DataStreamHAPTransport=t.CurrentVisibilityState=t.CurrentVerticalTiltAngle=t.CurrentTransport=t.CurrentTime=t.CurrentTiltAngle=t.CurrentTemperature=t.CurrentSlatState=t.CurrentRelativeHumidity=t.CurrentPosition=void 0,t.RelayState=t.RelayEnabled=t.RelayControlPoint=t.RelativeHumidityHumidifierThreshold=t.RelativeHumidityDehumidifierThreshold=t.RecordingAudioActive=t.ReceiverSensitivity=t.ReceivedSignalStrengthIndication=t.Reachable=t.ProgramMode=t.ProgrammableSwitchOutputState=t.ProgrammableSwitchEvent=t.ProductData=t.PowerModeSelection=t.PositionState=t.PM2_5Density=t.PM10Density=t.Ping=t.PictureMode=t.PeriodicSnapshotsActive=t.PasswordSetting=t.PairVerify=t.PairSetup=t.PairingFeatures=t.OzoneDensity=t.OutletInUse=t.OpticalZoom=t.OperatingStateResponse=t.On=t.OccupancyDetected=t.ObstructionDetected=t.NitrogenDioxideDensity=t.NightVision=t.NFCAccessSupportedConfiguration=t.NFCAccessControlPoint=t.NetworkClientStatusControl=t.NetworkClientProfileControl=t.NetworkAccessViolationControl=t.Name=t.Mute=t.MultifunctionButton=t.MotionDetected=t.Model=t.MetricsBufferFullState=t.MaximumTransmitPower=t.Manufacturer=t.ManuallyDisabled=t.ManagedNetworkEnable=t.MACTransmissionCounters=t.MACRetransmissionMaximum=void 0,t.SupportedDiagnosticsModes=t.SupportedDataStreamTransportConfiguration=t.SupportedCharacteristicValueTransitionConfiguration=t.SupportedCameraRecordingConfiguration=t.SupportedAudioStreamConfiguration=t.SupportedAudioRecordingConfiguration=t.SupportedAssetTypes=t.SulphurDioxideDensity=t.StreamingStatus=t.StatusTampered=t.StatusLowBattery=t.StatusJammed=t.StatusFault=t.StatusActive=t.StagedFirmwareVersion=t.SoftwareRevision=t.SmokeDetected=t.SleepInterval=t.SleepDiscoveryMode=t.SlatType=t.SiriTouchToUse=t.SiriListening=t.SiriLightOnUse=t.SiriInputType=t.SiriEngineVersion=t.SiriEndpointSessionStatus=t.SiriEnable=t.SignalToNoiseRatio=t.SetupTransferTransport=t.SetupEndpoints=t.SetupDataStreamTransport=t.SetDuration=t.ServiceLabelNamespace=t.ServiceLabelIndex=t.SerialNumber=t.SelectedSleepConfiguration=t.SelectedRTPStreamConfiguration=t.SelectedDiagnosticsModes=t.SelectedCameraRecordingConfiguration=t.SelectedAudioStreamConfiguration=t.SecuritySystemTargetState=t.SecuritySystemCurrentState=t.SecuritySystemAlarmType=t.Saturation=t.RouterStatus=t.RotationSpeed=t.RotationDirection=t.ResetFilterIndication=t.RemoteKey=t.RemainingDuration=void 0,t.WakeConfiguration=t.VolumeSelector=t.VolumeControlType=t.Volume=t.VOCDensity=t.VideoAnalysisActive=t.Version=t.ValveType=t.TunneledAccessoryStateNumber=t.TunneledAccessoryConnected=t.TunneledAccessoryAdvertising=t.TunnelConnectionTimeout=t.TransmitPower=t.Token=t.TimeUpdate=t.ThreadStatus=t.ThreadOpenThreadVersion=t.ThreadNodeCapabilities=t.ThreadControlPoint=t.ThirdPartyCameraActive=t.TemperatureDisplayUnits=t.TargetVisibilityState=t.TargetVerticalTiltAngle=t.TargetTiltAngle=t.TargetTemperature=t.TargetSlatState=t.TargetRelativeHumidity=t.TargetPosition=t.TargetMediaState=t.TargetHumidifierDehumidifierState=t.TargetHorizontalTiltAngle=t.TargetHeatingCoolingState=t.TargetHeaterCoolerState=t.TargetFanState=t.TargetDoorState=t.TargetControlSupportedConfiguration=t.TargetControlList=t.TargetAirQuality=t.TargetAirPurifierState=t.TapType=t.SwingMode=t.SupportedVideoStreamConfiguration=t.SupportedVideoRecordingConfiguration=t.SupportedTransferTransportConfiguration=t.SupportedSleepConfiguration=t.SupportedRTPConfiguration=t.SupportedRouterConfiguration=t.SupportedMetrics=t.SupportedFirmwareUpdateConfiguration=t.SupportedDiagnosticsSnapshot=void 0,t.WiFiSatelliteStatus=t.WiFiConfigurationControl=t.WiFiCapabilities=t.WaterLevel=t.WANStatusList=t.WANConfigurationList=void 0;var i=r(1635),n=r(9826),o=function(e){function t(){var r=e.call(this,"Access Code Control Point",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000262-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessCodeControlPoint=o,n.Characteristic.AccessCodeControlPoint=o;var a=function(e){function t(){var r=e.call(this,"Access Code Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000261-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessCodeSupportedConfiguration=a,n.Characteristic.AccessCodeSupportedConfiguration=a;var s=function(e){function t(){var r=e.call(this,"Access Control Level",t.UUID,{format:"uint16",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessControlLevel=s,n.Characteristic.AccessControlLevel=s;var c=function(e){function t(){var r=e.call(this,"Accessory Flags",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A6-0000-1000-8000-0026BB765291",t.REQUIRES_ADDITIONAL_SETUP_BIT_MASK=1,t}(n.Characteristic);t.AccessoryFlags=c,n.Characteristic.AccessoryFlags=c;var u=function(e){function t(){var r=e.call(this,"Accessory Identifier",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000057-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessoryIdentifier=u,n.Characteristic.AccessoryIdentifier=u;var l=function(e){function t(){var r=e.call(this,"Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B0-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.ACTIVE=1,t}(n.Characteristic);t.Active=l,n.Characteristic.Active=l;var h=function(e){function t(){var r=e.call(this,"Active Identifier",t.UUID,{format:"uint32",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E7-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ActiveIdentifier=h,n.Characteristic.ActiveIdentifier=h;var d=function(e){function t(){var r=e.call(this,"Activity Interval",t.UUID,{format:"uint32",perms:["ev","pr"],minValue:0,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ActivityInterval=d,n.Characteristic.ActivityInterval=d;var p=function(e){function t(){var r=e.call(this,"Administrator Only Access",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000001-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AdministratorOnlyAccess=p,n.Characteristic.AdministratorOnlyAccess=p;var f=function(e){function t(){var r=e.call(this,"Air Particulate Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000064-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AirParticulateDensity=f,n.Characteristic.AirParticulateDensity=f;var m=function(e){function t(){var r=e.call(this,"Air Particulate Size",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000065-0000-1000-8000-0026BB765291",t._2_5_M=0,t._10_M=1,t}(n.Characteristic);t.AirParticulateSize=m,n.Characteristic.AirParticulateSize=m;var g=function(e){function t(){var r=e.call(this,"AirPlay Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000025B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AirPlayEnable=g,n.Characteristic.AirPlayEnable=g;var v=function(e){function t(){var r=e.call(this,"Air Quality",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1,validValues:[0,1,2,3,4,5]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000095-0000-1000-8000-0026BB765291",t.UNKNOWN=0,t.EXCELLENT=1,t.GOOD=2,t.FAIR=3,t.INFERIOR=4,t.POOR=5,t}(n.Characteristic);t.AirQuality=v,n.Characteristic.AirQuality=v;var y=function(e){function t(){var r=e.call(this,"App Matching Identifier",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AppMatchingIdentifier=y,n.Characteristic.AppMatchingIdentifier=y;var C=function(e){function t(){var r=e.call(this,"Asset Update Readiness",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000269-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AssetUpdateReadiness=C,n.Characteristic.AssetUpdateReadiness=C;var S=function(e){function t(){var r=e.call(this,"Audio Feedback",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000005-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AudioFeedback=S,n.Characteristic.AudioFeedback=S;var E=function(e){function t(){var r=e.call(this,"Battery Level",t.UUID,{format:"uint8",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000068-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.BatteryLevel=E,n.Characteristic.BatteryLevel=E;var _=function(e){function t(){var r=e.call(this,"Brightness",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000008-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Brightness=_,n.Characteristic.Brightness=_;var T=function(e){function t(){var r=e.call(this,"Button Event",t.UUID,{format:"tlv8",perms:["ev","pr"],adminOnlyAccess:[2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000126-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ButtonEvent=T,n.Characteristic.ButtonEvent=T;var A=function(e){function t(){var r=e.call(this,"Camera Operating Mode Indicator",t.UUID,{format:"bool",perms:["ev","pr","pw","tw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021D-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.CameraOperatingModeIndicator=A,n.Characteristic.CameraOperatingModeIndicator=A;var I=function(e){function t(){var r=e.call(this,"Carbon Dioxide Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000092-0000-1000-8000-0026BB765291",t.CO2_LEVELS_NORMAL=0,t.CO2_LEVELS_ABNORMAL=1,t}(n.Characteristic);t.CarbonDioxideDetected=I,n.Characteristic.CarbonDioxideDetected=I;var D=function(e){function t(){var r=e.call(this,"Carbon Dioxide Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000093-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonDioxideLevel=D,n.Characteristic.CarbonDioxideLevel=D;var w=function(e){function t(){var r=e.call(this,"Carbon Dioxide Peak Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000094-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonDioxidePeakLevel=w,n.Characteristic.CarbonDioxidePeakLevel=w;var b=function(e){function t(){var r=e.call(this,"Carbon Monoxide Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000069-0000-1000-8000-0026BB765291",t.CO_LEVELS_NORMAL=0,t.CO_LEVELS_ABNORMAL=1,t}(n.Characteristic);t.CarbonMonoxideDetected=b,n.Characteristic.CarbonMonoxideDetected=b;var U=function(e){function t(){var r=e.call(this,"Carbon Monoxide Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000090-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonMonoxideLevel=U,n.Characteristic.CarbonMonoxideLevel=U;var R=function(e){function t(){var r=e.call(this,"Carbon Monoxide Peak Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000091-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonMonoxidePeakLevel=R,n.Characteristic.CarbonMonoxidePeakLevel=R;var O=function(e){function t(){var r=e.call(this,"Category",t.UUID,{format:"uint16",perms:["ev","pr"],minValue:1,maxValue:16})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Category=O,n.Characteristic.Category=O;var N=function(e){function t(){var r=e.call(this,"CCA Energy Detect Threshold",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000246-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CCAEnergyDetectThreshold=N,n.Characteristic.CCAEnergyDetectThreshold=N;var P=function(e){function t(){var r=e.call(this,"CCA Signal Detect Threshold",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000245-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CCASignalDetectThreshold=P,n.Characteristic.CCASignalDetectThreshold=P;var B=function(e){function t(){var r=e.call(this,"Characteristic Value Active Transition Count",t.UUID,{format:"uint8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CharacteristicValueActiveTransitionCount=B,n.Characteristic.CharacteristicValueActiveTransitionCount=B;var L=function(e){function t(){var r=e.call(this,"Characteristic Value Transition Control",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000143-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CharacteristicValueTransitionControl=L,n.Characteristic.CharacteristicValueTransitionControl=L;var x=function(e){function t(){var r=e.call(this,"Charging State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000008F-0000-1000-8000-0026BB765291",t.NOT_CHARGING=0,t.CHARGING=1,t.NOT_CHARGEABLE=2,t}(n.Characteristic);t.ChargingState=x,n.Characteristic.ChargingState=x;var M=function(e){function t(){var r=e.call(this,"Closed Captions",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DD-0000-1000-8000-0026BB765291",t.DISABLED=0,t.ENABLED=1,t}(n.Characteristic);t.ClosedCaptions=M,n.Characteristic.ClosedCaptions=M;var F=function(e){function t(){var r=e.call(this,"Color Temperature",t.UUID,{format:"int",perms:["ev","pr","pw"],minValue:140,maxValue:500,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CE-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ColorTemperature=F,n.Characteristic.ColorTemperature=F;var k=function(e){function t(){var r=e.call(this,"Configuration State",t.UUID,{format:"uint16",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000263-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigurationState=k,n.Characteristic.ConfigurationState=k;var V=function(e){function t(){var r=e.call(this,"Configure Bridged Accessory",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A0-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigureBridgedAccessory=V,n.Characteristic.ConfigureBridgedAccessory=V;var H=function(e){function t(){var r=e.call(this,"Configure Bridged Accessory Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigureBridgedAccessoryStatus=H,n.Characteristic.ConfigureBridgedAccessoryStatus=H;var j=function(e){function t(){var r=e.call(this,"Configured Name",t.UUID,{format:"string",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfiguredName=j,n.Characteristic.ConfiguredName=j;var G=function(e){function t(){var r=e.call(this,"Contact Sensor State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006A-0000-1000-8000-0026BB765291",t.CONTACT_DETECTED=0,t.CONTACT_NOT_DETECTED=1,t}(n.Characteristic);t.ContactSensorState=G,n.Characteristic.ContactSensorState=G;var W=function(e){function t(){var r=e.call(this,"Cooling Threshold Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:10,maxValue:35,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CoolingThresholdTemperature=W,n.Characteristic.CoolingThresholdTemperature=W;var Y=function(e){function t(){var r=e.call(this,"Crypto Hash",t.UUID,{format:"tlv8",perms:["pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000250-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CryptoHash=Y,n.Characteristic.CryptoHash=Y;var q=function(e){function t(){var r=e.call(this,"Current Air Purifier State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A9-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.PURIFYING_AIR=2,t}(n.Characteristic);t.CurrentAirPurifierState=q,n.Characteristic.CurrentAirPurifierState=q;var K=function(e){function t(){var r=e.call(this,"Current Ambient Light Level",t.UUID,{format:"float",perms:["ev","pr"],unit:"lux",minValue:1e-4,maxValue:1e5})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentAmbientLightLevel=K,n.Characteristic.CurrentAmbientLightLevel=K;var $=function(e){function t(){var r=e.call(this,"Current Door State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:4,minStep:1,validValues:[0,1,2,3,4]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000E-0000-1000-8000-0026BB765291",t.OPEN=0,t.CLOSED=1,t.OPENING=2,t.CLOSING=3,t.STOPPED=4,t}(n.Characteristic);t.CurrentDoorState=$,n.Characteristic.CurrentDoorState=$;var z=function(e){function t(){var r=e.call(this,"Current Fan State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AF-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.BLOWING_AIR=2,t}(n.Characteristic);t.CurrentFanState=z,n.Characteristic.CurrentFanState=z;var Q=function(e){function t(){var r=e.call(this,"Current Heater-Cooler State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B1-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.HEATING=2,t.COOLING=3,t}(n.Characteristic);t.CurrentHeaterCoolerState=Q,n.Characteristic.CurrentHeaterCoolerState=Q;var X=function(e){function t(){var r=e.call(this,"Current Heating Cooling State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000F-0000-1000-8000-0026BB765291",t.OFF=0,t.HEAT=1,t.COOL=2,t}(n.Characteristic);t.CurrentHeatingCoolingState=X,n.Characteristic.CurrentHeatingCoolingState=X;var J=function(e){function t(){var r=e.call(this,"Current Horizontal Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentHorizontalTiltAngle=J,n.Characteristic.CurrentHorizontalTiltAngle=J;var Z=function(e){function t(){var r=e.call(this,"Current Humidifier-Dehumidifier State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B3-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.HUMIDIFYING=2,t.DEHUMIDIFYING=3,t}(n.Characteristic);t.CurrentHumidifierDehumidifierState=Z,n.Characteristic.CurrentHumidifierDehumidifierState=Z;var ee=function(e){function t(){var r=e.call(this,"Current Media State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1,validValues:[0,1,2,4,5]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E0-0000-1000-8000-0026BB765291",t.PLAY=0,t.PAUSE=1,t.STOP=2,t.LOADING=4,t.INTERRUPTED=5,t}(n.Characteristic);t.CurrentMediaState=ee,n.Characteristic.CurrentMediaState=ee;var te=function(e){function t(){var r=e.call(this,"Current Position",t.UUID,{format:"uint8",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentPosition=te,n.Characteristic.CurrentPosition=te;var re=function(e){function t(){var r=e.call(this,"Current Relative Humidity",t.UUID,{format:"float",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000010-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentRelativeHumidity=re,n.Characteristic.CurrentRelativeHumidity=re;var ie=function(e){function t(){var r=e.call(this,"Current Slat State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AA-0000-1000-8000-0026BB765291",t.FIXED=0,t.JAMMED=1,t.SWINGING=2,t}(n.Characteristic);t.CurrentSlatState=ie,n.Characteristic.CurrentSlatState=ie;var ne=function(e){function t(){var r=e.call(this,"Current Temperature",t.UUID,{format:"float",perms:["ev","pr"],unit:"celsius",minValue:-270,maxValue:100,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000011-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTemperature=ne,n.Characteristic.CurrentTemperature=ne;var oe=function(e){function t(){var r=e.call(this,"Current Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C1-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTiltAngle=oe,n.Characteristic.CurrentTiltAngle=oe;var ae=function(e){function t(){var r=e.call(this,"Current Time",t.UUID,{format:"string",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTime=ae,n.Characteristic.CurrentTime=ae;var se=function(e){function t(){var r=e.call(this,"Current Transport",t.UUID,{format:"bool",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTransport=se,n.Characteristic.CurrentTransport=se;var ce=function(e){function t(){var r=e.call(this,"Current Vertical Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentVerticalTiltAngle=ce,n.Characteristic.CurrentVerticalTiltAngle=ce;var ue=function(e){function t(){var r=e.call(this,"Current Visibility State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000135-0000-1000-8000-0026BB765291",t.SHOWN=0,t.HIDDEN=1,t}(n.Characteristic);t.CurrentVisibilityState=ue,n.Characteristic.CurrentVisibilityState=ue;var le=function(e){function t(){var r=e.call(this,"Data Stream HAP Transport",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000138-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DataStreamHAPTransport=le,n.Characteristic.DataStreamHAPTransport=le;var he=function(e){function t(){var r=e.call(this,"Data Stream HAP Transport Interrupt",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000139-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DataStreamHAPTransportInterrupt=he,n.Characteristic.DataStreamHAPTransportInterrupt=he;var de=function(e){function t(){var r=e.call(this,"Day of the Week",t.UUID,{format:"uint8",perms:["pr","pw"],minValue:1,maxValue:7})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000098-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DayoftheWeek=de,n.Characteristic.DayoftheWeek=de;var pe=function(e){function t(){var r=e.call(this,"Diagonal Field Of View",t.UUID,{format:"float",perms:["ev","pr"],unit:"arcdegrees",minValue:0,maxValue:360})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000224-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiagonalFieldOfView=pe,n.Characteristic.DiagonalFieldOfView=pe;var fe=function(e){function t(){var r=e.call(this,"Digital Zoom",t.UUID,{format:"float",perms:["ev","pr","pw"],minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DigitalZoom=fe,n.Characteristic.DigitalZoom=fe;var me=function(e){function t(){var r=e.call(this,"Discover Bridged Accessories",t.UUID,{format:"uint8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiscoverBridgedAccessories=me,n.Characteristic.DiscoverBridgedAccessories=me;var ge=function(e){function t(){var r=e.call(this,"Discovered Bridged Accessories",t.UUID,{format:"uint16",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiscoveredBridgedAccessories=ge,n.Characteristic.DiscoveredBridgedAccessories=ge;var ve=function(e){function t(){var r=e.call(this,"Display Order",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000136-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DisplayOrder=ve,n.Characteristic.DisplayOrder=ve;var ye=function(e){function t(){var r=e.call(this,"Event Retransmission Maximum",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.EventRetransmissionMaximum=ye,n.Characteristic.EventRetransmissionMaximum=ye;var Ce=function(e){function t(){var r=e.call(this,"Event Snapshots Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000223-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.EventSnapshotsActive=Ce,n.Characteristic.EventSnapshotsActive=Ce;var Se=function(e){function t(){var r=e.call(this,"Event Transmission Counters",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.EventTransmissionCounters=Se,n.Characteristic.EventTransmissionCounters=Se;var Ee=function(e){function t(){var r=e.call(this,"Filter Change Indication",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AC-0000-1000-8000-0026BB765291",t.FILTER_OK=0,t.CHANGE_FILTER=1,t}(n.Characteristic);t.FilterChangeIndication=Ee,n.Characteristic.FilterChangeIndication=Ee;var _e=function(e){function t(){var r=e.call(this,"Filter Life Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AB-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FilterLifeLevel=_e,n.Characteristic.FilterLifeLevel=_e;var Te=function(e){function t(){var r=e.call(this,"Firmware Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000052-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareRevision=Te,n.Characteristic.FirmwareRevision=Te;var Ae=function(e){function t(){var r=e.call(this,"Firmware Update Readiness",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000234-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareUpdateReadiness=Ae,n.Characteristic.FirmwareUpdateReadiness=Ae;var Ie=function(e){function t(){var r=e.call(this,"Firmware Update Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000235-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareUpdateStatus=Ie,n.Characteristic.FirmwareUpdateStatus=Ie;var De=function(e){function t(){var r=e.call(this,"Hardware Finish",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000026C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HardwareFinish=De,n.Characteristic.HardwareFinish=De;var we=function(e){function t(){var r=e.call(this,"Hardware Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000053-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HardwareRevision=we,n.Characteristic.HardwareRevision=we;var be=function(e){function t(){var r=e.call(this,"Heart Beat",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HeartBeat=be,n.Characteristic.HeartBeat=be;var Ue=function(e){function t(){var r=e.call(this,"Heating Threshold Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:0,maxValue:25,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000012-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HeatingThresholdTemperature=Ue,n.Characteristic.HeatingThresholdTemperature=Ue;var Re=function(e){function t(){var r=e.call(this,"Hold Position",t.UUID,{format:"bool",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HoldPosition=Re,n.Characteristic.HoldPosition=Re;var Oe=function(e){function t(){var r=e.call(this,"HomeKit Camera Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021B-0000-1000-8000-0026BB765291",t.OFF=0,t.ON=1,t}(n.Characteristic);t.HomeKitCameraActive=Oe,n.Characteristic.HomeKitCameraActive=Oe;var Ne=function(e){function t(){var r=e.call(this,"Hue",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:0,maxValue:360,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000013-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Hue=Ne,n.Characteristic.Hue=Ne;var Pe=function(e){function t(){var r=e.call(this,"Identifier",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E6-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Identifier=Pe,n.Characteristic.Identifier=Pe;var Be=function(e){function t(){var r=e.call(this,"Identify",t.UUID,{format:"bool",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000014-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Identify=Be,n.Characteristic.Identify=Be;var Le=function(e){function t(){var r=e.call(this,"Image Mirroring",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ImageMirroring=Le,n.Characteristic.ImageMirroring=Le;var xe=function(e){function t(){var r=e.call(this,"Image Rotation",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:0,maxValue:360,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ImageRotation=xe,n.Characteristic.ImageRotation=xe;var Me=function(e){function t(){var r=e.call(this,"Input Device Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:6,minStep:1,validValues:[0,1,2,3,4,5,6]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DC-0000-1000-8000-0026BB765291",t.OTHER=0,t.TV=1,t.RECORDING=2,t.TUNER=3,t.PLAYBACK=4,t.AUDIO_SYSTEM=5,t}(n.Characteristic);t.InputDeviceType=Me,n.Characteristic.InputDeviceType=Me;var Fe=function(e){function t(){var r=e.call(this,"Input Source Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:10,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DB-0000-1000-8000-0026BB765291",t.OTHER=0,t.HOME_SCREEN=1,t.TUNER=2,t.HDMI=3,t.COMPOSITE_VIDEO=4,t.S_VIDEO=5,t.COMPONENT_VIDEO=6,t.DVI=7,t.AIRPLAY=8,t.USB=9,t.APPLICATION=10,t}(n.Characteristic);t.InputSourceType=Fe,n.Characteristic.InputSourceType=Fe;var ke=function(e){function t(){var r=e.call(this,"In Use",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D2-0000-1000-8000-0026BB765291",t.NOT_IN_USE=0,t.IN_USE=1,t}(n.Characteristic);t.InUse=ke,n.Characteristic.InUse=ke;var Ve=function(e){function t(){var r=e.call(this,"Is Configured",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D6-0000-1000-8000-0026BB765291",t.NOT_CONFIGURED=0,t.CONFIGURED=1,t}(n.Characteristic);t.IsConfigured=Ve,n.Characteristic.IsConfigured=Ve;var He=function(e){function t(){var r=e.call(this,"Leak Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000070-0000-1000-8000-0026BB765291",t.LEAK_NOT_DETECTED=0,t.LEAK_DETECTED=1,t}(n.Characteristic);t.LeakDetected=He,n.Characteristic.LeakDetected=He;var je=function(e){function t(){var r=e.call(this,"Link Quality",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:1,maxValue:4})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LinkQuality=je,n.Characteristic.LinkQuality=je;var Ge=function(e){function t(){var r=e.call(this,"List Pairings",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000050-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ListPairings=Ge,n.Characteristic.ListPairings=Ge;var We=function(e){function t(){var r=e.call(this,"Lock Control Point",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000019-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LockControlPoint=We,n.Characteristic.LockControlPoint=We;var Ye=function(e){function t(){var r=e.call(this,"Lock Current State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001D-0000-1000-8000-0026BB765291",t.UNSECURED=0,t.SECURED=1,t.JAMMED=2,t.UNKNOWN=3,t}(n.Characteristic);t.LockCurrentState=Ye,n.Characteristic.LockCurrentState=Ye;var qe=function(e){function t(){var r=e.call(this,"Lock Last Known Action",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:10,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001C-0000-1000-8000-0026BB765291",t.SECURED_PHYSICALLY_INTERIOR=0,t.UNSECURED_PHYSICALLY_INTERIOR=1,t.SECURED_PHYSICALLY_EXTERIOR=2,t.UNSECURED_PHYSICALLY_EXTERIOR=3,t.SECURED_BY_KEYPAD=4,t.UNSECURED_BY_KEYPAD=5,t.SECURED_REMOTELY=6,t.UNSECURED_REMOTELY=7,t.SECURED_BY_AUTO_SECURE_TIMEOUT=8,t.SECURED_PHYSICALLY=9,t.UNSECURED_PHYSICALLY=10,t}(n.Characteristic);t.LockLastKnownAction=qe,n.Characteristic.LockLastKnownAction=qe;var Ke=function(e){function t(){var r=e.call(this,"Lock Management Auto Security Timeout",t.UUID,{format:"uint32",perms:["ev","pr","pw"],unit:"seconds"})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LockManagementAutoSecurityTimeout=Ke,n.Characteristic.LockManagementAutoSecurityTimeout=Ke;var $e=function(e){function t(){var r=e.call(this,"Lock Physical Controls",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A7-0000-1000-8000-0026BB765291",t.CONTROL_LOCK_DISABLED=0,t.CONTROL_LOCK_ENABLED=1,t}(n.Characteristic);t.LockPhysicalControls=$e,n.Characteristic.LockPhysicalControls=$e;var ze=function(e){function t(){var r=e.call(this,"Lock Target State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001E-0000-1000-8000-0026BB765291",t.UNSECURED=0,t.SECURED=1,t}(n.Characteristic);t.LockTargetState=ze,n.Characteristic.LockTargetState=ze;var Qe=function(e){function t(){var r=e.call(this,"Logs",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Logs=Qe,n.Characteristic.Logs=Qe;var Xe=function(e){function t(){var r=e.call(this,"MAC Retransmission Maximum",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000247-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MACRetransmissionMaximum=Xe,n.Characteristic.MACRetransmissionMaximum=Xe;var Je=function(e){function t(){var r=e.call(this,"MAC Transmission Counters",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000248-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MACTransmissionCounters=Je,n.Characteristic.MACTransmissionCounters=Je;var Ze=function(e){function t(){var r=e.call(this,"Managed Network Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw","tw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000215-0000-1000-8000-0026BB765291",t.DISABLED=0,t.ENABLED=1,t}(n.Characteristic);t.ManagedNetworkEnable=Ze,n.Characteristic.ManagedNetworkEnable=Ze;var et=function(e){function t(){var r=e.call(this,"Manually Disabled",t.UUID,{format:"bool",perms:["ev","pr"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000227-0000-1000-8000-0026BB765291",t.ENABLED=0,t.DISABLED=1,t}(n.Characteristic);t.ManuallyDisabled=et,n.Characteristic.ManuallyDisabled=et;var tt=function(e){function t(){var r=e.call(this,"Manufacturer",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000020-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Manufacturer=tt,n.Characteristic.Manufacturer=tt;var rt=function(e){function t(){var r=e.call(this,"Maximum Transmit Power",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000243-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MaximumTransmitPower=rt,n.Characteristic.MaximumTransmitPower=rt;var it=function(e){function t(){var r=e.call(this,"Metrics Buffer Full State",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000272-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MetricsBufferFullState=it,n.Characteristic.MetricsBufferFullState=it;var nt=function(e){function t(){var r=e.call(this,"Model",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000021-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Model=nt,n.Characteristic.Model=nt;var ot=function(e){function t(){var r=e.call(this,"Motion Detected",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000022-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MotionDetected=ot,n.Characteristic.MotionDetected=ot;var at=function(e){function t(){var r=e.call(this,"Multifunction Button",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000026B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MultifunctionButton=at,n.Characteristic.MultifunctionButton=at;var st=function(e){function t(){var r=e.call(this,"Mute",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Mute=st,n.Characteristic.Mute=st;var ct=function(e){function t(){var r=e.call(this,"Name",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000023-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Name=ct,n.Characteristic.Name=ct;var ut=function(e){function t(){var r=e.call(this,"Network Access Violation Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkAccessViolationControl=ut,n.Characteristic.NetworkAccessViolationControl=ut;var lt=function(e){function t(){var r=e.call(this,"Network Client Profile Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkClientProfileControl=lt,n.Characteristic.NetworkClientProfileControl=lt;var ht=function(e){function t(){var r=e.call(this,"Network Client Status Control",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkClientStatusControl=ht,n.Characteristic.NetworkClientStatusControl=ht;var dt=function(e){function t(){var r=e.call(this,"NFC Access Control Point",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000264-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NFCAccessControlPoint=dt,n.Characteristic.NFCAccessControlPoint=dt;var pt=function(e){function t(){var r=e.call(this,"NFC Access Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000265-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NFCAccessSupportedConfiguration=pt,n.Characteristic.NFCAccessSupportedConfiguration=pt;var ft=function(e){function t(){var r=e.call(this,"Night Vision",t.UUID,{format:"bool",perms:["ev","pr","pw","tw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NightVision=ft,n.Characteristic.NightVision=ft;var mt=function(e){function t(){var r=e.call(this,"Nitrogen Dioxide Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NitrogenDioxideDensity=mt,n.Characteristic.NitrogenDioxideDensity=mt;var gt=function(e){function t(){var r=e.call(this,"Obstruction Detected",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000024-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ObstructionDetected=gt,n.Characteristic.ObstructionDetected=gt;var vt=function(e){function t(){var r=e.call(this,"Occupancy Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000071-0000-1000-8000-0026BB765291",t.OCCUPANCY_NOT_DETECTED=0,t.OCCUPANCY_DETECTED=1,t}(n.Characteristic);t.OccupancyDetected=vt,n.Characteristic.OccupancyDetected=vt;var yt=function(e){function t(){var r=e.call(this,"On",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000025-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.On=yt,n.Characteristic.On=yt;var Ct=function(e){function t(){var r=e.call(this,"Operating State Response",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000232-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OperatingStateResponse=Ct,n.Characteristic.OperatingStateResponse=Ct;var St=function(e){function t(){var r=e.call(this,"Optical Zoom",t.UUID,{format:"float",perms:["ev","pr","pw"],minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OpticalZoom=St,n.Characteristic.OpticalZoom=St;var Et=function(e){function t(){var r=e.call(this,"Outlet In Use",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000026-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OutletInUse=Et,n.Characteristic.OutletInUse=Et;var _t=function(e){function t(){var r=e.call(this,"Ozone Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OzoneDensity=_t,n.Characteristic.OzoneDensity=_t;var Tt=function(e){function t(){var r=e.call(this,"Pairing Features",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairingFeatures=Tt,n.Characteristic.PairingFeatures=Tt;var At=function(e){function t(){var r=e.call(this,"Pair Setup",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairSetup=At,n.Characteristic.PairSetup=At;var It=function(e){function t(){var r=e.call(this,"Pair Verify",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairVerify=It,n.Characteristic.PairVerify=It;var Dt=function(e){function t(){var r=e.call(this,"Password Setting",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PasswordSetting=Dt,n.Characteristic.PasswordSetting=Dt;var wt=function(e){function t(){var r=e.call(this,"Periodic Snapshots Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000225-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.PeriodicSnapshotsActive=wt,n.Characteristic.PeriodicSnapshotsActive=wt;var bt=function(e){function t(){var r=e.call(this,"Picture Mode",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:13,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10,11,12,13]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E2-0000-1000-8000-0026BB765291",t.OTHER=0,t.STANDARD=1,t.CALIBRATED=2,t.CALIBRATED_DARK=3,t.VIVID=4,t.GAME=5,t.COMPUTER=6,t.CUSTOM=7,t}(n.Characteristic);t.PictureMode=bt,n.Characteristic.PictureMode=bt;var Ut=function(e){function t(){var r=e.call(this,"Ping",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Ping=Ut,n.Characteristic.Ping=Ut;var Rt=function(e){function t(){var r=e.call(this,"PM10 Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C7-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PM10Density=Rt,n.Characteristic.PM10Density=Rt;var Ot=function(e){function t(){var r=e.call(this,"PM2.5 Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C6-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PM2_5Density=Ot,n.Characteristic.PM2_5Density=Ot;var Nt=function(e){function t(){var r=e.call(this,"Position State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000072-0000-1000-8000-0026BB765291",t.DECREASING=0,t.INCREASING=1,t.STOPPED=2,t}(n.Characteristic);t.PositionState=Nt,n.Characteristic.PositionState=Nt;var Pt=function(e){function t(){var r=e.call(this,"Power Mode Selection",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DF-0000-1000-8000-0026BB765291",t.SHOW=0,t.HIDE=1,t}(n.Characteristic);t.PowerModeSelection=Pt,n.Characteristic.PowerModeSelection=Pt;var Bt=function(e){function t(){var r=e.call(this,"Product Data",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000220-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ProductData=Bt,n.Characteristic.ProductData=Bt;var Lt=function(e){function t(){var r=e.call(this,"Programmable Switch Event",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000073-0000-1000-8000-0026BB765291",t.SINGLE_PRESS=0,t.DOUBLE_PRESS=1,t.LONG_PRESS=2,t}(n.Characteristic);t.ProgrammableSwitchEvent=Lt,n.Characteristic.ProgrammableSwitchEvent=Lt;var xt=function(e){function t(){var r=e.call(this,"Programmable Switch Output State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000074-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ProgrammableSwitchOutputState=xt,n.Characteristic.ProgrammableSwitchOutputState=xt;var Mt=function(e){function t(){var r=e.call(this,"Program Mode",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D1-0000-1000-8000-0026BB765291",t.NO_PROGRAM_SCHEDULED=0,t.PROGRAM_SCHEDULED=1,t.PROGRAM_SCHEDULED_MANUAL_MODE_=2,t}(n.Characteristic);t.ProgramMode=Mt,n.Characteristic.ProgramMode=Mt;var Ft=function(e){function t(){var r=e.call(this,"Reachable",t.UUID,{format:"bool",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000063-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Reachable=Ft,n.Characteristic.Reachable=Ft;var kt=function(e){function t(){var r=e.call(this,"Received Signal Strength Indication",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ReceivedSignalStrengthIndication=kt,n.Characteristic.ReceivedSignalStrengthIndication=kt;var Vt=function(e){function t(){var r=e.call(this,"Receiver Sensitivity",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000244-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ReceiverSensitivity=Vt,n.Characteristic.ReceiverSensitivity=Vt;var Ht=function(e){function t(){var r=e.call(this,"Recording Audio Active",t.UUID,{format:"uint8",perms:["ev","pr","pw","tw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000226-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.RecordingAudioActive=Ht,n.Characteristic.RecordingAudioActive=Ht;var jt=function(e){function t(){var r=e.call(this,"Relative Humidity Dehumidifier Threshold",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C9-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelativeHumidityDehumidifierThreshold=jt,n.Characteristic.RelativeHumidityDehumidifierThreshold=jt;var Gt=function(e){function t(){var r=e.call(this,"Relative Humidity Humidifier Threshold",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CA-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelativeHumidityHumidifierThreshold=Gt,n.Characteristic.RelativeHumidityHumidifierThreshold=Gt;var Wt=function(e){function t(){var r=e.call(this,"Relay Control Point",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayControlPoint=Wt,n.Characteristic.RelayControlPoint=Wt;var Yt=function(e){function t(){var r=e.call(this,"Relay Enabled",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayEnabled=Yt,n.Characteristic.RelayEnabled=Yt;var qt=function(e){function t(){var r=e.call(this,"Relay State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayState=qt,n.Characteristic.RelayState=qt;var Kt=function(e){function t(){var r=e.call(this,"Remaining Duration",t.UUID,{format:"uint32",perms:["ev","pr"],unit:"seconds",minValue:0,maxValue:3600,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RemainingDuration=Kt,n.Characteristic.RemainingDuration=Kt;var $t=function(e){function t(){var r=e.call(this,"Remote Key",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:16,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E1-0000-1000-8000-0026BB765291",t.REWIND=0,t.FAST_FORWARD=1,t.NEXT_TRACK=2,t.PREVIOUS_TRACK=3,t.ARROW_UP=4,t.ARROW_DOWN=5,t.ARROW_LEFT=6,t.ARROW_RIGHT=7,t.SELECT=8,t.BACK=9,t.EXIT=10,t.PLAY_PAUSE=11,t.INFORMATION=15,t}(n.Characteristic);t.RemoteKey=$t,n.Characteristic.RemoteKey=$t;var zt=function(e){function t(){var r=e.call(this,"Reset Filter Indication",t.UUID,{format:"uint8",perms:["pw"],minValue:1,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AD-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ResetFilterIndication=zt,n.Characteristic.ResetFilterIndication=zt;var Qt=function(e){function t(){var r=e.call(this,"Rotation Direction",t.UUID,{format:"int",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000028-0000-1000-8000-0026BB765291",t.CLOCKWISE=0,t.COUNTER_CLOCKWISE=1,t}(n.Characteristic);t.RotationDirection=Qt,n.Characteristic.RotationDirection=Qt;var Xt=function(e){function t(){var r=e.call(this,"Rotation Speed",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000029-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RotationSpeed=Xt,n.Characteristic.RotationSpeed=Xt;var Jt=function(e){function t(){var r=e.call(this,"Router Status",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020E-0000-1000-8000-0026BB765291",t.READY=0,t.NOT_READY=1,t}(n.Characteristic);t.RouterStatus=Jt,n.Characteristic.RouterStatus=Jt;var Zt=function(e){function t(){var r=e.call(this,"Saturation",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000002F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Saturation=Zt,n.Characteristic.Saturation=Zt;var er=function(e){function t(){var r=e.call(this,"Security System Alarm Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000008E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SecuritySystemAlarmType=er,n.Characteristic.SecuritySystemAlarmType=er;var tr=function(e){function t(){var r=e.call(this,"Security System Current State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:4,minStep:1,validValues:[0,1,2,3,4]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000066-0000-1000-8000-0026BB765291",t.STAY_ARM=0,t.AWAY_ARM=1,t.NIGHT_ARM=2,t.DISARMED=3,t.ALARM_TRIGGERED=4,t}(n.Characteristic);t.SecuritySystemCurrentState=tr,n.Characteristic.SecuritySystemCurrentState=tr;var rr=function(e){function t(){var r=e.call(this,"Security System Target State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000067-0000-1000-8000-0026BB765291",t.STAY_ARM=0,t.AWAY_ARM=1,t.NIGHT_ARM=2,t.DISARM=3,t}(n.Characteristic);t.SecuritySystemTargetState=rr,n.Characteristic.SecuritySystemTargetState=rr;var ir=function(e){function t(){var r=e.call(this,"Selected Audio Stream Configuration",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000128-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedAudioStreamConfiguration=ir,n.Characteristic.SelectedAudioStreamConfiguration=ir;var nr=function(e){function t(){var r=e.call(this,"Selected Camera Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000209-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedCameraRecordingConfiguration=nr,n.Characteristic.SelectedCameraRecordingConfiguration=nr;var or=function(e){function t(){var r=e.call(this,"Selected Diagnostics Modes",t.UUID,{format:"uint32",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedDiagnosticsModes=or,n.Characteristic.SelectedDiagnosticsModes=or;var ar=function(e){function t(){var r=e.call(this,"Selected RTP Stream Configuration",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000117-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedRTPStreamConfiguration=ar,n.Characteristic.SelectedRTPStreamConfiguration=ar;var sr=function(e){function t(){var r=e.call(this,"Selected Sleep Configuration",t.UUID,{format:"tlv8",perms:["ev","pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000252-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedSleepConfiguration=sr,n.Characteristic.SelectedSleepConfiguration=sr;var cr=function(e){function t(){var r=e.call(this,"Serial Number",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000030-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SerialNumber=cr,n.Characteristic.SerialNumber=cr;var ur=function(e){function t(){var r=e.call(this,"Service Label Index",t.UUID,{format:"uint8",perms:["pr"],minValue:1,maxValue:255,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CB-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ServiceLabelIndex=ur,n.Characteristic.ServiceLabelIndex=ur;var lr=function(e){function t(){var r=e.call(this,"Service Label Namespace",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CD-0000-1000-8000-0026BB765291",t.DOTS=0,t.ARABIC_NUMERALS=1,t}(n.Characteristic);t.ServiceLabelNamespace=lr,n.Characteristic.ServiceLabelNamespace=lr;var hr=function(e){function t(){var r=e.call(this,"Set Duration",t.UUID,{format:"uint32",perms:["ev","pr","pw"],unit:"seconds",minValue:0,maxValue:3600,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetDuration=hr,n.Characteristic.SetDuration=hr;var dr=function(e){function t(){var r=e.call(this,"Setup Data Stream Transport",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000131-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupDataStreamTransport=dr,n.Characteristic.SetupDataStreamTransport=dr;var pr=function(e){function t(){var r=e.call(this,"Setup Endpoints",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000118-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupEndpoints=pr,n.Characteristic.SetupEndpoints=pr;var fr=function(e){function t(){var r=e.call(this,"Setup Transfer Transport",t.UUID,{format:"tlv8",perms:["pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000201-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupTransferTransport=fr,n.Characteristic.SetupTransferTransport=fr;var mr=function(e){function t(){var r=e.call(this,"Signal To Noise Ratio",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000241-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SignalToNoiseRatio=mr,n.Characteristic.SignalToNoiseRatio=mr;var gr=function(e){function t(){var r=e.call(this,"Siri Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000255-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEnable=gr,n.Characteristic.SiriEnable=gr;var vr=function(e){function t(){var r=e.call(this,"Siri Endpoint Session Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000254-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEndpointSessionStatus=vr,n.Characteristic.SiriEndpointSessionStatus=vr;var yr=function(e){function t(){var r=e.call(this,"Siri Engine Version",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000025A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEngineVersion=yr,n.Characteristic.SiriEngineVersion=yr;var Cr=function(e){function t(){var r=e.call(this,"Siri Input Type",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:0,validValues:[0]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000132-0000-1000-8000-0026BB765291",t.PUSH_BUTTON_TRIGGERED_APPLE_TV=0,t}(n.Characteristic);t.SiriInputType=Cr,n.Characteristic.SiriInputType=Cr;var Sr=function(e){function t(){var r=e.call(this,"Siri Light On Use",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000258-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriLightOnUse=Sr,n.Characteristic.SiriLightOnUse=Sr;var Er=function(e){function t(){var r=e.call(this,"Siri Listening",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000256-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriListening=Er,n.Characteristic.SiriListening=Er;var _r=function(e){function t(){var r=e.call(this,"Siri Touch To Use",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000257-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriTouchToUse=_r,n.Characteristic.SiriTouchToUse=_r;var Tr=function(e){function t(){var r=e.call(this,"Slat Type",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C0-0000-1000-8000-0026BB765291",t.HORIZONTAL=0,t.VERTICAL=1,t}(n.Characteristic);t.SlatType=Tr,n.Characteristic.SlatType=Tr;var Ar=function(e){function t(){var r=e.call(this,"Sleep Discovery Mode",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E8-0000-1000-8000-0026BB765291",t.NOT_DISCOVERABLE=0,t.ALWAYS_DISCOVERABLE=1,t}(n.Characteristic);t.SleepDiscoveryMode=Ar,n.Characteristic.SleepDiscoveryMode=Ar;var Ir=function(e){function t(){var r=e.call(this,"Sleep Interval",t.UUID,{format:"uint32",perms:["ev","pr"],minValue:0,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SleepInterval=Ir,n.Characteristic.SleepInterval=Ir;var Dr=function(e){function t(){var r=e.call(this,"Smoke Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000076-0000-1000-8000-0026BB765291",t.SMOKE_NOT_DETECTED=0,t.SMOKE_DETECTED=1,t}(n.Characteristic);t.SmokeDetected=Dr,n.Characteristic.SmokeDetected=Dr;var wr=function(e){function t(){var r=e.call(this,"Software Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000054-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SoftwareRevision=wr,n.Characteristic.SoftwareRevision=wr;var br=function(e){function t(){var r=e.call(this,"Staged Firmware Version",t.UUID,{format:"string",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000249-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StagedFirmwareVersion=br,n.Characteristic.StagedFirmwareVersion=br;var Ur=function(e){function t(){var r=e.call(this,"Status Active",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000075-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StatusActive=Ur,n.Characteristic.StatusActive=Ur;var Rr=function(e){function t(){var r=e.call(this,"Status Fault",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000077-0000-1000-8000-0026BB765291",t.NO_FAULT=0,t.GENERAL_FAULT=1,t}(n.Characteristic);t.StatusFault=Rr,n.Characteristic.StatusFault=Rr;var Or=function(e){function t(){var r=e.call(this,"Status Jammed",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000078-0000-1000-8000-0026BB765291",t.NOT_JAMMED=0,t.JAMMED=1,t}(n.Characteristic);t.StatusJammed=Or,n.Characteristic.StatusJammed=Or;var Nr=function(e){function t(){var r=e.call(this,"Status Low Battery",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000079-0000-1000-8000-0026BB765291",t.BATTERY_LEVEL_NORMAL=0,t.BATTERY_LEVEL_LOW=1,t}(n.Characteristic);t.StatusLowBattery=Nr,n.Characteristic.StatusLowBattery=Nr;var Pr=function(e){function t(){var r=e.call(this,"Status Tampered",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007A-0000-1000-8000-0026BB765291",t.NOT_TAMPERED=0,t.TAMPERED=1,t}(n.Characteristic);t.StatusTampered=Pr,n.Characteristic.StatusTampered=Pr;var Br=function(e){function t(){var r=e.call(this,"Streaming Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000120-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StreamingStatus=Br,n.Characteristic.StreamingStatus=Br;var Lr=function(e){function t(){var r=e.call(this,"Sulphur Dioxide Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SulphurDioxideDensity=Lr,n.Characteristic.SulphurDioxideDensity=Lr;var xr=function(e){function t(){var r=e.call(this,"Supported Asset Types",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000268-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAssetTypes=xr,n.Characteristic.SupportedAssetTypes=xr;var Mr=function(e){function t(){var r=e.call(this,"Supported Audio Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000207-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAudioRecordingConfiguration=Mr,n.Characteristic.SupportedAudioRecordingConfiguration=Mr;var Fr=function(e){function t(){var r=e.call(this,"Supported Audio Stream Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000115-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAudioStreamConfiguration=Fr,n.Characteristic.SupportedAudioStreamConfiguration=Fr;var kr=function(e){function t(){var r=e.call(this,"Supported Camera Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000205-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedCameraRecordingConfiguration=kr,n.Characteristic.SupportedCameraRecordingConfiguration=kr;var Vr=function(e){function t(){var r=e.call(this,"Supported Characteristic Value Transition Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000144-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedCharacteristicValueTransitionConfiguration=Vr,n.Characteristic.SupportedCharacteristicValueTransitionConfiguration=Vr;var Hr=function(e){function t(){var r=e.call(this,"Supported Data Stream Transport Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000130-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDataStreamTransportConfiguration=Hr,n.Characteristic.SupportedDataStreamTransportConfiguration=Hr;var jr=function(e){function t(){var r=e.call(this,"Supported Diagnostics Modes",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDiagnosticsModes=jr,n.Characteristic.SupportedDiagnosticsModes=jr;var Gr=function(e){function t(){var r=e.call(this,"Supported Diagnostics Snapshot",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000238-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDiagnosticsSnapshot=Gr,n.Characteristic.SupportedDiagnosticsSnapshot=Gr;var Wr=function(e){function t(){var r=e.call(this,"Supported Firmware Update Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000233-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedFirmwareUpdateConfiguration=Wr,n.Characteristic.SupportedFirmwareUpdateConfiguration=Wr;var Yr=function(e){function t(){var r=e.call(this,"Supported Metrics",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000271-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedMetrics=Yr,n.Characteristic.SupportedMetrics=Yr;var qr=function(e){function t(){var r=e.call(this,"Supported Router Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000210-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedRouterConfiguration=qr,n.Characteristic.SupportedRouterConfiguration=qr;var Kr=function(e){function t(){var r=e.call(this,"Supported RTP Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000116-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedRTPConfiguration=Kr,n.Characteristic.SupportedRTPConfiguration=Kr;var $r=function(e){function t(){var r=e.call(this,"Supported Sleep Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000251-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedSleepConfiguration=$r,n.Characteristic.SupportedSleepConfiguration=$r;var zr=function(e){function t(){var r=e.call(this,"Supported Transfer Transport Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000202-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedTransferTransportConfiguration=zr,n.Characteristic.SupportedTransferTransportConfiguration=zr;var Qr=function(e){function t(){var r=e.call(this,"Supported Video Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000206-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedVideoRecordingConfiguration=Qr,n.Characteristic.SupportedVideoRecordingConfiguration=Qr;var Xr=function(e){function t(){var r=e.call(this,"Supported Video Stream Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000114-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedVideoStreamConfiguration=Xr,n.Characteristic.SupportedVideoStreamConfiguration=Xr;var Jr=function(e){function t(){var r=e.call(this,"Swing Mode",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B6-0000-1000-8000-0026BB765291",t.SWING_DISABLED=0,t.SWING_ENABLED=1,t}(n.Characteristic);t.SwingMode=Jr,n.Characteristic.SwingMode=Jr;var Zr=function(e){function t(){var r=e.call(this,"Tap Type",t.UUID,{format:"uint16",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TapType=Zr,n.Characteristic.TapType=Zr;var ei=function(e){function t(){var r=e.call(this,"Target Air Purifier State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A8-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetAirPurifierState=ei,n.Characteristic.TargetAirPurifierState=ei;var ti=function(e){function t(){var r=e.call(this,"Target Air Quality",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AE-0000-1000-8000-0026BB765291",t.EXCELLENT=0,t.GOOD=1,t.FAIR=2,t}(n.Characteristic);t.TargetAirQuality=ti,n.Characteristic.TargetAirQuality=ti;var ri=function(e){function t(){var r=e.call(this,"Target Control List",t.UUID,{format:"tlv8",perms:["pr","pw","wr"],adminOnlyAccess:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000124-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetControlList=ri,n.Characteristic.TargetControlList=ri;var ii=function(e){function t(){var r=e.call(this,"Target Control Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000123-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetControlSupportedConfiguration=ii,n.Characteristic.TargetControlSupportedConfiguration=ii;var ni=function(e){function t(){var r=e.call(this,"Target Door State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000032-0000-1000-8000-0026BB765291",t.OPEN=0,t.CLOSED=1,t}(n.Characteristic);t.TargetDoorState=ni,n.Characteristic.TargetDoorState=ni;var oi=function(e){function t(){var r=e.call(this,"Target Fan State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000BF-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetFanState=oi,n.Characteristic.TargetFanState=oi;var ai=function(e){function t(){var r=e.call(this,"Target Heater-Cooler State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B2-0000-1000-8000-0026BB765291",t.AUTO=0,t.HEAT=1,t.COOL=2,t}(n.Characteristic);t.TargetHeaterCoolerState=ai,n.Characteristic.TargetHeaterCoolerState=ai;var si=function(e){function t(){var r=e.call(this,"Target Heating Cooling State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000033-0000-1000-8000-0026BB765291",t.OFF=0,t.HEAT=1,t.COOL=2,t.AUTO=3,t}(n.Characteristic);t.TargetHeatingCoolingState=si,n.Characteristic.TargetHeatingCoolingState=si;var ci=function(e){function t(){var r=e.call(this,"Target Horizontal Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetHorizontalTiltAngle=ci,n.Characteristic.TargetHorizontalTiltAngle=ci;var ui=function(e){function t(){var r=e.call(this,"Target Humidifier-Dehumidifier State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B4-0000-1000-8000-0026BB765291",t.AUTO=0,t.HUMIDIFIER_OR_DEHUMIDIFIER=0,t.HUMIDIFIER=1,t.DEHUMIDIFIER=2,t}(n.Characteristic);t.TargetHumidifierDehumidifierState=ui,n.Characteristic.TargetHumidifierDehumidifierState=ui;var li=function(e){function t(){var r=e.call(this,"Target Media State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000137-0000-1000-8000-0026BB765291",t.PLAY=0,t.PAUSE=1,t.STOP=2,t}(n.Characteristic);t.TargetMediaState=li,n.Characteristic.TargetMediaState=li;var hi=function(e){function t(){var r=e.call(this,"Target Position",t.UUID,{format:"uint8",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetPosition=hi,n.Characteristic.TargetPosition=hi;var di=function(e){function t(){var r=e.call(this,"Target Relative Humidity",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000034-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetRelativeHumidity=di,n.Characteristic.TargetRelativeHumidity=di;var pi=function(e){function t(){var r=e.call(this,"Target Slat State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000BE-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetSlatState=pi,n.Characteristic.TargetSlatState=pi;var fi=function(e){function t(){var r=e.call(this,"Target Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:10,maxValue:38,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000035-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetTemperature=fi,n.Characteristic.TargetTemperature=fi;var mi=function(e){function t(){var r=e.call(this,"Target Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C2-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetTiltAngle=mi,n.Characteristic.TargetTiltAngle=mi;var gi=function(e){function t(){var r=e.call(this,"Target Vertical Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetVerticalTiltAngle=gi,n.Characteristic.TargetVerticalTiltAngle=gi;var vi=function(e){function t(){var r=e.call(this,"Target Visibility State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000134-0000-1000-8000-0026BB765291",t.SHOWN=0,t.HIDDEN=1,t}(n.Characteristic);t.TargetVisibilityState=vi,n.Characteristic.TargetVisibilityState=vi;var yi=function(e){function t(){var r=e.call(this,"Temperature Display Units",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000036-0000-1000-8000-0026BB765291",t.CELSIUS=0,t.FAHRENHEIT=1,t}(n.Characteristic);t.TemperatureDisplayUnits=yi,n.Characteristic.TemperatureDisplayUnits=yi;var Ci=function(e){function t(){var r=e.call(this,"Third Party Camera Active",t.UUID,{format:"uint8",perms:["ev","pr"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021C-0000-1000-8000-0026BB765291",t.OFF=0,t.ON=1,t}(n.Characteristic);t.ThirdPartyCameraActive=Ci,n.Characteristic.ThirdPartyCameraActive=Ci;var Si=function(e){function t(){var r=e.call(this,"Thread Control Point",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000704-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadControlPoint=Si,n.Characteristic.ThreadControlPoint=Si;var Ei=function(e){function t(){var r=e.call(this,"Thread Node Capabilities",t.UUID,{format:"uint16",perms:["pr"],minValue:0,maxValue:31,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000702-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadNodeCapabilities=Ei,n.Characteristic.ThreadNodeCapabilities=Ei;var _i=function(e){function t(){var r=e.call(this,"Thread OpenThread Version",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000706-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadOpenThreadVersion=_i,n.Characteristic.ThreadOpenThreadVersion=_i;var Ti=function(e){function t(){var r=e.call(this,"Thread Status",t.UUID,{format:"uint16",perms:["ev","pr"],minValue:0,maxValue:6,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000703-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadStatus=Ti,n.Characteristic.ThreadStatus=Ti;var Ai=function(e){function t(){var r=e.call(this,"Time Update",t.UUID,{format:"bool",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TimeUpdate=Ai,n.Characteristic.TimeUpdate=Ai;var Ii=function(e){function t(){var r=e.call(this,"Token",t.UUID,{format:"data",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000231-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Token=Ii,n.Characteristic.Token=Ii;var Di=function(e){function t(){var r=e.call(this,"Transmit Power",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000242-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TransmitPower=Di,n.Characteristic.TransmitPower=Di;var wi=function(e){function t(){var r=e.call(this,"Tunnel Connection Timeout",t.UUID,{format:"int",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000061-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunnelConnectionTimeout=wi,n.Characteristic.TunnelConnectionTimeout=wi;var bi=function(e){function t(){var r=e.call(this,"Tunneled Accessory Advertising",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000060-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryAdvertising=bi,n.Characteristic.TunneledAccessoryAdvertising=bi;var Ui=function(e){function t(){var r=e.call(this,"Tunneled Accessory Connected",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000059-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryConnected=Ui,n.Characteristic.TunneledAccessoryConnected=Ui;var Ri=function(e){function t(){var r=e.call(this,"Tunneled Accessory State Number",t.UUID,{format:"int",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000058-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryStateNumber=Ri,n.Characteristic.TunneledAccessoryStateNumber=Ri;var Oi=function(e){function t(){var r=e.call(this,"Valve Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D5-0000-1000-8000-0026BB765291",t.GENERIC_VALVE=0,t.IRRIGATION=1,t.SHOWER_HEAD=2,t.WATER_FAUCET=3,t}(n.Characteristic);t.ValveType=Oi,n.Characteristic.ValveType=Oi;var Ni=function(e){function t(){var r=e.call(this,"Version",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000037-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Version=Ni,n.Characteristic.Version=Ni;var Pi=function(e){function t(){var r=e.call(this,"Video Analysis Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000229-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.VideoAnalysisActive=Pi,n.Characteristic.VideoAnalysisActive=Pi;var Bi=function(e){function t(){var r=e.call(this,"VOC Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C8-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.VOCDensity=Bi,n.Characteristic.VOCDensity=Bi;var Li=function(e){function t(){var r=e.call(this,"Volume",t.UUID,{format:"uint8",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000119-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Volume=Li,n.Characteristic.Volume=Li;var xi=function(e){function t(){var r=e.call(this,"Volume Control Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E9-0000-1000-8000-0026BB765291",t.NONE=0,t.RELATIVE=1,t.RELATIVE_WITH_CURRENT=2,t.ABSOLUTE=3,t}(n.Characteristic);t.VolumeControlType=xi,n.Characteristic.VolumeControlType=xi;var Mi=function(e){function t(){var r=e.call(this,"Volume Selector",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000EA-0000-1000-8000-0026BB765291",t.INCREMENT=0,t.DECREMENT=1,t}(n.Characteristic);t.VolumeSelector=Mi,n.Characteristic.VolumeSelector=Mi;var Fi=function(e){function t(){var r=e.call(this,"Wake Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000222-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WakeConfiguration=Fi,n.Characteristic.WakeConfiguration=Fi;var ki=function(e){function t(){var r=e.call(this,"WAN Configuration List",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000211-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WANConfigurationList=ki,n.Characteristic.WANConfigurationList=ki;var Vi=function(e){function t(){var r=e.call(this,"WAN Status List",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000212-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WANStatusList=Vi,n.Characteristic.WANStatusList=Vi;var Hi=function(e){function t(){var r=e.call(this,"Water Level",t.UUID,{format:"float",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WaterLevel=Hi,n.Characteristic.WaterLevel=Hi;var ji=function(e){function t(){var r=e.call(this,"Wi-Fi Capabilities",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WiFiCapabilities=ji,n.Characteristic.WiFiCapabilities=ji;var Gi=function(e){function t(){var r=e.call(this,"Wi-Fi Configuration Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WiFiConfigurationControl=Gi,n.Characteristic.WiFiConfigurationControl=Gi;var Wi=function(e){function t(){var r=e.call(this,"Wi-Fi Satellite Status",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021E-0000-1000-8000-0026BB765291",t.UNKNOWN=0,t.CONNECTED=1,t.NOT_CONNECTED=2,t}(n.Characteristic);t.WiFiSatelliteStatus=Wi,n.Characteristic.WiFiSatelliteStatus=Wi},1647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecuritySystem=t.ProtocolInformation=t.PowerManagement=t.Pairing=t.Outlet=t.OccupancySensor=t.NFCAccess=t.MotionSensor=t.Microphone=t.LockMechanism=t.LockManagement=t.LightSensor=t.Lightbulb=t.LeakSensor=t.IrrigationSystem=t.InputSource=t.HumiditySensor=t.HumidifierDehumidifier=t.HeaterCooler=t.GarageDoorOpener=t.FirmwareUpdate=t.FilterMaintenance=t.Faucet=t.Fanv2=t.Fan=t.Doorbell=t.Door=t.Diagnostics=t.DataStreamTransportManagement=t.ContactSensor=t.CloudRelay=t.CarbonMonoxideSensor=t.CarbonDioxideSensor=t.CameraRTPStreamManagement=t.CameraRecordingManagement=t.CameraOperatingMode=t.CameraControl=t.BridgingState=t.BridgeConfiguration=t.Battery=t.AudioStreamManagement=t.Assistant=t.AssetUpdate=t.AirQualitySensor=t.AirPurifier=t.AccessoryRuntimeInformation=t.AccessoryMetrics=t.AccessoryInformation=t.AccessControl=t.AccessCode=void 0,t.WindowCovering=t.Window=t.WiFiTransport=t.WiFiSatellite=t.WiFiRouter=t.Valve=t.Tunnel=t.TransferTransportManagement=t.TimeInformation=t.ThreadTransport=t.Thermostat=t.TemperatureSensor=t.TelevisionSpeaker=t.Television=t.TargetControlManagement=t.TargetControl=t.TapManagement=t.Switch=t.StatelessProgrammableSwitch=t.StatefulProgrammableSwitch=t.Speaker=t.SmokeSensor=t.SmartSpeaker=t.Slats=t.SiriEndpoint=t.Siri=t.ServiceLabel=void 0;var i=r(1635),n=r(9826),o=r(5876),a=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessCodeControlPoint),o.addCharacteristic(n.Characteristic.AccessCodeSupportedConfiguration),o.addCharacteristic(n.Characteristic.ConfigurationState),o}return i.__extends(t,e),t.UUID="00000260-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessCode=a,o.Service.AccessCode=a;var s=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessControlLevel),o.addOptionalCharacteristic(n.Characteristic.PasswordSetting),o}return i.__extends(t,e),t.UUID="000000DA-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessControl=s,o.Service.AccessControl=s;var c=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Identify),o.addCharacteristic(n.Characteristic.Manufacturer),o.addCharacteristic(n.Characteristic.Model),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o.addCharacteristic(n.Characteristic.SerialNumber),o.addCharacteristic(n.Characteristic.FirmwareRevision),o.addOptionalCharacteristic(n.Characteristic.AccessoryFlags),o.addOptionalCharacteristic(n.Characteristic.AppMatchingIdentifier),o.addOptionalCharacteristic(n.Characteristic.ConfiguredName),o.addOptionalCharacteristic(n.Characteristic.HardwareFinish),o.addOptionalCharacteristic(n.Characteristic.HardwareRevision),o.addOptionalCharacteristic(n.Characteristic.ProductData),o.addOptionalCharacteristic(n.Characteristic.SoftwareRevision),o}return i.__extends(t,e),t.UUID="0000003E-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryInformation=c,o.Service.AccessoryInformation=c;var u=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.MetricsBufferFullState),o.addCharacteristic(n.Characteristic.SupportedMetrics),o}return i.__extends(t,e),t.UUID="00000270-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryMetrics=u,o.Service.AccessoryMetrics=u;var l=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Ping),o.addOptionalCharacteristic(n.Characteristic.ActivityInterval),o.addOptionalCharacteristic(n.Characteristic.HeartBeat),o.addOptionalCharacteristic(n.Characteristic.SleepInterval),o}return i.__extends(t,e),t.UUID="00000239-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryRuntimeInformation=l,o.Service.AccessoryRuntimeInformation=l;var h=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentAirPurifierState),o.addCharacteristic(n.Characteristic.TargetAirPurifierState),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o}return i.__extends(t,e),t.UUID="000000BB-0000-1000-8000-0026BB765291",t}(o.Service);t.AirPurifier=h,o.Service.AirPurifier=h;var d=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AirQuality),o.addOptionalCharacteristic(n.Characteristic.NitrogenDioxideDensity),o.addOptionalCharacteristic(n.Characteristic.OzoneDensity),o.addOptionalCharacteristic(n.Characteristic.PM10Density),o.addOptionalCharacteristic(n.Characteristic.PM2_5Density),o.addOptionalCharacteristic(n.Characteristic.SulphurDioxideDensity),o.addOptionalCharacteristic(n.Characteristic.VOCDensity),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000008D-0000-1000-8000-0026BB765291",t}(o.Service);t.AirQualitySensor=d,o.Service.AirQualitySensor=d;var p=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AssetUpdateReadiness),o.addCharacteristic(n.Characteristic.SupportedAssetTypes),o}return i.__extends(t,e),t.UUID="00000267-0000-1000-8000-0026BB765291",t}(o.Service);t.AssetUpdate=p,o.Service.AssetUpdate=p;var f=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.Identifier),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o}return i.__extends(t,e),t.UUID="0000026A-0000-1000-8000-0026BB765291",t}(o.Service);t.Assistant=f,o.Service.Assistant=f;var m=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedAudioStreamConfiguration),o.addCharacteristic(n.Characteristic.SelectedAudioStreamConfiguration),o}return i.__extends(t,e),t.UUID="00000127-0000-1000-8000-0026BB765291",t}(o.Service);t.AudioStreamManagement=m,o.Service.AudioStreamManagement=m;var g=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.BatteryLevel),o.addOptionalCharacteristic(n.Characteristic.ChargingState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000096-0000-1000-8000-0026BB765291",t}(o.Service);t.Battery=g,o.Service.BatteryService=g,o.Service.Battery=g;var v=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfigureBridgedAccessoryStatus),o.addCharacteristic(n.Characteristic.DiscoverBridgedAccessories),o.addCharacteristic(n.Characteristic.DiscoveredBridgedAccessories),o.addCharacteristic(n.Characteristic.ConfigureBridgedAccessory),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="000000A1-0000-1000-8000-0026BB765291",t}(o.Service);t.BridgeConfiguration=v,o.Service.BridgeConfiguration=v;var y=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Reachable),o.addCharacteristic(n.Characteristic.LinkQuality),o.addCharacteristic(n.Characteristic.AccessoryIdentifier),o.addCharacteristic(n.Characteristic.Category),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000062-0000-1000-8000-0026BB765291",t}(o.Service);t.BridgingState=y,o.Service.BridgingState=y;var C=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.CurrentHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.CurrentVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.NightVision),o.addOptionalCharacteristic(n.Characteristic.OpticalZoom),o.addOptionalCharacteristic(n.Characteristic.DigitalZoom),o.addOptionalCharacteristic(n.Characteristic.ImageRotation),o.addOptionalCharacteristic(n.Characteristic.ImageMirroring),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000111-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraControl=C,o.Service.CameraControl=C;var S=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.EventSnapshotsActive),o.addCharacteristic(n.Characteristic.HomeKitCameraActive),o.addOptionalCharacteristic(n.Characteristic.CameraOperatingModeIndicator),o.addOptionalCharacteristic(n.Characteristic.ManuallyDisabled),o.addOptionalCharacteristic(n.Characteristic.NightVision),o.addOptionalCharacteristic(n.Characteristic.PeriodicSnapshotsActive),o.addOptionalCharacteristic(n.Characteristic.ThirdPartyCameraActive),o.addOptionalCharacteristic(n.Characteristic.DiagonalFieldOfView),o}return i.__extends(t,e),t.UUID="0000021A-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraOperatingMode=S,o.Service.CameraOperatingMode=S;var E=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.SelectedCameraRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedAudioRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedCameraRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedVideoRecordingConfiguration),o.addOptionalCharacteristic(n.Characteristic.RecordingAudioActive),o}return i.__extends(t,e),t.UUID="00000204-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraRecordingManagement=E,o.Service.CameraEventRecordingManagement=E,o.Service.CameraRecordingManagement=E;var _=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SelectedRTPStreamConfiguration),o.addCharacteristic(n.Characteristic.SetupEndpoints),o.addCharacteristic(n.Characteristic.StreamingStatus),o.addCharacteristic(n.Characteristic.SupportedAudioStreamConfiguration),o.addCharacteristic(n.Characteristic.SupportedRTPConfiguration),o.addCharacteristic(n.Characteristic.SupportedVideoStreamConfiguration),o.addOptionalCharacteristic(n.Characteristic.Active),o}return i.__extends(t,e),t.UUID="00000110-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraRTPStreamManagement=_,o.Service.CameraRTPStreamManagement=_;var T=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CarbonDioxideDetected),o.addOptionalCharacteristic(n.Characteristic.CarbonDioxideLevel),o.addOptionalCharacteristic(n.Characteristic.CarbonDioxidePeakLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000097-0000-1000-8000-0026BB765291",t}(o.Service);t.CarbonDioxideSensor=T,o.Service.CarbonDioxideSensor=T;var A=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CarbonMonoxideDetected),o.addOptionalCharacteristic(n.Characteristic.CarbonMonoxideLevel),o.addOptionalCharacteristic(n.Characteristic.CarbonMonoxidePeakLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000007F-0000-1000-8000-0026BB765291",t}(o.Service);t.CarbonMonoxideSensor=A,o.Service.CarbonMonoxideSensor=A;var I=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.RelayControlPoint),o.addCharacteristic(n.Characteristic.RelayState),o.addCharacteristic(n.Characteristic.RelayEnabled),o}return i.__extends(t,e),t.UUID="0000005A-0000-1000-8000-0026BB765291",t}(o.Service);t.CloudRelay=I,o.Service.Relay=I,o.Service.CloudRelay=I;var D=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ContactSensorState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000080-0000-1000-8000-0026BB765291",t}(o.Service);t.ContactSensor=D,o.Service.ContactSensor=D;var w=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SetupDataStreamTransport),o.addCharacteristic(n.Characteristic.SupportedDataStreamTransportConfiguration),o.addCharacteristic(n.Characteristic.Version),o}return i.__extends(t,e),t.UUID="00000129-0000-1000-8000-0026BB765291",t}(o.Service);t.DataStreamTransportManagement=w,o.Service.DataStreamTransportManagement=w;var b=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedDiagnosticsSnapshot),o.addOptionalCharacteristic(n.Characteristic.SelectedDiagnosticsModes),o.addOptionalCharacteristic(n.Characteristic.SupportedDiagnosticsModes),o}return i.__extends(t,e),t.UUID="00000237-0000-1000-8000-0026BB765291",t}(o.Service);t.Diagnostics=b,o.Service.Diagnostics=b;var U=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o}return i.__extends(t,e),t.UUID="00000081-0000-1000-8000-0026BB765291",t}(o.Service);t.Door=U,o.Service.Door=U;var R=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.OperatingStateResponse),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000121-0000-1000-8000-0026BB765291",t}(o.Service);t.Doorbell=R,o.Service.Doorbell=R;var O=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationDirection),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o}return i.__extends(t,e),t.UUID="00000040-0000-1000-8000-0026BB765291",t}(o.Service);t.Fan=O,o.Service.Fan=O;var N=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.CurrentFanState),o.addOptionalCharacteristic(n.Characteristic.TargetFanState),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationDirection),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o}return i.__extends(t,e),t.UUID="000000B7-0000-1000-8000-0026BB765291",t}(o.Service);t.Fanv2=N,o.Service.Fanv2=N;var P=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000D7-0000-1000-8000-0026BB765291",t}(o.Service);t.Faucet=P,o.Service.Faucet=P;var B=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.FilterChangeIndication),o.addOptionalCharacteristic(n.Characteristic.FilterLifeLevel),o.addOptionalCharacteristic(n.Characteristic.ResetFilterIndication),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="000000BA-0000-1000-8000-0026BB765291",t}(o.Service);t.FilterMaintenance=B,o.Service.FilterMaintenance=B;var L=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.FirmwareUpdateReadiness),o.addCharacteristic(n.Characteristic.FirmwareUpdateStatus),o.addOptionalCharacteristic(n.Characteristic.StagedFirmwareVersion),o.addOptionalCharacteristic(n.Characteristic.SupportedFirmwareUpdateConfiguration),o}return i.__extends(t,e),t.UUID="00000236-0000-1000-8000-0026BB765291",t}(o.Service);t.FirmwareUpdate=L,o.Service.FirmwareUpdate=L;var x=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentDoorState),o.addCharacteristic(n.Characteristic.TargetDoorState),o.addCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.LockCurrentState),o.addOptionalCharacteristic(n.Characteristic.LockTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000041-0000-1000-8000-0026BB765291",t}(o.Service);t.GarageDoorOpener=x,o.Service.GarageDoorOpener=x;var M=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentHeaterCoolerState),o.addCharacteristic(n.Characteristic.TargetHeaterCoolerState),o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.CoolingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.HeatingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.TemperatureDisplayUnits),o}return i.__extends(t,e),t.UUID="000000BC-0000-1000-8000-0026BB765291",t}(o.Service);t.HeaterCooler=M,o.Service.HeaterCooler=M;var F=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentHumidifierDehumidifierState),o.addCharacteristic(n.Characteristic.TargetHumidifierDehumidifierState),o.addCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RelativeHumidityDehumidifierThreshold),o.addOptionalCharacteristic(n.Characteristic.RelativeHumidityHumidifierThreshold),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.WaterLevel),o}return i.__extends(t,e),t.UUID="000000BD-0000-1000-8000-0026BB765291",t}(o.Service);t.HumidifierDehumidifier=F,o.Service.HumidifierDehumidifier=F;var k=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000082-0000-1000-8000-0026BB765291",t}(o.Service);t.HumiditySensor=k,o.Service.HumiditySensor=k;var V=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.InputSourceType),o.addCharacteristic(n.Characteristic.IsConfigured),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o.addCharacteristic(n.Characteristic.CurrentVisibilityState),o.addOptionalCharacteristic(n.Characteristic.Identifier),o.addOptionalCharacteristic(n.Characteristic.InputDeviceType),o.addOptionalCharacteristic(n.Characteristic.TargetVisibilityState),o}return i.__extends(t,e),t.UUID="000000D9-0000-1000-8000-0026BB765291",t}(o.Service);t.InputSource=V,o.Service.InputSource=V;var H=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ProgramMode),o.addCharacteristic(n.Characteristic.InUse),o.addOptionalCharacteristic(n.Characteristic.RemainingDuration),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000CF-0000-1000-8000-0026BB765291",t}(o.Service);t.IrrigationSystem=H,o.Service.IrrigationSystem=H;var j=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LeakDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000083-0000-1000-8000-0026BB765291",t}(o.Service);t.LeakSensor=j,o.Service.LeakSensor=j;var G=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.CharacteristicValueActiveTransitionCount),o.addOptionalCharacteristic(n.Characteristic.CharacteristicValueTransitionControl),o.addOptionalCharacteristic(n.Characteristic.ColorTemperature),o.addOptionalCharacteristic(n.Characteristic.Hue),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.Saturation),o.addOptionalCharacteristic(n.Characteristic.SupportedCharacteristicValueTransitionConfiguration),o}return i.__extends(t,e),t.UUID="00000043-0000-1000-8000-0026BB765291",t}(o.Service);t.Lightbulb=G,o.Service.Lightbulb=G;var W=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentAmbientLightLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000084-0000-1000-8000-0026BB765291",t}(o.Service);t.LightSensor=W,o.Service.LightSensor=W;var Y=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LockControlPoint),o.addCharacteristic(n.Characteristic.Version),o.addOptionalCharacteristic(n.Characteristic.AdministratorOnlyAccess),o.addOptionalCharacteristic(n.Characteristic.AudioFeedback),o.addOptionalCharacteristic(n.Characteristic.CurrentDoorState),o.addOptionalCharacteristic(n.Characteristic.LockManagementAutoSecurityTimeout),o.addOptionalCharacteristic(n.Characteristic.LockLastKnownAction),o.addOptionalCharacteristic(n.Characteristic.Logs),o.addOptionalCharacteristic(n.Characteristic.MotionDetected),o}return i.__extends(t,e),t.UUID="00000044-0000-1000-8000-0026BB765291",t}(o.Service);t.LockManagement=Y,o.Service.LockManagement=Y;var q=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LockCurrentState),o.addCharacteristic(n.Characteristic.LockTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000045-0000-1000-8000-0026BB765291",t}(o.Service);t.LockMechanism=q,o.Service.LockMechanism=q;var K=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000112-0000-1000-8000-0026BB765291",t}(o.Service);t.Microphone=K,o.Service.Microphone=K;var $=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.MotionDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000085-0000-1000-8000-0026BB765291",t}(o.Service);t.MotionSensor=$,o.Service.MotionSensor=$;var z=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfigurationState),o.addCharacteristic(n.Characteristic.NFCAccessControlPoint),o.addCharacteristic(n.Characteristic.NFCAccessSupportedConfiguration),o}return i.__extends(t,e),t.UUID="00000266-0000-1000-8000-0026BB765291",t}(o.Service);t.NFCAccess=z,o.Service.NFCAccess=z;var Q=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.OccupancyDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000086-0000-1000-8000-0026BB765291",t}(o.Service);t.OccupancySensor=Q,o.Service.OccupancySensor=Q;var X=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.OutletInUse),o}return i.__extends(t,e),t.UUID="00000047-0000-1000-8000-0026BB765291",t}(o.Service);t.Outlet=X,o.Service.Outlet=X;var J=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ListPairings),o.addCharacteristic(n.Characteristic.PairSetup),o.addCharacteristic(n.Characteristic.PairVerify),o.addCharacteristic(n.Characteristic.PairingFeatures),o}return i.__extends(t,e),t.UUID="00000055-0000-1000-8000-0026BB765291",t}(o.Service);t.Pairing=J,o.Service.Pairing=J;var Z=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.WakeConfiguration),o.addOptionalCharacteristic(n.Characteristic.SelectedSleepConfiguration),o.addOptionalCharacteristic(n.Characteristic.SupportedSleepConfiguration),o}return i.__extends(t,e),t.UUID="00000221-0000-1000-8000-0026BB765291",t}(o.Service);t.PowerManagement=Z,o.Service.PowerManagement=Z;var ee=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Version),o}return i.__extends(t,e),t.UUID="000000A2-0000-1000-8000-0026BB765291",t}(o.Service);t.ProtocolInformation=ee,o.Service.ProtocolInformation=ee;var te=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SecuritySystemCurrentState),o.addCharacteristic(n.Characteristic.SecuritySystemTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.SecuritySystemAlarmType),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000007E-0000-1000-8000-0026BB765291",t}(o.Service);t.SecuritySystem=te,o.Service.SecuritySystem=te;var re=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ServiceLabelNamespace),o}return i.__extends(t,e),t.UUID="000000CC-0000-1000-8000-0026BB765291",t}(o.Service);t.ServiceLabel=re,o.Service.ServiceLabel=re;var ie=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SiriInputType),o.addOptionalCharacteristic(n.Characteristic.MultifunctionButton),o.addOptionalCharacteristic(n.Characteristic.SiriEnable),o.addOptionalCharacteristic(n.Characteristic.SiriEngineVersion),o.addOptionalCharacteristic(n.Characteristic.SiriLightOnUse),o.addOptionalCharacteristic(n.Characteristic.SiriListening),o.addOptionalCharacteristic(n.Characteristic.SiriTouchToUse),o}return i.__extends(t,e),t.UUID="00000133-0000-1000-8000-0026BB765291",t}(o.Service);t.Siri=ie,o.Service.Siri=ie;var ne=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SiriEndpointSessionStatus),o.addCharacteristic(n.Characteristic.Version),o.addOptionalCharacteristic(n.Characteristic.ActiveIdentifier),o.addOptionalCharacteristic(n.Characteristic.ManuallyDisabled),o}return i.__extends(t,e),t.UUID="00000253-0000-1000-8000-0026BB765291",t}(o.Service);t.SiriEndpoint=ne,o.Service.SiriEndpoint=ne;var oe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentSlatState),o.addCharacteristic(n.Characteristic.SlatType),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.CurrentTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetTiltAngle),o}return i.__extends(t,e),t.UUID="000000B9-0000-1000-8000-0026BB765291",t}(o.Service);t.Slats=oe,o.Service.Slat=oe,o.Service.Slats=oe;var ae=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentMediaState),o.addCharacteristic(n.Characteristic.TargetMediaState),o.addOptionalCharacteristic(n.Characteristic.AirPlayEnable),o.addOptionalCharacteristic(n.Characteristic.ConfiguredName),o.addOptionalCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000228-0000-1000-8000-0026BB765291",t}(o.Service);t.SmartSpeaker=ae,o.Service.SmartSpeaker=ae;var se=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SmokeDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000087-0000-1000-8000-0026BB765291",t}(o.Service);t.SmokeSensor=se,o.Service.SmokeSensor=se;var ce=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000113-0000-1000-8000-0026BB765291",t}(o.Service);t.Speaker=ce,o.Service.Speaker=ce;var ue=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addCharacteristic(n.Characteristic.ProgrammableSwitchOutputState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000088-0000-1000-8000-0026BB765291",t}(o.Service);t.StatefulProgrammableSwitch=ue,o.Service.StatefulProgrammableSwitch=ue;var le=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ServiceLabelIndex),o}return i.__extends(t,e),t.UUID="00000089-0000-1000-8000-0026BB765291",t}(o.Service);t.StatelessProgrammableSwitch=le,o.Service.StatelessProgrammableSwitch=le;var he=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000049-0000-1000-8000-0026BB765291",t}(o.Service);t.Switch=he,o.Service.Switch=he;var de=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CryptoHash),o.addCharacteristic(n.Characteristic.TapType),o.addCharacteristic(n.Characteristic.Token),o}return i.__extends(t,e),t.UUID="0000022E-0000-1000-8000-0026BB765291",t}(o.Service);t.TapManagement=de,o.Service.TapManagement=de;var pe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ActiveIdentifier),o.addCharacteristic(n.Characteristic.ButtonEvent),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000125-0000-1000-8000-0026BB765291",t}(o.Service);t.TargetControl=pe,o.Service.TargetControl=pe;var fe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.TargetControlSupportedConfiguration),o.addCharacteristic(n.Characteristic.TargetControlList),o}return i.__extends(t,e),t.UUID="00000122-0000-1000-8000-0026BB765291",t}(o.Service);t.TargetControlManagement=fe,o.Service.TargetControlManagement=fe;var me=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ActiveIdentifier),o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.RemoteKey),o.addCharacteristic(n.Characteristic.SleepDiscoveryMode),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.ClosedCaptions),o.addOptionalCharacteristic(n.Characteristic.DisplayOrder),o.addOptionalCharacteristic(n.Characteristic.CurrentMediaState),o.addOptionalCharacteristic(n.Characteristic.TargetMediaState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.PictureMode),o.addOptionalCharacteristic(n.Characteristic.PowerModeSelection),o}return i.__extends(t,e),t.UUID="000000D8-0000-1000-8000-0026BB765291",t}(o.Service);t.Television=me,o.Service.Television=me;var ge=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Volume),o.addOptionalCharacteristic(n.Characteristic.VolumeControlType),o.addOptionalCharacteristic(n.Characteristic.VolumeSelector),o}return i.__extends(t,e),t.UUID="00000113-0000-1000-8000-0026BB765291",t}(o.Service);t.TelevisionSpeaker=ge,o.Service.TelevisionSpeaker=ge;var ve=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000008A-0000-1000-8000-0026BB765291",t}(o.Service);t.TemperatureSensor=ve,o.Service.TemperatureSensor=ve;var ye=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentHeatingCoolingState),o.addCharacteristic(n.Characteristic.TargetHeatingCoolingState),o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addCharacteristic(n.Characteristic.TargetTemperature),o.addCharacteristic(n.Characteristic.TemperatureDisplayUnits),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.TargetRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.CoolingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.HeatingThresholdTemperature),o}return i.__extends(t,e),t.UUID="0000004A-0000-1000-8000-0026BB765291",t}(o.Service);t.Thermostat=ye,o.Service.Thermostat=ye;var Ce=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTransport),o.addCharacteristic(n.Characteristic.ThreadControlPoint),o.addCharacteristic(n.Characteristic.ThreadNodeCapabilities),o.addCharacteristic(n.Characteristic.ThreadStatus),o.addOptionalCharacteristic(n.Characteristic.CCAEnergyDetectThreshold),o.addOptionalCharacteristic(n.Characteristic.CCASignalDetectThreshold),o.addOptionalCharacteristic(n.Characteristic.EventRetransmissionMaximum),o.addOptionalCharacteristic(n.Characteristic.EventTransmissionCounters),o.addOptionalCharacteristic(n.Characteristic.MACRetransmissionMaximum),o.addOptionalCharacteristic(n.Characteristic.MACTransmissionCounters),o.addOptionalCharacteristic(n.Characteristic.ReceiverSensitivity),o.addOptionalCharacteristic(n.Characteristic.ReceivedSignalStrengthIndication),o.addOptionalCharacteristic(n.Characteristic.SignalToNoiseRatio),o.addOptionalCharacteristic(n.Characteristic.ThreadOpenThreadVersion),o.addOptionalCharacteristic(n.Characteristic.TransmitPower),o.addOptionalCharacteristic(n.Characteristic.MaximumTransmitPower),o}return i.__extends(t,e),t.UUID="00000701-0000-1000-8000-0026BB765291",t}(o.Service);t.ThreadTransport=Ce,o.Service.ThreadTransport=Ce;var Se=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTime),o.addCharacteristic(n.Characteristic.DayoftheWeek),o.addCharacteristic(n.Characteristic.TimeUpdate),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000099-0000-1000-8000-0026BB765291",t}(o.Service);t.TimeInformation=Se,o.Service.TimeInformation=Se;var Ee=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedTransferTransportConfiguration),o.addCharacteristic(n.Characteristic.SetupTransferTransport),o}return i.__extends(t,e),t.UUID="00000203-0000-1000-8000-0026BB765291",t}(o.Service);t.TransferTransportManagement=Ee,o.Service.TransferTransportManagement=Ee;var _e=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessoryIdentifier),o.addCharacteristic(n.Characteristic.TunnelConnectionTimeout),o.addCharacteristic(n.Characteristic.TunneledAccessoryAdvertising),o.addCharacteristic(n.Characteristic.TunneledAccessoryConnected),o.addCharacteristic(n.Characteristic.TunneledAccessoryStateNumber),o}return i.__extends(t,e),t.UUID="00000056-0000-1000-8000-0026BB765291",t}(o.Service);t.Tunnel=_e,o.Service.TunneledBTLEAccessoryService=_e,o.Service.Tunnel=_e;var Te=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.InUse),o.addCharacteristic(n.Characteristic.ValveType),o.addOptionalCharacteristic(n.Characteristic.IsConfigured),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RemainingDuration),o.addOptionalCharacteristic(n.Characteristic.ServiceLabelIndex),o.addOptionalCharacteristic(n.Characteristic.SetDuration),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000D0-0000-1000-8000-0026BB765291",t}(o.Service);t.Valve=Te,o.Service.Valve=Te;var Ae=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.ManagedNetworkEnable),o.addCharacteristic(n.Characteristic.NetworkAccessViolationControl),o.addCharacteristic(n.Characteristic.NetworkClientProfileControl),o.addCharacteristic(n.Characteristic.NetworkClientStatusControl),o.addCharacteristic(n.Characteristic.RouterStatus),o.addCharacteristic(n.Characteristic.SupportedRouterConfiguration),o.addCharacteristic(n.Characteristic.WANConfigurationList),o.addCharacteristic(n.Characteristic.WANStatusList),o}return i.__extends(t,e),t.UUID="0000020A-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiRouter=Ae,o.Service.WiFiRouter=Ae;var Ie=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.WiFiSatelliteStatus),o}return i.__extends(t,e),t.UUID="0000020F-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiSatellite=Ie,o.Service.WiFiSatellite=Ie;var De=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTransport),o.addCharacteristic(n.Characteristic.WiFiCapabilities),o.addOptionalCharacteristic(n.Characteristic.WiFiConfigurationControl),o}return i.__extends(t,e),t.UUID="0000022A-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiTransport=De,o.Service.WiFiTransport=De;var we=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o}return i.__extends(t,e),t.UUID="0000008B-0000-1000-8000-0026BB765291",t}(o.Service);t.Window=we,o.Service.Window=we;var be=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.CurrentHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o.addOptionalCharacteristic(n.Characteristic.CurrentVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetVerticalTiltAngle),o}return i.__extends(t,e),t.UUID="0000008C-0000-1000-8000-0026BB765291",t}(o.Service);t.WindowCovering=be,o.Service.WindowCovering=be},8086:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(651),t),i.__exportStar(r(1647),t)},5579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessoryInfo=t.PermissionTypes=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(6982)),a=i.__importDefault(r(8947)),s=i.__importDefault(r(9023)),c=r(9593),u=r(4299);function l(){return r(8389).version}!function(e){e[e.USER=0]="USER",e[e.ADMIN=1]="ADMIN"}(t.PermissionTypes||(t.PermissionTypes={}));var h=function(){function e(e){var t=this;this.configVersion=1,this.lastFirmwareVersion="",this.paired=function(){return Object.keys(t.pairedClients).length>0},this.username=e,this.displayName="",this.model="",this.category=1,this.pincode="",this.signSk=Buffer.alloc(0),this.signPk=Buffer.alloc(0),this.pairedClients={},this.pairedAdminClients=0,this.configHash="",this.setupID=""}return e.prototype.addPairedClient=function(e,t,r){this.pairedClients[e]={username:e,publicKey:t,permission:r},1===r&&this.pairedAdminClients++},e.prototype.updatePermission=function(e,t){var r=this.pairedClients[e];if(r){var i=r.permission;r.permission=t,1===i&&1!==t?this.pairedAdminClients--:1!==i&&1===t&&this.pairedAdminClients++}},e.prototype.listPairings=function(){var e,t,r=[];try{for(var n=i.__values(Object.values(this.pairedClients)),o=n.next();!o.done;o=n.next()){var a=o.value;r.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.removePairedClient=function(e,t){var r,n;if(this._removePairedClient0(e,t),0===this.pairedAdminClients)try{for(var o=i.__values(Object.keys(this.pairedClients)),a=o.next();!a.done;a=o.next()){var s=a.value;this._removePairedClient0(e,s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype._removePairedClient0=function(e,t){this.pairedClients[t]&&1===this.pairedClients[t].permission&&this.pairedAdminClients--,delete this.pairedClients[t],c.EventedHTTPServer.destroyExistingConnectionsAfterUnpair(e,t)},e.prototype.isPaired=function(e){return!!this.pairedClients[e]},e.prototype.hasAdminPermissions=function(e){if(!e)return!1;var t=this.pairedClients[e];return!!t&&1===t.permission},e.prototype.getClientPublicKey=function(e){var t=this.pairedClients[e];return t?t.publicKey:void 0},e.prototype.checkForCurrentConfigurationNumberIncrement=function(e,t){var r=o.default.createHash("sha1");r.update(JSON.stringify(e));var i=r.digest("hex"),n=!1;if(i!==this.configHash&&(this.configVersion++,this.configHash=i,this.ensureConfigVersionBounds(),n=!0),t){var a=l();this.lastFirmwareVersion!==a&&(this.lastFirmwareVersion=a,n=!0)}return n&&this.save(),n},e.prototype.getConfigVersion=function(){return this.configVersion},e.prototype.ensureConfigVersionBounds=function(){this.configVersion=this.configVersion%65536,0===this.configVersion&&(this.configVersion=1)},e.prototype.save=function(){var t,r,n={displayName:this.displayName,category:this.category,pincode:this.pincode,signSk:this.signSk.toString("hex"),signPk:this.signPk.toString("hex"),pairedClients:{},pairedClientsPermission:{},configVersion:this.configVersion,configHash:this.configHash,setupID:this.setupID,lastFirmwareVersion:this.lastFirmwareVersion};try{for(var o=i.__values(Object.entries(this.pairedClients)),a=o.next();!a.done;a=o.next()){var s=i.__read(a.value,2),c=s[0],l=s[1];n.pairedClients[c]=l.publicKey.toString("hex"),n.pairedClientsPermission[c]=l.permission}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var h=e.persistKey(this.username);u.HAPStorage.storage().setItemSync(h,n)},e.persistKey=function(e){return s.default.format("AccessoryInfo.%s.json",e.replace(/:/g,"").toUpperCase())},e.create=function(t){e.assertValidUsername(t);var r=new e(t);r.lastFirmwareVersion=l();var i=a.default.sign.keyPair();return r.signSk=Buffer.from(i.secretKey),r.signPk=Buffer.from(i.publicKey),r},e.load=function(t){var r,n;e.assertValidUsername(t);var o=e.persistKey(t),a=u.HAPStorage.storage().getItem(o);if(a){var s=new e(t);s.displayName=a.displayName||"",s.category=a.category||"",s.pincode=a.pincode||"",s.signSk=Buffer.from(a.signSk||"","hex"),s.signPk=Buffer.from(a.signPk||"","hex"),s.pairedClients={};try{for(var c=i.__values(Object.keys(a.pairedClients||{})),h=c.next();!h.done;h=c.next()){var d=h.value,p=a.pairedClients[d],f=a.pairedClientsPermission?a.pairedClientsPermission[d]:void 0;void 0===f&&(f=1),s.pairedClients[d]={username:d,publicKey:Buffer.from(p,"hex"),permission:f},1===f&&s.pairedAdminClients++}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return s.configVersion=a.configVersion||1,s.configHash=a.configHash||"",s.setupID=a.setupID||"",s.lastFirmwareVersion=a.lastFirmwareVersion||l(),s.ensureConfigVersionBounds(),s}return null},e.remove=function(t){var r=e.persistKey(t);u.HAPStorage.storage().removeItemSync(r)},e.assertValidUsername=function(t){n.default.ok(e.deviceIdPattern.test(t),"The supplied username ("+t+") is not valid (expected a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string). Note that, if you had this accessory already paired with the invalid username, you will need to repair the accessory and reconfigure your services in the Home app. Using an invalid username will lead to unexpected behaviour.")},e.deviceIdPattern=/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,e}();t.AccessoryInfo=h},292:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ControllerStorage=void 0;var i=r(1635),n=i.__importDefault(r(9023)),o=i.__importDefault(r(5753)),a=r(4299),s=(0,o.default)("HAP-NodeJS:ControllerStorage"),c=function(){function e(e){this.initialized=!1,this.fileCreated=!1,this.purgeUnidentifiedAccessoryData=!0,this.trackedControllers=[],this.controllerData={},this.accessoryUUID=e.UUID}return e.prototype.enqueueSaveRequest=function(e){var t,r=this;if(void 0===e&&(e=0),this.parent)this.parent.enqueueSaveRequest(e);else{var i=Date.now()+e;if(this.queuedSaveTimeout){if(i<=(null!==(t=this.queuedSaveTime)&&void 0!==t?t:0))return;clearTimeout(this.queuedSaveTimeout)}this.queuedSaveTimeout=setTimeout((function(){r.queuedSaveTimeout=r.queuedSaveTime=void 0,r.save()}),e).unref(),this.queuedSaveTime=Date.now()+e}},e.prototype.linkAccessory=function(e){this.linkedAccessories||(this.linkedAccessories=[]);var t=e.controllerStorage;this.linkedAccessories.push(t),t.parent=this;var r=this.restoredAccessories&&this.restoredAccessories[e.UUID];this.initialized&&t.init(r)},e.prototype.trackController=function(e){e.setupStateChangeDelegate(this.handleStateChange.bind(this,e)),this.initialized?this.restoreController(e):this.trackedControllers.push(e)},e.prototype.untrackController=function(e){var t=this.trackedControllers.indexOf(e);-1!==t&&this.trackedControllers.splice(t,1),e.setupStateChangeDelegate(void 0),this.purgeControllerData(e)},e.prototype.purgeControllerData=function(e){delete this.controllerData[e.controllerId()],this.initialized&&this.enqueueSaveRequest(100)},e.prototype.handleStateChange=function(e){var t=e.controllerId(),r=e.serialize();if(r){var i=this.controllerData[t];i?i.data=r:this.controllerData[t]={data:r}}else delete this.controllerData[t];this.initialized&&this.enqueueSaveRequest(100)},e.prototype.restoreController=function(e){if(!this.initialized)throw new Error("Illegal state. Controller data wasn't loaded yet!");var t=this.controllerData[e.controllerId()];if(t){try{e.deserialize(t.data)}catch(t){console.warn("Could not initialize controller of type '".concat(e.controllerId(),"' from data stored on disk. Resetting to default: ").concat(t.stack)),e.handleFactoryReset()}t.purgeOnNextLoad=void 0}},e.prototype.init=function(e){var t=this;if(this.initialized)throw new Error("ControllerStorage for accessory ".concat(this.accessoryUUID," was already initialized!"));this.initialized=!0,e&&e.forEach((function(e){return t.controllerData[e.type]=e.controllerData}));var r=[];this.trackedControllers.forEach((function(e){t.restoreController(e),r.push(e.controllerId())})),this.trackedControllers.splice(0,this.trackedControllers.length);var n=!1;Object.entries(this.controllerData).forEach((function(e){var o=i.__read(e,2),a=o[0],s=o[1];if(s.purgeOnNextLoad)return delete t.controllerData[a],void(n=!0);r.includes(a)||(s.purgeOnNextLoad=!0)})),n&&this.enqueueSaveRequest(500)},e.prototype.load=function(t){if(this.username)throw new Error("ControllerStorage was already loaded!");this.username=t;var r,i=e.persistKey(t),n=a.HAPStorage.storage().getItem(i);n&&(this.fileCreated=!0,r=n.accessories[this.accessoryUUID],delete n.accessories[this.accessoryUUID]),this.init(r),this.linkedAccessories&&this.linkedAccessories.forEach((function(e){var t=n&&n.accessories[e.accessoryUUID];e.init(t),n&&delete n.accessories[e.accessoryUUID]})),n&&Object.keys(n.accessories).length>0&&(this.purgeUnidentifiedAccessoryData?s("Purging unidentified controller data for bridge %s",t):this.restoredAccessories=n.accessories)},e.prototype.save=function(){var t;if(this.parent)this.parent.save();else{if(!this.initialized)throw new Error("ControllerStorage has not yet been loaded!");if(!this.username)throw new Error("Cannot save controllerData for a storage without a username!");var r=((t={})[this.accessoryUUID]=this.controllerData,t);this.linkedAccessories&&this.linkedAccessories.forEach((function(e){return r[e.accessoryUUID]=e.controllerData}));var n=this.restoredAccessories||{};Object.entries(r).forEach((function(e){var t=i.__read(e,2),r=t[0],o=t[1],a=Object.entries(o);a.length>0&&(n[r]=a.map((function(e){var t=i.__read(e,2);return{type:t[0],controllerData:t[1]}})))}));var o=e.persistKey(this.username);if(Object.keys(n).length>0){var s={accessories:n};this.fileCreated=!0,a.HAPStorage.storage().setItemSync(o,s)}else this.fileCreated&&(this.fileCreated=!1,a.HAPStorage.storage().removeItemSync(o))}},e.persistKey=function(e){return n.default.format("ControllerStorage.%s.json",e.replace(/:/g,"").toUpperCase())},e.remove=function(t){var r=e.persistKey(t);a.HAPStorage.storage().removeItemSync(r)},e}();t.ControllerStorage=c},4299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPStorage=void 0;var i=r(1635).__importDefault(r(3396)),n=function(){function e(){}return e.storage=function(){return this.INSTANCE.storage()},e.setCustomStoragePath=function(e){this.INSTANCE.setCustomStoragePath(e)},e.prototype.storage=function(){return this.localStore||(this.localStore=i.default.create(),this.customStoragePath?this.localStore.initSync({dir:this.customStoragePath}):this.localStore.initSync()),this.localStore},e.prototype.setCustomStoragePath=function(e){if(this.localStore)throw new Error("Cannot change storage path after it has already been initialized!");this.customStoragePath=e},e.INSTANCE=new e,e}();t.HAPStorage=n},2738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierCache=void 0;var i=r(1635),n=i.__importDefault(r(6982)),o=i.__importDefault(r(9023)),a=r(4299),s=function(){function e(e){this.username=e,this._cache={},this._usedCache=null,this._savedCacheHash=""}return e.prototype.startTrackingUsage=function(){this._usedCache={}},e.prototype.stopTrackingUsageAndExpireUnused=function(){this._cache=this._usedCache||this._cache,this._usedCache=null},e.prototype.getCache=function(e){var t=this._cache[e];return this._usedCache&&void 0!==t&&(this._usedCache[e]=t),t},e.prototype.setCache=function(e,t){return this._cache[e]=t,this._usedCache&&(this._usedCache[e]=t),t},e.prototype.getAID=function(e){var t=e;return this.getCache("|nextAID"),this.getCache(t)||this.setCache(t,this.getNextAID())},e.prototype.getIID=function(e,t,r,i){var n=e+"|"+t+(r?"|"+r:"")+(i?"|"+i:"");return this.getCache(e+"|nextIID"),this.getCache(n)||this.setCache(n,this.getNextIID(e))},e.prototype.getNextAID=function(){var e="|nextAID",t=this.getCache(e)||2;return this.setCache(e,t+1),t},e.prototype.getNextIID=function(e){var t=e+"|nextIID",r=this.getCache(t)||2;return this.setCache(t,r+1),r},e.prototype.save=function(){var t=n.default.createHash("sha1").update(JSON.stringify(this._cache)).digest("hex");if(t!==this._savedCacheHash){var r={cache:this._cache},i=e.persistKey(this.username);a.HAPStorage.storage().setItemSync(i,r),this._savedCacheHash=t}},e.persistKey=function(e){return o.default.format("IdentifierCache.%s.json",e.replace(/:/g,"").toUpperCase())},e.load=function(t){var r=e.persistKey(t),i=a.HAPStorage.storage().getItem(r);if(i){var o=new e(t);return o._cache=i.cache,o._savedCacheHash=n.default.createHash("sha1").update(JSON.stringify(o._cache)).digest("hex"),o}return null},e.remove=function(e){var t=this.persistKey(e);a.HAPStorage.storage().removeItemSync(t)},e}();t.IdentifierCache=s},4910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessControlManagement=t.AccessControlEvent=t.AccessLevel=void 0;var i,n=r(1635),o=r(4434),a=r(9826),s=r(5876),c=n.__importStar(r(3314));!function(e){e[e.PASSWORD=1]="PASSWORD",e[e.PASSWORD_REQUIRED=2]="PASSWORD_REQUIRED"}(i||(i={})),function(e){e[e.ANYONE=0]="ANYONE",e[e.HOME_MEMBERS_ONLY=1]="HOME_MEMBERS_ONLY"}(t.AccessLevel||(t.AccessLevel={})),function(e){e.ACCESS_LEVEL_UPDATED="update-control-level",e.PASSWORD_SETTING_UPDATED="update-password"}(t.AccessControlEvent||(t.AccessControlEvent={}));var u=function(e){function t(t,r){var i=e.call(this)||this;return i.accessLevel=0,i.passwordRequired=!1,i.accessControlService=r||new s.Service.AccessControl,i.setupServiceHandlers(t),i}return n.__extends(t,e),t.prototype.getService=function(){return this.accessControlService},t.prototype.getAccessLevel=function(){return this.accessLevel},t.prototype.getPassword=function(){return this.passwordRequired?this.password:void 0},t.prototype.destroy=function(){this.removeAllListeners(),this.accessControlService.getCharacteristic(a.Characteristic.AccessControlLevel).removeOnSet(),this.accessControlService.testCharacteristic(a.Characteristic.PasswordSetting)&&this.accessControlService.getCharacteristic(a.Characteristic.PasswordSetting).removeOnSet()},t.prototype.handleAccessLevelChange=function(e){var t=this;this.accessLevel=e,setTimeout((function(){t.emit("update-control-level",t.accessLevel)}),0).unref()},t.prototype.handlePasswordChange=function(e){var t=this,r=Buffer.from(e,"base64"),i=c.decode(r);i[1]?this.password=i[1].toString("utf8"):this.password=void 0,this.passwordRequired=!!i[2][0],setTimeout((function(){t.emit("update-password",t.password,t.passwordRequired)}),0).unref()},t.prototype.setupServiceHandlers=function(e){var t=this;this.accessControlService.getCharacteristic(a.Characteristic.AccessControlLevel).onSet((function(e){return t.handleAccessLevelChange(e)})).updateValue(0),e&&this.accessControlService.getCharacteristic(a.Characteristic.PasswordSetting).onSet((function(e){return t.handlePasswordChange(e)})).updateValue("")},t}(o.EventEmitter);t.AccessControlManagement=u},9621:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var i=r(1635);t.clone=function(e,t){var r,n,o,a,s={};try{for(var c=i.__values(Object.entries(e)),u=c.next();!u.done;u=c.next()){var l=i.__read(u.value,2),h=l[0],d=l[1];s[h]=d}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}if(t)try{for(var p=i.__values(Object.entries(t)),f=p.next();!f.done;f=p.next()){var m=i.__read(f.value,2);h=m[0],d=m[1];s[h]=d}}catch(e){o={error:e}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}return s}},2175:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorUtils=void 0;var i=r(1635).__importDefault(r(2613)),n=new Map([[100,[19,222.1]],[101,[18.7,222.2]],[102,[18.4,222.3]],[103,[18.2,222.3]],[104,[17.9,222.4]],[105,[17.6,222.5]],[106,[17.3,222.7]],[107,[17,222.8]],[108,[16.7,222.9]],[109,[16.4,223]],[110,[16.1,223.2]],[111,[15.8,223.3]],[112,[15.4,223.4]],[113,[15.2,223.6]],[114,[14.9,223.8]],[115,[14.7,223.9]],[116,[14.3,224.1]],[117,[14.1,224.2]],[118,[13.8,224.4]],[119,[13.5,224.6]],[120,[13.2,224.8]],[121,[12.9,225]],[122,[12.5,225.3]],[123,[12.2,225.6]],[124,[11.8,225.9]],[125,[11.4,226.3]],[126,[11.1,226.7]],[127,[10.7,227.1]],[128,[10.3,227.6]],[129,[9.9,228]],[130,[9.6,228.5]],[131,[9.3,229.1]],[132,[8.9,229.6]],[133,[8.5,230.2]],[134,[8.2,230.9]],[135,[7.8,231.6]],[136,[7.5,232.5]],[137,[7.1,233.5]],[138,[6.7,234.6]],[139,[6.3,235.8]],[140,[6,237.1]],[141,[5.6,238.9]],[142,[5.2,240.9]],[143,[5,242.9]],[144,[4.8,244.9]],[145,[4.6,246.9]],[146,[4.4,249.3]],[147,[4.3,251.9]],[148,[4.1,254.9]],[149,[3.9,258]],[150,[3.7,261.8]],[151,[3.4,265.9]],[152,[3.2,271]],[153,[3,276.4]],[154,[2.8,283.6]],[155,[2.6,290.4]],[156,[2.3,295.3]],[157,[2.1,300]],[158,[1.9,300]],[159,[1.6,300]],[160,[1.4,195.8]],[161,[1.2,84.3]],[162,[1.3,58.2]],[163,[1.5,55.9]],[164,[1.7,53.2]],[165,[1.9,50.2]],[166,[2.1,47.1]],[167,[2.4,44.5]],[168,[2.6,42.6]],[169,[2.9,40.9]],[170,[3.1,39.5]],[171,[3.4,38.3]],[172,[3.7,37.3]],[173,[3.9,36.5]],[174,[4.2,35.7]],[175,[4.4,35.1]],[176,[4.6,34.5]],[177,[4.9,34]],[178,[5.1,33.5]],[179,[5.3,33]],[180,[5.6,32.7]],[181,[5.8,32.3]],[182,[6,32]],[183,[6.3,31.7]],[184,[6.5,31.4]],[185,[6.7,31.2]],[186,[7,30.9]],[187,[7.2,30.7]],[188,[7.4,30.5]],[189,[7.6,30.3]],[190,[7.9,30.1]],[191,[8.1,29.9]],[192,[8.4,29.7]],[193,[8.6,29.6]],[194,[8.9,29.5]],[195,[9.1,29.3]],[196,[9.4,29.2]],[197,[9.6,29.1]],[198,[9.8,29]],[199,[10,28.9]],[200,[10.2,28.7]],[201,[10.5,28.7]],[202,[10.7,28.6]],[203,[11,28.5]],[204,[11.2,28.4]],[205,[11.4,28.3]],[206,[11.6,28.3]],[207,[11.8,28.2]],[208,[12.1,28.1]],[209,[12.3,28.1]],[210,[12.5,28]],[211,[12.7,28]],[212,[12.9,27.9]],[213,[13.2,27.8]],[214,[13.4,27.8]],[215,[13.6,27.7]],[216,[13.8,27.7]],[217,[14,27.7]],[218,[14.3,27.6]],[219,[14.5,27.6]],[220,[14.7,27.5]],[221,[14.9,27.5]],[222,[15.1,27.5]],[223,[15.3,27.4]],[224,[15.5,27.4]],[225,[15.8,27.4]],[226,[16,27.3]],[227,[16.2,27.3]],[228,[16.4,27.3]],[229,[16.6,27.3]],[230,[16.8,27.2]],[231,[17,27.2]],[232,[17.2,27.2]],[233,[17.4,27.2]],[234,[17.6,27.2]],[235,[17.8,27.1]],[236,[18,27.1]],[237,[18.2,27.1]],[238,[18.4,27.1]],[239,[18.7,27.1]],[240,[18.8,27]],[241,[19,27]],[242,[19.2,27]],[243,[19.4,27]],[244,[19.6,27]],[245,[19.8,27]],[246,[20,27]],[247,[20.3,26.9]],[248,[20.5,26.9]],[249,[20.6,26.9]],[250,[20.8,26.9]],[251,[21,26.9]],[252,[21.3,26.9]],[253,[21.5,26.9]],[254,[21.6,26.9]],[255,[21.8,26.8]],[256,[22,26.8]],[257,[22.2,26.8]],[258,[22.4,26.8]],[259,[22.6,26.8]],[260,[22.8,26.8]],[261,[23,26.8]],[262,[23.2,26.8]],[263,[23.4,26.8]],[264,[23.6,26.8]],[265,[23.8,26.8]],[266,[24,26.8]],[267,[24.1,26.8]],[268,[24.3,26.8]],[269,[24.5,26.8]],[270,[24.7,26.8]],[271,[24.8,26.8]],[272,[25.1,26.7]],[273,[25.3,26.7]],[274,[25.4,26.7]],[275,[25.6,26.7]],[276,[25.8,26.7]],[277,[26,26.7]],[278,[26.1,26.7]],[279,[26.3,26.7]],[280,[26.5,26.7]],[281,[26.7,26.7]],[282,[26.9,26.7]],[283,[27.1,26.7]],[284,[27.3,26.7]],[285,[27.5,26.7]],[286,[27.7,26.7]],[287,[27.8,26.7]],[288,[28,26.7]],[289,[28.2,26.7]],[290,[28.4,26.7]],[291,[28.6,26.7]],[292,[28.8,26.7]],[293,[28.9,26.7]],[294,[29.1,26.7]],[295,[29.3,26.7]],[296,[29.5,26.7]],[297,[29.6,26.7]],[298,[29.8,26.7]],[299,[30,26.7]],[300,[30.2,26.7]],[301,[30.4,26.7]],[302,[30.5,26.7]],[303,[30.7,26.7]],[304,[30.9,26.7]],[305,[31.1,26.7]],[306,[31.2,26.7]],[307,[31.4,26.7]],[308,[31.6,26.7]],[309,[31.8,26.8]],[310,[31.9,26.8]],[311,[32.1,26.8]],[312,[32.3,26.8]],[313,[32.5,26.8]],[314,[32.6,26.8]],[315,[32.8,26.8]],[316,[33,26.8]],[317,[33.2,26.8]],[318,[33.3,26.8]],[319,[33.5,26.8]],[320,[33.7,26.8]],[321,[33.8,26.8]],[322,[34,26.8]],[323,[34.2,26.8]],[324,[34.4,26.8]],[325,[34.5,26.8]],[326,[34.7,26.8]],[327,[34.9,26.8]],[328,[35.1,26.8]],[329,[35.2,26.8]],[330,[35.4,26.8]],[331,[35.5,26.8]],[332,[35.7,26.8]],[333,[35.9,26.8]],[334,[36.1,26.8]],[335,[36.3,26.9]],[336,[36.5,26.9]],[337,[36.7,26.9]],[338,[36.9,26.9]],[339,[37.1,26.9]],[340,[37.2,26.9]],[341,[37.4,26.9]],[342,[37.5,26.9]],[343,[37.7,26.9]],[344,[37.9,26.9]],[345,[38.1,26.9]],[346,[38.3,26.9]],[347,[38.5,26.9]],[348,[38.7,26.9]],[349,[38.9,26.9]],[350,[39,26.9]],[351,[39.2,26.9]],[352,[39.3,27]],[353,[39.5,27]],[354,[39.7,27]],[355,[39.9,27]],[356,[40.1,27]],[357,[40.2,27]],[358,[40.4,27]],[359,[40.6,27]],[360,[40.8,27]],[361,[40.9,27]],[362,[41.1,27]],[363,[41.2,27]],[364,[41.4,27]],[365,[41.6,27]],[366,[41.8,27]],[367,[42,27]],[368,[42.1,27.1]],[369,[42.3,27.1]],[370,[42.4,27.1]],[371,[42.6,27.1]],[372,[42.8,27.1]],[373,[43,27.1]],[374,[43.1,27.1]],[375,[43.2,27.1]],[376,[43.4,27.1]],[377,[43.6,27.1]],[378,[43.8,27.1]],[379,[43.9,27.1]],[380,[44.1,27.1]],[381,[44.3,27.2]],[382,[44.4,27.2]],[383,[44.6,27.2]],[384,[44.7,27.2]],[385,[44.9,27.2]],[386,[45.1,27.2]],[387,[45.3,27.2]],[388,[45.5,27.2]],[389,[45.6,27.2]],[390,[45.8,27.2]],[391,[46,27.2]],[392,[46.2,27.2]],[393,[46.4,27.3]],[394,[46.5,27.3]],[395,[46.7,27.3]],[396,[46.9,27.3]],[397,[47.1,27.3]],[398,[47.2,27.3]],[399,[47.4,27.3]],[400,[47.6,27.3]],[401,[47.7,27.3]],[402,[47.9,27.3]],[403,[48.1,27.3]],[404,[48.3,27.3]],[405,[48.5,27.4]],[406,[48.7,27.4]],[407,[48.8,27.4]],[408,[49,27.4]],[409,[49.2,27.4]],[410,[49.4,27.4]],[411,[49.6,27.4]],[412,[49.7,27.4]],[413,[49.9,27.4]],[414,[50.1,27.4]],[415,[50.2,27.4]],[416,[50.4,27.4]],[417,[50.6,27.5]],[418,[50.7,27.5]],[419,[50.9,27.5]],[420,[51.1,27.5]],[421,[51.2,27.5]],[422,[51.4,27.5]],[423,[51.6,27.5]],[424,[51.7,27.5]],[425,[51.9,27.5]],[426,[52.1,27.5]],[427,[51.2,27.6]],[428,[52.4,27.6]],[429,[52.5,27.6]],[430,[52.7,27.6]],[431,[52.9,27.6]],[432,[53.1,27.6]],[433,[53.2,27.6]],[434,[53.4,27.6]],[435,[53.6,27.6]],[436,[53.7,27.6]],[437,[53.9,27.6]],[438,[54.1,27.7]],[439,[54.2,27.7]],[440,[54.3,27.7]],[441,[54.5,27.7]],[442,[54.7,27.7]],[443,[54.8,27.7]],[444,[55,27.7]],[445,[55.2,27.7]],[446,[55.3,27.7]],[447,[55.5,27.7]],[448,[55.7,27.7]],[449,[55.8,27.8]],[450,[56,27.8]],[451,[56.2,27.8]],[452,[56.3,27.8]],[453,[56.5,27.8]],[454,[56.7,27.8]],[455,[56.8,27.8]],[456,[57,27.8]],[457,[57.2,27.8]],[458,[57.3,27.9]],[459,[57.4,27.9]],[460,[57.6,27.9]],[461,[57.8,27.9]],[462,[57.9,27.9]],[463,[58.1,27.9]],[464,[58.3,27.9]],[465,[58.4,27.9]],[466,[58.6,27.9]],[467,[58.8,27.9]],[468,[59,28]],[469,[59.1,28]],[470,[59.2,28]],[471,[59.4,28]],[472,[59.6,28]],[473,[59.7,28]],[474,[60,28]],[475,[60.1,28]],[476,[60.2,28]],[477,[60.4,28]],[478,[60.6,28.1]],[479,[60.7,28.1]],[480,[60.9,28.1]],[481,[60.1,28.1]],[482,[60.3,28.1]],[483,[61.4,28.1]],[484,[61.5,28.1]],[485,[61.7,28.1]],[486,[61.9,28.1]],[487,[62,28.2]],[488,[62.2,28.2]],[489,[62.3,28.2]],[490,[62.5,28.2]],[491,[62.7,28.2]],[492,[62.8,28.2]],[493,[63,28.2]],[494,[63.2,28.2]],[495,[63.3,28.2]],[496,[63.4,28.2]],[497,[63.6,28.2]],[498,[63.8,28.3]],[499,[63.9,28.3]],[500,[64.1,28.3]]]),o=function(){function e(){}return e.colorTemperatureToHueAndSaturation=function(e,t){void 0===t&&(t=!0),e>500?e=500:e<100&&(e=100),e=Math.round(e);var r=n.get(e);return(0,i.default)(null!=e,"lookup for temperature "+e+" did not yield any results"),t&&(r[0]=Math.round(r[0]),r[1]=Math.round(r[1])),{saturation:r[0],hue:r[1]}},e}();t.ColorUtils=o},9593:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPConnection=t.HAPConnectionEvent=t.HAPConnectionState=t.EventedHTTPServer=t.EventedHTTPServerEvent=t.HAPEncryption=void 0;var i=r(1635),n=r(9152),o=i.__importDefault(r(2613)),a=i.__importDefault(r(5753)),s=r(4434),c=i.__importDefault(r(8611)),u=i.__importDefault(r(9278)),l=i.__importDefault(r(857)),h=i.__importStar(r(8)),d=r(47),p=i.__importStar(r(2997)),f=(0,a.default)("HAP-NodeJS:EventedHTTPServer"),m=(0,a.default)("HAP-NodeJS:EventedHTTPServer:Connection"),g=(0,a.default)("HAP-NodeJS:EventEmitter"),v=function(e,t,r,i,n){this.accessoryToControllerCount=0,this.controllerToAccessoryCount=0,this.clientPublicKey=e,this.secretKey=t,this.publicKey=r,this.sharedSecret=i,this.hkdfPairEncryptionKey=n,this.accessoryToControllerKey=Buffer.alloc(0),this.controllerToAccessoryKey=Buffer.alloc(0)};t.HAPEncryption=v,function(e){e.LISTENING="listening",e.CONNECTION_OPENED="connection-opened",e.REQUEST="request",e.CONNECTION_CLOSED="connection-closed"}(t.EventedHTTPServerEvent||(t.EventedHTTPServerEvent={}));var y=function(e){function t(){var t=e.call(this)||this;return t.connections=new Set,t.connectionsByUsername=new Map,t.tcpServer=u.default.createServer(),t}return i.__extends(t,e),t.prototype.scheduleNextConnectionIdleTimeout=function(){var e,r;if(this.connectionIdleTimeout=void 0,this.tcpServer.listening){f("Running idle timeout timer...");var n=(new Date).getTime(),o=-1;try{for(var a=i.__values(this.connections),s=a.next();!s.done;s=a.next()){var c=s.value,u=n-c.lastSocketOperation;u>=t.MAX_CONNECTION_IDLE_TIME?(f("[%s] Closing connection as it was inactive for "+u+"ms"),c.close()):o=Math.max(o,t.MAX_CONNECTION_IDLE_TIME-u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}this.connections.size>=t.CONNECTION_TIMEOUT_LIMIT&&(this.connectionIdleTimeout=setTimeout(this.scheduleNextConnectionIdleTimeout.bind(this),o))}},t.prototype.address=function(){return this.tcpServer.address()},t.prototype.listen=function(e,t){var r=this;this.tcpServer.listen(e,t,(function(){var e=r.tcpServer.address();f("Server listening on %s:%s","IPv6"===e.family?"[".concat(e.address,"]"):e.address,e.port),r.connectionLoggingInterval=setInterval((function(){var e=i.__spreadArray([],i.__read(r.connections),!1).map((function(e){return"".concat(e.remoteAddress,":").concat(e.remotePort)})).join(", ");f("Currently %d hap connections open: %s",r.connections.size,e)}),6e4),r.connectionLoggingInterval.unref(),r.emit("listening",e.port,e.address)})),this.tcpServer.on("connection",this.onConnection.bind(this))},t.prototype.stop=function(){var e,t;null!=this.connectionLoggingInterval&&(clearInterval(this.connectionLoggingInterval),this.connectionLoggingInterval=void 0),null!=this.connectionIdleTimeout&&(clearTimeout(this.connectionIdleTimeout),this.connectionIdleTimeout=void 0),this.tcpServer.close();try{for(var r=i.__values(this.connections),n=r.next();!n.done;n=r.next()){n.value.close()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.destroy=function(){this.stop(),this.removeAllListeners()},t.prototype.broadcastEvent=function(e,t,r,n,o){var a,s;try{for(var c=i.__values(this.connections),u=c.next();!u.done;u=c.next()){var l=u.value;l!==n?l.sendEvent(e,t,r,o):f("[%s] Muting event '%s' notification for this connection since it originated here.",l.remoteAddress,e+"."+t)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}},t.prototype.onConnection=function(e){var r=this,i=new C(this,e);i.on("request",(function(e,t){r.emit("request",i,e,t)})),i.on("authenticated",this.handleConnectionAuthenticated.bind(this,i)),i.on("closed",this.handleConnectionClose.bind(this,i)),this.connections.add(i),f("[%s] New connection from client on interface %s (%s)",i.remoteAddress,i.networkInterface,i.localAddress),this.emit("connection-opened",i),this.connections.size>=t.CONNECTION_TIMEOUT_LIMIT&&!this.connectionIdleTimeout&&this.scheduleNextConnectionIdleTimeout()},t.prototype.handleConnectionAuthenticated=function(e,t){var r=this.connectionsByUsername.get(t);r?r.includes(e)||r.push(e):this.connectionsByUsername.set(t,[e])},t.prototype.handleConnectionClose=function(e){if(this.emit("connection-closed",e),this.connections.delete(e),e.username){var t=this.connectionsByUsername.get(e.username);if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1),0===t.length&&this.connectionsByUsername.delete(e.username)}}},t.destroyExistingConnectionsAfterUnpair=function(e,t){var r,n,o=e.server.connectionsByUsername.get(t);if(o)try{for(var a=i.__values(o),s=a.next();!s.done;s=a.next()){s.value.closeConnectionAsOfUnpair(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},t.CONNECTION_TIMEOUT_LIMIT=16,t.MAX_CONNECTION_IDLE_TIME=36e5,t}(s.EventEmitter);t.EventedHTTPServer=y,function(e){e[e.CONNECTING=0]="CONNECTING",e[e.FULLY_SET_UP=1]="FULLY_SET_UP",e[e.AUTHENTICATED=2]="AUTHENTICATED",e[e.TO_BE_TEARED_DOWN=3]="TO_BE_TEARED_DOWN",e[e.CLOSING=4]="CLOSING",e[e.CLOSED=5]="CLOSED"}(t.HAPConnectionState||(t.HAPConnectionState={})),function(e){e.REQUEST="request",e.AUTHENTICATED="authenticated",e.CLOSED="closed"}(t.HAPConnectionEvent||(t.HAPConnectionEvent={}));var C=function(e){function t(r,i){var n=e.call(this)||this;return n.state=0,n.lastSocketOperation=(new Date).getTime(),n.pendingClientSocketData=Buffer.alloc(0),n.handlingRequest=!1,n.registeredEvents=new Set,n.queuedEvents=[],n.eventsQueuedForImmediateDelivery=!1,n.server=r,n.sessionID=p.generate(i.remoteAddress+":"+i.remotePort),n.localAddress=i.localAddress,n.remoteAddress=i.remoteAddress,n.remotePort=i.remotePort,n.networkInterface=t.getLocalNetworkInterface(i),n.tcpSocket=i,n.tcpSocket.on("data",n.onTCPSocketData.bind(n)),n.tcpSocket.on("close",n.onTCPSocketClose.bind(n)),n.tcpSocket.on("error",n.onTCPSocketError.bind(n)),n.tcpSocket.setNoDelay(!0),n.internalHttpServer=c.default.createServer(),n.internalHttpServer.timeout=0,n.internalHttpServer.keepAliveTimeout=0,n.internalHttpServer.on("listening",n.onHttpServerListening.bind(n)),n.internalHttpServer.on("request",n.handleHttpServerRequest.bind(n)),n.internalHttpServer.on("error",n.onHttpServerError.bind(n)),n.internalHttpServer.listen(0,n.internalHttpServerAddress=(0,d.getOSLoopbackAddressIfAvailable)()),n}return i.__extends(t,e),t.prototype.debugListenerRegistration=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=-1);var i=(new Error).stack.split("\n")[3],n=this.listeners(e).length,o="authenticated"===e?"\t":"\t\t",a=t?"\t\t":"\t";g("[".concat(this.remoteAddress,"] ").concat(t?"Registered":"Unregistered"," event '").concat(String(e).toUpperCase(),"' ").concat(o,"(total: ").concat(n).concat(t?"":" Before: "+r,") ").concat(a).concat(i))},t.prototype.on=function(t,r){var i=e.prototype.on.call(this,t,r);return this.debugListenerRegistration(t),i},t.prototype.addListener=function(t,r){var i=e.prototype.addListener.call(this,t,r);return this.debugListenerRegistration(t),i},t.prototype.removeListener=function(t,r){var i=this.listeners(t).length,n=e.prototype.removeListener.call(this,t,r);return this.debugListenerRegistration(t,!1,i),n},t.prototype.off=function(t,r){var i=e.prototype.off.call(this,t,r),n=this.listeners(t).length;return this.debugListenerRegistration(t,!1,n),i},t.prototype.connectionAuthenticated=function(e){this.state=2,this.username=e,this.emit("authenticated",e)},t.prototype.isAuthenticated=function(){return 2===this.state},t.prototype.close=function(){this.state>=4||(this.state=4,this.tcpSocket.destroy())},t.prototype.closeConnectionAsOfUnpair=function(e){this===e?this.state=3:this.close()},t.prototype.sendEvent=function(e,t,r,i){(0,o.default)(null!=e,"HAPConnection.sendEvent: aid must be defined!"),(0,o.default)(null!=t,"HAPConnection.sendEvent: iid must be defined!");var n=e+"."+t;if(this.registeredEvents.has(n)){var a={aid:e,iid:t,value:r};if(i)return this.queuedEvents.push(a),this.eventsQueuedForImmediateDelivery=!0,this.eventsTimer&&(clearTimeout(this.eventsTimer),this.eventsTimer=void 0),void this.handleEventsTimeout();for(var s=this.queuedEvents.length-1;s>=0;s--){var c=this.queuedEvents[s];if(c.aid===e&&c.iid===t){if(c.value===r)return;break}}this.queuedEvents.push(a),this.eventsTimer||(this.eventsTimer=setTimeout(this.handleEventsTimeout.bind(this),250),this.eventsTimer.unref())}},t.prototype.handleEventsTimeout=function(){this.eventsTimer=void 0,this.state>2||this.writeQueuedEventNotifications()},t.prototype.writeQueuedEventNotifications=function(){var e,t;if(0!==this.queuedEvents.length&&!this.handlingRequest){this.eventsTimer&&(clearTimeout(this.eventsTimer),this.eventsTimer=void 0);var r={characteristics:[]};try{for(var n=i.__values(this.queuedEvents),o=n.next();!o.done;o=n.next()){var a=o.value;this.registeredEvents.has(a.aid+"."+a.iid)&&r.characteristics.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.queuedEvents.splice(0,this.queuedEvents.length),this.eventsQueuedForImmediateDelivery=!1,this.writeEventNotification(r)}},t.prototype.writeEventNotification=function(e){m("[%s] Sending HAP event notifications %o",this.remoteAddress,e.characteristics),(0,o.default)(!this.handlingRequest,"Can't write event notifications while handling a request!"),e.characteristics.reverse();var t=Buffer.from(JSON.stringify(e),"utf8"),r=Buffer.from("EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: "+t.length+"\r\n\r\n","utf8"),i=Buffer.concat([r,t]);this.tcpSocket.write(this.encrypt(i),this.handleTCPSocketWriteFulfilled.bind(this))},t.prototype.enableEventNotifications=function(e,t){this.registeredEvents.add(e+"."+t)},t.prototype.disableEventNotifications=function(e,t){this.registeredEvents.delete(e+"."+t)},t.prototype.hasEventNotifications=function(e,t){return this.registeredEvents.has(e+"."+t)},t.prototype.getRegisteredEvents=function(){return this.registeredEvents},t.prototype.clearRegisteredEvents=function(){this.registeredEvents.clear()},t.prototype.encrypt=function(e){return this.encryption&&this.encryption.accessoryToControllerKey.length>0&&this.encryption.controllerToAccessoryCount>0?h.layerEncrypt(e,this.encryption):e},t.prototype.decrypt=function(e){return this.encryption&&this.encryption.controllerToAccessoryKey.length>0?h.layerDecrypt(e,this.encryption):e},t.prototype.onHttpServerListening=function(){var e=this,t=this.internalHttpServer.address(),r="IPv6"===t.family?"[".concat(t.address,"]"):t.address;this.internalHttpServerPort=t.port,m("[%s] Internal HTTP server listening on %s:%s",this.remoteAddress,r,t.port),this.internalHttpServer.on("close",this.onHttpServerClose.bind(this)),this.httpSocket=u.default.createConnection(this.internalHttpServerPort,this.internalHttpServerAddress),this.httpSocket.setNoDelay(!0),this.httpSocket.on("data",this.handleHttpServerResponse.bind(this)),this.httpSocket.on("error",this.onHttpSocketError.bind(this)),this.httpSocket.on("close",this.onHttpSocketClose.bind(this)),this.httpSocket.on("connect",(function(){e.state=1,m("[%s] Internal HTTP socket connected. HAPConnection now fully set up!",e.remoteAddress),e.pendingClientSocketData&&e.pendingClientSocketData.length>0&&e.httpSocket.write(e.pendingClientSocketData),e.pendingClientSocketData=void 0}))},t.prototype.onTCPSocketData=function(e){if(!(this.state>2)){this.handlingRequest=!0,this.lastSocketOperation=(new Date).getTime();try{e=this.decrypt(e)}catch(e){return m("[%s] Error occurred trying to decrypt incoming packet: %s",this.remoteAddress,e.message),void this.close()}this.state<1?this.pendingClientSocketData=Buffer.concat([this.pendingClientSocketData,e]):this.httpSocket.write(e)}},t.prototype.handleHttpServerRequest=function(e,t){this.state>2||(m("[%s] HTTP request: %s",this.remoteAddress,e.url),e.socket.setNoDelay(!0),this.emit("request",e,t))},t.prototype.handleHttpServerResponse=function(e){var t=this;e=this.encrypt(e),this.tcpSocket.write(e,this.handleTCPSocketWriteFulfilled.bind(this)),m("[%s] HTTP Response is finished",this.remoteAddress),this.handlingRequest=!1,3===this.state?setTimeout((function(){return t.close()}),10):this.state<3&&(this.eventsTimer&&!this.eventsQueuedForImmediateDelivery||this.writeQueuedEventNotifications())},t.prototype.handleTCPSocketWriteFulfilled=function(){this.lastSocketOperation=(new Date).getTime()},t.prototype.onTCPSocketError=function(e){m("[%s] Client connection error: %s",this.remoteAddress,e.message)},t.prototype.onTCPSocketClose=function(){this.state=5,m("[%s] Client connection closed",this.remoteAddress),this.httpSocket&&this.httpSocket.destroy(),this.internalHttpServer.close(),this.emit("closed"),this.removeAllListeners()},t.prototype.onHttpServerError=function(e){m("[%s] HTTP server error: %s",this.remoteAddress,e.message),"EADDRINUSE"===e.code&&(this.internalHttpServerPort=void 0,this.internalHttpServer.close(),this.internalHttpServer.listen(0,this.internalHttpServerAddress=(0,d.getOSLoopbackAddressIfAvailable)()))},t.prototype.onHttpServerClose=function(){m("[%s] HTTP server was closed",this.remoteAddress),this.close()},t.prototype.onHttpSocketError=function(e){m("[%s] HTTP connection error: ",this.remoteAddress,e.message)},t.prototype.onHttpSocketClose=function(){m("[%s] HTTP connection was closed",this.remoteAddress),this.internalHttpServer.close()},t.prototype.getLocalAddress=function(e){var t,r,n,o,a=l.default.networkInterfaces()[this.networkInterface];if("ipv4"===e){try{for(var s=i.__values(a),c=s.next();!c.done;c=s.next()){if("IPv4"===(p=c.value).family||4===p.family)return p.address}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw new Error("Could not find "+e+" address for interface "+this.networkInterface)}var u=void 0;try{for(var h=i.__values(a),d=h.next();!d.done;d=h.next()){var p;if("IPv6"===(p=d.value).family||6===p.family){if(!p.scopeid)return p.address;u||(u=p.address)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}if(!u)throw new Error("Could not find "+e+" address for interface "+this.networkInterface);return u},t.getLocalNetworkInterface=function(e){var t,r,o,a,s,c,h,d,p=e.localAddress;if(p.startsWith("::ffff:"))p=p.substring(7);else{var f=p.indexOf("%");-1!==f&&(p=p.substring(0,f))}var m=l.default.networkInterfaces();try{for(var g=i.__values(Object.entries(m)),v=g.next();!v.done;v=g.next()){var y=i.__read(v.value,2),C=y[0],S=y[1];try{for(var E=(o=void 0,i.__values(S)),_=E.next();!_.done;_=E.next()){if((U=_.value).address===p)return C}}catch(e){o={error:e}}finally{try{_&&!_.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(t)throw t.error}}var T=u.default.isIPv4(p)?"IPv4":"IPv6";try{for(var A=i.__values(Object.entries(m)),I=A.next();!I.done;I=A.next()){var D=i.__read(I.value,2);C=D[0],S=D[1];try{for(var w=(h=void 0,i.__values(S)),b=w.next();!b.done;b=w.next()){var U;if((U=b.value).family===T&&(0,n.getNetAddress)(p,U.netmask)===(0,n.getNetAddress)(U.address,U.netmask))return C}}catch(e){h={error:e}}finally{try{b&&!b.done&&(d=w.return)&&d.call(w)}finally{if(h)throw h.error}}}}catch(e){s={error:e}}finally{try{I&&!I.done&&(c=A.return)&&c.call(A)}finally{if(s)throw s.error}}return console.log("WARNING couldn't map socket coming from remote address ".concat(e.remoteAddress,":").concat(e.remotePort," at local address ").concat(e.localAddress," to a interface!")),Object.keys(m)[1]},t}(s.EventEmitter);t.HAPConnection=C},8:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layerDecrypt=t.layerEncrypt=t.chacha20_poly1305_encryptAndSeal=t.chacha20_poly1305_decryptAndVerify=t.writeUInt64LE=t.HKDF=t.generateCurve25519SharedSecKey=t.generateCurve25519KeyPair=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(6982)),a=i.__importDefault(r(6871)),s=i.__importDefault(r(8947));o.default.getCiphers().includes("chacha20-poly1305")||n.default.fail("The cipher 'chacha20-poly1305' is not supported with your current running nodejs version v"+process.version+". At least a nodejs version of v10.17.0 (excluding v11.0 and v11.1) is required!"),t.generateCurve25519KeyPair=function(){return s.default.box.keyPair()},t.generateCurve25519SharedSecKey=function(e,t){return s.default.scalarMult(e,t)},t.HKDF=function(e,t,r,i,n){return(0,a.default)(r,n,{hash:e,salt:t,info:i})};var c=4294967295,u=9007199254740991;function l(e,t,r){void 0===r&&(r=0);var i=function(e){(0,n.default)(e>-1&&e<=u,"number out of range"),(0,n.default)(Math.floor(e)===e,"number must be an integer");var t=0,r=4294967295&e,i=r<0?2147483648+(2147483647&e):r;return e>c&&(t=(e-i)/(c+1)),[t,i]}(e);t.writeUInt32LE(i[1],r),t.writeUInt32LE(i[0],r+4)}function h(e,t,r,i,n){t.length<12&&(t=Buffer.concat([Buffer.alloc(12-t.length,0),t]));var a=o.default.createDecipheriv("chacha20-poly1305",e,t,{authTagLength:16});r&&a.setAAD(r),a.setAuthTag(n);var s=a.update(i);return a.final(),s}function d(e,t,r,i){t.length<12&&(t=Buffer.concat([Buffer.alloc(12-t.length,0),t]));var n=o.default.createCipheriv("chacha20-poly1305",e,t,{authTagLength:16});r&&n.setAAD(r);var a=n.update(i);return n.final(),{ciphertext:a,authTag:n.getAuthTag()}}t.writeUInt64LE=l,t.chacha20_poly1305_decryptAndVerify=h,t.chacha20_poly1305_encryptAndSeal=d,t.layerEncrypt=function(e,t){for(var r=Buffer.alloc(0),i=e.length,n=0;ni-n-2-16){t.incompleteFrame=e.slice(n);break}var a=Buffer.alloc(8);l(t.controllerToAccessoryCount++,a,0);var s=h(t.controllerToAccessoryKey,a,e.slice(n,n+2),e.slice(n+2,n+2+o),e.slice(n+2+o,n+2+o+16));r=Buffer.concat([r,s]),n+=18+o}return r}},8073:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HapStatusError=void 0;var i=r(1635),n=r(589),o=function(e){function t(r){var i=e.call(this,"HAP Status Error: "+r)||this;return Object.setPrototypeOf(i,t.prototype),(0,n.IsKnownHAPStatusError)(r)?i.hapStatus=r:i.hapStatus=-70402,i}return i.__extends(t,e),t}(Error);t.HapStatusError=o},47:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOSLoopbackAddressIfAvailable=t.getOSLoopbackAddress=t.findLoopbackAddress=void 0;var i=r(1635),n=i.__importDefault(r(857));function o(){var e,t,r,o,a=void 0,s=void 0,c=void 0;try{for(var u=i.__values(Object.entries(n.default.networkInterfaces())),l=u.next();!l.done;l=u.next()){var h=i.__read(l.value,2),d=h[0],p=h[1],f=!1;try{for(var m=(r=void 0,i.__values(p)),g=m.next();!g.done;g=m.next()){var v=g.value;v.internal&&(f=!0,"IPv4"===v.family||4===v.family?c||(c=v.address):"IPv6"!==v.family&&6!==v.family||(v.scopeid?s||(s=v.address+"%"+d):a||(a=v.address)))}}catch(e){r={error:e}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(r)throw r.error}}if(f)break}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}var y=c||a||s;if(!y)throw new Error("Could not find a valid loopback address on the platform!");return y}t.findLoopbackAddress=o;var a=void 0;t.getOSLoopbackAddress=function(){return null!=a?a:a=o()},t.getOSLoopbackAddressIfAvailable=function(){try{return null!=a?a:a=o()}catch(e){return void console.log(e.stack)}}},7739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.once=void 0;var i=r(1635);t.once=function(e){var t=!1;return function(){for(var r=[],n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.awaitEventOnce=t.PromiseTimeout=void 0,t.PromiseTimeout=function(e){return new Promise((function(t){setTimeout((function(){return t()}),e)}))},t.awaitEventOnce=function(e,t,r){return void 0===r&&(r=5e3),new Promise((function(i,n){var o,a=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numericUpperBound=t.numericLowerBound=t.isIntegerNumericFormat=t.isUnsignedNumericFormat=t.isNumericFormat=t.formatOutgoingCharacteristicValue=void 0,t.formatOutgoingCharacteristicValue=function(e,t){var r;if("boolean"==typeof e)return e?1:0;if("number"==typeof e){if(!t.minStep||t.minStep>=1)return e;var i=null!==(r=t.minValue)&&void 0!==r?r:0,n=1/t.minStep;return Math.round(1e4*(Math.round((e-i)*n)/n+i))/1e4}return e},t.isNumericFormat=function(e){switch(e){case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.isUnsignedNumericFormat=function(e){switch(e){case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.isIntegerNumericFormat=function(e){switch(e){case"int":case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.numericLowerBound=function(e){switch(e){case"int":return-2147483648;case"float":return-Number.MAX_VALUE;case"uint8":case"uint16":case"uint32":case"uint64":return 0;default:throw new Error("Unable to determine numeric lower bound for "+e)}},t.numericUpperBound=function(e){switch(e){case"int":return 2147483647;case"float":return Number.MAX_VALUE;case"uint8":return 255;case"uint16":return 65535;case"uint32":return 4294967295;case"uint64":return 0x10000000000000000;default:throw new Error("Unable to determine numeric lower bound for "+e)}}},1579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.epochMillisFromMillisSince2001_01_01Buffer=t.epochMillisFromMillisSince2001_01_01=void 0;var i=r(1635).__importDefault(r(2613)),n=r(3314),o=Date.UTC(2001,0,1,0,0,0,0);function a(e){return o+e}t.epochMillisFromMillisSince2001_01_01=a,t.epochMillisFromMillisSince2001_01_01Buffer=function(e){return(0,i.default)(8===e.length,"can only parse 64 bit buffers!"),a((0,n.readUInt64LE)(e))}},3314:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.writeVariableUIntLE=t.readVariableUIntLE=t.readUInt16=t.writeUInt16=t.writeFloat32LE=t.readUInt32=t.writeUInt32=t.readUInt64BE=t.readUInt64LE=t.readUInt64=t.writeUInt64=t.decodeList=t.decodeWithLists=t.decode=t.encode=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importStar(r(8));function a(e,t){void 0===t&&(t=0);var r=e.readUInt32LE(t);return 4294967296*e.readUInt32LE(t+4)+r}function s(e){var t=Buffer.alloc(4);return t.writeUInt32LE(e,0),t}function c(e){var t=Buffer.alloc(2);return t.writeUInt16LE(e,0),t}t.encode=function e(t,r){for(var n,o,a=[],s=2;s0;)p>=255?(c.push(Buffer.concat([Buffer.from([t,255]),r.slice(f,f+255)])),p-=255,f+=255):(c.push(Buffer.concat([Buffer.from([t,p]),r.slice(f)])),p-=p);if(a.length>=2){var m=i.__read(a),g=m[0],v=m[1],y=m.slice(2),C=e.apply(void 0,i.__spreadArray([g,v],i.__read(y),!1));c.push(C)}return Buffer.concat(c)},t.decode=function(e){(0,n.default)(e instanceof Buffer,"Illegal argument. tlv.decode() expects Buffer type!");for(var t={},r=e.length,i=0;r>0;){var o=e[i],a=e[i+1];i+=2,r-=2;var s=e.slice(i,i+a);t[o]?t[o]=Buffer.concat([t[o],s]):t[o]=s,i+=a,r-=a}return t},t.decodeWithLists=function(e){for(var t={},r=e.length,i=0,n=-1,o=-1,a=!1;r>0;){var s=e.readUInt8(i++),c=e.readUInt8(i++);r-=2;var u=e.slice(i,i+c);if(i+=c,r-=c,0!==s||0!==c){var l=t[s];if(l)if(a&&n===s)Array.isArray(l)?l.push(u):t[s]=[l,u];else{if(n!==s||255!==o)throw new Error("Found duplicated tlv entry with type ".concat(s," and length ").concat(c," (lastItemWasDelimiter: ").concat(a,", lastType: ").concat(n,", lastLength: ").concat(o,")"));if(Array.isArray(l)){var h=l[l.length-1];l[l.length-1]=Buffer.concat([h,u])}else t[s]=Buffer.concat([l,u])}else t[s]=u;n=s,o=c,a=!1}else a=!0}return t},t.decodeList=function(e,t){for(var r=[],i=e.length,n=0,o=void 0;i>0;){var a=e[n],s=e[n+1],c=e.slice(n+2,n+2+s);if(a===t&&(void 0!==o&&r.push(o),o={}),void 0===o)throw new Error("Error parsing tlv list: Encountered uninitialized storage object");o[a]?o[a]=Buffer.concat([o[a],c]):o[a]=c,n+=2+s,i-=2+s}return void 0!==o&&r.push(o),r},t.writeUInt64=function(e){var t=new Float64Array(1);t[0]=e;for(var r=Buffer.alloc(t.buffer.byteLength),i=new Uint8Array(t.buffer),n=0;n=0,"Can't encode a negative integer as unsigned integer"),(0,n.default)(0===t,"Can't define a offset different than 0!"),e<=255)return(r=Buffer.alloc(1)).writeUInt8(e,t),r;if(e<=65535)return c(e);if(e<=4294967295)return s(e);var r=Buffer.alloc(8);return o.writeUInt64LE(e,r,t),r}},2997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toLongForm=t.toShortForm=t.write=t.unparse=t.isValid=t.generate=t.BASE_UUID=void 0;var i=r(1635).__importDefault(r(6982));t.BASE_UUID="-0000-1000-8000-0026BB765291",t.generate=function(e){var t=i.default.createHash("sha1");t.update(e);var r=t.digest("hex"),n=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){return n+=1,"y"===e?(3&parseInt("0x"+r[n],16)|8).toString(16):r[n]}))};var n=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function o(e){return n.test(e)}t.isValid=o,t.unparse=function(e,t){if(void 0===t&&(t=0),"string"==typeof e&&o(e))return e;var r=t;return e.toString("hex",r,r+=4)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+6)},t.write=function(e,t,r){void 0===r&&(r=0);var i=Buffer.from(e.replace(/-/g,""),"hex");return t?(i.copy(t,r),t):i};var a=/^0*([0-9a-f]{1,8})-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i;t.toShortForm=function(e,r){if(void 0===r&&(r=t.BASE_UUID),!o(e))throw new TypeError("uuid was not a valid UUID or short form UUID");if(r&&!o("00000000"+r))throw new TypeError("base was not a valid base UUID");return r&&!e.endsWith(r)?e.toUpperCase():e.replace(a,"$1").toUpperCase()};var s=/^[0-9a-f]{1,8}$/i;t.toLongForm=function(e,r){if(void 0===r&&(r=t.BASE_UUID),o(e))return e.toUpperCase();if(!s.test(e))throw new TypeError("uuid was not a valid UUID or short form UUID");if(!o("00000000"+r))throw new TypeError("base was not a valid base UUID");return(("00000000"+e).substr(-8)+r).toUpperCase()}},7506:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=7506,e.exports=t},4310:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceRequestType=void 0,function(e){e.IMAGE="image"}(t.ResourceRequestType||(t.ResourceRequestType={}))},9790:e=>{"use strict";var t="undefined"!=typeof BigInt&&BigInt;e.exports=function(){return"function"==typeof t&&"function"==typeof BigInt&&"bigint"==typeof t(42)&&"bigint"==typeof BigInt(42)}},5884:e=>{"use strict";e.exports=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",i=t.indexOf(r+e),n=t.indexOf("--");return-1!==i&&(-1===n||i{"use strict";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},24:e=>{"use strict";var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},4039:(e,t,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(1333);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},1333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},9092:(e,t,r)=>{"use strict";var i=r(1333);e.exports=function(){return i()&&!!Symbol.toStringTag}},9957:(e,t,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(6743);e.exports=o.call(i,n)},7244:(e,t,r)=>{"use strict";var i=r(9092)(),n=r(8075)("Object.prototype.toString"),o=function(e){return!(i&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===n(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==n(e)&&"[object Function]"===n(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},4670:(e,t,r)=>{"use strict";var i=r(487),n=r(8075),o=r(453)("%ArrayBuffer%",!0),a=n("ArrayBuffer.prototype.byteLength",!0),s=n("Object.prototype.toString"),c=!!o&&!a&&new o(0).slice,u=!!c&&i(c);e.exports=a||u?function(e){if(!e||"object"!=typeof e)return!1;try{return a?a(e):u(e,0),!0}catch(e){return!1}}:o?function(e){return"[object ArrayBuffer]"===s(e)}:function(e){return!1}},9803:(e,t,r)=>{"use strict";if(r(9790)()){var i=BigInt.prototype.valueOf;e.exports=function(e){return null!=e&&"boolean"!=typeof e&&"string"!=typeof e&&"number"!=typeof e&&"symbol"!=typeof e&&"function"!=typeof e&&("bigint"==typeof e||function(e){try{return i.call(e),!0}catch(e){}return!1}(e))}}else e.exports=function(e){return!1}},5128:(e,t,r)=>{"use strict";var i=r(8075),n=i("Boolean.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();e.exports=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(a&&Symbol.toStringTag in e?function(e){try{return n(e),!0}catch(e){return!1}}(e):"[object Boolean]"===o(e))}},9600:e=>{"use strict";var t,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n((function(){throw 42}),null,t)}catch(e){e!==r&&(n=null)}else n=null;var o=/^\s*class\b/,a=function(e){try{var t=i.call(e);return o.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(i.call(e),!0)}catch(e){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var d=document.all;c.call(d)===c.call(document.all)&&(h=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=n?function(e){if(h(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{n(e,null,t)}catch(e){if(e!==r)return!1}return!a(e)&&s(e)}:function(e){if(h(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(a(e))return!1;var t=c.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},2120:(e,t,r)=>{"use strict";var i=Date.prototype.getDay,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"object"==typeof e&&null!==e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object Date]"===n.call(e))}},3802:e=>{"use strict";var t,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;r||(t=function(e){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;t||n||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(n.call(e),o)try{o.call(e)}catch(e){return!0}return e instanceof r}catch(e){}return!1}},1703:(e,t,r)=>{"use strict";var i=Number.prototype.toString,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"number"==typeof e||"object"==typeof e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object Number]"===n.call(e))}},4035:(e,t,r)=>{"use strict";var i,n,o,a,s=r(8075),c=r(9092)();if(c){i=s("Object.prototype.hasOwnProperty"),n=s("RegExp.prototype.exec"),o={};var u=function(){throw o};a={toString:u,valueOf:u},"symbol"==typeof Symbol.toPrimitive&&(a[Symbol.toPrimitive]=u)}var l=s("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;e.exports=c?function(e){if(!e||"object"!=typeof e)return!1;var t=h(e,"lastIndex");if(!(t&&i(t,"value")))return!1;try{n(e,a)}catch(e){return e===o}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===l(e)}},256:e=>{"use strict";var t,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;i||(t=function(e){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;t||o||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(o.call(e),n)try{n.call(e)}catch(e){return!0}return e instanceof i}catch(e){}return!1}},7070:(e,t,r)=>{"use strict";var i=r(8075)("SharedArrayBuffer.prototype.byteLength",!0);e.exports=i?function(e){if(!e||"object"!=typeof e)return!1;try{return i(e),!0}catch(e){return!1}}:function(e){return!1}},4761:(e,t,r)=>{"use strict";var i=String.prototype.valueOf,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"string"==typeof e||"object"==typeof e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object String]"===n.call(e))}},3612:(e,t,r)=>{"use strict";var i=Object.prototype.toString;if(r(4039)()){var n=Symbol.prototype.toString,o=/^Symbol\(.*\)$/;e.exports=function(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==i.call(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&o.test(n.call(e))}(e)}catch(e){return!1}}}else e.exports=function(e){return!1}},7842:e=>{"use strict";var t,r="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;r||(t=function(e){return!1});var n=r?r.prototype.has:null,o=i?i.prototype.has:null;t||n||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(n.call(e,n),o)try{o.call(e,o)}catch(e){return!0}return e instanceof r}catch(e){}return!1}},2648:(e,t,r)=>{"use strict";var i=r(453),n=r(8075),o=i("%WeakSet%",!0),a=n("WeakSet.prototype.has",!0);if(a){var s=n("WeakMap.prototype.has",!0);e.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(a(e,a),s)try{s(e,s)}catch(e){return!0}return e instanceof o}catch(e){}return!1}}else e.exports=function(e){return!1}},4634:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},9292:(e,t,r)=>{var i=r(2203).Stream;e.exports=function(e,t){var r=new i,n=0,o=0,a=!1,s=!1,c=!1,u=0,l=!1,h=(t=t||{}).failures?"failure":"error",d={};function p(e,t){var i=u+1;if(t===i?(void 0!==e&&r.emit.apply(r,["data",e]),u++,i++):d[t]=e,d.hasOwnProperty(i)){var c=d[i];return delete d[i],p(c,i)}o++,n===o&&(s&&(s=!1,r.emit("drain")),a&&m())}function f(e,i,n){c||(l=!0,e&&!t.failures||p(i,n),e&&r.emit.apply(r,[h,e]),l=!1)}function m(e){if(a=!0,r.writable=!1,void 0!==e)return p(e,n);n==o&&(r.readable=!1,r.emit("end"),r.destroy())}return r.writable=!0,r.readable=!0,r.write=function(t){if(a)throw new Error("map stream is not writable");l=!1,n++;try{var r=(i=t,o=n,c=f,e.call(null,i,(function(e,t){c(e,t,o)})));return!(s=!1===r)}catch(e){if(l)throw e;return f(e),!s}var i,o,c},r.end=function(e){a||m(e)},r.destroy=function(){a=c=!0,r.writable=r.readable=s=!1,process.nextTick((function(){r.emit("close")}))},r.pause=function(){s=!0},r.resume=function(){s=!1},r}},3480:(e,t,r)=>{var i=r(6928),n=r(9896),o=parseInt("0777",8);function a(e,t,r,s){"function"==typeof t?(r=t,t={}):t&&"object"==typeof t||(t={mode:t});var c=t.mode,u=t.fs||n;void 0===c&&(c=o),s||(s=null);var l=r||function(){};e=i.resolve(e),u.mkdir(e,c,(function(r){if(!r)return l(null,s=s||e);if("ENOENT"===r.code){if(i.dirname(e)===e)return l(r);a(i.dirname(e),t,(function(r,i){r?l(r,i):a(e,t,l,i)}))}else u.stat(e,(function(e,t){e||!t.isDirectory()?l(r,s):l(null,s)}))}))}e.exports=a.mkdirp=a.mkdirP=a,a.sync=function e(t,r,a){r&&"object"==typeof r||(r={mode:r});var s=r.mode,c=r.fs||n;void 0===s&&(s=o),a||(a=null),t=i.resolve(t);try{c.mkdirSync(t,s),a=a||t}catch(n){if("ENOENT"===n.code)a=e(i.dirname(t),r,a),e(t,r,a);else{var u;try{u=c.statSync(t)}catch(e){throw n}if(!u.isDirectory())throw n}}return a}},6585:e=>{var t=1e3,r=60*t,i=60*r,n=24*i,o=7*n,a=365.25*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*i;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=n)return s(e,o,n,"day");if(o>=i)return s(e,o,i,"hour");if(o>=r)return s(e,o,r,"minute");if(o>=t)return s(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=n)return Math.round(e/n)+"d";if(o>=i)return Math.round(e/i)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},2781:(e,t)=>{var r=function(e){return"_"+e},i=function(e){return e};t.stringify=function(e){return"object"==typeof e&&e&&e.name?t.stringify(e.name,e.protocol,e.subtypes):Array.prototype.concat.apply([],arguments).filter(i).map(r).join(".")},t.parse=function(e){for(var t=e.split("."),r=0;r{var i=r(3843),n=r(7194),o=r(294),a=r(4434),s=r(857),c=function(){};function u(e){return 4===e||"IPv4"===e}e.exports=function(e){e||(e={});var t=new a.EventEmitter,r="number"==typeof e.port?e.port:5353,l=e.type||"udp4",h=e.ip||e.host||("udp4"===l?"224.0.0.251":null),d={address:h,port:r},p={},f=!1,m=null;if(!("udp6"!==l||h&&e.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var g=e.socket||n.createSocket({type:l,reuseAddr:!1!==e.reuseAddr,toString:function(){return l}});g.on("error",(function(e){"EACCES"===e.code||"EADDRINUSE"===e.code?t.emit("error",e):t.emit("warning",e)})),g.on("message",(function(e,r){try{e=i.decode(e)}catch(e){return void t.emit("warning",e)}t.emit("packet",e,r),"query"===e.type&&t.emit("query",e,r),"response"===e.type&&t.emit("response",e,r)})),g.on("listening",(function(){r||(r=d.port=g.address().port),!1!==e.multicast&&(t.update(),m=setInterval(t.update,5e3),g.setMulticastTTL(e.ttl||255),g.setMulticastLoopback(!1!==e.loopback))}));var v=o((function(t){if(!r||!1===e.bind)return t(null);g.once("error",t),g.bind(r,e.bind||e.interface,(function(){g.removeListener("error",t),t(null)}))}));return v((function(e){if(e)return t.emit("error",e);t.emit("ready")})),t.send=function(e,r,n){if("function"==typeof r)return t.send(e,null,r);n||(n=c),r?r.host||r.address||(r.address=d.address):r=d,v((function(t){if(f)return n();if(t)return n(t);var o=i.encode(e);g.send(o,0,o.length,r.port,r.address||r.host,n)}))},t.response=t.respond=function(e,r,n){Array.isArray(e)&&(e={answers:e}),e.type="response",e.flags=(e.flags||0)|i.AUTHORITATIVE_ANSWER,t.send(e,r,n)},t.query=function(e,r,i,n){return"function"==typeof r?t.query(e,null,null,r):"object"==typeof r&&r&&r.port?t.query(e,null,r,i):"function"==typeof i?t.query(e,r,null,i):(n||(n=c),"string"==typeof e&&(e=[{name:e,type:r||"ANY"}]),Array.isArray(e)&&(e={type:"query",questions:e}),e.type="query",void t.send(e,i,n))},t.destroy=function(e){if(e||(e=c),f)return process.nextTick(e);for(var t in f=!0,clearInterval(m),p)try{g.dropMembership(h,t)}catch(e){}p={},g.close(e)},t.update=function(){for(var r=e.interface?[].concat(e.interface):function(){for(var e=s.networkInterfaces(),t=Object.keys(e),r=[],i=0;i{var i=r(9896),n=r(6928),o=r(3480),a=r(3231),s={dir:"persist",stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,continuous:!0,interval:!1,ttl:!1},c=function(e){return"function"==typeof e},u=function(e){if(e)throw e},l=function(){},h=function(e){if(!(this instanceof h))return new h(e);this.data={},this.ttls={},this.changes={},this.setOptions(e)};h.prototype={setOptions:function(e){var t,r={};if(e){for(var i in s)e.hasOwnProperty(i)?r[i]=e[i]:r[i]=s[i];r.dir=this.resolveDir(r.dir),r.ttlDir=r.dir+"-ttl",r.ttl=!!r.ttl&&(t=r.ttl,!isNaN(parseFloat(t))&&isFinite(t)&&r.ttl>0?r.ttl:864e5)}else r=s;c(r.logging)&&(this.log=r.logging,r.logging=!0),this.options=r},init:function(e,t){c(e)&&(t=e,e=null),e&&this.setOptions(e),t=c(t)?t:u;var r=a.defer(),i=[],n=this.options,o={dir:n.dir};return i.push(this.parseDataDir()),n.ttl&&(o.ttlDir=n.ttlDir,i.push(this.parseTTLDir())),n.interval&&n.interval>0&&(this._persistInterval=setInterval(this.persist.bind(this),n.interval)),a.all(i).then((function(){r.resolve(o),t(null,o)}),(function(e){r.reject(e),t(e)})),r.promise},initSync:function(e){e&&this.setOptions(e);var t=this.options;t.logging&&(this.log("options:"),this.log(t.stringify(t))),this.parseDataDirSync(),t.ttl&&this.parseTTLDirSync(),t.interval&&t.interval>0&&(this._persistInterval=setInterval(this.persistSync.bind(this),t.interval))},key:function(e){var t=this.keys();return t.length<=e?null:t[e]},keys:function(){return Object.keys(this.data)},length:function(){return this.keys().length},forEach:function(e){return this.keys().forEach(function(t){e(t,this.data[t])}.bind(this))},values:function(e){e=c(e)?e:l;var t=this.keys().map(function(e){return this.data[e]}.bind(this));return e(t),t},valuesWithKeyMatch:function(e,t){t=c(t)?t:l;var r=(e=e||/.*/)instanceof RegExp?function(t){return e.test(t)}:function(t){return-1!==e.indexOf(t)},i=[];return this.keys().forEach(function(e){r(e)&&i.push(this.data[e])}.bind(this)),t(i),i},setItem:function(e,t,r){r=c(r)?r:u;var i,n=this.options,o="set ("+e+": "+n.stringify(t)+")",s=a.defer(),l=[];this.data[e]=t,n.ttl&&(this.ttls[e]=(new Date).getTime()+n.ttl),i={key:e,value:t,queued:!!n.interval,manual:!n.interval&&!n.continuous};return this.log(o),n.interval||!n.continuous?this.changes[e]={onSuccess:function(){r(null,i),s.resolve(i)},onError:function(e){r(e),s.reject(e)}}:(l.push(this.persistKey(e)),a.all(l).then(function(e){s.resolve(e),r(null,e)}.bind(this),(function(e){s.reject(e),r(e)}))),s.promise},setItemSync:function(e,t){this.data[e]=t,this.options.ttl&&(this.ttls[e]=(new Date).getTime()+this.options.ttl),this.persistKeySync(e),this.log("set ("+e+": "+this.options.stringify(t)+")")},getItem:function(e,t){if(t=c(t)?t:u,!this.isExpired(e))return t(null,this.data[e]),this.data[e];this.log(e+" has expired"),!this.options.interval&&this.options.continuous?this.removeItem(e,(function(){t(null,null)})):t(null,null)},getItemSync:function(e){if(!this.isExpired(e))return this.data[e];this.removeItemSync(e)},removeItem:function(e,t){t=c(t)?t:u;var r=a.defer(),i=[];return i.push(this.removePersistedKey(e)),a.all(i).then(function(){delete this.data[e],delete this.ttls[e],this.log("removed: "+e),t(null,this.data),r.resolve(this.data)}.bind(this),(function(e){t(e),r.reject(e)})),r.promise},removeItemSync:function(e){this.removePersistedKeySync(e),delete this.data[e],delete this.ttls[e],this.log("removed: "+e)},clear:function(e){e=c(e)?e:u;for(var t=a.defer(),r=[],i=this.keys(),n=0;n{var i=r(1566);!function(e){var t;e.create=function(e){return i(e)},e.init=function(r,i){return(t=e.create(r)).init(i)},e.initSync=function(r){return(t=e.create(r)).initSync()},e.key=function(e){return t.key(e)},e.keys=function(){return t.keys()},e.length=function(){return t.length()},e.forEach=function(e){return t.forEach(e)},e.values=function(e){return t.values(e)},e.valuesWithKeyMatch=function(e,r){return t.valuesWithKeyMatch(e,r)},e.setItem=function(e,r,i){return t.setItem(e,r,i)},e.setItemSync=function(e,r){return t.setItemSync(e,r)},e.getItem=function(e,r){return t.getItem(e,r)},e.getItemSync=function(e){return t.getItemSync(e)},e.removeItem=function(e,r){return t.removeItem(e,r)},e.removeItemSync=function(e){return t.removeItemSync(e)},e.clear=function(e){return t.clear(e)},e.clearSync=function(){return t.clearSync()},e.persist=function(e){return t.persist(e)},e.persistSync=function(){return t.persistSync()},e.persistKey=function(e,r){return t.persistKey(e,r)},e.persistKeySync=function(e){return t.persistKeySync(e)}}(e.exports)},8859:(e,t,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=i&&n&&"function"==typeof n.get?n.get:null,a=i&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=s&&c&&"function"==typeof c.get?c.get:null,l=s&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,y=String.prototype.slice,C=String.prototype.replace,S=String.prototype.toUpperCase,E=String.prototype.toLowerCase,_=RegExp.prototype.test,T=Array.prototype.concat,A=Array.prototype.join,I=Array.prototype.slice,D=Math.floor,w="function"==typeof BigInt?BigInt.prototype.valueOf:null,b=Object.getOwnPropertySymbols,U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,R="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===R||"symbol")?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,P=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function B(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||_.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-D(-e):D(e);if(i!==e){var n=String(i),o=y.call(t,n.length+1);return C.call(n,r,"$&_")+"."+C.call(C.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return C.call(t,r,"$&_")}var L=r(8093),x=L.custom,M=j(x)?x:null;function F(e,t,r){var i="double"===(r.quoteStyle||t)?'"':"'";return i+e+i}function k(e){return C.call(String(e),/"/g,""")}function V(e){return!("[object Array]"!==Y(e)||O&&"object"==typeof e&&O in e)}function H(e){return!("[object RegExp]"!==Y(e)||O&&"object"==typeof e&&O in e)}function j(e){if(R)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!U)return!1;try{return U.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,i,n){var s=r||{};if(W(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!W(s,"customInspect")||s.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=s.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return K(t,s);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var S=String(t);return m?B(t,S):S}if("bigint"==typeof t){var _=String(t)+"n";return m?B(t,_):_}var D=void 0===s.depth?5:s.depth;if(void 0===i&&(i=0),i>=D&&D>0&&"object"==typeof t)return V(t)?"[Array]":"[Object]";var b=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=A.call(Array(e.indent+1)," ")}return{base:r,prev:A.call(Array(t+1),r)}}(s,i);if(void 0===n)n=[];else if(q(n,t)>=0)return"[Circular]";function x(t,r,o){if(r&&(n=I.call(n)).push(r),o){var a={depth:s.depth};return W(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),e(t,a,i+1,n)}return e(t,s,i+1,n)}if("function"==typeof t&&!H(t)){var G=function(e){if(e.name)return e.name;var t=v.call(g.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),$=Z(t,x);return"[Function"+(G?": "+G:" (anonymous)")+"]"+($.length>0?" { "+A.call($,", ")+" }":"")}if(j(t)){var ee=R?C.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):U.call(t);return"object"!=typeof t||R?ee:z(ee)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var te="<"+E.call(String(t.nodeName)),re=t.attributes||[],ie=0;ie"}if(V(t)){if(0===t.length)return"[]";var ne=Z(t,x);return b&&!function(e){for(var t=0;t=0)return!1;return!0}(ne)?"["+J(ne,b)+"]":"[ "+A.call(ne,", ")+" ]"}if(function(e){return!("[object Error]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t)){var oe=Z(t,x);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===oe.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(oe,", ")+" }":"{ ["+String(t)+"] "+A.call(T.call("[cause]: "+x(t.cause),oe),", ")+" }"}if("object"==typeof t&&c){if(M&&"function"==typeof t[M]&&L)return L(t,{depth:D-i});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{u.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return a&&a.call(t,(function(e,r){ae.push(x(r,t,!0)+" => "+x(e,t))})),X("Map",o.call(t),ae,b)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var se=[];return l&&l.call(t,(function(e){se.push(x(e,t))})),X("Set",u.call(t),se,b)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Q("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{h.call(e,h)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Q("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return Q("WeakRef");if(function(e){return!("[object Number]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(x(Number(t)));if(function(e){if(!e||"object"!=typeof e||!w)return!1;try{return w.call(e),!0}catch(e){}return!1}(t))return z(x(w.call(t)));if(function(e){return!("[object Boolean]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(f.call(t));if(function(e){return!("[object String]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(x(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t)&&!H(t)){var ce=Z(t,x),ue=P?P(t)===Object.prototype:t instanceof Object||t.constructor===Object,le=t instanceof Object?"":"null prototype",he=!ue&&O&&Object(t)===t&&O in t?y.call(Y(t),8,-1):le?"Object":"",de=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(he||le?"["+A.call(T.call([],he||[],le||[]),": ")+"] ":"");return 0===ce.length?de+"{}":b?de+"{"+J(ce,b)+"}":de+"{ "+A.call(ce,", ")+" }"}return String(t)};var G=Object.prototype.hasOwnProperty||function(e){return e in this};function W(e,t){return G.call(e,t)}function Y(e){return m.call(e)}function q(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,i=e.length;rt.maxStringLength){var r=e.length-t.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return K(y.call(e,0,t.maxStringLength),t)+i}return F(C.call(C.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$),"single",t)}function $(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+S.call(t.toString(16))}function z(e){return"Object("+e+")"}function Q(e){return e+" { ? }"}function X(e,t,r,i){return e+" ("+t+") {"+(i?J(r,i):A.call(r,", "))+"}"}function J(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+A.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=V(e),i=[];if(r){i.length=e.length;for(var n=0;n{e.exports=r(9023).inspect},9211:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},7653:(e,t,r)=>{"use strict";var i=r(8452),n=r(487),o=r(9211),a=r(9394),s=r(6576),c=n(a(),Object);i(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},9394:(e,t,r)=>{"use strict";var i=r(9211);e.exports=function(){return"function"==typeof Object.is?Object.is:i}},6576:(e,t,r)=>{"use strict";var i=r(9394),n=r(8452);e.exports=function(){var e=i();return n(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8875:(e,t,r)=>{"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1093),s=Object.prototype.propertyIsEnumerable,c=!s.call({toString:null},"toString"),u=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},d={$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},p=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!d["$"+e]&&n.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{h(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();i=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),i=a(e),s=t&&"[object String]"===o.call(e),d=[];if(!t&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var f=u&&r;if(s&&e.length>0&&!n.call(e,0))for(var m=0;m0)for(var g=0;g{"use strict";var i=Array.prototype.slice,n=r(1093),o=Object.keys,a=o?function(e){return o(e)}:r(8875),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return n(e)?s(i.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1093:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),i}},8403:(e,t,r)=>{"use strict";var i=r(1189),n=r(1333)(),o=r(8075),a=Object,s=o("Array.prototype.push"),c=o("Object.prototype.propertyIsEnumerable"),u=n?Object.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var r=a(e);if(1===arguments.length)return r;for(var o=1;o{"use strict";var i=r(8452),n=r(487),o=r(8403),a=r(1514),s=r(984),c=n.apply(a()),u=function(e,t){return c(Object,arguments)};i(u,{getPolyfill:a,implementation:o,shim:s}),e.exports=u},1514:(e,t,r)=>{"use strict";var i=r(8403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i{"use strict";var i=r(8452),n=r(1514);e.exports=function(){var e=n();return i(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}},6736:(e,t,r)=>{e.exports=r(1094)},4280:(e,t,r)=>{const i=r(9278),n=r(5753)("pick-port"),o=r(5753)("pick-port:WARN"),a=r(67),s=r(9615);n.log=console.debug.bind(console),o.log=console.warn.bind(console);const c=new Set;function u({type:e,ip:t,port:r,reserveTimeout:i}){const n=`${e}:${t}:${r}`;c.add(n),setTimeout((()=>c.delete(n)),1e3*i)}function l({type:e,ip:t,port:r}){const i=`${e}:${t}:${r}`;return c.has(i)}e.exports=async function({type:e="udp",ip:t="0.0.0.0",minPort:r=1e4,maxPort:c=2e4,reserveTimeout:h=5}={}){n("called with [type:%s, ip:%s, minPort:%d, maxPort:%d, reserveTimeout:%d]",e,t,r,c,h),e=e.toLowerCase();const d=i.isIP(t);if("udp"!==e&&"tcp"!==e)throw new TypeError("invalid type parameter");if(4!==d&&6!==d)throw new TypeError("invalid ip parameter");if("number"!=typeof r||"number"!=typeof c||r>c)throw new TypeError("invalid minPort/maxPort parameter");if("number"!=typeof h)throw new TypeError("invalid reserveTimeout parameter");const p="udp"===e?s:a;let f=Math.floor(Math.random()*(c+1-r))+r,m=c-r+1;for(;--m>=0;)if(++f>c&&(f=r),!l({type:e,ip:t,port:f}))try{return await p({ip:t,port:f,family:d}),u({type:e,ip:t,port:f,reserveTimeout:h}),n("got an available port [type:%s, ip:%s, port:%d]",e,t,f),f}catch(r){if("EADDRINUSE"===r.code){n("port in use [type:%s, ip:%s, port:%d]",e,t,f);continue}throw o("could not get any available port [type:%s, ip:%s, port:%d]: %s",e,t,f,r.toString()),r}throw new Error("no port available")}},67:(e,t,r)=>{const i=r(9278);e.exports=async function({ip:e,port:t}){const r=i.createServer();return new Promise(((i,n)=>{r.unref(),r.on("error",n),r.listen({port:t,exclusive:!0},e,(()=>r.close(i)))}))}},9615:(e,t,r)=>{const i=r(7194);e.exports=async function({ip:e,port:t,family:r}){const n=i.createSocket(4===r?"udp4":"udp6");return new Promise(((r,i)=>{n.unref(),n.on("error",i),n.bind({port:t,exclusive:!0},e,(()=>n.close(r)))}))}},6578:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},3231:e=>{ +return 16==e&&o.length%2!=0&&(o="0"+o),n?o:"0"},n.prototype.negate=function(){var e=o();return n.ZERO.subTo(this,e),e},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t},n.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new f(t):new g(t),this.exp(e,r)},n.prototype.clone=function(){var e=o();return this.copyTo(e),e},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0===this.t)return-1}else{if(1==this.t)return this[0];if(0===this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,i=this.DB-e*this.DB%8,n=0;if(e-- >0)for(i>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<=0;)i<8?(r=(this[e]&(1<>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),128&r&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},n.prototype.toBuffer=function(e){var t=Buffer.from(this.toByteArray());if(!0===e&&0===t[0])t=t.slice(1);else if("number"==typeof e){if(t.length>e){for(var r=0;r0},n.prototype.gte=function(e){return this.compareTo(e)>=0},n.prototype.lt=function(e){return this.compareTo(e)<0},n.prototype.lte=function(e){return this.compareTo(e)<=0},n.prototype.min=function(e){return this.compareTo(e)<0?this:e},n.prototype.max=function(e){return this.compareTo(e)>0?this:e},n.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},n.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},n.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,y,t),t},n.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,C,t),t},n.prototype.not=function(){for(var e=o(),t=0;t=this.t?0!=this.s:!!(this[t]&1<1){var h=o();for(i.sqrTo(s[1],h);c<=l;)s[c]=o(),i.mulTo(h,s[c-2],s[c]),c+=2}var m,v,y=e.t-1,C=!0,S=o();for(n=p(e[y])-1;y>=0;){for(n>=u?m=e[y]>>n-u&l:(m=(e[y]&(1<0&&(m|=e[y-1]>>this.DB+n-u)),c=r;!(1&m);)m>>=1,--c;if((n-=c)<0&&(n+=this.DB,--y),C)s[m].copyTo(a),C=!1;else{for(;c>1;)i.sqrTo(a,S),i.sqrTo(S,a),c-=2;c>0?i.sqrTo(a,S):(v=a,a=S,S=v),i.mulTo(S,s[m],a)}for(;y>=0&&!(e[y]&1<=0?(r.subTo(i,r),t&&o.subTo(s,o),a.subTo(c,a)):(i.subTo(r,i),t&&s.subTo(o,s),c.subTo(a,c))}return 0!=i.compareTo(n.ONE)?n.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},n.prototype.pow=function(e){return this.exp(e,new _)},n.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(n0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},n.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.params=t.hex=void 0;const i=r(2986);function n(e){return new i(e.split(/\s|\n/).join(""),16)}t.hex=n,t.params={1024:{N_length_bits:1024,N:n("\n EEAF0AB9 ADB38DD6 9C33F80A FA8FC5E8 60726187 75FF3C0B 9EA2314C\n 9C256576 D674DF74 96EA81D3 383B4813 D692C6E0 E0D5D8E2 50B98BE4\n 8E495C1D 6089DAD1 5DC7D7B4 6154D6B6 CE8EF4AD 69B15D49 82559B29\n 7BCF1885 C529F566 660E57EC 68EDBC3C 05726CC0 2FD4CBF4 976EAA9A\n FD5138FE 8376435B 9FC61D2F C0EB06E3\n "),g:n("02"),hash:"sha1"},1536:{N_length_bits:1536,N:n("\n 9DEF3CAF B939277A B1F12A86 17A47BBB DBA51DF4 99AC4C80 BEEEA961\n 4B19CC4D 5F4F5F55 6E27CBDE 51C6A94B E4607A29 1558903B A0D0F843\n 80B655BB 9A22E8DC DF028A7C EC67F0D0 8134B1C8 B9798914 9B609E0B\n E3BAB63D 47548381 DBC5B1FC 764E3F4B 53DD9DA1 158BFD3E 2B9C8CF5\n 6EDF0195 39349627 DB2FD53D 24B7C486 65772E43 7D6C7F8C E442734A\n F7CCB7AE 837C264A E3A9BEB8 7F8A2FE9 B8B5292E 5A021FFF 5E91479E\n 8CE7A28C 2442C6F3 15180F93 499A234D CF76E3FE D135F9BB\n "),g:n("02"),hash:"sha1"},2048:{N_length_bits:2048,N:n("\n AC6BDB41 324A9A9B F166DE5E 1389582F AF72B665 1987EE07 FC319294\n 3DB56050 A37329CB B4A099ED 8193E075 7767A13D D52312AB 4B03310D\n CD7F48A9 DA04FD50 E8083969 EDB767B0 CF609517 9A163AB3 661A05FB\n D5FAAAE8 2918A996 2F0B93B8 55F97993 EC975EEA A80D740A DBF4FF74\n 7359D041 D5C33EA7 1D281E44 6B14773B CA97B43A 23FB8016 76BD207A\n 436C6481 F1D2B907 8717461A 5B9D32E6 88F87748 544523B5 24B0D57D\n 5EA77A27 75D2ECFA 032CFBDB F52FB378 61602790 04E57AE6 AF874E73\n 03CE5329 9CCC041C 7BC308D8 2A5698F3 A8D0C382 71AE35F8 E9DBFBB6\n 94B5C803 D89F7AE4 35DE236D 525F5475 9B65E372 FCD68EF2 0FA7111F\n 9E4AFF73\n "),g:n("02"),hash:"sha256"},3072:{N_length_bits:3072,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},hap:{N_length_bits:3072,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha512"},4096:{N_length_bits:4096,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34063199\n FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},6244:{N_length_bits:6244,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DCC4024 FFFFFFFF FFFFFFFF\n "),g:n("05"),hash:"sha256"},8192:{N_length_bits:8192,N:n("\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DBE1159 74A3926F 12FEE5E4 38777CB6 A932DF8C D8BEC4D0 73B931BA\n 3BC832B6 8D9DD300 741FA7BF 8AFC47ED 2576F693 6BA42466 3AAB639C\n 5AE4F568 3423B474 2BF1C978 238F16CB E39D652D E3FDB8BE FC848AD9\n 22222E04 A4037C07 13EB57A8 1A23F0C7 3473FC64 6CEA306B 4BCBC886\n 2F8385DD FA9D4B7F A2C087E8 79683303 ED5BDD3A 062B3CF5 B3A278A6\n 6D2A13F8 3F44F82D DF310EE0 74AB6A36 4597E899 A0255DC1 64F31CC5\n 0846851D F9AB4819 5DED7EA1 B1D510BD 7EE74D73 FAF36BC3 1ECFA268\n 359046F4 EB879F92 4009438B 481C6CD7 889A002E D5EE382B C9190DA6\n FC026E47 9558E447 5677E9AA 9E3050E2 765694DF C81F56E8 80B96E71\n 60C980DD 98EDD3DF FFFFFFFF FFFFFFFF\n "),g:n("13"),hash:"sha256"}},t.default=t.params},4618:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SrpServer=t.SrpClient=t.SRP=void 0;const n=i(r(6982)),o=i(r(2613)),a=r(2986),s=r(1799),c=new a(0,10);function u(e,t){if(!e)throw new Error(t||"assertion")}function l(e,t="arg"){u(Buffer.isBuffer(e),`Type error: ${t} must be a buffer`)}function h(e,t="arg"){u(e instanceof a,`Type error: ${t} must be a BigInteger`)}function d(e,t){l(e,"n");const r=t-e.length;u(r>-1,"Negative padding. Very uncomfortable.");const i=Buffer.alloc(t);return i.fill(0,0,r),e.copy(i,r),o.default.strictEqual(i.length,t),i}function p(e,t){h(e);const r=e.toString(16).length%2!=0?"0"+e.toString(16):e.toString(16);return d(Buffer.from(r,"hex"),t.N_length_bits/8)}function f(e,t,r,i){l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)");const o=n.default.createHash(e.hash).update(Buffer.concat([r,Buffer.from(":"),i])).digest(),s=n.default.createHash(e.hash).update(t).update(o).digest();return new a(s)}class g{static computeVerifier(e,t,r,i){l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)");return e.g.modPow(f(e,t,r,i),e.N).toBuffer(e.N_length_bits/8)}static genKey(e=32,t){if("number"!=typeof e&&(t=e,e=32),!t)return new Promise(((t,r)=>g.genKey(e,((e,i)=>e?r(e):t(i)))));n.default.randomBytes(e,((e,r)=>e?t(e,null):t(null,r)))}}function m(e){const t=n.default.createHash(e.hash).update(p(e.N,e)).update(p(e.g,e)).digest();return new a(t)}function v(e,t,r){l(t,"A"),l(r,"B");const i=n.default.createHash(e.hash).update(d(t,e.N_length_bits/8)).update(d(r,e.N_length_bits/8)).digest();return new a(i)}function y(e,t){return l(t,"S"),"sha1"===e.hash?Buffer.concat([n.default.createHash(e.hash).update(t).update(Buffer.from([0,0,0,0])).digest(),n.default.createHash(e.hash).update(t).update(Buffer.from([0,0,0,1])).digest()]):n.default.createHash(e.hash).update(t).digest()}function C(e,t,r,i,o,a){if(arguments.length>4){l(t,"identity (I)"),l(r,"salt (s)"),l(i,"client public key (A)"),l(o,"server public key (B)"),l(a,"session key (K)");const s=n.default.createHash(e.hash).update(e.N.toBuffer(!0)).digest(),c=n.default.createHash(e.hash).update(e.g.toBuffer(!0)).digest();for(let e=0;e=0||e.N.compareTo(n)<=0)throw new Error('invalid server-supplied "B", must be 1..N-1');return n.subtract(t.multiply(e.g.modPow(r,e.N))).modPow(i.add(o.multiply(r)),e.N).mod(e.N).toBuffer(e.N_length_bits/8)}(this._params,this._k,this._x,this._a,new a(e),t);this._K=y(this._params,r),this._u=t,this._S=r,this._B=e,this._I&&this._s?this._M1=C(this._params,this._I,this._s,this._A,this._B,this._K):this._M1=C(this._params,this._A,this._B,this._S),this._M2=S(this._params,this._A,this._M1,this._K)}computeM1(){if(void 0===this._M1)throw new Error("incomplete protocol");return this._M1}checkM2(e){if(!E(this._M2,e))throw new Error("server is not authentic")}computeK(){if(void 0===this._K)throw new Error("incomplete protocol");return this._K}};t.SrpServer=class{constructor(e,t,r,i,n){if(this._params=e,this._k=m(e),arguments.length>3)l(t,"salt (salt)"),l(r,"identity (I)"),l(i,"password (P)"),l(n,"secret2"),this._b=new a(n),this._v=new a(g.computeVerifier(e,t,r,i)),this._I=r,this._s=t;else if(t instanceof Buffer){const e=t;[n,t,r,i]=[r,void 0,void 0,void 0],l(e,"verifier (v)"),l(n,"secret2"),this._b=new a(n),this._v=new a(e)}else{const s=t;[n,t,r,i]=[r,void 0,void 0,void 0],(0,o.default)(s.username instanceof Buffer||"string"==typeof s.username,"identity.username (I) must be a string or Buffer"),l(s.salt,"identity.salt (s)"),(0,o.default)("password"in s||"verifier"in s,"identity requires a password or verifier"),"verifier"in s?l(s.verifier,"identity.verifier (v)"):(0,o.default)(s.password instanceof Buffer||"string"==typeof s.password,"identity.password (p) must be a string or Buffer"),l(n,"secret2");const c="string"==typeof s.username?Buffer.from(s.username):s.username;this._b=new a(n),this._v=new a("verifier"in s?s.verifier:g.computeVerifier(e,s.salt,c,"string"==typeof s.password?Buffer.from(s.password):s.password)),this._I=c,this._s=s.salt}this._B=function(e,t,r,i){return h(r),h(t),h(i),t.multiply(r).add(e.g.modPow(i,e.N)).mod(e.N).toBuffer(e.N_length_bits/8)}(e,this._k,this._v,this._b)}computeB(){return this._B}setA(e){const t=v(this._params,e,this._B),r=function(e,t,r,i,n){if(h(t),h(r),h(i),h(n),c.compareTo(r)>=0||e.N.compareTo(r)<=0)throw new Error('invalid client-supplied "A", must be 1..N-1');return r.multiply(t.modPow(n,e.N)).modPow(i,e.N).mod(e.N).toBuffer(e.N_length_bits/8)}(this._params,this._v,new a(e),this._b,t);this._K=y(this._params,r),this._u=t,this._S=r,this._I&&this._s?this._M1=C(this._params,this._I,this._s,e,this._B,this._K):this._M1=C(this._params,e,this._B,this._S),this._M2=S(this._params,e,this._M1,this._K)}checkM1(e){if(void 0===this._M1)throw new Error("incomplete protocol");if(!E(this._M1,e))throw new Error("client did not use the same password")}computeK(){if(void 0===this._K)throw new Error("incomplete protocol");return this._K}computeM2(){if(void 0===this._M2)throw new Error("incomplete protocol");return this._M2}}},2682:(e,t,r)=>{"use strict";var i=r(9600),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){if(!i(t))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===n.call(e)?function(e,t,r){for(var i=0,n=e.length;i{"use strict";var i=r(2203);e.exports=function e(t){if(Array.isArray(t)){var r=0,n=t.length;return e((function(e){return r{"use strict";var t=Object.prototype.toString,r=Math.max,i=function(e,t){for(var r=[],i=0;i{"use strict";var i=r(9353);e.exports=Function.prototype.bind||i},4462:e=>{"use strict";var t=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(e){r=null}t.functionsHaveConfigurableNames=function(){if(!t()||!r)return!1;var e=r((function(){}),"name");return!!e&&!!e.configurable};var i=Function.prototype.bind;t.boundFunctionsHaveNames=function(){return t()&&"function"==typeof i&&""!==function(){}.bind().name},e.exports=t},6871:(e,t,r)=>{"use strict";const{Buffer:i}=r(181),{createHash:n,createHmac:o}=r(6982),a={},s=e=>{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=a[e];return void 0===t&&(t=n(e).digest().length,a[e]=t),t}}},c=(e,t,r,n)=>{const a=i.isBuffer(r)?r:i.from(r),s=n&&n.length?i.from(n):i.alloc(t,0);return o(e,s).update(a).digest()},u=(e,t,r,n,a)=>{const s=i.isBuffer(a)?a:i.from(a||""),c=s.length,u=Math.ceil(n/t);if(u>255)throw new Error(`OKM length ${n} is too long for ${e} hash`);const l=i.alloc(t*u+c+1);for(let i=1,n=0,a=0;i<=u;++i)s.copy(l,a),l[a+c]=i,o(e,r).update(l.slice(n,a+c+1)).digest().copy(l,a),n=a,a+=t;return l.slice(0,n)};function l(e,t,{salt:r="",info:i="",hash:n="SHA-256"}={}){n=n.toLowerCase().replace("-","");const o=s(n),a=c(n,o,e,r);return u(n,o,a,t,i)}Object.defineProperties(l,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:s},extract:{configurable:!1,enumerable:!1,writable:!1,value:c},expand:{configurable:!1,enumerable:!1,writable:!1,value:u}}),e.exports=l},453:(e,t,r)=>{"use strict";var i,n=r(9383),o=r(1237),a=r(9290),s=r(9538),c=r(8068),u=r(9675),l=r(5345),h=Function,d=function(e){try{return h('"use strict"; return ('+e+").constructor;")()}catch(e){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(e){p=null}var f=function(){throw new u},g=p?function(){try{return f}catch(e){try{return p(arguments,"callee").get}catch(e){return f}}}():f,m=r(4039)(),v=r(24)(),y=Object.getPrototypeOf||(v?function(e){return e.__proto__}:null),C={},S="undefined"!=typeof Uint8Array&&y?y(Uint8Array):i,E={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":m&&y?y([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":C,"%AsyncGenerator%":C,"%AsyncGeneratorFunction%":C,"%AsyncIteratorPrototype%":C,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":C,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&y?y(y([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&m&&y?y((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&m&&y?y((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&y?y(""[Symbol.iterator]()):i,"%Symbol%":m?Symbol:i,"%SyntaxError%":c,"%ThrowTypeError%":g,"%TypedArray%":S,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":l,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet};if(y)try{null.error}catch(e){var _=y(y(e));E["%Error.prototype%"]=_}var T=function e(t){var r;if("%AsyncFunction%"===t)r=d("async function () {}");else if("%GeneratorFunction%"===t)r=d("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=d("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&y&&(r=y(n.prototype))}return E[t]=r,r},A={__proto__:null,"%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"]},I=r(6743),D=r(9957),w=I.call(Function.call,Array.prototype.concat),b=I.call(Function.apply,Array.prototype.splice),U=I.call(Function.call,String.prototype.replace),R=I.call(Function.call,String.prototype.slice),O=I.call(Function.call,RegExp.prototype.exec),N=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,B=function(e,t){var r,i=e;if(D(A,i)&&(i="%"+(r=A[i])[0]+"%"),D(E,i)){var n=E[i];if(n===C&&(n=T(i)),void 0===n&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new c("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=R(e,0,1),r=R(e,-1);if("%"===t&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new c("invalid intrinsic syntax, expected opening `%`");var i=[];return U(e,N,(function(e,t,r,n){i[i.length]=r?U(n,P,"$1"):t||e})),i}(e),i=r.length>0?r[0]:"",n=B("%"+i+"%",t),o=n.name,a=n.value,s=!1,l=n.alias;l&&(i=l[0],b(r,w([0,1],l)));for(var h=1,d=!0;h=r.length){var v=p(a,f);a=(d=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:a[f]}else d=D(a,f),a=a[f];d&&!s&&(E[o]=a)}}return a}},5795:(e,t,r)=>{"use strict";var i=r(453)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},135:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MANUFACTURER_CTYPE=t.LOGS_CTYPE=t.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE=t.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE=t.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE=t.IDENTIFY_CTYPE=t.HUE_CTYPE=t.HEATING_THRESHOLD_CTYPE=t.CURRENT_TEMPERATURE_CTYPE=t.CURRENT_RELATIVE_HUMIDITY_CTYPE=t.CURRENT_LOCK_MECHANISM_STATE_CTYPE=t.CURRENT_DOOR_STATE_CTYPE=t.CONTACT_SENSOR_STATE_CTYPE=t.COOLING_THRESHOLD_CTYPE=t.BATTERY_LEVEL_CTYPE=t.BRIGHTNESS_CTYPE=t.AUDIO_FEEDBACK_CTYPE=t.ADMIN_ONLY_ACCESS_CTYPE=t.ALARM_TARGET_STATE_CTYPE=t.ALARM_CURRENT_STATE_CTYPE=t.TEMPERATURE_SENSOR_STYPE=t.HUMIDITY_SENSOR_STYPE=t.MOTION_SENSOR_STYPE=t.CONTACT_SENSOR_STYPE=t.OCCUPANCY_SENSOR_STYPE=t.WINDOW_COVERING_STYPE=t.ALARM_STYPE=t.LOCK_MANAGEMENT_STYPE=t.LOCK_MECHANISM_STYPE=t.OUTLET_STYPE=t.FAN_STYPE=t.ACCESSORY_INFORMATION_STYPE=t.GARAGE_DOOR_OPENER_STYPE=t.THERMOSTAT_STYPE=t.SWITCH_STYPE=t.LIGHTBULB_STYPE=t.PROGRAMMABLE_SWITCH_TCTYPE=t.WINDOW_COVERING_TCTYPE=t.WINDOW_TCTYPE=t.DOOR_TCTYPE=t.ALARM_SYSTEM_TCTYPE=t.SENSOR_TCTYPE=t.THERMOSTAT_TCTYPE=t.SWITCH_TCTYPE=t.OUTLET_TCTYPE=t.DOOR_LOCK_TCTYPE=t.LIGHTBULB_TCTYPE=t.GARAGE_DOOR_OPENER_TCTYPE=t.FAN_TCTYPE=t.OTHER_TCTYPE=void 0,t.TARGETHEATINGCOOLING_CTYPE=t.CURRENTHEATINGCOOLING_CTYPE=t.WINDOW_COVERING_OPERATION_STATE_CTYPE=t.WINDOW_COVERING_CURRENT_POSITION_CTYPE=t.WINDOW_COVERING_TARGET_POSITION_CTYPE=t.VERSION_CTYPE=t.TEMPERATURE_UNITS_CTYPE=t.TARGET_TEMPERATURE_CTYPE=t.TARGET_RELATIVE_HUMIDITY_CTYPE=t.TARGET_LOCK_MECHANISM_STATE_CTYPE=t.TARGET_DOORSTATE_CTYPE=t.STATUS_FAULT_CTYPE=t.STATUS_LOW_BATTERY_CTYPE=t.FIRMWARE_REVISION_CTYPE=t.SERIAL_NUMBER_CTYPE=t.SATURATION_CTYPE=t.ROTATION_SPEED_CTYPE=t.ROTATION_DIRECTION_CTYPE=t.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE=t.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE=t.POWER_STATE_CTYPE=t.OCCUPANCY_DETECTED_CTYPE=t.OUTLET_IN_USE_CTYPE=t.OBSTRUCTION_DETECTED_CTYPE=t.NAME_CTYPE=t.MOTION_DETECTED_CTYPE=t.MODEL_CTYPE=void 0;var r="000000",i="-0000-1000-8000-0026BB765291";t.OTHER_TCTYPE=1,t.FAN_TCTYPE=3,t.GARAGE_DOOR_OPENER_TCTYPE=4,t.LIGHTBULB_TCTYPE=5,t.DOOR_LOCK_TCTYPE=6,t.OUTLET_TCTYPE=7,t.SWITCH_TCTYPE=8,t.THERMOSTAT_TCTYPE=9,t.SENSOR_TCTYPE=10,t.ALARM_SYSTEM_TCTYPE=11,t.DOOR_TCTYPE=12,t.WINDOW_TCTYPE=13,t.WINDOW_COVERING_TCTYPE=14,t.PROGRAMMABLE_SWITCH_TCTYPE=15,t.LIGHTBULB_STYPE=r+"43"+i,t.SWITCH_STYPE=r+"49"+i,t.THERMOSTAT_STYPE=r+"4A"+i,t.GARAGE_DOOR_OPENER_STYPE=r+"41"+i,t.ACCESSORY_INFORMATION_STYPE=r+"3E"+i,t.FAN_STYPE=r+"40"+i,t.OUTLET_STYPE=r+"47"+i,t.LOCK_MECHANISM_STYPE=r+"45"+i,t.LOCK_MANAGEMENT_STYPE=r+"44"+i,t.ALARM_STYPE=r+"7E"+i,t.WINDOW_COVERING_STYPE=r+"8C"+i,t.OCCUPANCY_SENSOR_STYPE=r+"86"+i,t.CONTACT_SENSOR_STYPE=r+"80"+i,t.MOTION_SENSOR_STYPE=r+"85"+i,t.HUMIDITY_SENSOR_STYPE=r+"82"+i,t.TEMPERATURE_SENSOR_STYPE=r+"8A"+i,t.ALARM_CURRENT_STATE_CTYPE=r+"66"+i,t.ALARM_TARGET_STATE_CTYPE=r+"67"+i,t.ADMIN_ONLY_ACCESS_CTYPE=r+"01"+i,t.AUDIO_FEEDBACK_CTYPE=r+"05"+i,t.BRIGHTNESS_CTYPE=r+"08"+i,t.BATTERY_LEVEL_CTYPE=r+"68"+i,t.COOLING_THRESHOLD_CTYPE=r+"0D"+i,t.CONTACT_SENSOR_STATE_CTYPE=r+"6A"+i,t.CURRENT_DOOR_STATE_CTYPE=r+"0E"+i,t.CURRENT_LOCK_MECHANISM_STATE_CTYPE=r+"1D"+i,t.CURRENT_RELATIVE_HUMIDITY_CTYPE=r+"10"+i,t.CURRENT_TEMPERATURE_CTYPE=r+"11"+i,t.HEATING_THRESHOLD_CTYPE=r+"12"+i,t.HUE_CTYPE=r+"13"+i,t.IDENTIFY_CTYPE=r+"14"+i,t.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE=r+"1A"+i,t.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE=r+"19"+i,t.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE=r+"1C"+i,t.LOGS_CTYPE=r+"1F"+i,t.MANUFACTURER_CTYPE=r+"20"+i,t.MODEL_CTYPE=r+"21"+i,t.MOTION_DETECTED_CTYPE=r+"22"+i,t.NAME_CTYPE=r+"23"+i,t.OBSTRUCTION_DETECTED_CTYPE=r+"24"+i,t.OUTLET_IN_USE_CTYPE=r+"26"+i,t.OCCUPANCY_DETECTED_CTYPE=r+"71"+i,t.POWER_STATE_CTYPE=r+"25"+i,t.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE=r+"73"+i,t.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE=r+"74"+i,t.ROTATION_DIRECTION_CTYPE=r+"28"+i,t.ROTATION_SPEED_CTYPE=r+"29"+i,t.SATURATION_CTYPE=r+"2F"+i,t.SERIAL_NUMBER_CTYPE=r+"30"+i,t.FIRMWARE_REVISION_CTYPE=r+"52"+i,t.STATUS_LOW_BATTERY_CTYPE=r+"79"+i,t.STATUS_FAULT_CTYPE=r+"77"+i,t.TARGET_DOORSTATE_CTYPE=r+"32"+i,t.TARGET_LOCK_MECHANISM_STATE_CTYPE=r+"1E"+i,t.TARGET_RELATIVE_HUMIDITY_CTYPE=r+"34"+i,t.TARGET_TEMPERATURE_CTYPE=r+"35"+i,t.TEMPERATURE_UNITS_CTYPE=r+"36"+i,t.VERSION_CTYPE=r+"37"+i,t.WINDOW_COVERING_TARGET_POSITION_CTYPE=r+"7C"+i,t.WINDOW_COVERING_CURRENT_POSITION_CTYPE=r+"6D"+i,t.WINDOW_COVERING_OPERATION_STATE_CTYPE=r+"72"+i,t.CURRENTHEATINGCOOLING_CTYPE=r+"0F"+i,t.TARGETHEATINGCOOLING_CTYPE=r+"33"+i},3103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.init=t.HAPLibraryVersion=t.LegacyTypes=t.uuid=t.AccessoryLoader=void 0;var i=r(1635);r(3476),r(8086);var n=i.__importDefault(r(5753)),o=r(4299);t.AccessoryLoader=i.__importStar(r(1370)),t.uuid=i.__importStar(r(2997)),i.__exportStar(r(4299),t),i.__exportStar(r(5745),t),i.__exportStar(r(3186),t),i.__exportStar(r(5876),t),i.__exportStar(r(9826),t),i.__exportStar(r(1370),t),i.__exportStar(r(8591),t),i.__exportStar(r(4910),t),i.__exportStar(r(589),t),i.__exportStar(r(9948),t),i.__exportStar(r(1068),t),i.__exportStar(r(5579),t),i.__exportStar(r(9621),t),i.__exportStar(r(7739),t),i.__exportStar(r(3314),t),i.__exportStar(r(8073),t),i.__exportStar(r(2175),t),i.__exportStar(r(1579),t),i.__exportStar(r(9593),t),i.__exportStar(r(4310),t),t.LegacyTypes=i.__importStar(r(135));var a=(0,n.default)("HAP-NodeJS:Advertiser");function s(){return r(8389).version}t.HAPLibraryVersion=s,a("Initializing HAP-NodeJS v%s ...",s()),t.init=function(e){console.log("DEPRECATED: The need to manually initialize HAP (by calling the init method) was removed. If you want to set a custom storage path location, please ust HAPStorage.setCustomStoragePath directly. This method will be removed in the next major update!"),e&&o.HAPStorage.setCustomStoragePath(e)};i.__importStar(r(1647)),i.__importStar(r(651))},8602:(e,t)=>{"use strict";var r,i,n,o;Object.defineProperty(t,"__esModule",{value:!0}),t.HAPMimeTypes=t.PairingStates=t.PairMethods=t.TLVValues=t.consideredTrue=void 0,t.consideredTrue=function(e){return!!e&&("true"===e||"1"===e)},function(e){e[e.REQUEST_TYPE=0]="REQUEST_TYPE",e[e.METHOD=0]="METHOD",e[e.USERNAME=1]="USERNAME",e[e.IDENTIFIER=1]="IDENTIFIER",e[e.SALT=2]="SALT",e[e.PUBLIC_KEY=3]="PUBLIC_KEY",e[e.PASSWORD_PROOF=4]="PASSWORD_PROOF",e[e.ENCRYPTED_DATA=5]="ENCRYPTED_DATA",e[e.SEQUENCE_NUM=6]="SEQUENCE_NUM",e[e.STATE=6]="STATE",e[e.ERROR_CODE=7]="ERROR_CODE",e[e.RETRY_DELAY=8]="RETRY_DELAY",e[e.CERTIFICATE=9]="CERTIFICATE",e[e.PROOF=10]="PROOF",e[e.SIGNATURE=10]="SIGNATURE",e[e.PERMISSIONS=11]="PERMISSIONS",e[e.FRAGMENT_DATA=12]="FRAGMENT_DATA",e[e.FRAGMENT_LAST=13]="FRAGMENT_LAST",e[e.SEPARATOR=255]="SEPARATOR"}(r||(t.TLVValues=r={})),function(e){e[e.PAIR_SETUP=0]="PAIR_SETUP",e[e.PAIR_SETUP_WITH_AUTH=1]="PAIR_SETUP_WITH_AUTH",e[e.PAIR_VERIFY=2]="PAIR_VERIFY",e[e.ADD_PAIRING=3]="ADD_PAIRING",e[e.REMOVE_PAIRING=4]="REMOVE_PAIRING",e[e.LIST_PAIRINGS=5]="LIST_PAIRINGS"}(i||(t.PairMethods=i={})),function(e){e[e.M1=1]="M1",e[e.M2=2]="M2",e[e.M3=3]="M3",e[e.M4=4]="M4",e[e.M5=5]="M5",e[e.M6=6]="M6"}(n||(t.PairingStates=n={})),function(e){e.PAIRING_TLV8="application/pairing+tlv8",e.HAP_JSON="application/hap+json",e.IMAGE_JPEG="image/jpeg"}(o||(t.HAPMimeTypes=o={}))},5745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Accessory=t.AccessoryEventTypes=t.MDNSAdvertiser=t.CharacteristicWarningType=t.Categories=void 0;var i,n,o,a,s,c=r(1635),u=c.__importDefault(r(2613)),l=c.__importDefault(r(6982)),h=c.__importDefault(r(5753)),d=r(4434),p=c.__importDefault(r(9278)),f=r(310),g=r(8591),m=r(9826),v=r(1068),y=r(589),C=r(5579),S=r(292),E=r(2738),_=r(5876),T=r(9621),A=r(8066),I=c.__importStar(r(2997)),D=r(2997),w=(0,h.default)("HAP-NodeJS:Accessory");!function(e){e[e.OTHER=1]="OTHER",e[e.BRIDGE=2]="BRIDGE",e[e.FAN=3]="FAN",e[e.GARAGE_DOOR_OPENER=4]="GARAGE_DOOR_OPENER",e[e.LIGHTBULB=5]="LIGHTBULB",e[e.DOOR_LOCK=6]="DOOR_LOCK",e[e.OUTLET=7]="OUTLET",e[e.SWITCH=8]="SWITCH",e[e.THERMOSTAT=9]="THERMOSTAT",e[e.SENSOR=10]="SENSOR",e[e.ALARM_SYSTEM=11]="ALARM_SYSTEM",e[e.SECURITY_SYSTEM=11]="SECURITY_SYSTEM",e[e.DOOR=12]="DOOR",e[e.WINDOW=13]="WINDOW",e[e.WINDOW_COVERING=14]="WINDOW_COVERING",e[e.PROGRAMMABLE_SWITCH=15]="PROGRAMMABLE_SWITCH",e[e.RANGE_EXTENDER=16]="RANGE_EXTENDER",e[e.CAMERA=17]="CAMERA",e[e.IP_CAMERA=17]="IP_CAMERA",e[e.VIDEO_DOORBELL=18]="VIDEO_DOORBELL",e[e.AIR_PURIFIER=19]="AIR_PURIFIER",e[e.AIR_HEATER=20]="AIR_HEATER",e[e.AIR_CONDITIONER=21]="AIR_CONDITIONER",e[e.AIR_HUMIDIFIER=22]="AIR_HUMIDIFIER",e[e.AIR_DEHUMIDIFIER=23]="AIR_DEHUMIDIFIER",e[e.APPLE_TV=24]="APPLE_TV",e[e.HOMEPOD=25]="HOMEPOD",e[e.SPEAKER=26]="SPEAKER",e[e.AIRPORT=27]="AIRPORT",e[e.SPRINKLER=28]="SPRINKLER",e[e.FAUCET=29]="FAUCET",e[e.SHOWER_HEAD=30]="SHOWER_HEAD",e[e.TELEVISION=31]="TELEVISION",e[e.TARGET_CONTROLLER=32]="TARGET_CONTROLLER",e[e.ROUTER=33]="ROUTER",e[e.AUDIO_RECEIVER=34]="AUDIO_RECEIVER",e[e.TV_SET_TOP_BOX=35]="TV_SET_TOP_BOX",e[e.TV_STREAMING_STICK=36]="TV_STREAMING_STICK"}(i||(t.Categories=i={})),function(e){e.SLOW_WRITE="slow-write",e.TIMEOUT_WRITE="timeout-write",e.SLOW_READ="slow-read",e.TIMEOUT_READ="timeout-read",e.WARN_MESSAGE="warn-message",e.ERROR_MESSAGE="error-message",e.DEBUG_MESSAGE="debug-message"}(n||(t.CharacteristicWarningType=n={})),function(e){e.CIAO="ciao",e.BONJOUR="bonjour-hap",e.AVAHI="avahi",e.RESOLVED="resolved"}(o||(t.MDNSAdvertiser=o={})),function(e){e[e.REGULAR_REQUEST=0]="REGULAR_REQUEST",e[e.TIMED_WRITE_AUTHENTICATED=1]="TIMED_WRITE_AUTHENTICATED",e[e.TIMED_WRITE_REJECTED=2]="TIMED_WRITE_REJECTED"}(a||(a={})),function(e){e.IDENTIFY="identify",e.LISTENING="listening",e.ADVERTISED="advertised",e.SERVICE_CONFIGURATION_CHANGE="service-configurationChange",e.SERVICE_CHARACTERISTIC_CHANGE="service-characteristic-change",e.PAIRED="paired",e.UNPAIRED="unpaired",e.CHARACTERISTIC_WARNING="characteristic-warning"}(s||(t.AccessoryEventTypes=s={}));var b=function(e){function t(t,r){var i=e.call(this)||this;return i.displayName=t,i.UUID=r,i.aid=null,i._isBridge=!1,i.bridged=!1,i.bridgedAccessories=[],i.reachable=!0,i.category=1,i.services=[],i.shouldPurgeUnusedIDs=!0,i.initialized=!1,i.controllers={},i._setupID=null,i.controllerStorage=new S.ControllerStorage(i),i.lastAccessoriesRequest=0,i.getPrimaryAccessory=function(){return i.bridged?i.bridge:i},(0,u.default)(t,"Accessories must be created with a non-empty displayName."),(0,u.default)(r,"Accessories must be created with a valid UUID."),(0,u.default)(I.isValid(r),"UUID '"+r+"' is not a valid UUID. Try using the provided 'generateUUID' function to create a valid UUID from any arbitrary string, like a serial number."),i.addService(_.Service.AccessoryInformation).setCharacteristic(m.Characteristic.Name,t),i.getService(_.Service.AccessoryInformation).getCharacteristic(m.Characteristic.Identify).on("set",(function(e,t){if(e){i.identificationRequest(!0,t)}})),i}return c.__extends(t,e),t.prototype.identificationRequest=function(e,t){w("[%s] Identification request",this.displayName),this.listeners("identify").length>0?this.emit("identify",e,t):(w("[%s] Identification request ignored; no listeners to 'identify' event",this.displayName),t())},t.prototype.addService=function(e){for(var t,r,i=[],n=1;n=100)throw new Error("Cannot add more than 100 services to a single accessory!");return this.services.push(o),o.isPrimaryService&&(void 0!==this.primaryService&&(this.primaryService.isPrimaryService=!1),this.primaryService=o),this.bridged?this.emit("service-configurationChange",{service:o}):this.enqueueConfigurationUpdate(),this.setupServiceEventHandlers(o),o},t.prototype.setPrimaryService=function(e){e.setPrimaryService()},t.prototype.removeService=function(e){var t=this.services.indexOf(e);t>=0&&(this.services.splice(t,1),this.primaryService===e&&(this.primaryService=void 0),this.removeLinkedService(e),this.bridged?this.emit("service-configurationChange",{service:e}):this.enqueueConfigurationUpdate(),e.removeAllListeners())},t.prototype.removeLinkedService=function(e){var t,r;try{for(var i=c.__values(this.services),n=i.next();!n.done;n=i.next()){n.value.removeLinkedService(e)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getService=function(e){var t,r;try{for(var i=c.__values(this.services),n=i.next();!n.done;n=i.next()){var o=n.value;if("string"==typeof e&&(o.displayName===e||o.name===e||o.subtype===e))return o;if("function"==typeof e&&(o instanceof e||e.UUID===o.UUID))return o}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getServiceById=function(e,t){var r,i;try{for(var n=c.__values(this.services),o=n.next();!o.done;o=n.next()){var a=o.value;if("string"==typeof e&&(a.displayName===e||a.name===e)&&a.subtype===t)return a;if("function"==typeof e&&(a instanceof e||e.UUID===a.UUID)&&a.subtype===t)return a}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},t.prototype.updateReachability=function(e){if(!this.bridged)throw new Error("Cannot update reachability on non-bridged accessory!");this.reachable=e,w("Reachability update is no longer being supported.")},t.prototype.addBridgedAccessory=function(e,t){var r=this;if(void 0===t&&(t=!1),e._isBridge||e===this)throw new Error("Illegal state: either trying to bridge a bridge or trying to bridge itself!");if(e.initialized)throw new Error("Tried to bridge an accessory which was already published once!");if(null!=e.bridge)throw new Error("Tried to bridge "+e.displayName+" while it was already bridged by "+e.bridge.displayName);if(this.bridgedAccessories.length>=149)throw new Error("Cannot Bridge more than 149 Accessories");return e.on("service-characteristic-change",(function(t){return r.handleCharacteristicChangeEvent(e,t.service,t)})),e.on("service-configurationChange",this.enqueueConfigurationUpdate.bind(this)),e.on("characteristic-warning",this.handleCharacteristicWarning.bind(this)),e.bridged=!0,e.bridge=this,this.bridgedAccessories.push(e),this.controllerStorage.linkAccessory(e),t||this.enqueueConfigurationUpdate(),e},t.prototype.addBridgedAccessories=function(e){var t,r;try{for(var i=c.__values(e),n=i.next();!n.done;n=i.next()){var o=n.value;this.addBridgedAccessory(o,!0)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.enqueueConfigurationUpdate()},t.prototype.removeBridgedAccessory=function(e,t){void 0===t&&(t=!1);var r=this.bridgedAccessories.indexOf(e);if(-1===r)throw new Error("Cannot find the bridged Accessory to remove.");this.bridgedAccessories.splice(r,1),e.bridged=!1,e.bridge=void 0,e.removeAllListeners(),t||this.enqueueConfigurationUpdate()},t.prototype.removeBridgedAccessories=function(e){var t,r;try{for(var i=c.__values(e),n=i.next();!n.done;n=i.next()){var o=n.value;this.removeBridgedAccessory(o,!0)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.enqueueConfigurationUpdate()},t.prototype.removeAllBridgedAccessories=function(){for(var e=this.bridgedAccessories.length-1;e>=0;e--)this.removeBridgedAccessory(this.bridgedAccessories[e],!0);this.enqueueConfigurationUpdate()},t.prototype.getCharacteristicByIID=function(e){var t,r;try{for(var i=c.__values(this.services),n=i.next();!n.done;n=i.next()){var o=n.value.getCharacteristicByIID(e);if(o)return o}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.getAccessoryByAID=function(e){return this.aid===e?this:this.bridgedAccessories.find((function(t){return t.aid===e}))},t.prototype.findCharacteristic=function(e,t){var r=this.getAccessoryByAID(e);return r&&r.getCharacteristicByIID(t)},t.prototype.configureCameraSource=function(e){var t=this;if(0===e.streamControllers.length)throw new Error("Malformed legacy CameraSource. Did not expose any StreamControllers!");var r=e.streamControllers[0].options,i={cameraStreamCount:e.streamControllers.length,streamingOptions:r,delegate:new g.LegacyCameraSourceAdapter(e)},n=new v.CameraController(i,!0);return this.configureController(n),e.services.forEach((function(e){e.UUID!==_.Service.CameraRTPStreamManagement.UUID&&e.UUID!==_.Service.CameraOperatingMode.UUID&&e.UUID!==_.Service.CameraRecordingManagement.UUID&&t.addService(e)})),e.streamControllers=n.streamManagements,n},t.prototype.configureController=function(e){var t=this,r="function"==typeof e?new e:e,i=r.controllerId();if(this.controllers[i])throw new Error("A Controller with the type/id '".concat(i,"' was already added to the accessory ").concat(this.displayName));var n,o=this.serializedControllers&&this.serializedControllers[i];if(o){var a=(0,T.clone)(o),s=r.initWithServices(o);n=s||o,s&&this.handleUpdatedControllerServiceMap(a,s),r.configureServices(),delete this.serializedControllers[i],0===Object.entries(this.serializedControllers).length&&(this.serializedControllers=void 0)}else n=r.constructServices(),r.configureServices(),Object.values(n).forEach((function(e){e&&!t.services.includes(e)&&t.addService(e)}));var c={controller:r,serviceMap:n};(0,v.isSerializableController)(r)&&this.controllerStorage.trackController(r),this.controllers[i]=c,r instanceof v.CameraController&&(this.activeCameraController=r)},t.prototype.removeController=function(e){var t=this,r=e.controllerId(),i=this.controllers[r];if(i){if(i.controller!==e)throw new Error("["+this.displayName+"] tried removing a controller with the id/type '"+r+"' though provided controller isn't the same instance that is registered!");(0,v.isSerializableController)(e)&&this.controllerStorage.untrackController(e),e.handleFactoryReset&&e.handleFactoryReset(),e.handleControllerRemoved(),delete this.controllers[r],this.activeCameraController===e&&(this.activeCameraController=void 0),Object.values(i.serviceMap).forEach((function(e){e&&t.removeService(e)}))}this.serializedControllers&&delete this.serializedControllers[r]},t.prototype.handleAccessoryUnpairedForControllers=function(){var e,t;try{for(var r=c.__values(Object.values(this.controllers)),i=r.next();!i.done;i=r.next()){var n=i.value.controller;n.handleFactoryReset&&n.handleFactoryReset(),(0,v.isSerializableController)(n)&&this.controllerStorage.purgeControllerData(n)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.handleUpdatedControllerServiceMap=function(e,t){var r=this;t=(0,T.clone)(t),Object.keys(e).forEach((function(i){var n=e[i],o=t[i];n&&o&&(delete e[i],delete t[i],n!==o&&(r.removeService(n),r.addService(o)))})),Object.values(e).forEach((function(e){e&&r.removeService(e)})),Object.values(t).forEach((function(e){e&&r.addService(e)}))},t.prototype.setupURI=function(){if(this._setupURI)return this._setupURI;(0,u.default)(!!this._accessoryInfo,"Cannot generate setupURI on an accessory that isn't published yet!");var e=Buffer.alloc(8),t=parseInt(this._accessoryInfo.pincode.replace(/-/g,""),10),r=this._accessoryInfo.category>>1;t|=1<<28,e.writeUInt32BE(t,4),1&this._accessoryInfo.category&&(e[4]=128|e[4]),e.writeUInt32BE(r,0);var i=(e.readUInt32BE(4)+4294967296*e.readUInt32BE(0)).toString(36).toUpperCase();if(9!==i.length)for(var n=0;n<=9-i.length;n++)i="0"+i;return this._setupURI="X-HM://"+i+this._setupID,this._setupURI},t.prototype.validateAccessory=function(e){var t=this,r=this.getService(_.Service.AccessoryInformation);if(r){var i=function(e,r){r||console.log("HAP-NodeJS WARNING: The accessory '"+t.displayName+"' is getting published with the characteristic '"+e+"' (of the AccessoryInformation service) not having a value set. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!")},n=r.getCharacteristic(m.Characteristic.Model).value,o=r.getCharacteristic(m.Characteristic.SerialNumber).value,a=r.getCharacteristic(m.Characteristic.FirmwareRevision).value,s=r.getCharacteristic(m.Characteristic.Name).value;i("Model",n),i("SerialNumber",o),i("FirmwareRevision",a),i("Name",s)}else console.log("HAP-NodeJS WARNING: The accessory '"+this.displayName+"' is getting published without a AccessoryInformation service. This might prevent the accessory from being added to the Home app or leading to the accessory being unresponsive!");e&&(0,u.default)(Buffer.from(this.displayName,"utf8").length<=63,"Accessory displayName cannot be longer than 63 bytes!"),this.bridged&&this.bridgedAccessories.forEach((function(e){return e.validateAccessory()}))},t.prototype._assignIDs=function(e){var t,r,i,n;this._identifierCache&&this.shouldPurgeUnusedIDs&&this._identifierCache.startTrackingUsage(),this.bridged?this.aid=e.getAID(this.UUID):this.aid=1;try{for(var o=c.__values(this.services),a=o.next();!a.done;a=o.next()){var s=a.value;this._isBridge?s._assignIDs(e,this.UUID,2e9):s._assignIDs(e,this.UUID)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}try{for(var u=c.__values(this.bridgedAccessories),l=u.next();!l.done;l=u.next()){l.value._assignIDs(e)}}catch(e){i={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}this._identifierCache&&(this.shouldPurgeUnusedIDs&&this._identifierCache.stopTrackingUsageAndExpireUnused(),this._identifierCache.save())},t.prototype.disableUnusedIDPurge=function(){this.shouldPurgeUnusedIDs=!1},t.prototype.enableUnusedIDPurge=function(){this.shouldPurgeUnusedIDs=!0},t.prototype.purgeUnusedIDs=function(){var e=this.shouldPurgeUnusedIDs;this.shouldPurgeUnusedIDs=!0,this._assignIDs(this._identifierCache),this.shouldPurgeUnusedIDs=e},t.prototype.toHAP=function(e){return c.__awaiter(this,arguments,void 0,(function(e,t){var r,i,n,o,a,s;return void 0===t&&(t=!0),c.__generator(this,(function(l){switch(l.label){case 0:return(0,u.default)(this.aid,"aid cannot be undefined for accessory '"+this.displayName+"'"),(0,u.default)(this.services.length,"accessory '"+this.displayName+"' does not have any services!"),s={aid:this.aid},[4,Promise.all(this.services.map((function(r){return r.toHAP(e,t)})))];case 1:return s.services=l.sent(),r=[s],this.bridged?[3,3]:(n=(i=r.push).apply,o=[r],a=[[]],[4,Promise.all(this.bridgedAccessories.map((function(r){return r.toHAP(e,t).then((function(e){return e[0]}))})))]);case 2:n.apply(i,o.concat([c.__spreadArray.apply(void 0,a.concat([c.__read.apply(void 0,[l.sent()]),!1]))])),l.label=3;case 3:return[2,r]}}))}))},t.prototype.internalHAPRepresentation=function(e){var t,r;void 0===e&&(e=!0),e&&this._assignIDs(this._identifierCache),(0,u.default)(this.aid,"aid cannot be undefined for accessory '"+this.displayName+"'"),(0,u.default)(this.services.length,"accessory '"+this.displayName+"' does not have any services!");var i=[{aid:this.aid,services:this.services.map((function(e){return e.internalHAPRepresentation()}))}];if(!this.bridged)try{for(var n=c.__values(this.bridgedAccessories),o=n.next();!o.done;o=n.next()){var a=o.value;i.push(a.internalHAPRepresentation(!1)[0])}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},t.prototype.publish=function(e,r){return c.__awaiter(this,void 0,void 0,(function(){var i,n,o,a,s,u,h,d,p,g,v=this;return c.__generator(this,(function(c){switch(c.label){case 0:if(this.bridged)throw new Error("Can't publish in accessory which is bridged by another accessory. Bridged by "+(null===(d=this.bridge)||void 0===d?void 0:d.displayName));return e.advertiser||null==e.useLegacyAdvertiser||(e.advertiser=e.useLegacyAdvertiser?"bonjour-hap":"ciao",console.warn('DEPRECATED The PublishInfo.useLegacyAdvertiser option has been removed. Please use the PublishInfo.advertiser property to enable "ciao" (useLegacyAdvertiser=false) or "bonjour-hap" (useLegacyAdvertiser=true) mdns advertiser libraries!')),e.mdns&&"bonjour-hap"!==e.advertiser&&console.log("DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. Please move to the new 'bind' option."),(i=this.getService(_.Service.ProtocolInformation))||(i=this.addService(_.Service.ProtocolInformation)),i.setCharacteristic(m.Characteristic.Version,f.CiaoAdvertiser.protocolVersionService),this.lastKnownUsername&&this.lastKnownUsername!==e.username&&t.cleanupAccessoryData(this.lastKnownUsername),this.initialized||null!==(p=e.addIdentifyingMaterial)&&void 0!==p&&!p||(this.displayName=this.displayName+" "+l.default.createHash("sha512").update(e.username,"utf8").digest("hex").slice(0,4).toUpperCase(),this.getService(_.Service.AccessoryInformation).updateCharacteristic(m.Characteristic.Name,this.displayName)),this._accessoryInfo=C.AccessoryInfo.load(e.username),this._accessoryInfo||(w("[%s] Creating new AccessoryInfo for our HAP server",this.displayName),this._accessoryInfo=C.AccessoryInfo.create(e.username)),e.setupID?this._setupID=e.setupID:void 0===this._accessoryInfo.setupID||""===this._accessoryInfo.setupID?this._setupID=t._generateSetupID():this._setupID=this._accessoryInfo.setupID,this._accessoryInfo.setupID=this._setupID,this._accessoryInfo.displayName=this.displayName,this._accessoryInfo.model=this.getService(_.Service.AccessoryInformation).getCharacteristic(m.Characteristic.Model).value,this._accessoryInfo.category=e.category||1,this._accessoryInfo.pincode=e.pincode,this._accessoryInfo.save(),this._identifierCache=E.IdentifierCache.load(e.username),this._identifierCache||(w("[%s] Creating new IdentifierCache",this.displayName),this._identifierCache=new E.IdentifierCache(e.username)),this._isBridge&&0===this.bridgedAccessories.length&&(this.disableUnusedIDPurge(),this.controllerStorage.purgeUnidentifiedAccessoryData=!1),this.initialized||this.controllerStorage.load(e.username),this._assignIDs(this._identifierCache),n=this.internalHAPRepresentation(!1),this._accessoryInfo.checkForCurrentConfigurationNumberIncrement(n,!0),this.validateAccessory(!0),o=t.parseBindOption(e),a=null!==(g=e.advertiser)&&void 0!==g?g:"bonjour-hap",(u="avahi"===e.advertiser)?[4,f.AvahiAdvertiser.isAvailable()]:[3,2];case 1:u=!c.sent(),c.label=2;case 2:return(s=u)?[3,5]:(h="resolved"===e.advertiser)?[4,f.ResolvedAdvertiser.isAvailable()]:[3,4];case 3:h=!c.sent(),c.label=4;case 4:s=h,c.label=5;case 5:switch(s&&(console.error("[".concat(this.displayName,'] The selected advertiser, "').concat(e.advertiser,"\", isn't available on this platform. ")+'Reverting to "'.concat("bonjour-hap",'"')),a="bonjour-hap"),a){case"ciao":this._advertiser=new f.CiaoAdvertiser(this._accessoryInfo,{interface:o.advertiserAddress},{restrictedAddresses:o.serviceRestrictedAddress,disabledIpv6:o.serviceDisableIpv6});break;case"bonjour-hap":this._advertiser=new f.BonjourHAPAdvertiser(this._accessoryInfo,e.mdns,{restrictedAddresses:o.serviceRestrictedAddress,disabledIpv6:o.serviceDisableIpv6});break;case"avahi":this._advertiser=new f.AvahiAdvertiser(this._accessoryInfo);break;case"resolved":this._advertiser=new f.ResolvedAdvertiser(this._accessoryInfo);break;default:throw new Error("Unsupported advertiser setting: '"+e.advertiser+"'")}return this._advertiser.on("updated-name",(function(e){v.displayName=e,v._accessoryInfo&&(v._accessoryInfo.displayName=e,v._accessoryInfo.save()),v.getService(_.Service.AccessoryInformation).updateCharacteristic(m.Characteristic.Name,e)})),this._server=new y.HAPServer(this._accessoryInfo),this._server.allowInsecureRequest=!!r,this._server.on("listening",this.onListening.bind(this)),this._server.on("identify",this.identificationRequest.bind(this,!1)),this._server.on("pair",this.handleInitialPairSetupFinished.bind(this)),this._server.on("add-pairing",this.handleAddPairing.bind(this)),this._server.on("remove-pairing",this.handleRemovePairing.bind(this)),this._server.on("list-pairings",this.handleListPairings.bind(this)),this._server.on("accessories",this.handleAccessories.bind(this)),this._server.on("get-characteristics",this.handleGetCharacteristics.bind(this)),this._server.on("set-characteristics",this.handleSetCharacteristics.bind(this)),this._server.on("connection-closed",this.handleHAPConnectionClosed.bind(this)),this._server.on("request-resource",this.handleResource.bind(this)),this._server.listen(e.port,o.serverAddress),this.initialized=!0,[2]}}))}))},t.prototype.destroy=function(){var e=this.unpublish();return this._accessoryInfo&&(t.cleanupAccessoryData(this._accessoryInfo.username),this._accessoryInfo=void 0,this._identifierCache=void 0,this.controllerStorage=new S.ControllerStorage(this)),this.removeAllListeners(),e},t.prototype.unpublish=function(){return c.__awaiter(this,void 0,void 0,(function(){return c.__generator(this,(function(e){switch(e.label){case 0:return this._server&&(this._server.destroy(),this._server=void 0),this._advertiser?[4,this._advertiser.destroy()]:[3,2];case 1:e.sent(),this._advertiser=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.enqueueConfigurationUpdate=function(){var e=this;this.configurationChangeDebounceTimeout||(this.configurationChangeDebounceTimeout=setTimeout((function(){var t;if(e.configurationChangeDebounceTimeout=void 0,e._advertiser&&e._advertiser){var r=e.internalHAPRepresentation();(null===(t=e._accessoryInfo)||void 0===t?void 0:t.checkForCurrentConfigurationNumberIncrement(r))&&e._advertiser.updateAdvertisement()}}),1e3),this.configurationChangeDebounceTimeout.unref())},t.prototype.onListening=function(e,t){var r=this;(0,u.default)(this._advertiser,"Advertiser wasn't created at onListening!"),this._advertiser.initPort(e),this._advertiser.startAdvertising().then((function(){return r.emit("advertised")})).catch((function(e){console.error("Could not create mDNS advertisement. The HAP-Server won't be discoverable: "+e),e.stack&&w("Detailed error: "+e.stack)})),this.emit("listening",e,t)},t.prototype.handleInitialPairSetupFinished=function(e,t,r){w("[%s] Paired with client %s",this.displayName,e),this._accessoryInfo&&this._accessoryInfo.addPairedClient(e,t,1),this._accessoryInfo&&this._accessoryInfo.save(),this._advertiser&&this._advertiser.updateAdvertisement(),r(),this.emit("paired")},t.prototype.handleAddPairing=function(e,t,r,i,n){if(this._accessoryInfo)if(this._accessoryInfo.hasAdminPermissions(e.username)){var o=this._accessoryInfo.getClientPublicKey(t);if(o){if(o.toString()!==r.toString())return void n(1);this._accessoryInfo.updatePermission(t,i)}else this._accessoryInfo.addPairedClient(t,r,i);this._accessoryInfo.save(),n(0)}else n(2);else n(6)},t.prototype.handleRemovePairing=function(e,t,r){var i,n;if(this._accessoryInfo)if(this._accessoryInfo.hasAdminPermissions(e.username)){if(this._accessoryInfo.removePairedClient(e,t),this._accessoryInfo.save(),r(0),!this._accessoryInfo.paired()){this._advertiser&&this._advertiser.updateAdvertisement(),this.emit("unpaired"),this.handleAccessoryUnpairedForControllers();try{for(var o=c.__values(this.bridgedAccessories),a=o.next();!a.done;a=o.next()){a.value.handleAccessoryUnpairedForControllers()}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}}}else r(2);else r(6)},t.prototype.handleListPairings=function(e,t){this._accessoryInfo?this._accessoryInfo.hasAdminPermissions(e.username)?t(0,this._accessoryInfo.listPairings()):t(2):t(6)},t.prototype.handleAccessories=function(e,t){var r=this;this._assignIDs(this._identifierCache);var i=Date.now(),n=i-this.lastAccessoriesRequest>5e3;this.lastAccessoriesRequest=i,this.toHAP(e,n).then((function(e){t(void 0,{accessories:e})}),(function(e){console.error("["+r.displayName+"] /accessories request error with: "+e.stack),t({httpCode:500,status:-70402})}))},t.prototype.handleGetCharacteristics=function(e,r,i){var n,o,a=this,s=[],u={characteristics:s},l=new Set(r.ids.map((function(e){return e.aid+"."+e.iid})));if(l.size===r.ids.length){var h=setTimeout((function(){var e,r;try{for(var n=c.__values(l),o=n.next();!o.done;o=n.next()){var d=o.value.split("."),p=parseInt(d[0],10),f=parseInt(d[1],10),g=a.getAccessoryByAID(p),m=g.getCharacteristicByIID(f);a.sendCharacteristicWarning(m,"slow-read","The read handler for the characteristic '"+m.displayName+"' on the accessory '"+g.displayName+"' was slow to respond!")}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}h=setTimeout((function(){var e,t;h=void 0;try{for(var r=c.__values(l),n=r.next();!n.done;n=r.next()){var o=n.value.split("."),d=parseInt(o[0],10),p=parseInt(o[1],10),f=a.getAccessoryByAID(d),g=f.getCharacteristicByIID(p);a.sendCharacteristicWarning(g,"timeout-read","The read handler for the characteristic '"+g.displayName+"' on the accessory '"+f.displayName+"' didn't respond at all!. Please check that you properly call the callback!"),s.push({aid:d,iid:p,status:-70408})}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}l.clear(),i(void 0,u)}),t.TIMEOUT_AFTER_WARNING),h.unref()}),t.TIMEOUT_WARNING);h.unref();var d=function(t){var n=t.aid+"."+t.iid;p.handleCharacteristicRead(e,t,r).then((function(e){return c.__assign({aid:t.aid,iid:t.iid},e)}),(function(e){return console.error("[".concat(a.displayName,"] Read request for characteristic ").concat(n," encountered an error: ").concat(e.stack)),{aid:t.aid,iid:t.iid,status:-70402}})).then((function(e){h&&(l.delete(n),s.push(e),0===l.size&&(h&&(clearTimeout(h),h=void 0),i(void 0,u)))}))},p=this;try{for(var f=c.__values(r.ids),g=f.next();!g.done;g=f.next()){d(g.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}else i({httpCode:422,status:-70410})},t.prototype.handleCharacteristicRead=function(e,t,r){return c.__awaiter(this,void 0,void 0,(function(){var i,n,o=this;return c.__generator(this,(function(a){return(i=this.findCharacteristic(t.aid,t.iid))?i.props.perms.includes("pr")?i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(0)&&((n=this._accessoryInfo&&e.username)||w("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for reading (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!n||!this._accessoryInfo.hasAdminPermissions(e.username))?[2,{status:-70401}]:[2,i.handleGetRequest(e).then((function(n){n=(0,A.formatOutgoingCharacteristicValue)(n,i.props),w('[%s] Got Characteristic "%s" value: "%s"',o.displayName,i.displayName,n);var a={value:null==n?null:n};return r.includeMeta&&(a.format=i.props.format,a.unit=i.props.unit,a.minValue=i.props.minValue,a.maxValue=i.props.maxValue,a.minStep=i.props.minStep,a.maxLen=i.props.maxLen||i.props.maxDataLen),r.includePerms&&(a.perms=i.props.perms),r.includeType&&(a.type=(0,D.toShortForm)(i.UUID)),r.includeEvent&&(a.ev=e.hasEventNotifications(t.aid,t.iid)),a}),(function(e){return w('[%s] Error getting value for characteristic "%s": %s',o.displayName,i.displayName,y.HAPStatus[e]),{status:e}}))]:(w("[%s] Tried reading from characteristic which does not allow reading (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70405}]):(w("[%s] Could not find a Characteristic with aid of %s and iid of %s",this.displayName,t.aid,t.iid),[2,{status:-70410}])}))}))},t.prototype.handleSetCharacteristics=function(e,r,i){var n,o,a=this;w("[%s] Processing characteristic set: %s",this.displayName,JSON.stringify(r));var s=0;void 0!==r.pid&&(e.timedWritePid===r.pid?(s=1,clearTimeout(e.timedWriteTimeout),e.timedWritePid=void 0,e.timedWriteTimeout=void 0,w("[%s] Timed write request got acknowledged for pid %d",this.displayName,r.pid)):(s=2,w("[%s] TTL for timed write request has probably expired for pid %d",this.displayName,r.pid)));var u=[],l={characteristics:u},h=new Set(r.characteristics.map((function(e){return e.aid+"."+e.iid})));if(h.size===r.characteristics.length){var d=setTimeout((function(){var e,r;try{for(var n=c.__values(h),o=n.next();!o.done;o=n.next()){var s=o.value.split("."),p=parseInt(s[0],10),f=parseInt(s[1],10),g=a.getAccessoryByAID(p),m=g.getCharacteristicByIID(f);a.sendCharacteristicWarning(m,"slow-write","The write handler for the characteristic '"+m.displayName+"' on the accessory '"+g.displayName+"' was slow to respond!")}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}d=setTimeout((function(){var e,t;d=void 0;try{for(var r=c.__values(h),n=r.next();!n.done;n=r.next()){var o=n.value.split("."),s=parseInt(o[0],10),p=parseInt(o[1],10),f=a.getAccessoryByAID(s),g=f.getCharacteristicByIID(p);a.sendCharacteristicWarning(g,"timeout-write","The write handler for the characteristic '"+g.displayName+"' on the accessory '"+f.displayName+"' didn't respond at all!. Please check that you properly call the callback!"),u.push({aid:s,iid:p,status:-70408})}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}h.clear(),i(void 0,l)}),t.TIMEOUT_AFTER_WARNING),d.unref()}),t.TIMEOUT_WARNING);d.unref();var p=function(t){var r=t.aid+"."+t.iid;f.handleCharacteristicWrite(e,t,s).then((function(e){return c.__assign({aid:t.aid,iid:t.iid},e)}),(function(e){return console.error("[".concat(a.displayName,"] Write request for characteristic ").concat(r," encountered an error: ").concat(e.stack)),{aid:t.aid,iid:t.iid,status:-70402}})).then((function(e){d&&(h.delete(r),u.push(e),0===h.size&&(d&&(clearTimeout(d),d=void 0),i(void 0,l)))}))},f=this;try{for(var g=c.__values(r.characteristics),m=g.next();!m.done;m=g.next()){p(m.value)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}else i({httpCode:422,status:-70410})},t.prototype.handleCharacteristicWrite=function(e,t,r){return c.__awaiter(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c.__generator(this,(function(c){if(!(i=this.findCharacteristic(t.aid,t.iid)))return w("[%s] Could not find a Characteristic with aid of %s and iid of %s",this.displayName,t.aid,t.iid),[2,{status:-70410}];if(2===r)return[2,{status:-70410}];if(null==t.ev&&null==t.value)return[2,{status:-70410}];if(null!=t.ev){if(!i.props.perms.includes("ev"))return w("[%s] Tried %s notifications for Characteristic which does not allow notify (aid of %s and iid of %s)",this.displayName,t.ev?"enabling":"disabling",t.aid,t.iid),[2,{status:-70406}];if(i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(2)&&((o=e.username&&this._accessoryInfo)||w("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for notify (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!o||!this._accessoryInfo.hasAdminPermissions(e.username)))return[2,{status:-70401}];n=e.hasEventNotifications(t.aid,t.iid),t.ev&&!n?(e.enableEventNotifications(t.aid,t.iid),i.subscribe(),w('[%s] Registered Characteristic "%s" on "%s" for events',e.remoteAddress,i.displayName,this.displayName)):!t.ev&&n&&(i.unsubscribe(),e.disableEventNotifications(t.aid,t.iid),w('[%s] Unregistered Characteristic "%s" on "%s" for events',e.remoteAddress,i.displayName,this.displayName))}if(null!=t.value){if(!i.props.perms.includes("pw"))return w("[%s] Tried writing to Characteristic which does not allow writing (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70404}];if(i.props.adminOnlyAccess&&i.props.adminOnlyAccess.includes(1)&&((o=e.username&&this._accessoryInfo)||w("[%s] Could not verify admin permissions for Characteristic which requires admin permissions for write (aid of %s and iid of %s)",this.displayName,t.aid,t.iid),!o||!this._accessoryInfo.hasAdminPermissions(e.username)))return[2,{status:-70401}];if(i.props.perms.includes("aa")&&i.additionalAuthorizationHandler){a=void 0;try{a=i.additionalAuthorizationHandler(t.authData)}catch(e){console.warn("["+this.displayName+"] Additional authorization handler has thrown an error when checking authData: "+e.stack),a=!1}if(!a)return[2,{status:-70411}]}return i.props.perms.includes("tw")&&1!==r?(w("[%s] Tried writing to a timed write only Characteristic without properly preparing (iid of %s and aid of %s)",this.displayName,t.aid,t.iid),[2,{status:-70410}]):[2,i.handleSetRequest(t.value,e).then((function(e){return w('[%s] Setting Characteristic "%s" to value %s',s.displayName,i.displayName,t.value),{value:t.r&&e?(0,A.formatOutgoingCharacteristicValue)(e,i.props):void 0,status:0}}),(function(e){return w('[%s] Error setting Characteristic "%s" to value %s: ',s.displayName,i.displayName,t.value,y.HAPStatus[e]),{status:e}}))]}return[2,{status:0}]}))}))},t.prototype.handleResource=function(e,t){var r;if("image"===e["resource-type"]){var i=e.aid,n=void 0,o=void 0;return i?(n=this.getAccessoryByAID(i))&&n.activeCameraController&&(o=n.activeCameraController):this.activeCameraController&&(n=this,o=this.activeCameraController),o?void o.handleSnapshotRequest(e["image-height"],e["image-width"],null==n?void 0:n.displayName,e.reason).then((function(e){t(void 0,e)}),(function(e){t({httpCode:207,status:e})})):(w("[%s] received snapshot request though no camera controller was associated!"),void t({httpCode:404,status:-70409}))}w("[%s] received request for unsupported image type: "+e["resource-type"],null===(r=this._accessoryInfo)||void 0===r?void 0:r.username),t({httpCode:404,status:-70409})},t.prototype.handleHAPConnectionClosed=function(e){var t,r;this.activeCameraController&&this.activeCameraController.handleCloseConnection(e.sessionID);try{for(var i=c.__values(e.getRegisteredEvents()),n=i.next();!n.done;n=i.next()){var o=n.value.split("."),a=parseInt(o[0],10),s=parseInt(o[1],10),u=this.findCharacteristic(a,s);u&&u.unsubscribe()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.clearRegisteredEvents()},t.prototype.handleServiceConfigurationChangeEvent=function(e){e.isPrimaryService||e!==this.primaryService?e.isPrimaryService&&e!==this.primaryService&&(void 0!==this.primaryService&&(this.primaryService.isPrimaryService=!1),this.primaryService=e):this.primaryService=void 0,this.bridged?this.emit("service-configurationChange",{service:e}):this.enqueueConfigurationUpdate()},t.prototype.handleCharacteristicChangeEvent=function(e,t,r){if(this.bridged)this.emit("service-characteristic-change",c.__assign(c.__assign({},r),{service:t}));else{if(!this._server)return;if(null==e.aid||null==r.characteristic.iid)return void w("[%s] Muting event notification for %s as ids aren't yet assigned!",e.displayName,r.characteristic.displayName);if(null!=r.context&&"object"==typeof r.context&&r.context.omitEventUpdate)return void w("[%s] Omitting event updates for %s as specified in the context object!",e.displayName,r.characteristic.displayName);if("event"!==r.reason&&r.oldValue===r.newValue&&r.characteristic.UUID!==m.Characteristic.ProgrammableSwitchEvent.UUID&&r.characteristic.UUID!==m.Characteristic.ButtonEvent.UUID)return;var i=r.characteristic.UUID,n=i===m.Characteristic.ButtonEvent.UUID||i===m.Characteristic.ProgrammableSwitchEvent.UUID||i===m.Characteristic.MotionDetected.UUID||i===m.Characteristic.ContactSensorState.UUID,o=(0,A.formatOutgoingCharacteristicValue)(r.newValue,r.characteristic.props);this._server.sendEventNotifications(e.aid,r.characteristic.iid,o,r.originator,n)}},t.prototype.sendCharacteristicWarning=function(e,t,r){this.handleCharacteristicWarning({characteristic:e,type:t,message:r,originatorChain:[e.displayName],stack:(new Error).stack})},t.prototype.handleCharacteristicWarning=function(e){var t;if(e.originatorChain=c.__spreadArray([this.displayName],c.__read(e.originatorChain),!1),!this.emit("characteristic-warning",e)){var r="[".concat(e.originatorChain.join("@"),"] ").concat(e.message);"error-message"===e.type||"timeout-read"===e.type||"timeout-write"===e.type?console.error(r):console.warn(r),w("[%s] Above characteristic warning was thrown at: %s",this.displayName,null!==(t=e.stack)&&void 0!==t?t:"unknown")}},t.prototype.setupServiceEventHandlers=function(e){e.on("service-configurationChange",this.handleServiceConfigurationChangeEvent.bind(this,e)),e.on("characteristic-change",this.handleCharacteristicChangeEvent.bind(this,this,e)),e.on("characteristic-warning",this.handleCharacteristicWarning.bind(this))},t.prototype._sideloadServices=function(e){var t,r,i=this;try{for(var n=c.__values(e),o=n.next();!o.done;o=n.next()){var a=o.value;this.setupServiceEventHandlers(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.services=e.slice(),this.getService(_.Service.AccessoryInformation).getCharacteristic(m.Characteristic.Identify).on("set",(function(e,t){if(e){i.identificationRequest(!0,t)}}))},t._generateSetupID=function(){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",t="",r=0;r<4;r++){var i=Math.floor(36*Math.random());t+=e.charAt(i)}return t},t.serialize=function(e){var r={displayName:e.displayName,UUID:e.UUID,lastKnownUsername:e._accessoryInfo?e._accessoryInfo.username:void 0,category:e.category,services:[]},i={},n=!1;e.services.forEach((function(e){r.services.push(_.Service.serialize(e));var t=[];e.linkedServices.forEach((function(e){t.push(e.getServiceId())})),t.length>0&&(i[e.getServiceId()]=t,n=!0)})),n&&(r.linkedServices=i);var o=[];return Object.values(e.controllers).forEach((function(e){o.push({type:e.controller.controllerId(),services:t.serializeServiceMap(e.serviceMap)})})),e.serializedControllers&&Object.entries(e.serializedControllers).forEach((function(e){var r=c.__read(e,2),i=r[0],n=r[1];o.push({type:i,services:t.serializeServiceMap(n)})})),o.length>0&&(r.controllers=o),r},t.deserialize=function(e){var r,i,n=new t(e.displayName,e.UUID);n.lastKnownUsername=e.lastKnownUsername,n.category=e.category;var o=[],a={};if(e.services.forEach((function(e){var t=_.Service.deserialize(e);o.push(t),a[t.getServiceId()]=t})),e.linkedServices){var s=function(e,t){var r=a[e];if(!r)return"continue";t.forEach((function(e){var t=a[e];t&&r.addLinkedService(t)}))};try{for(var u=c.__values(Object.entries(e.linkedServices)),l=u.next();!l.done;l=u.next()){var h=c.__read(l.value,2);s(h[0],h[1])}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}return e.controllers&&(n.serializedControllers={},e.controllers.forEach((function(e){n.serializedControllers[e.type]=t.deserializeServiceMap(e.services,a)}))),n._sideloadServices(o),n},t.cleanupAccessoryData=function(e){E.IdentifierCache.remove(e),C.AccessoryInfo.remove(e),S.ControllerStorage.remove(e)},t.serializeServiceMap=function(e){var t={};return Object.entries(e).forEach((function(e){var r=c.__read(e,2),i=r[0],n=r[1];n&&(t[i]=n.getServiceId())})),t},t.deserializeServiceMap=function(e,t){var r={};return Object.entries(e).forEach((function(e){var i=c.__read(e,2),n=i[0],o=i[1],a=t[o];a&&(r[n]=a)})),r},t.parseBindOption=function(e){var t,r,i=void 0,n=void 0,o=void 0;if(e.bind){var a=new Set(Array.isArray(e.bind)?e.bind:[e.bind]);if(a.has("::"))o="::",a.delete("::"),a.size&&(i=Array.from(a));else if(a.has("0.0.0.0"))n=!0,o="0.0.0.0",a.delete("0.0.0.0"),a.size&&(i=Array.from(a));else if(1===a.size){i=Array.from(a);var s=a.values().next().value;o=(d=p.default.isIP(s))&&4===d?"0.0.0.0":"::"}else if(a.size>1){i=Array.from(a);var u=!1;try{for(var l=c.__values(a),h=l.next();!h.done;h=l.next()){var d;s=h.value;if(0===(d=p.default.isIP(s))||6===d){u=!0;break}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}o=u?"::":"0.0.0.0"}}return{advertiserAddress:i,serviceRestrictedAddress:i,serviceDisableIpv6:n,serverAddress:o}},t.Categories=i,t.TIMEOUT_WARNING=3e3,t.TIMEOUT_AFTER_WARNING=6e3,t}(d.EventEmitter);t.Accessory=b},1370:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadDirectory=t.parseAccessoryJSON=t.parseServiceJSON=t.parseCharacteristicJSON=void 0;var i=r(1635),n=i.__importDefault(r(5753)),o=i.__importDefault(r(9896)),a=i.__importDefault(r(6928)),s=r(5745),c=r(9826),u=r(5876),l=i.__importStar(r(2997)),h=(0,n.default)("HAP-NodeJS:AccessoryLoader");function d(e){var t=e.cType,r=new c.Characteristic(e.manfDescription||t,t,{format:e.format,minValue:e.designedMinValue,maxValue:e.designedMaxValue,minStep:e.designedMinStep,unit:e.unit,perms:e.perms});r.value=e.initialValue,r.locals=e.locals;var i=e.onUpdate,n=e.onRead,o=e.onRegister;return i&&r.on("set",(function(e,t){i(e),t&&t()})),n&&r.on("get",(function(e){n((function(t){e(null,t)}))})),o&&o(r),r}function p(e){var t=e.sType,r=[];e.characteristics.forEach((function(e){var t=d(e);r.push(t)}));var i=null;r.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"===e.UUID&&(i=e.value)}));var n=new u.Service(i||t,t,"".concat(i));return r.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"!==e.UUID&&n.addCharacteristic(e)})),n}function f(e){var t=[];e.services.forEach((function(e){var r=p(e);t.push(r)}));var r=e.displayName;t.forEach((function(e){"0000003E-0000-1000-8000-0026BB765291"===e.UUID&&e.characteristics.forEach((function(e){"00000023-0000-1000-8000-0026BB765291"===e.UUID&&(r=e.value)}))}));var i=new s.Accessory(r,l.generate(r));return i.username=e.username,i.pincode=e.pincode,i.services.length=0,t.forEach((function(e){i.addService(e)})),i}t.parseCharacteristicJSON=d,t.parseServiceJSON=p,t.parseAccessoryJSON=f,t.loadDirectory=function(e){var t=[];return o.default.readdirSync(e).forEach((function(i){var n=i.split("_").pop();if("accessory.js"===n||"accessory.ts"===n){h("Parsing accessory: %s",i);var o=r(7506)(a.default.join(e,i)).accessory;t.push(o)}else if("accfactory.js"===n||"accfactory.ts"===n){h("Parsing accessory factory: %s",i);var s=r(7506)(a.default.join(e,i));t=t.concat(s)}})),t.map((function(e){return null==e?(console.log("Invalid accessory!"),!1):e instanceof s.Accessory?e:f(e)})).filter((function(e){return!!e}))}},310:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvedAdvertiser=t.AvahiAdvertiser=t.DBusInvokeError=t.BonjourHAPAdvertiser=t.CiaoAdvertiser=t.AdvertiserEvent=t.PairingFeatureFlag=t.StatusFlag=void 0;var i,n,o,a=r(1635),s=a.__importDefault(r(8318)),c=a.__importDefault(r(9640)),u=a.__importDefault(r(2613)),l=a.__importDefault(r(8404)),h=a.__importDefault(r(6982)),d=a.__importDefault(r(5753)),p=r(4434),f=r(4009),g=(0,d.default)("HAP-NodeJS:Advertiser");!function(e){e[e.NOT_PAIRED=1]="NOT_PAIRED",e[e.NOT_JOINED_WIFI=2]="NOT_JOINED_WIFI",e[e.PROBLEM_DETECTED=4]="PROBLEM_DETECTED"}(i||(t.StatusFlag=i={})),function(e){e[e.SUPPORTS_HARDWARE_AUTHENTICATION=1]="SUPPORTS_HARDWARE_AUTHENTICATION",e[e.SUPPORTS_SOFTWARE_AUTHENTICATION=2]="SUPPORTS_SOFTWARE_AUTHENTICATION"}(n||(t.PairingFeatureFlag=n={})),function(e){e.UPDATED_NAME="updated-name"}(o||(t.AdvertiserEvent=o={}));var m=function(e){function t(r,i,n){var o=e.call(this)||this;return o.accessoryInfo=r,o.setupHash=t.computeSetupHash(r),o.responder=s.default.getResponder(a.__assign({},i)),o.advertisedService=o.responder.createService(a.__assign({name:o.accessoryInfo.displayName,type:"hap",txt:t.createTxt(r,o.setupHash)},n)),o.advertisedService.on("name-change",o.emit.bind(o,"updated-name")),g("Preparing Advertiser for '".concat(o.accessoryInfo.displayName,"' using ciao backend!")),o}return a.__extends(t,e),t.prototype.initPort=function(e){this.advertisedService.updatePort(e)},t.prototype.startAdvertising=function(){return g("Starting to advertise '".concat(this.accessoryInfo.displayName,"' using ciao backend!")),this.advertisedService.advertise()},t.prototype.updateAdvertisement=function(e){var r=t.createTxt(this.accessoryInfo,this.setupHash);g("Updating txt record (txt: %o, silent: %d)",r,e),this.advertisedService.updateTxt(r,e)},t.prototype.destroy=function(){return a.__awaiter(this,void 0,void 0,(function(){return a.__generator(this,(function(e){switch(e.label){case 0:return[4,this.responder.shutdown()];case 1:return e.sent(),this.removeAllListeners(),[2]}}))}))},t.createTxt=function(e,r){var i=[];return e.paired()||i.push(1),{"c#":e.getConfigVersion(),ff:t.ff(),id:e.username,md:e.model,pv:t.protocolVersion,"s#":1,sf:t.sf.apply(t,a.__spreadArray([],a.__read(i),!1)),ci:e.category,sh:r}},t.computeSetupHash=function(e){var t=h.default.createHash("sha512");return t.update(e.setupID+e.username.toUpperCase()),t.digest().slice(0,4).toString("base64")},t.ff=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bridge=void 0;var i=r(1635),n=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i._isBridge=!0,i}return i.__extends(t,e),t}(r(5745).Accessory);t.Bridge=n},9826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Characteristic=t.CharacteristicEventTypes=t.ChangeReason=t.Access=t.Perms=t.Units=t.Formats=void 0;var i,n,o,a,s,c,u=r(1635),l=u.__importDefault(r(2613)),h=u.__importDefault(r(5753)),d=r(4434),p=r(589),f=r(9621),g=r(8073),m=r(7739),v=r(8066),y=r(2997),C=(0,h.default)("HAP-NodeJS:Characteristic");!function(e){e.BOOL="bool",e.INT="int",e.FLOAT="float",e.STRING="string",e.UINT8="uint8",e.UINT16="uint16",e.UINT32="uint32",e.UINT64="uint64",e.DATA="data",e.TLV8="tlv8",e.ARRAY="array",e.DICTIONARY="dict"}(i||(t.Formats=i={})),function(e){e.CELSIUS="celsius",e.PERCENTAGE="percentage",e.ARC_DEGREE="arcdegrees",e.LUX="lux",e.SECONDS="seconds"}(n||(t.Units=n={})),function(e){e.READ="pr",e.WRITE="pw",e.PAIRED_READ="pr",e.PAIRED_WRITE="pw",e.NOTIFY="ev",e.EVENTS="ev",e.ADDITIONAL_AUTHORIZATION="aa",e.TIMED_WRITE="tw",e.HIDDEN="hd",e.WRITE_RESPONSE="wr"}(o||(t.Perms=o={})),function(e){e[e.READ=0]="READ",e[e.WRITE=1]="WRITE",e[e.NOTIFY=2]="NOTIFY"}(a||(t.Access=a={})),function(e){e.WRITE="write",e.UPDATE="update",e.READ="read",e.EVENT="event"}(s||(t.ChangeReason=s={})),function(e){e.GET="get",e.SET="set",e.CHANGE="change",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e.CHARACTERISTIC_WARNING="characteristic-warning"}(c||(t.CharacteristicEventTypes=c={}));var S=function(){function e(e){(0,l.default)((0,v.isNumericFormat)(e.format),"Cannot instantiate valid values iterable when format is not numeric. Found "+e.format),this.props=e}return e.prototype[Symbol.iterator]=function(){var e,t,r,i,n,o,a,s,c;return u.__generator(this,(function(l){switch(l.label){case 0:if(!this.props.validValues)return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),e=u.__values(this.props.validValues),t=e.next(),l.label=2;case 2:return t.done?[3,5]:[4,t.value];case 3:l.sent(),l.label=4;case 4:return t=e.next(),[3,2];case 5:return[3,8];case 6:return r=l.sent(),s={error:r},[3,8];case 7:try{t&&!t.done&&(c=e.return)&&c.call(e)}finally{if(s)throw s.error}return[7];case 8:return[3,13];case 9:if(i=0,n=void 0,o=1,this.props.validValueRanges)i=this.props.validValueRanges[0],n=this.props.validValueRanges[1];else if(null!=this.props.minValue&&null!=this.props.maxValue)i=this.props.minValue,n=this.props.maxValue,null!=this.props.minStep&&(o=this.props.minStep);else{if(!(0,v.isUnsignedNumericFormat)(this.props.format))throw new Error("Could not find valid iterator strategy for props: "+JSON.stringify(this.props));n=(0,v.numericUpperBound)(this.props.format)}a=i,l.label=10;case 10:return a<=n?[4,a]:[3,13];case 11:l.sent(),l.label=12;case 12:return a+=o,[3,10];case 13:return[2]}}))},e}(),E=/^-?\d+$/;function _(e){var t=-70402;if(E.test(e.message)){var r=parseInt(e.message,10);(0,p.IsKnownHAPStatusError)(r)&&(t=r)}return t}function T(e,t){return null==e?t:null==t?e:Math.max(e,t)}function A(e,t){return null==e?t:null==t?e:Math.min(e,t)}var I=function(e){function t(t,r,i){var n=e.call(this)||this;return n.iid=null,n.value=null,n.status=null,n.statusCode=0,n.subscriptions=0,n.displayName=t,n.UUID=r,n.props={format:"int",perms:["ev"]},n.setProps(i||{}),n}return u.__extends(t,e),t.prototype.onGet=function(e){return"function"!=typeof e?(this.characteristicWarning(".onGet handler must be a function"),this):(this.getHandler=e,this)},t.prototype.removeOnGet=function(){return this.getHandler=void 0,this},t.prototype.onSet=function(e){return"function"!=typeof e?(this.characteristicWarning(".onSet handler must be a function"),this):(this.setHandler=e,this)},t.prototype.removeOnSet=function(){return this.setHandler=void 0,this},t.prototype.setProps=function(e){(0,l.default)(e,"props cannot be undefined when setting props");var r=!1;if(e.format&&(r=this.props.format!==e.format,this.props.format=e.format),e.perms&&((0,l.default)(e.perms.length>0,"characteristic prop perms cannot be empty array"),this.props.perms=e.perms),void 0!==e.unit&&(this.props.unit=null!=e.unit?e.unit:void 0),void 0!==e.description&&(this.props.description=null!=e.description?e.description:void 0),void 0!==e.minValue&&(null===e.minValue?e.minValue=void 0:(0,v.isNumericFormat)(this.props.format)?"number"==typeof e.minValue&&Number.isFinite(e.minValue)?e.minValue<(0,v.numericLowerBound)(this.props.format)?(this.characteristicWarning("Characteristic Property 'minValue' was set to "+e.minValue+", but for numeric format "+this.props.format+" minimum possible is "+(0,v.numericLowerBound)(this.props.format),"error-message"),e.minValue=(0,v.numericLowerBound)(this.props.format)):e.minValue>(0,v.numericUpperBound)(this.props.format)&&(this.characteristicWarning("Characteristic Property 'minValue' was set to "+e.minValue+", but for numeric format "+this.props.format+" maximum possible is "+(0,v.numericUpperBound)(this.props.format),"error-message"),e.minValue=(0,v.numericLowerBound)(this.props.format)):(this.characteristicWarning("Characteristic Property 'minValue' must be a finite number, received \"".concat(e.minValue,'" (').concat(typeof e.minValue,")"),"error-message"),e.minValue=void 0):(this.characteristicWarning("Characteristic Property 'minValue' can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message"),e.minValue=void 0),this.props.minValue=e.minValue),void 0!==e.maxValue&&(null===e.maxValue?e.maxValue=void 0:(0,v.isNumericFormat)(this.props.format)?"number"==typeof e.maxValue&&Number.isFinite(e.maxValue)?e.maxValue>(0,v.numericUpperBound)(this.props.format)?(this.characteristicWarning("Characteristic Property 'maxValue' was set to "+e.maxValue+", but for numeric format "+this.props.format+" maximum possible is "+(0,v.numericUpperBound)(this.props.format),"error-message"),e.maxValue=(0,v.numericUpperBound)(this.props.format)):e.maxValue<(0,v.numericLowerBound)(this.props.format)&&(this.characteristicWarning("Characteristic Property 'maxValue' was set to "+e.maxValue+", but for numeric format "+this.props.format+" minimum possible is "+(0,v.numericLowerBound)(this.props.format),"error-message"),e.maxValue=(0,v.numericUpperBound)(this.props.format)):(this.characteristicWarning("Characteristic Property 'maxValue' must be a finite number, received \"".concat(e.maxValue,'" (').concat(typeof e.maxValue,")"),"error-message"),e.maxValue=void 0):(this.characteristicWarning("Characteristic Property 'maxValue' can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message"),e.maxValue=void 0),this.props.maxValue=e.maxValue),void 0!==e.minStep&&(null===e.minStep?this.props.minStep=void 0:(0,v.isNumericFormat)(this.props.format)?(e.minStep<1&&(0,v.isIntegerNumericFormat)(this.props.format)&&this.characteristicWarning("Characteristic Property `minStep` was set to a value lower than 1, this will have no effect on format `"+this.props.format),this.props.minStep=e.minStep):this.characteristicWarning("Characteristic Property `minStep` can only be set for characteristics with numeric format, but not for "+this.props.format,"error-message")),void 0!==e.maxLen&&(null===e.maxLen?this.props.maxLen=void 0:"string"!==this.props.format?this.characteristicWarning("Characteristic Property `maxLen` can only be set for characteristics with format `STRING`, but not for "+this.props.format,"error-message"):(e.maxLen>256&&(this.characteristicWarning("Characteristic Property string `maxLen` cannot be bigger than 256"),e.maxLen=256),this.props.maxLen=e.maxLen)),void 0!==e.maxDataLen&&(null===e.maxDataLen?this.props.maxDataLen=void 0:"data"!==this.props.format?this.characteristicWarning("Characteristic Property `maxDataLen` can only be set for characteristics with format `DATA`, but not for "+this.props.format,"error-message"):this.props.maxDataLen=e.maxDataLen),void 0!==e.validValues&&(null===e.validValues?this.props.validValues=void 0:(0,v.isNumericFormat)(this.props.format)?((0,l.default)(e.validValues.length,"characteristic prop validValues cannot be empty array"),this.props.validValues=e.validValues):this.characteristicWarning("Characteristic Property `validValues` was supplied for non numeric format "+this.props.format)),void 0!==e.validValueRanges&&(null===e.validValueRanges?this.props.validValueRanges=void 0:(0,v.isNumericFormat)(this.props.format)?((0,l.default)(2===e.validValueRanges.length,"characteristic prop validValueRanges must have a length of 2"),this.props.validValueRanges=e.validValueRanges):this.characteristicWarning("Characteristic Property `validValueRanges` was supplied for non numeric format "+this.props.format)),void 0!==e.adminOnlyAccess&&(this.props.adminOnlyAccess=null!=e.adminOnlyAccess?e.adminOnlyAccess:void 0),null!=this.props.minValue&&null!=this.props.maxValue&&this.props.minValue>this.props.maxValue)throw this.props.minValue=void 0,this.props.maxValue=void 0,new Error("Error setting CharacteristicsProps for '"+this.displayName+"': 'minValue' cannot be greater or equal the 'maxValue'!");if(((0,v.isNumericFormat)(this.props.format)||"string"===this.props.format)&&null!=this.value&&!r&&0===this.statusCode&&this.UUID!==t.ProgrammableSwitchEvent.UUID){var i=this.validateUserInput(this.value,"debug-message");i!==this.value&&this.updateValue(i)}return this},t.prototype.validValuesIterator=function(){return new S(this.props)},t.prototype.setupAdditionalAuthorization=function(e){this.props.perms.includes("aa")||this.props.perms.push("aa"),this.additionalAuthorizationHandler=e},t.prototype.getValue=function(e,t){this.handleGetRequest(void 0,t).then((function(t){e&&e(null,t)}),(function(t){e&&e(t)}))},t.prototype.setValue=function(e,t,r){if(e instanceof Error)return this.statusCode=e instanceof g.HapStatusError?e.hapStatus:_(e),this.status=e,t&&t(),this;t&&!r&&"function"!=typeof t&&(r=t,t=void 0);try{e=this.validateUserInput(e)}catch(e){return this.characteristicWarning((null==e?void 0:e.message)+"","error-message",null==e?void 0:e.stack),t&&t(e),this}return this.handleSetRequest(e,void 0,r).then((function(e){t&&(e?t(null,e):t(null))}),(function(e){t&&t(e)})),this},t.prototype.updateValue=function(e,t,r){if(e instanceof Error)return this.statusCode=e instanceof g.HapStatusError?e.hapStatus:_(e),this.status=e,t&&t(),this;t&&!r&&"function"!=typeof t&&(r=t,t=void 0);try{e=this.validateUserInput(e)}catch(e){return this.characteristicWarning((null==e?void 0:e.message)+"","error-message",null==e?void 0:e.stack),t&&t(),this}this.statusCode=0,this.status=null;var i=this.value;return this.value=e,t&&t(),this.emit("change",{originator:void 0,oldValue:i,newValue:e,reason:"update",context:r}),this},t.prototype.sendEventNotification=function(e,t){this.statusCode=0,this.status=null,e=this.validateUserInput(e);var r=this.value;return this.value=e,this.emit("change",{originator:void 0,oldValue:r,newValue:e,reason:"event",context:t}),this},t.prototype.handleGetRequest=function(e,r){return u.__awaiter(this,void 0,void 0,(function(){var i,n,o,a,s=this;return u.__generator(this,(function(c){switch(c.label){case 0:if(!this.props.perms.includes("pr"))throw-70405;if(this.UUID===t.ProgrammableSwitchEvent.UUID)return[2,null];if(!this.getHandler)return[3,4];this.listeners("get").length>0&&this.characteristicWarning("Ignoring on('get') handler as onGet handler was defined instead"),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.getHandler(r,e)];case 2:i=c.sent(),this.statusCode=0,this.status=null;try{i=this.validateUserInput(i)}catch(e){return this.characteristicWarning("An illegal value was supplied by the read handler for characteristic: ".concat(null==e?void 0:e.message),"warn-message",null==e?void 0:e.stack),this.statusCode=-70402,this.status=e,[2,Promise.reject(-70402)]}return n=this.value,this.value=i,n!==i&&this.emit("change",{originator:e,oldValue:n,newValue:i,reason:"read",context:r}),[2,i];case 3:throw"number"==typeof(o=c.sent())?(a=new g.HapStatusError(o),this.statusCode=a.hapStatus,this.status=a):o instanceof g.HapStatusError?(this.statusCode=o.hapStatus,this.status=o):(this.characteristicWarning("Unhandled error thrown inside read handler for characteristic: ".concat(null==o?void 0:o.message),"error-message",null==o?void 0:o.stack),this.statusCode=-70402,this.status=o),this.statusCode;case 4:if(0===this.listeners("get").length){if(this.statusCode)throw this.statusCode;try{return[2,this.validateUserInput(this.value)]}catch(e){return this.characteristicWarning("An illegal value was supplied by setting `value` for characteristic: ".concat(null==e?void 0:e.message),"warn-message",null==e?void 0:e.stack),[2,Promise.reject(-70402)]}}return[2,new Promise((function(t,i){try{s.emit("get",(0,m.once)((function(n,o){if(n){if("number"==typeof n){var a=new g.HapStatusError(n);s.statusCode=a.hapStatus,s.status=a}else n instanceof g.HapStatusError?(s.statusCode=n.hapStatus,s.status=n):(C("[%s] Received error from get handler %s",s.displayName,n.stack),s.statusCode=_(n),s.status=n);i(s.statusCode)}else{s.statusCode=0,s.status=null,o=s.validateUserInput(o);var c=s.value;s.value=o,t(o),c!==o&&s.emit("change",{originator:e,oldValue:c,newValue:o,reason:"read",context:r})}})),r,e)}catch(e){s.characteristicWarning("Unhandled error thrown inside read handler for characteristic: ".concat(null==e?void 0:e.message),"error-message",null==e?void 0:e.stack),s.statusCode=-70402,s.status=e,i(-70402)}}))]}}))}))},t.prototype.handleSetRequest=function(e,t,r){return u.__awaiter(this,void 0,void 0,(function(){var i,n,o,a,s=this;return u.__generator(this,(function(c){switch(c.label){case 0:if(this.statusCode=0,this.status=null,void 0!==t)try{e=this.validateClientSuppliedValue(e)}catch(e){return C("[".concat(this.displayName,"]"),e.message),[2,Promise.reject(-70410)]}if(i=this.value,!this.setHandler)return[3,4];this.listeners("set").length>0&&this.characteristicWarning("Ignoring on('set') handler as onSet handler was defined instead"),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.setHandler(e,r,t)];case 2:return n=c.sent(),this.statusCode=0,this.status=null,null!=n&&this.props.perms.includes("wr")?(this.value=this.validateUserInput(n),[2,this.value]):(null!=n&&this.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response","debug-message"),this.value=e,this.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}),[2]);case 3:throw"number"==typeof(o=c.sent())?(a=new g.HapStatusError(o),this.statusCode=a.hapStatus,this.status=a):o instanceof g.HapStatusError?(this.statusCode=o.hapStatus,this.status=o):(this.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(null==o?void 0:o.message),"error-message",null==o?void 0:o.stack),this.statusCode=-70402,this.status=o),this.statusCode;case 4:return 0===this.listeners("set").length?(this.value=e,this.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}),[2,Promise.resolve()]):[2,new Promise((function(n,o){try{s.emit("set",e,(0,m.once)((function(a,c){if(a){if("number"==typeof a){var u=new g.HapStatusError(a);s.statusCode=u.hapStatus,s.status=u}else a instanceof g.HapStatusError?(s.statusCode=a.hapStatus,s.status=a):(C("[%s] Received error from set handler %s",s.displayName,a.stack),s.statusCode=_(a),s.status=a);o(s.statusCode)}else s.statusCode=0,s.status=null,null!=c&&s.props.perms.includes("wr")?(s.value=s.validateUserInput(c),n(s.value)):(null!=c&&s.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response","debug-message"),s.value=e,n(),s.emit("change",{originator:t,oldValue:i,newValue:e,reason:"write",context:r}))})),r,t)}catch(e){s.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(null==e?void 0:e.message),"error-message",null==e?void 0:e.stack),s.statusCode=-70402,s.status=e,o(-70402)}}))]}}))}))},t.prototype.subscribe=function(){0===this.subscriptions&&this.emit("subscribe"),this.subscriptions++},t.prototype.unsubscribe=function(){var e=1===this.subscriptions;this.subscriptions--,this.subscriptions=Math.max(this.subscriptions,0),e&&this.emit("unsubscribe")},t.prototype.getDefaultValue=function(){var e;switch(this.props.format){case"bool":return!1;case"string":switch(this.UUID){case t.Manufacturer.UUID:return"Default-Manufacturer";case t.Model.UUID:return"Default-Model";case t.SerialNumber.UUID:return"Default-SerialNumber";case t.FirmwareRevision.UUID:return"0.0.0";default:return""}case"data":case"tlv8":return"";case"dict":return{};case"array":return[];case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":return this.UUID===t.CurrentTemperature.UUID?0:(null===(e=this.props.validValues)||void 0===e?void 0:e.length)&&"number"==typeof this.props.validValues[0]?this.props.validValues[0]:"number"==typeof this.props.minValue&&Number.isFinite(this.props.minValue)?this.props.minValue:0;default:return 0}},t.prototype.validateClientSuppliedValue=function(e){if(null==e)throw new Error("Client supplied invalid value for ".concat(this.props.format,": ").concat(e));switch(this.props.format){case"bool":if("boolean"==typeof e)return e;if("number"==typeof e&&(1===e||0===e))return Boolean(e);throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":if("boolean"==typeof e&&(e=e?1:0),"number"!=typeof e||!Number.isFinite(e))throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));var t=T(this.props.minValue,(0,v.numericLowerBound)(this.props.format)),r=A(this.props.maxValue,(0,v.numericUpperBound)(this.props.format));if("number"==typeof t&&er)throw new Error("Client supplied value of ".concat(e," is greater than the maximum allowed value of ").concat(r));if(this.props.validValues&&!this.props.validValues.includes(e))throw new Error("Client supplied value of ".concat(e," is not in ").concat(this.props.validValues.toString()));if(this.props.validValueRanges&&2===this.props.validValueRanges.length){if(ethis.props.validValueRanges[1])throw new Error("Client supplied value of ".concat(e," is greater than the maximum allowed value of ").concat(this.props.validValueRanges[1]))}return e;case"string":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));var i=null!=this.props.maxLen?this.props.maxLen:64;if(e.length>i)throw new Error("Client supplied value length of ".concat(e.length," exceeds maximum length allowed of ").concat(i));return e;case"data":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));i=null!=this.props.maxDataLen?this.props.maxDataLen:2097152;if(e.length>i)throw new Error("Client supplied value length of ".concat(e.length," exceeds maximum length allowed of ").concat(i));return e;case"tlv8":if("string"!=typeof e)throw new Error("Client supplied invalid type for ".concat(this.props.format,': "').concat(e,'" (').concat(typeof e,")"));return e}return e},t.prototype.validateUserInput=function(e,r){var i;if(void 0===r&&(r="warn-message"),null===e){if(this.UUID===t.Model.UUID||this.UUID===t.SerialNumber.UUID)return this.characteristicWarning("characteristic must have a non null value otherwise HomeKit will reject this accessory, ignoring new value","error-message"),this.value;if("data"===this.props.format||"tlv8"===this.props.format)return e;if(!this.UUID.endsWith(y.BASE_UUID))return e;if(this.UUID===t.ProgrammableSwitchEvent.UUID)return e;if(this.characteristicWarning("characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics",r),null!==this.value)return this.value}switch(this.props.format){case"bool":return"boolean"==typeof e?e:"number"==typeof e?1===e:"string"==typeof e?"1"===e||"true"===e:(this.characteristicWarning("characteristic value expected boolean and received "+typeof e,r),!1);case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":"boolean"==typeof e&&(e=e?1:0),"string"==typeof e&&(e="float"===this.props.format?parseFloat(e):parseInt(e,10)),"number"==typeof e&&Number.isFinite(e)||(this.characteristicWarning('characteristic value expected valid finite number and received "'.concat(e,'" (').concat(typeof e,")"),r),e="number"==typeof this.value?this.value:this.props.minValue||0);var n=T(this.props.minValue,(0,v.numericLowerBound)(this.props.format)),o=A(this.props.maxValue,(0,v.numericUpperBound)(this.props.format)),a=void 0;if(null!=(a="float"===this.props.format?this.props.minStep:T(this.props.minStep,1))&&a>0){var s=null!=this.props.minValue?this.props.minValue:0;e=a*Math.round((e-s)/a)+s}return null!=n&&eo&&(this.characteristicWarning("characteristic was supplied illegal value: number ".concat(e," exceeded maximum of ").concat(o),r),e=o),this.props.validValues&&!this.props.validValues.includes(e)?(this.characteristicWarning("characteristic value ".concat(e," is not contained in valid values array"),r),this.props.validValues.includes(this.value)?this.value:this.props.validValues[0]||0):(this.props.validValueRanges&&2===this.props.validValueRanges.length&&(ethis.props.validValueRanges[1]&&(this.characteristicWarning("characteristic was supplied illegal value: number ".concat(e," not contained in valid value range of ").concat(this.props.validValueRanges,", supplying illegal values will throw errors in the future"),r),e=this.props.validValueRanges[1])),e);case"string":if("number"==typeof e&&(this.characteristicWarning("characteristic was supplied illegal value: number instead of string, supplying illegal values will throw errors in the future",r),e=String(e)),"string"!=typeof e&&(this.characteristicWarning("characteristic value expected string and received "+typeof e,r),e="string"==typeof this.value?this.value:e+""),e.length<=1&&(this.UUID===t.Model.UUID||this.UUID===t.SerialNumber.UUID))return this.characteristicWarning("[".concat(this.displayName,"] characteristic must have a length of more than 1 character otherwise HomeKit will reject this accessory, ignoring new value"),r),this.value;var c=null!==(i=this.props.maxLen)&&void 0!==i?i:64;return e.length>c&&(this.characteristicWarning("characteristic was supplied illegal value: string '".concat(e,"' exceeded max length of ").concat(c),r),e=e.substring(0,c)),e;case"data":if("string"!=typeof e)throw new Error("characteristic with DATA format must have string value");if(null!=this.props.maxDataLen&&e.length>this.props.maxDataLen)throw new Error("characteristic with DATA format exceeds specified maxDataLen");return e;case"tlv8":return void 0===e?(this.characteristicWarning("characteristic was supplied illegal value: undefined",r),this.value):e}return void 0===e?(this.characteristicWarning("characteristic was supplied illegal value: undefined","error-message"),this.value):e},t.prototype._assignID=function(e,t,r,i){this.iid=e.getIID(t,r,i,this.UUID)},t.prototype.characteristicWarning=function(e,t,r){void 0===t&&(t="warn-message"),void 0===r&&(r=(new Error).stack),this.emit("characteristic-warning",t,e,r)},t.prototype.removeAllListeners=function(t){return t||(this.removeOnGet(),this.removeOnSet()),e.prototype.removeAllListeners.call(this,t)},t.prototype.replaceBy=function(e){var t=this;this.props=e.props,this.updateValue(e.value);var r=e.listeners("get");r.length&&(this.removeAllListeners("get"),r.forEach((function(e){return t.addListener("get",e)}))),this.removeOnGet(),e.getHandler&&this.onGet(e.getHandler);var i=e.listeners("set");i.length&&(this.removeAllListeners("set"),i.forEach((function(e){return t.addListener("set",e)}))),this.removeOnSet(),e.setHandler&&this.onSet(e.setHandler)},t.prototype.toHAP=function(e){return u.__awaiter(this,arguments,void 0,(function(e,r){var i,n,o,a=this;return void 0===r&&(r=!0),u.__generator(this,(function(s){switch(s.label){case 0:return i=this.internalHAPRepresentation(),this.props.perms.includes("pr")?[3,1]:(i.value=void 0,[3,6]);case 1:return this.UUID!==t.ProgrammableSwitchEvent.UUID?[3,2]:(i.value=null,[3,6]);case 2:return r?[4,this.handleGetRequest(e).catch((function(){var e=a.getDefaultValue();return C("[%s] Error getting value for characteristic on /accessories request. Returning default value instead: %s",a.displayName,"".concat(e)),e}))]:[3,4];case 3:return o=s.sent(),[3,5];case 4:o=this.value,s.label=5;case 5:n=o,i.value=(0,v.formatOutgoingCharacteristicValue)(n,this.props),s.label=6;case 6:return[2,i]}}))}))},t.prototype.internalHAPRepresentation=function(){return(0,l.default)(this.iid,"iid cannot be undefined for characteristic '"+this.displayName+"'"),{type:(0,y.toShortForm)(this.UUID),iid:this.iid,value:null,perms:this.props.perms,description:this.props.description||this.displayName,format:this.props.format,unit:this.props.unit,minValue:this.props.minValue,maxValue:this.props.maxValue,minStep:this.props.minStep,maxLen:this.props.maxLen,maxDataLen:this.props.maxDataLen,"valid-values":this.props.validValues,"valid-values-range":this.props.validValueRanges}},t.serialize=function(e){var r;return"Characteristic"!==e.constructor.name&&(r=e.constructor.name),{displayName:e.displayName,UUID:e.UUID,eventOnlyCharacteristic:e.UUID===t.ProgrammableSwitchEvent.UUID,constructorName:r,value:e.value,props:(0,f.clone)({},e.props)}},t.deserialize=function(e){var r;e.constructorName&&e.constructorName.charAt(0).toUpperCase()===e.constructorName.charAt(0)&&t[e.constructorName]?((r=new(0,t[e.constructorName])).displayName=e.displayName,r.setProps(e.props)):r=new t(e.displayName,e.UUID,e.props);return r.value=e.value,r},t.Formats=i,t.Units=n,t.Perms=o,t}(d.EventEmitter);t.Characteristic=I,r(651)},589:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPServer=t.HAPServerEventTypes=t.HAPPairingHTTPCode=t.HAPHTTPCode=t.Status=t.Codes=t.IsKnownHAPStatusError=t.HAPStatus=t.TLVErrorCode=void 0;var i,n,o,a,s,c=r(1635),u=c.__importDefault(r(6982)),l=c.__importDefault(r(5753)),h=r(4434),d=r(4618),p=c.__importDefault(r(8947)),f=r(7016),g=r(8602),m=r(9593),v=c.__importStar(r(8)),y=r(7739),C=c.__importStar(r(3314)),S=(0,l.default)("HAP-NodeJS:HAPServer");!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.INVALID_REQUEST=2]="INVALID_REQUEST",e[e.AUTHENTICATION=2]="AUTHENTICATION",e[e.BACKOFF=3]="BACKOFF",e[e.MAX_PEERS=4]="MAX_PEERS",e[e.MAX_TRIES=5]="MAX_TRIES",e[e.UNAVAILABLE=6]="UNAVAILABLE",e[e.BUSY=7]="BUSY"}(i||(t.TLVErrorCode=i={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.INSUFFICIENT_PRIVILEGES=-70401]="INSUFFICIENT_PRIVILEGES",e[e.SERVICE_COMMUNICATION_FAILURE=-70402]="SERVICE_COMMUNICATION_FAILURE",e[e.RESOURCE_BUSY=-70403]="RESOURCE_BUSY",e[e.READ_ONLY_CHARACTERISTIC=-70404]="READ_ONLY_CHARACTERISTIC",e[e.WRITE_ONLY_CHARACTERISTIC=-70405]="WRITE_ONLY_CHARACTERISTIC",e[e.NOTIFICATION_NOT_SUPPORTED=-70406]="NOTIFICATION_NOT_SUPPORTED",e[e.OUT_OF_RESOURCE=-70407]="OUT_OF_RESOURCE",e[e.OPERATION_TIMED_OUT=-70408]="OPERATION_TIMED_OUT",e[e.RESOURCE_DOES_NOT_EXIST=-70409]="RESOURCE_DOES_NOT_EXIST",e[e.INVALID_VALUE_IN_REQUEST=-70410]="INVALID_VALUE_IN_REQUEST",e[e.INSUFFICIENT_AUTHORIZATION=-70411]="INSUFFICIENT_AUTHORIZATION",e[e.NOT_ALLOWED_IN_CURRENT_STATE=-70412]="NOT_ALLOWED_IN_CURRENT_STATE"}(n||(t.HAPStatus=n={})),t.IsKnownHAPStatusError=function(e){return e>=-70412&&e<=-70401},t.Codes=i,t.Status=n,function(e){e[e.OK=200]="OK",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE"}(o||(t.HAPHTTPCode=o={})),function(e){e[e.OK=200]="OK",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.CONNECTION_AUTHORIZATION_REQUIRED=470]="CONNECTION_AUTHORIZATION_REQUIRED",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR"}(a||(t.HAPPairingHTTPCode=a={})),function(e){e.LISTENING="listening",e.IDENTIFY="identify",e.ADD_PAIRING="add-pairing",e.REMOVE_PAIRING="remove-pairing",e.LIST_PAIRINGS="list-pairings",e.PAIR="pair",e.ACCESSORIES="accessories",e.GET_CHARACTERISTICS="get-characteristics",e.SET_CHARACTERISTICS="set-characteristics",e.REQUEST_RESOURCE="request-resource",e.CONNECTION_CLOSED="connection-closed"}(s||(t.HAPServerEventTypes=s={}));var E=function(e){function t(t){var r=e.call(this)||this;return r.unsuccessfulPairAttempts=0,r.accessoryInfo=t,r.allowInsecureRequest=!1,r.httpServer=new m.EventedHTTPServer,r.httpServer.on("listening",r.onListening.bind(r)),r.httpServer.on("request",r.handleRequestOnHAPConnection.bind(r)),r.httpServer.on("connection-closed",r.handleConnectionClosed.bind(r)),r}return c.__extends(t,e),t.prototype.listen=function(e,t){void 0===e&&(e=0),"::"===t&&(t=void 0),this.httpServer.listen(e,t)},t.prototype.stop=function(){this.httpServer.stop()},t.prototype.destroy=function(){this.stop(),this.removeAllListeners()},t.prototype.sendEventNotifications=function(e,t,r,i,n){try{this.httpServer.broadcastEvent(e,t,r,i,n)}catch(e){console.warn("["+this.accessoryInfo.username+"] Error when sending event notifications: "+e.message)}},t.prototype.onListening=function(e,t){this.emit("listening",e,t)},t.prototype.handleRequestOnHAPConnection=function(e,t,r){var i=this;S("[%s] HAP Request: %s %s",this.accessoryInfo.username,t.method,t.url);var n=[];t.on("data",(function(e){return n.push(e)})),t.on("end",(function(){var o=new f.URL(t.url,"http://hap-nodejs.local"),a=i.getHandler(o);if(a){var s=Buffer.concat(n);try{a(e,o,t,s,r)}catch(e){S("[%s] Error executing route handler: %s",i.accessoryInfo.username,e.stack),r.writeHead(500,{"Content-Type":"application/hap+json"}),r.end(JSON.stringify({status:-70403}))}}else S("[%s] WARNING: Handler for %s not implemented",i.accessoryInfo.username,t.url),r.writeHead(404,{"Content-Type":"application/hap+json"}),r.end(JSON.stringify({status:-70409}))}))},t.prototype.handleConnectionClosed=function(e){this.emit("connection-closed",e)},t.prototype.getHandler=function(e){switch(e.pathname.toLowerCase()){case"/identify":return this.handleIdentifyRequest.bind(this);case"/pair-setup":return this.handlePairSetup.bind(this);case"/pair-verify":return this.handlePairVerify.bind(this);case"/pairings":return this.handlePairings.bind(this);case"/accessories":return this.handleAccessories.bind(this);case"/characteristics":return this.handleCharacteristics.bind(this);case"/prepare":return this.handlePrepareWrite.bind(this);case"/resource":return this.handleResource.bind(this);default:return}},t.prototype.handleIdentifyRequest=function(e,t,r,i,n){var o=this;if(this.accessoryInfo.paired()&&!this.allowInsecureRequest)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));this.emit("identify",(0,y.once)((function(e){e?(S("[%s] Identification error: %s",o.accessoryInfo.username,e.message),n.writeHead(500,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70403}))):(S("[%s] Identification success",o.accessoryInfo.username),n.writeHead(204),n.end())})))},t.prototype.handlePairSetup=function(e,t,r,i,n){if(!this.allowInsecureRequest&&this.accessoryInfo.paired())return n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,2,7,6));if(this.unsuccessfulPairAttempts>100)return S("[%s] Reached maximum amount of unsuccessful pair attempts!",this.accessoryInfo.username),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,2,7,5));var o=C.decode(i),a=o[6][0];if(1===a)this.handlePairSetupM1(e,r,n);else if(3===a&&2===e._pairSetupState)this.handlePairSetupM3(e,r,n,o);else{if(5!==a||4!==e._pairSetupState)return n.writeHead(400,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,a+1,7,1));this.handlePairSetupM5(e,r,n,o)}},t.prototype.handlePairSetupM1=function(e,t,r){var i=this;S("[%s] Pair step 1/5",this.accessoryInfo.username);var n=u.default.randomBytes(16),o=d.SRP.params.hap;d.SRP.genKey(32).then((function(t){var a=new d.SrpServer(o,n,Buffer.from("Pair-Setup"),Buffer.from(i.accessoryInfo.pincode),t),s=a.computeB();e.srpServer=a,r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,2,2,n,3,s)),e._pairSetupState=2})).catch((function(e){S("[%s] Error occurred when generating srp key: %s",i.accessoryInfo.username,e.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,2,7,1))}))},t.prototype.handlePairSetupM3=function(e,t,r,i){S("[%s] Pair step 2/5",this.accessoryInfo.username);var n=i[3],o=i[4],a=e.srpServer;a.setA(n);try{a.checkM1(o)}catch(t){return this.unsuccessfulPairAttempts++,S("[%s] Error while checking pincode: %s",this.accessoryInfo.username,t.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,7,2)),void(e._pairSetupState=void 0)}var s=a.computeM2();r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,4,s)),e._pairSetupState=4},t.prototype.handlePairSetupM5=function(e,t,r,i){S("[%s] Pair step 3/5",this.accessoryInfo.username);var n=e.srpServer,o=i[5],a=Buffer.alloc(o.length-16),s=Buffer.alloc(16);o.copy(a,0,0,o.length-16),o.copy(s,0,o.length-16,o.length);var c,u=n.computeK(),l=Buffer.from("Pair-Setup-Encrypt-Salt"),h=Buffer.from("Pair-Setup-Encrypt-Info"),d=v.HKDF("sha512",l,u,h,32);try{c=v.chacha20_poly1305_decryptAndVerify(d,Buffer.from("PS-Msg05"),null,a,s)}catch(t){return S("[%s] Error while decrypting and verifying M5 subTlv: %s",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,7,2)),void(e._pairSetupState=void 0)}var p=C.decode(c),f=p[1],g=p[3],m=p[10];this.handlePairSetupM5_2(e,t,r,f,g,m,d)},t.prototype.handlePairSetupM5_2=function(e,t,r,i,n,o,a){S("[%s] Pair step 4/5",this.accessoryInfo.username);var s=e.srpServer.computeK(),c=Buffer.from("Pair-Setup-Controller-Sign-Salt"),u=Buffer.from("Pair-Setup-Controller-Sign-Info"),l=v.HKDF("sha512",c,s,u,32),h=Buffer.concat([l,i,n]);if(!p.default.sign.detached.verify(h,o,n))return S("[%s] Invalid signature",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,6,7,2)),void(e._pairSetupState=void 0);this.handlePairSetupM5_3(e,t,r,i,n,a)},t.prototype.handlePairSetupM5_3=function(e,t,r,i,n,o){var a=this;S("[%s] Pair step 5/5",this.accessoryInfo.username);var s=e.srpServer.computeK(),c=Buffer.from("Pair-Setup-Accessory-Sign-Salt"),u=Buffer.from("Pair-Setup-Accessory-Sign-Info"),l=v.HKDF("sha512",c,s,u,32),h=this.accessoryInfo.signPk,d=Buffer.from(this.accessoryInfo.username),f=Buffer.concat([l,d,h]),g=Buffer.from(this.accessoryInfo.signSk),m=p.default.sign.detached(f,g),E=C.encode(1,d,3,h,10,m),_=v.chacha20_poly1305_encryptAndSeal(o,Buffer.from("PS-Msg06"),null,E);this.emit("pair",i.toString(),n,(0,y.once)((function(t){if(t)return S("[%s] Error adding pairing info: %s",a.accessoryInfo.username,t.message),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,6,7,1)),void(e._pairSetupState=void 0);r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,6,5,Buffer.concat([_.ciphertext,_.authTag]))),e._pairSetupState=void 0})))},t.prototype.handlePairVerify=function(e,t,r,i,n){var o=C.decode(i),a=o[6][0];if(1===a)this.handlePairVerifyM1(e,r,n,o);else{if(3!==a||2!==e._pairVerifyState)return n.writeHead(400,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,a+1,7,1));this.handlePairVerifyM3(e,r,n,o)}},t.prototype.handlePairVerifyM1=function(e,t,r,i){S("[%s] Pair verify step 1/2",this.accessoryInfo.username);var n=i[3],o=v.generateCurve25519KeyPair(),a=Buffer.from(o.secretKey),s=Buffer.from(o.publicKey),c=Buffer.from(v.generateCurve25519SharedSecKey(a,n)),u=Buffer.from(this.accessoryInfo.username),l=Buffer.concat([s,u,n]),h=Buffer.from(this.accessoryInfo.signSk),d=p.default.sign.detached(l,h),f=Buffer.from("Pair-Verify-Encrypt-Salt"),g=Buffer.from("Pair-Verify-Encrypt-Info"),y=v.HKDF("sha512",f,c,g,32).slice(0,32);e.encryption=new m.HAPEncryption(n,a,s,c,y);var E=C.encode(1,u,10,d),_=v.chacha20_poly1305_encryptAndSeal(y,Buffer.from("PV-Msg02"),null,E);r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,2,5,Buffer.concat([_.ciphertext,_.authTag]),3,s)),e._pairVerifyState=2},t.prototype.handlePairVerifyM3=function(e,t,r,i){S("[%s] Pair verify step 2/2",this.accessoryInfo.username);var n=i[5],o=Buffer.alloc(n.length-16),a=Buffer.alloc(16);n.copy(o,0,0,n.length-16),n.copy(a,0,n.length-16,n.length);var s,c=e.encryption;try{s=v.chacha20_poly1305_decryptAndVerify(c.hkdfPairEncryptionKey,Buffer.from("PV-Msg03"),null,o,a)}catch(t){return S("[%s] M3: Failed to decrypt and/or verify",this.accessoryInfo.username),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,7,2)),void(e._pairVerifyState=void 0)}var u=C.decode(s),l=u[1],h=u[10],d=Buffer.concat([c.clientPublicKey,l,c.publicKey]),f=this.accessoryInfo.getClientPublicKey(l.toString());if(!f)return S("[%s] Client %s attempting to verify, but we are not paired; rejecting client",this.accessoryInfo.username,l),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,7,2)),void(e._pairVerifyState=void 0);if(!p.default.sign.detached.verify(d,h,f))return S("[%s] Client %s provided an invalid signature",this.accessoryInfo.username,l),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4,7,2)),void(e._pairVerifyState=void 0);S("[%s] Client %s verification complete",this.accessoryInfo.username,l),r.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),r.end(C.encode(6,4));var g=Buffer.from("Control-Salt"),m=Buffer.from("Control-Read-Encryption-Key"),y=Buffer.from("Control-Write-Encryption-Key");c.accessoryToControllerKey=v.HKDF("sha512",g,c.sharedSecret,m,32),c.controllerToAccessoryKey=v.HKDF("sha512",g,c.sharedSecret,y,32),e.connectionAuthenticated(l.toString()),e._pairVerifyState=void 0},t.prototype.handlePairings=function(e,t,r,i,n){var o=this;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));var a=C.decode(i),s=a[0][0];if(1===a[6][0])if(3===s){var u=a[1].toString(),l=a[3],h=a[11][0];this.emit("add-pairing",e,u,l,h,(0,y.once)((function(e){if(e>0)return S("[%s] Pairings: failed ADD_PAIRING with code %d",o.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,2,7,e));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(C.encode(6,2)),S("[%s] Pairings: successfully executed ADD_PAIRING",o.accessoryInfo.username)})))}else if(4===s){u=a[1].toString();this.emit("remove-pairing",e,u,(0,y.once)((function(e){if(e>0)return S("[%s] Pairings: failed REMOVE_PAIRING with code %d",o.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,2,7,e));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(C.encode(6,2)),S("[%s] Pairings: successfully executed REMOVE_PAIRING",o.accessoryInfo.username)})))}else 5===s&&this.emit("list-pairings",e,(0,y.once)((function(e,t){if(e>0)return S("[%s] Pairings: failed LIST_PAIRINGS with code %d",o.accessoryInfo.username,e),n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),void n.end(C.encode(6,2,7,e));var r=[];t.forEach((function(e,t){t>0&&r.push(255,Buffer.alloc(0)),r.push(1,e.username,3,e.publicKey,11,e.permission)}));var i=C.encode.apply(C,c.__spreadArray([6,2],c.__read(r),!1));n.writeHead(200,{"Content-Type":"application/pairing+tlv8"}),n.end(i),S("[%s] Pairings: successfully executed LIST_PAIRINGS",o.accessoryInfo.username)})))},t.prototype.handleAccessories=function(e,t,r,i,n){if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));this.emit("accessories",e,(0,y.once)((function(e,t){e?(n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:e.status}))):(n.writeHead(200,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify(t)))})))},t.prototype.handleCharacteristics=function(e,t,r,i,n){var o,a;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("GET"===r.method){var s=t.searchParams,u=s.get("id");if(!u)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var l=[];try{for(var h=c.__values(u.split(",")),d=h.next();!d.done;d=h.next()){var p=d.value.split(".");l.push({aid:parseInt(p[0],10),iid:parseInt(p[1],10)})}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}var f={ids:l,includeMeta:(0,g.consideredTrue)(s.get("meta")),includePerms:(0,g.consideredTrue)(s.get("perms")),includeType:(0,g.consideredTrue)(s.get("type")),includeEvent:(0,g.consideredTrue)(s.get("ev"))};this.emit("get-characteristics",e,f,(0,y.once)((function(e,t){var r,i,o,a;if(e)return n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:e.status}));var s=t.characteristics,u=!1;try{for(var l=c.__values(s),h=l.next();!h.done;h=l.next()){if(h.value.status){u=!0;break}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(u)try{for(var d=c.__values(s),p=d.next();!p.done;p=d.next()){var f=p.value;f.status||(f.status=0)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}n.writeHead(u?207:200,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({characteristics:s}))})))}else if("PUT"===r.method){if(!e.isAuthenticated()&&(!r.headers||r.headers&&r.headers.authorization!==this.accessoryInfo.pincode))return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var m=JSON.parse(i.toString("utf8"));this.emit("set-characteristics",e,m,(0,y.once)((function(e,t){var r,i;if(e)return n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:e.status}));var o=t.characteristics,a=!1;try{for(var s=c.__values(o),u=s.next();!u.done;u=s.next()){var l=u.value;if(l.status||void 0!==l.value){a=!0;break}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}a?(n.writeHead(207,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({characteristics:o}))):(n.writeHead(204),n.end())})))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t.prototype.handlePrepareWrite=function(e,t,r,i,n){var o=this;if(!this.allowInsecureRequest&&!e.isAuthenticated())return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("PUT"===r.method){if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var a=JSON.parse(i.toString());if(a.pid&&a.ttl)return S("[%s] Received prepare write request with pid %d and ttl %d",this.accessoryInfo.username,a.pid,a.ttl),e.timedWriteTimeout&&clearTimeout(e.timedWriteTimeout),e.timedWritePid=a.pid,e.timedWriteTimeout=setTimeout((function(){S("[%s] Timed write request timed out for pid %d",o.accessoryInfo.username,a.pid),e.timedWritePid=void 0,e.timedWriteTimeout=void 0}),a.ttl),n.writeHead(200,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:0}));n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t.prototype.handleResource=function(e,t,r,i,n){if(!(e.isAuthenticated()||this.allowInsecureRequest&&r.headers&&r.headers.authorization===this.accessoryInfo.pincode))return n.writeHead(470,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70401}));if("POST"===r.method){if(0===i.length)return n.writeHead(400,{"Content-Type":"application/hap+json"}),void n.end(JSON.stringify({status:-70410}));var o=JSON.parse(i.toString());this.emit("request-resource",o,(0,y.once)((function(e,t){e?(n.writeHead(e.httpCode,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:e.status}))):(n.writeHead(200,{"Content-Type":"image/jpeg"}),n.end(t))})))}else n.writeHead(400,{"Content-Type":"application/hap+json"}),n.end(JSON.stringify({status:-70410}))},t}(h.EventEmitter);t.HAPServer=E},5876:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Service=t.ServiceEventTypes=void 0;var i,n=r(1635),o=n.__importDefault(r(2613)),a=n.__importDefault(r(5753)),s=r(4434),c=r(9826),u=r(2997),l=(0,a.default)("HAP-NodeJS:Service");!function(e){e.CHARACTERISTIC_CHANGE="characteristic-change",e.SERVICE_CONFIGURATION_CHANGE="service-configurationChange",e.CHARACTERISTIC_WARNING="characteristic-warning"}(i||(t.ServiceEventTypes=i={}));var h=function(e){function t(t,r,i){void 0===t&&(t="");var n=e.call(this)||this;(n.iid=null,n.name=null,n.characteristics=[],n.optionalCharacteristics=[],n.isHiddenService=!1,n.isPrimaryService=!1,n.linkedServices=[],(0,o.default)(r,"Services must be created with a valid UUID."),n.displayName=t,n.UUID=r,n.subtype=i,t)&&(n.getCharacteristic(c.Characteristic.Name)||n.addCharacteristic(c.Characteristic.Name)).updateValue(t);return n}return n.__extends(t,e),t.prototype.getServiceId=function(){return this.UUID+(this.subtype||"")},t.prototype.addCharacteristic=function(e){for(var t,r,i=[],o=1;o=100)throw new Error("Cannot add more than 100 characteristics to a single service!");return this.setupCharacteristicEventHandlers(a),this.characteristics.push(a),this.emit("service-configurationChange"),a},t.prototype.setPrimaryService=function(e){void 0===e&&(e=!0),this.isPrimaryService=e,this.emit("service-configurationChange")},t.prototype.setHiddenService=function(e){void 0===e&&(e=!0),this.isHiddenService=e,this.emit("service-configurationChange")},t.prototype.addLinkedService=function(e){this.linkedServices.includes(e)||this.linkedServices.push(e),this.emit("service-configurationChange")},t.prototype.removeLinkedService=function(e){var t=this.linkedServices.indexOf(e);-1!==t&&this.linkedServices.splice(t,1),this.emit("service-configurationChange")},t.prototype.removeCharacteristic=function(e){var t=this.characteristics.indexOf(e);-1!==t&&(this.characteristics.splice(t,1),e.removeAllListeners(),this.emit("service-configurationChange"))},t.prototype.getCharacteristic=function(e){var t,r,i,o;try{for(var a=n.__values(this.characteristics),s=a.next();!s.done;s=a.next()){var u=s.value;if("string"==typeof e&&u.displayName===e)return u;if("function"==typeof e&&(u instanceof e||e.UUID===u.UUID))return u}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}if("function"==typeof e){try{for(var l=n.__values(this.optionalCharacteristics),h=l.next();!h.done;h=l.next()){if((u=h.value)instanceof e||e.UUID===u.UUID)return this.addCharacteristic(e)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}var d=this.addCharacteristic(e);return e.UUID!==c.Characteristic.Name.UUID&&this.emitCharacteristicWarningEvent(d,"warn-message","Characteristic not in required or optional characteristic section for service "+this.constructor.name+". Adding anyway."),d}},t.prototype.testCharacteristic=function(e){var t,r;try{for(var i=n.__values(this.characteristics),o=i.next();!o.done;o=i.next()){var a=o.value;if("string"==typeof e&&a.displayName===e)return!0;if("function"==typeof e&&(a instanceof e||e.UUID===a.UUID))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1},t.prototype.setCharacteristic=function(e,t){return this.getCharacteristic(e).setValue(t),this},t.prototype.updateCharacteristic=function(e,t){return this.getCharacteristic(e).updateValue(t),this},t.prototype.addOptionalCharacteristic=function(e){"function"==typeof e&&(e=new e),this.optionalCharacteristics.push(e)},t.prototype.replaceCharacteristicsFromService=function(e){var t=this;if(this.UUID!==e.UUID)throw new Error("Incompatible services. Tried replacing characteristics of ".concat(this.UUID," with characteristics from ").concat(e.UUID));var r={};e.characteristics.forEach((function(e){return r[e.UUID]=e})),this.characteristics.forEach((function(e){var t=r[e.UUID];if(t){if(delete r[e.UUID],!t.value&&0!==t.value&&!1!==t.value)return;e.replaceBy(t)}})),Object.values(r).forEach((function(e){return t.addCharacteristic(e)}))},t.prototype.getCharacteristicByIID=function(e){var t,r;try{for(var i=n.__values(this.characteristics),o=i.next();!o.done;o=i.next()){var a=o.value;if(a.iid===e)return a}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype._assignIDs=function(e,t,r){var i,o;void 0===r&&(r=0),"0000003E-0000-1000-8000-0026BB765291"===this.UUID?this.iid=1:this.iid=r+e.getIID(t,this.UUID,this.subtype);try{for(var a=n.__values(this.characteristics),s=a.next();!s.done;s=a.next()){s.value._assignID(e,t,this.UUID,this.subtype)}}catch(e){i={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}},t.prototype.toHAP=function(e,t){var r=this;return void 0===t&&(t=!0),new Promise((function(i){var a,s,c,h;(0,o.default)(r.iid,"iid cannot be undefined for service '"+r.displayName+"'"),(0,o.default)(r.characteristics.length,"service '"+r.displayName+"' does not have any characteristics!");var d={type:(0,u.toShortForm)(r.UUID),iid:r.iid,characteristics:[],hidden:!!r.isHiddenService||void 0,primary:!!r.isPrimaryService||void 0};if(r.linkedServices.length){d.linked=[];try{for(var p=n.__values(r.linkedServices),f=p.next();!f.done;f=p.next()){var g=f.value;g.iid?d.linked.push(g.iid):l("iid of linked service '".concat(g.displayName,"' ").concat(g.UUID," is undefined on service '").concat(r.displayName,"'"))}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}}var m=new Set,v=setTimeout((function(){var e,t;try{for(var o=n.__values(m),a=o.next();!a.done;a=o.next()){var s=a.value;r.emitCharacteristicWarningEvent(s,"slow-read","The read handler for the characteristic '".concat(s.displayName,"' was slow to respond!"))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}v=setTimeout((function(){var e,t;v=void 0;try{for(var o=n.__values(m),a=o.next();!a.done;a=o.next()){var s=a.value;r.emitCharacteristicWarningEvent(s,"timeout-read","The read handler for the characteristic '"+(null==s?void 0:s.displayName)+"' didn't respond at all!. Please check that you properly call the callback!"),d.characteristics.push(s.internalHAPRepresentation())}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}m.clear(),i(d)}),6e3)}),3e3),y=function(r){m.add(r),r.toHAP(e,t).then((function(e){v&&(m.delete(r),d.characteristics.push(e),0===m.size&&(v&&(clearTimeout(v),v=void 0),i(d)))}))};try{for(var C=n.__values(r.characteristics),S=C.next();!S.done;S=C.next()){y(S.value)}}catch(e){c={error:e}}finally{try{S&&!S.done&&(h=C.return)&&h.call(C)}finally{if(c)throw c.error}}}))},t.prototype.internalHAPRepresentation=function(){var e,t;(0,o.default)(this.iid,"iid cannot be undefined for service '"+this.displayName+"'"),(0,o.default)(this.characteristics.length,"service '"+this.displayName+"' does not have any characteristics!");var r={type:(0,u.toShortForm)(this.UUID),iid:this.iid,characteristics:this.characteristics.map((function(e){return e.internalHAPRepresentation()})),hidden:!!this.isHiddenService||void 0,primary:!!this.isPrimaryService||void 0};if(this.linkedServices.length){r.linked=[];try{for(var i=n.__values(this.linkedServices),a=i.next();!a.done;a=i.next()){var s=a.value;s.iid?r.linked.push(s.iid):l("iid of linked service '".concat(s.displayName,"' ").concat(s.UUID," is undefined on service '").concat(this.displayName,"'"))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}}return r},t.prototype.setupCharacteristicEventHandlers=function(e){var t=this;e.on("change",(function(r){t.emit("characteristic-change",n.__assign(n.__assign({},r),{characteristic:e}))})),e.on("characteristic-warning",this.emitCharacteristicWarningEvent.bind(this,e))},t.prototype.emitCharacteristicWarningEvent=function(e,t,r,i){this.emit("characteristic-warning",{characteristic:e,type:t,message:r,originatorChain:[this.displayName,e.displayName],stack:i})},t.prototype._sideloadCharacteristics=function(e){var t,r;try{for(var i=n.__values(e),o=i.next();!o.done;o=i.next()){var a=o.value;this.setupCharacteristicEventHandlers(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.characteristics=e.slice()},t.serialize=function(e){var t;return"Service"!==e.constructor.name&&(t=e.constructor.name),{displayName:e.displayName,UUID:e.UUID,subtype:e.subtype,constructorName:t,hiddenService:e.isHiddenService,primaryService:e.isPrimaryService,characteristics:e.characteristics.map((function(e){return c.Characteristic.serialize(e)})),optionalCharacteristics:e.optionalCharacteristics.map((function(e){return c.Characteristic.serialize(e)}))}},t.deserialize=function(e){var r;e.constructorName&&e.constructorName.charAt(0).toUpperCase()===e.constructorName.charAt(0)&&t[e.constructorName]?r=new(0,t[e.constructorName])(e.displayName,e.subtype):r=new t(e.displayName,e.UUID,e.subtype);r.isHiddenService=!!e.hiddenService,r.isPrimaryService=!!e.primaryService;var i=e.characteristics.map((function(e){return c.Characteristic.deserialize(e)}));return r._sideloadCharacteristics(i),e.optionalCharacteristics&&(r.optionalCharacteristics=e.optionalCharacteristics.map((function(e){return c.Characteristic.deserialize(e)}))),r},t}(s.EventEmitter);t.Service=h,r(1647)},9672:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyCameraSourceAdapter=void 0;var r=function(){function e(e){this.cameraSource=e}return e.prototype.handleSnapshotRequest=function(e,t){this.cameraSource.handleSnapshotRequest(e,(function(e,r){t(e||void 0,r)}))},e.prototype.prepareStream=function(e,t){this.cameraSource.prepareStream(e,(function(e){t(void 0,e)}))},e.prototype.handleStreamRequest=function(e,t){this.cameraSource.handleStreamRequest(e),t()},e.prototype.forwardCloseConnection=function(e){this.cameraSource.handleCloseConnection(e)},e}();t.LegacyCameraSourceAdapter=r},5989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635).__importDefault(r(7194)),n=function(){function e(e){this.options=e,this.startingPort=1e4,this.type=e.isIPV6?"udp6":"udp4",this.startingPort=1e4,this.outgoingAddress=e.outgoingAddress,this.outgoingPort=e.outgoingPort,this.incomingPayloadType=0,this.outgoingSSRC=e.outgoingSSRC,this.disabled=e.disabled,this.incomingSSRC=null,this.outgoingPayloadType=null}return e.prototype.setup=function(){var e=this;return this.createSocketPair(this.type).then((function(t){return e.incomingRTPSocket=t[0],e.incomingRTCPSocket=t[1],e.createSocket(e.type)})).then((function(t){e.outgoingSocket=t,e.onBound()}))},e.prototype.destroy=function(){this.incomingRTPSocket&&this.incomingRTPSocket.close(),this.incomingRTCPSocket&&this.incomingRTCPSocket.close(),this.outgoingSocket&&this.outgoingSocket.close()},e.prototype.incomingRTPPort=function(){var e=this.incomingRTPSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.incomingRTCPPort=function(){var e=this.incomingRTCPSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.outgoingLocalPort=function(){var e=this.outgoingSocket.address();if("string"!=typeof e)return e.port;throw new Error("Unsupported socket!")},e.prototype.setServerAddress=function(e){this.serverAddress=e},e.prototype.setServerRTPPort=function(e){this.serverRTPPort=e},e.prototype.setServerRTCPPort=function(e){this.serverRTCPPort=e},e.prototype.setIncomingPayloadType=function(e){this.incomingPayloadType=e},e.prototype.setOutgoingPayloadType=function(e){this.outgoingPayloadType=e},e.prototype.sendOut=function(e){this.outgoingAddress&&this.outgoingPort&&this.outgoingSocket.send(e,this.outgoingPort,this.outgoingAddress)},e.prototype.sendBack=function(e){this.serverAddress&&this.serverRTCPPort&&this.outgoingSocket.send(e,this.serverRTCPPort,this.serverAddress)},e.prototype.onBound=function(){var e=this;this.disabled||(this.incomingRTPSocket.on("message",(function(t){e.rtpMessage(t)})),this.incomingRTCPSocket.on("message",(function(t){e.rtcpMessage(t)})),this.outgoingSocket.on("message",(function(t){e.rtcpReply(t)})))},e.prototype.rtpMessage=function(e){if(e.length<12)this.sendOut(e);else{var t=e.readUInt8(1);(127&t)===this.incomingPayloadType&&(t=128&t|this.outgoingPayloadType,e.writeUInt8(t,1)),null===this.incomingSSRC&&(this.incomingSSRC=e.readUInt32BE(4)),e.writeUInt32BE(this.outgoingSSRC,8),this.sendOut(e)}},e.prototype.processRTCPMessage=function(e,t){for(var r=[],i=0;i+4<=e.length;){var n=e.readUInt8(i+1),o=4*e.readUInt16BE(i+2);if(i+4+o>e.length)break;var a=e.slice(i,i+4+o);(a=t(n,a))&&r.push(a),i+=4+o}return r.length>0?Buffer.concat(r):null},e.prototype.rtcpMessage=function(e){var t=this,r=this.processRTCPMessage(e,(function(e,r){return 200!==e||r.length<8||(null===t.incomingSSRC&&(t.incomingSSRC=r.readUInt32BE(4)),r.writeUInt32BE(t.outgoingSSRC,4)),r}));r&&this.sendOut(r)},e.prototype.rtcpReply=function(e){var t=this,r=this.processRTCPMessage(e,(function(e,r){return 201!==e||r.length<12||r.writeUInt32BE(t.incomingSSRC,8),r}));r&&this.sendOut(r)},e.prototype.createSocket=function(e){var t=this;return new Promise((function(r){var n=function(){var o=i.default.createSocket(e);o.once("error",(function(){65535===t.startingPort?t.startingPort=1e4:++t.startingPort,o.close(),n()})),o.on("listening",(function(){r(o)})),o.bind(t.startingPort)};n()}))},e.prototype.createSocketPair=function(e){var t=this;return new Promise((function(r){var n=function(){var o=i.default.createSocket(e),a=i.default.createSocket(e),s={socket1:0,socket2:0},c=function(){0!==s.socket1&&0!==s.socket2&&(2!==s.socket1||2!==s.socket2?(65534===t.startingPort?t.startingPort=1e4:++t.startingPort,o.close(),a.close(),n()):r([o,a]))};o.once("error",(function(){s.socket1=1,c()})),a.once("error",(function(){s.socket2=1,c()})),o.once("listening",(function(){s.socket1=2,c()})),a.once("listening",(function(){s.socket2=2,c()})),o.bind(t.startingPort),a.bind(t.startingPort+1)};n()}))},e}();t.default=n},8598:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamController=t.RTPStreamManagement=t.StreamRequestTypes=t.AudioStreamingSamplerate=t.AudioStreamingCodecType=t.SRTPCryptoSuites=t.AudioSamplerate=t.AudioBitrate=t.VideoCodecPacketizationMode=t.H264Level=t.H264Profile=t.VideoCodecType=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,C,S,E,_,T,A,I,D,w,b,U,R,O,N,P,B,L,x,M,F=r(1635),k=F.__importDefault(r(2613)),V=F.__importDefault(r(6982)),H=F.__importDefault(r(5753)),j=F.__importDefault(r(9278)),G=r(9826),W=r(1068),Y=r(5876),q=r(8073),K=r(7739),$=F.__importStar(r(3314)),z=F.__importStar(r(2997)),Q=r(9672),X=F.__importDefault(r(5989)),J=(0,H.default)("HAP-NodeJS:Camera:RTPStreamManagement");!function(e){e[e.STATUS=1]="STATUS"}(i||(i={})),function(e){e[e.AVAILABLE=0]="AVAILABLE",e[e.IN_USE=1]="IN_USE",e[e.UNAVAILABLE=2]="UNAVAILABLE"}(n||(n={})),function(e){e[e.VIDEO_CODEC_CONFIGURATION=1]="VIDEO_CODEC_CONFIGURATION"}(o||(o={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES"}(a||(a={})),function(e){e[e.PROFILE_ID=1]="PROFILE_ID",e[e.LEVEL=2]="LEVEL",e[e.PACKETIZATION_MODE=3]="PACKETIZATION_MODE",e[e.CVO_ENABLED=4]="CVO_ENABLED",e[e.CVO_ID=5]="CVO_ID"}(s||(s={})),function(e){e[e.IMAGE_WIDTH=1]="IMAGE_WIDTH",e[e.IMAGE_HEIGHT=2]="IMAGE_HEIGHT",e[e.FRAME_RATE=3]="FRAME_RATE"}(c||(c={})),function(e){e[e.H264=0]="H264"}(u||(t.VideoCodecType=u={})),function(e){e[e.BASELINE=0]="BASELINE",e[e.MAIN=1]="MAIN",e[e.HIGH=2]="HIGH"}(l||(t.H264Profile=l={})),function(e){e[e.LEVEL3_1=0]="LEVEL3_1",e[e.LEVEL3_2=1]="LEVEL3_2",e[e.LEVEL4_0=2]="LEVEL4_0"}(h||(t.H264Level=h={})),function(e){e[e.NON_INTERLEAVED=0]="NON_INTERLEAVED"}(d||(t.VideoCodecPacketizationMode=d={})),function(e){e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.SUPPORTED=1]="SUPPORTED"}(p||(p={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION",e[e.COMFORT_NOISE_SUPPORT=2]="COMFORT_NOISE_SUPPORT"}(f||(f={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(g||(g={})),function(e){e[e.PCMU=0]="PCMU",e[e.PCMA=1]="PCMA",e[e.AAC_ELD=2]="AAC_ELD",e[e.OPUS=3]="OPUS",e[e.MSBC=4]="MSBC",e[e.AMR=5]="AMR",e[e.AMR_WB=6]="AMR_WB"}(m||(m={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.PACKET_TIME=4]="PACKET_TIME"}(v||(v={})),function(e){e[e.VARIABLE=0]="VARIABLE",e[e.CONSTANT=1]="CONSTANT"}(y||(t.AudioBitrate=y={})),function(e){e[e.KHZ_8=0]="KHZ_8",e[e.KHZ_16=1]="KHZ_16",e[e.KHZ_24=2]="KHZ_24"}(C||(t.AudioSamplerate=C={})),function(e){e[e.SRTP_CRYPTO_SUITE=2]="SRTP_CRYPTO_SUITE"}(S||(S={})),function(e){e[e.AES_CM_128_HMAC_SHA1_80=0]="AES_CM_128_HMAC_SHA1_80",e[e.AES_CM_256_HMAC_SHA1_80=1]="AES_CM_256_HMAC_SHA1_80",e[e.NONE=2]="NONE"}(E||(t.SRTPCryptoSuites=E={})),function(e){e[e.SESSION_ID=1]="SESSION_ID",e[e.CONTROLLER_ADDRESS=3]="CONTROLLER_ADDRESS",e[e.VIDEO_SRTP_PARAMETERS=4]="VIDEO_SRTP_PARAMETERS",e[e.AUDIO_SRTP_PARAMETERS=5]="AUDIO_SRTP_PARAMETERS"}(_||(_={})),function(e){e[e.ADDRESS_VERSION=1]="ADDRESS_VERSION",e[e.ADDRESS=2]="ADDRESS",e[e.VIDEO_RTP_PORT=3]="VIDEO_RTP_PORT",e[e.AUDIO_RTP_PORT=4]="AUDIO_RTP_PORT"}(T||(T={})),function(e){e[e.IPV4=0]="IPV4",e[e.IPV6=1]="IPV6"}(A||(A={})),function(e){e[e.SRTP_CRYPTO_SUITE=1]="SRTP_CRYPTO_SUITE",e[e.MASTER_KEY=2]="MASTER_KEY",e[e.MASTER_SALT=3]="MASTER_SALT"}(I||(I={})),function(e){e[e.SESSION_ID=1]="SESSION_ID",e[e.STATUS=2]="STATUS",e[e.ACCESSORY_ADDRESS=3]="ACCESSORY_ADDRESS",e[e.VIDEO_SRTP_PARAMETERS=4]="VIDEO_SRTP_PARAMETERS",e[e.AUDIO_SRTP_PARAMETERS=5]="AUDIO_SRTP_PARAMETERS",e[e.VIDEO_SSRC=6]="VIDEO_SSRC",e[e.AUDIO_SSRC=7]="AUDIO_SSRC"}(D||(D={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.BUSY=1]="BUSY",e[e.ERROR=2]="ERROR"}(w||(w={})),function(e){e[e.SESSION_CONTROL=1]="SESSION_CONTROL",e[e.SELECTED_VIDEO_PARAMETERS=2]="SELECTED_VIDEO_PARAMETERS",e[e.SELECTED_AUDIO_PARAMETERS=3]="SELECTED_AUDIO_PARAMETERS"}(b||(b={})),function(e){e[e.SESSION_IDENTIFIER=1]="SESSION_IDENTIFIER",e[e.COMMAND=2]="COMMAND"}(U||(U={})),function(e){e[e.END_SESSION=0]="END_SESSION",e[e.START_SESSION=1]="START_SESSION",e[e.SUSPEND_SESSION=2]="SUSPEND_SESSION",e[e.RESUME_SESSION=3]="RESUME_SESSION",e[e.RECONFIGURE_SESSION=4]="RECONFIGURE_SESSION"}(R||(R={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES",e[e.RTP_PARAMETERS=4]="RTP_PARAMETERS"}(O||(O={})),function(e){e[e.PAYLOAD_TYPE=1]="PAYLOAD_TYPE",e[e.SYNCHRONIZATION_SOURCE=2]="SYNCHRONIZATION_SOURCE",e[e.MAX_BIT_RATE=3]="MAX_BIT_RATE",e[e.MIN_RTCP_INTERVAL=4]="MIN_RTCP_INTERVAL",e[e.MAX_MTU=5]="MAX_MTU"}(N||(N={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.RTP_PARAMETERS=3]="RTP_PARAMETERS",e[e.COMFORT_NOISE=4]="COMFORT_NOISE"}(P||(P={})),function(e){e[e.PAYLOAD_TYPE=1]="PAYLOAD_TYPE",e[e.SYNCHRONIZATION_SOURCE=2]="SYNCHRONIZATION_SOURCE",e[e.MAX_BIT_RATE=3]="MAX_BIT_RATE",e[e.MIN_RTCP_INTERVAL=4]="MIN_RTCP_INTERVAL",e[e.COMFORT_NOISE_PAYLOAD_TYPE=6]="COMFORT_NOISE_PAYLOAD_TYPE"}(B||(B={})),function(e){e.PCMU="PCMU",e.PCMA="PCMA",e.AAC_ELD="AAC-eld",e.OPUS="OPUS",e.MSBC="mSBC",e.AMR="AMR",e.AMR_WB="AMR-WB"}(L||(t.AudioStreamingCodecType=L={})),function(e){e[e.KHZ_8=8]="KHZ_8",e[e.KHZ_16=16]="KHZ_16",e[e.KHZ_24=24]="KHZ_24"}(x||(t.AudioStreamingSamplerate=x={})),function(e){e.RECONFIGURE="reconfigure",e.START="start",e.STOP="stop"}(M||(t.StreamRequestTypes=M={}));var Z=function(){function e(t,r,i,n,o){if(this.videoOnly=!1,this.sessionIdentifier=void 0,this.streamStatus=0,this.selectedConfiguration="",this.setupEndpointsResponse="",this.id=t,this.delegate=i,this.requireProxy=r.proxy||!1,this.disableAudioProxy=r.disable_audio_proxy||!1,!function(e){return"srtp"in e}(r)?this.supportedCryptoSuites=r.supportedCryptoSuites:this.supportedCryptoSuites=[r.srtp?0:2],0===this.supportedCryptoSuites.length&&this.supportedCryptoSuites.push(2),!r.video)throw new Error("Video parameters cannot be undefined in options");this.supportedRTPConfiguration=e._supportedRTPConfiguration(this.supportedCryptoSuites),this.supportedVideoStreamConfiguration=e._supportedVideoStreamConfiguration(r.video),this.supportedAudioStreamConfiguration=this._supportedAudioStreamConfiguration(r.audio),this.activeConnectionClosedListener=this._handleStopStream.bind(this),this.service=n||this.constructService(t),this.setupServiceHandlers(),this.resetSetupEndpointsResponse(),this.resetSelectedStreamConfiguration(),this.disabledThroughOperatingMode=o}return e.prototype.forceStop=function(){this.handleSessionClosed()},e.prototype.getService=function(){return this.service},e.prototype.handleCloseConnection=function(e){},e.prototype.handleFactoryReset=function(){this.resetSelectedStreamConfiguration(),this.resetSetupEndpointsResponse(),this.service.updateCharacteristic(G.Characteristic.Active,!0)},e.prototype.destroy=function(){this.activeConnection&&this._handleStopStream()},e.prototype.constructService=function(e){var t=new Y.Service.CameraRTPStreamManagement("",e.toString());return t.setCharacteristic(G.Characteristic.Active,!0),t},e.prototype.setupServiceHandlers=function(){var e=this;this.service.testCharacteristic(G.Characteristic.Active)||this.service.setCharacteristic(G.Characteristic.Active,!0),this.service.getCharacteristic(G.Characteristic.Active).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.service.setCharacteristic(G.Characteristic.SupportedRTPConfiguration,this.supportedRTPConfiguration),this.service.setCharacteristic(G.Characteristic.SupportedVideoStreamConfiguration,this.supportedVideoStreamConfiguration),this.service.setCharacteristic(G.Characteristic.SupportedAudioStreamConfiguration,this.supportedAudioStreamConfiguration),this._updateStreamStatus(0),this.service.setCharacteristic(G.Characteristic.SetupEndpoints,this.setupEndpointsResponse),this.service.getCharacteristic(G.Characteristic.SelectedRTPStreamConfiguration).on("get",(function(t){e.streamingIsDisabled()?t(null,$.encode(1,$.encode(2,R.SUSPEND_SESSION)).toString("base64")):t(null,e.selectedConfiguration)})).on("set",this._handleSelectedStreamConfigurationWrite.bind(this)),this.service.getCharacteristic(G.Characteristic.SetupEndpoints).on("get",(function(t){e.streamingIsDisabled()?t(null,$.encode(2,2).toString("base64")):t(null,e.setupEndpointsResponse)})).on("set",(function(t,r,i,n){if(!n)return J("Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!"),void r(-70410);e.handleSetupEndpoints(t,r,n)}))},e.prototype.handleSessionClosed=function(){this.resetSelectedStreamConfiguration(),this.resetSetupEndpointsResponse(),this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionClosedListener),this.activeConnection=void 0),this._updateStreamStatus(0),this.sessionIdentifier=void 0,this.connectionID=void 0,this.ipVersion=void 0,this.videoProxy&&(this.videoProxy.destroy(),this.videoProxy=void 0),this.audioProxy&&(this.audioProxy.destroy(),this.audioProxy=void 0)},e.prototype.streamingIsDisabled=function(e){var t;return this.service.getCharacteristic(G.Characteristic.Active).value?!!(null===(t=this.disabledThroughOperatingMode)||void 0===t?void 0:t.call(this))&&(e&&e(new q.HapStatusError(-70412)),!0):(e&&e(new q.HapStatusError(-70412)),!0)},e.prototype._handleSelectedStreamConfigurationWrite=function(e,t){var r=this;if(!this.streamingIsDisabled(t)){var i=Buffer.from(e,"base64"),n=$.decode(i),o=$.decode(n[1]),a=z.unparse(o[1]),s=o[2][0];if(a!==this.sessionIdentifier)return J("Received unknown session Identifier with request to ".concat(R[s])),void t(-70410);this.selectedConfiguration=e;var c=function(e,i){t(e,i),e&&r.handleSessionClosed()};switch(s){case R.START_SESSION:var u=$.decode(n[2]),l=$.decode(n[3]);this._handleStartStream(u,l,c);break;case R.RECONFIGURE_SESSION:var h=$.decode(n[2]);this.handleReconfigureStream(h,c);break;case R.END_SESSION:this._handleStopStream(c);break;case R.RESUME_SESSION:case R.SUSPEND_SESSION:default:return J("Unhandled request type ".concat(R[s])),void t(-70410)}}},e.prototype._handleStartStream=function(e,t,r){var i=e[1],n=e[2],o=e[3],a=e[4],s=$.decode(n),c=s[1][0],u=s[2][0],l=s[3][0],h=s[4],d=void 0;h&&1===h[0]&&(d=s[5].readUInt8(0));var p=$.decode(o),f=p[1].readUInt16LE(0),g=p[2].readUInt16LE(0),m=p[3].readUInt8(0),v=$.decode(a),y=v[1].readUInt8(0),C=v[2].readUInt32LE(0),S=v[3].readUInt16LE(0),E=v[4].readFloatLE(0),_="ipv6"===this.ipVersion?1228:1378;v[5]&&(_=v[5].readUInt16LE(0));var T=t[1][0],A=t[2],I=t[3],D=!!t[4].readUInt8(0),w=$.decode(A),b=w[1][0],U=w[2][0],R=w[3][0],O=w[4].readUInt8(0),N=$.decode(I),P=N[1].readUInt8(0),B=N[2].readUInt32LE(0),L=N[3].readUInt16LE(0),x=N[4].readFloatLE(0),M=N[6].readUInt8(0);this.requireProxy&&(this.videoProxy.setOutgoingPayloadType(y),this.disableAudioProxy||this.audioProxy.setOutgoingPayloadType(P));var F,k,V={codec:i.readUInt8(0),profile:c,level:u,packetizationMode:l,cvoId:d,width:f,height:g,fps:m,pt:y,ssrc:C,max_bit_rate:S,rtcp_interval:E,mtu:_};switch(T){case 0:F="PCMU";break;case 1:F="PCMA";break;case 2:F="AAC-eld";break;case 3:F="OPUS";break;case 4:F="mSBC";break;case 5:F="AMR";break;case 6:F="AMR-WB";break;default:throw new Error("Encountered unknown selected audio codec ".concat(T))}switch(R){case 0:k=8;break;case 1:k=16;break;case 2:k=24;break;default:throw new Error("Encountered unknown selected audio samplerate ".concat(R))}var H={codec:F,channel:b,bit_rate:U,sample_rate:k,packet_time:O,pt:P,ssrc:B,max_bit_rate:L,rtcp_interval:x,comfort_pt:M,comfortNoiseEnabled:D},j={sessionID:this.sessionIdentifier,type:"start",video:V,audio:H};this.delegate.handleStreamRequest(j,(function(e){return r(e)}))},e.prototype.handleReconfigureStream=function(e,t){var r=e[3],i=e[4],n=$.decode(r),o=n[1].readUInt16LE(0),a=n[2].readUInt16LE(0),s=n[3].readUInt8(0),c=$.decode(i),u={width:o,height:a,fps:s,max_bit_rate:c[3].readUInt16LE(0),rtcp_interval:c[4].readFloatLE(0)||.5},l={sessionID:this.sessionIdentifier,type:"reconfigure",video:u};this.delegate.handleStreamRequest(l,(function(e){return t(e)}))},e.prototype._handleStopStream=function(e){var t={sessionID:this.sessionIdentifier,type:"stop"};this.handleSessionClosed(),this.delegate.handleStreamRequest(t,(function(t){return e?e(t):void 0}))},e.prototype.handleSetupEndpoints=function(e,t,r){var i=this;if(!this.streamingIsDisabled(t)){var n=Buffer.from(e,"base64"),o=$.decode(n),a=z.unparse(o[1]);if(0!==this.streamStatus)return this.setupEndpointsResponse=$.encode(1,z.write(a),2,1).toString("base64"),void t();(0,k.default)(null==this.activeConnection,"Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!"),this.activeConnection=r,this.activeConnection.on("closed",this.activeConnectionClosedListener),this.connectionID=r.sessionID,this.sessionIdentifier=a,this._updateStreamStatus(1);var s=o[3],c=$.decode(s),u=c[1][0],l=c[2].toString("utf8"),h=c[3].readUInt16LE(0),d=c[4].readUInt16LE(0),p=o[4],f=$.decode(p),g=f[1][0],m=f[2],v=f[3],y=o[5],C=$.decode(y),S=C[1][0],E=C[2],_=C[3];J("Session: ",a,"\nControllerAddress: ",l,"\nVideoPort: ",h,"\nAudioPort: ",d,"\nVideo Crypto: ",g,"\nVideo Master Key: ",m,"\nVideo Master Salt: ",v,"\nAudio Crypto: ",S,"\nAudio Master Key: ",E,"\nAudio Master Salt: ",_);var T={sessionID:a,sourceAddress:r.localAddress,targetAddress:l,addressVersion:1===u?"ipv6":"ipv4",video:{port:h,srtpCryptoSuite:g,srtp_key:m,srtp_salt:v},audio:{port:d,srtpCryptoSuite:S,srtp_key:E,srtp_salt:_}},A=[];this.requireProxy&&(T.targetAddress=r.getLocalAddress(1===u?"ipv6":"ipv4"),this.videoProxy=new X.default({outgoingAddress:l,outgoingPort:h,outgoingSSRC:V.default.randomBytes(4).readUInt32LE(0),disabled:!1}),A.push(this.videoProxy.setup().then((function(){T.video.proxy_rtp=i.videoProxy.incomingRTPPort(),T.video.proxy_rtcp=i.videoProxy.incomingRTCPPort()}))),this.disableAudioProxy||(this.audioProxy=new X.default({outgoingAddress:l,outgoingPort:d,outgoingSSRC:V.default.randomBytes(4).readUInt32LE(0),disabled:this.videoOnly}),A.push(this.audioProxy.setup().then((function(){T.audio.proxy_rtp=i.audioProxy.incomingRTPPort(),T.audio.proxy_rtcp=i.audioProxy.incomingRTCPPort()}))))),Promise.all(A).then((function(){i.delegate.prepareStream(T,(0,K.once)((function(e,n){e||!n?(J("PrepareStream request encountered an error: ".concat(e?e.message:void 0)),i.setupEndpointsResponse=$.encode(1,z.write(a),2,2).toString("base64"),i.handleSessionClosed(),t(e)):i.generateSetupEndpointResponse(r,a,T,n,t)})))}))}},e.prototype.generateSetupEndpointResponse=function(e,t,r,i,n){var o,a,s,c,u,l,h,d,p,f,g,m=r.addressVersion;if(!this.videoOnly&&!i.audio)throw new Error("Audio was enabled but not supplied in PrepareStreamResponse!");var v=i.audio||{port:r.audio.port,ssrc:W.CameraController.generateSynchronisationSource(),srtp_key:r.audio.srtp_key,srtp_salt:r.audio.srtp_salt};if(this.requireProxy){C=i.video;if(o=e.getLocalAddress(r.addressVersion),c=2,u=Buffer.alloc(0),l=Buffer.alloc(0),h=2,d=Buffer.alloc(0),p=Buffer.alloc(0),this.videoProxy.setIncomingPayloadType(C.proxy_pt),this.videoProxy.setServerAddress(C.proxy_server_address),this.videoProxy.setServerRTPPort(C.proxy_server_rtp),this.videoProxy.setServerRTCPPort(C.proxy_server_rtcp),a=this.videoProxy.outgoingLocalPort(),f=this.videoProxy.outgoingSSRC,this.disableAudioProxy){s=(y=i.audio).port,g=y.ssrc}else{var y=i.audio;this.audioProxy.setIncomingPayloadType(y.proxy_pt),this.audioProxy.setServerAddress(y.proxy_server_address),this.audioProxy.setServerRTPPort(y.proxy_server_rtp),this.audioProxy.setServerRTCPPort(y.proxy_server_rtcp),s=this.audioProxy.outgoingLocalPort(),g=this.audioProxy.outgoingSSRC}}else{var C=i.video,y=v;if(i.addressOverride?(m=j.default.isIPv4(i.addressOverride)?"ipv4":"ipv6",o=i.addressOverride):o=e.getLocalAddress(m),r.addressVersion!==m)throw new Error("Incoming and outgoing ip address versions must match! Expected ".concat(r.addressVersion," but got ").concat(m));if(a=C.port,s=y.port,2!==r.video.srtpCryptoSuite&&(void 0===C.srtp_key||void 0===C.srtp_salt))throw new Error("SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!");if(2!==r.audio.srtpCryptoSuite&&(void 0===y.srtp_key||void 0===y.srtp_salt))throw new Error("SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!");c=r.video.srtpCryptoSuite,u=C.srtp_key||Buffer.alloc(0),l=C.srtp_salt||Buffer.alloc(0),h=r.audio.srtpCryptoSuite,d=y.srtp_key||Buffer.alloc(0),p=y.srtp_salt||Buffer.alloc(0),f=C.ssrc,g=y.ssrc}this.ipVersion=m;var S=$.encode(1,"ipv4"===m?0:1,2,o,3,$.writeUInt16(a),4,$.writeUInt16(s)),E=$.encode(1,c,2,u,3,l),_=$.encode(1,h,2,d,3,p);this.setupEndpointsResponse=$.encode(1,z.write(t),2,0,3,S,4,E,5,_,6,$.writeUInt32(f),7,$.writeUInt32(g)).toString("base64"),n()},e.prototype._updateStreamStatus=function(e){this.streamStatus=e,this.service.updateCharacteristic(G.Characteristic.StreamingStatus,$.encode(1,this.streamStatus).toString("base64"))},e._supportedRTPConfiguration=function(e){return 1===e.length&&2===e[0]&&J("Client claims it doesn't support SRTP. The stream may stops working with future iOS releases."),$.encode(2,e).toString("base64")},e._supportedVideoStreamConfiguration=function(e){if(!e.codec)throw new Error("Video codec cannot be undefined");if(!e.resolutions)throw new Error("Video resolutions cannot be undefined");var t=$.encode(1,e.codec.profiles,2,e.codec.levels,3,0);null!=e.cvoId&&(t=Buffer.concat([t,$.encode(4,1,5,e.cvoId)]));var r=$.encode(1,0,2,t,3,e.resolutions.map((function(e){if(3!==e.length)throw new Error("Unexpected video resolution");var t=Buffer.alloc(2),r=Buffer.alloc(2),i=Buffer.alloc(1);return t.writeUInt16LE(e[0],0),r.writeUInt16LE(e[1],0),i.writeUInt8(e[2],0),$.encode(1,t,2,r,3,i)})));return $.encode(1,r).toString("base64")},e.prototype.checkForLegacyAudioCodecRepresentation=function(e){var t={};e.slice().forEach((function(r){var i=t[r.type];if(i){"number"==typeof i.samplerate&&(i.samplerate=[i.samplerate]),i.samplerate=i.samplerate.concat(r.samplerate);var n=e.indexOf(r);n>=0&&e.splice(n,1)}else t[r.type]=r}))},e.prototype._supportedAudioStreamConfiguration=function(e){var t=e&&!!e.comfort_noise,r=e&&e.codecs||[];this.checkForLegacyAudioCodecRepresentation(r),0===r.length&&(J("Client doesn't support any audio codec that HomeKit supports."),this.videoOnly=!0,r.push({type:"OPUS",samplerate:[16,24]}));var i=r.map((function(e){var t;switch(e.type){case"OPUS":t=3;break;case"AAC-eld":t=2;break;case"PCMA":t=1;break;case"PCMU":t=0;break;case"mSBC":t=4;break;case"AMR":t=5;break;case"AMR-WB":t=6;break;default:throw new Error("Unsupported codec: "+e.type)}var r=("number"==typeof e.samplerate?[e.samplerate]:e.samplerate).map((function(t){var r;switch(t){case 8:r=0;break;case 16:r=1;break;case 24:r=2;break;default:console.log("Unsupported sample rate: ",e.samplerate),r=-1}return r})).filter((function(e){return-1!==e}));if(0===r.length)throw new Error("Audio samplerate cannot be empty!");var i=$.encode(1,Math.max(1,e.audioChannels||1),2,e.bitrate||0,3,r);return $.encode(1,t,2,i)}));return $.encode(1,i,2,t?1:0).toString("base64")},e.prototype.resetSetupEndpointsResponse=function(){this.setupEndpointsResponse=$.encode(2,2).toString("base64"),this.service.updateCharacteristic(G.Characteristic.SetupEndpoints,this.setupEndpointsResponse)},e.prototype.resetSelectedStreamConfiguration=function(){this.selectedConfiguration=$.encode(1,$.encode(2,R.SUSPEND_SESSION)).toString("base64"),this.service.updateCharacteristic(G.Characteristic.SelectedRTPStreamConfiguration,this.selectedConfiguration)},e.prototype.serialize=function(){var e=this.service.getCharacteristic(G.Characteristic.Active).value;if(!0!==e)return{id:this.id,active:!!e}},e.prototype.deserialize=function(e){(0,k.default)(e.id===this.id,"Tried to initialize RTPStreamManagement ".concat(this.id," with data from management with id ").concat(e.id,"!")),this.service.updateCharacteristic(G.Characteristic.Active,e.active)},e.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},e.SRTPCryptoSuites=E,e.VideoCodecParamProfileIDTypes=l,e.VideoCodecParamLevelTypes=Object.freeze({TYPE3_1:0,TYPE3_2:1,TYPE4_0:2}),e}();t.RTPStreamManagement=Z;var ee=function(e){function t(t,r,i,n){var o=e.call(this,t,r,new Q.LegacyCameraSourceAdapter(i),n)||this;return o.options=r,o}return F.__extends(t,e),t}(Z);t.StreamController=ee},6859:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RecordingManagement=t.PacketDataType=t.AudioRecordingSamplerate=t.AudioRecordingCodecType=t.MediaContainerType=t.EventTriggerOption=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,C=r(1635),S=C.__importDefault(r(6982)),E=C.__importDefault(r(5753)),_=r(4434),T=r(9826),A=r(9948),I=r(5876),D=r(8073),w=C.__importStar(r(3314)),b=(0,E.default)("HAP-NodeJS:Camera:RecordingManagement");!function(e){e[e.MOTION=1]="MOTION",e[e.DOORBELL=2]="DOORBELL"}(i||(t.EventTriggerOption=i={})),function(e){e[e.FRAGMENTED_MP4=0]="FRAGMENTED_MP4"}(n||(t.MediaContainerType=n={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS",e[e.ATTRIBUTES=3]="ATTRIBUTES"}(o||(o={})),function(e){e[e.PROFILE_ID=1]="PROFILE_ID",e[e.LEVEL=2]="LEVEL",e[e.BITRATE=3]="BITRATE",e[e.IFRAME_INTERVAL=4]="IFRAME_INTERVAL"}(a||(a={})),function(e){e[e.IMAGE_WIDTH=1]="IMAGE_WIDTH",e[e.IMAGE_HEIGHT=2]="IMAGE_HEIGHT",e[e.FRAME_RATE=3]="FRAME_RATE"}(s||(s={})),function(e){e[e.SELECTED_RECORDING_CONFIGURATION=1]="SELECTED_RECORDING_CONFIGURATION",e[e.SELECTED_VIDEO_CONFIGURATION=2]="SELECTED_VIDEO_CONFIGURATION",e[e.SELECTED_AUDIO_CONFIGURATION=3]="SELECTED_AUDIO_CONFIGURATION"}(c||(c={})),function(e){e[e.AAC_LC=0]="AAC_LC",e[e.AAC_ELD=1]="AAC_ELD"}(u||(t.AudioRecordingCodecType=u={})),function(e){e[e.KHZ_8=0]="KHZ_8",e[e.KHZ_16=1]="KHZ_16",e[e.KHZ_24=2]="KHZ_24",e[e.KHZ_32=3]="KHZ_32",e[e.KHZ_44_1=4]="KHZ_44_1",e[e.KHZ_48=5]="KHZ_48"}(l||(t.AudioRecordingSamplerate=l={})),function(e){e[e.VIDEO_CODEC_CONFIGURATION=1]="VIDEO_CODEC_CONFIGURATION"}(h||(h={})),function(e){e[e.PREBUFFER_LENGTH=1]="PREBUFFER_LENGTH",e[e.EVENT_TRIGGER_OPTIONS=2]="EVENT_TRIGGER_OPTIONS",e[e.MEDIA_CONTAINER_CONFIGURATIONS=3]="MEDIA_CONTAINER_CONFIGURATIONS"}(d||(d={})),function(e){e[e.MEDIA_CONTAINER_TYPE=1]="MEDIA_CONTAINER_TYPE",e[e.MEDIA_CONTAINER_PARAMETERS=2]="MEDIA_CONTAINER_PARAMETERS"}(p||(p={})),function(e){e[e.FRAGMENT_LENGTH=1]="FRAGMENT_LENGTH"}(f||(f={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.MAX_AUDIO_BITRATE=4]="MAX_AUDIO_BITRATE"}(g||(g={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(m||(m={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION"}(v||(v={})),function(e){e.MEDIA_INITIALIZATION="mediaInitialization",e.MEDIA_FRAGMENT="mediaFragment"}(y||(t.PacketDataType=y={}));var U,R=function(){function e(e,t,r,i){var n,o;this.sensorServices=[],this.recordingActive=!1,this.options=e,this.delegate=t;var a=i||this.constructService();this.recordingManagementService=a.recordingManagement,this.operatingModeService=a.operatingMode,this.dataStreamManagement=a.dataStreamManagement,this.eventTriggerOptions=0;try{for(var s=C.__values(r),c=s.next();!c.done;c=s.next()){var u=c.value;this.eventTriggerOptions|=u}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}this.supportedCameraRecordingConfiguration=this._supportedCameraRecordingConfiguration(e),this.supportedVideoRecordingConfiguration=this._supportedVideoRecordingConfiguration(e.video),this.supportedAudioRecordingConfiguration=this._supportedAudioStreamConfiguration(e.audio),this.setupServiceHandlers()}return e.prototype.constructService=function(){var e=new I.Service.CameraRecordingManagement("","");e.setCharacteristic(T.Characteristic.Active,!1),e.setCharacteristic(T.Characteristic.RecordingAudioActive,!1);var t=new I.Service.CameraOperatingMode("","");t.setCharacteristic(T.Characteristic.EventSnapshotsActive,!0),t.setCharacteristic(T.Characteristic.HomeKitCameraActive,!0),t.setCharacteristic(T.Characteristic.PeriodicSnapshotsActive,!0);var r=new A.DataStreamManagement;return e.addLinkedService(r.getService()),{recordingManagement:e,operatingMode:t,dataStreamManagement:r}},e.prototype.setupServiceHandlers=function(){var e=this;this.recordingManagementService.setCharacteristic(T.Characteristic.SupportedCameraRecordingConfiguration,this.supportedCameraRecordingConfiguration),this.recordingManagementService.setCharacteristic(T.Characteristic.SupportedVideoRecordingConfiguration,this.supportedVideoRecordingConfiguration),this.recordingManagementService.setCharacteristic(T.Characteristic.SupportedAudioRecordingConfiguration,this.supportedAudioRecordingConfiguration),this.recordingManagementService.getCharacteristic(T.Characteristic.SelectedCameraRecordingConfiguration).onGet(this.handleSelectedCameraRecordingConfigurationRead.bind(this)).onSet(this.handleSelectedCameraRecordingConfigurationWrite.bind(this)).setProps({adminOnlyAccess:[1]}),this.recordingManagementService.getCharacteristic(T.Characteristic.Active).onSet((function(t){!!t!==e.recordingActive&&(e.recordingActive=!!t,e.delegate.updateRecordingActive(e.recordingActive))})).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.recordingManagementService.getCharacteristic(T.Characteristic.RecordingAudioActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})),this.operatingModeService.getCharacteristic(T.Characteristic.HomeKitCameraActive).on("change",(function(t){var r,i,n;try{for(var o=C.__values(e.sensorServices),a=o.next();!a.done;a=o.next()){a.value.setCharacteristic(T.Characteristic.StatusActive,!!t.newValue)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}!t.newValue&&e.recordingStream&&e.recordingStream.close(1),null===(n=e.stateChangeDelegate)||void 0===n||n.call(e)})).setProps({adminOnlyAccess:[1]}),this.operatingModeService.getCharacteristic(T.Characteristic.EventSnapshotsActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.operatingModeService.getCharacteristic(T.Characteristic.PeriodicSnapshotsActive).on("change",(function(){var t;return null===(t=e.stateChangeDelegate)||void 0===t?void 0:t.call(e)})).setProps({adminOnlyAccess:[1]}),this.dataStreamManagement.onRequestMessage("dataSend","open",this.handleDataSendOpen.bind(this))},e.prototype.handleDataSendOpen=function(e,t,r){var i=this,n=r.streamId,o=r.type,a=r.target,s=r.reason;if("controller"!==a||"ipcamera.recording"!==o)return b("[HDS %s] Received data send with unexpected target: %s or type: %d. Rejecting...",e.remoteAddress,a,o),void e.sendResponse("dataSend","open",t,A.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:5});if(this.recordingActive){if(this.operatingModeService.getCharacteristic(T.Characteristic.HomeKitCameraActive).value)return this.recordingStream?(b("[HDS %s] Rejecting DATA_SEND OPEN as another stream (%s) is already recording with streamId %d!",e.remoteAddress,this.recordingStream.connection.remoteAddress,this.recordingStream.streamId),void e.sendResponse("dataSend","open",t,A.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:2})):void(this.selectedConfiguration?(b("[HDS %s] HDS DATA_SEND Open with reason '%s'.",e.remoteAddress,s),this.recordingStream=new O(e,this.delegate,t,n),this.recordingStream.on("closed",(function(){b("[HDS %s] Removing active recoding session from recording management!"),i.recordingStream=void 0})),this.recordingStream.startStreaming()):e.sendResponse("dataSend","open",t,A.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:9}));e.sendResponse("dataSend","open",t,A.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:1})}else e.sendResponse("dataSend","open",t,A.HDSStatus.PROTOCOL_SPECIFIC_ERROR,{status:1})},e.prototype.handleSelectedCameraRecordingConfigurationRead=function(){if(!this.selectedConfiguration)throw new D.HapStatusError(-70402);return this.selectedConfiguration.base64},e.prototype.handleSelectedCameraRecordingConfigurationWrite=function(e){var t,r,i=this.parseSelectedConfiguration(e),n=(null===(t=this.selectedConfiguration)||void 0===t?void 0:t.base64)!==e;this.selectedConfiguration={parsed:i,base64:e},n&&(this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed),null===(r=this.stateChangeDelegate)||void 0===r||r.call(this))},e.prototype.parseSelectedConfiguration=function(e){for(var t=w.decode(Buffer.from(e,"base64")),r=w.decode(t[1]),i=w.decode(t[2]),n=w.decode(t[3]),o=r[1].readInt32LE(0),a=r[2].readInt32LE(0),s=w.decode(r[3]),c=s[1][0],u=w.decode(s[2])[1].readInt32LE(0),l=i[1][0],h=w.decode(i[2]),d=w.decode(i[3]),p=h[1][0],f=h[2][0],g=h[3].readInt32LE(0),m=h[4].readInt32LE(0),v=d[1].readInt16LE(0),y=d[2].readInt16LE(0),C=d[3][0],S=n[1][0],E=w.decode(n[2]),_=E[1][0],T=E[3][0],A=E[2][0],I=E[4].readUInt32LE(0),D=[],b=0;a>0;)1&a&&D.push(1<>=1,b+=1;return{prebufferLength:o,eventTriggerTypes:D,mediaContainerConfiguration:{type:c,fragmentLength:u},videoCodec:{type:l,parameters:{profile:p,level:f,bitRate:g,iFrameInterval:m},resolution:[v,y,C]},audioCodec:{audioChannels:_,type:S,samplerate:T,bitrateMode:A,bitrate:I}}},e.prototype._supportedCameraRecordingConfiguration=function(e){var t=Array.isArray(e.mediaContainerConfiguration)?e.mediaContainerConfiguration:[e.mediaContainerConfiguration],r=Buffer.alloc(4),i=Buffer.alloc(8);return r.writeInt32LE(e.prebufferLength,0),i.writeInt32LE(this.eventTriggerOptions,0),w.encode(1,r,2,i,3,t.map((function(e){var t=Buffer.alloc(4);return t.writeInt32LE(e.fragmentLength,0),w.encode(1,e.type,2,w.encode(1,t))}))).toString("base64")},e.prototype._supportedVideoRecordingConfiguration=function(e){if(!e.parameters)throw new Error("Video parameters cannot be undefined");if(!e.resolutions)throw new Error("Video resolutions cannot be undefined");var t=w.encode(1,e.parameters.profiles,2,e.parameters.levels),r=w.encode(1,e.type,2,t,3,e.resolutions.map((function(e){if(3!==e.length)throw new Error("Unexpected video resolution");var t=Buffer.alloc(2),r=Buffer.alloc(2),i=Buffer.alloc(1);return t.writeUInt16LE(e[0],0),r.writeUInt16LE(e[1],0),i.writeUInt8(e[2],0),w.encode(1,t,2,r,3,i)})));return w.encode(1,r).toString("base64")},e.prototype._supportedAudioStreamConfiguration=function(e){var t=Array.isArray(e.codecs)?e.codecs:[e.codecs];if(0===t.length)throw Error("CameraRecordingOptions.audio: At least one audio codec configuration must be specified!");var r=t.map((function(e){var t=Array.isArray(e.samplerate)?e.samplerate:[e.samplerate];if(0===t.length)throw new Error("CameraRecordingOptions.audio.codecs: Audio samplerate cannot be empty!");var r=w.encode(1,Math.max(1,e.audioChannels||1),2,e.bitrateMode||0,3,t);return w.encode(1,e.type,2,r)}));return w.encode(1,r).toString("base64")},e.prototype.computeConfigurationHash=function(e){void 0===e&&(e="sha256");var t=S.default.createHash(e);return t.update(this.supportedCameraRecordingConfiguration),t.update(this.supportedVideoRecordingConfiguration),t.update(this.supportedAudioRecordingConfiguration),t.digest().toString("hex")},e.prototype.serialize=function(){var e;return{configurationHash:{algorithm:"sha256",hash:this.computeConfigurationHash("sha256")},selectedConfiguration:null===(e=this.selectedConfiguration)||void 0===e?void 0:e.base64,recordingActive:this.recordingActive,recordingAudioActive:!!this.recordingManagementService.getCharacteristic(T.Characteristic.RecordingAudioActive).value,eventSnapshotsActive:!!this.operatingModeService.getCharacteristic(T.Characteristic.EventSnapshotsActive).value,homeKitCameraActive:!!this.operatingModeService.getCharacteristic(T.Characteristic.HomeKitCameraActive).value,periodicSnapshotsActive:!!this.operatingModeService.getCharacteristic(T.Characteristic.PeriodicSnapshotsActive).value}},e.prototype.deserialize=function(e){var t,r,i,n=!1,o=this.computeConfigurationHash(e.configurationHash.algorithm);e.selectedConfiguration&&(o===e.configurationHash.hash?this.selectedConfiguration={base64:e.selectedConfiguration,parsed:this.parseSelectedConfiguration(e.selectedConfiguration)}:n=!0),this.recordingActive=e.recordingActive,this.recordingManagementService.updateCharacteristic(T.Characteristic.Active,e.recordingActive),this.recordingManagementService.updateCharacteristic(T.Characteristic.RecordingAudioActive,e.recordingAudioActive),this.operatingModeService.updateCharacteristic(T.Characteristic.EventSnapshotsActive,e.eventSnapshotsActive),this.operatingModeService.updateCharacteristic(T.Characteristic.PeriodicSnapshotsActive,e.periodicSnapshotsActive),this.operatingModeService.updateCharacteristic(T.Characteristic.HomeKitCameraActive,e.homeKitCameraActive);try{for(var a=C.__values(this.sensorServices),s=a.next();!s.done;s=a.next()){s.value.setCharacteristic(T.Characteristic.StatusActive,e.homeKitCameraActive)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}try{this.selectedConfiguration&&this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed),e.recordingActive&&this.delegate.updateRecordingActive(e.recordingActive)}catch(e){console.error("Failed to properly initialize CameraRecordingDelegate from persistent storage: "+e.stack)}n&&(null===(i=this.stateChangeDelegate)||void 0===i||i.call(this))},e.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},e.prototype.destroy=function(){this.dataStreamManagement.destroy()},e.prototype.handleFactoryReset=function(){var e,t;this.selectedConfiguration=void 0,this.recordingManagementService.updateCharacteristic(T.Characteristic.Active,!1),this.recordingManagementService.updateCharacteristic(T.Characteristic.RecordingAudioActive,!1),this.operatingModeService.updateCharacteristic(T.Characteristic.EventSnapshotsActive,!0),this.operatingModeService.updateCharacteristic(T.Characteristic.PeriodicSnapshotsActive,!0),this.operatingModeService.updateCharacteristic(T.Characteristic.HomeKitCameraActive,!0);try{for(var r=C.__values(this.sensorServices),i=r.next();!i.done;i=r.next()){i.value.setCharacteristic(T.Characteristic.StatusActive,!0)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}try{this.delegate.updateRecordingActive(!1),this.delegate.updateRecordingConfiguration(void 0)}catch(e){console.error("CameraRecordingDelegate failed to update state after handleFactoryReset: "+e.stack)}},e}();t.RecordingManagement=R,function(e){e.CLOSED="closed"}(U||(U={}));var O=function(e){function t(t,r,i,n){var o,a=e.call(this)||this;return a.closed=!1,a.eventHandler=((o={}).close=a.handleDataSendClose.bind(a),o.ack=a.handleDataSendAck.bind(a),o),a.requestHandler=void 0,a.connection=t,a.delegate=r,a.hdsRequestId=i,a.streamId=n,a.connection.on("closed",a.closeListener=a.handleDataStreamConnectionClosed.bind(a)),a.connection.addProtocolHandler("dataSend",a),a}return C.__extends(t,e),t.prototype.startStreaming=function(){this._startStreaming()},t.prototype._startStreaming=function(){return C.__awaiter(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,S;return C.__generator(this,(function(E){switch(E.label){case 0:b("[HDS %s] Sending DATA_SEND OPEN response for streamId %d",this.connection.remoteAddress,this.streamId),this.connection.sendResponse("dataSend","open",this.hdsRequestId,A.HDSStatus.SUCCESS,{status:A.HDSStatus.SUCCESS}),e=262144,t=!0,r=1,i=!1,E.label=1;case 1:E.trys.push([1,14,15,16]),this.generator=this.delegate.handleRecordingStreamRequest(this.streamId),E.label=2;case 2:E.trys.push([2,7,8,13]),n=!0,o=C.__asyncValues(this.generator),E.label=3;case 3:return[4,o.next()];case 4:if(a=E.sent(),m=a.done)return[3,6];if(S=a.value,n=!1,s=S,this.closed)return console.error("[HDS ".concat(this.connection.remoteAddress,"] Delegate yielded fragment after stream ").concat(this.streamId," was already closed!")),[3,6];if(i)return console.error("[HDS ".concat(this.connection.remoteAddress,"] Delegate yielded fragment for stream ").concat(this.streamId," after already signaling end of stream!")),[3,6];for(c=s.data,u=0,l=1;u=c.length,dataTotalSize:1===l?c.length:void 0}}],endOfStream:u>=c.length?Boolean(s.isLast).valueOf():void 0},b("[HDS %s] Sending DATA_SEND DATA for stream %d with metadata: %o and length %d; EoS: %s",this.connection.remoteAddress,this.streamId,d.packets[0].metadata,h.length,d.endOfStream),this.connection.sendEvent("dataSend","data",d),l++,t=!1;if(i=s.isLast,s.isLast)return[3,6];r++,E.label=5;case 5:return n=!0,[3,3];case 6:return[3,13];case 7:return p=E.sent(),v={error:p},[3,13];case 8:return E.trys.push([8,,11,12]),n||m||!(y=o.return)?[3,10]:[4,y.call(o)];case 9:E.sent(),E.label=10;case 10:return[3,12];case 11:if(v)throw v.error;return[7];case 12:return[7];case 13:return i||this.closed||console.warn("[HDS ".concat(this.connection.remoteAddress,"] Delegate finished streaming for ").concat(this.streamId," without setting RecordingPacket.isLast. Can't notify Controller about endOfStream!")),[3,16];case 14:if(f=E.sent(),this.closed)console.warn("[HDS ".concat(this.connection.remoteAddress,"] Encountered unexpected error on already closed recording stream ").concat(this.streamId,": ").concat(f.stack));else{if(g=5,f instanceof A.HDSProtocolError)g=f.reason,b("[HDS %s] Delegate signaled to close the recording stream %d.",this.connection.remoteAddress,this.streamId);else{if(f instanceof A.HDSConnectionError&&2===f.type)return b("[HDS %s] Exited recording stream due to closed HDS socket: stream id %d.",this.connection.remoteAddress,this.streamId),[2];console.error("[HDS ".concat(this.connection.remoteAddress,"] Encountered unexpected error for recording stream ").concat(this.streamId,": ").concat(f.stack))}this.close(g)}return[2];case 15:return this.generator=void 0,this.generatorTimeout&&clearTimeout(this.generatorTimeout),this.closed||this.kickOffCloseTimeout(),[7];case 16:return t&&console.warn("[HDS ".concat(this.connection.remoteAddress,"] Delegate finished recording stream ").concat(this.streamId," without sending anything out. Controller will CANCEL.")),b("[HDS %s] Finished DATA_SEND transmission for stream %d!",this.connection.remoteAddress,this.streamId),[2]}}))}))},t.prototype.handleDataSendAck=function(e){var t=this,r=e.streamId,i=e.endOfStream;b("[HDS %s] Received DATA_SEND ACK packet for streamId %s. Acknowledged %s.",this.connection.remoteAddress,r,i),this.handleClosed((function(){var e,r;return null===(r=(e=t.delegate).acknowledgeStream)||void 0===r?void 0:r.call(e,t.streamId)}))},t.prototype.handleDataSendClose=function(e){var t=this,r=e.streamId,i=e.reason;r===this.streamId&&(b("[HDS %s] Received DATA_SEND CLOSE for streamId %d with reason %s",this.connection.remoteAddress,r,A.HDSProtocolSpecificErrorReason[i]),this.handleClosed((function(){return t.delegate.closeRecordingStream(r,i)})))},t.prototype.handleDataStreamConnectionClosed=function(){var e=this;b("[HDS %s] The HDS connection of the stream %d closed.",this.connection.remoteAddress,this.streamId),this.handleClosed((function(){return e.delegate.closeRecordingStream(e.streamId,void 0)}))},t.prototype.handleClosed=function(e){var t=this;this.closed=!0,this.closingTimeout&&(clearTimeout(this.closingTimeout),this.closingTimeout=void 0),this.connection.removeProtocolHandler("dataSend",this),this.connection.removeListener("closed",this.closeListener),this.generator&&(this.generatorTimeout=setTimeout((function(){console.error("[HDS %s] Recording download stream %d is still awaiting generator although stream was closed 10s ago! This is a programming mistake by the camera implementation which prevents freeing up resources.",t.connection.remoteAddress,t.streamId)}),1e4));try{e()}catch(e){console.error("[HDS ".concat(this.connection.remoteAddress,"] CameraRecordingDelegated failed to handle closing the stream ").concat(this.streamId,": ").concat(e.stack))}this.emit("closed")},t.prototype.close=function(e){var t=this;this.closed||(b("[HDS %s] Recording stream %d was closed manually with reason %s.",this.connection.remoteAddress,this.streamId,e?A.HDSProtocolSpecificErrorReason[e]:"CLOSED"),this.connection.isConsideredClosed()||this.connection.sendEvent("dataSend","close",{streamId:this.streamId,reason:e}),this.handleClosed((function(){return t.delegate.closeRecordingStream(t.streamId,e)})))},t.prototype.kickOffCloseTimeout=function(){var e=this;this.closingTimeout&&clearTimeout(this.closingTimeout),this.closingTimeout=setTimeout((function(){e.closed||(b("[HDS %s] Recording stream %d took longer than expected to fully close. Force closing now!",e.connection.remoteAddress,e.streamId),e.close(3))}),12e3)},t}(_.EventEmitter)},8591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(9672),t),i.__exportStar(r(5989),t),i.__exportStar(r(8598),t),i.__exportStar(r(6859),t)},6864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdaptiveLightingController=t.AdaptiveLightingControllerEvents=t.AdaptiveLightingControllerMode=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y=r(1635),C=y.__importDefault(r(2613)),S=r(2175),E=r(8073),_=r(1579),T=y.__importStar(r(2997)),A=y.__importDefault(r(5753)),I=r(4434),D=r(9826),w=y.__importStar(r(3314)),b=(0,A.default)("HAP-NodeJS:Controller:TransitionControl");!function(e){e[e.SUPPORTED_TRANSITION_CONFIGURATION=1]="SUPPORTED_TRANSITION_CONFIGURATION"}(i||(i={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_TYPE=2]="TRANSITION_TYPE"}(n||(n={})),function(e){e[e.BRIGHTNESS=1]="BRIGHTNESS",e[e.COLOR_TEMPERATURE=2]="COLOR_TEMPERATURE"}(o||(o={})),function(e){e[e.READ_CURRENT_VALUE_TRANSITION_CONFIGURATION=1]="READ_CURRENT_VALUE_TRANSITION_CONFIGURATION",e[e.UPDATE_VALUE_TRANSITION_CONFIGURATION=2]="UPDATE_VALUE_TRANSITION_CONFIGURATION"}(a||(a={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID"}(s||(s={})),function(e){e[e.VALUE_TRANSITION_CONFIGURATION=1]="VALUE_TRANSITION_CONFIGURATION"}(c||(c={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_PARAMETERS=2]="TRANSITION_PARAMETERS",e[e.UNKNOWN_3=3]="UNKNOWN_3",e[e.UNKNOWN_4=4]="UNKNOWN_4",e[e.TRANSITION_CURVE_CONFIGURATION=5]="TRANSITION_CURVE_CONFIGURATION",e[e.UPDATE_INTERVAL=6]="UPDATE_INTERVAL",e[e.UNKNOWN_7=7]="UNKNOWN_7",e[e.NOTIFY_INTERVAL_THRESHOLD=8]="NOTIFY_INTERVAL_THRESHOLD"}(u||(u={})),function(e){e[e.TRANSITION_ID=1]="TRANSITION_ID",e[e.START_TIME=2]="START_TIME",e[e.UNKNOWN_3=3]="UNKNOWN_3"}(l||(l={})),function(e){e[e.TRANSITION_ENTRY=1]="TRANSITION_ENTRY",e[e.ADJUSTMENT_CHARACTERISTIC_IID=2]="ADJUSTMENT_CHARACTERISTIC_IID",e[e.ADJUSTMENT_MULTIPLIER_RANGE=3]="ADJUSTMENT_MULTIPLIER_RANGE"}(h||(h={})),function(e){e[e.ADJUSTMENT_FACTOR=1]="ADJUSTMENT_FACTOR",e[e.VALUE=2]="VALUE",e[e.TRANSITION_OFFSET=3]="TRANSITION_OFFSET",e[e.DURATION=4]="DURATION"}(d||(d={})),function(e){e[e.MINIMUM_ADJUSTMENT_MULTIPLIER=1]="MINIMUM_ADJUSTMENT_MULTIPLIER",e[e.MAXIMUM_ADJUSTMENT_MULTIPLIER=2]="MAXIMUM_ADJUSTMENT_MULTIPLIER"}(p||(p={})),function(e){e[e.VALUE_CONFIGURATION_STATUS=1]="VALUE_CONFIGURATION_STATUS"}(f||(f={})),function(e){e[e.CHARACTERISTIC_IID=1]="CHARACTERISTIC_IID",e[e.TRANSITION_PARAMETERS=2]="TRANSITION_PARAMETERS",e[e.TIME_SINCE_START=3]="TIME_SINCE_START"}(g||(g={})),function(e){e[e.AUTOMATIC=1]="AUTOMATIC",e[e.MANUAL=2]="MANUAL"}(m||(t.AdaptiveLightingControllerMode=m={})),function(e){e.UPDATE="update",e.DISABLED="disable"}(v||(t.AdaptiveLightingControllerEvents=v={}));var U=function(e){function t(t,r){var i,n,o=e.call(this)||this;return o.didRunFirstInitializationStep=!1,o.lastEventNotificationSent=0,o.lastNotifiedTemperatureValue=0,o.lastNotifiedSaturationValue=0,o.lastNotifiedHueValue=0,o.lightbulb=t,o.mode=null!==(i=null==r?void 0:r.controllerMode)&&void 0!==i?i:1,o.customTemperatureAdjustment=null!==(n=null==r?void 0:r.customTemperatureAdjustment)&&void 0!==n?n:0,(0,C.default)(o.lightbulb.testCharacteristic(D.Characteristic.ColorTemperature),"Lightbulb must have the ColorTemperature characteristic added!"),(0,C.default)(o.lightbulb.testCharacteristic(D.Characteristic.Brightness),"Lightbulb must have the Brightness characteristic added!"),o.adjustmentFactorChangedListener=o.handleAdjustmentFactorChanged.bind(o),o.characteristicManualWrittenChangeListener=o.handleCharacteristicManualWritten.bind(o),o}return y.__extends(t,e),t.prototype.controllerId=function(){return"characteristic-transition-"+this.lightbulb.getServiceId()},t.prototype.isAdaptiveLightingActive=function(){return!!this.activeTransition},t.prototype.disableAdaptiveLighting=function(){var e;this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),this.activeTransition&&(this.colorTemperatureCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.brightnessCharacteristic.removeListener("change",this.adjustmentFactorChangedListener),this.hueCharacteristic&&this.hueCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.saturationCharacteristic&&this.saturationCharacteristic.removeListener("change",this.characteristicManualWrittenChangeListener),this.activeTransition=void 0,null===(e=this.stateChangeDelegate)||void 0===e||e.call(this)),this.colorTemperatureCharacteristic=void 0,this.brightnessCharacteristic=void 0,this.hueCharacteristic=void 0,this.saturationCharacteristic=void 0,this.lastTransitionPointInfo=void 0,this.lastEventNotificationSent=0,this.lastNotifiedTemperatureValue=0,this.lastNotifiedSaturationValue=0,this.lastNotifiedHueValue=0,this.didRunFirstInitializationStep=!1,this.activeTransitionCount.sendEventNotification(0),b("[%s] Disabling adaptive lighting",this.lightbulb.displayName)},t.prototype.getAdaptiveLightingStartTimeOfTransition=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.transitionStartMillis},t.prototype.getAdaptiveLightingTimeOffset=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.timeMillisOffset},t.prototype.getAdaptiveLightingTransitionCurve=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.transitionCurve},t.prototype.getAdaptiveLightingBrightnessMultiplierRange=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.brightnessAdjustmentRange},t.prototype.getAdaptiveLightingUpdateInterval=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.updateInterval},t.prototype.getAdaptiveLightingNotifyIntervalThreshold=function(){if(!this.activeTransition)throw new Error("There is no active transition!");return this.activeTransition.notifyIntervalThreshold},t.prototype.handleActiveTransitionUpdated=function(e){var t;if(void 0===e&&(e=!1),e?this.activeTransitionCount.value=1:this.activeTransitionCount.sendEventNotification(1),1===this.mode)this.scheduleNextUpdate();else{if(2!==this.mode)throw new Error("Unsupported adaptive lighting controller mode: "+this.mode);this.emit("update")}e||null===(t=this.stateChangeDelegate)||void 0===t||t.call(this)},t.prototype.handleAdaptiveLightingEnabled=function(){if(!this.activeTransition)throw new Error("There is no active transition!");this.colorTemperatureCharacteristic=this.lightbulb.getCharacteristic(D.Characteristic.ColorTemperature),this.brightnessCharacteristic=this.lightbulb.getCharacteristic(D.Characteristic.Brightness),this.colorTemperatureCharacteristic.on("change",this.characteristicManualWrittenChangeListener),this.brightnessCharacteristic.on("change",this.adjustmentFactorChangedListener),this.lightbulb.testCharacteristic(D.Characteristic.Hue)&&(this.hueCharacteristic=this.lightbulb.getCharacteristic(D.Characteristic.Hue).on("change",this.characteristicManualWrittenChangeListener)),this.lightbulb.testCharacteristic(D.Characteristic.Saturation)&&(this.saturationCharacteristic=this.lightbulb.getCharacteristic(D.Characteristic.Saturation).on("change",this.characteristicManualWrittenChangeListener))},t.prototype.handleAdaptiveLightingDisabled=function(){2===this.mode&&this.activeTransition&&this.emit("disable"),this.disableAdaptiveLighting()},t.prototype.handleAdjustmentFactorChanged=function(e){var t=this;e.newValue!==e.oldValue&&("read"===e.reason?setTimeout((function(){t.activeTransition&&t.scheduleNextUpdate(!0)}),1e3).unref():this.scheduleNextUpdate(!0))},t.prototype.handleCharacteristicManualWritten=function(e){var t;"write"!==e.reason||(t=e.context)&&"controller"in t&&e.context.controller===this||(b("[%s] Received a manual write to an characteristic (newValue: %d, oldValue: %d, reason: %s). Thus disabling adaptive lighting!",this.lightbulb.displayName,e.newValue,e.oldValue,e.reason),this.disableAdaptiveLighting())},t.prototype.getCurrentAdaptiveLightingTransitionPoint=function(){var e,t,r,i,n;if(!this.activeTransition)throw new Error("Cannot calculate current transition point if no transition is active!");for(var o=Date.now()-this.activeTransition.timeMillisOffset-this.activeTransition.transitionStartMillis,a=null!==(t=null===(e=this.lastTransitionPointInfo)||void 0===e?void 0:e.curveIndex)&&void 0!==t?t:0,s=null!==(i=null===(r=this.lastTransitionPointInfo)||void 0===r?void 0:r.lowerBoundTimeOffset)&&void 0!==i?i:0,c=void 0,u=void 0;a+1=(s+=l.transitionTime)){if(o<=s+d+h.transitionTime){c=l,u=h;break}}else if(this.lastTransitionPointInfo)return this.lastTransitionPointInfo=void 0,this.getCurrentAdaptiveLightingTransitionPoint();s+=d}if(c&&u)return this.lastTransitionPointInfo={curveIndex:a,lowerBoundTimeOffset:s-c.transitionTime},{lowerBoundTimeOffset:s,transitionOffset:o-s,lowerBound:c,upperBound:u};this.lastTransitionPointInfo=void 0},t.prototype.scheduleNextUpdate=function(e){var t,r,i,n,o,a=this;if(void 0===e&&(e=!1),!this.activeTransition)throw new Error("tried scheduling transition when no transition was active!");e||(this.updateTimeout=void 0),this.didRunFirstInitializationStep||(this.didRunFirstInitializationStep=!0,this.handleAdaptiveLightingEnabled());var s=this.getCurrentAdaptiveLightingTransitionPoint();if(!s)return b("[%s] Reached end of transition curve!",this.lightbulb.displayName),void(e||this.disableAdaptiveLighting());var c,u,l=s.lowerBound,h=s.upperBound;if(l.duration&&s.transitionOffset<=l.duration)c=l.temperature,u=l.brightnessAdjustmentFactor;else{var d=(s.transitionOffset-(null!==(t=l.duration)&&void 0!==t?t:0))/h.transitionTime;c=l.temperature+(h.temperature-l.temperature)*d,u=l.brightnessAdjustmentFactor+(h.brightnessAdjustmentFactor-l.brightnessAdjustmentFactor)*d}var p=Math.max(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue,Math.min(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue,this.brightnessCharacteristic.value)),f=Math.round(c+u*p);f+=this.customTemperatureAdjustment;var g=null!==(i=null===(r=this.colorTemperatureCharacteristic)||void 0===r?void 0:r.props.minValue)&&void 0!==i?i:140,m=null!==(o=null===(n=this.colorTemperatureCharacteristic)||void 0===n?void 0:n.props.maxValue)&&void 0!==o?o:500;f=Math.max(g,Math.min(m,f));var v=S.ColorUtils.colorTemperatureToHueAndSaturation(f);b("[%s] Next temperature value is %d (for brightness %d adj: %s)",this.lightbulb.displayName,f,p,this.customTemperatureAdjustment);var y={controller:this,omitEventUpdate:!0};if(this.saturationCharacteristic&&(this.saturationCharacteristic.value=v.saturation),this.hueCharacteristic&&(this.hueCharacteristic.value=v.hue),this.colorTemperatureCharacteristic.handleSetRequest(f,void 0,y).catch((function(e){b("[%s] Failed to next adaptive lighting transition point: %d",a.lightbulb.displayName,e)})),this.activeTransition){var C=Date.now();if(!e&&C-this.lastEventNotificationSent>=this.activeTransition.notifyIntervalThreshold){b("[%s] Sending event notifications for current transition!",this.lightbulb.displayName),this.lastEventNotificationSent=C;var E={controller:this};this.lastNotifiedTemperatureValue!==f&&(this.colorTemperatureCharacteristic.sendEventNotification(f,E),this.lastNotifiedTemperatureValue=f),this.saturationCharacteristic&&this.lastNotifiedSaturationValue!==v.saturation&&(this.saturationCharacteristic.sendEventNotification(v.saturation,E),this.lastNotifiedSaturationValue=v.saturation),this.hueCharacteristic&&this.lastNotifiedHueValue!==v.hue&&(this.hueCharacteristic.sendEventNotification(v.hue,E),this.lastNotifiedHueValue=v.hue)}e||(this.updateTimeout=setTimeout(this.scheduleNextUpdate.bind(this),this.activeTransition.updateInterval))}else console.warn("["+this.lightbulb.displayName+"] Adaptive Lighting was probably disable my mistake by some call in the SET handler of the ColorTemperature characteristic! Please check that you don't call setValue/setCharacteristic on the Hue, Saturation or ColorTemperature characteristic!")},t.prototype.constructServices=function(){return{}},t.prototype.initWithServices=function(e){},t.prototype.configureServices=function(){var e=this;this.supportedTransitionConfiguration=this.lightbulb.getCharacteristic(D.Characteristic.SupportedCharacteristicValueTransitionConfiguration),this.transitionControl=this.lightbulb.getCharacteristic(D.Characteristic.CharacteristicValueTransitionControl).updateValue(""),this.activeTransitionCount=this.lightbulb.getCharacteristic(D.Characteristic.CharacteristicValueActiveTransitionCount).updateValue(0),this.supportedTransitionConfiguration.onGet(this.handleSupportedTransitionConfigurationRead.bind(this)),this.transitionControl.onGet((function(){return e.buildTransitionControlResponseBuffer().toString("base64")})).onSet((function(t){try{return e.handleTransitionControlWrite(t)}catch(r){throw console.warn("[%s] DEBUG: '".concat(t,"'")),console.warn("[%s] Encountered error on CharacteristicValueTransitionControl characteristic: "+r.stack),e.disableAdaptiveLighting(),new E.HapStatusError(-70402)}}))},t.prototype.handleControllerRemoved=function(){this.lightbulb.removeCharacteristic(this.supportedTransitionConfiguration),this.lightbulb.removeCharacteristic(this.transitionControl),this.lightbulb.removeCharacteristic(this.activeTransitionCount),this.supportedTransitionConfiguration=void 0,this.transitionControl=void 0,this.activeTransitionCount=void 0,this.removeAllListeners()},t.prototype.handleFactoryReset=function(){this.handleAdaptiveLightingDisabled()},t.prototype.serialize=function(){if(this.activeTransition)return{activeTransition:this.activeTransition}},t.prototype.deserialize=function(e){this.activeTransition=e.activeTransition,this.activeTransition.transitionId||(this.activeTransition.transitionId=this.activeTransition.id1,delete this.activeTransition.id1),this.activeTransition.timeMillisOffset||(this.activeTransition.timeMillisOffset=0),this.handleActiveTransitionUpdated(!0)},t.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},t.prototype.handleSupportedTransitionConfigurationRead=function(){var e=this.lightbulb.getCharacteristic(D.Characteristic.Brightness).iid,t=this.lightbulb.getCharacteristic(D.Characteristic.ColorTemperature).iid;return(0,C.default)(e,"iid for brightness characteristic is undefined"),(0,C.default)(t,"iid for temperature characteristic is undefined"),w.encode(1,[w.encode(1,w.writeVariableUIntLE(e),2,1),w.encode(1,w.writeVariableUIntLE(t),2,2)]).toString("base64")},t.prototype.buildTransitionControlResponseBuffer=function(e){if(!this.activeTransition)return Buffer.alloc(0);var t=this.activeTransition,r=null!=e?e:Date.now()-t.timeMillisOffset-t.transitionStartMillis,i=w.writeVariableUIntLE(r),n=w.encode(1,T.write(t.transitionId),2,Buffer.from(t.transitionStartBuffer,"hex"));t.id3&&(n=Buffer.concat([n,w.encode(3,Buffer.from(t.id3,"hex"))]));var o=w.encode(1,w.writeVariableUIntLE(t.iid),2,n,3,i);return w.encode(1,o)},t.prototype.handleTransitionControlWrite=function(e){if("string"!=typeof e)throw new E.HapStatusError(-70410);var t=w.decode(Buffer.from(e,"base64")),r=[],i=t[1];if(i){var n=this.handleTransitionControlReadTransition(i);n&&r.push(n)}var o=t[2];if(o){var a=this.handleTransitionControlUpdateTransition(o);a&&r.push(a)}return Buffer.concat(r).toString("base64")},t.prototype.handleTransitionControlReadTransition=function(e){var t=w.decode(e),r=w.readVariableUIntLE(t[1]);if(this.activeTransition){if(this.activeTransition.iid!==r)throw console.warn("["+this.lightbulb.displayName+"] iid of current adaptive lighting transition ("+this.activeTransition.iid+") doesn't match the requested one "+r),new E.HapStatusError(-70410);var i=w.encode(1,T.write(this.activeTransition.transitionId),2,Buffer.from(this.activeTransition.transitionStartBuffer,"hex"));return this.activeTransition.id3&&(i=Buffer.concat([i,w.encode(3,Buffer.from(this.activeTransition.id3,"hex"))])),w.encode(1,w.encode(1,w.writeVariableUIntLE(this.activeTransition.iid),2,i,3,1,5,w.encode(1,this.activeTransition.transitionCurve.map((function(e,t,r){var i,n,o=null!==(n=null===(i=r[t-1])||void 0===i?void 0:i.duration)&&void 0!==n?n:0;return w.encode(1,w.writeFloat32LE(e.brightnessAdjustmentFactor),2,w.writeFloat32LE(e.temperature),3,w.writeVariableUIntLE(e.transitionTime),4,w.writeVariableUIntLE(o))})),2,w.writeVariableUIntLE(this.activeTransition.brightnessCharacteristicIID),3,w.encode(1,w.writeUInt32(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue),2,w.writeUInt32(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue))),6,w.writeVariableUIntLE(this.activeTransition.updateInterval),8,w.writeVariableUIntLE(this.activeTransition.notifyIntervalThreshold)))}},t.prototype.handleTransitionControlUpdateTransition=function(e){var t,r,i,n,o=w.decode(e),a=w.decode(o[1]),s=w.readVariableUIntLE(a[1]);if(!this.lightbulb.getCharacteristicByIID(s))throw new E.HapStatusError(-70410);if(!(null===(i=a[3])||void 0===i?void 0:i.readUInt8(0)))return this.handleAdaptiveLightingDisabled(),w.encode(2,Buffer.alloc(0));var c=w.decode(a[2]),u=w.decodeWithLists(a[5]),l=null===(n=a[6])||void 0===n?void 0:n.readUInt16LE(0),h=a[8].readUInt32LE(0),d=c[1],p=c[2],f=c[3],g=(0,_.epochMillisFromMillisSince2001_01_01Buffer)(p),m=Date.now()-g,v=[],C=void 0,S=u[1];try{for(var A=y.__values(S),I=A.next();!I.done;I=A.next()){var D=I.value,U=w.decode(D),R=U[1].readFloatLE(0),O=U[2].readFloatLE(0),N=w.readVariableUIntLE(U[3]),P=U[4]?w.readVariableUIntLE(U[4]):void 0;C&&(C.duration=P),C={temperature:O,brightnessAdjustmentFactor:R,transitionTime:N},v.push(C)}}catch(e){t={error:e}}finally{try{I&&!I.done&&(r=A.return)&&r.call(A)}finally{if(t)throw t.error}}var B=w.readVariableUIntLE(u[2]),L=w.decode(u[3]),x=L[1].readUInt32LE(0),M=L[2].readUInt32LE(0);return this.activeTransition={iid:s,transitionStartMillis:g,timeMillisOffset:m,transitionId:T.unparse(d),transitionStartBuffer:p.toString("hex"),id3:null==f?void 0:f.toString("hex"),brightnessCharacteristicIID:B,brightnessAdjustmentRange:{minBrightnessValue:x,maxBrightnessValue:M},transitionCurve:v,updateInterval:null!=l?l:6e4,notifyIntervalThreshold:h},this.updateTimeout?(clearTimeout(this.updateTimeout),this.updateTimeout=void 0,b("[%s] Adaptive lighting was renewed.",this.lightbulb.displayName)):b("[%s] Adaptive lighting was enabled.",this.lightbulb.displayName),this.handleActiveTransitionUpdated(),w.encode(2,this.buildTransitionControlResponseBuffer(0))},t}(I.EventEmitter);t.AdaptiveLightingController=U},2405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CameraController=t.CameraControllerEvents=t.ResourceRequestReason=void 0;var i,n,o=r(1635),a=o.__importDefault(r(6982)),s=o.__importDefault(r(5753)),c=r(4434),u=r(8591),l=r(9826),h=r(9948),d=r(5876),p=r(8073),f=(0,s.default)("HAP-NodeJS:Camera:Controller");!function(e){e[e.PERIODIC=0]="PERIODIC",e[e.EVENT=1]="EVENT"}(i||(t.ResourceRequestReason=i={})),function(e){e.MICROPHONE_PROPERTIES_CHANGED="microphone-change",e.SPEAKER_PROPERTIES_CHANGED="speaker-change"}(n||(t.CameraControllerEvents=n={}));var g=function(e){function t(t,r){void 0===r&&(r=!1);var i=e.call(this)||this;return i.legacyMode=!1,i.streamManagements=[],i.microphoneMuted=!1,i.microphoneVolume=100,i.speakerMuted=!1,i.speakerVolume=100,i.motionServiceExternallySupplied=!1,i.occupancyServiceExternallySupplied=!1,i.streamCount=Math.max(1,t.cameraStreamCount||1),i.delegate=t.delegate,i.streamingOptions=t.streamingOptions,i.recording=t.recording,i.sensorOptions=t.sensors,i.legacyMode=r,i}return o.__extends(t,e),t.prototype.controllerId=function(){return"camera"},t.prototype.forceStopStreamingSession=function(e){this.streamManagements.forEach((function(t){t.sessionIdentifier===e&&t.forceStop()}))},t.generateSynchronisationSource=function(){var e=a.default.randomBytes(4);return e[0]=0,e.readInt32BE(0)},t.prototype.setMicrophoneMuted=function(e){void 0===e&&(e=!0),this.microphoneService&&(this.microphoneMuted=e,this.microphoneService.updateCharacteristic(l.Characteristic.Mute,e))},t.prototype.setMicrophoneVolume=function(e){this.microphoneService&&(this.microphoneVolume=e,this.microphoneService.updateCharacteristic(l.Characteristic.Volume,e))},t.prototype.setSpeakerMuted=function(e){void 0===e&&(e=!0),this.speakerService&&(this.speakerMuted=e,this.speakerService.updateCharacteristic(l.Characteristic.Mute,e))},t.prototype.setSpeakerVolume=function(e){this.speakerService&&(this.speakerVolume=e,this.speakerService.updateCharacteristic(l.Characteristic.Volume,e))},t.prototype.emitMicrophoneChange=function(){this.emit("microphone-change",this.microphoneMuted,this.microphoneVolume)},t.prototype.emitSpeakerChange=function(){this.emit("speaker-change",this.speakerMuted,this.speakerVolume)},t.prototype.constructServices=function(){for(var e,r,i,n,o=0;o{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableController=t.DefaultControllerType=void 0,function(e){e.CAMERA="camera",e.REMOTE="remote",e.TV="tv",e.ROUTER="router",e.LOCK="lock",e.CHARACTERISTIC_TRANSITION="characteristic-transition"}(r||(t.DefaultControllerType=r={})),t.isSerializableController=function(e){return"serialize"in e&&"deserialize"in e&&"setupStateChangeDelegate"in e}},7959:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DoorbellController=void 0;var i=r(1635),n=r(9826),o=r(5876),a=function(e){function t(t){var r=e.call(this,t)||this;return r.doorbellServiceExternallySupplied=!1,r.doorbellOptions={name:t.name,externalDoorbellService:t.externalDoorbellService},r}return i.__extends(t,e),t.prototype.ringDoorbell=function(){this.doorbellService.updateCharacteristic(n.Characteristic.ProgrammableSwitchEvent,n.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)},t.prototype.constructServices=function(){var t,r,i;(null===(t=this.doorbellOptions)||void 0===t?void 0:t.externalDoorbellService)?(this.doorbellService=this.doorbellOptions.externalDoorbellService,this.doorbellServiceExternallySupplied=!0):this.doorbellService=new o.Service.Doorbell(null!==(i=null===(r=this.doorbellOptions)||void 0===r?void 0:r.name)&&void 0!==i?i:"",""),this.doorbellService.setPrimaryService();var n=e.prototype.constructServices.call(this);return this.doorbellServiceExternallySupplied||(n.doorbell=this.doorbellService),n},t.prototype.initWithServices=function(t){var r,i,n,a=e.prototype._initWithServices.call(this,t);if((null===(r=this.doorbellOptions)||void 0===r?void 0:r.externalDoorbellService)?(this.doorbellService=this.doorbellOptions.externalDoorbellService,this.doorbellServiceExternallySupplied=!0,a.serviceMap.doorbell&&(delete a.serviceMap.doorbell,a.updated=!0)):(this.doorbellService=a.serviceMap.doorbell,this.doorbellService||(this.doorbellService=new o.Service.Doorbell(null!==(n=null===(i=this.doorbellOptions)||void 0===i?void 0:i.name)&&void 0!==n?n:"",""),a.serviceMap.doorbell=this.doorbellService,a.updated=!0)),this.doorbellService.setPrimaryService(),a.updated)return a.serviceMap},t.prototype.migrateFromDoorbell=function(e){return!1},t.prototype.retrieveEventTriggerOptions=function(){var t=e.prototype.retrieveEventTriggerOptions.call(this);return t.add(2),t},t.prototype.handleControllerRemoved=function(){e.prototype.handleControllerRemoved.call(this),this.doorbellService=void 0},t.prototype.configureServices=function(){e.prototype.configureServices.call(this),this.doorbellService.getCharacteristic(n.Characteristic.ProgrammableSwitchEvent).onGet((function(){return null})),this.doorbellOptions=void 0},t}(r(2405).CameraController);t.DoorbellController=a},9352:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SiriAudioSession=t.SiriAudioSessionEvents=t.HomeKitRemoteController=t.RemoteController=t.RemoteControllerEvents=t.TargetUpdates=t.AudioCodecTypes=t.ButtonState=t.TargetCategory=t.ButtonType=void 0;var i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,C,S,E=r(1635),_=E.__importDefault(r(2613)),T=E.__importDefault(r(5753)),A=r(4434),I=r(9826),D=r(9948),w=r(5876),b=E.__importStar(r(3314)),U=(0,T.default)("HAP-NodeJS:Remote:Controller");!function(e){e[e.MAXIMUM_TARGETS=1]="MAXIMUM_TARGETS",e[e.TICKS_PER_SECOND=2]="TICKS_PER_SECOND",e[e.SUPPORTED_BUTTON_CONFIGURATION=3]="SUPPORTED_BUTTON_CONFIGURATION",e[e.TYPE=4]="TYPE"}(i||(i={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_TYPE=2]="BUTTON_TYPE"}(n||(n={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.MENU=1]="MENU",e[e.PLAY_PAUSE=2]="PLAY_PAUSE",e[e.TV_HOME=3]="TV_HOME",e[e.SELECT=4]="SELECT",e[e.ARROW_UP=5]="ARROW_UP",e[e.ARROW_RIGHT=6]="ARROW_RIGHT",e[e.ARROW_DOWN=7]="ARROW_DOWN",e[e.ARROW_LEFT=8]="ARROW_LEFT",e[e.VOLUME_UP=9]="VOLUME_UP",e[e.VOLUME_DOWN=10]="VOLUME_DOWN",e[e.SIRI=11]="SIRI",e[e.POWER=12]="POWER",e[e.GENERIC=13]="GENERIC"}(o||(t.ButtonType=o={})),function(e){e[e.OPERATION=1]="OPERATION",e[e.TARGET_CONFIGURATION=2]="TARGET_CONFIGURATION"}(a||(a={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.LIST=1]="LIST",e[e.ADD=2]="ADD",e[e.REMOVE=3]="REMOVE",e[e.RESET=4]="RESET",e[e.UPDATE=5]="UPDATE"}(s||(s={})),function(e){e[e.TARGET_IDENTIFIER=1]="TARGET_IDENTIFIER",e[e.TARGET_NAME=2]="TARGET_NAME",e[e.TARGET_CATEGORY=3]="TARGET_CATEGORY",e[e.BUTTON_CONFIGURATION=4]="BUTTON_CONFIGURATION"}(c||(c={})),function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.APPLE_TV=24]="APPLE_TV"}(u||(t.TargetCategory=u={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_TYPE=2]="BUTTON_TYPE",e[e.BUTTON_NAME=3]="BUTTON_NAME"}(l||(l={})),function(e){e[e.BUTTON_ID=1]="BUTTON_ID",e[e.BUTTON_STATE=2]="BUTTON_STATE",e[e.TIMESTAMP=3]="TIMESTAMP",e[e.ACTIVE_IDENTIFIER=4]="ACTIVE_IDENTIFIER"}(h||(h={})),function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(d||(t.ButtonState=d={})),function(e){e[e.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION=1]="SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION"}(p||(p={})),function(e){e[e.AUDIO_CODEC_CONFIGURATION=1]="AUDIO_CODEC_CONFIGURATION",e[e.COMFORT_NOISE_SUPPORT=2]="COMFORT_NOISE_SUPPORT"}(f||(f={})),function(e){e[e.CODEC_TYPE=1]="CODEC_TYPE",e[e.CODEC_PARAMETERS=2]="CODEC_PARAMETERS"}(g||(g={})),function(e){e[e.PCMU=0]="PCMU",e[e.PCMA=1]="PCMA",e[e.AAC_ELD=2]="AAC_ELD",e[e.OPUS=3]="OPUS",e[e.MSBC=4]="MSBC",e[e.AMR=5]="AMR",e[e.AMR_WB=6]="AMR_WB"}(m||(t.AudioCodecTypes=m={})),function(e){e[e.CHANNEL=1]="CHANNEL",e[e.BIT_RATE=2]="BIT_RATE",e[e.SAMPLE_RATE=3]="SAMPLE_RATE",e[e.PACKET_TIME=4]="PACKET_TIME"}(v||(v={})),function(e){e[e.STARTING=0]="STARTING",e[e.SENDING=1]="SENDING",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(y||(y={})),function(e){e[e.NAME=0]="NAME",e[e.CATEGORY=1]="CATEGORY",e[e.UPDATED_BUTTONS=2]="UPDATED_BUTTONS",e[e.REMOVED_BUTTONS=3]="REMOVED_BUTTONS"}(C||(t.TargetUpdates=C={})),function(e){e.ACTIVE_CHANGE="active-change",e.ACTIVE_IDENTIFIER_CHANGE="active-identifier-change",e.TARGET_ADDED="target-add",e.TARGET_UPDATED="target-update",e.TARGET_REMOVED="target-remove",e.TARGETS_RESET="targets-reset"}(S||(t.RemoteControllerEvents=S={}));var R=function(e){function t(r,i){var n=e.call(this)||this;n.buttons={},n.targetConfigurations=new Map,n.targetConfigurationsString="",n.lastButtonEvent="",n.activeIdentifier=0,n.dataStreamConnections=new Map,n.audioSupported=void 0!==r,n.audioProducerConstructor=r,n.audioProducerOptions=i;var o=n.constructSupportedConfiguration();n.supportedConfiguration=n.buildTargetControlSupportedConfigurationTLV(o);var a=n.constructSupportedAudioConfiguration();return n.supportedAudioConfiguration=t.buildSupportedAudioConfigurationTLV(a),n.selectedAudioConfiguration={codecType:3,parameters:{channels:1,bitrate:0,samplerate:1,rtpTime:20}},n.selectedAudioConfigurationString=t.buildSelectedAudioConfigurationTLV({audioCodecConfiguration:n.selectedAudioConfiguration}),n}return E.__extends(t,e),t.prototype.controllerId=function(){return"remote"},t.prototype.setActiveIdentifier=function(e){var t=this;if(e!==this.activeIdentifier){if(0!==e&&!this.targetConfigurations.has(e))throw Error("Tried setting unconfigured targetIdentifier to active");U("%d is now the active target",e),this.activeIdentifier=e,this.targetControlService.getCharacteristic(I.Characteristic.ActiveIdentifier).updateValue(e),this.activeAudioSession&&this.handleSiriAudioStop(),setTimeout((function(){return t.emit("active-identifier-change",e)}),0),this.setInactive()}},t.prototype.isActive=function(){return!!this.activeConnection},t.prototype.isConfigured=function(e){return this.targetConfigurations.has(e)},t.prototype.getTargetIdentifierByName=function(e){var t,r;try{for(var i=E.__values(Object.entries(this.targetConfigurations)),n=i.next();!n.done;n=i.next()){var o=E.__read(n.value,2),a=o[0];if(o[1].targetName===e)return parseInt(a,10)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.pushButton=function(e){this.sendButtonEvent(e,1)},t.prototype.releaseButton=function(e){this.sendButtonEvent(e,0)},t.prototype.pushAndReleaseButton=function(e,t){var r=this;void 0===t&&(t=200),this.pushButton(e),setTimeout((function(){return r.releaseButton(e)}),t)},t.prototype.addServicesToAccessory=function(e){e.configureController(this)},t.prototype.constructSupportedConfiguration=function(){var e=this,t={maximumTargets:10,ticksPerSecond:1e3,supportedButtonConfiguration:[],hardwareImplemented:this.audioSupported},r=[1,2,3,4,5,6,7,8,9,10,12,13];return this.audioSupported&&r.push(11),r.forEach((function(r){var i={buttonID:100+r,buttonType:r};t.supportedButtonConfiguration.push(i),e.buttons[r]=i.buttonID})),t},t.prototype.constructSupportedAudioConfiguration=function(){return{audioCodecConfiguration:{codecType:3,parameters:{channels:1,bitrate:0,samplerate:1}}}},t.prototype.handleTargetControlWrite=function(e,t){var r,i=Buffer.from(e,"base64"),n=b.decode(i),o=n[1][0],a=void 0;switch(n[2]&&(a=this.parseTargetConfigurationTLV(n[2])),U("Received TargetControl write operation %s",s[o]),o){case s.ADD:r=this.handleAddTarget.bind(this);break;case s.UPDATE:r=this.handleUpdateTarget.bind(this);break;case s.REMOVE:r=this.handleRemoveTarget.bind(this);break;case s.RESET:r=this.handleResetTargets.bind(this);break;case s.LIST:r=this.handleListTargets.bind(this);break;default:return void t(-70410,void 0)}var c=r(a);0===c?(t(void 0,this.targetConfigurationsString),o===s.ADD&&0===this.activeIdentifier&&this.setActiveIdentifier(a.targetIdentifier)):t(new Error(c+""))},t.prototype.handleAddTarget=function(e){var t=this;return e?(this.targetConfigurations.set(e.targetIdentifier,e),U("Configured new target '"+e.targetName+"' with targetIdentifier '"+e.targetIdentifier+"'"),setTimeout((function(){return t.emit("target-add",e)}),0),this.updatedTargetConfiguration(),0):-70410},t.prototype.handleUpdateTarget=function(e){var t,r,i=this;if(!e)return-70410;var n=[],o=this.targetConfigurations.get(e.targetIdentifier);if(!o)return-70410;if(e.targetName&&(U("Target name was updated '%s' => '%s' (%d)",o.targetName,e.targetName,o.targetIdentifier),o.targetName=e.targetName,n.push(0)),e.targetCategory&&(U("Target category was updated '%d' => '%d' for target '%s' (%d)",o.targetCategory,e.targetCategory,o.targetName,o.targetIdentifier),o.targetCategory=e.targetCategory,n.push(1)),e.buttonConfiguration){U("%d button configurations were updated for target '%s' (%d)",Object.keys(e.buttonConfiguration).length,o.targetName,o.targetIdentifier);try{for(var a=E.__values(Object.values(e.buttonConfiguration)),s=a.next();!s.done;s=a.next()){var c=s.value,u=o.buttonConfiguration[c.buttonID];u.buttonType=c.buttonType,u.buttonName=c.buttonName}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}n.push(2)}return setTimeout((function(){return i.emit("target-update",e,n)}),0),this.updatedTargetConfiguration(),0},t.prototype.handleRemoveTarget=function(e){var t=this;if(!e)return-70410;var r=this.targetConfigurations.get(e.targetIdentifier);if(!r)return-70410;if(e.buttonConfiguration){for(var i in e.buttonConfiguration)Object.prototype.hasOwnProperty.call(e.buttonConfiguration,i)&&delete r.buttonConfiguration[i];U("Removed %d button configurations of target '%s' (%d)",Object.keys(e.buttonConfiguration).length,r.targetName,r.targetIdentifier),setTimeout((function(){return t.emit("target-update",r,[3])}),0)}else{this.targetConfigurations.delete(e.targetIdentifier),U("Target '%s' (%d) was removed",r.targetName,r.targetIdentifier),setTimeout((function(){return t.emit("target-remove",e.targetIdentifier)}),0);var n=Object.keys(this.targetConfigurations);this.setActiveIdentifier(0===n.length?0:parseInt(n[0],10))}return this.updatedTargetConfiguration(),0},t.prototype.handleResetTargets=function(e){var t=this;return e?-70410:(U("Resetting all target configurations"),this.targetConfigurations=new Map,this.updatedTargetConfiguration(),setTimeout((function(){return t.emit("targets-reset")}),0),this.setActiveIdentifier(0),0)},t.prototype.handleListTargets=function(e){return e?-70410:(U("Returning "+Object.keys(this.targetConfigurations).length+" target configurations"),0)},t.prototype.handleActiveWrite=function(e,t,r){if(0===this.activeIdentifier)return U("Tried to change active state. There is no active target set though"),void t(-70410);this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionDisconnectListener),this.activeConnection=void 0,this.activeConnectionDisconnectListener=void 0),this.activeConnection=e?r:void 0,this.activeConnection&&(this.activeConnectionDisconnectListener=this.handleActiveSessionDisconnected.bind(this,this.activeConnection),this.activeConnection.on("closed",this.activeConnectionDisconnectListener));var i=this.targetConfigurations.get(this.activeIdentifier);i?(U("Remote with activeTarget '%s' (%d) was set to %s",i.targetName,this.activeIdentifier,e?"ACTIVE":"INACTIVE"),t(),this.emit("active-change",e)):t(-70410)},t.prototype.setInactive=function(){var e=this;void 0!==this.activeConnection&&(this.activeConnection.removeListener("closed",this.activeConnectionDisconnectListener),this.activeConnection=void 0,this.activeConnectionDisconnectListener=void 0,this.targetControlService.getCharacteristic(I.Characteristic.Active).updateValue(!1),U("Remote was set to INACTIVE"),setTimeout((function(){return e.emit("active-change",!1)}),0))},t.prototype.handleActiveSessionDisconnected=function(e){e===this.activeConnection&&(U("Active hap session disconnected!"),this.setInactive())},t.prototype.sendButtonEvent=function(e,t){var r=this.buttons[e];if(void 0===r||0===r)throw new Error("Tried sending button event for unsupported button ("+e+")");if(0===this.activeIdentifier)throw new Error("Tried sending button event although no target was selected");if(!this.isActive())throw new Error("Tried sending button event although target was not marked as active");if(11===e&&this.audioSupported)1===t?this.handleSiriAudioStart():0===t&&this.handleSiriAudioStop();else{var i=b.encode(1,r),n=b.encode(2,t),o=b.encode(3,b.writeVariableUIntLE((new Date).getTime())),a=b.encode(4,b.writeUInt32(this.activeIdentifier));this.lastButtonEvent=Buffer.concat([i,n,o,a]).toString("base64"),this.targetControlService.getCharacteristic(I.Characteristic.ButtonEvent).sendEventNotification(this.lastButtonEvent)}},t.prototype.parseTargetConfigurationTLV=function(e){var t=b.decode(e),r=b.readUInt32(t[1]),i=void 0;t[2]&&(i=t[2].toString());var n=void 0;t[3]&&(n=b.readUInt16(t[3]));var a={};t[4]&&b.decodeList(t[4],1).forEach((function(e){var t,r=e[1][0],i=b.readUInt16(e[2]);t=e[3]?e[3].toString():o[i],a[r]={buttonID:r,buttonType:i,buttonName:t}}));return{targetIdentifier:r,targetName:i,targetCategory:n,buttonConfiguration:a}},t.prototype.updatedTargetConfiguration=function(){var e,t,r,i,n,o=[];try{for(var a=E.__values(Object.values(this.targetConfigurations)),s=a.next();!s.done;s=a.next()){var c=s.value,u=b.encode(1,b.writeUInt32(c.targetIdentifier)),l=b.encode(2,c.targetName),h=b.encode(3,b.writeUInt16(c.targetCategory)),d=[];try{for(var p=(r=void 0,E.__values(c.buttonConfiguration.values())),f=p.next();!f.done;f=p.next()){var g=f.value,m=b.encode(1,g.buttonID,2,b.writeUInt16(g.buttonType));g.buttonName&&(m=Buffer.concat([m,b.encode(3,g.buttonName)])),d.push(m)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}var v=b.encode(4,Buffer.concat(d)),y=Buffer.concat([u,l,h,v]);o.push(b.encode(2,y))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}this.targetConfigurationsString=Buffer.concat(o).toString("base64"),null===(n=this.stateChangeDelegate)||void 0===n||n.call(this)},t.prototype.buildTargetControlSupportedConfigurationTLV=function(e){var t=b.encode(1,e.maximumTargets),r=b.encode(2,b.writeVariableUIntLE(e.ticksPerSecond)),i=[];e.supportedButtonConfiguration.forEach((function(e){var t=b.encode(1,e.buttonID,2,b.writeUInt16(e.buttonType));i.push(t)}));var n=b.encode(3,Buffer.concat(i)),o=b.encode(4,e.hardwareImplemented?1:0);return Buffer.concat([t,r,n,o]).toString("base64")},t.prototype.handleTargetControlWhoAmI=function(e,t){var r=t.identifier;this.dataStreamConnections.set(r,e),U("Discovered HDS connection for targetIdentifier %s",r),e.addProtocolHandler("dataSend",this)},t.prototype.handleSiriAudioStart=function(){if(!this.audioSupported)throw new Error("Cannot start siri stream on remote where siri is not supported");if(this.isActive())if(!this.activeAudioSession||this.activeAudioSession.isClosing()&&!this.nextAudioSession){var e=this.dataStreamConnections.get(this.activeIdentifier);if(void 0!==e){var t=new P(e,this.selectedAudioConfiguration,this.audioProducerConstructor,this.audioProducerOptions);this.activeAudioSession?this.nextAudioSession=t:this.activeAudioSession=t,t.on("close",this.handleSiriAudioSessionClosed.bind(this,t)),t.start()}else U("Tried opening Siri audio stream however target is not connected via HDS")}else U("Tried opening Siri audio stream, however there is already one in progress");else U("Tried opening Siri audio stream, however no controller is connected!")},t.prototype.handleSiriAudioStop=function(){if(this.activeAudioSession){if(!this.activeAudioSession.isClosing())return void this.activeAudioSession.stop();if(this.nextAudioSession&&!this.nextAudioSession.isClosing())return void this.nextAudioSession.stop()}U("handleSiriAudioStop called although no audio session was started")},t.prototype.handleDataSendAckEvent=function(e){var t=e.streamId,r=e.endOfStream;this.activeAudioSession&&this.activeAudioSession.streamId===t?this.activeAudioSession.handleDataSendAckEvent(r):this.nextAudioSession&&this.nextAudioSession.streamId===t?this.nextAudioSession.handleDataSendAckEvent(r):U("Received dataSend acknowledgment event for unknown streamId '%s'",t)},t.prototype.handleDataSendCloseEvent=function(e){var t=e.streamId,r=e.reason;this.activeAudioSession&&this.activeAudioSession.streamId===t?this.activeAudioSession.handleDataSendCloseEvent(r):this.nextAudioSession&&this.nextAudioSession.streamId===t?this.nextAudioSession.handleDataSendCloseEvent(r):U("Received dataSend close event for unknown streamId '%s'",t)},t.prototype.handleSiriAudioSessionClosed=function(e){e===this.activeAudioSession?(this.activeAudioSession=this.nextAudioSession,this.nextAudioSession=void 0):e===this.nextAudioSession&&(this.nextAudioSession=void 0)},t.prototype.handleDataStreamConnectionClosed=function(e){var t,r;try{for(var i=E.__values(this.dataStreamConnections),n=i.next();!n.done;n=i.next()){var o=E.__read(n.value,2),a=o[0];if(e===o[1]){U("HDS connection disconnected for targetIdentifier %s",a),this.dataStreamConnections.delete(a);break}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.handleSelectedAudioConfigurationWrite=function(e,r){var i=Buffer.from(e,"base64"),n=b.decode(i),o=b.decode(n[1]),a=o[1][0],s=b.decode(o[2]),c=s[1][0],u=s[2][0],l=s[3][0];this.selectedAudioConfiguration={codecType:a,parameters:{channels:c,bitrate:u,samplerate:l,rtpTime:20}},this.selectedAudioConfigurationString=t.buildSelectedAudioConfigurationTLV({audioCodecConfiguration:this.selectedAudioConfiguration}),r()},t.buildSupportedAudioConfigurationTLV=function(e){var r=t.buildCodecConfigurationTLV(e.audioCodecConfiguration);return b.encode(1,r).toString("base64")},t.buildSelectedAudioConfigurationTLV=function(e){var r=t.buildCodecConfigurationTLV(e.audioCodecConfiguration);return b.encode(1,r).toString("base64")},t.buildCodecConfigurationTLV=function(e){var t=e.parameters,r=b.encode(1,t.channels,2,t.bitrate,3,t.samplerate);return t.rtpTime&&(r=Buffer.concat([r,b.encode(4,t.rtpTime)])),b.encode(1,e.codecType,2,r)},t.prototype.constructServices=function(){var e;return this.targetControlManagementService=new w.Service.TargetControlManagement("",""),this.targetControlManagementService.setCharacteristic(I.Characteristic.TargetControlSupportedConfiguration,this.supportedConfiguration),this.targetControlManagementService.setCharacteristic(I.Characteristic.TargetControlList,this.targetConfigurationsString),this.targetControlManagementService.setPrimaryService(),this.targetControlService=new w.Service.TargetControl("",""),this.targetControlService.setCharacteristic(I.Characteristic.ActiveIdentifier,0),this.targetControlService.setCharacteristic(I.Characteristic.Active,!1),this.targetControlService.setCharacteristic(I.Characteristic.ButtonEvent,this.lastButtonEvent),this.audioSupported&&(this.siriService=new w.Service.Siri("",""),this.siriService.setCharacteristic(I.Characteristic.SiriInputType,I.Characteristic.SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV),this.audioStreamManagementService=new w.Service.AudioStreamManagement("",""),this.audioStreamManagementService.setCharacteristic(I.Characteristic.SupportedAudioStreamConfiguration,this.supportedAudioConfiguration),this.audioStreamManagementService.setCharacteristic(I.Characteristic.SelectedAudioStreamConfiguration,this.selectedAudioConfigurationString),this.dataStreamManagement=new D.DataStreamManagement,this.siriService.addLinkedService(this.dataStreamManagement.getService()),this.siriService.addLinkedService(this.audioStreamManagementService)),{targetControlManagement:this.targetControlManagementService,targetControl:this.targetControlService,siri:this.siriService,audioStreamManagement:this.audioStreamManagementService,dataStreamTransportManagement:null===(e=this.dataStreamManagement)||void 0===e?void 0:e.getService()}},t.prototype.initWithServices=function(e){this.targetControlManagementService=e.targetControlManagement,this.targetControlService=e.targetControl,this.siriService=e.siri,this.audioStreamManagementService=e.audioStreamManagement,this.dataStreamManagement=new D.DataStreamManagement(e.dataStreamTransportManagement)},t.prototype.configureServices=function(){var e,t=this;if(!this.targetControlManagementService||!this.targetControlService)throw new Error("Unexpected state: Services not configured!");this.targetControlManagementService.getCharacteristic(I.Characteristic.TargetControlList).on("get",(function(e){e(null,t.targetConfigurationsString)})).on("set",this.handleTargetControlWrite.bind(this)),this.targetControlService.getCharacteristic(I.Characteristic.ActiveIdentifier).on("get",(function(e){e(void 0,t.activeIdentifier)})),this.targetControlService.getCharacteristic(I.Characteristic.Active).on("get",(function(e){e(void 0,t.isActive())})).on("set",(function(e,r,i,n){if(!n)return U("Set event handler for Remote.Active cannot be called from plugin. Connection undefined!"),void r(-70410);t.handleActiveWrite(e,r,n)})),this.targetControlService.getCharacteristic(I.Characteristic.ButtonEvent).on("get",(function(e){e(void 0,t.lastButtonEvent)})),this.audioSupported&&(this.audioStreamManagementService.getCharacteristic(I.Characteristic.SelectedAudioStreamConfiguration).on("get",(function(e){e(null,t.selectedAudioConfigurationString)})).on("set",this.handleSelectedAudioConfigurationWrite.bind(this)).updateValue(this.selectedAudioConfigurationString),this.dataStreamManagement.onEventMessage("targetControl","whoami",this.handleTargetControlWhoAmI.bind(this)).onServerEvent("connection-closed",this.handleDataStreamConnectionClosed.bind(this)),this.eventHandler=((e={}).ack=this.handleDataSendAckEvent.bind(this),e.close=this.handleDataSendCloseEvent.bind(this),e))},t.prototype.handleControllerRemoved=function(){var e;this.targetControlManagementService=void 0,this.targetControlService=void 0,this.siriService=void 0,this.audioStreamManagementService=void 0,this.eventHandler=void 0,this.requestHandler=void 0,null===(e=this.dataStreamManagement)||void 0===e||e.destroy(),this.dataStreamManagement=void 0},t.prototype.handleFactoryReset=function(){U("Running factory reset. Resetting targets..."),this.handleResetTargets(void 0),this.lastButtonEvent=""},t.prototype.serialize=function(){if(this.activeIdentifier||0!==Object.keys(this.targetConfigurations).length)return{activeIdentifier:this.activeIdentifier,targetConfigurations:E.__spreadArray([],E.__read(this.targetConfigurations),!1).reduce((function(e,t){var r=E.__read(t,2),i=r[0],n=r[1];return e[i]=n,e}),{})}},t.prototype.deserialize=function(e){this.activeIdentifier=e.activeIdentifier,this.targetConfigurations=Object.entries(e.targetConfigurations).reduce((function(e,t){var r=E.__read(t,2),i=r[0],n=r[1],o=parseInt(i,10);return e.set(o,n),e}),new Map),this.updatedTargetConfiguration()},t.prototype.setupStateChangeDelegate=function(e){this.stateChangeDelegate=e},t}(A.EventEmitter);t.RemoteController=R;var O,N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E.__extends(t,e),t}(R);t.HomeKitRemoteController=N,function(e){e.CLOSE="close"}(O||(t.SiriAudioSessionEvents=O={}));var P=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o.producerRunning=!1,o.state=0,o.endOfStream=!1,o.audioFrameQueue=[],o.maxQueueSize=1024,o.sequenceNumber=0,o.connection=t,o.selectedAudioConfiguration=r,o.producer=new i(o.handleSiriAudioFrame.bind(o),o.handleProducerError.bind(o),n),o.connection.on("closed",o.closeListener=o.handleDataStreamConnectionClosed.bind(o)),o}return E.__extends(t,e),t.prototype.start=function(){var e=this;U("Sending request to start siri audio stream"),this.connection.sendRequest("dataSend","open",{target:"controller",type:"audio.siri"},(function(t,r,i){3!==e.state?(_.default.strictEqual(e.state,0),e.state=1,t||r?(t?U("Error occurred trying to start siri audio stream: %s",t.message):r&&U("Controller responded with non-zero status code: %s",D.HDSStatus[r]),e.closed()):(e.streamId=i.streamId,e.producerRunning?U("Successfully setup siri audio stream with streamId %d",e.streamId):e.sendDataSendCloseEvent(3))):U("Ignoring dataSend open response as the session is already closed")})),this.startAudioProducer()},t.prototype.isClosing=function(){return this.state>=2},t.prototype.stop=function(){(0,_.default)(this.state<=1,"state was higher than SENDING"),U("Stopping siri audio stream with streamId %d",this.streamId),this.endOfStream=!0,this.stopAudioProducer(),1===this.state?(this.handleSiriAudioFrame(void 0),this.state=2):this.closed()},t.prototype.startAudioProducer=function(){var e=this;this.producer.startAudioProduction(this.selectedAudioConfiguration),this.producerRunning=!0,this.producerTimer=setTimeout((function(){U("Didn't receive any frames from audio producer for stream with streamId %s. Canceling the stream now.",e.streamId),e.producerTimer=void 0,e.handleProducerError(3)}),3e3),this.producerTimer.unref()},t.prototype.stopAudioProducer=function(){this.producer.stopAudioProduction(),this.producerRunning=!1,this.producerTimer&&(clearTimeout(this.producerTimer),this.producerTimer=void 0)},t.prototype.handleSiriAudioFrame=function(e){var t=this;if(!(this.state>=2)&&(this.producerTimer&&(clearTimeout(this.producerTimer),this.producerTimer=void 0),e&&this.audioFrameQueue.length=2||(this.stopAudioProducer(),1===this.state&&this.sendDataSendCloseEvent(e))},t.prototype.handleDataSendAckEvent=function(e){_.default.strictEqual(e,!0),U("Received acknowledgment for siri audio stream with streamId %s, closing it now",this.streamId),this.sendDataSendCloseEvent(0)},t.prototype.handleDataSendCloseEvent=function(e){U("Received close event from controller with reason %s for stream with streamId %s",D.HDSProtocolSpecificErrorReason[e],this.streamId),this.state<=1&&this.stopAudioProducer(),this.closed()},t.prototype.sendDataSendCloseEvent=function(e){(0,_.default)(this.state>=1,"state was less than SENDING"),(0,_.default)(this.state<=2,"state was higher than CLOSING"),this.connection.sendEvent("dataSend","close",{streamId:new D.Int64(this.streamId),reason:new D.Int64(e)}),this.closed()},t.prototype.handleDataStreamConnectionClosed=function(){U("Closing audio session with streamId %d",this.streamId),this.state<=1&&this.stopAudioProducer(),this.closed()},t.prototype.closed=function(){var e=this.state;this.state=3,3!==e&&(this.emit("close"),this.connection.removeListener("closed",this.closeListener)),this.removeAllListeners()},t.prototype.popSome=function(){if(this.audioFrameQueue.length<5&&!this.endOfStream)return null;for(var e=Math.min(this.audioFrameQueue.length,5),t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(9414),t),i.__exportStar(r(6864),t),i.__exportStar(r(9352),t),i.__exportStar(r(2405),t),i.__exportStar(r(7959),t)},733:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamManagement=t.DataStreamStatus=void 0;var i,n,o,a,s,c,u,l,h=r(1635),d=h.__importDefault(r(5753)),p=r(9826),f=r(5876),g=h.__importStar(r(3314)),m=r(4097),v=(0,d.default)("HAP-NodeJS:DataStream:Management");!function(e){e[e.TRANSFER_TRANSPORT_CONFIGURATION=1]="TRANSFER_TRANSPORT_CONFIGURATION"}(i||(i={})),function(e){e[e.TRANSPORT_TYPE=1]="TRANSPORT_TYPE"}(n||(n={})),function(e){e[e.SESSION_COMMAND_TYPE=1]="SESSION_COMMAND_TYPE",e[e.TRANSPORT_TYPE=2]="TRANSPORT_TYPE",e[e.CONTROLLER_KEY_SALT=3]="CONTROLLER_KEY_SALT"}(o||(o={})),function(e){e[e.STATUS=1]="STATUS",e[e.TRANSPORT_TYPE_SESSION_PARAMETERS=2]="TRANSPORT_TYPE_SESSION_PARAMETERS",e[e.ACCESSORY_KEY_SALT=3]="ACCESSORY_KEY_SALT"}(a||(a={})),function(e){e[e.TCP_LISTENING_PORT=1]="TCP_LISTENING_PORT"}(s||(s={})),function(e){e[e.HOMEKIT_DATA_STREAM=0]="HOMEKIT_DATA_STREAM"}(c||(c={})),function(e){e[e.START_SESSION=0]="START_SESSION"}(u||(u={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.GENERIC_ERROR=1]="GENERIC_ERROR",e[e.BUSY=2]="BUSY"}(l||(t.DataStreamStatus=l={}));var y=function(){function e(e){this.dataStreamServer=new m.DataStreamServer,this.lastSetupDataStreamTransportResponse="";var t=[c.HOMEKIT_DATA_STREAM];this.supportedDataStreamTransportConfiguration=this.buildSupportedDataStreamTransportConfigurationTLV(t),this.dataStreamTransportManagementService=e||this.constructService(),this.setupServiceHandlers()}return e.prototype.destroy=function(){this.dataStreamServer.destroy(),this.dataStreamTransportManagementService.getCharacteristic(p.Characteristic.SetupDataStreamTransport).removeOnGet().removeAllListeners("set"),this.lastSetupDataStreamTransportResponse=""},e.prototype.getService=function(){return this.dataStreamTransportManagementService},e.prototype.onEventMessage=function(e,t,r){return this.dataStreamServer.onEventMessage(e,t,r),this},e.prototype.removeEventHandler=function(e,t,r){return this.dataStreamServer.removeEventHandler(e,t,r),this},e.prototype.onRequestMessage=function(e,t,r){return this.dataStreamServer.onRequestMessage(e,t,r),this},e.prototype.removeRequestHandler=function(e,t,r){return this.dataStreamServer.removeRequestHandler(e,t,r),this},e.prototype.onServerEvent=function(e,t){return this.dataStreamServer.on(e,t),this},e.prototype.handleSetupDataStreamTransportWrite=function(e,t,r){var i=this,n=Buffer.from(e,"base64"),o=g.decode(n),a=o[1][0],s=o[2][0],l=o[3];v("Received setup write with command %s and transport type %s",u[a],c[s]),a===u.START_SESSION&&s===c.HOMEKIT_DATA_STREAM&&32===l.length?this.dataStreamServer.prepareSession(r,l,(function(e,r){if(!e&&r){var n=g.encode(1,g.writeUInt16(r.port)),o=Buffer.concat([g.encode(1,0),g.encode(2,n)]);i.lastSetupDataStreamTransportResponse=o.toString("base64"),o=Buffer.concat([o,g.encode(3,r.accessoryKeySalt)]),t(null,o.toString("base64"))}else t(null!=e?e:new Error("PreparedSession was undefined!"))})):t(-70410)},e.prototype.buildSupportedDataStreamTransportConfigurationTLV=function(e){var t=[];return e.forEach((function(e){var r=g.encode(1,e),i=g.encode(1,r);t.push(i)})),Buffer.concat(t).toString("base64")},e.prototype.constructService=function(){var e=new f.Service.DataStreamTransportManagement("","");return e.setCharacteristic(p.Characteristic.SupportedDataStreamTransportConfiguration,this.supportedDataStreamTransportConfiguration),e.setCharacteristic(p.Characteristic.Version,m.DataStreamServer.version),e},e.prototype.setupServiceHandlers=function(){var e=this;this.dataStreamTransportManagementService.getCharacteristic(p.Characteristic.SetupDataStreamTransport).onGet((function(){return e.lastSetupDataStreamTransportResponse})).on("set",(function(t,r,i,n){if(!n)return v("Set event handler for SetupDataStreamTransport cannot be called from plugin! Connection undefined!"),void r(-70410);e.handleSetupDataStreamTransportWrite(t,r,n)})).updateValue(this.lastSetupDataStreamTransportResponse)},e}();t.DataStreamManagement=y},7881:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamWriter=t.DataStreamReader=t.DataStreamParser=t.DataFormatTags=t.UUID=t.SecondsSince2001=t.Float64=t.Float32=t.Int64=t.Int32=t.Int16=t.Int8=t.ValueWrapper=void 0;var i=r(1635),n=i.__importStar(r(2997)),o=i.__importStar(r(8)),a=i.__importDefault(r(2613)),s=(0,i.__importDefault(r(5753)).default)("HAP-NodeJS:DataStream:Parser"),c=function(){function e(){}return e.TERMINATOR={type:"terminator"},e}(),u=function(){function e(e){this.value=e}return e.prototype.equals=function(e){return this.constructor.name===e.constructor.name&&e.value===this.value},e}();t.ValueWrapper=u;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int8=l;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int16=h;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int32=d;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Int64=p;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Float32=f;var g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.Float64=g;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(u);t.SecondsSince2001=m;var v,y=function(e){function t(t){return(0,a.default)(n.isValid(t),"invalid uuid format"),e.call(this,t)||this}return i.__extends(t,e),t}(u);t.UUID=y,function(e){e[e.INVALID=0]="INVALID",e[e.TRUE=1]="TRUE",e[e.FALSE=2]="FALSE",e[e.TERMINATOR=3]="TERMINATOR",e[e.NULL=4]="NULL",e[e.UUID=5]="UUID",e[e.DATE=6]="DATE",e[e.INTEGER_MINUS_ONE=7]="INTEGER_MINUS_ONE",e[e.INTEGER_RANGE_START_0=8]="INTEGER_RANGE_START_0",e[e.INTEGER_RANGE_STOP_39=46]="INTEGER_RANGE_STOP_39",e[e.INT8=48]="INT8",e[e.INT16LE=49]="INT16LE",e[e.INT32LE=50]="INT32LE",e[e.INT64LE=51]="INT64LE",e[e.FLOAT32LE=53]="FLOAT32LE",e[e.FLOAT64LE=54]="FLOAT64LE",e[e.UTF8_LENGTH_START=64]="UTF8_LENGTH_START",e[e.UTF8_LENGTH_STOP=96]="UTF8_LENGTH_STOP",e[e.UTF8_LENGTH8=97]="UTF8_LENGTH8",e[e.UTF8_LENGTH16LE=98]="UTF8_LENGTH16LE",e[e.UTF8_LENGTH32LE=99]="UTF8_LENGTH32LE",e[e.UTF8_LENGTH64LE=100]="UTF8_LENGTH64LE",e[e.UTF8_NULL_TERMINATED=111]="UTF8_NULL_TERMINATED",e[e.DATA_LENGTH_START=112]="DATA_LENGTH_START",e[e.DATA_LENGTH_STOP=144]="DATA_LENGTH_STOP",e[e.DATA_LENGTH8=145]="DATA_LENGTH8",e[e.DATA_LENGTH16LE=146]="DATA_LENGTH16LE",e[e.DATA_LENGTH32LE=147]="DATA_LENGTH32LE",e[e.DATA_LENGTH64LE=148]="DATA_LENGTH64LE",e[e.DATA_TERMINATED=159]="DATA_TERMINATED",e[e.COMPRESSION_START=160]="COMPRESSION_START",e[e.COMPRESSION_STOP=207]="COMPRESSION_STOP",e[e.ARRAY_LENGTH_START=208]="ARRAY_LENGTH_START",e[e.ARRAY_LENGTH_STOP=222]="ARRAY_LENGTH_STOP",e[e.ARRAY_TERMINATED=223]="ARRAY_TERMINATED",e[e.DICTIONARY_LENGTH_START=224]="DICTIONARY_LENGTH_START",e[e.DICTIONARY_LENGTH_STOP=238]="DICTIONARY_LENGTH_STOP",e[e.DICTIONARY_TERMINATED=239]="DICTIONARY_TERMINATED"}(v||(t.DataFormatTags=v={}));var C=function(){function e(){}return e.decode=function(e){var t=e.readTag();if(0===t)throw new Error("HDSDecoder: zero tag detected on index "+e.readerIndex);if(1===t)return e.readTrue();if(2===t)return e.readFalse();if(3===t)return c.TERMINATOR;if(4===t)return null;if(5===t)return e.readUUID();if(6===t)return e.readSecondsSince2001_01_01();if(7===t)return e.readNegOne();if(t>=8&&t<=46)return e.readIntRange(t);if(48===t)return e.readInt8();if(49===t)return e.readInt16LE();if(50===t)return e.readInt32LE();if(51===t)return e.readInt64LE();if(53===t)return e.readFloat32LE();if(54===t)return e.readFloat64LE();if(t>=64&&t<=96){var r=t-64;return e.readUTF8(r)}if(97===t)return e.readUTF8_Length8();if(98===t)return e.readUTF8_Length16LE();if(99===t)return e.readUTF8_Length32LE();if(100===t)return e.readUTF8_Length64LE();if(111===t)return e.readUTF8_NULL_terminated();if(!(t>=112&&t<=144)){if(145===t)return e.readData_Length8();if(146===t)return e.readData_Length16LE();if(147===t)return e.readData_Length32LE();if(148===t)return e.readData_Length64LE();if(159===t)return e.readData_terminated();if(t>=160&&t<=207){var i=t-160;return e.decompressData(i)}if(t>=208&&t<=222){r=t-208;for(var n=[],o=0;o=224&&t<=238){r=t-224;var s={};for(o=0;o12&&t.writeTag(3)}else if(e instanceof u)if(e instanceof l)t.writeInt8(e);else if(e instanceof h)t.writeInt16LE(e);else if(e instanceof d)t.writeInt32LE(e);else if(e instanceof p)t.writeInt64LE(e);else if(e instanceof f)t.writeFloat32LE(e);else if(e instanceof g)t.writeFloat64LE(e);else if(e instanceof m)t.writeSecondsSince2001_01_01(e);else{if(!(e instanceof y))throw new Error("Unknown wrapped object 'ValueWrapper' of class "+e.constructor.name);t.writeUUID(e.value)}else if(e instanceof Buffer)t.writeData(e);else{var n=Object.entries(e).filter((function(e){return void 0!==e[1]}));n.length<=14?t.writeTag(224+n.length):t.writeTag(239),n.forEach((function(e){r.encode(e[0],t),r.encode(e[1],t)})),n.length>14&&t.writeTag(3)}break;default:throw new Error("HDSEncoder: no idea how to encode value of type '"+typeof e+"': "+e)}else t.writeTag(4)},e}();t.DataStreamParser=C;var S=function(){function e(e){this.trackedCompressedData=[],this.data=e,this.readerIndex=0}return e.prototype.finished=function(){if(this.readerIndex=this.trackedCompressedData.length)throw new Error("HDSDecoder: Tried decompression of data for an index out of range (index "+e+" and got "+this.trackedCompressedData.length+" elements)");return this.trackedCompressedData[e]},e.prototype.trackData=function(e){return this.trackedCompressedData.push(e),e},e.prototype.ensureLength=function(e){if(this.readerIndex+e>this.data.length){var t=this.data.length-this.readerIndex;throw new Error("HDSDecoder: End of data stream. Tried reading "+e+" bytes however got only "+t+" remaining!")}},e.prototype.readTag=function(){return this.ensureLength(1),this.data.readUInt8(this.readerIndex++)},e.prototype.readTrue=function(){return this.trackData(!0)},e.prototype.readFalse=function(){return this.trackData(!1)},e.prototype.readNegOne=function(){return this.trackData(-1)},e.prototype.readIntRange=function(e){return this.trackData(e-8)},e.prototype.readInt8=function(){return this.ensureLength(1),this.trackData(this.data.readInt8(this.readerIndex++))},e.prototype.readInt16LE=function(){this.ensureLength(2);var e=this.data.readInt16LE(this.readerIndex);return this.readerIndex+=2,this.trackData(e)},e.prototype.readInt32LE=function(){this.ensureLength(4);var e=this.data.readInt32LE(this.readerIndex);return this.readerIndex+=4,this.trackData(e)},e.prototype.readInt64LE=function(){this.ensureLength(8);var e=this.data.readInt32LE(this.readerIndex),t=4294967296*this.data.readInt32LE(this.readerIndex+4)+e;return e<0&&(t+=4294967296),this.readerIndex+=8,this.trackData(t)},e.prototype.readFloat32LE=function(){this.ensureLength(4);var e=this.data.readFloatLE(this.readerIndex);return this.readerIndex+=4,this.trackData(e)},e.prototype.readFloat64LE=function(){this.ensureLength(8);var e=this.data.readDoubleLE(this.readerIndex);return this.trackData(e)},e.prototype.readLength8=function(){return this.ensureLength(1),this.data.readUInt8(this.readerIndex++)},e.prototype.readLength16LE=function(){this.ensureLength(2);var e=this.data.readUInt16LE(this.readerIndex);return this.readerIndex+=2,e},e.prototype.readLength32LE=function(){this.ensureLength(4);var e=this.data.readUInt32LE(this.readerIndex);return this.readerIndex+=4,e},e.prototype.readLength64LE=function(){this.ensureLength(8);var e=this.data.readUInt32LE(this.readerIndex),t=4294967296*this.data.readUInt32LE(this.readerIndex+4)+e;return this.readerIndex+=8,t},e.prototype.readUTF8=function(e){this.ensureLength(e);var t=this.data.toString("utf8",this.readerIndex,this.readerIndex+e);return this.readerIndex+=e,this.trackData(t)},e.prototype.readUTF8_Length8=function(){var e=this.readLength8();return this.readUTF8(e)},e.prototype.readUTF8_Length16LE=function(){var e=this.readLength16LE();return this.readUTF8(e)},e.prototype.readUTF8_Length32LE=function(){var e=this.readLength32LE();return this.readUTF8(e)},e.prototype.readUTF8_Length64LE=function(){var e=this.readLength64LE();return this.readUTF8(e)},e.prototype.readUTF8_NULL_terminated=function(){for(var e,t=this.readerIndex;;){if(void 0===(e=this.data[t]))throw new Error("HDSDecoder: Reached end of data stream while reading NUL terminated string!");if(0===e)break;t++}var r=this.data.toString("utf8",this.readerIndex,t);return this.readerIndex=t+1,this.trackData(r)},e.prototype.readData=function(e){this.ensureLength(e);var t=this.data.slice(this.readerIndex,this.readerIndex+e);return this.readerIndex+=e,this.trackData(t)},e.prototype.readData_Length8=function(){var e=this.readLength8();return this.readData(e)},e.prototype.readData_Length16LE=function(){var e=this.readLength16LE();return this.readData(e)},e.prototype.readData_Length32LE=function(){var e=this.readLength32LE();return this.readData(e)},e.prototype.readData_Length64LE=function(){var e=this.readLength64LE();return this.readData(e)},e.prototype.readData_terminated=function(){for(var e,t=this.readerIndex;;){if(void 0===(e=this.data[t]))throw new Error("HDSDecoder: Reached end of data stream while reading terminated data!");if(3===e)break;t++}var r=this.data.slice(this.readerIndex,t);return this.readerIndex=t+1,this.trackData(r)},e.prototype.readSecondsSince2001_01_01=function(){return this.readFloat64LE()},e.prototype.readUUID=function(){this.ensureLength(16);var e=n.unparse(this.data,this.readerIndex);return this.readerIndex+=16,this.trackData(e)},e}();t.DataStreamReader=S;var E=function(){function e(){this.writtenData=[]}return e.prototype.push=function(e){this.writtenData.push(e)},e.prototype.indexOf=function(e){for(var t=0;t0){var i=Math.ceil(r/e.chunkSize);this.data=Buffer.concat([this.data,Buffer.alloc(i*e.chunkSize)])}},e.prototype.compressDataIfPossible=function(e){var t=this.writtenData.indexOf(e);return t<0?(this.writtenData.push(e),!1):t<=47&&(this.writeTag(160+t),!0)},e.prototype.writeTag=function(e){this.ensureLength(1),this.data.writeUInt8(e,this.writerIndex++)},e.prototype.writeTrue=function(){this.writeTag(1)},e.prototype.writeFalse=function(){this.writeTag(2)},e.prototype.writeNumber=function(e){if(-1===e)this.writeTag(7);else if(e>=0&&e<=39)this.writeTag(8+e);else if(e>=-128&&e<=127)this.writeInt8(new l(e));else if(e>=-32768&&e<=32767)this.writeInt16LE(new h(e));else if(e>=-2147483648&&e<=-2147483648)this.writeInt32LE(new d(e));else{if(!(e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER))throw new Error("Tried writing unrepresentable number ("+e+")");this.writeInt64LE(new p(e))}},e.prototype.writeInt8=function(e){this.compressDataIfPossible(e)||(this.ensureLength(2),this.writeTag(48),this.data.writeInt8(e.value,this.writerIndex++))},e.prototype.writeInt16LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(3),this.writeTag(49),this.data.writeInt16LE(e.value,this.writerIndex),this.writerIndex+=2)},e.prototype.writeInt32LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(5),this.writeTag(50),this.data.writeInt32LE(e.value,this.writerIndex),this.writerIndex+=4)},e.prototype.writeInt64LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(9),this.writeTag(51),this.data.writeUInt32LE(e.value,this.writerIndex),this.data.writeUInt32LE(0,this.writerIndex+4),this.writerIndex+=8)},e.prototype.writeFloat32LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(5),this.writeTag(53),this.data.writeFloatLE(e.value,this.writerIndex),this.writerIndex+=4)},e.prototype.writeFloat64LE=function(e){this.compressDataIfPossible(e)||(this.ensureLength(9),this.writeTag(54),this.data.writeDoubleLE(e.value,this.writerIndex),this.writerIndex+=8)},e.prototype.writeLength8=function(e){this.ensureLength(1),this.data.writeUInt8(e,this.writerIndex++)},e.prototype.writeLength16LE=function(e){this.ensureLength(2),this.data.writeUInt16LE(e,this.writerIndex),this.writerIndex+=2},e.prototype.writeLength32LE=function(e){this.ensureLength(4),this.data.writeUInt32LE(e,this.writerIndex),this.writerIndex+=4},e.prototype.writeLength64LE=function(e){this.ensureLength(8),o.writeUInt64LE(e,this.data,this.writerIndex),this.writerIndex+=8},e.prototype.writeUTF8=function(e){if(!this.compressDataIfPossible(e)){var t=Buffer.byteLength(e);t<=32?(this.ensureLength(1+t),this.writeTag(64+e.length),this._writeUTF8(e)):t<=255?this.writeUTF8_Length8(e):t<=65535?this.writeUTF8_Length16LE(e):t<=4294967295?this.writeUTF8_Length32LE(e):t<=Number.MAX_SAFE_INTEGER?this.writeUTF8_Length64LE(e):this.writeUTF8_NULL_terminated(e)}},e.prototype._writeUTF8=function(e){var t=Buffer.byteLength(e);this.ensureLength(t),this.data.write(e,this.writerIndex,t,"utf8"),this.writerIndex+=t},e.prototype.writeUTF8_Length8=function(e){var t=Buffer.byteLength(e);this.ensureLength(2+t),this.writeTag(97),this.writeLength8(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length16LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(3+t),this.writeTag(98),this.writeLength16LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length32LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(5+t),this.writeTag(99),this.writeLength32LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_Length64LE=function(e){var t=Buffer.byteLength(e);this.ensureLength(9+t),this.writeTag(100),this.writeLength64LE(t),this._writeUTF8(e)},e.prototype.writeUTF8_NULL_terminated=function(e){this.ensureLength(1+Buffer.byteLength(e)+1),this.writeTag(111),this._writeUTF8(e),this.data.writeUInt8(0,this.writerIndex++)},e.prototype.writeData=function(e){this.compressDataIfPossible(e)||(e.length<=32?(this.writeTag(112+e.length),this._writeData(e)):e.length<=255?this.writeData_Length8(e):e.length<=65535?this.writeData_Length16LE(e):e.length<=4294967295?this.writeData_Length32LE(e):e.length<=Number.MAX_SAFE_INTEGER?this.writeData_Length64LE(e):this.writeData_terminated(e))},e.prototype._writeData=function(e){this.ensureLength(e.length);for(var t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataStreamConnection=t.HDSConnectionError=t.HDSConnectionErrorType=t.DataStreamConnectionEvent=t.DataStreamServer=t.DataStreamServerEvent=t.MessageType=t.HDSProtocolError=t.HDSProtocolSpecificErrorReason=t.HDSStatus=t.Topics=t.Protocols=void 0;var i,n,o,a,s=r(1635),c=s.__importDefault(r(2613)),u=s.__importDefault(r(6982)),l=s.__importDefault(r(5753)),h=r(4434),d=s.__importDefault(r(9278)),p=s.__importStar(r(8)),f=r(7881),g=(0,l.default)("HAP-NodeJS:DataStream:Server");!function(e){e.CONTROL="control",e.TARGET_CONTROL="targetControl",e.DATA_SEND="dataSend"}(i||(t.Protocols=i={})),function(e){e.HELLO="hello",e.WHOAMI="whoami",e.OPEN="open",e.DATA="data",e.ACK="ack",e.CLOSE="close"}(n||(t.Topics=n={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.OUT_OF_MEMORY=1]="OUT_OF_MEMORY",e[e.TIMEOUT=2]="TIMEOUT",e[e.HEADER_ERROR=3]="HEADER_ERROR",e[e.PAYLOAD_ERROR=4]="PAYLOAD_ERROR",e[e.MISSING_PROTOCOL=5]="MISSING_PROTOCOL",e[e.PROTOCOL_SPECIFIC_ERROR=6]="PROTOCOL_SPECIFIC_ERROR"}(o||(t.HDSStatus=o={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.NOT_ALLOWED=1]="NOT_ALLOWED",e[e.BUSY=2]="BUSY",e[e.CANCELLED=3]="CANCELLED",e[e.UNSUPPORTED=4]="UNSUPPORTED",e[e.UNEXPECTED_FAILURE=5]="UNEXPECTED_FAILURE",e[e.TIMEOUT=6]="TIMEOUT",e[e.BAD_DATA=7]="BAD_DATA",e[e.PROTOCOL_ERROR=8]="PROTOCOL_ERROR",e[e.INVALID_CONFIGURATION=9]="INVALID_CONFIGURATION"}(a||(t.HDSProtocolSpecificErrorReason=a={}));var m,v,y,C,S=function(e){function t(t){var r=e.call(this,"HDSProtocolError: "+t)||this;return(0,c.default)(0!==t,"Cannot initialize a HDSProtocolError with NORMAL!"),r.reason=t,r}return s.__extends(t,e),t}(Error);t.HDSProtocolError=S,function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.BINDING=1]="BINDING",e[e.LISTENING=2]="LISTENING",e[e.CLOSING=3]="CLOSING"}(m||(m={})),function(e){e[e.UNIDENTIFIED=0]="UNIDENTIFIED",e[e.EXPECTING_HELLO=1]="EXPECTING_HELLO",e[e.READY=2]="READY",e[e.CLOSING=3]="CLOSING",e[e.CLOSED=4]="CLOSED"}(v||(v={})),function(e){e[e.EVENT=1]="EVENT",e[e.REQUEST=2]="REQUEST",e[e.RESPONSE=3]="RESPONSE"}(y||(t.MessageType=y={})),function(e){e.CONNECTION_OPENED="connection-opened",e.CONNECTION_CLOSED="connection-closed"}(C||(t.DataStreamServerEvent=C={}));var E,_,T=function(e){function t(){var t=e.call(this)||this;return t.state=0,t.preparedSessions=[],t.connections=[],t.removeListenersOnceClosed=!1,t.internalEventEmitter=new h.EventEmitter,t}return s.__extends(t,e),t.prototype.onEventMessage=function(e,t,r){return this.internalEventEmitter.on(e+"-e-"+t,r),this},t.prototype.removeEventHandler=function(e,t,r){return this.internalEventEmitter.removeListener(e+"-e-"+t,r),this},t.prototype.onRequestMessage=function(e,t,r){return this.internalEventEmitter.on(e+"-r-"+t,r),this},t.prototype.removeRequestHandler=function(e,t,r){return this.internalEventEmitter.removeListener(e+"-r-"+t,r),this},t.prototype.prepareSession=function(e,r,i){var n=this;g("Preparing for incoming HDS connection from %s",e.sessionID);var o=u.default.randomBytes(32),a=Buffer.concat([r,o]),s={connection:e,accessoryToControllerEncryptionKey:p.HKDF("sha512",a,e.encryption.sharedSecret,t.accessoryToControllerInfo,32),controllerToAccessoryEncryptionKey:p.HKDF("sha512",a,e.encryption.sharedSecret,t.controllerToAccessoryInfo,32),accessoryKeySalt:o,connectTimeout:setTimeout((function(){return n.timeoutPreparedSession(s)}),1e4)};s.connectTimeout.unref(),this.preparedSessions.push(s),this.checkTCPServerEstablished(s,(function(e){e?i(e):i(void 0,s)}))},t.prototype.timeoutPreparedSession=function(e){g("Prepared HDS session timed out out since no connection was opened for 10 seconds (%s)",e.connection.sessionID);var t=this.preparedSessions.indexOf(e);t>=0&&this.preparedSessions.splice(t,1),this.checkCloseable()},t.prototype.checkTCPServerEstablished=function(e,t){var r=this;switch(this.state){case 0:g("Starting up TCP server."),this.tcpServer=d.default.createServer(),this.tcpServer.once("listening",this.listening.bind(this,e,t)),this.tcpServer.on("connection",this.onConnection.bind(this)),this.tcpServer.on("close",this.closed.bind(this)),this.tcpServer.listen(),this.state=1;break;case 1:g("TCP server already running. Waiting for it to bind."),this.tcpServer.once("listening",this.listening.bind(this,e,t));break;case 2:g("Instructing client to connect to already running TCP server"),e.port=this.tcpPort,t();break;case 3:g("TCP socket is currently closing. Trying again when server is fully closed and opening a new one then."),this.tcpServer.once("close",(function(){return setTimeout((function(){return r.checkTCPServerEstablished(e,t)}),10)}))}},t.prototype.listening=function(e,t){this.state=2;var r=this.tcpServer.address();r&&"string"!=typeof r&&(this.tcpPort=r.port,e.port=r.port,g("TCP server is now listening for new data stream connections on port %s",r.port),t())},t.prototype.onConnection=function(e){g("[%s] New DataStream connection was established",e.remoteAddress);var t=new I(e);t.on("identification",this.handleSessionIdentification.bind(this,t)),t.on("handle-message-globally",this.handleMessageGlobally.bind(this,t)),t.on("closed",this.connectionClosed.bind(this,t)),this.connections.push(t),this.emit("connection-opened",t)},t.prototype.handleSessionIdentification=function(e,t,r){for(var i=void 0,n=0;n=0&&this.preparedSessions.splice(a,1),clearTimeout(i.connectTimeout),i.connectTimeout=void 0}else g("[%s] Could not identify connection. Terminating.",e.remoteAddress),e.close()},t.prototype.handleMessageGlobally=function(e,t){var r;c.default.notStrictEqual(t.type,3);var i,n="",o=[];1===t.type?n="-e-":2===t.type&&(n="-r-",o.push(t.id)),o.push(t.message);try{i=(r=this.internalEventEmitter).emit.apply(r,s.__spreadArray([t.protocol+n+t.topic,e],s.__read(o),!1))}catch(r){i=!0,g("[%s] Error occurred while dispatching handler for HDS message: %o",e.remoteAddress,t),g(r.stack)}i||g("[%s] WARNING no handler was found for message: %o",e.remoteAddress,t)},t.prototype.connectionClosed=function(e){g("[%s] DataStream connection closed",e.remoteAddress),this.connections.splice(this.connections.indexOf(e),1),this.emit("connection-closed",e),this.checkCloseable(),3===this.state&&this.removeListenersOnceClosed&&0===this.connections.length&&this.removeAllListeners()},t.prototype.checkCloseable=function(){0===this.connections.length&&0===this.preparedSessions.length&&this.state<3&&(g("Last connection disconnected. Closing the server now."),this.state=3,this.tcpServer.close())},t.prototype.destroy=function(){var e,t;if(this.state>0&&this.state<3){this.tcpServer.close();try{for(var r=s.__values(this.connections),i=r.next();!i.done;i=r.next()){i.value.close()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}}this.state=3,this.removeListenersOnceClosed=!0,this.internalEventEmitter.removeAllListeners()},t.prototype.closed=function(){this.tcpServer=void 0,this.tcpPort=void 0,this.state=0},t.version="1.0",t.accessoryToControllerInfo=Buffer.from("HDS-Read-Encryption-Key"),t.controllerToAccessoryInfo=Buffer.from("HDS-Write-Encryption-Key"),t}(h.EventEmitter);t.DataStreamServer=T,function(e){e.IDENTIFICATION="identification",e.HANDLE_MESSAGE_GLOBALLY="handle-message-globally",e.CLOSED="closed"}(E||(t.DataStreamConnectionEvent=E={})),function(e){e[e.ILLEGAL_STATE=1]="ILLEGAL_STATE",e[e.CLOSED_SOCKET=2]="CLOSED_SOCKET",e[e.MAX_PAYLOAD_LENGTH=3]="MAX_PAYLOAD_LENGTH"}(_||(t.HDSConnectionErrorType=_={}));var A=function(e){function t(t,r){var i=e.call(this,t)||this;return i.type=r,i}return s.__extends(t,e),t}(Error);t.HDSConnectionError=A;var I=function(e){function t(t){var r,i=e.call(this)||this;return i.state=0,i.protocolHandlers={},i.responseHandlers={},i.responseTimers={},i.socket=t,i.remoteAddress=t.remoteAddress,i.socket.setNoDelay(!0),i.socket.setKeepAlive(!0),i.accessoryToControllerNonce=0,i.accessoryToControllerNonceBuffer=Buffer.alloc(8),i.controllerToAccessoryNonce=0,i.controllerToAccessoryNonceBuffer=Buffer.alloc(8),i.hapConnectionClosedListener=i.onHAPSessionClosed.bind(i),i.addProtocolHandler("control",{requestHandler:(r={},r.hello=i.handleHello.bind(i),r)}),i.helloTimer=setTimeout((function(){g("[%s] Hello message did not arrive in time. Killing the connection",i.remoteAddress),i.close()}),1e4),i.socket.on("data",i.onSocketData.bind(i)),i.socket.on("error",i.onSocketError.bind(i)),i.socket.on("close",i.onSocketClose.bind(i)),i.setMaxListeners(100),i}return s.__extends(t,e),t.prototype.handleHello=function(e,t){g("[%s] Received hello message from client: %o",this.remoteAddress,t),clearTimeout(this.helloTimer),this.helloTimer=void 0,this.state=2,this.sendResponse("control","hello",e)},t.prototype.addProtocolHandler=function(e,t){return void 0===this.protocolHandlers[e]&&(this.protocolHandlers[e]=t,!0)},t.prototype.removeProtocolHandler=function(e,t){this.protocolHandlers[e]===t&&delete this.protocolHandlers[e]},t.prototype.sendEvent=function(e,t,r){void 0===r&&(r={});var i={};i.protocol=e,i.event=t,this.sendHDSFrame(i,r)},t.prototype.sendRequest=function(e,t,r,i){var n,o=this;void 0===r&&(r={});do{n=Math.floor(4294967295*Math.random())}while(void 0!==this.responseHandlers[n]);this.responseHandlers[n]=i,this.responseTimers[n]=setTimeout((function(){o.close();var e=o.responseHandlers[n];delete o.responseHandlers[n],delete o.responseTimers[n],e(new Error("timeout"),void 0,{})}),1e4);var a={};a.protocol=e,a.request=t,a.id=new f.Int64(n),this.sendHDSFrame(a,r)},t.prototype.sendResponse=function(e,t,r,i,n){void 0===i&&(i=o.SUCCESS),void 0===n&&(n={});var a={};a.protocol=e,a.response=t,a.id=new f.Int64(r),a.status=new f.Int64(i),this.sendHDSFrame(a,n)},t.prototype.onSocketData=function(e){var t=this;if(!(this.state>=3)){var r=0,i=this.decodeHDSFrames(e);if(0!==i.length){if(0===this.state){var n=i[r++];if(this.emit("identification",n,(function(e){e&&(t.connection=e.connection,t.accessoryToControllerEncryptionKey=e.accessoryToControllerEncryptionKey,t.controllerToAccessoryEncryptionKey=e.controllerToAccessoryEncryptionKey,t.state=1,t.connection.setMaxListeners(t.connection.getMaxListeners()+1),t.connection.on("closed",t.hapConnectionClosedListener),g("[%s] Registering CLOSED handler to HAP connection. Connection currently has %d close handlers!",t.remoteAddress,t.connection.listeners("closed").length))})),0===this.state)return}for(;rr){this.frameBuffer=e.slice(n);break}var o=e.readUInt8(n),a=e.readUIntBE(n+1,3);if(a>t.MAX_PAYLOAD_LENGTH)return g("[%s] Connection send payload with size bigger than the maximum allow for data stream",this.remoteAddress),this.close(),[];if(a+16>r-n-4){this.frameBuffer=e.slice(n);break}var s=n+4,c=s+a,u=e.slice(n,s),l=e.slice(s,c),h=Buffer.alloc(a),d=e.slice(c,c+16);if(n=c+16,1===o){var p={header:u,cipheredPayload:l,authTag:d};i.push(p)}else g("[%s] Encountered unknown payload type %d for payload: %s",this.remoteAddress,h.toString("hex"))}return i},t.prototype.decryptHDSFrame=function(e,t){p.writeUInt64LE(this.controllerToAccessoryNonce,this.controllerToAccessoryNonceBuffer,0);var r=t||this.controllerToAccessoryEncryptionKey;try{return e.plaintextPayload=p.chacha20_poly1305_decryptAndVerify(r,this.controllerToAccessoryNonceBuffer,e.header,e.cipheredPayload,e.authTag),this.controllerToAccessoryNonce++,!0}catch(e){return!1}},t.prototype.decodePayloads=function(e){var t=this,r=[];return e.forEach((function(e){var i=e.plaintextPayload;if(!i)throw new A("Reached illegal state. Encountered HDSFrame with wasn't decrypted yet!",1);var n,o,a,s=i.readUInt8(0),c=i.length-s-1,u=1+s,l=new f.DataStreamReader(i.slice(1,1+s)),h=new f.DataStreamReader(i.slice(u,u+c));try{n=f.DataStreamParser.decode(l),l.finished()}catch(e){return void g("[%s] Failed to decode header payload: %s",t.remoteAddress,e.message)}try{o=f.DataStreamParser.decode(h),h.finished()}catch(e){return void g("[%s] Failed to decode message payload: %s (header: %o)",t.remoteAddress,e.message,n)}var d,p=n.protocol,m=void 0,v=void 0;if(void 0!==n.event)a=1,d=n.event;else if(void 0!==n.request)a=2,d=n.request,m=n.id;else{if(void 0===n.response)return void g("[%s] Encountered unknown payload header format: %o (message: %o)",t.remoteAddress,n,o);a=3,d=n.response,m=n.id,v=n.status}var y={type:a,protocol:p,topic:d,id:m,status:v,message:o};r.push(y)})),r},t.prototype.sendHDSFrame=function(e,r){if(this.state>=3)throw new A("Cannot send message on closing/closed socket!",2);var i=new f.DataStreamWriter,n=new f.DataStreamWriter;f.DataStreamParser.encode(e,i),f.DataStreamParser.encode(r,n);var o=Buffer.alloc(1);o.writeUInt8(i.length(),0);var a=Buffer.concat([o,i.getData(),n.getData()]);if(a.length>t.MAX_PAYLOAD_LENGTH)throw new A("Tried sending payload with length larger than the maximum allowed for data stream",3);var s=Buffer.alloc(1);s.writeUInt8(1,0);var c=Buffer.alloc(4);c.writeUInt32BE(a.length,0),c=c.slice(1,4);var u=Buffer.concat([s,c]);p.writeUInt64LE(this.accessoryToControllerNonce++,this.accessoryToControllerNonceBuffer);var l=p.chacha20_poly1305_encryptAndSeal(this.accessoryToControllerEncryptionKey,this.accessoryToControllerNonceBuffer,u,a);this.socket.write(Buffer.concat([u,l.ciphertext,l.authTag]))},t.prototype.close=function(){this.state>=3||(this.state=3,this.socket.end())},t.prototype.isConsideredClosed=function(){return this.state>=3},t.prototype.onHAPSessionClosed=function(){g("[%s] HAP connection disconnected. Also closing DataStream connection now.",this.remoteAddress),this.close()},t.prototype.onSocketError=function(e){g("[%s] Encountered socket error: %s",this.remoteAddress,e.message)},t.prototype.onSocketClose=function(){var e,t;this.state=4,this.emit("closed"),null===(e=this.connection)||void 0===e||e.removeListener("closed",this.hapConnectionClosedListener),null===(t=this.connection)||void 0===t||t.setMaxListeners(this.connection.getMaxListeners()-1),this.removeAllListeners()},t.MAX_PAYLOAD_LENGTH=1048575,t}(h.EventEmitter);t.DataStreamConnection=I},9948:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(733),t),i.__exportStar(r(4097),t),i.__exportStar(r(7881),t)},651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CurrentMediaState=t.CurrentHumidifierDehumidifierState=t.CurrentHorizontalTiltAngle=t.CurrentHeatingCoolingState=t.CurrentHeaterCoolerState=t.CurrentFanState=t.CurrentDoorState=t.CurrentAmbientLightLevel=t.CurrentAirPurifierState=t.CryptoHash=t.CoolingThresholdTemperature=t.ContactSensorState=t.ConfiguredName=t.ConfigureBridgedAccessoryStatus=t.ConfigureBridgedAccessory=t.ConfigurationState=t.ColorTemperature=t.ClosedCaptions=t.ChargingState=t.CharacteristicValueTransitionControl=t.CharacteristicValueActiveTransitionCount=t.CCASignalDetectThreshold=t.CCAEnergyDetectThreshold=t.Category=t.CarbonMonoxidePeakLevel=t.CarbonMonoxideLevel=t.CarbonMonoxideDetected=t.CarbonDioxidePeakLevel=t.CarbonDioxideLevel=t.CarbonDioxideDetected=t.CameraOperatingModeIndicator=t.ButtonEvent=t.Brightness=t.BatteryLevel=t.AudioFeedback=t.AssetUpdateReadiness=t.AppMatchingIdentifier=t.AirQuality=t.AirPlayEnable=t.AirParticulateSize=t.AirParticulateDensity=t.AdministratorOnlyAccess=t.ActivityInterval=t.ActiveIdentifier=t.Active=t.AccessoryIdentifier=t.AccessoryFlags=t.AccessControlLevel=t.AccessCodeSupportedConfiguration=t.AccessCodeControlPoint=void 0,t.Logs=t.LockTargetState=t.LockPhysicalControls=t.LockManagementAutoSecurityTimeout=t.LockLastKnownAction=t.LockCurrentState=t.LockControlPoint=t.ListPairings=t.LinkQuality=t.LeakDetected=t.IsConfigured=t.InUse=t.InputSourceType=t.InputDeviceType=t.ImageRotation=t.ImageMirroring=t.Identify=t.Identifier=t.Hue=t.HomeKitCameraActive=t.HoldPosition=t.HeatingThresholdTemperature=t.HeartBeat=t.HardwareRevision=t.HardwareFinish=t.FirmwareUpdateStatus=t.FirmwareUpdateReadiness=t.FirmwareRevision=t.FilterLifeLevel=t.FilterChangeIndication=t.EventTransmissionCounters=t.EventSnapshotsActive=t.EventRetransmissionMaximum=t.DisplayOrder=t.DiscoveredBridgedAccessories=t.DiscoverBridgedAccessories=t.DigitalZoom=t.DiagonalFieldOfView=t.DayoftheWeek=t.DataStreamHAPTransportInterrupt=t.DataStreamHAPTransport=t.CurrentVisibilityState=t.CurrentVerticalTiltAngle=t.CurrentTransport=t.CurrentTime=t.CurrentTiltAngle=t.CurrentTemperature=t.CurrentSlatState=t.CurrentRelativeHumidity=t.CurrentPosition=void 0,t.RelayState=t.RelayEnabled=t.RelayControlPoint=t.RelativeHumidityHumidifierThreshold=t.RelativeHumidityDehumidifierThreshold=t.RecordingAudioActive=t.ReceiverSensitivity=t.ReceivedSignalStrengthIndication=t.Reachable=t.ProgramMode=t.ProgrammableSwitchOutputState=t.ProgrammableSwitchEvent=t.ProductData=t.PowerModeSelection=t.PositionState=t.PM2_5Density=t.PM10Density=t.Ping=t.PictureMode=t.PeriodicSnapshotsActive=t.PasswordSetting=t.PairVerify=t.PairSetup=t.PairingFeatures=t.OzoneDensity=t.OutletInUse=t.OpticalZoom=t.OperatingStateResponse=t.On=t.OccupancyDetected=t.ObstructionDetected=t.NitrogenDioxideDensity=t.NightVision=t.NFCAccessSupportedConfiguration=t.NFCAccessControlPoint=t.NetworkClientStatusControl=t.NetworkClientProfileControl=t.NetworkAccessViolationControl=t.Name=t.Mute=t.MultifunctionButton=t.MotionDetected=t.Model=t.MetricsBufferFullState=t.MaximumTransmitPower=t.Manufacturer=t.ManuallyDisabled=t.ManagedNetworkEnable=t.MACTransmissionCounters=t.MACRetransmissionMaximum=void 0,t.SupportedDiagnosticsModes=t.SupportedDataStreamTransportConfiguration=t.SupportedCharacteristicValueTransitionConfiguration=t.SupportedCameraRecordingConfiguration=t.SupportedAudioStreamConfiguration=t.SupportedAudioRecordingConfiguration=t.SupportedAssetTypes=t.SulphurDioxideDensity=t.StreamingStatus=t.StatusTampered=t.StatusLowBattery=t.StatusJammed=t.StatusFault=t.StatusActive=t.StagedFirmwareVersion=t.SoftwareRevision=t.SmokeDetected=t.SleepInterval=t.SleepDiscoveryMode=t.SlatType=t.SiriTouchToUse=t.SiriListening=t.SiriLightOnUse=t.SiriInputType=t.SiriEngineVersion=t.SiriEndpointSessionStatus=t.SiriEnable=t.SignalToNoiseRatio=t.SetupTransferTransport=t.SetupEndpoints=t.SetupDataStreamTransport=t.SetDuration=t.ServiceLabelNamespace=t.ServiceLabelIndex=t.SerialNumber=t.SelectedSleepConfiguration=t.SelectedRTPStreamConfiguration=t.SelectedDiagnosticsModes=t.SelectedCameraRecordingConfiguration=t.SelectedAudioStreamConfiguration=t.SecuritySystemTargetState=t.SecuritySystemCurrentState=t.SecuritySystemAlarmType=t.Saturation=t.RouterStatus=t.RotationSpeed=t.RotationDirection=t.ResetFilterIndication=t.RemoteKey=t.RemainingDuration=void 0,t.WakeConfiguration=t.VolumeSelector=t.VolumeControlType=t.Volume=t.VOCDensity=t.VideoAnalysisActive=t.Version=t.ValveType=t.TunneledAccessoryStateNumber=t.TunneledAccessoryConnected=t.TunneledAccessoryAdvertising=t.TunnelConnectionTimeout=t.TransmitPower=t.Token=t.TimeUpdate=t.ThreadStatus=t.ThreadOpenThreadVersion=t.ThreadNodeCapabilities=t.ThreadControlPoint=t.ThirdPartyCameraActive=t.TemperatureDisplayUnits=t.TargetVisibilityState=t.TargetVerticalTiltAngle=t.TargetTiltAngle=t.TargetTemperature=t.TargetSlatState=t.TargetRelativeHumidity=t.TargetPosition=t.TargetMediaState=t.TargetHumidifierDehumidifierState=t.TargetHorizontalTiltAngle=t.TargetHeatingCoolingState=t.TargetHeaterCoolerState=t.TargetFanState=t.TargetDoorState=t.TargetControlSupportedConfiguration=t.TargetControlList=t.TargetAirQuality=t.TargetAirPurifierState=t.TapType=t.SwingMode=t.SupportedVideoStreamConfiguration=t.SupportedVideoRecordingConfiguration=t.SupportedTransferTransportConfiguration=t.SupportedSleepConfiguration=t.SupportedRTPConfiguration=t.SupportedRouterConfiguration=t.SupportedMetrics=t.SupportedFirmwareUpdateConfiguration=t.SupportedDiagnosticsSnapshot=void 0,t.WiFiSatelliteStatus=t.WiFiConfigurationControl=t.WiFiCapabilities=t.WaterLevel=t.WANStatusList=t.WANConfigurationList=void 0;var i=r(1635),n=r(9826),o=function(e){function t(){var r=e.call(this,"Access Code Control Point",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000262-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessCodeControlPoint=o,n.Characteristic.AccessCodeControlPoint=o;var a=function(e){function t(){var r=e.call(this,"Access Code Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000261-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessCodeSupportedConfiguration=a,n.Characteristic.AccessCodeSupportedConfiguration=a;var s=function(e){function t(){var r=e.call(this,"Access Control Level",t.UUID,{format:"uint16",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessControlLevel=s,n.Characteristic.AccessControlLevel=s;var c=function(e){function t(){var r=e.call(this,"Accessory Flags",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A6-0000-1000-8000-0026BB765291",t.REQUIRES_ADDITIONAL_SETUP_BIT_MASK=1,t}(n.Characteristic);t.AccessoryFlags=c,n.Characteristic.AccessoryFlags=c;var u=function(e){function t(){var r=e.call(this,"Accessory Identifier",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000057-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AccessoryIdentifier=u,n.Characteristic.AccessoryIdentifier=u;var l=function(e){function t(){var r=e.call(this,"Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B0-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.ACTIVE=1,t}(n.Characteristic);t.Active=l,n.Characteristic.Active=l;var h=function(e){function t(){var r=e.call(this,"Active Identifier",t.UUID,{format:"uint32",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E7-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ActiveIdentifier=h,n.Characteristic.ActiveIdentifier=h;var d=function(e){function t(){var r=e.call(this,"Activity Interval",t.UUID,{format:"uint32",perms:["ev","pr"],minValue:0,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ActivityInterval=d,n.Characteristic.ActivityInterval=d;var p=function(e){function t(){var r=e.call(this,"Administrator Only Access",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000001-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AdministratorOnlyAccess=p,n.Characteristic.AdministratorOnlyAccess=p;var f=function(e){function t(){var r=e.call(this,"Air Particulate Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000064-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AirParticulateDensity=f,n.Characteristic.AirParticulateDensity=f;var g=function(e){function t(){var r=e.call(this,"Air Particulate Size",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000065-0000-1000-8000-0026BB765291",t._2_5_M=0,t._10_M=1,t}(n.Characteristic);t.AirParticulateSize=g,n.Characteristic.AirParticulateSize=g;var m=function(e){function t(){var r=e.call(this,"AirPlay Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000025B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AirPlayEnable=m,n.Characteristic.AirPlayEnable=m;var v=function(e){function t(){var r=e.call(this,"Air Quality",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1,validValues:[0,1,2,3,4,5]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000095-0000-1000-8000-0026BB765291",t.UNKNOWN=0,t.EXCELLENT=1,t.GOOD=2,t.FAIR=3,t.INFERIOR=4,t.POOR=5,t}(n.Characteristic);t.AirQuality=v,n.Characteristic.AirQuality=v;var y=function(e){function t(){var r=e.call(this,"App Matching Identifier",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AppMatchingIdentifier=y,n.Characteristic.AppMatchingIdentifier=y;var C=function(e){function t(){var r=e.call(this,"Asset Update Readiness",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000269-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AssetUpdateReadiness=C,n.Characteristic.AssetUpdateReadiness=C;var S=function(e){function t(){var r=e.call(this,"Audio Feedback",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000005-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.AudioFeedback=S,n.Characteristic.AudioFeedback=S;var E=function(e){function t(){var r=e.call(this,"Battery Level",t.UUID,{format:"uint8",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000068-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.BatteryLevel=E,n.Characteristic.BatteryLevel=E;var _=function(e){function t(){var r=e.call(this,"Brightness",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000008-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Brightness=_,n.Characteristic.Brightness=_;var T=function(e){function t(){var r=e.call(this,"Button Event",t.UUID,{format:"tlv8",perms:["ev","pr"],adminOnlyAccess:[2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000126-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ButtonEvent=T,n.Characteristic.ButtonEvent=T;var A=function(e){function t(){var r=e.call(this,"Camera Operating Mode Indicator",t.UUID,{format:"bool",perms:["ev","pr","pw","tw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021D-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.CameraOperatingModeIndicator=A,n.Characteristic.CameraOperatingModeIndicator=A;var I=function(e){function t(){var r=e.call(this,"Carbon Dioxide Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000092-0000-1000-8000-0026BB765291",t.CO2_LEVELS_NORMAL=0,t.CO2_LEVELS_ABNORMAL=1,t}(n.Characteristic);t.CarbonDioxideDetected=I,n.Characteristic.CarbonDioxideDetected=I;var D=function(e){function t(){var r=e.call(this,"Carbon Dioxide Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000093-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonDioxideLevel=D,n.Characteristic.CarbonDioxideLevel=D;var w=function(e){function t(){var r=e.call(this,"Carbon Dioxide Peak Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000094-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonDioxidePeakLevel=w,n.Characteristic.CarbonDioxidePeakLevel=w;var b=function(e){function t(){var r=e.call(this,"Carbon Monoxide Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000069-0000-1000-8000-0026BB765291",t.CO_LEVELS_NORMAL=0,t.CO_LEVELS_ABNORMAL=1,t}(n.Characteristic);t.CarbonMonoxideDetected=b,n.Characteristic.CarbonMonoxideDetected=b;var U=function(e){function t(){var r=e.call(this,"Carbon Monoxide Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000090-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonMonoxideLevel=U,n.Characteristic.CarbonMonoxideLevel=U;var R=function(e){function t(){var r=e.call(this,"Carbon Monoxide Peak Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000091-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CarbonMonoxidePeakLevel=R,n.Characteristic.CarbonMonoxidePeakLevel=R;var O=function(e){function t(){var r=e.call(this,"Category",t.UUID,{format:"uint16",perms:["ev","pr"],minValue:1,maxValue:16})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Category=O,n.Characteristic.Category=O;var N=function(e){function t(){var r=e.call(this,"CCA Energy Detect Threshold",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000246-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CCAEnergyDetectThreshold=N,n.Characteristic.CCAEnergyDetectThreshold=N;var P=function(e){function t(){var r=e.call(this,"CCA Signal Detect Threshold",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000245-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CCASignalDetectThreshold=P,n.Characteristic.CCASignalDetectThreshold=P;var B=function(e){function t(){var r=e.call(this,"Characteristic Value Active Transition Count",t.UUID,{format:"uint8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CharacteristicValueActiveTransitionCount=B,n.Characteristic.CharacteristicValueActiveTransitionCount=B;var L=function(e){function t(){var r=e.call(this,"Characteristic Value Transition Control",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000143-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CharacteristicValueTransitionControl=L,n.Characteristic.CharacteristicValueTransitionControl=L;var x=function(e){function t(){var r=e.call(this,"Charging State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000008F-0000-1000-8000-0026BB765291",t.NOT_CHARGING=0,t.CHARGING=1,t.NOT_CHARGEABLE=2,t}(n.Characteristic);t.ChargingState=x,n.Characteristic.ChargingState=x;var M=function(e){function t(){var r=e.call(this,"Closed Captions",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DD-0000-1000-8000-0026BB765291",t.DISABLED=0,t.ENABLED=1,t}(n.Characteristic);t.ClosedCaptions=M,n.Characteristic.ClosedCaptions=M;var F=function(e){function t(){var r=e.call(this,"Color Temperature",t.UUID,{format:"int",perms:["ev","pr","pw"],minValue:140,maxValue:500,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CE-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ColorTemperature=F,n.Characteristic.ColorTemperature=F;var k=function(e){function t(){var r=e.call(this,"Configuration State",t.UUID,{format:"uint16",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000263-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigurationState=k,n.Characteristic.ConfigurationState=k;var V=function(e){function t(){var r=e.call(this,"Configure Bridged Accessory",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A0-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigureBridgedAccessory=V,n.Characteristic.ConfigureBridgedAccessory=V;var H=function(e){function t(){var r=e.call(this,"Configure Bridged Accessory Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfigureBridgedAccessoryStatus=H,n.Characteristic.ConfigureBridgedAccessoryStatus=H;var j=function(e){function t(){var r=e.call(this,"Configured Name",t.UUID,{format:"string",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ConfiguredName=j,n.Characteristic.ConfiguredName=j;var G=function(e){function t(){var r=e.call(this,"Contact Sensor State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006A-0000-1000-8000-0026BB765291",t.CONTACT_DETECTED=0,t.CONTACT_NOT_DETECTED=1,t}(n.Characteristic);t.ContactSensorState=G,n.Characteristic.ContactSensorState=G;var W=function(e){function t(){var r=e.call(this,"Cooling Threshold Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:10,maxValue:35,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CoolingThresholdTemperature=W,n.Characteristic.CoolingThresholdTemperature=W;var Y=function(e){function t(){var r=e.call(this,"Crypto Hash",t.UUID,{format:"tlv8",perms:["pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000250-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CryptoHash=Y,n.Characteristic.CryptoHash=Y;var q=function(e){function t(){var r=e.call(this,"Current Air Purifier State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A9-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.PURIFYING_AIR=2,t}(n.Characteristic);t.CurrentAirPurifierState=q,n.Characteristic.CurrentAirPurifierState=q;var K=function(e){function t(){var r=e.call(this,"Current Ambient Light Level",t.UUID,{format:"float",perms:["ev","pr"],unit:"lux",minValue:1e-4,maxValue:1e5})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentAmbientLightLevel=K,n.Characteristic.CurrentAmbientLightLevel=K;var $=function(e){function t(){var r=e.call(this,"Current Door State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:4,minStep:1,validValues:[0,1,2,3,4]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000E-0000-1000-8000-0026BB765291",t.OPEN=0,t.CLOSED=1,t.OPENING=2,t.CLOSING=3,t.STOPPED=4,t}(n.Characteristic);t.CurrentDoorState=$,n.Characteristic.CurrentDoorState=$;var z=function(e){function t(){var r=e.call(this,"Current Fan State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AF-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.BLOWING_AIR=2,t}(n.Characteristic);t.CurrentFanState=z,n.Characteristic.CurrentFanState=z;var Q=function(e){function t(){var r=e.call(this,"Current Heater-Cooler State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B1-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.HEATING=2,t.COOLING=3,t}(n.Characteristic);t.CurrentHeaterCoolerState=Q,n.Characteristic.CurrentHeaterCoolerState=Q;var X=function(e){function t(){var r=e.call(this,"Current Heating Cooling State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000000F-0000-1000-8000-0026BB765291",t.OFF=0,t.HEAT=1,t.COOL=2,t}(n.Characteristic);t.CurrentHeatingCoolingState=X,n.Characteristic.CurrentHeatingCoolingState=X;var J=function(e){function t(){var r=e.call(this,"Current Horizontal Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentHorizontalTiltAngle=J,n.Characteristic.CurrentHorizontalTiltAngle=J;var Z=function(e){function t(){var r=e.call(this,"Current Humidifier-Dehumidifier State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B3-0000-1000-8000-0026BB765291",t.INACTIVE=0,t.IDLE=1,t.HUMIDIFYING=2,t.DEHUMIDIFYING=3,t}(n.Characteristic);t.CurrentHumidifierDehumidifierState=Z,n.Characteristic.CurrentHumidifierDehumidifierState=Z;var ee=function(e){function t(){var r=e.call(this,"Current Media State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1,validValues:[0,1,2,4,5]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E0-0000-1000-8000-0026BB765291",t.PLAY=0,t.PAUSE=1,t.STOP=2,t.LOADING=4,t.INTERRUPTED=5,t}(n.Characteristic);t.CurrentMediaState=ee,n.Characteristic.CurrentMediaState=ee;var te=function(e){function t(){var r=e.call(this,"Current Position",t.UUID,{format:"uint8",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentPosition=te,n.Characteristic.CurrentPosition=te;var re=function(e){function t(){var r=e.call(this,"Current Relative Humidity",t.UUID,{format:"float",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000010-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentRelativeHumidity=re,n.Characteristic.CurrentRelativeHumidity=re;var ie=function(e){function t(){var r=e.call(this,"Current Slat State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AA-0000-1000-8000-0026BB765291",t.FIXED=0,t.JAMMED=1,t.SWINGING=2,t}(n.Characteristic);t.CurrentSlatState=ie,n.Characteristic.CurrentSlatState=ie;var ne=function(e){function t(){var r=e.call(this,"Current Temperature",t.UUID,{format:"float",perms:["ev","pr"],unit:"celsius",minValue:-270,maxValue:100,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000011-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTemperature=ne,n.Characteristic.CurrentTemperature=ne;var oe=function(e){function t(){var r=e.call(this,"Current Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C1-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTiltAngle=oe,n.Characteristic.CurrentTiltAngle=oe;var ae=function(e){function t(){var r=e.call(this,"Current Time",t.UUID,{format:"string",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTime=ae,n.Characteristic.CurrentTime=ae;var se=function(e){function t(){var r=e.call(this,"Current Transport",t.UUID,{format:"bool",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentTransport=se,n.Characteristic.CurrentTransport=se;var ce=function(e){function t(){var r=e.call(this,"Current Vertical Tilt Angle",t.UUID,{format:"int",perms:["ev","pr"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.CurrentVerticalTiltAngle=ce,n.Characteristic.CurrentVerticalTiltAngle=ce;var ue=function(e){function t(){var r=e.call(this,"Current Visibility State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000135-0000-1000-8000-0026BB765291",t.SHOWN=0,t.HIDDEN=1,t}(n.Characteristic);t.CurrentVisibilityState=ue,n.Characteristic.CurrentVisibilityState=ue;var le=function(e){function t(){var r=e.call(this,"Data Stream HAP Transport",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000138-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DataStreamHAPTransport=le,n.Characteristic.DataStreamHAPTransport=le;var he=function(e){function t(){var r=e.call(this,"Data Stream HAP Transport Interrupt",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000139-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DataStreamHAPTransportInterrupt=he,n.Characteristic.DataStreamHAPTransportInterrupt=he;var de=function(e){function t(){var r=e.call(this,"Day of the Week",t.UUID,{format:"uint8",perms:["pr","pw"],minValue:1,maxValue:7})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000098-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DayoftheWeek=de,n.Characteristic.DayoftheWeek=de;var pe=function(e){function t(){var r=e.call(this,"Diagonal Field Of View",t.UUID,{format:"float",perms:["ev","pr"],unit:"arcdegrees",minValue:0,maxValue:360})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000224-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiagonalFieldOfView=pe,n.Characteristic.DiagonalFieldOfView=pe;var fe=function(e){function t(){var r=e.call(this,"Digital Zoom",t.UUID,{format:"float",perms:["ev","pr","pw"],minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DigitalZoom=fe,n.Characteristic.DigitalZoom=fe;var ge=function(e){function t(){var r=e.call(this,"Discover Bridged Accessories",t.UUID,{format:"uint8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiscoverBridgedAccessories=ge,n.Characteristic.DiscoverBridgedAccessories=ge;var me=function(e){function t(){var r=e.call(this,"Discovered Bridged Accessories",t.UUID,{format:"uint16",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DiscoveredBridgedAccessories=me,n.Characteristic.DiscoveredBridgedAccessories=me;var ve=function(e){function t(){var r=e.call(this,"Display Order",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000136-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.DisplayOrder=ve,n.Characteristic.DisplayOrder=ve;var ye=function(e){function t(){var r=e.call(this,"Event Retransmission Maximum",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.EventRetransmissionMaximum=ye,n.Characteristic.EventRetransmissionMaximum=ye;var Ce=function(e){function t(){var r=e.call(this,"Event Snapshots Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000223-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.EventSnapshotsActive=Ce,n.Characteristic.EventSnapshotsActive=Ce;var Se=function(e){function t(){var r=e.call(this,"Event Transmission Counters",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.EventTransmissionCounters=Se,n.Characteristic.EventTransmissionCounters=Se;var Ee=function(e){function t(){var r=e.call(this,"Filter Change Indication",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AC-0000-1000-8000-0026BB765291",t.FILTER_OK=0,t.CHANGE_FILTER=1,t}(n.Characteristic);t.FilterChangeIndication=Ee,n.Characteristic.FilterChangeIndication=Ee;var _e=function(e){function t(){var r=e.call(this,"Filter Life Level",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AB-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FilterLifeLevel=_e,n.Characteristic.FilterLifeLevel=_e;var Te=function(e){function t(){var r=e.call(this,"Firmware Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000052-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareRevision=Te,n.Characteristic.FirmwareRevision=Te;var Ae=function(e){function t(){var r=e.call(this,"Firmware Update Readiness",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000234-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareUpdateReadiness=Ae,n.Characteristic.FirmwareUpdateReadiness=Ae;var Ie=function(e){function t(){var r=e.call(this,"Firmware Update Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000235-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.FirmwareUpdateStatus=Ie,n.Characteristic.FirmwareUpdateStatus=Ie;var De=function(e){function t(){var r=e.call(this,"Hardware Finish",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000026C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HardwareFinish=De,n.Characteristic.HardwareFinish=De;var we=function(e){function t(){var r=e.call(this,"Hardware Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000053-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HardwareRevision=we,n.Characteristic.HardwareRevision=we;var be=function(e){function t(){var r=e.call(this,"Heart Beat",t.UUID,{format:"uint32",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HeartBeat=be,n.Characteristic.HeartBeat=be;var Ue=function(e){function t(){var r=e.call(this,"Heating Threshold Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:0,maxValue:25,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000012-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HeatingThresholdTemperature=Ue,n.Characteristic.HeatingThresholdTemperature=Ue;var Re=function(e){function t(){var r=e.call(this,"Hold Position",t.UUID,{format:"bool",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000006F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.HoldPosition=Re,n.Characteristic.HoldPosition=Re;var Oe=function(e){function t(){var r=e.call(this,"HomeKit Camera Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021B-0000-1000-8000-0026BB765291",t.OFF=0,t.ON=1,t}(n.Characteristic);t.HomeKitCameraActive=Oe,n.Characteristic.HomeKitCameraActive=Oe;var Ne=function(e){function t(){var r=e.call(this,"Hue",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:0,maxValue:360,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000013-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Hue=Ne,n.Characteristic.Hue=Ne;var Pe=function(e){function t(){var r=e.call(this,"Identifier",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E6-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Identifier=Pe,n.Characteristic.Identifier=Pe;var Be=function(e){function t(){var r=e.call(this,"Identify",t.UUID,{format:"bool",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000014-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Identify=Be,n.Characteristic.Identify=Be;var Le=function(e){function t(){var r=e.call(this,"Image Mirroring",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ImageMirroring=Le,n.Characteristic.ImageMirroring=Le;var xe=function(e){function t(){var r=e.call(this,"Image Rotation",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:0,maxValue:360,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ImageRotation=xe,n.Characteristic.ImageRotation=xe;var Me=function(e){function t(){var r=e.call(this,"Input Device Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:6,minStep:1,validValues:[0,1,2,3,4,5,6]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DC-0000-1000-8000-0026BB765291",t.OTHER=0,t.TV=1,t.RECORDING=2,t.TUNER=3,t.PLAYBACK=4,t.AUDIO_SYSTEM=5,t}(n.Characteristic);t.InputDeviceType=Me,n.Characteristic.InputDeviceType=Me;var Fe=function(e){function t(){var r=e.call(this,"Input Source Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:10,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DB-0000-1000-8000-0026BB765291",t.OTHER=0,t.HOME_SCREEN=1,t.TUNER=2,t.HDMI=3,t.COMPOSITE_VIDEO=4,t.S_VIDEO=5,t.COMPONENT_VIDEO=6,t.DVI=7,t.AIRPLAY=8,t.USB=9,t.APPLICATION=10,t}(n.Characteristic);t.InputSourceType=Fe,n.Characteristic.InputSourceType=Fe;var ke=function(e){function t(){var r=e.call(this,"In Use",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D2-0000-1000-8000-0026BB765291",t.NOT_IN_USE=0,t.IN_USE=1,t}(n.Characteristic);t.InUse=ke,n.Characteristic.InUse=ke;var Ve=function(e){function t(){var r=e.call(this,"Is Configured",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D6-0000-1000-8000-0026BB765291",t.NOT_CONFIGURED=0,t.CONFIGURED=1,t}(n.Characteristic);t.IsConfigured=Ve,n.Characteristic.IsConfigured=Ve;var He=function(e){function t(){var r=e.call(this,"Leak Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000070-0000-1000-8000-0026BB765291",t.LEAK_NOT_DETECTED=0,t.LEAK_DETECTED=1,t}(n.Characteristic);t.LeakDetected=He,n.Characteristic.LeakDetected=He;var je=function(e){function t(){var r=e.call(this,"Link Quality",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:1,maxValue:4})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LinkQuality=je,n.Characteristic.LinkQuality=je;var Ge=function(e){function t(){var r=e.call(this,"List Pairings",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000050-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ListPairings=Ge,n.Characteristic.ListPairings=Ge;var We=function(e){function t(){var r=e.call(this,"Lock Control Point",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000019-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LockControlPoint=We,n.Characteristic.LockControlPoint=We;var Ye=function(e){function t(){var r=e.call(this,"Lock Current State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001D-0000-1000-8000-0026BB765291",t.UNSECURED=0,t.SECURED=1,t.JAMMED=2,t.UNKNOWN=3,t}(n.Characteristic);t.LockCurrentState=Ye,n.Characteristic.LockCurrentState=Ye;var qe=function(e){function t(){var r=e.call(this,"Lock Last Known Action",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:10,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001C-0000-1000-8000-0026BB765291",t.SECURED_PHYSICALLY_INTERIOR=0,t.UNSECURED_PHYSICALLY_INTERIOR=1,t.SECURED_PHYSICALLY_EXTERIOR=2,t.UNSECURED_PHYSICALLY_EXTERIOR=3,t.SECURED_BY_KEYPAD=4,t.UNSECURED_BY_KEYPAD=5,t.SECURED_REMOTELY=6,t.UNSECURED_REMOTELY=7,t.SECURED_BY_AUTO_SECURE_TIMEOUT=8,t.SECURED_PHYSICALLY=9,t.UNSECURED_PHYSICALLY=10,t}(n.Characteristic);t.LockLastKnownAction=qe,n.Characteristic.LockLastKnownAction=qe;var Ke=function(e){function t(){var r=e.call(this,"Lock Management Auto Security Timeout",t.UUID,{format:"uint32",perms:["ev","pr","pw"],unit:"seconds"})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.LockManagementAutoSecurityTimeout=Ke,n.Characteristic.LockManagementAutoSecurityTimeout=Ke;var $e=function(e){function t(){var r=e.call(this,"Lock Physical Controls",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A7-0000-1000-8000-0026BB765291",t.CONTROL_LOCK_DISABLED=0,t.CONTROL_LOCK_ENABLED=1,t}(n.Characteristic);t.LockPhysicalControls=$e,n.Characteristic.LockPhysicalControls=$e;var ze=function(e){function t(){var r=e.call(this,"Lock Target State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001E-0000-1000-8000-0026BB765291",t.UNSECURED=0,t.SECURED=1,t}(n.Characteristic);t.LockTargetState=ze,n.Characteristic.LockTargetState=ze;var Qe=function(e){function t(){var r=e.call(this,"Logs",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000001F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Logs=Qe,n.Characteristic.Logs=Qe;var Xe=function(e){function t(){var r=e.call(this,"MAC Retransmission Maximum",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000247-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MACRetransmissionMaximum=Xe,n.Characteristic.MACRetransmissionMaximum=Xe;var Je=function(e){function t(){var r=e.call(this,"MAC Transmission Counters",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000248-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MACTransmissionCounters=Je,n.Characteristic.MACTransmissionCounters=Je;var Ze=function(e){function t(){var r=e.call(this,"Managed Network Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw","tw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000215-0000-1000-8000-0026BB765291",t.DISABLED=0,t.ENABLED=1,t}(n.Characteristic);t.ManagedNetworkEnable=Ze,n.Characteristic.ManagedNetworkEnable=Ze;var et=function(e){function t(){var r=e.call(this,"Manually Disabled",t.UUID,{format:"bool",perms:["ev","pr"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000227-0000-1000-8000-0026BB765291",t.ENABLED=0,t.DISABLED=1,t}(n.Characteristic);t.ManuallyDisabled=et,n.Characteristic.ManuallyDisabled=et;var tt=function(e){function t(){var r=e.call(this,"Manufacturer",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000020-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Manufacturer=tt,n.Characteristic.Manufacturer=tt;var rt=function(e){function t(){var r=e.call(this,"Maximum Transmit Power",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000243-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MaximumTransmitPower=rt,n.Characteristic.MaximumTransmitPower=rt;var it=function(e){function t(){var r=e.call(this,"Metrics Buffer Full State",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000272-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MetricsBufferFullState=it,n.Characteristic.MetricsBufferFullState=it;var nt=function(e){function t(){var r=e.call(this,"Model",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000021-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Model=nt,n.Characteristic.Model=nt;var ot=function(e){function t(){var r=e.call(this,"Motion Detected",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000022-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MotionDetected=ot,n.Characteristic.MotionDetected=ot;var at=function(e){function t(){var r=e.call(this,"Multifunction Button",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000026B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.MultifunctionButton=at,n.Characteristic.MultifunctionButton=at;var st=function(e){function t(){var r=e.call(this,"Mute",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Mute=st,n.Characteristic.Mute=st;var ct=function(e){function t(){var r=e.call(this,"Name",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000023-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Name=ct,n.Characteristic.Name=ct;var ut=function(e){function t(){var r=e.call(this,"Network Access Violation Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkAccessViolationControl=ut,n.Characteristic.NetworkAccessViolationControl=ut;var lt=function(e){function t(){var r=e.call(this,"Network Client Profile Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkClientProfileControl=lt,n.Characteristic.NetworkClientProfileControl=lt;var ht=function(e){function t(){var r=e.call(this,"Network Client Status Control",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NetworkClientStatusControl=ht,n.Characteristic.NetworkClientStatusControl=ht;var dt=function(e){function t(){var r=e.call(this,"NFC Access Control Point",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000264-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NFCAccessControlPoint=dt,n.Characteristic.NFCAccessControlPoint=dt;var pt=function(e){function t(){var r=e.call(this,"NFC Access Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000265-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NFCAccessSupportedConfiguration=pt,n.Characteristic.NFCAccessSupportedConfiguration=pt;var ft=function(e){function t(){var r=e.call(this,"Night Vision",t.UUID,{format:"bool",perms:["ev","pr","pw","tw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NightVision=ft,n.Characteristic.NightVision=ft;var gt=function(e){function t(){var r=e.call(this,"Nitrogen Dioxide Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.NitrogenDioxideDensity=gt,n.Characteristic.NitrogenDioxideDensity=gt;var mt=function(e){function t(){var r=e.call(this,"Obstruction Detected",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000024-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ObstructionDetected=mt,n.Characteristic.ObstructionDetected=mt;var vt=function(e){function t(){var r=e.call(this,"Occupancy Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000071-0000-1000-8000-0026BB765291",t.OCCUPANCY_NOT_DETECTED=0,t.OCCUPANCY_DETECTED=1,t}(n.Characteristic);t.OccupancyDetected=vt,n.Characteristic.OccupancyDetected=vt;var yt=function(e){function t(){var r=e.call(this,"On",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000025-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.On=yt,n.Characteristic.On=yt;var Ct=function(e){function t(){var r=e.call(this,"Operating State Response",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000232-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OperatingStateResponse=Ct,n.Characteristic.OperatingStateResponse=Ct;var St=function(e){function t(){var r=e.call(this,"Optical Zoom",t.UUID,{format:"float",perms:["ev","pr","pw"],minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000011C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OpticalZoom=St,n.Characteristic.OpticalZoom=St;var Et=function(e){function t(){var r=e.call(this,"Outlet In Use",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000026-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OutletInUse=Et,n.Characteristic.OutletInUse=Et;var _t=function(e){function t(){var r=e.call(this,"Ozone Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.OzoneDensity=_t,n.Characteristic.OzoneDensity=_t;var Tt=function(e){function t(){var r=e.call(this,"Pairing Features",t.UUID,{format:"uint8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairingFeatures=Tt,n.Characteristic.PairingFeatures=Tt;var At=function(e){function t(){var r=e.call(this,"Pair Setup",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairSetup=At,n.Characteristic.PairSetup=At;var It=function(e){function t(){var r=e.call(this,"Pair Verify",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000004E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PairVerify=It,n.Characteristic.PairVerify=It;var Dt=function(e){function t(){var r=e.call(this,"Password Setting",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PasswordSetting=Dt,n.Characteristic.PasswordSetting=Dt;var wt=function(e){function t(){var r=e.call(this,"Periodic Snapshots Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000225-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.PeriodicSnapshotsActive=wt,n.Characteristic.PeriodicSnapshotsActive=wt;var bt=function(e){function t(){var r=e.call(this,"Picture Mode",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:13,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10,11,12,13]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E2-0000-1000-8000-0026BB765291",t.OTHER=0,t.STANDARD=1,t.CALIBRATED=2,t.CALIBRATED_DARK=3,t.VIVID=4,t.GAME=5,t.COMPUTER=6,t.CUSTOM=7,t}(n.Characteristic);t.PictureMode=bt,n.Characteristic.PictureMode=bt;var Ut=function(e){function t(){var r=e.call(this,"Ping",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Ping=Ut,n.Characteristic.Ping=Ut;var Rt=function(e){function t(){var r=e.call(this,"PM10 Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C7-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PM10Density=Rt,n.Characteristic.PM10Density=Rt;var Ot=function(e){function t(){var r=e.call(this,"PM2.5 Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C6-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.PM2_5Density=Ot,n.Characteristic.PM2_5Density=Ot;var Nt=function(e){function t(){var r=e.call(this,"Position State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000072-0000-1000-8000-0026BB765291",t.DECREASING=0,t.INCREASING=1,t.STOPPED=2,t}(n.Characteristic);t.PositionState=Nt,n.Characteristic.PositionState=Nt;var Pt=function(e){function t(){var r=e.call(this,"Power Mode Selection",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000DF-0000-1000-8000-0026BB765291",t.SHOW=0,t.HIDE=1,t}(n.Characteristic);t.PowerModeSelection=Pt,n.Characteristic.PowerModeSelection=Pt;var Bt=function(e){function t(){var r=e.call(this,"Product Data",t.UUID,{format:"data",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000220-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ProductData=Bt,n.Characteristic.ProductData=Bt;var Lt=function(e){function t(){var r=e.call(this,"Programmable Switch Event",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000073-0000-1000-8000-0026BB765291",t.SINGLE_PRESS=0,t.DOUBLE_PRESS=1,t.LONG_PRESS=2,t}(n.Characteristic);t.ProgrammableSwitchEvent=Lt,n.Characteristic.ProgrammableSwitchEvent=Lt;var xt=function(e){function t(){var r=e.call(this,"Programmable Switch Output State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000074-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ProgrammableSwitchOutputState=xt,n.Characteristic.ProgrammableSwitchOutputState=xt;var Mt=function(e){function t(){var r=e.call(this,"Program Mode",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D1-0000-1000-8000-0026BB765291",t.NO_PROGRAM_SCHEDULED=0,t.PROGRAM_SCHEDULED=1,t.PROGRAM_SCHEDULED_MANUAL_MODE_=2,t}(n.Characteristic);t.ProgramMode=Mt,n.Characteristic.ProgramMode=Mt;var Ft=function(e){function t(){var r=e.call(this,"Reachable",t.UUID,{format:"bool",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000063-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Reachable=Ft,n.Characteristic.Reachable=Ft;var kt=function(e){function t(){var r=e.call(this,"Received Signal Strength Indication",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ReceivedSignalStrengthIndication=kt,n.Characteristic.ReceivedSignalStrengthIndication=kt;var Vt=function(e){function t(){var r=e.call(this,"Receiver Sensitivity",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000244-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ReceiverSensitivity=Vt,n.Characteristic.ReceiverSensitivity=Vt;var Ht=function(e){function t(){var r=e.call(this,"Recording Audio Active",t.UUID,{format:"uint8",perms:["ev","pr","pw","tw"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000226-0000-1000-8000-0026BB765291",t.DISABLE=0,t.ENABLE=1,t}(n.Characteristic);t.RecordingAudioActive=Ht,n.Characteristic.RecordingAudioActive=Ht;var jt=function(e){function t(){var r=e.call(this,"Relative Humidity Dehumidifier Threshold",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C9-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelativeHumidityDehumidifierThreshold=jt,n.Characteristic.RelativeHumidityDehumidifierThreshold=jt;var Gt=function(e){function t(){var r=e.call(this,"Relative Humidity Humidifier Threshold",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CA-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelativeHumidityHumidifierThreshold=Gt,n.Characteristic.RelativeHumidityHumidifierThreshold=Gt;var Wt=function(e){function t(){var r=e.call(this,"Relay Control Point",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayControlPoint=Wt,n.Characteristic.RelayControlPoint=Wt;var Yt=function(e){function t(){var r=e.call(this,"Relay Enabled",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayEnabled=Yt,n.Characteristic.RelayEnabled=Yt;var qt=function(e){function t(){var r=e.call(this,"Relay State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:5,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000005C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RelayState=qt,n.Characteristic.RelayState=qt;var Kt=function(e){function t(){var r=e.call(this,"Remaining Duration",t.UUID,{format:"uint32",perms:["ev","pr"],unit:"seconds",minValue:0,maxValue:3600,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D4-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RemainingDuration=Kt,n.Characteristic.RemainingDuration=Kt;var $t=function(e){function t(){var r=e.call(this,"Remote Key",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:16,minStep:1,validValues:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E1-0000-1000-8000-0026BB765291",t.REWIND=0,t.FAST_FORWARD=1,t.NEXT_TRACK=2,t.PREVIOUS_TRACK=3,t.ARROW_UP=4,t.ARROW_DOWN=5,t.ARROW_LEFT=6,t.ARROW_RIGHT=7,t.SELECT=8,t.BACK=9,t.EXIT=10,t.PLAY_PAUSE=11,t.INFORMATION=15,t}(n.Characteristic);t.RemoteKey=$t,n.Characteristic.RemoteKey=$t;var zt=function(e){function t(){var r=e.call(this,"Reset Filter Indication",t.UUID,{format:"uint8",perms:["pw"],minValue:1,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AD-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ResetFilterIndication=zt,n.Characteristic.ResetFilterIndication=zt;var Qt=function(e){function t(){var r=e.call(this,"Rotation Direction",t.UUID,{format:"int",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000028-0000-1000-8000-0026BB765291",t.CLOCKWISE=0,t.COUNTER_CLOCKWISE=1,t}(n.Characteristic);t.RotationDirection=Qt,n.Characteristic.RotationDirection=Qt;var Xt=function(e){function t(){var r=e.call(this,"Rotation Speed",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000029-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.RotationSpeed=Xt,n.Characteristic.RotationSpeed=Xt;var Jt=function(e){function t(){var r=e.call(this,"Router Status",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000020E-0000-1000-8000-0026BB765291",t.READY=0,t.NOT_READY=1,t}(n.Characteristic);t.RouterStatus=Jt,n.Characteristic.RouterStatus=Jt;var Zt=function(e){function t(){var r=e.call(this,"Saturation",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000002F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Saturation=Zt,n.Characteristic.Saturation=Zt;var er=function(e){function t(){var r=e.call(this,"Security System Alarm Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000008E-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SecuritySystemAlarmType=er,n.Characteristic.SecuritySystemAlarmType=er;var tr=function(e){function t(){var r=e.call(this,"Security System Current State",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:4,minStep:1,validValues:[0,1,2,3,4]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000066-0000-1000-8000-0026BB765291",t.STAY_ARM=0,t.AWAY_ARM=1,t.NIGHT_ARM=2,t.DISARMED=3,t.ALARM_TRIGGERED=4,t}(n.Characteristic);t.SecuritySystemCurrentState=tr,n.Characteristic.SecuritySystemCurrentState=tr;var rr=function(e){function t(){var r=e.call(this,"Security System Target State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000067-0000-1000-8000-0026BB765291",t.STAY_ARM=0,t.AWAY_ARM=1,t.NIGHT_ARM=2,t.DISARM=3,t}(n.Characteristic);t.SecuritySystemTargetState=rr,n.Characteristic.SecuritySystemTargetState=rr;var ir=function(e){function t(){var r=e.call(this,"Selected Audio Stream Configuration",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000128-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedAudioStreamConfiguration=ir,n.Characteristic.SelectedAudioStreamConfiguration=ir;var nr=function(e){function t(){var r=e.call(this,"Selected Camera Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000209-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedCameraRecordingConfiguration=nr,n.Characteristic.SelectedCameraRecordingConfiguration=nr;var or=function(e){function t(){var r=e.call(this,"Selected Diagnostics Modes",t.UUID,{format:"uint32",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedDiagnosticsModes=or,n.Characteristic.SelectedDiagnosticsModes=or;var ar=function(e){function t(){var r=e.call(this,"Selected RTP Stream Configuration",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000117-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedRTPStreamConfiguration=ar,n.Characteristic.SelectedRTPStreamConfiguration=ar;var sr=function(e){function t(){var r=e.call(this,"Selected Sleep Configuration",t.UUID,{format:"tlv8",perms:["ev","pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000252-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SelectedSleepConfiguration=sr,n.Characteristic.SelectedSleepConfiguration=sr;var cr=function(e){function t(){var r=e.call(this,"Serial Number",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000030-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SerialNumber=cr,n.Characteristic.SerialNumber=cr;var ur=function(e){function t(){var r=e.call(this,"Service Label Index",t.UUID,{format:"uint8",perms:["pr"],minValue:1,maxValue:255,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CB-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ServiceLabelIndex=ur,n.Characteristic.ServiceLabelIndex=ur;var lr=function(e){function t(){var r=e.call(this,"Service Label Namespace",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000CD-0000-1000-8000-0026BB765291",t.DOTS=0,t.ARABIC_NUMERALS=1,t}(n.Characteristic);t.ServiceLabelNamespace=lr,n.Characteristic.ServiceLabelNamespace=lr;var hr=function(e){function t(){var r=e.call(this,"Set Duration",t.UUID,{format:"uint32",perms:["ev","pr","pw"],unit:"seconds",minValue:0,maxValue:3600,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D3-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetDuration=hr,n.Characteristic.SetDuration=hr;var dr=function(e){function t(){var r=e.call(this,"Setup Data Stream Transport",t.UUID,{format:"tlv8",perms:["pr","pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000131-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupDataStreamTransport=dr,n.Characteristic.SetupDataStreamTransport=dr;var pr=function(e){function t(){var r=e.call(this,"Setup Endpoints",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000118-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupEndpoints=pr,n.Characteristic.SetupEndpoints=pr;var fr=function(e){function t(){var r=e.call(this,"Setup Transfer Transport",t.UUID,{format:"tlv8",perms:["pw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000201-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SetupTransferTransport=fr,n.Characteristic.SetupTransferTransport=fr;var gr=function(e){function t(){var r=e.call(this,"Signal To Noise Ratio",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000241-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SignalToNoiseRatio=gr,n.Characteristic.SignalToNoiseRatio=gr;var mr=function(e){function t(){var r=e.call(this,"Siri Enable",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000255-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEnable=mr,n.Characteristic.SiriEnable=mr;var vr=function(e){function t(){var r=e.call(this,"Siri Endpoint Session Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000254-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEndpointSessionStatus=vr,n.Characteristic.SiriEndpointSessionStatus=vr;var yr=function(e){function t(){var r=e.call(this,"Siri Engine Version",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000025A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriEngineVersion=yr,n.Characteristic.SiriEngineVersion=yr;var Cr=function(e){function t(){var r=e.call(this,"Siri Input Type",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:0,validValues:[0]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000132-0000-1000-8000-0026BB765291",t.PUSH_BUTTON_TRIGGERED_APPLE_TV=0,t}(n.Characteristic);t.SiriInputType=Cr,n.Characteristic.SiriInputType=Cr;var Sr=function(e){function t(){var r=e.call(this,"Siri Light On Use",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000258-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriLightOnUse=Sr,n.Characteristic.SiriLightOnUse=Sr;var Er=function(e){function t(){var r=e.call(this,"Siri Listening",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000256-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriListening=Er,n.Characteristic.SiriListening=Er;var _r=function(e){function t(){var r=e.call(this,"Siri Touch To Use",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000257-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SiriTouchToUse=_r,n.Characteristic.SiriTouchToUse=_r;var Tr=function(e){function t(){var r=e.call(this,"Slat Type",t.UUID,{format:"uint8",perms:["pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C0-0000-1000-8000-0026BB765291",t.HORIZONTAL=0,t.VERTICAL=1,t}(n.Characteristic);t.SlatType=Tr,n.Characteristic.SlatType=Tr;var Ar=function(e){function t(){var r=e.call(this,"Sleep Discovery Mode",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E8-0000-1000-8000-0026BB765291",t.NOT_DISCOVERABLE=0,t.ALWAYS_DISCOVERABLE=1,t}(n.Characteristic);t.SleepDiscoveryMode=Ar,n.Characteristic.SleepDiscoveryMode=Ar;var Ir=function(e){function t(){var r=e.call(this,"Sleep Interval",t.UUID,{format:"uint32",perms:["ev","pr"],minValue:0,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000023A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SleepInterval=Ir,n.Characteristic.SleepInterval=Ir;var Dr=function(e){function t(){var r=e.call(this,"Smoke Detected",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000076-0000-1000-8000-0026BB765291",t.SMOKE_NOT_DETECTED=0,t.SMOKE_DETECTED=1,t}(n.Characteristic);t.SmokeDetected=Dr,n.Characteristic.SmokeDetected=Dr;var wr=function(e){function t(){var r=e.call(this,"Software Revision",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000054-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SoftwareRevision=wr,n.Characteristic.SoftwareRevision=wr;var br=function(e){function t(){var r=e.call(this,"Staged Firmware Version",t.UUID,{format:"string",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000249-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StagedFirmwareVersion=br,n.Characteristic.StagedFirmwareVersion=br;var Ur=function(e){function t(){var r=e.call(this,"Status Active",t.UUID,{format:"bool",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000075-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StatusActive=Ur,n.Characteristic.StatusActive=Ur;var Rr=function(e){function t(){var r=e.call(this,"Status Fault",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000077-0000-1000-8000-0026BB765291",t.NO_FAULT=0,t.GENERAL_FAULT=1,t}(n.Characteristic);t.StatusFault=Rr,n.Characteristic.StatusFault=Rr;var Or=function(e){function t(){var r=e.call(this,"Status Jammed",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000078-0000-1000-8000-0026BB765291",t.NOT_JAMMED=0,t.JAMMED=1,t}(n.Characteristic);t.StatusJammed=Or,n.Characteristic.StatusJammed=Or;var Nr=function(e){function t(){var r=e.call(this,"Status Low Battery",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000079-0000-1000-8000-0026BB765291",t.BATTERY_LEVEL_NORMAL=0,t.BATTERY_LEVEL_LOW=1,t}(n.Characteristic);t.StatusLowBattery=Nr,n.Characteristic.StatusLowBattery=Nr;var Pr=function(e){function t(){var r=e.call(this,"Status Tampered",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007A-0000-1000-8000-0026BB765291",t.NOT_TAMPERED=0,t.TAMPERED=1,t}(n.Characteristic);t.StatusTampered=Pr,n.Characteristic.StatusTampered=Pr;var Br=function(e){function t(){var r=e.call(this,"Streaming Status",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000120-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.StreamingStatus=Br,n.Characteristic.StreamingStatus=Br;var Lr=function(e){function t(){var r=e.call(this,"Sulphur Dioxide Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SulphurDioxideDensity=Lr,n.Characteristic.SulphurDioxideDensity=Lr;var xr=function(e){function t(){var r=e.call(this,"Supported Asset Types",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000268-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAssetTypes=xr,n.Characteristic.SupportedAssetTypes=xr;var Mr=function(e){function t(){var r=e.call(this,"Supported Audio Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000207-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAudioRecordingConfiguration=Mr,n.Characteristic.SupportedAudioRecordingConfiguration=Mr;var Fr=function(e){function t(){var r=e.call(this,"Supported Audio Stream Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000115-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedAudioStreamConfiguration=Fr,n.Characteristic.SupportedAudioStreamConfiguration=Fr;var kr=function(e){function t(){var r=e.call(this,"Supported Camera Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000205-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedCameraRecordingConfiguration=kr,n.Characteristic.SupportedCameraRecordingConfiguration=kr;var Vr=function(e){function t(){var r=e.call(this,"Supported Characteristic Value Transition Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000144-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedCharacteristicValueTransitionConfiguration=Vr,n.Characteristic.SupportedCharacteristicValueTransitionConfiguration=Vr;var Hr=function(e){function t(){var r=e.call(this,"Supported Data Stream Transport Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000130-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDataStreamTransportConfiguration=Hr,n.Characteristic.SupportedDataStreamTransportConfiguration=Hr;var jr=function(e){function t(){var r=e.call(this,"Supported Diagnostics Modes",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000024C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDiagnosticsModes=jr,n.Characteristic.SupportedDiagnosticsModes=jr;var Gr=function(e){function t(){var r=e.call(this,"Supported Diagnostics Snapshot",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000238-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedDiagnosticsSnapshot=Gr,n.Characteristic.SupportedDiagnosticsSnapshot=Gr;var Wr=function(e){function t(){var r=e.call(this,"Supported Firmware Update Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000233-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedFirmwareUpdateConfiguration=Wr,n.Characteristic.SupportedFirmwareUpdateConfiguration=Wr;var Yr=function(e){function t(){var r=e.call(this,"Supported Metrics",t.UUID,{format:"tlv8",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000271-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedMetrics=Yr,n.Characteristic.SupportedMetrics=Yr;var qr=function(e){function t(){var r=e.call(this,"Supported Router Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000210-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedRouterConfiguration=qr,n.Characteristic.SupportedRouterConfiguration=qr;var Kr=function(e){function t(){var r=e.call(this,"Supported RTP Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000116-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedRTPConfiguration=Kr,n.Characteristic.SupportedRTPConfiguration=Kr;var $r=function(e){function t(){var r=e.call(this,"Supported Sleep Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000251-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedSleepConfiguration=$r,n.Characteristic.SupportedSleepConfiguration=$r;var zr=function(e){function t(){var r=e.call(this,"Supported Transfer Transport Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000202-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedTransferTransportConfiguration=zr,n.Characteristic.SupportedTransferTransportConfiguration=zr;var Qr=function(e){function t(){var r=e.call(this,"Supported Video Recording Configuration",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000206-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedVideoRecordingConfiguration=Qr,n.Characteristic.SupportedVideoRecordingConfiguration=Qr;var Xr=function(e){function t(){var r=e.call(this,"Supported Video Stream Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000114-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.SupportedVideoStreamConfiguration=Xr,n.Characteristic.SupportedVideoStreamConfiguration=Xr;var Jr=function(e){function t(){var r=e.call(this,"Swing Mode",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B6-0000-1000-8000-0026BB765291",t.SWING_DISABLED=0,t.SWING_ENABLED=1,t}(n.Characteristic);t.SwingMode=Jr,n.Characteristic.SwingMode=Jr;var Zr=function(e){function t(){var r=e.call(this,"Tap Type",t.UUID,{format:"uint16",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022F-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TapType=Zr,n.Characteristic.TapType=Zr;var ei=function(e){function t(){var r=e.call(this,"Target Air Purifier State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000A8-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetAirPurifierState=ei,n.Characteristic.TargetAirPurifierState=ei;var ti=function(e){function t(){var r=e.call(this,"Target Air Quality",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000AE-0000-1000-8000-0026BB765291",t.EXCELLENT=0,t.GOOD=1,t.FAIR=2,t}(n.Characteristic);t.TargetAirQuality=ti,n.Characteristic.TargetAirQuality=ti;var ri=function(e){function t(){var r=e.call(this,"Target Control List",t.UUID,{format:"tlv8",perms:["pr","pw","wr"],adminOnlyAccess:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000124-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetControlList=ri,n.Characteristic.TargetControlList=ri;var ii=function(e){function t(){var r=e.call(this,"Target Control Supported Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000123-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetControlSupportedConfiguration=ii,n.Characteristic.TargetControlSupportedConfiguration=ii;var ni=function(e){function t(){var r=e.call(this,"Target Door State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000032-0000-1000-8000-0026BB765291",t.OPEN=0,t.CLOSED=1,t}(n.Characteristic);t.TargetDoorState=ni,n.Characteristic.TargetDoorState=ni;var oi=function(e){function t(){var r=e.call(this,"Target Fan State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000BF-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetFanState=oi,n.Characteristic.TargetFanState=oi;var ai=function(e){function t(){var r=e.call(this,"Target Heater-Cooler State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B2-0000-1000-8000-0026BB765291",t.AUTO=0,t.HEAT=1,t.COOL=2,t}(n.Characteristic);t.TargetHeaterCoolerState=ai,n.Characteristic.TargetHeaterCoolerState=ai;var si=function(e){function t(){var r=e.call(this,"Target Heating Cooling State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000033-0000-1000-8000-0026BB765291",t.OFF=0,t.HEAT=1,t.COOL=2,t.AUTO=3,t}(n.Characteristic);t.TargetHeatingCoolingState=si,n.Characteristic.TargetHeatingCoolingState=si;var ci=function(e){function t(){var r=e.call(this,"Target Horizontal Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007B-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetHorizontalTiltAngle=ci,n.Characteristic.TargetHorizontalTiltAngle=ci;var ui=function(e){function t(){var r=e.call(this,"Target Humidifier-Dehumidifier State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B4-0000-1000-8000-0026BB765291",t.AUTO=0,t.HUMIDIFIER_OR_DEHUMIDIFIER=0,t.HUMIDIFIER=1,t.DEHUMIDIFIER=2,t}(n.Characteristic);t.TargetHumidifierDehumidifierState=ui,n.Characteristic.TargetHumidifierDehumidifierState=ui;var li=function(e){function t(){var r=e.call(this,"Target Media State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:2,minStep:1,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000137-0000-1000-8000-0026BB765291",t.PLAY=0,t.PAUSE=1,t.STOP=2,t}(n.Characteristic);t.TargetMediaState=li,n.Characteristic.TargetMediaState=li;var hi=function(e){function t(){var r=e.call(this,"Target Position",t.UUID,{format:"uint8",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetPosition=hi,n.Characteristic.TargetPosition=hi;var di=function(e){function t(){var r=e.call(this,"Target Relative Humidity",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000034-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetRelativeHumidity=di,n.Characteristic.TargetRelativeHumidity=di;var pi=function(e){function t(){var r=e.call(this,"Target Slat State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000BE-0000-1000-8000-0026BB765291",t.MANUAL=0,t.AUTO=1,t}(n.Characteristic);t.TargetSlatState=pi,n.Characteristic.TargetSlatState=pi;var fi=function(e){function t(){var r=e.call(this,"Target Temperature",t.UUID,{format:"float",perms:["ev","pr","pw"],unit:"celsius",minValue:10,maxValue:38,minStep:.1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000035-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetTemperature=fi,n.Characteristic.TargetTemperature=fi;var gi=function(e){function t(){var r=e.call(this,"Target Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C2-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetTiltAngle=gi,n.Characteristic.TargetTiltAngle=gi;var mi=function(e){function t(){var r=e.call(this,"Target Vertical Tilt Angle",t.UUID,{format:"int",perms:["ev","pr","pw"],unit:"arcdegrees",minValue:-90,maxValue:90,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000007D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TargetVerticalTiltAngle=mi,n.Characteristic.TargetVerticalTiltAngle=mi;var vi=function(e){function t(){var r=e.call(this,"Target Visibility State",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000134-0000-1000-8000-0026BB765291",t.SHOWN=0,t.HIDDEN=1,t}(n.Characteristic);t.TargetVisibilityState=vi,n.Characteristic.TargetVisibilityState=vi;var yi=function(e){function t(){var r=e.call(this,"Temperature Display Units",t.UUID,{format:"uint8",perms:["ev","pr","pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000036-0000-1000-8000-0026BB765291",t.CELSIUS=0,t.FAHRENHEIT=1,t}(n.Characteristic);t.TemperatureDisplayUnits=yi,n.Characteristic.TemperatureDisplayUnits=yi;var Ci=function(e){function t(){var r=e.call(this,"Third Party Camera Active",t.UUID,{format:"uint8",perms:["ev","pr"],validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021C-0000-1000-8000-0026BB765291",t.OFF=0,t.ON=1,t}(n.Characteristic);t.ThirdPartyCameraActive=Ci,n.Characteristic.ThirdPartyCameraActive=Ci;var Si=function(e){function t(){var r=e.call(this,"Thread Control Point",t.UUID,{format:"tlv8",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000704-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadControlPoint=Si,n.Characteristic.ThreadControlPoint=Si;var Ei=function(e){function t(){var r=e.call(this,"Thread Node Capabilities",t.UUID,{format:"uint16",perms:["pr"],minValue:0,maxValue:31,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000702-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadNodeCapabilities=Ei,n.Characteristic.ThreadNodeCapabilities=Ei;var _i=function(e){function t(){var r=e.call(this,"Thread OpenThread Version",t.UUID,{format:"string",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000706-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadOpenThreadVersion=_i,n.Characteristic.ThreadOpenThreadVersion=_i;var Ti=function(e){function t(){var r=e.call(this,"Thread Status",t.UUID,{format:"uint16",perms:["ev","pr"],minValue:0,maxValue:6,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000703-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.ThreadStatus=Ti,n.Characteristic.ThreadStatus=Ti;var Ai=function(e){function t(){var r=e.call(this,"Time Update",t.UUID,{format:"bool",perms:["pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000009A-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TimeUpdate=Ai,n.Characteristic.TimeUpdate=Ai;var Ii=function(e){function t(){var r=e.call(this,"Token",t.UUID,{format:"data",perms:["pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000231-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Token=Ii,n.Characteristic.Token=Ii;var Di=function(e){function t(){var r=e.call(this,"Transmit Power",t.UUID,{format:"int",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000242-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TransmitPower=Di,n.Characteristic.TransmitPower=Di;var wi=function(e){function t(){var r=e.call(this,"Tunnel Connection Timeout",t.UUID,{format:"int",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000061-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunnelConnectionTimeout=wi,n.Characteristic.TunnelConnectionTimeout=wi;var bi=function(e){function t(){var r=e.call(this,"Tunneled Accessory Advertising",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000060-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryAdvertising=bi,n.Characteristic.TunneledAccessoryAdvertising=bi;var Ui=function(e){function t(){var r=e.call(this,"Tunneled Accessory Connected",t.UUID,{format:"bool",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000059-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryConnected=Ui,n.Characteristic.TunneledAccessoryConnected=Ui;var Ri=function(e){function t(){var r=e.call(this,"Tunneled Accessory State Number",t.UUID,{format:"int",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000058-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.TunneledAccessoryStateNumber=Ri,n.Characteristic.TunneledAccessoryStateNumber=Ri;var Oi=function(e){function t(){var r=e.call(this,"Valve Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000D5-0000-1000-8000-0026BB765291",t.GENERIC_VALVE=0,t.IRRIGATION=1,t.SHOWER_HEAD=2,t.WATER_FAUCET=3,t}(n.Characteristic);t.ValveType=Oi,n.Characteristic.ValveType=Oi;var Ni=function(e){function t(){var r=e.call(this,"Version",t.UUID,{format:"string",perms:["pr"],maxLen:64})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000037-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Version=Ni,n.Characteristic.Version=Ni;var Pi=function(e){function t(){var r=e.call(this,"Video Analysis Active",t.UUID,{format:"uint8",perms:["ev","pr","pw"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000229-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.VideoAnalysisActive=Pi,n.Characteristic.VideoAnalysisActive=Pi;var Bi=function(e){function t(){var r=e.call(this,"VOC Density",t.UUID,{format:"float",perms:["ev","pr"],minValue:0,maxValue:1e3,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000C8-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.VOCDensity=Bi,n.Characteristic.VOCDensity=Bi;var Li=function(e){function t(){var r=e.call(this,"Volume",t.UUID,{format:"uint8",perms:["ev","pr","pw"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000119-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.Volume=Li,n.Characteristic.Volume=Li;var xi=function(e){function t(){var r=e.call(this,"Volume Control Type",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:3,minStep:1,validValues:[0,1,2,3]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000E9-0000-1000-8000-0026BB765291",t.NONE=0,t.RELATIVE=1,t.RELATIVE_WITH_CURRENT=2,t.ABSOLUTE=3,t}(n.Characteristic);t.VolumeControlType=xi,n.Characteristic.VolumeControlType=xi;var Mi=function(e){function t(){var r=e.call(this,"Volume Selector",t.UUID,{format:"uint8",perms:["pw"],minValue:0,maxValue:1,minStep:1,validValues:[0,1]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000EA-0000-1000-8000-0026BB765291",t.INCREMENT=0,t.DECREMENT=1,t}(n.Characteristic);t.VolumeSelector=Mi,n.Characteristic.VolumeSelector=Mi;var Fi=function(e){function t(){var r=e.call(this,"Wake Configuration",t.UUID,{format:"tlv8",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000222-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WakeConfiguration=Fi,n.Characteristic.WakeConfiguration=Fi;var ki=function(e){function t(){var r=e.call(this,"WAN Configuration List",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000211-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WANConfigurationList=ki,n.Characteristic.WANConfigurationList=ki;var Vi=function(e){function t(){var r=e.call(this,"WAN Status List",t.UUID,{format:"tlv8",perms:["ev","pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="00000212-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WANStatusList=Vi,n.Characteristic.WANStatusList=Vi;var Hi=function(e){function t(){var r=e.call(this,"Water Level",t.UUID,{format:"float",perms:["ev","pr"],unit:"percentage",minValue:0,maxValue:100,minStep:1})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="000000B5-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WaterLevel=Hi,n.Characteristic.WaterLevel=Hi;var ji=function(e){function t(){var r=e.call(this,"Wi-Fi Capabilities",t.UUID,{format:"uint32",perms:["pr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022C-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WiFiCapabilities=ji,n.Characteristic.WiFiCapabilities=ji;var Gi=function(e){function t(){var r=e.call(this,"Wi-Fi Configuration Control",t.UUID,{format:"tlv8",perms:["ev","pr","pw","tw","wr"]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000022D-0000-1000-8000-0026BB765291",t}(n.Characteristic);t.WiFiConfigurationControl=Gi,n.Characteristic.WiFiConfigurationControl=Gi;var Wi=function(e){function t(){var r=e.call(this,"Wi-Fi Satellite Status",t.UUID,{format:"uint8",perms:["ev","pr"],minValue:0,maxValue:2,validValues:[0,1,2]})||this;return r.value=r.getDefaultValue(),r}return i.__extends(t,e),t.UUID="0000021E-0000-1000-8000-0026BB765291",t.UNKNOWN=0,t.CONNECTED=1,t.NOT_CONNECTED=2,t}(n.Characteristic);t.WiFiSatelliteStatus=Wi,n.Characteristic.WiFiSatelliteStatus=Wi},1647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecuritySystem=t.ProtocolInformation=t.PowerManagement=t.Pairing=t.Outlet=t.OccupancySensor=t.NFCAccess=t.MotionSensor=t.Microphone=t.LockMechanism=t.LockManagement=t.LightSensor=t.Lightbulb=t.LeakSensor=t.IrrigationSystem=t.InputSource=t.HumiditySensor=t.HumidifierDehumidifier=t.HeaterCooler=t.GarageDoorOpener=t.FirmwareUpdate=t.FilterMaintenance=t.Faucet=t.Fanv2=t.Fan=t.Doorbell=t.Door=t.Diagnostics=t.DataStreamTransportManagement=t.ContactSensor=t.CloudRelay=t.CarbonMonoxideSensor=t.CarbonDioxideSensor=t.CameraRTPStreamManagement=t.CameraRecordingManagement=t.CameraOperatingMode=t.CameraControl=t.BridgingState=t.BridgeConfiguration=t.Battery=t.AudioStreamManagement=t.Assistant=t.AssetUpdate=t.AirQualitySensor=t.AirPurifier=t.AccessoryRuntimeInformation=t.AccessoryMetrics=t.AccessoryInformation=t.AccessControl=t.AccessCode=void 0,t.WindowCovering=t.Window=t.WiFiTransport=t.WiFiSatellite=t.WiFiRouter=t.Valve=t.Tunnel=t.TransferTransportManagement=t.TimeInformation=t.ThreadTransport=t.Thermostat=t.TemperatureSensor=t.TelevisionSpeaker=t.Television=t.TargetControlManagement=t.TargetControl=t.TapManagement=t.Switch=t.StatelessProgrammableSwitch=t.StatefulProgrammableSwitch=t.Speaker=t.SmokeSensor=t.SmartSpeaker=t.Slats=t.SiriEndpoint=t.Siri=t.ServiceLabel=void 0;var i=r(1635),n=r(9826),o=r(5876),a=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessCodeControlPoint),o.addCharacteristic(n.Characteristic.AccessCodeSupportedConfiguration),o.addCharacteristic(n.Characteristic.ConfigurationState),o}return i.__extends(t,e),t.UUID="00000260-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessCode=a,o.Service.AccessCode=a;var s=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessControlLevel),o.addOptionalCharacteristic(n.Characteristic.PasswordSetting),o}return i.__extends(t,e),t.UUID="000000DA-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessControl=s,o.Service.AccessControl=s;var c=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Identify),o.addCharacteristic(n.Characteristic.Manufacturer),o.addCharacteristic(n.Characteristic.Model),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o.addCharacteristic(n.Characteristic.SerialNumber),o.addCharacteristic(n.Characteristic.FirmwareRevision),o.addOptionalCharacteristic(n.Characteristic.AccessoryFlags),o.addOptionalCharacteristic(n.Characteristic.AppMatchingIdentifier),o.addOptionalCharacteristic(n.Characteristic.ConfiguredName),o.addOptionalCharacteristic(n.Characteristic.HardwareFinish),o.addOptionalCharacteristic(n.Characteristic.HardwareRevision),o.addOptionalCharacteristic(n.Characteristic.ProductData),o.addOptionalCharacteristic(n.Characteristic.SoftwareRevision),o}return i.__extends(t,e),t.UUID="0000003E-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryInformation=c,o.Service.AccessoryInformation=c;var u=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.MetricsBufferFullState),o.addCharacteristic(n.Characteristic.SupportedMetrics),o}return i.__extends(t,e),t.UUID="00000270-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryMetrics=u,o.Service.AccessoryMetrics=u;var l=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Ping),o.addOptionalCharacteristic(n.Characteristic.ActivityInterval),o.addOptionalCharacteristic(n.Characteristic.HeartBeat),o.addOptionalCharacteristic(n.Characteristic.SleepInterval),o}return i.__extends(t,e),t.UUID="00000239-0000-1000-8000-0026BB765291",t}(o.Service);t.AccessoryRuntimeInformation=l,o.Service.AccessoryRuntimeInformation=l;var h=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentAirPurifierState),o.addCharacteristic(n.Characteristic.TargetAirPurifierState),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o}return i.__extends(t,e),t.UUID="000000BB-0000-1000-8000-0026BB765291",t}(o.Service);t.AirPurifier=h,o.Service.AirPurifier=h;var d=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AirQuality),o.addOptionalCharacteristic(n.Characteristic.NitrogenDioxideDensity),o.addOptionalCharacteristic(n.Characteristic.OzoneDensity),o.addOptionalCharacteristic(n.Characteristic.PM10Density),o.addOptionalCharacteristic(n.Characteristic.PM2_5Density),o.addOptionalCharacteristic(n.Characteristic.SulphurDioxideDensity),o.addOptionalCharacteristic(n.Characteristic.VOCDensity),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000008D-0000-1000-8000-0026BB765291",t}(o.Service);t.AirQualitySensor=d,o.Service.AirQualitySensor=d;var p=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AssetUpdateReadiness),o.addCharacteristic(n.Characteristic.SupportedAssetTypes),o}return i.__extends(t,e),t.UUID="00000267-0000-1000-8000-0026BB765291",t}(o.Service);t.AssetUpdate=p,o.Service.AssetUpdate=p;var f=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.Identifier),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o}return i.__extends(t,e),t.UUID="0000026A-0000-1000-8000-0026BB765291",t}(o.Service);t.Assistant=f,o.Service.Assistant=f;var g=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedAudioStreamConfiguration),o.addCharacteristic(n.Characteristic.SelectedAudioStreamConfiguration),o}return i.__extends(t,e),t.UUID="00000127-0000-1000-8000-0026BB765291",t}(o.Service);t.AudioStreamManagement=g,o.Service.AudioStreamManagement=g;var m=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.BatteryLevel),o.addOptionalCharacteristic(n.Characteristic.ChargingState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000096-0000-1000-8000-0026BB765291",t}(o.Service);t.Battery=m,o.Service.BatteryService=m,o.Service.Battery=m;var v=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfigureBridgedAccessoryStatus),o.addCharacteristic(n.Characteristic.DiscoverBridgedAccessories),o.addCharacteristic(n.Characteristic.DiscoveredBridgedAccessories),o.addCharacteristic(n.Characteristic.ConfigureBridgedAccessory),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="000000A1-0000-1000-8000-0026BB765291",t}(o.Service);t.BridgeConfiguration=v,o.Service.BridgeConfiguration=v;var y=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Reachable),o.addCharacteristic(n.Characteristic.LinkQuality),o.addCharacteristic(n.Characteristic.AccessoryIdentifier),o.addCharacteristic(n.Characteristic.Category),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000062-0000-1000-8000-0026BB765291",t}(o.Service);t.BridgingState=y,o.Service.BridgingState=y;var C=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.CurrentHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.CurrentVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.NightVision),o.addOptionalCharacteristic(n.Characteristic.OpticalZoom),o.addOptionalCharacteristic(n.Characteristic.DigitalZoom),o.addOptionalCharacteristic(n.Characteristic.ImageRotation),o.addOptionalCharacteristic(n.Characteristic.ImageMirroring),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000111-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraControl=C,o.Service.CameraControl=C;var S=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.EventSnapshotsActive),o.addCharacteristic(n.Characteristic.HomeKitCameraActive),o.addOptionalCharacteristic(n.Characteristic.CameraOperatingModeIndicator),o.addOptionalCharacteristic(n.Characteristic.ManuallyDisabled),o.addOptionalCharacteristic(n.Characteristic.NightVision),o.addOptionalCharacteristic(n.Characteristic.PeriodicSnapshotsActive),o.addOptionalCharacteristic(n.Characteristic.ThirdPartyCameraActive),o.addOptionalCharacteristic(n.Characteristic.DiagonalFieldOfView),o}return i.__extends(t,e),t.UUID="0000021A-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraOperatingMode=S,o.Service.CameraOperatingMode=S;var E=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.SelectedCameraRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedAudioRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedCameraRecordingConfiguration),o.addCharacteristic(n.Characteristic.SupportedVideoRecordingConfiguration),o.addOptionalCharacteristic(n.Characteristic.RecordingAudioActive),o}return i.__extends(t,e),t.UUID="00000204-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraRecordingManagement=E,o.Service.CameraEventRecordingManagement=E,o.Service.CameraRecordingManagement=E;var _=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SelectedRTPStreamConfiguration),o.addCharacteristic(n.Characteristic.SetupEndpoints),o.addCharacteristic(n.Characteristic.StreamingStatus),o.addCharacteristic(n.Characteristic.SupportedAudioStreamConfiguration),o.addCharacteristic(n.Characteristic.SupportedRTPConfiguration),o.addCharacteristic(n.Characteristic.SupportedVideoStreamConfiguration),o.addOptionalCharacteristic(n.Characteristic.Active),o}return i.__extends(t,e),t.UUID="00000110-0000-1000-8000-0026BB765291",t}(o.Service);t.CameraRTPStreamManagement=_,o.Service.CameraRTPStreamManagement=_;var T=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CarbonDioxideDetected),o.addOptionalCharacteristic(n.Characteristic.CarbonDioxideLevel),o.addOptionalCharacteristic(n.Characteristic.CarbonDioxidePeakLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000097-0000-1000-8000-0026BB765291",t}(o.Service);t.CarbonDioxideSensor=T,o.Service.CarbonDioxideSensor=T;var A=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CarbonMonoxideDetected),o.addOptionalCharacteristic(n.Characteristic.CarbonMonoxideLevel),o.addOptionalCharacteristic(n.Characteristic.CarbonMonoxidePeakLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000007F-0000-1000-8000-0026BB765291",t}(o.Service);t.CarbonMonoxideSensor=A,o.Service.CarbonMonoxideSensor=A;var I=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.RelayControlPoint),o.addCharacteristic(n.Characteristic.RelayState),o.addCharacteristic(n.Characteristic.RelayEnabled),o}return i.__extends(t,e),t.UUID="0000005A-0000-1000-8000-0026BB765291",t}(o.Service);t.CloudRelay=I,o.Service.Relay=I,o.Service.CloudRelay=I;var D=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ContactSensorState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000080-0000-1000-8000-0026BB765291",t}(o.Service);t.ContactSensor=D,o.Service.ContactSensor=D;var w=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SetupDataStreamTransport),o.addCharacteristic(n.Characteristic.SupportedDataStreamTransportConfiguration),o.addCharacteristic(n.Characteristic.Version),o}return i.__extends(t,e),t.UUID="00000129-0000-1000-8000-0026BB765291",t}(o.Service);t.DataStreamTransportManagement=w,o.Service.DataStreamTransportManagement=w;var b=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedDiagnosticsSnapshot),o.addOptionalCharacteristic(n.Characteristic.SelectedDiagnosticsModes),o.addOptionalCharacteristic(n.Characteristic.SupportedDiagnosticsModes),o}return i.__extends(t,e),t.UUID="00000237-0000-1000-8000-0026BB765291",t}(o.Service);t.Diagnostics=b,o.Service.Diagnostics=b;var U=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o}return i.__extends(t,e),t.UUID="00000081-0000-1000-8000-0026BB765291",t}(o.Service);t.Door=U,o.Service.Door=U;var R=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.OperatingStateResponse),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000121-0000-1000-8000-0026BB765291",t}(o.Service);t.Doorbell=R,o.Service.Doorbell=R;var O=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationDirection),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o}return i.__extends(t,e),t.UUID="00000040-0000-1000-8000-0026BB765291",t}(o.Service);t.Fan=O,o.Service.Fan=O;var N=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.CurrentFanState),o.addOptionalCharacteristic(n.Characteristic.TargetFanState),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationDirection),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o}return i.__extends(t,e),t.UUID="000000B7-0000-1000-8000-0026BB765291",t}(o.Service);t.Fanv2=N,o.Service.Fanv2=N;var P=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000D7-0000-1000-8000-0026BB765291",t}(o.Service);t.Faucet=P,o.Service.Faucet=P;var B=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.FilterChangeIndication),o.addOptionalCharacteristic(n.Characteristic.FilterLifeLevel),o.addOptionalCharacteristic(n.Characteristic.ResetFilterIndication),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="000000BA-0000-1000-8000-0026BB765291",t}(o.Service);t.FilterMaintenance=B,o.Service.FilterMaintenance=B;var L=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.FirmwareUpdateReadiness),o.addCharacteristic(n.Characteristic.FirmwareUpdateStatus),o.addOptionalCharacteristic(n.Characteristic.StagedFirmwareVersion),o.addOptionalCharacteristic(n.Characteristic.SupportedFirmwareUpdateConfiguration),o}return i.__extends(t,e),t.UUID="00000236-0000-1000-8000-0026BB765291",t}(o.Service);t.FirmwareUpdate=L,o.Service.FirmwareUpdate=L;var x=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentDoorState),o.addCharacteristic(n.Characteristic.TargetDoorState),o.addCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.LockCurrentState),o.addOptionalCharacteristic(n.Characteristic.LockTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000041-0000-1000-8000-0026BB765291",t}(o.Service);t.GarageDoorOpener=x,o.Service.GarageDoorOpener=x;var M=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentHeaterCoolerState),o.addCharacteristic(n.Characteristic.TargetHeaterCoolerState),o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.CoolingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.HeatingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.TemperatureDisplayUnits),o}return i.__extends(t,e),t.UUID="000000BC-0000-1000-8000-0026BB765291",t}(o.Service);t.HeaterCooler=M,o.Service.HeaterCooler=M;var F=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CurrentHumidifierDehumidifierState),o.addCharacteristic(n.Characteristic.TargetHumidifierDehumidifierState),o.addCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.LockPhysicalControls),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RelativeHumidityDehumidifierThreshold),o.addOptionalCharacteristic(n.Characteristic.RelativeHumidityHumidifierThreshold),o.addOptionalCharacteristic(n.Characteristic.RotationSpeed),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.WaterLevel),o}return i.__extends(t,e),t.UUID="000000BD-0000-1000-8000-0026BB765291",t}(o.Service);t.HumidifierDehumidifier=F,o.Service.HumidifierDehumidifier=F;var k=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000082-0000-1000-8000-0026BB765291",t}(o.Service);t.HumiditySensor=k,o.Service.HumiditySensor=k;var V=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.InputSourceType),o.addCharacteristic(n.Characteristic.IsConfigured),o.testCharacteristic(n.Characteristic.Name)||o.addCharacteristic(n.Characteristic.Name).updateValue("Unnamed Service"),o.addCharacteristic(n.Characteristic.CurrentVisibilityState),o.addOptionalCharacteristic(n.Characteristic.Identifier),o.addOptionalCharacteristic(n.Characteristic.InputDeviceType),o.addOptionalCharacteristic(n.Characteristic.TargetVisibilityState),o}return i.__extends(t,e),t.UUID="000000D9-0000-1000-8000-0026BB765291",t}(o.Service);t.InputSource=V,o.Service.InputSource=V;var H=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ProgramMode),o.addCharacteristic(n.Characteristic.InUse),o.addOptionalCharacteristic(n.Characteristic.RemainingDuration),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000CF-0000-1000-8000-0026BB765291",t}(o.Service);t.IrrigationSystem=H,o.Service.IrrigationSystem=H;var j=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LeakDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000083-0000-1000-8000-0026BB765291",t}(o.Service);t.LeakSensor=j,o.Service.LeakSensor=j;var G=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.CharacteristicValueActiveTransitionCount),o.addOptionalCharacteristic(n.Characteristic.CharacteristicValueTransitionControl),o.addOptionalCharacteristic(n.Characteristic.ColorTemperature),o.addOptionalCharacteristic(n.Characteristic.Hue),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.Saturation),o.addOptionalCharacteristic(n.Characteristic.SupportedCharacteristicValueTransitionConfiguration),o}return i.__extends(t,e),t.UUID="00000043-0000-1000-8000-0026BB765291",t}(o.Service);t.Lightbulb=G,o.Service.Lightbulb=G;var W=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentAmbientLightLevel),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000084-0000-1000-8000-0026BB765291",t}(o.Service);t.LightSensor=W,o.Service.LightSensor=W;var Y=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LockControlPoint),o.addCharacteristic(n.Characteristic.Version),o.addOptionalCharacteristic(n.Characteristic.AdministratorOnlyAccess),o.addOptionalCharacteristic(n.Characteristic.AudioFeedback),o.addOptionalCharacteristic(n.Characteristic.CurrentDoorState),o.addOptionalCharacteristic(n.Characteristic.LockManagementAutoSecurityTimeout),o.addOptionalCharacteristic(n.Characteristic.LockLastKnownAction),o.addOptionalCharacteristic(n.Characteristic.Logs),o.addOptionalCharacteristic(n.Characteristic.MotionDetected),o}return i.__extends(t,e),t.UUID="00000044-0000-1000-8000-0026BB765291",t}(o.Service);t.LockManagement=Y,o.Service.LockManagement=Y;var q=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.LockCurrentState),o.addCharacteristic(n.Characteristic.LockTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000045-0000-1000-8000-0026BB765291",t}(o.Service);t.LockMechanism=q,o.Service.LockMechanism=q;var K=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000112-0000-1000-8000-0026BB765291",t}(o.Service);t.Microphone=K,o.Service.Microphone=K;var $=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.MotionDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000085-0000-1000-8000-0026BB765291",t}(o.Service);t.MotionSensor=$,o.Service.MotionSensor=$;var z=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfigurationState),o.addCharacteristic(n.Characteristic.NFCAccessControlPoint),o.addCharacteristic(n.Characteristic.NFCAccessSupportedConfiguration),o}return i.__extends(t,e),t.UUID="00000266-0000-1000-8000-0026BB765291",t}(o.Service);t.NFCAccess=z,o.Service.NFCAccess=z;var Q=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.OccupancyDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000086-0000-1000-8000-0026BB765291",t}(o.Service);t.OccupancySensor=Q,o.Service.OccupancySensor=Q;var X=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.OutletInUse),o}return i.__extends(t,e),t.UUID="00000047-0000-1000-8000-0026BB765291",t}(o.Service);t.Outlet=X,o.Service.Outlet=X;var J=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ListPairings),o.addCharacteristic(n.Characteristic.PairSetup),o.addCharacteristic(n.Characteristic.PairVerify),o.addCharacteristic(n.Characteristic.PairingFeatures),o}return i.__extends(t,e),t.UUID="00000055-0000-1000-8000-0026BB765291",t}(o.Service);t.Pairing=J,o.Service.Pairing=J;var Z=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.WakeConfiguration),o.addOptionalCharacteristic(n.Characteristic.SelectedSleepConfiguration),o.addOptionalCharacteristic(n.Characteristic.SupportedSleepConfiguration),o}return i.__extends(t,e),t.UUID="00000221-0000-1000-8000-0026BB765291",t}(o.Service);t.PowerManagement=Z,o.Service.PowerManagement=Z;var ee=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Version),o}return i.__extends(t,e),t.UUID="000000A2-0000-1000-8000-0026BB765291",t}(o.Service);t.ProtocolInformation=ee,o.Service.ProtocolInformation=ee;var te=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SecuritySystemCurrentState),o.addCharacteristic(n.Characteristic.SecuritySystemTargetState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.SecuritySystemAlarmType),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000007E-0000-1000-8000-0026BB765291",t}(o.Service);t.SecuritySystem=te,o.Service.SecuritySystem=te;var re=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ServiceLabelNamespace),o}return i.__extends(t,e),t.UUID="000000CC-0000-1000-8000-0026BB765291",t}(o.Service);t.ServiceLabel=re,o.Service.ServiceLabel=re;var ie=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SiriInputType),o.addOptionalCharacteristic(n.Characteristic.MultifunctionButton),o.addOptionalCharacteristic(n.Characteristic.SiriEnable),o.addOptionalCharacteristic(n.Characteristic.SiriEngineVersion),o.addOptionalCharacteristic(n.Characteristic.SiriLightOnUse),o.addOptionalCharacteristic(n.Characteristic.SiriListening),o.addOptionalCharacteristic(n.Characteristic.SiriTouchToUse),o}return i.__extends(t,e),t.UUID="00000133-0000-1000-8000-0026BB765291",t}(o.Service);t.Siri=ie,o.Service.Siri=ie;var ne=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SiriEndpointSessionStatus),o.addCharacteristic(n.Characteristic.Version),o.addOptionalCharacteristic(n.Characteristic.ActiveIdentifier),o.addOptionalCharacteristic(n.Characteristic.ManuallyDisabled),o}return i.__extends(t,e),t.UUID="00000253-0000-1000-8000-0026BB765291",t}(o.Service);t.SiriEndpoint=ne,o.Service.SiriEndpoint=ne;var oe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentSlatState),o.addCharacteristic(n.Characteristic.SlatType),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.SwingMode),o.addOptionalCharacteristic(n.Characteristic.CurrentTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetTiltAngle),o}return i.__extends(t,e),t.UUID="000000B9-0000-1000-8000-0026BB765291",t}(o.Service);t.Slats=oe,o.Service.Slat=oe,o.Service.Slats=oe;var ae=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentMediaState),o.addCharacteristic(n.Characteristic.TargetMediaState),o.addOptionalCharacteristic(n.Characteristic.AirPlayEnable),o.addOptionalCharacteristic(n.Characteristic.ConfiguredName),o.addOptionalCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000228-0000-1000-8000-0026BB765291",t}(o.Service);t.SmartSpeaker=ae,o.Service.SmartSpeaker=ae;var se=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SmokeDetected),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="00000087-0000-1000-8000-0026BB765291",t}(o.Service);t.SmokeSensor=se,o.Service.SmokeSensor=se;var ce=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Volume),o}return i.__extends(t,e),t.UUID="00000113-0000-1000-8000-0026BB765291",t}(o.Service);t.Speaker=ce,o.Service.Speaker=ce;var ue=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addCharacteristic(n.Characteristic.ProgrammableSwitchOutputState),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000088-0000-1000-8000-0026BB765291",t}(o.Service);t.StatefulProgrammableSwitch=ue,o.Service.StatefulProgrammableSwitch=ue;var le=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ProgrammableSwitchEvent),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ServiceLabelIndex),o}return i.__extends(t,e),t.UUID="00000089-0000-1000-8000-0026BB765291",t}(o.Service);t.StatelessProgrammableSwitch=le,o.Service.StatelessProgrammableSwitch=le;var he=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.On),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000049-0000-1000-8000-0026BB765291",t}(o.Service);t.Switch=he,o.Service.Switch=he;var de=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.CryptoHash),o.addCharacteristic(n.Characteristic.TapType),o.addCharacteristic(n.Characteristic.Token),o}return i.__extends(t,e),t.UUID="0000022E-0000-1000-8000-0026BB765291",t}(o.Service);t.TapManagement=de,o.Service.TapManagement=de;var pe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ActiveIdentifier),o.addCharacteristic(n.Characteristic.ButtonEvent),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000125-0000-1000-8000-0026BB765291",t}(o.Service);t.TargetControl=pe,o.Service.TargetControl=pe;var fe=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.TargetControlSupportedConfiguration),o.addCharacteristic(n.Characteristic.TargetControlList),o}return i.__extends(t,e),t.UUID="00000122-0000-1000-8000-0026BB765291",t}(o.Service);t.TargetControlManagement=fe,o.Service.TargetControlManagement=fe;var ge=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.ActiveIdentifier),o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.RemoteKey),o.addCharacteristic(n.Characteristic.SleepDiscoveryMode),o.addOptionalCharacteristic(n.Characteristic.Brightness),o.addOptionalCharacteristic(n.Characteristic.ClosedCaptions),o.addOptionalCharacteristic(n.Characteristic.DisplayOrder),o.addOptionalCharacteristic(n.Characteristic.CurrentMediaState),o.addOptionalCharacteristic(n.Characteristic.TargetMediaState),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.PictureMode),o.addOptionalCharacteristic(n.Characteristic.PowerModeSelection),o}return i.__extends(t,e),t.UUID="000000D8-0000-1000-8000-0026BB765291",t}(o.Service);t.Television=ge,o.Service.Television=ge;var me=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Mute),o.addOptionalCharacteristic(n.Characteristic.Active),o.addOptionalCharacteristic(n.Characteristic.Volume),o.addOptionalCharacteristic(n.Characteristic.VolumeControlType),o.addOptionalCharacteristic(n.Characteristic.VolumeSelector),o}return i.__extends(t,e),t.UUID="00000113-0000-1000-8000-0026BB765291",t}(o.Service);t.TelevisionSpeaker=me,o.Service.TelevisionSpeaker=me;var ve=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.StatusActive),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o.addOptionalCharacteristic(n.Characteristic.StatusLowBattery),o.addOptionalCharacteristic(n.Characteristic.StatusTampered),o}return i.__extends(t,e),t.UUID="0000008A-0000-1000-8000-0026BB765291",t}(o.Service);t.TemperatureSensor=ve,o.Service.TemperatureSensor=ve;var ye=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentHeatingCoolingState),o.addCharacteristic(n.Characteristic.TargetHeatingCoolingState),o.addCharacteristic(n.Characteristic.CurrentTemperature),o.addCharacteristic(n.Characteristic.TargetTemperature),o.addCharacteristic(n.Characteristic.TemperatureDisplayUnits),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.CurrentRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.TargetRelativeHumidity),o.addOptionalCharacteristic(n.Characteristic.CoolingThresholdTemperature),o.addOptionalCharacteristic(n.Characteristic.HeatingThresholdTemperature),o}return i.__extends(t,e),t.UUID="0000004A-0000-1000-8000-0026BB765291",t}(o.Service);t.Thermostat=ye,o.Service.Thermostat=ye;var Ce=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTransport),o.addCharacteristic(n.Characteristic.ThreadControlPoint),o.addCharacteristic(n.Characteristic.ThreadNodeCapabilities),o.addCharacteristic(n.Characteristic.ThreadStatus),o.addOptionalCharacteristic(n.Characteristic.CCAEnergyDetectThreshold),o.addOptionalCharacteristic(n.Characteristic.CCASignalDetectThreshold),o.addOptionalCharacteristic(n.Characteristic.EventRetransmissionMaximum),o.addOptionalCharacteristic(n.Characteristic.EventTransmissionCounters),o.addOptionalCharacteristic(n.Characteristic.MACRetransmissionMaximum),o.addOptionalCharacteristic(n.Characteristic.MACTransmissionCounters),o.addOptionalCharacteristic(n.Characteristic.ReceiverSensitivity),o.addOptionalCharacteristic(n.Characteristic.ReceivedSignalStrengthIndication),o.addOptionalCharacteristic(n.Characteristic.SignalToNoiseRatio),o.addOptionalCharacteristic(n.Characteristic.ThreadOpenThreadVersion),o.addOptionalCharacteristic(n.Characteristic.TransmitPower),o.addOptionalCharacteristic(n.Characteristic.MaximumTransmitPower),o}return i.__extends(t,e),t.UUID="00000701-0000-1000-8000-0026BB765291",t}(o.Service);t.ThreadTransport=Ce,o.Service.ThreadTransport=Ce;var Se=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTime),o.addCharacteristic(n.Characteristic.DayoftheWeek),o.addCharacteristic(n.Characteristic.TimeUpdate),o.addOptionalCharacteristic(n.Characteristic.Name),o}return i.__extends(t,e),t.UUID="00000099-0000-1000-8000-0026BB765291",t}(o.Service);t.TimeInformation=Se,o.Service.TimeInformation=Se;var Ee=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.SupportedTransferTransportConfiguration),o.addCharacteristic(n.Characteristic.SetupTransferTransport),o}return i.__extends(t,e),t.UUID="00000203-0000-1000-8000-0026BB765291",t}(o.Service);t.TransferTransportManagement=Ee,o.Service.TransferTransportManagement=Ee;var _e=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.AccessoryIdentifier),o.addCharacteristic(n.Characteristic.TunnelConnectionTimeout),o.addCharacteristic(n.Characteristic.TunneledAccessoryAdvertising),o.addCharacteristic(n.Characteristic.TunneledAccessoryConnected),o.addCharacteristic(n.Characteristic.TunneledAccessoryStateNumber),o}return i.__extends(t,e),t.UUID="00000056-0000-1000-8000-0026BB765291",t}(o.Service);t.Tunnel=_e,o.Service.TunneledBTLEAccessoryService=_e,o.Service.Tunnel=_e;var Te=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.Active),o.addCharacteristic(n.Characteristic.InUse),o.addCharacteristic(n.Characteristic.ValveType),o.addOptionalCharacteristic(n.Characteristic.IsConfigured),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.RemainingDuration),o.addOptionalCharacteristic(n.Characteristic.ServiceLabelIndex),o.addOptionalCharacteristic(n.Characteristic.SetDuration),o.addOptionalCharacteristic(n.Characteristic.StatusFault),o}return i.__extends(t,e),t.UUID="000000D0-0000-1000-8000-0026BB765291",t}(o.Service);t.Valve=Te,o.Service.Valve=Te;var Ae=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.ConfiguredName),o.addCharacteristic(n.Characteristic.ManagedNetworkEnable),o.addCharacteristic(n.Characteristic.NetworkAccessViolationControl),o.addCharacteristic(n.Characteristic.NetworkClientProfileControl),o.addCharacteristic(n.Characteristic.NetworkClientStatusControl),o.addCharacteristic(n.Characteristic.RouterStatus),o.addCharacteristic(n.Characteristic.SupportedRouterConfiguration),o.addCharacteristic(n.Characteristic.WANConfigurationList),o.addCharacteristic(n.Characteristic.WANStatusList),o}return i.__extends(t,e),t.UUID="0000020A-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiRouter=Ae,o.Service.WiFiRouter=Ae;var Ie=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.WiFiSatelliteStatus),o}return i.__extends(t,e),t.UUID="0000020F-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiSatellite=Ie,o.Service.WiFiSatellite=Ie;var De=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentTransport),o.addCharacteristic(n.Characteristic.WiFiCapabilities),o.addOptionalCharacteristic(n.Characteristic.WiFiConfigurationControl),o}return i.__extends(t,e),t.UUID="0000022A-0000-1000-8000-0026BB765291",t}(o.Service);t.WiFiTransport=De,o.Service.WiFiTransport=De;var we=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o}return i.__extends(t,e),t.UUID="0000008B-0000-1000-8000-0026BB765291",t}(o.Service);t.Window=we,o.Service.Window=we;var be=function(e){function t(r,i){var o=e.call(this,r,t.UUID,i)||this;return o.addCharacteristic(n.Characteristic.CurrentPosition),o.addCharacteristic(n.Characteristic.PositionState),o.addCharacteristic(n.Characteristic.TargetPosition),o.addOptionalCharacteristic(n.Characteristic.CurrentHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetHorizontalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.Name),o.addOptionalCharacteristic(n.Characteristic.ObstructionDetected),o.addOptionalCharacteristic(n.Characteristic.HoldPosition),o.addOptionalCharacteristic(n.Characteristic.CurrentVerticalTiltAngle),o.addOptionalCharacteristic(n.Characteristic.TargetVerticalTiltAngle),o}return i.__extends(t,e),t.UUID="0000008C-0000-1000-8000-0026BB765291",t}(o.Service);t.WindowCovering=be,o.Service.WindowCovering=be},8086:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1635);i.__exportStar(r(651),t),i.__exportStar(r(1647),t)},5579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessoryInfo=t.PermissionTypes=void 0;var i,n=r(1635),o=n.__importDefault(r(2613)),a=n.__importDefault(r(6982)),s=n.__importDefault(r(8947)),c=n.__importDefault(r(9023)),u=r(9593),l=r(4299);function h(){return r(8389).version}!function(e){e[e.USER=0]="USER",e[e.ADMIN=1]="ADMIN"}(i||(t.PermissionTypes=i={}));var d=function(){function e(e){var t=this;this.configVersion=1,this.lastFirmwareVersion="",this.paired=function(){return Object.keys(t.pairedClients).length>0},this.username=e,this.displayName="",this.model="",this.category=1,this.pincode="",this.signSk=Buffer.alloc(0),this.signPk=Buffer.alloc(0),this.pairedClients={},this.pairedAdminClients=0,this.configHash="",this.setupID=""}return e.prototype.addPairedClient=function(e,t,r){this.pairedClients[e]={username:e,publicKey:t,permission:r},1===r&&this.pairedAdminClients++},e.prototype.updatePermission=function(e,t){var r=this.pairedClients[e];if(r){var i=r.permission;r.permission=t,1===i&&1!==t?this.pairedAdminClients--:1!==i&&1===t&&this.pairedAdminClients++}},e.prototype.listPairings=function(){var e,t,r=[];try{for(var i=n.__values(Object.values(this.pairedClients)),o=i.next();!o.done;o=i.next()){var a=o.value;r.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.removePairedClient=function(e,t){var r,i;if(this._removePairedClient0(e,t),0===this.pairedAdminClients)try{for(var o=n.__values(Object.keys(this.pairedClients)),a=o.next();!a.done;a=o.next()){var s=a.value;this._removePairedClient0(e,s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},e.prototype._removePairedClient0=function(e,t){this.pairedClients[t]&&1===this.pairedClients[t].permission&&this.pairedAdminClients--,delete this.pairedClients[t],u.EventedHTTPServer.destroyExistingConnectionsAfterUnpair(e,t)},e.prototype.isPaired=function(e){return!!this.pairedClients[e]},e.prototype.hasAdminPermissions=function(e){if(!e)return!1;var t=this.pairedClients[e];return!!t&&1===t.permission},e.prototype.getClientPublicKey=function(e){var t=this.pairedClients[e];return t?t.publicKey:void 0},e.prototype.checkForCurrentConfigurationNumberIncrement=function(e,t){var r=a.default.createHash("sha1");r.update(JSON.stringify(e));var i=r.digest("hex"),n=!1;if(i!==this.configHash&&(this.configVersion++,this.configHash=i,this.ensureConfigVersionBounds(),n=!0),t){var o=h();this.lastFirmwareVersion!==o&&(this.lastFirmwareVersion=o,n=!0)}return n&&this.save(),n},e.prototype.getConfigVersion=function(){return this.configVersion},e.prototype.ensureConfigVersionBounds=function(){this.configVersion=this.configVersion%65536,0===this.configVersion&&(this.configVersion=1)},e.prototype.save=function(){var t,r,i={displayName:this.displayName,category:this.category,pincode:this.pincode,signSk:this.signSk.toString("hex"),signPk:this.signPk.toString("hex"),pairedClients:{},pairedClientsPermission:{},configVersion:this.configVersion,configHash:this.configHash,setupID:this.setupID,lastFirmwareVersion:this.lastFirmwareVersion};try{for(var o=n.__values(Object.entries(this.pairedClients)),a=o.next();!a.done;a=o.next()){var s=n.__read(a.value,2),c=s[0],u=s[1];i.pairedClients[c]=u.publicKey.toString("hex"),i.pairedClientsPermission[c]=u.permission}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var h=e.persistKey(this.username);l.HAPStorage.storage().setItemSync(h,i)},e.persistKey=function(e){return c.default.format("AccessoryInfo.%s.json",e.replace(/:/g,"").toUpperCase())},e.create=function(t){e.assertValidUsername(t);var r=new e(t);r.lastFirmwareVersion=h();var i=s.default.sign.keyPair();return r.signSk=Buffer.from(i.secretKey),r.signPk=Buffer.from(i.publicKey),r},e.load=function(t){var r,i;e.assertValidUsername(t);var o=e.persistKey(t),a=l.HAPStorage.storage().getItem(o);if(a){var s=new e(t);s.displayName=a.displayName||"",s.category=a.category||"",s.pincode=a.pincode||"",s.signSk=Buffer.from(a.signSk||"","hex"),s.signPk=Buffer.from(a.signPk||"","hex"),s.pairedClients={};try{for(var c=n.__values(Object.keys(a.pairedClients||{})),u=c.next();!u.done;u=c.next()){var d=u.value,p=a.pairedClients[d],f=a.pairedClientsPermission?a.pairedClientsPermission[d]:void 0;void 0===f&&(f=1),s.pairedClients[d]={username:d,publicKey:Buffer.from(p,"hex"),permission:f},1===f&&s.pairedAdminClients++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s.configVersion=a.configVersion||1,s.configHash=a.configHash||"",s.setupID=a.setupID||"",s.lastFirmwareVersion=a.lastFirmwareVersion||h(),s.ensureConfigVersionBounds(),s}return null},e.remove=function(t){var r=e.persistKey(t);l.HAPStorage.storage().removeItemSync(r)},e.assertValidUsername=function(t){o.default.ok(e.deviceIdPattern.test(t),"The supplied username ("+t+") is not valid (expected a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string). Note that, if you had this accessory already paired with the invalid username, you will need to repair the accessory and reconfigure your services in the Home app. Using an invalid username will lead to unexpected behaviour.")},e.deviceIdPattern=/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,e}();t.AccessoryInfo=d},292:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ControllerStorage=void 0;var i=r(1635),n=i.__importDefault(r(9023)),o=i.__importDefault(r(5753)),a=r(4299),s=(0,o.default)("HAP-NodeJS:ControllerStorage"),c=function(){function e(e){this.initialized=!1,this.fileCreated=!1,this.purgeUnidentifiedAccessoryData=!0,this.trackedControllers=[],this.controllerData={},this.accessoryUUID=e.UUID}return e.prototype.enqueueSaveRequest=function(e){var t,r=this;if(void 0===e&&(e=0),this.parent)this.parent.enqueueSaveRequest(e);else{var i=Date.now()+e;if(this.queuedSaveTimeout){if(i<=(null!==(t=this.queuedSaveTime)&&void 0!==t?t:0))return;clearTimeout(this.queuedSaveTimeout)}this.queuedSaveTimeout=setTimeout((function(){r.queuedSaveTimeout=r.queuedSaveTime=void 0,r.save()}),e).unref(),this.queuedSaveTime=Date.now()+e}},e.prototype.linkAccessory=function(e){this.linkedAccessories||(this.linkedAccessories=[]);var t=e.controllerStorage;this.linkedAccessories.push(t),t.parent=this;var r=this.restoredAccessories&&this.restoredAccessories[e.UUID];this.initialized&&t.init(r)},e.prototype.trackController=function(e){e.setupStateChangeDelegate(this.handleStateChange.bind(this,e)),this.initialized?this.restoreController(e):this.trackedControllers.push(e)},e.prototype.untrackController=function(e){var t=this.trackedControllers.indexOf(e);-1!==t&&this.trackedControllers.splice(t,1),e.setupStateChangeDelegate(void 0),this.purgeControllerData(e)},e.prototype.purgeControllerData=function(e){delete this.controllerData[e.controllerId()],this.initialized&&this.enqueueSaveRequest(100)},e.prototype.handleStateChange=function(e){var t=e.controllerId(),r=e.serialize();if(r){var i=this.controllerData[t];i?i.data=r:this.controllerData[t]={data:r}}else delete this.controllerData[t];this.initialized&&this.enqueueSaveRequest(100)},e.prototype.restoreController=function(e){if(!this.initialized)throw new Error("Illegal state. Controller data wasn't loaded yet!");var t=this.controllerData[e.controllerId()];if(t){try{e.deserialize(t.data)}catch(t){console.warn("Could not initialize controller of type '".concat(e.controllerId(),"' from data stored on disk. Resetting to default: ").concat(t.stack)),e.handleFactoryReset()}t.purgeOnNextLoad=void 0}},e.prototype.init=function(e){var t=this;if(this.initialized)throw new Error("ControllerStorage for accessory ".concat(this.accessoryUUID," was already initialized!"));this.initialized=!0,e&&e.forEach((function(e){return t.controllerData[e.type]=e.controllerData}));var r=[];this.trackedControllers.forEach((function(e){t.restoreController(e),r.push(e.controllerId())})),this.trackedControllers.splice(0,this.trackedControllers.length);var n=!1;Object.entries(this.controllerData).forEach((function(e){var o=i.__read(e,2),a=o[0],s=o[1];if(s.purgeOnNextLoad)return delete t.controllerData[a],void(n=!0);r.includes(a)||(s.purgeOnNextLoad=!0)})),n&&this.enqueueSaveRequest(500)},e.prototype.load=function(t){if(this.username)throw new Error("ControllerStorage was already loaded!");this.username=t;var r,i=e.persistKey(t),n=a.HAPStorage.storage().getItem(i);n&&(this.fileCreated=!0,r=n.accessories[this.accessoryUUID],delete n.accessories[this.accessoryUUID]),this.init(r),this.linkedAccessories&&this.linkedAccessories.forEach((function(e){var t=n&&n.accessories[e.accessoryUUID];e.init(t),n&&delete n.accessories[e.accessoryUUID]})),n&&Object.keys(n.accessories).length>0&&(this.purgeUnidentifiedAccessoryData?s("Purging unidentified controller data for bridge %s",t):this.restoredAccessories=n.accessories)},e.prototype.save=function(){var t;if(this.parent)this.parent.save();else{if(!this.initialized)throw new Error("ControllerStorage has not yet been loaded!");if(!this.username)throw new Error("Cannot save controllerData for a storage without a username!");var r=((t={})[this.accessoryUUID]=this.controllerData,t);this.linkedAccessories&&this.linkedAccessories.forEach((function(e){return r[e.accessoryUUID]=e.controllerData}));var n=this.restoredAccessories||{};Object.entries(r).forEach((function(e){var t=i.__read(e,2),r=t[0],o=t[1],a=Object.entries(o);a.length>0&&(n[r]=a.map((function(e){var t=i.__read(e,2);return{type:t[0],controllerData:t[1]}})))}));var o=e.persistKey(this.username);if(Object.keys(n).length>0){var s={accessories:n};this.fileCreated=!0,a.HAPStorage.storage().setItemSync(o,s)}else this.fileCreated&&(this.fileCreated=!1,a.HAPStorage.storage().removeItemSync(o))}},e.persistKey=function(e){return n.default.format("ControllerStorage.%s.json",e.replace(/:/g,"").toUpperCase())},e.remove=function(t){var r=e.persistKey(t);a.HAPStorage.storage().removeItemSync(r)},e}();t.ControllerStorage=c},4299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPStorage=void 0;var i=r(1635).__importDefault(r(3396)),n=function(){function e(){}return e.storage=function(){return this.INSTANCE.storage()},e.setCustomStoragePath=function(e){this.INSTANCE.setCustomStoragePath(e)},e.prototype.storage=function(){return this.localStore||(this.localStore=i.default.create(),this.customStoragePath?this.localStore.initSync({dir:this.customStoragePath}):this.localStore.initSync()),this.localStore},e.prototype.setCustomStoragePath=function(e){if(this.localStore)throw new Error("Cannot change storage path after it has already been initialized!");this.customStoragePath=e},e.INSTANCE=new e,e}();t.HAPStorage=n},2738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierCache=void 0;var i=r(1635),n=i.__importDefault(r(6982)),o=i.__importDefault(r(9023)),a=r(4299),s=function(){function e(e){this.username=e,this._cache={},this._usedCache=null,this._savedCacheHash=""}return e.prototype.startTrackingUsage=function(){this._usedCache={}},e.prototype.stopTrackingUsageAndExpireUnused=function(){this._cache=this._usedCache||this._cache,this._usedCache=null},e.prototype.getCache=function(e){var t=this._cache[e];return this._usedCache&&void 0!==t&&(this._usedCache[e]=t),t},e.prototype.setCache=function(e,t){return this._cache[e]=t,this._usedCache&&(this._usedCache[e]=t),t},e.prototype.getAID=function(e){var t=e;return this.getCache("|nextAID"),this.getCache(t)||this.setCache(t,this.getNextAID())},e.prototype.getIID=function(e,t,r,i){var n=e+"|"+t+(r?"|"+r:"")+(i?"|"+i:"");return this.getCache(e+"|nextIID"),this.getCache(n)||this.setCache(n,this.getNextIID(e))},e.prototype.getNextAID=function(){var e="|nextAID",t=this.getCache(e)||2;return this.setCache(e,t+1),t},e.prototype.getNextIID=function(e){var t=e+"|nextIID",r=this.getCache(t)||2;return this.setCache(t,r+1),r},e.prototype.save=function(){var t=n.default.createHash("sha1").update(JSON.stringify(this._cache)).digest("hex");if(t!==this._savedCacheHash){var r={cache:this._cache},i=e.persistKey(this.username);a.HAPStorage.storage().setItemSync(i,r),this._savedCacheHash=t}},e.persistKey=function(e){return o.default.format("IdentifierCache.%s.json",e.replace(/:/g,"").toUpperCase())},e.load=function(t){var r=e.persistKey(t),i=a.HAPStorage.storage().getItem(r);if(i){var o=new e(t);return o._cache=i.cache,o._savedCacheHash=n.default.createHash("sha1").update(JSON.stringify(o._cache)).digest("hex"),o}return null},e.remove=function(e){var t=this.persistKey(e);a.HAPStorage.storage().removeItemSync(t)},e}();t.IdentifierCache=s},4910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessControlManagement=t.AccessControlEvent=t.AccessLevel=void 0;var i,n,o,a=r(1635),s=r(4434),c=r(9826),u=r(5876),l=a.__importStar(r(3314));!function(e){e[e.PASSWORD=1]="PASSWORD",e[e.PASSWORD_REQUIRED=2]="PASSWORD_REQUIRED"}(i||(i={})),function(e){e[e.ANYONE=0]="ANYONE",e[e.HOME_MEMBERS_ONLY=1]="HOME_MEMBERS_ONLY"}(n||(t.AccessLevel=n={})),function(e){e.ACCESS_LEVEL_UPDATED="update-control-level",e.PASSWORD_SETTING_UPDATED="update-password"}(o||(t.AccessControlEvent=o={}));var h=function(e){function t(t,r){var i=e.call(this)||this;return i.accessLevel=0,i.passwordRequired=!1,i.accessControlService=r||new u.Service.AccessControl,i.setupServiceHandlers(t),i}return a.__extends(t,e),t.prototype.getService=function(){return this.accessControlService},t.prototype.getAccessLevel=function(){return this.accessLevel},t.prototype.getPassword=function(){return this.passwordRequired?this.password:void 0},t.prototype.destroy=function(){this.removeAllListeners(),this.accessControlService.getCharacteristic(c.Characteristic.AccessControlLevel).removeOnSet(),this.accessControlService.testCharacteristic(c.Characteristic.PasswordSetting)&&this.accessControlService.getCharacteristic(c.Characteristic.PasswordSetting).removeOnSet()},t.prototype.handleAccessLevelChange=function(e){var t=this;this.accessLevel=e,setTimeout((function(){t.emit("update-control-level",t.accessLevel)}),0).unref()},t.prototype.handlePasswordChange=function(e){var t=this,r=Buffer.from(e,"base64"),i=l.decode(r);i[1]?this.password=i[1].toString("utf8"):this.password=void 0,this.passwordRequired=!!i[2][0],setTimeout((function(){t.emit("update-password",t.password,t.passwordRequired)}),0).unref()},t.prototype.setupServiceHandlers=function(e){var t=this;this.accessControlService.getCharacteristic(c.Characteristic.AccessControlLevel).onSet((function(e){return t.handleAccessLevelChange(e)})).updateValue(0),e&&this.accessControlService.getCharacteristic(c.Characteristic.PasswordSetting).onSet((function(e){return t.handlePasswordChange(e)})).updateValue("")},t}(s.EventEmitter);t.AccessControlManagement=h},9621:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;var i=r(1635);t.clone=function(e,t){var r,n,o,a,s={};try{for(var c=i.__values(Object.entries(e)),u=c.next();!u.done;u=c.next()){var l=i.__read(u.value,2),h=l[0],d=l[1];s[h]=d}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}if(t)try{for(var p=i.__values(Object.entries(t)),f=p.next();!f.done;f=p.next()){var g=i.__read(f.value,2);h=g[0],d=g[1];s[h]=d}}catch(e){o={error:e}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}return s}},2175:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorUtils=void 0;var i=r(1635).__importDefault(r(2613)),n=new Map([[100,[19,222.1]],[101,[18.7,222.2]],[102,[18.4,222.3]],[103,[18.2,222.3]],[104,[17.9,222.4]],[105,[17.6,222.5]],[106,[17.3,222.7]],[107,[17,222.8]],[108,[16.7,222.9]],[109,[16.4,223]],[110,[16.1,223.2]],[111,[15.8,223.3]],[112,[15.4,223.4]],[113,[15.2,223.6]],[114,[14.9,223.8]],[115,[14.7,223.9]],[116,[14.3,224.1]],[117,[14.1,224.2]],[118,[13.8,224.4]],[119,[13.5,224.6]],[120,[13.2,224.8]],[121,[12.9,225]],[122,[12.5,225.3]],[123,[12.2,225.6]],[124,[11.8,225.9]],[125,[11.4,226.3]],[126,[11.1,226.7]],[127,[10.7,227.1]],[128,[10.3,227.6]],[129,[9.9,228]],[130,[9.6,228.5]],[131,[9.3,229.1]],[132,[8.9,229.6]],[133,[8.5,230.2]],[134,[8.2,230.9]],[135,[7.8,231.6]],[136,[7.5,232.5]],[137,[7.1,233.5]],[138,[6.7,234.6]],[139,[6.3,235.8]],[140,[6,237.1]],[141,[5.6,238.9]],[142,[5.2,240.9]],[143,[5,242.9]],[144,[4.8,244.9]],[145,[4.6,246.9]],[146,[4.4,249.3]],[147,[4.3,251.9]],[148,[4.1,254.9]],[149,[3.9,258]],[150,[3.7,261.8]],[151,[3.4,265.9]],[152,[3.2,271]],[153,[3,276.4]],[154,[2.8,283.6]],[155,[2.6,290.4]],[156,[2.3,295.3]],[157,[2.1,300]],[158,[1.9,300]],[159,[1.6,300]],[160,[1.4,195.8]],[161,[1.2,84.3]],[162,[1.3,58.2]],[163,[1.5,55.9]],[164,[1.7,53.2]],[165,[1.9,50.2]],[166,[2.1,47.1]],[167,[2.4,44.5]],[168,[2.6,42.6]],[169,[2.9,40.9]],[170,[3.1,39.5]],[171,[3.4,38.3]],[172,[3.7,37.3]],[173,[3.9,36.5]],[174,[4.2,35.7]],[175,[4.4,35.1]],[176,[4.6,34.5]],[177,[4.9,34]],[178,[5.1,33.5]],[179,[5.3,33]],[180,[5.6,32.7]],[181,[5.8,32.3]],[182,[6,32]],[183,[6.3,31.7]],[184,[6.5,31.4]],[185,[6.7,31.2]],[186,[7,30.9]],[187,[7.2,30.7]],[188,[7.4,30.5]],[189,[7.6,30.3]],[190,[7.9,30.1]],[191,[8.1,29.9]],[192,[8.4,29.7]],[193,[8.6,29.6]],[194,[8.9,29.5]],[195,[9.1,29.3]],[196,[9.4,29.2]],[197,[9.6,29.1]],[198,[9.8,29]],[199,[10,28.9]],[200,[10.2,28.7]],[201,[10.5,28.7]],[202,[10.7,28.6]],[203,[11,28.5]],[204,[11.2,28.4]],[205,[11.4,28.3]],[206,[11.6,28.3]],[207,[11.8,28.2]],[208,[12.1,28.1]],[209,[12.3,28.1]],[210,[12.5,28]],[211,[12.7,28]],[212,[12.9,27.9]],[213,[13.2,27.8]],[214,[13.4,27.8]],[215,[13.6,27.7]],[216,[13.8,27.7]],[217,[14,27.7]],[218,[14.3,27.6]],[219,[14.5,27.6]],[220,[14.7,27.5]],[221,[14.9,27.5]],[222,[15.1,27.5]],[223,[15.3,27.4]],[224,[15.5,27.4]],[225,[15.8,27.4]],[226,[16,27.3]],[227,[16.2,27.3]],[228,[16.4,27.3]],[229,[16.6,27.3]],[230,[16.8,27.2]],[231,[17,27.2]],[232,[17.2,27.2]],[233,[17.4,27.2]],[234,[17.6,27.2]],[235,[17.8,27.1]],[236,[18,27.1]],[237,[18.2,27.1]],[238,[18.4,27.1]],[239,[18.7,27.1]],[240,[18.8,27]],[241,[19,27]],[242,[19.2,27]],[243,[19.4,27]],[244,[19.6,27]],[245,[19.8,27]],[246,[20,27]],[247,[20.3,26.9]],[248,[20.5,26.9]],[249,[20.6,26.9]],[250,[20.8,26.9]],[251,[21,26.9]],[252,[21.3,26.9]],[253,[21.5,26.9]],[254,[21.6,26.9]],[255,[21.8,26.8]],[256,[22,26.8]],[257,[22.2,26.8]],[258,[22.4,26.8]],[259,[22.6,26.8]],[260,[22.8,26.8]],[261,[23,26.8]],[262,[23.2,26.8]],[263,[23.4,26.8]],[264,[23.6,26.8]],[265,[23.8,26.8]],[266,[24,26.8]],[267,[24.1,26.8]],[268,[24.3,26.8]],[269,[24.5,26.8]],[270,[24.7,26.8]],[271,[24.8,26.8]],[272,[25.1,26.7]],[273,[25.3,26.7]],[274,[25.4,26.7]],[275,[25.6,26.7]],[276,[25.8,26.7]],[277,[26,26.7]],[278,[26.1,26.7]],[279,[26.3,26.7]],[280,[26.5,26.7]],[281,[26.7,26.7]],[282,[26.9,26.7]],[283,[27.1,26.7]],[284,[27.3,26.7]],[285,[27.5,26.7]],[286,[27.7,26.7]],[287,[27.8,26.7]],[288,[28,26.7]],[289,[28.2,26.7]],[290,[28.4,26.7]],[291,[28.6,26.7]],[292,[28.8,26.7]],[293,[28.9,26.7]],[294,[29.1,26.7]],[295,[29.3,26.7]],[296,[29.5,26.7]],[297,[29.6,26.7]],[298,[29.8,26.7]],[299,[30,26.7]],[300,[30.2,26.7]],[301,[30.4,26.7]],[302,[30.5,26.7]],[303,[30.7,26.7]],[304,[30.9,26.7]],[305,[31.1,26.7]],[306,[31.2,26.7]],[307,[31.4,26.7]],[308,[31.6,26.7]],[309,[31.8,26.8]],[310,[31.9,26.8]],[311,[32.1,26.8]],[312,[32.3,26.8]],[313,[32.5,26.8]],[314,[32.6,26.8]],[315,[32.8,26.8]],[316,[33,26.8]],[317,[33.2,26.8]],[318,[33.3,26.8]],[319,[33.5,26.8]],[320,[33.7,26.8]],[321,[33.8,26.8]],[322,[34,26.8]],[323,[34.2,26.8]],[324,[34.4,26.8]],[325,[34.5,26.8]],[326,[34.7,26.8]],[327,[34.9,26.8]],[328,[35.1,26.8]],[329,[35.2,26.8]],[330,[35.4,26.8]],[331,[35.5,26.8]],[332,[35.7,26.8]],[333,[35.9,26.8]],[334,[36.1,26.8]],[335,[36.3,26.9]],[336,[36.5,26.9]],[337,[36.7,26.9]],[338,[36.9,26.9]],[339,[37.1,26.9]],[340,[37.2,26.9]],[341,[37.4,26.9]],[342,[37.5,26.9]],[343,[37.7,26.9]],[344,[37.9,26.9]],[345,[38.1,26.9]],[346,[38.3,26.9]],[347,[38.5,26.9]],[348,[38.7,26.9]],[349,[38.9,26.9]],[350,[39,26.9]],[351,[39.2,26.9]],[352,[39.3,27]],[353,[39.5,27]],[354,[39.7,27]],[355,[39.9,27]],[356,[40.1,27]],[357,[40.2,27]],[358,[40.4,27]],[359,[40.6,27]],[360,[40.8,27]],[361,[40.9,27]],[362,[41.1,27]],[363,[41.2,27]],[364,[41.4,27]],[365,[41.6,27]],[366,[41.8,27]],[367,[42,27]],[368,[42.1,27.1]],[369,[42.3,27.1]],[370,[42.4,27.1]],[371,[42.6,27.1]],[372,[42.8,27.1]],[373,[43,27.1]],[374,[43.1,27.1]],[375,[43.2,27.1]],[376,[43.4,27.1]],[377,[43.6,27.1]],[378,[43.8,27.1]],[379,[43.9,27.1]],[380,[44.1,27.1]],[381,[44.3,27.2]],[382,[44.4,27.2]],[383,[44.6,27.2]],[384,[44.7,27.2]],[385,[44.9,27.2]],[386,[45.1,27.2]],[387,[45.3,27.2]],[388,[45.5,27.2]],[389,[45.6,27.2]],[390,[45.8,27.2]],[391,[46,27.2]],[392,[46.2,27.2]],[393,[46.4,27.3]],[394,[46.5,27.3]],[395,[46.7,27.3]],[396,[46.9,27.3]],[397,[47.1,27.3]],[398,[47.2,27.3]],[399,[47.4,27.3]],[400,[47.6,27.3]],[401,[47.7,27.3]],[402,[47.9,27.3]],[403,[48.1,27.3]],[404,[48.3,27.3]],[405,[48.5,27.4]],[406,[48.7,27.4]],[407,[48.8,27.4]],[408,[49,27.4]],[409,[49.2,27.4]],[410,[49.4,27.4]],[411,[49.6,27.4]],[412,[49.7,27.4]],[413,[49.9,27.4]],[414,[50.1,27.4]],[415,[50.2,27.4]],[416,[50.4,27.4]],[417,[50.6,27.5]],[418,[50.7,27.5]],[419,[50.9,27.5]],[420,[51.1,27.5]],[421,[51.2,27.5]],[422,[51.4,27.5]],[423,[51.6,27.5]],[424,[51.7,27.5]],[425,[51.9,27.5]],[426,[52.1,27.5]],[427,[51.2,27.6]],[428,[52.4,27.6]],[429,[52.5,27.6]],[430,[52.7,27.6]],[431,[52.9,27.6]],[432,[53.1,27.6]],[433,[53.2,27.6]],[434,[53.4,27.6]],[435,[53.6,27.6]],[436,[53.7,27.6]],[437,[53.9,27.6]],[438,[54.1,27.7]],[439,[54.2,27.7]],[440,[54.3,27.7]],[441,[54.5,27.7]],[442,[54.7,27.7]],[443,[54.8,27.7]],[444,[55,27.7]],[445,[55.2,27.7]],[446,[55.3,27.7]],[447,[55.5,27.7]],[448,[55.7,27.7]],[449,[55.8,27.8]],[450,[56,27.8]],[451,[56.2,27.8]],[452,[56.3,27.8]],[453,[56.5,27.8]],[454,[56.7,27.8]],[455,[56.8,27.8]],[456,[57,27.8]],[457,[57.2,27.8]],[458,[57.3,27.9]],[459,[57.4,27.9]],[460,[57.6,27.9]],[461,[57.8,27.9]],[462,[57.9,27.9]],[463,[58.1,27.9]],[464,[58.3,27.9]],[465,[58.4,27.9]],[466,[58.6,27.9]],[467,[58.8,27.9]],[468,[59,28]],[469,[59.1,28]],[470,[59.2,28]],[471,[59.4,28]],[472,[59.6,28]],[473,[59.7,28]],[474,[60,28]],[475,[60.1,28]],[476,[60.2,28]],[477,[60.4,28]],[478,[60.6,28.1]],[479,[60.7,28.1]],[480,[60.9,28.1]],[481,[60.1,28.1]],[482,[60.3,28.1]],[483,[61.4,28.1]],[484,[61.5,28.1]],[485,[61.7,28.1]],[486,[61.9,28.1]],[487,[62,28.2]],[488,[62.2,28.2]],[489,[62.3,28.2]],[490,[62.5,28.2]],[491,[62.7,28.2]],[492,[62.8,28.2]],[493,[63,28.2]],[494,[63.2,28.2]],[495,[63.3,28.2]],[496,[63.4,28.2]],[497,[63.6,28.2]],[498,[63.8,28.3]],[499,[63.9,28.3]],[500,[64.1,28.3]]]),o=function(){function e(){}return e.colorTemperatureToHueAndSaturation=function(e,t){void 0===t&&(t=!0),e>500?e=500:e<100&&(e=100),e=Math.round(e);var r=n.get(e);return(0,i.default)(null!=e,"lookup for temperature "+e+" did not yield any results"),t&&(r[0]=Math.round(r[0]),r[1]=Math.round(r[1])),{saturation:r[0],hue:r[1]}},e}();t.ColorUtils=o},9593:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HAPConnection=t.HAPConnectionEvent=t.HAPConnectionState=t.EventedHTTPServer=t.EventedHTTPServerEvent=t.HAPEncryption=void 0;var i,n=r(1635),o=r(9152),a=n.__importDefault(r(2613)),s=n.__importDefault(r(5753)),c=r(4434),u=n.__importDefault(r(8611)),l=n.__importDefault(r(9278)),h=n.__importDefault(r(857)),d=n.__importStar(r(8)),p=r(47),f=n.__importStar(r(2997)),g=(0,s.default)("HAP-NodeJS:EventedHTTPServer"),m=(0,s.default)("HAP-NodeJS:EventedHTTPServer:Connection"),v=(0,s.default)("HAP-NodeJS:EventEmitter"),y=function(e,t,r,i,n){this.accessoryToControllerCount=0,this.controllerToAccessoryCount=0,this.clientPublicKey=e,this.secretKey=t,this.publicKey=r,this.sharedSecret=i,this.hkdfPairEncryptionKey=n,this.accessoryToControllerKey=Buffer.alloc(0),this.controllerToAccessoryKey=Buffer.alloc(0)};t.HAPEncryption=y,function(e){e.LISTENING="listening",e.CONNECTION_OPENED="connection-opened",e.REQUEST="request",e.CONNECTION_CLOSED="connection-closed"}(i||(t.EventedHTTPServerEvent=i={}));var C,S,E=function(e){function t(){var t=e.call(this)||this;return t.connections=new Set,t.connectionsByUsername=new Map,t.tcpServer=l.default.createServer(),t}return n.__extends(t,e),t.prototype.scheduleNextConnectionIdleTimeout=function(){var e,r;if(this.connectionIdleTimeout=void 0,this.tcpServer.listening){g("Running idle timeout timer...");var i=(new Date).getTime(),o=-1;try{for(var a=n.__values(this.connections),s=a.next();!s.done;s=a.next()){var c=s.value,u=i-c.lastSocketOperation;u>=t.MAX_CONNECTION_IDLE_TIME?(g("[%s] Closing connection as it was inactive for "+u+"ms"),c.close()):o=Math.max(o,t.MAX_CONNECTION_IDLE_TIME-u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}this.connections.size>=t.CONNECTION_TIMEOUT_LIMIT&&(this.connectionIdleTimeout=setTimeout(this.scheduleNextConnectionIdleTimeout.bind(this),o))}},t.prototype.address=function(){return this.tcpServer.address()},t.prototype.listen=function(e,t){var r=this;this.tcpServer.listen(e,t,(function(){var e=r.tcpServer.address();g("Server listening on %s:%s","IPv6"===e.family?"[".concat(e.address,"]"):e.address,e.port),r.connectionLoggingInterval=setInterval((function(){var e=n.__spreadArray([],n.__read(r.connections),!1).map((function(e){return"".concat(e.remoteAddress,":").concat(e.remotePort)})).join(", ");g("Currently %d hap connections open: %s",r.connections.size,e)}),6e4),r.connectionLoggingInterval.unref(),r.emit("listening",e.port,e.address)})),this.tcpServer.on("connection",this.onConnection.bind(this))},t.prototype.stop=function(){var e,t;null!=this.connectionLoggingInterval&&(clearInterval(this.connectionLoggingInterval),this.connectionLoggingInterval=void 0),null!=this.connectionIdleTimeout&&(clearTimeout(this.connectionIdleTimeout),this.connectionIdleTimeout=void 0),this.tcpServer.close();try{for(var r=n.__values(this.connections),i=r.next();!i.done;i=r.next()){i.value.close()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.destroy=function(){this.stop(),this.removeAllListeners()},t.prototype.broadcastEvent=function(e,t,r,i,o){var a,s;try{for(var c=n.__values(this.connections),u=c.next();!u.done;u=c.next()){var l=u.value;l!==i?l.sendEvent(e,t,r,o):g("[%s] Muting event '%s' notification for this connection since it originated here.",l.remoteAddress,e+"."+t)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}},t.prototype.onConnection=function(e){var r=this,i=new _(this,e);i.on("request",(function(e,t){r.emit("request",i,e,t)})),i.on("authenticated",this.handleConnectionAuthenticated.bind(this,i)),i.on("closed",this.handleConnectionClose.bind(this,i)),this.connections.add(i),g("[%s] New connection from client on interface %s (%s)",i.remoteAddress,i.networkInterface,i.localAddress),this.emit("connection-opened",i),this.connections.size>=t.CONNECTION_TIMEOUT_LIMIT&&!this.connectionIdleTimeout&&this.scheduleNextConnectionIdleTimeout()},t.prototype.handleConnectionAuthenticated=function(e,t){var r=this.connectionsByUsername.get(t);r?r.includes(e)||r.push(e):this.connectionsByUsername.set(t,[e])},t.prototype.handleConnectionClose=function(e){if(this.emit("connection-closed",e),this.connections.delete(e),e.username){var t=this.connectionsByUsername.get(e.username);if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1),0===t.length&&this.connectionsByUsername.delete(e.username)}}},t.destroyExistingConnectionsAfterUnpair=function(e,t){var r,i,o=e.server.connectionsByUsername.get(t);if(o)try{for(var a=n.__values(o),s=a.next();!s.done;s=a.next()){s.value.closeConnectionAsOfUnpair(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},t.CONNECTION_TIMEOUT_LIMIT=16,t.MAX_CONNECTION_IDLE_TIME=36e5,t}(c.EventEmitter);t.EventedHTTPServer=E,function(e){e[e.CONNECTING=0]="CONNECTING",e[e.FULLY_SET_UP=1]="FULLY_SET_UP",e[e.AUTHENTICATED=2]="AUTHENTICATED",e[e.TO_BE_TEARED_DOWN=3]="TO_BE_TEARED_DOWN",e[e.CLOSING=4]="CLOSING",e[e.CLOSED=5]="CLOSED"}(C||(t.HAPConnectionState=C={})),function(e){e.REQUEST="request",e.AUTHENTICATED="authenticated",e.CLOSED="closed"}(S||(t.HAPConnectionEvent=S={}));var _=function(e){function t(r,i){var n=e.call(this)||this;return n.state=0,n.lastSocketOperation=(new Date).getTime(),n.pendingClientSocketData=Buffer.alloc(0),n.handlingRequest=!1,n.registeredEvents=new Set,n.queuedEvents=[],n.eventsQueuedForImmediateDelivery=!1,n.server=r,n.sessionID=f.generate(i.remoteAddress+":"+i.remotePort),n.localAddress=i.localAddress,n.remoteAddress=i.remoteAddress,n.remotePort=i.remotePort,n.networkInterface=t.getLocalNetworkInterface(i),n.tcpSocket=i,n.tcpSocket.on("data",n.onTCPSocketData.bind(n)),n.tcpSocket.on("close",n.onTCPSocketClose.bind(n)),n.tcpSocket.on("error",n.onTCPSocketError.bind(n)),n.tcpSocket.setNoDelay(!0),n.internalHttpServer=u.default.createServer(),n.internalHttpServer.timeout=0,n.internalHttpServer.keepAliveTimeout=0,n.internalHttpServer.on("listening",n.onHttpServerListening.bind(n)),n.internalHttpServer.on("request",n.handleHttpServerRequest.bind(n)),n.internalHttpServer.on("error",n.onHttpServerError.bind(n)),n.internalHttpServer.listen(0,n.internalHttpServerAddress=(0,p.getOSLoopbackAddressIfAvailable)()),n}return n.__extends(t,e),t.prototype.debugListenerRegistration=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=-1);var i=(new Error).stack.split("\n")[3],n=this.listeners(e).length,o="authenticated"===e?"\t":"\t\t",a=t?"\t\t":"\t";v("[".concat(this.remoteAddress,"] ").concat(t?"Registered":"Unregistered"," event '").concat(String(e).toUpperCase(),"' ").concat(o,"(total: ").concat(n).concat(t?"":" Before: "+r,") ").concat(a).concat(i))},t.prototype.on=function(t,r){var i=e.prototype.on.call(this,t,r);return this.debugListenerRegistration(t),i},t.prototype.addListener=function(t,r){var i=e.prototype.addListener.call(this,t,r);return this.debugListenerRegistration(t),i},t.prototype.removeListener=function(t,r){var i=this.listeners(t).length,n=e.prototype.removeListener.call(this,t,r);return this.debugListenerRegistration(t,!1,i),n},t.prototype.off=function(t,r){var i=e.prototype.off.call(this,t,r),n=this.listeners(t).length;return this.debugListenerRegistration(t,!1,n),i},t.prototype.connectionAuthenticated=function(e){this.state=2,this.username=e,this.emit("authenticated",e)},t.prototype.isAuthenticated=function(){return 2===this.state},t.prototype.close=function(){this.state>=4||(this.state=4,this.tcpSocket.destroy())},t.prototype.closeConnectionAsOfUnpair=function(e){this===e?this.state=3:this.close()},t.prototype.sendEvent=function(e,t,r,i){(0,a.default)(null!=e,"HAPConnection.sendEvent: aid must be defined!"),(0,a.default)(null!=t,"HAPConnection.sendEvent: iid must be defined!");var n=e+"."+t;if(this.registeredEvents.has(n)){var o={aid:e,iid:t,value:r};if(i)return this.queuedEvents.push(o),this.eventsQueuedForImmediateDelivery=!0,this.eventsTimer&&(clearTimeout(this.eventsTimer),this.eventsTimer=void 0),void this.handleEventsTimeout();for(var s=this.queuedEvents.length-1;s>=0;s--){var c=this.queuedEvents[s];if(c.aid===e&&c.iid===t){if(c.value===r)return;break}}this.queuedEvents.push(o),this.eventsTimer||(this.eventsTimer=setTimeout(this.handleEventsTimeout.bind(this),250),this.eventsTimer.unref())}},t.prototype.handleEventsTimeout=function(){this.eventsTimer=void 0,this.state>2||this.writeQueuedEventNotifications()},t.prototype.writeQueuedEventNotifications=function(){var e,t;if(0!==this.queuedEvents.length&&!this.handlingRequest){this.eventsTimer&&(clearTimeout(this.eventsTimer),this.eventsTimer=void 0);var r={characteristics:[]};try{for(var i=n.__values(this.queuedEvents),o=i.next();!o.done;o=i.next()){var a=o.value;this.registeredEvents.has(a.aid+"."+a.iid)&&r.characteristics.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.queuedEvents.splice(0,this.queuedEvents.length),this.eventsQueuedForImmediateDelivery=!1,this.writeEventNotification(r)}},t.prototype.writeEventNotification=function(e){m("[%s] Sending HAP event notifications %o",this.remoteAddress,e.characteristics),(0,a.default)(!this.handlingRequest,"Can't write event notifications while handling a request!"),e.characteristics.reverse();var t=Buffer.from(JSON.stringify(e),"utf8"),r=Buffer.from("EVENT/1.0 200 OK\r\nContent-Type: application/hap+json\r\nContent-Length: "+t.length+"\r\n\r\n","utf8"),i=Buffer.concat([r,t]);this.tcpSocket.write(this.encrypt(i),this.handleTCPSocketWriteFulfilled.bind(this))},t.prototype.enableEventNotifications=function(e,t){this.registeredEvents.add(e+"."+t)},t.prototype.disableEventNotifications=function(e,t){this.registeredEvents.delete(e+"."+t)},t.prototype.hasEventNotifications=function(e,t){return this.registeredEvents.has(e+"."+t)},t.prototype.getRegisteredEvents=function(){return this.registeredEvents},t.prototype.clearRegisteredEvents=function(){this.registeredEvents.clear()},t.prototype.encrypt=function(e){return this.encryption&&this.encryption.accessoryToControllerKey.length>0&&this.encryption.controllerToAccessoryCount>0?d.layerEncrypt(e,this.encryption):e},t.prototype.decrypt=function(e){return this.encryption&&this.encryption.controllerToAccessoryKey.length>0?d.layerDecrypt(e,this.encryption):e},t.prototype.onHttpServerListening=function(){var e=this,t=this.internalHttpServer.address(),r="IPv6"===t.family?"[".concat(t.address,"]"):t.address;this.internalHttpServerPort=t.port,m("[%s] Internal HTTP server listening on %s:%s",this.remoteAddress,r,t.port),this.internalHttpServer.on("close",this.onHttpServerClose.bind(this)),this.httpSocket=l.default.createConnection(this.internalHttpServerPort,this.internalHttpServerAddress),this.httpSocket.setNoDelay(!0),this.httpSocket.on("data",this.handleHttpServerResponse.bind(this)),this.httpSocket.on("error",this.onHttpSocketError.bind(this)),this.httpSocket.on("close",this.onHttpSocketClose.bind(this)),this.httpSocket.on("connect",(function(){e.state=1,m("[%s] Internal HTTP socket connected. HAPConnection now fully set up!",e.remoteAddress),e.pendingClientSocketData&&e.pendingClientSocketData.length>0&&e.httpSocket.write(e.pendingClientSocketData),e.pendingClientSocketData=void 0}))},t.prototype.onTCPSocketData=function(e){if(!(this.state>2)){this.handlingRequest=!0,this.lastSocketOperation=(new Date).getTime();try{e=this.decrypt(e)}catch(e){return m("[%s] Error occurred trying to decrypt incoming packet: %s",this.remoteAddress,e.message),void this.close()}this.state<1?this.pendingClientSocketData=Buffer.concat([this.pendingClientSocketData,e]):this.httpSocket.write(e)}},t.prototype.handleHttpServerRequest=function(e,t){this.state>2||(m("[%s] HTTP request: %s",this.remoteAddress,e.url),e.socket.setNoDelay(!0),this.emit("request",e,t))},t.prototype.handleHttpServerResponse=function(e){var t=this;e=this.encrypt(e),this.tcpSocket.write(e,this.handleTCPSocketWriteFulfilled.bind(this)),m("[%s] HTTP Response is finished",this.remoteAddress),this.handlingRequest=!1,3===this.state?setTimeout((function(){return t.close()}),10):this.state<3&&(this.eventsTimer&&!this.eventsQueuedForImmediateDelivery||this.writeQueuedEventNotifications())},t.prototype.handleTCPSocketWriteFulfilled=function(){this.lastSocketOperation=(new Date).getTime()},t.prototype.onTCPSocketError=function(e){m("[%s] Client connection error: %s",this.remoteAddress,e.message)},t.prototype.onTCPSocketClose=function(){this.state=5,m("[%s] Client connection closed",this.remoteAddress),this.httpSocket&&this.httpSocket.destroy(),this.internalHttpServer.close(),this.emit("closed"),this.removeAllListeners()},t.prototype.onHttpServerError=function(e){m("[%s] HTTP server error: %s",this.remoteAddress,e.message),"EADDRINUSE"===e.code&&(this.internalHttpServerPort=void 0,this.internalHttpServer.close(),this.internalHttpServer.listen(0,this.internalHttpServerAddress=(0,p.getOSLoopbackAddressIfAvailable)()))},t.prototype.onHttpServerClose=function(){m("[%s] HTTP server was closed",this.remoteAddress),this.close()},t.prototype.onHttpSocketError=function(e){m("[%s] HTTP connection error: ",this.remoteAddress,e.message)},t.prototype.onHttpSocketClose=function(){m("[%s] HTTP connection was closed",this.remoteAddress),this.internalHttpServer.close()},t.prototype.getLocalAddress=function(e){var t,r,i,o,a=h.default.networkInterfaces()[this.networkInterface];if("ipv4"===e){if(a)try{for(var s=n.__values(a),c=s.next();!c.done;c=s.next()){if("IPv4"===(p=c.value).family||4===p.family)return p.address}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw new Error("Could not find "+e+" address for interface "+this.networkInterface)}var u=void 0;if(a)try{for(var l=n.__values(a),d=l.next();!d.done;d=l.next()){var p;if("IPv6"===(p=d.value).family||6===p.family){if(!p.scopeid)return p.address;u||(u=p.address)}}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}if(!u)throw new Error("Could not find "+e+" address for interface "+this.networkInterface);return u},t.getLocalNetworkInterface=function(e){var t,r,i,a,s,c,u,d,p=e.localAddress;if(p.startsWith("::ffff:"))p=p.substring(7);else{var f=p.indexOf("%");-1!==f&&(p=p.substring(0,f))}var g=h.default.networkInterfaces();try{for(var m=n.__values(Object.entries(g)),v=m.next();!v.done;v=m.next()){var y=n.__read(v.value,2),C=y[0];if(I=y[1])try{for(var S=(i=void 0,n.__values(I)),E=S.next();!E.done;E=S.next()){if((U=E.value).address===p)return C}}catch(e){i={error:e}}finally{try{E&&!E.done&&(a=S.return)&&a.call(S)}finally{if(i)throw i.error}}}}catch(e){t={error:e}}finally{try{v&&!v.done&&(r=m.return)&&r.call(m)}finally{if(t)throw t.error}}var _=l.default.isIPv4(p)?"IPv4":"IPv6";try{for(var T=n.__values(Object.entries(g)),A=T.next();!A.done;A=T.next()){var I,D=n.__read(A.value,2);C=D[0];if(I=D[1])try{for(var w=(u=void 0,n.__values(I)),b=w.next();!b.done;b=w.next()){var U;if((U=b.value).family===_&&(0,o.getNetAddress)(p,U.netmask)===(0,o.getNetAddress)(U.address,U.netmask))return C}}catch(e){u={error:e}}finally{try{b&&!b.done&&(d=w.return)&&d.call(w)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{A&&!A.done&&(c=T.return)&&c.call(T)}finally{if(s)throw s.error}}return console.log("WARNING couldn't map socket coming from remote address ".concat(e.remoteAddress,":").concat(e.remotePort," at local address ").concat(e.localAddress," to a interface!")),Object.keys(g)[1]},t}(c.EventEmitter);t.HAPConnection=_},8:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layerDecrypt=t.layerEncrypt=t.chacha20_poly1305_encryptAndSeal=t.chacha20_poly1305_decryptAndVerify=t.writeUInt64LE=t.HKDF=t.generateCurve25519SharedSecKey=t.generateCurve25519KeyPair=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importDefault(r(6982)),a=i.__importDefault(r(6871)),s=i.__importDefault(r(8947));o.default.getCiphers().includes("chacha20-poly1305")||n.default.fail("The cipher 'chacha20-poly1305' is not supported with your current running nodejs version v"+process.version+". At least a nodejs version of v10.17.0 (excluding v11.0 and v11.1) is required!"),t.generateCurve25519KeyPair=function(){return s.default.box.keyPair()},t.generateCurve25519SharedSecKey=function(e,t){return s.default.scalarMult(e,t)},t.HKDF=function(e,t,r,i,n){return(0,a.default)(r,n,{hash:e,salt:t,info:i})};var c=4294967295,u=9007199254740991;function l(e,t,r){void 0===r&&(r=0);var i=function(e){(0,n.default)(e>-1&&e<=u,"number out of range"),(0,n.default)(Math.floor(e)===e,"number must be an integer");var t=0,r=4294967295&e,i=r<0?2147483648+(2147483647&e):r;return e>c&&(t=(e-i)/(c+1)),[t,i]}(e);t.writeUInt32LE(i[1],r),t.writeUInt32LE(i[0],r+4)}function h(e,t,r,i,n){t.length<12&&(t=Buffer.concat([Buffer.alloc(12-t.length,0),t]));var a=o.default.createDecipheriv("chacha20-poly1305",e,t,{authTagLength:16});r&&a.setAAD(r,{plaintextLength:i.length}),a.setAuthTag(n);var s=a.update(i);return a.final(),s}function d(e,t,r,i){t.length<12&&(t=Buffer.concat([Buffer.alloc(12-t.length,0),t]));var n=o.default.createCipheriv("chacha20-poly1305",e,t,{authTagLength:16});r&&n.setAAD(r,{plaintextLength:i.length});var a=n.update(i);return n.final(),{ciphertext:a,authTag:n.getAuthTag()}}t.writeUInt64LE=l,t.chacha20_poly1305_decryptAndVerify=h,t.chacha20_poly1305_encryptAndSeal=d,t.layerEncrypt=function(e,t){for(var r=Buffer.alloc(0),i=e.length,n=0;ni-n-2-16){t.incompleteFrame=e.slice(n);break}var a=Buffer.alloc(8);l(t.controllerToAccessoryCount++,a,0);var s=h(t.controllerToAccessoryKey,a,e.slice(n,n+2),e.slice(n+2,n+2+o),e.slice(n+2+o,n+2+o+16));r=Buffer.concat([r,s]),n+=18+o}return r}},8073:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HapStatusError=void 0;var i=r(1635),n=r(589),o=function(e){function t(r){var i=e.call(this,"HAP Status Error: "+r)||this;return Object.setPrototypeOf(i,t.prototype),(0,n.IsKnownHAPStatusError)(r)?i.hapStatus=r:i.hapStatus=-70402,i}return i.__extends(t,e),t}(Error);t.HapStatusError=o},47:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOSLoopbackAddressIfAvailable=t.getOSLoopbackAddress=t.findLoopbackAddress=void 0;var i=r(1635),n=i.__importDefault(r(857));function o(){var e,t,r,o,a=void 0,s=void 0,c=void 0;try{for(var u=i.__values(Object.entries(n.default.networkInterfaces())),l=u.next();!l.done;l=u.next()){var h=i.__read(l.value,2),d=h[0],p=h[1],f=!1;if(p)try{for(var g=(r=void 0,i.__values(p)),m=g.next();!m.done;m=g.next()){var v=m.value;v.internal&&(f=!0,"IPv4"===v.family||4===v.family?c||(c=v.address):"IPv6"!==v.family&&6!==v.family||(v.scopeid?s||(s=v.address+"%"+d):a||(a=v.address)))}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}if(f)break}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}var y=c||a||s;if(!y)throw new Error("Could not find a valid loopback address on the platform!");return y}t.findLoopbackAddress=o;var a=void 0;t.getOSLoopbackAddress=function(){return null!=a?a:a=o()},t.getOSLoopbackAddressIfAvailable=function(){try{return null!=a?a:a=o()}catch(e){return void console.log(e.stack)}}},7739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.once=void 0;var i=r(1635);t.once=function(e){var t=!1;return function(){for(var r=[],n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.awaitEventOnce=t.PromiseTimeout=void 0,t.PromiseTimeout=function(e){return new Promise((function(t){setTimeout((function(){return t()}),e)}))},t.awaitEventOnce=function(e,t,r){return void 0===r&&(r=5e3),new Promise((function(i,n){var o,a=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numericUpperBound=t.numericLowerBound=t.isIntegerNumericFormat=t.isUnsignedNumericFormat=t.isNumericFormat=t.formatOutgoingCharacteristicValue=void 0,t.formatOutgoingCharacteristicValue=function(e,t){var r;if("boolean"==typeof e)return e?1:0;if("number"==typeof e){if(!t.minStep||t.minStep>=1)return e;var i=null!==(r=t.minValue)&&void 0!==r?r:0,n=1/t.minStep;return Math.round(1e4*(Math.round((e-i)*n)/n+i))/1e4}return e},t.isNumericFormat=function(e){switch(e){case"int":case"float":case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.isUnsignedNumericFormat=function(e){switch(e){case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.isIntegerNumericFormat=function(e){switch(e){case"int":case"uint8":case"uint16":case"uint32":case"uint64":return!0;default:return!1}},t.numericLowerBound=function(e){switch(e){case"int":return-2147483648;case"float":return-Number.MAX_VALUE;case"uint8":case"uint16":case"uint32":case"uint64":return 0;default:throw new Error("Unable to determine numeric lower bound for "+e)}},t.numericUpperBound=function(e){switch(e){case"int":return 2147483647;case"float":return Number.MAX_VALUE;case"uint8":return 255;case"uint16":return 65535;case"uint32":return 4294967295;case"uint64":return 0x10000000000000000;default:throw new Error("Unable to determine numeric lower bound for "+e)}}},1579:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.epochMillisFromMillisSince2001_01_01Buffer=t.epochMillisFromMillisSince2001_01_01=void 0;var i=r(1635).__importDefault(r(2613)),n=r(3314),o=Date.UTC(2001,0,1,0,0,0,0);function a(e){return o+e}t.epochMillisFromMillisSince2001_01_01=a,t.epochMillisFromMillisSince2001_01_01Buffer=function(e){return(0,i.default)(8===e.length,"can only parse 64 bit buffers!"),a((0,n.readUInt64LE)(e))}},3314:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.writeVariableUIntLE=t.readVariableUIntLE=t.readUInt16=t.writeUInt16=t.writeFloat32LE=t.readUInt32=t.writeUInt32=t.readUInt64BE=t.readUInt64LE=t.readUInt64=t.writeUInt64=t.decodeList=t.decodeWithLists=t.decode=t.encode=void 0;var i=r(1635),n=i.__importDefault(r(2613)),o=i.__importStar(r(8));function a(e,t){void 0===t&&(t=0);var r=e.readUInt32LE(t);return 4294967296*e.readUInt32LE(t+4)+r}function s(e){var t=Buffer.alloc(4);return t.writeUInt32LE(e,0),t}function c(e){var t=Buffer.alloc(2);return t.writeUInt16LE(e,0),t}t.encode=function e(t,r){for(var n,o,a=[],s=2;s0;)p>=255?(c.push(Buffer.concat([Buffer.from([t,255]),r.slice(f,f+255)])),p-=255,f+=255):(c.push(Buffer.concat([Buffer.from([t,p]),r.slice(f)])),p-=p);if(a.length>=2){var g=i.__read(a),m=g[0],v=g[1],y=g.slice(2),C=e.apply(void 0,i.__spreadArray([m,v],i.__read(y),!1));c.push(C)}return Buffer.concat(c)},t.decode=function(e){(0,n.default)(e instanceof Buffer,"Illegal argument. tlv.decode() expects Buffer type!");for(var t={},r=e.length,i=0;r>0;){var o=e[i],a=e[i+1];i+=2,r-=2;var s=e.slice(i,i+a);t[o]?t[o]=Buffer.concat([t[o],s]):t[o]=s,i+=a,r-=a}return t},t.decodeWithLists=function(e){for(var t={},r=e.length,i=0,n=-1,o=-1,a=!1;r>0;){var s=e.readUInt8(i++),c=e.readUInt8(i++);r-=2;var u=e.slice(i,i+c);if(i+=c,r-=c,0!==s||0!==c){var l=t[s];if(l)if(a&&n===s)Array.isArray(l)?l.push(u):t[s]=[l,u];else{if(n!==s||255!==o)throw new Error("Found duplicated tlv entry with type ".concat(s," and length ").concat(c," (lastItemWasDelimiter: ").concat(a,", lastType: ").concat(n,", lastLength: ").concat(o,")"));if(Array.isArray(l)){var h=l[l.length-1];l[l.length-1]=Buffer.concat([h,u])}else t[s]=Buffer.concat([l,u])}else t[s]=u;n=s,o=c,a=!1}else a=!0}return t},t.decodeList=function(e,t){for(var r=[],i=e.length,n=0,o=void 0;i>0;){var a=e[n],s=e[n+1],c=e.slice(n+2,n+2+s);if(a===t&&(void 0!==o&&r.push(o),o={}),void 0===o)throw new Error("Error parsing tlv list: Encountered uninitialized storage object");o[a]?o[a]=Buffer.concat([o[a],c]):o[a]=c,n+=2+s,i-=2+s}return void 0!==o&&r.push(o),r},t.writeUInt64=function(e){var t=new Float64Array(1);t[0]=e;for(var r=Buffer.alloc(t.buffer.byteLength),i=new Uint8Array(t.buffer),n=0;n=0,"Can't encode a negative integer as unsigned integer"),(0,n.default)(0===t,"Can't define a offset different than 0!"),e<=255)return(r=Buffer.alloc(1)).writeUInt8(e,t),r;if(e<=65535)return c(e);if(e<=4294967295)return s(e);var r=Buffer.alloc(8);return o.writeUInt64LE(e,r,t),r}},2997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toLongForm=t.toShortForm=t.write=t.unparse=t.isValid=t.generate=t.BASE_UUID=void 0;var i=r(1635).__importDefault(r(6982));t.BASE_UUID="-0000-1000-8000-0026BB765291",t.generate=function(e){var t=i.default.createHash("sha1");t.update(e);var r=t.digest("hex"),n=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){return n+=1,"y"===e?(3&parseInt("0x"+r[n],16)|8).toString(16):r[n]}))};var n=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function o(e){return n.test(e)}t.isValid=o,t.unparse=function(e,t){if(void 0===t&&(t=0),"string"==typeof e&&o(e))return e;var r=t;return e.toString("hex",r,r+=4)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+=2)+"-"+e.toString("hex",r,r+6)},t.write=function(e,t,r){void 0===r&&(r=0);var i=Buffer.from(e.replace(/-/g,""),"hex");return t?(i.copy(t,r),t):i};var a=/^0*([0-9a-f]{1,8})-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i;t.toShortForm=function(e,r){if(void 0===r&&(r=t.BASE_UUID),!o(e))throw new TypeError("uuid was not a valid UUID or short form UUID");if(r&&!o("00000000"+r))throw new TypeError("base was not a valid base UUID");return r&&!e.endsWith(r)?e.toUpperCase():e.replace(a,"$1").toUpperCase()};var s=/^[0-9a-f]{1,8}$/i;t.toLongForm=function(e,r){if(void 0===r&&(r=t.BASE_UUID),o(e))return e.toUpperCase();if(!s.test(e))throw new TypeError("uuid was not a valid UUID or short form UUID");if(!o("00000000"+r))throw new TypeError("base was not a valid base UUID");return(("00000000"+e).substr(-8)+r).toUpperCase()}},7506:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=7506,e.exports=t},4310:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceRequestType=void 0,function(e){e.IMAGE="image"}(r||(t.ResourceRequestType=r={}))},9790:e=>{"use strict";var t="undefined"!=typeof BigInt&&BigInt;e.exports=function(){return"function"==typeof t&&"function"==typeof BigInt&&"bigint"==typeof t(42)&&"bigint"==typeof BigInt(42)}},5884:e=>{"use strict";e.exports=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",i=t.indexOf(r+e),n=t.indexOf("--");return-1!==i&&(-1===n||i{"use strict";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},24:e=>{"use strict";var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},4039:(e,t,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(1333);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},1333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},9092:(e,t,r)=>{"use strict";var i=r(1333);e.exports=function(){return i()&&!!Symbol.toStringTag}},9957:(e,t,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(6743);e.exports=o.call(i,n)},7244:(e,t,r)=>{"use strict";var i=r(9092)(),n=r(8075)("Object.prototype.toString"),o=function(e){return!(i&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===n(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==n(e)&&"[object Function]"===n(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},4670:(e,t,r)=>{"use strict";var i=r(487),n=r(8075),o=r(453)("%ArrayBuffer%",!0),a=n("ArrayBuffer.prototype.byteLength",!0),s=n("Object.prototype.toString"),c=!!o&&!a&&new o(0).slice,u=!!c&&i(c);e.exports=a||u?function(e){if(!e||"object"!=typeof e)return!1;try{return a?a(e):u(e,0),!0}catch(e){return!1}}:o?function(e){return"[object ArrayBuffer]"===s(e)}:function(e){return!1}},9803:(e,t,r)=>{"use strict";if(r(9790)()){var i=BigInt.prototype.valueOf;e.exports=function(e){return null!=e&&"boolean"!=typeof e&&"string"!=typeof e&&"number"!=typeof e&&"symbol"!=typeof e&&"function"!=typeof e&&("bigint"==typeof e||function(e){try{return i.call(e),!0}catch(e){}return!1}(e))}}else e.exports=function(e){return!1}},5128:(e,t,r)=>{"use strict";var i=r(8075),n=i("Boolean.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();e.exports=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(a&&Symbol.toStringTag in e?function(e){try{return n(e),!0}catch(e){return!1}}(e):"[object Boolean]"===o(e))}},9600:e=>{"use strict";var t,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n((function(){throw 42}),null,t)}catch(e){e!==r&&(n=null)}else n=null;var o=/^\s*class\b/,a=function(e){try{var t=i.call(e);return o.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(i.call(e),!0)}catch(e){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var d=document.all;c.call(d)===c.call(document.all)&&(h=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=n?function(e){if(h(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{n(e,null,t)}catch(e){if(e!==r)return!1}return!a(e)&&s(e)}:function(e){if(h(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(a(e))return!1;var t=c.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},2120:(e,t,r)=>{"use strict";var i=Date.prototype.getDay,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"object"==typeof e&&null!==e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object Date]"===n.call(e))}},3802:e=>{"use strict";var t,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;r||(t=function(e){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;t||n||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(n.call(e),o)try{o.call(e)}catch(e){return!0}return e instanceof r}catch(e){}return!1}},1703:(e,t,r)=>{"use strict";var i=Number.prototype.toString,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"number"==typeof e||"object"==typeof e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object Number]"===n.call(e))}},4035:(e,t,r)=>{"use strict";var i,n,o,a,s=r(8075),c=r(9092)();if(c){i=s("Object.prototype.hasOwnProperty"),n=s("RegExp.prototype.exec"),o={};var u=function(){throw o};a={toString:u,valueOf:u},"symbol"==typeof Symbol.toPrimitive&&(a[Symbol.toPrimitive]=u)}var l=s("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;e.exports=c?function(e){if(!e||"object"!=typeof e)return!1;var t=h(e,"lastIndex");if(!(t&&i(t,"value")))return!1;try{n(e,a)}catch(e){return e===o}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===l(e)}},256:e=>{"use strict";var t,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;i||(t=function(e){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;t||o||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(o.call(e),n)try{n.call(e)}catch(e){return!0}return e instanceof i}catch(e){}return!1}},7070:(e,t,r)=>{"use strict";var i=r(8075)("SharedArrayBuffer.prototype.byteLength",!0);e.exports=i?function(e){if(!e||"object"!=typeof e)return!1;try{return i(e),!0}catch(e){return!1}}:function(e){return!1}},4761:(e,t,r)=>{"use strict";var i=String.prototype.valueOf,n=Object.prototype.toString,o=r(9092)();e.exports=function(e){return"string"==typeof e||"object"==typeof e&&(o?function(e){try{return i.call(e),!0}catch(e){return!1}}(e):"[object String]"===n.call(e))}},3612:(e,t,r)=>{"use strict";var i=Object.prototype.toString;if(r(4039)()){var n=Symbol.prototype.toString,o=/^Symbol\(.*\)$/;e.exports=function(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==i.call(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&o.test(n.call(e))}(e)}catch(e){return!1}}}else e.exports=function(e){return!1}},7842:e=>{"use strict";var t,r="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;r||(t=function(e){return!1});var n=r?r.prototype.has:null,o=i?i.prototype.has:null;t||n||(t=function(e){return!1}),e.exports=t||function(e){if(!e||"object"!=typeof e)return!1;try{if(n.call(e,n),o)try{o.call(e,o)}catch(e){return!0}return e instanceof r}catch(e){}return!1}},2648:(e,t,r)=>{"use strict";var i=r(453),n=r(8075),o=i("%WeakSet%",!0),a=n("WeakSet.prototype.has",!0);if(a){var s=n("WeakMap.prototype.has",!0);e.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(a(e,a),s)try{s(e,s)}catch(e){return!0}return e instanceof o}catch(e){}return!1}}else e.exports=function(e){return!1}},4634:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},9292:(e,t,r)=>{var i=r(2203).Stream;e.exports=function(e,t){var r=new i,n=0,o=0,a=!1,s=!1,c=!1,u=0,l=!1,h=(t=t||{}).failures?"failure":"error",d={};function p(e,t){var i=u+1;if(t===i?(void 0!==e&&r.emit.apply(r,["data",e]),u++,i++):d[t]=e,d.hasOwnProperty(i)){var c=d[i];return delete d[i],p(c,i)}o++,n===o&&(s&&(s=!1,r.emit("drain")),a&&g())}function f(e,i,n){c||(l=!0,e&&!t.failures||p(i,n),e&&r.emit.apply(r,[h,e]),l=!1)}function g(e){if(a=!0,r.writable=!1,void 0!==e)return p(e,n);n==o&&(r.readable=!1,r.emit("end"),r.destroy())}return r.writable=!0,r.readable=!0,r.write=function(t){if(a)throw new Error("map stream is not writable");l=!1,n++;try{var r=(i=t,o=n,c=f,e.call(null,i,(function(e,t){c(e,t,o)})));return!(s=!1===r)}catch(e){if(l)throw e;return f(e),!s}var i,o,c},r.end=function(e){a||g(e)},r.destroy=function(){a=c=!0,r.writable=r.readable=s=!1,process.nextTick((function(){r.emit("close")}))},r.pause=function(){s=!0},r.resume=function(){s=!1},r}},3480:(e,t,r)=>{var i=r(6928),n=r(9896),o=parseInt("0777",8);function a(e,t,r,s){"function"==typeof t?(r=t,t={}):t&&"object"==typeof t||(t={mode:t});var c=t.mode,u=t.fs||n;void 0===c&&(c=o),s||(s=null);var l=r||function(){};e=i.resolve(e),u.mkdir(e,c,(function(r){if(!r)return l(null,s=s||e);if("ENOENT"===r.code){if(i.dirname(e)===e)return l(r);a(i.dirname(e),t,(function(r,i){r?l(r,i):a(e,t,l,i)}))}else u.stat(e,(function(e,t){e||!t.isDirectory()?l(r,s):l(null,s)}))}))}e.exports=a.mkdirp=a.mkdirP=a,a.sync=function e(t,r,a){r&&"object"==typeof r||(r={mode:r});var s=r.mode,c=r.fs||n;void 0===s&&(s=o),a||(a=null),t=i.resolve(t);try{c.mkdirSync(t,s),a=a||t}catch(n){if("ENOENT"===n.code)a=e(i.dirname(t),r,a),e(t,r,a);else{var u;try{u=c.statSync(t)}catch(e){throw n}if(!u.isDirectory())throw n}}return a}},6585:e=>{var t=1e3,r=60*t,i=60*r,n=24*i,o=7*n,a=365.25*n;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*i;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=n)return s(e,o,n,"day");if(o>=i)return s(e,o,i,"hour");if(o>=r)return s(e,o,r,"minute");if(o>=t)return s(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=n)return Math.round(e/n)+"d";if(o>=i)return Math.round(e/i)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},2781:(e,t)=>{var r=function(e){return"_"+e},i=function(e){return e};t.stringify=function(e){return"object"==typeof e&&e&&e.name?t.stringify(e.name,e.protocol,e.subtypes):Array.prototype.concat.apply([],arguments).filter(i).map(r).join(".")},t.parse=function(e){for(var t=e.split("."),r=0;r{var i=r(3843),n=r(7194),o=r(294),a=r(4434),s=r(857),c=function(){};function u(e){return 4===e||"IPv4"===e}e.exports=function(e){e||(e={});var t=new a.EventEmitter,r="number"==typeof e.port?e.port:5353,l=e.type||"udp4",h=e.ip||e.host||("udp4"===l?"224.0.0.251":null),d={address:h,port:r},p={},f=!1,g=null;if(!("udp6"!==l||h&&e.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var m=e.socket||n.createSocket({type:l,reuseAddr:!1!==e.reuseAddr,toString:function(){return l}});m.on("error",(function(e){"EACCES"===e.code||"EADDRINUSE"===e.code?t.emit("error",e):t.emit("warning",e)})),m.on("message",(function(e,r){try{e=i.decode(e)}catch(e){return void t.emit("warning",e)}t.emit("packet",e,r),"query"===e.type&&t.emit("query",e,r),"response"===e.type&&t.emit("response",e,r)})),m.on("listening",(function(){r||(r=d.port=m.address().port),!1!==e.multicast&&(t.update(),g=setInterval(t.update,5e3),m.setMulticastTTL(e.ttl||255),m.setMulticastLoopback(!1!==e.loopback))}));var v=o((function(t){if(!r||!1===e.bind)return t(null);m.once("error",t),m.bind(r,e.bind||e.interface,(function(){m.removeListener("error",t),t(null)}))}));return v((function(e){if(e)return t.emit("error",e);t.emit("ready")})),t.send=function(e,r,n){if("function"==typeof r)return t.send(e,null,r);n||(n=c),r?r.host||r.address||(r.address=d.address):r=d,v((function(t){if(f)return n();if(t)return n(t);var o=i.encode(e);m.send(o,0,o.length,r.port,r.address||r.host,n)}))},t.response=t.respond=function(e,r,n){Array.isArray(e)&&(e={answers:e}),e.type="response",e.flags=(e.flags||0)|i.AUTHORITATIVE_ANSWER,t.send(e,r,n)},t.query=function(e,r,i,n){return"function"==typeof r?t.query(e,null,null,r):"object"==typeof r&&r&&r.port?t.query(e,null,r,i):"function"==typeof i?t.query(e,r,null,i):(n||(n=c),"string"==typeof e&&(e=[{name:e,type:r||"ANY"}]),Array.isArray(e)&&(e={type:"query",questions:e}),e.type="query",void t.send(e,i,n))},t.destroy=function(e){if(e||(e=c),f)return process.nextTick(e);for(var t in f=!0,clearInterval(g),p)try{m.dropMembership(h,t)}catch(e){}p={},m.close(e)},t.update=function(){for(var r=e.interface?[].concat(e.interface):function(){for(var e=s.networkInterfaces(),t=Object.keys(e),r=[],i=0;i{var i=r(9896),n=r(6928),o=r(3480),a=r(3231),s={dir:"persist",stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,continuous:!0,interval:!1,ttl:!1},c=function(e){return"function"==typeof e},u=function(e){if(e)throw e},l=function(){},h=function(e){if(!(this instanceof h))return new h(e);this.data={},this.ttls={},this.changes={},this.setOptions(e)};h.prototype={setOptions:function(e){var t,r={};if(e){for(var i in s)e.hasOwnProperty(i)?r[i]=e[i]:r[i]=s[i];r.dir=this.resolveDir(r.dir),r.ttlDir=r.dir+"-ttl",r.ttl=!!r.ttl&&(t=r.ttl,!isNaN(parseFloat(t))&&isFinite(t)&&r.ttl>0?r.ttl:864e5)}else r=s;c(r.logging)&&(this.log=r.logging,r.logging=!0),this.options=r},init:function(e,t){c(e)&&(t=e,e=null),e&&this.setOptions(e),t=c(t)?t:u;var r=a.defer(),i=[],n=this.options,o={dir:n.dir};return i.push(this.parseDataDir()),n.ttl&&(o.ttlDir=n.ttlDir,i.push(this.parseTTLDir())),n.interval&&n.interval>0&&(this._persistInterval=setInterval(this.persist.bind(this),n.interval)),a.all(i).then((function(){r.resolve(o),t(null,o)}),(function(e){r.reject(e),t(e)})),r.promise},initSync:function(e){e&&this.setOptions(e);var t=this.options;t.logging&&(this.log("options:"),this.log(t.stringify(t))),this.parseDataDirSync(),t.ttl&&this.parseTTLDirSync(),t.interval&&t.interval>0&&(this._persistInterval=setInterval(this.persistSync.bind(this),t.interval))},key:function(e){var t=this.keys();return t.length<=e?null:t[e]},keys:function(){return Object.keys(this.data)},length:function(){return this.keys().length},forEach:function(e){return this.keys().forEach(function(t){e(t,this.data[t])}.bind(this))},values:function(e){e=c(e)?e:l;var t=this.keys().map(function(e){return this.data[e]}.bind(this));return e(t),t},valuesWithKeyMatch:function(e,t){t=c(t)?t:l;var r=(e=e||/.*/)instanceof RegExp?function(t){return e.test(t)}:function(t){return-1!==t.indexOf(e)},i=[];return this.keys().forEach(function(e){r(e)&&i.push(this.data[e])}.bind(this)),t(i),i},setItem:function(e,t,r){r=c(r)?r:u;var i,n=this.options,o="set ("+e+": "+n.stringify(t)+")",s=a.defer(),l=[];this.data[e]=t,n.ttl&&(this.ttls[e]=(new Date).getTime()+n.ttl),i={key:e,value:t,queued:!!n.interval,manual:!n.interval&&!n.continuous};return this.log(o),n.interval||!n.continuous?this.changes[e]={onSuccess:function(){r(null,i),s.resolve(i)},onError:function(e){r(e),s.reject(e)}}:(l.push(this.persistKey(e)),a.all(l).then(function(e){s.resolve(e),r(null,e)}.bind(this),(function(e){s.reject(e),r(e)}))),s.promise},setItemSync:function(e,t){this.data[e]=t,this.options.ttl&&(this.ttls[e]=(new Date).getTime()+this.options.ttl),this.persistKeySync(e),this.log("set ("+e+": "+this.options.stringify(t)+")")},getItem:function(e,t){if(t=c(t)?t:u,!this.isExpired(e))return t(null,this.data[e]),this.data[e];this.log(e+" has expired"),!this.options.interval&&this.options.continuous?this.removeItem(e,(function(){t(null,null)})):t(null,null)},getItemSync:function(e){if(!this.isExpired(e))return this.data[e];this.removeItemSync(e)},removeItem:function(e,t){t=c(t)?t:u;var r=a.defer(),i=[];return i.push(this.removePersistedKey(e)),a.all(i).then(function(){delete this.data[e],delete this.ttls[e],this.log("removed: "+e),t(null,this.data),r.resolve(this.data)}.bind(this),(function(e){t(e),r.reject(e)})),r.promise},removeItemSync:function(e){this.removePersistedKeySync(e),delete this.data[e],delete this.ttls[e],this.log("removed: "+e)},clear:function(e){e=c(e)?e:u;for(var t=a.defer(),r=[],i=this.keys(),n=0;n{var i=r(1566);!function(e){var t;e.create=function(e){return i(e)},e.init=function(r,i){return(t=e.create(r)).init(i)},e.initSync=function(r){return(t=e.create(r)).initSync()},e.key=function(e){return t.key(e)},e.keys=function(){return t.keys()},e.length=function(){return t.length()},e.forEach=function(e){return t.forEach(e)},e.values=function(e){return t.values(e)},e.valuesWithKeyMatch=function(e,r){return t.valuesWithKeyMatch(e,r)},e.setItem=function(e,r,i){return t.setItem(e,r,i)},e.setItemSync=function(e,r){return t.setItemSync(e,r)},e.getItem=function(e,r){return t.getItem(e,r)},e.getItemSync=function(e){return t.getItemSync(e)},e.removeItem=function(e,r){return t.removeItem(e,r)},e.removeItemSync=function(e){return t.removeItemSync(e)},e.clear=function(e){return t.clear(e)},e.clearSync=function(){return t.clearSync()},e.persist=function(e){return t.persist(e)},e.persistSync=function(){return t.persistSync()},e.persistKey=function(e,r){return t.persistKey(e,r)},e.persistKeySync=function(e){return t.persistKeySync(e)}}(e.exports)},8859:(e,t,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=i&&n&&"function"==typeof n.get?n.get:null,a=i&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=s&&c&&"function"==typeof c.get?c.get:null,l=s&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,v=String.prototype.match,y=String.prototype.slice,C=String.prototype.replace,S=String.prototype.toUpperCase,E=String.prototype.toLowerCase,_=RegExp.prototype.test,T=Array.prototype.concat,A=Array.prototype.join,I=Array.prototype.slice,D=Math.floor,w="function"==typeof BigInt?BigInt.prototype.valueOf:null,b=Object.getOwnPropertySymbols,U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,R="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===R||"symbol")?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,P=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function B(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||_.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-D(-e):D(e);if(i!==e){var n=String(i),o=y.call(t,n.length+1);return C.call(n,r,"$&_")+"."+C.call(C.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return C.call(t,r,"$&_")}var L=r(8093),x=L.custom,M=j(x)?x:null;function F(e,t,r){var i="double"===(r.quoteStyle||t)?'"':"'";return i+e+i}function k(e){return C.call(String(e),/"/g,""")}function V(e){return!("[object Array]"!==Y(e)||O&&"object"==typeof e&&O in e)}function H(e){return!("[object RegExp]"!==Y(e)||O&&"object"==typeof e&&O in e)}function j(e){if(R)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!U)return!1;try{return U.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,i,n){var s=r||{};if(W(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!W(s,"customInspect")||s.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var g=s.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return K(t,s);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var S=String(t);return g?B(t,S):S}if("bigint"==typeof t){var _=String(t)+"n";return g?B(t,_):_}var D=void 0===s.depth?5:s.depth;if(void 0===i&&(i=0),i>=D&&D>0&&"object"==typeof t)return V(t)?"[Array]":"[Object]";var b=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=A.call(Array(e.indent+1)," ")}return{base:r,prev:A.call(Array(t+1),r)}}(s,i);if(void 0===n)n=[];else if(q(n,t)>=0)return"[Circular]";function x(t,r,o){if(r&&(n=I.call(n)).push(r),o){var a={depth:s.depth};return W(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),e(t,a,i+1,n)}return e(t,s,i+1,n)}if("function"==typeof t&&!H(t)){var G=function(e){if(e.name)return e.name;var t=v.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),$=Z(t,x);return"[Function"+(G?": "+G:" (anonymous)")+"]"+($.length>0?" { "+A.call($,", ")+" }":"")}if(j(t)){var ee=R?C.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):U.call(t);return"object"!=typeof t||R?ee:z(ee)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var te="<"+E.call(String(t.nodeName)),re=t.attributes||[],ie=0;ie"}if(V(t)){if(0===t.length)return"[]";var ne=Z(t,x);return b&&!function(e){for(var t=0;t=0)return!1;return!0}(ne)?"["+J(ne,b)+"]":"[ "+A.call(ne,", ")+" ]"}if(function(e){return!("[object Error]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t)){var oe=Z(t,x);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===oe.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(oe,", ")+" }":"{ ["+String(t)+"] "+A.call(T.call("[cause]: "+x(t.cause),oe),", ")+" }"}if("object"==typeof t&&c){if(M&&"function"==typeof t[M]&&L)return L(t,{depth:D-i});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{u.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return a&&a.call(t,(function(e,r){ae.push(x(r,t,!0)+" => "+x(e,t))})),X("Map",o.call(t),ae,b)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var se=[];return l&&l.call(t,(function(e){se.push(x(e,t))})),X("Set",u.call(t),se,b)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Q("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{h.call(e,h)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Q("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return Q("WeakRef");if(function(e){return!("[object Number]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(x(Number(t)));if(function(e){if(!e||"object"!=typeof e||!w)return!1;try{return w.call(e),!0}catch(e){}return!1}(t))return z(x(w.call(t)));if(function(e){return!("[object Boolean]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(f.call(t));if(function(e){return!("[object String]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t))return z(x(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||"undefined"!=typeof global&&t===global)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==Y(e)||O&&"object"==typeof e&&O in e)}(t)&&!H(t)){var ce=Z(t,x),ue=P?P(t)===Object.prototype:t instanceof Object||t.constructor===Object,le=t instanceof Object?"":"null prototype",he=!ue&&O&&Object(t)===t&&O in t?y.call(Y(t),8,-1):le?"Object":"",de=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(he||le?"["+A.call(T.call([],he||[],le||[]),": ")+"] ":"");return 0===ce.length?de+"{}":b?de+"{"+J(ce,b)+"}":de+"{ "+A.call(ce,", ")+" }"}return String(t)};var G=Object.prototype.hasOwnProperty||function(e){return e in this};function W(e,t){return G.call(e,t)}function Y(e){return g.call(e)}function q(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,i=e.length;rt.maxStringLength){var r=e.length-t.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return K(y.call(e,0,t.maxStringLength),t)+i}return F(C.call(C.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$),"single",t)}function $(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+S.call(t.toString(16))}function z(e){return"Object("+e+")"}function Q(e){return e+" { ? }"}function X(e,t,r,i){return e+" ("+t+") {"+(i?J(r,i):A.call(r,", "))+"}"}function J(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+A.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=V(e),i=[];if(r){i.length=e.length;for(var n=0;n{e.exports=r(9023).inspect},9211:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},7653:(e,t,r)=>{"use strict";var i=r(8452),n=r(487),o=r(9211),a=r(9394),s=r(6576),c=n(a(),Object);i(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},9394:(e,t,r)=>{"use strict";var i=r(9211);e.exports=function(){return"function"==typeof Object.is?Object.is:i}},6576:(e,t,r)=>{"use strict";var i=r(9394),n=r(8452);e.exports=function(){var e=i();return n(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8875:(e,t,r)=>{"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1093),s=Object.prototype.propertyIsEnumerable,c=!s.call({toString:null},"toString"),u=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},d={$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},p=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!d["$"+e]&&n.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{h(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();i=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),i=a(e),s=t&&"[object String]"===o.call(e),d=[];if(!t&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var f=u&&r;if(s&&e.length>0&&!n.call(e,0))for(var g=0;g0)for(var m=0;m{"use strict";var i=Array.prototype.slice,n=r(1093),o=Object.keys,a=o?function(e){return o(e)}:r(8875),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return n(e)?s(i.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1093:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),i}},8403:(e,t,r)=>{"use strict";var i=r(1189),n=r(1333)(),o=r(8075),a=Object,s=o("Array.prototype.push"),c=o("Object.prototype.propertyIsEnumerable"),u=n?Object.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var r=a(e);if(1===arguments.length)return r;for(var o=1;o{"use strict";var i=r(8452),n=r(487),o=r(8403),a=r(1514),s=r(984),c=n.apply(a()),u=function(e,t){return c(Object,arguments)};i(u,{getPolyfill:a,implementation:o,shim:s}),e.exports=u},1514:(e,t,r)=>{"use strict";var i=r(8403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i{"use strict";var i=r(8452),n=r(1514);e.exports=function(){var e=n();return i(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}},6736:(e,t,r)=>{e.exports=r(1094)},4280:(e,t,r)=>{const i=r(9278),n=r(5753)("pick-port"),o=r(5753)("pick-port:WARN"),a=r(67),s=r(9615);n.log=console.debug.bind(console),o.log=console.warn.bind(console);const c=new Set;function u({type:e,ip:t,port:r,reserveTimeout:i}){const n=`${e}:${t}:${r}`;c.add(n),setTimeout((()=>c.delete(n)),1e3*i)}function l({type:e,ip:t,port:r}){const i=`${e}:${t}:${r}`;return c.has(i)}e.exports=async function({type:e="udp",ip:t="0.0.0.0",minPort:r=1e4,maxPort:c=2e4,reserveTimeout:h=5}={}){n("called with [type:%s, ip:%s, minPort:%d, maxPort:%d, reserveTimeout:%d]",e,t,r,c,h),e=e.toLowerCase();const d=i.isIP(t);if("udp"!==e&&"tcp"!==e)throw new TypeError("invalid type parameter");if(4!==d&&6!==d)throw new TypeError("invalid ip parameter");if("number"!=typeof r||"number"!=typeof c||r>c)throw new TypeError("invalid minPort/maxPort parameter");if("number"!=typeof h)throw new TypeError("invalid reserveTimeout parameter");const p="udp"===e?s:a;let f=Math.floor(Math.random()*(c+1-r))+r,g=c-r+1;for(;--g>=0;)if(++f>c&&(f=r),!l({type:e,ip:t,port:f}))try{return await p({ip:t,port:f,family:d}),u({type:e,ip:t,port:f,reserveTimeout:h}),n("got an available port [type:%s, ip:%s, port:%d]",e,t,f),f}catch(r){if("EADDRINUSE"===r.code){n("port in use [type:%s, ip:%s, port:%d]",e,t,f);continue}throw o("could not get any available port [type:%s, ip:%s, port:%d]: %s",e,t,f,r.toString()),r}throw new Error("no port available")}},67:(e,t,r)=>{const i=r(9278);e.exports=async function({ip:e,port:t}){const r=i.createServer();return new Promise(((i,n)=>{r.unref(),r.on("error",n),r.listen({port:t,exclusive:!0},e,(()=>r.close(i)))}))}},9615:(e,t,r)=>{const i=r(7194);e.exports=async function({ip:e,port:t,family:r}){const n=i.createSocket(4===r?"udp4":"udp6");return new Promise(((r,i)=>{n.unref(),n.on("error",i),n.bind({port:t,exclusive:!0},e,(()=>n.close(r)))}))}},6578:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},3231:e=>{ /*! * * Copyright 2009-2012 Kris Kowal under the terms of the MIT @@ -30,10 +30,8 @@ return 16==e&&o.length%2!=0&&(o="0"+o),n?o:"0"},n.prototype.negate=function(){va * limitations under the License. * */ -!function(t){"use strict";"function"==typeof bootstrap?bootstrap("promise",t):e.exports=t()}((function(){"use strict";var e=!1;try{throw new Error}catch(t){e=!!t.stack}var t,r=E(),i=function(){},n=function(){var e={task:void 0,next:null},t=e,r=!1,i=void 0,o=!1;function a(){for(;e.next;){var t=(e=e.next).task;e.task=void 0;var i=e.domain;i&&(e.domain=void 0,i.enter());try{t()}catch(e){if(o)throw i&&i.exit(),setTimeout(a,0),i&&i.enter(),e;setTimeout((function(){throw e}),0)}i&&i.exit()}r=!1}if(n=function(e){t=t.next={task:e,domain:o&&process.domain,next:null},r||(r=!0,i())},"undefined"!=typeof process&&process.nextTick)o=!0,i=function(){process.nextTick(a)};else if("function"==typeof setImmediate)i="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=function(){i=c,s.port1.onmessage=a,a()};var c=function(){s.port2.postMessage(0)};i=function(){setTimeout(a,0),c()}}else i=function(){setTimeout(a,0)};return n}(),o=Function.call;function a(e){return function(){return o.apply(e,arguments)}}var s,c=a(Array.prototype.slice),u=a(Array.prototype.reduce||function(e,t){var r=0,i=this.length;if(1===arguments.length)for(;;){if(r in this){t=this[r++];break}if(++r>=i)throw new TypeError}for(;r=r&&o<=W}function E(){if(e)try{throw new Error}catch(e){var r=e.stack.split("\n"),i=C(r[0].indexOf("@")>0?r[1]:r[2]);if(!i)return;return t=i[0],i[1]}}function _(e){return e instanceof D?e:R(e)?function(e){var t=T();return _.nextTick((function(){try{e.then(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}})),t.promise}(e):k(e)}function T(){var t,r=[],i=[],n=d(T.prototype),o=d(D.prototype);if(o.promiseDispatch=function(e,n,o){var a=c(arguments);r?(r.push(a),"when"===n&&o[1]&&i.push(o[1])):_.nextTick((function(){t.promiseDispatch.apply(t,a)}))},o.valueOf=function(){if(r)return o;var e=b(t);return U(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},_.longStackSupport&&e)try{throw new Error}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1)}function a(e){t=e,o.source=e,u(r,(function(t,r){_.nextTick((function(){e.promiseDispatch.apply(e,r)}))}),void 0),r=void 0,i=void 0}return n.promise=o,n.resolve=function(e){t||a(_(e))},n.fulfill=function(e){t||a(k(e))},n.reject=function(e){t||a(F(e))},n.notify=function(e){t||u(i,(function(t,r){_.nextTick((function(){r(e)}))}),void 0)},n}function A(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=T();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function I(e){return A((function(t,r){for(var i=0,n=e.length;i2?e.resolve(c(arguments,1)):e.resolve(r)}},_.Promise=A,_.promise=A,A.race=I,A.all=j,A.reject=F,A.resolve=_,_.passByCopy=function(e){return e},D.prototype.passByCopy=function(){return this},_.join=function(e,t){return _(e).join(t)},D.prototype.join=function(e){return _([this,e]).spread((function(e,t){if(e===t)return e;throw new Error("Can't join: not the same: "+e+" "+t)}))},_.race=I,D.prototype.race=function(){return this.then(_.race)},_.makePromise=D,D.prototype.toString=function(){return"[object Promise]"},D.prototype.then=function(e,t,r){var i=this,n=T(),o=!1;return _.nextTick((function(){i.promiseDispatch((function(t){o||(o=!0,n.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return F(e)}}(t)))}),"when",[function(e){o||(o=!0,n.resolve(function(e){if("function"==typeof t){v(e,i);try{return t(e)}catch(e){return F(e)}}return F(e)}(e)))}])})),i.promiseDispatch(void 0,"when",[void 0,function(e){var t,i=!1;try{t=function(e){return"function"==typeof r?r(e):e}(e)}catch(e){if(i=!0,!_.onerror)throw e;_.onerror(e)}i||n.notify(t)}]),n.promise},_.tap=function(e,t){return _(e).tap(t)},D.prototype.tap=function(e){return e=_(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},_.when=w,D.prototype.thenResolve=function(e){return this.then((function(){return e}))},_.thenResolve=function(e,t){return _(e).thenResolve(t)},D.prototype.thenReject=function(e){return this.then((function(){throw e}))},_.thenReject=function(e,t){return _(e).thenReject(t)},_.nearer=b,_.isPromise=U,_.isPromiseAlike=R,_.isPending=function(e){return U(e)&&"pending"===e.inspect().state},D.prototype.isPending=function(){return"pending"===this.inspect().state},_.isFulfilled=function(e){return!U(e)||"fulfilled"===e.inspect().state},D.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},_.isRejected=function(e){return U(e)&&"rejected"===e.inspect().state},D.prototype.isRejected=function(){return"rejected"===this.inspect().state};var O,N,P,B=[],L=[],x=!0;function M(){B.length=0,L.length=0,x||(x=!0)}function F(e){var t=D({when:function(t){return t&&function(e){if(x){var t=l(L,e);-1!==t&&(L.splice(t,1),B.splice(t,1))}}(this),t?t(e):this}},(function(){return this}),(function(){return{state:"rejected",reason:e}}));return function(e,t){x&&(L.push(e),t&&void 0!==t.stack?B.push(t.stack):B.push("(no stack) "+t))}(t,e),t}function k(e){return D({when:function(){return e},get:function(t){return e[t]},set:function(t,r){e[t]=r},delete:function(t){delete e[t]},post:function(t,r){return null==t?e.apply(void 0,r):e[t].apply(e,r)},apply:function(t,r){return e.apply(t,r)},keys:function(){return f(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function V(e,t,r){return _(e).spread(t,r)}function H(e,t,r){return _(e).dispatch(t,r)}function j(e){return w(e,(function(e){var t=0,r=T();return u(e,(function(i,n,o){var a;U(n)&&"fulfilled"===(a=n.inspect()).state?e[o]=a.value:(++t,w(n,(function(i){e[o]=i,0==--t&&r.resolve(e)}),r.reject,(function(e){r.notify({index:o,value:e})})))}),void 0),0===t&&r.resolve(e),r.promise}))}function G(e){return w(e,(function(e){return e=h(e,_),w(j(h(e,(function(e){return w(e,i,i)}))),(function(){return e}))}))}_.resetUnhandledRejections=M,_.getUnhandledReasons=function(){return B.slice()},_.stopUnhandledRejectionTracking=function(){M(),x=!1},M(),_.reject=F,_.fulfill=k,_.master=function(e){return D({isDef:function(){}},(function(t,r){return H(e,t,r)}),(function(){return _(e).inspect()}))},_.spread=V,D.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},_.async=function(e){return function(){function t(e,t){var o;if("undefined"==typeof StopIteration){try{o=r[e](t)}catch(e){return F(e)}return o.done?_(o.value):w(o.value,i,n)}try{o=r[e](t)}catch(e){return function(e){return"[object StopIteration]"===m(e)||e instanceof s}(e)?_(e.value):F(e)}return w(o,i,n)}var r=e.apply(this,arguments),i=t.bind(t,"next"),n=t.bind(t,"throw");return i()}},_.spawn=function(e){_.done(_.async(e)())},_.return=function(e){throw new s(e)},_.promised=function(e){return function(){return V([this,j(arguments)],(function(t,r){return e.apply(t,r)}))}},_.dispatch=H,D.prototype.dispatch=function(e,t){var r=this,i=T();return _.nextTick((function(){r.promiseDispatch(i.resolve,e,t)})),i.promise},_.get=function(e,t){return _(e).dispatch("get",[t])},D.prototype.get=function(e){return this.dispatch("get",[e])},_.set=function(e,t,r){return _(e).dispatch("set",[t,r])},D.prototype.set=function(e,t){return this.dispatch("set",[e,t])},_.del=_.delete=function(e,t){return _(e).dispatch("delete",[t])},D.prototype.del=D.prototype.delete=function(e){return this.dispatch("delete",[e])},_.mapply=_.post=function(e,t,r){return _(e).dispatch("post",[t,r])},D.prototype.mapply=D.prototype.post=function(e,t){return this.dispatch("post",[e,t])},_.send=_.mcall=_.invoke=function(e,t){return _(e).dispatch("post",[t,c(arguments,2)])},D.prototype.send=D.prototype.mcall=D.prototype.invoke=function(e){return this.dispatch("post",[e,c(arguments,1)])},_.fapply=function(e,t){return _(e).dispatch("apply",[void 0,t])},D.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},_.try=_.fcall=function(e){return _(e).dispatch("apply",[void 0,c(arguments,1)])},D.prototype.fcall=function(){return this.dispatch("apply",[void 0,c(arguments)])},_.fbind=function(e){var t=_(e),r=c(arguments,1);return function(){return t.dispatch("apply",[this,r.concat(c(arguments))])}},D.prototype.fbind=function(){var e=this,t=c(arguments);return function(){return e.dispatch("apply",[this,t.concat(c(arguments))])}},_.keys=function(e){return _(e).dispatch("keys",[])},D.prototype.keys=function(){return this.dispatch("keys",[])},_.all=j,D.prototype.all=function(){return j(this)},_.allResolved=(O=G,N="allResolved",P="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(N+" is deprecated, use "+P+" instead.",new Error("").stack),O.apply(O,arguments)}),D.prototype.allResolved=function(){return G(this)},_.allSettled=function(e){return _(e).allSettled()},D.prototype.allSettled=function(){return this.then((function(e){return j(h(e,(function(e){function t(){return e.inspect()}return(e=_(e)).then(t,t)})))}))},_.fail=_.catch=function(e,t){return _(e).then(void 0,t)},D.prototype.fail=D.prototype.catch=function(e){return this.then(void 0,e)},_.progress=function(e,t){return _(e).then(void 0,void 0,t)},D.prototype.progress=function(e){return this.then(void 0,void 0,e)},_.fin=_.finally=function(e,t){return _(e).finally(t)},D.prototype.fin=D.prototype.finally=function(e){return e=_(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},_.done=function(e,t,r,i){return _(e).done(t,r,i)},D.prototype.done=function(e,t,r){var i=function(e){_.nextTick((function(){if(v(e,n),!_.onerror)throw e;_.onerror(e)}))},n=e||t||r?this.then(e,t,r):this;"object"==typeof process&&process&&process.domain&&(i=process.domain.bind(i)),n.then(void 0,i)},_.timeout=function(e,t,r){return _(e).timeout(t,r)},D.prototype.timeout=function(e,t){var r=T(),i=setTimeout((function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),r.reject(t)}),e);return this.then((function(e){clearTimeout(i),r.resolve(e)}),(function(e){clearTimeout(i),r.reject(e)}),r.notify),r.promise},_.delay=function(e,t){return void 0===t&&(t=e,e=void 0),_(e).delay(t)},D.prototype.delay=function(e){return this.then((function(t){var r=T();return setTimeout((function(){r.resolve(t)}),e),r.promise}))},_.nfapply=function(e,t){return _(e).nfapply(t)},D.prototype.nfapply=function(e){var t=T(),r=c(e);return r.push(t.makeNodeResolver()),this.fapply(r).fail(t.reject),t.promise},_.nfcall=function(e){var t=c(arguments,1);return _(e).nfapply(t)},D.prototype.nfcall=function(){var e=c(arguments),t=T();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},_.nfbind=_.denodeify=function(e){var t=c(arguments,1);return function(){var r=t.concat(c(arguments)),i=T();return r.push(i.makeNodeResolver()),_(e).fapply(r).fail(i.reject),i.promise}},D.prototype.nfbind=D.prototype.denodeify=function(){var e=c(arguments);return e.unshift(this),_.denodeify.apply(void 0,e)},_.nbind=function(e,t){var r=c(arguments,2);return function(){var i=r.concat(c(arguments)),n=T();return i.push(n.makeNodeResolver()),_((function(){return e.apply(t,arguments)})).fapply(i).fail(n.reject),n.promise}},D.prototype.nbind=function(){var e=c(arguments,0);return e.unshift(this),_.nbind.apply(void 0,e)},_.nmapply=_.npost=function(e,t,r){return _(e).npost(t,r)},D.prototype.nmapply=D.prototype.npost=function(e,t){var r=c(t||[]),i=T();return r.push(i.makeNodeResolver()),this.dispatch("post",[e,r]).fail(i.reject),i.promise},_.nsend=_.nmcall=_.ninvoke=function(e,t){var r=c(arguments,2),i=T();return r.push(i.makeNodeResolver()),_(e).dispatch("post",[t,r]).fail(i.reject),i.promise},D.prototype.nsend=D.prototype.nmcall=D.prototype.ninvoke=function(e){var t=c(arguments,1),r=T();return t.push(r.makeNodeResolver()),this.dispatch("post",[e,t]).fail(r.reject),r.promise},_.nodeify=function(e,t){return _(e).nodeify(t)},D.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){_.nextTick((function(){e(null,t)}))}),(function(t){_.nextTick((function(){e(t)}))}))};var W=E();return _}))},7675:(e,t,r)=>{"use strict";var i=r(3206),n=r(9675),o=Object;e.exports=i((function(){if(null==this||this!==o(this))throw new n("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)},1589:(e,t,r)=>{"use strict";var i=r(8452),n=r(487),o=r(7675),a=r(5330),s=r(3984),c=n(a());i(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},5330:(e,t,r)=>{"use strict";var i=r(7675),n=r(8452).supportsDescriptors,o=Object.getOwnPropertyDescriptor;e.exports=function(){if(n&&"gim"===/a/gim.flags){var e=o(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var t="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(r,"sticky",{get:function(){t+="y"}}),"dy"===t)return e.get}}return i}},3984:(e,t,r)=>{"use strict";var i=r(8452).supportsDescriptors,n=r(5330),o=Object.getOwnPropertyDescriptor,a=Object.defineProperty,s=TypeError,c=Object.getPrototypeOf,u=/a/;e.exports=function(){if(!i||!c)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=n(),t=c(u),r=o(t,"flags");return r&&r.get===e||a(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},2861:(e,t,r)=>{ -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var i=r(181),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),a.prototype=Object.create(n.prototype),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},4043:(e,t,r)=>{!function(e){e.parser=function(e,t){return new n(e,t)},e.SAXParser=n,e.SAXStream=a,e.createStream=function(e,t){return new a(e,t)},e.MAX_BUFFER_LENGTH=65536;var t,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function n(t,r){if(!(this instanceof n))return new n(t,r);var o=this;!function(e){for(var t=0,r=i.length;t"===o?(w(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=A.TEXT):v(o)?(r.state=A.SGML_DECL_QUOTED,r.sgmlDecl+=o):r.sgmlDecl+=o;continue;case A.SGML_DECL_QUOTED:o===r.q&&(r.state=A.SGML_DECL,r.q=""),r.sgmlDecl+=o;continue;case A.DOCTYPE:">"===o?(r.state=A.TEXT,w(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=o,"["===o?r.state=A.DOCTYPE_DTD:v(o)&&(r.state=A.DOCTYPE_QUOTED,r.q=o));continue;case A.DOCTYPE_QUOTED:r.doctype+=o,o===r.q&&(r.q="",r.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:r.doctype+=o,"]"===o?r.state=A.DOCTYPE:v(o)&&(r.state=A.DOCTYPE_DTD_QUOTED,r.q=o);continue;case A.DOCTYPE_DTD_QUOTED:r.doctype+=o,o===r.q&&(r.state=A.DOCTYPE_DTD,r.q="");continue;case A.COMMENT:"-"===o?r.state=A.COMMENT_ENDING:r.comment+=o;continue;case A.COMMENT_ENDING:"-"===o?(r.state=A.COMMENT_ENDED,r.comment=U(r.opt,r.comment),r.comment&&w(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+o,r.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==o?(N(r,"Malformed comment"),r.comment+="--"+o,r.state=A.COMMENT):r.state=A.TEXT;continue;case A.CDATA:"]"===o?r.state=A.CDATA_ENDING:r.cdata+=o;continue;case A.CDATA_ENDING:"]"===o?r.state=A.CDATA_ENDING_2:(r.cdata+="]"+o,r.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===o?(r.cdata&&w(r,"oncdata",r.cdata),w(r,"onclosecdata"),r.cdata="",r.state=A.TEXT):"]"===o?r.cdata+="]":(r.cdata+="]]"+o,r.state=A.CDATA);continue;case A.PROC_INST:"?"===o?r.state=A.PROC_INST_ENDING:g(o)?r.state=A.PROC_INST_BODY:r.procInstName+=o;continue;case A.PROC_INST_BODY:if(!r.procInstBody&&g(o))continue;"?"===o?r.state=A.PROC_INST_ENDING:r.procInstBody+=o;continue;case A.PROC_INST_ENDING:">"===o?(w(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=A.TEXT):(r.procInstBody+="?"+o,r.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:C(p,o)?r.tagName+=o:(P(r),">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:(g(o)||N(r,"Invalid character in tag name"),r.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===o?(x(r,!0),M(r)):(N(r,"Forward-slash in opening tag not followed by >"),r.state=A.ATTRIB);continue;case A.ATTRIB:if(g(o))continue;">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:C(d,o)?(r.attribName=o,r.attribValue="",r.state=A.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===o?r.state=A.ATTRIB_VALUE:">"===o?(N(r,"Attribute without value"),r.attribValue=r.attribName,L(r),x(r)):g(o)?r.state=A.ATTRIB_NAME_SAW_WHITE:C(p,o)?r.attribName+=o:N(r,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===o)r.state=A.ATTRIB_VALUE;else{if(g(o))continue;N(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",w(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===o?x(r):C(d,o)?(r.attribName=o,r.state=A.ATTRIB_NAME):(N(r,"Invalid attribute name"),r.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(g(o))continue;v(o)?(r.q=o,r.state=A.ATTRIB_VALUE_QUOTED):(N(r,"Unquoted attribute value"),r.state=A.ATTRIB_VALUE_UNQUOTED,r.attribValue=o);continue;case A.ATTRIB_VALUE_QUOTED:if(o!==r.q){"&"===o?r.state=A.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=o;continue}L(r),r.q="",r.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:g(o)?r.state=A.ATTRIB:">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:C(d,o)?(N(r,"No whitespace between attributes"),r.attribName=o,r.attribValue="",r.state=A.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!y(o)){"&"===o?r.state=A.ATTRIB_VALUE_ENTITY_U:r.attribValue+=o;continue}L(r),">"===o?x(r):r.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(r.tagName)">"===o?M(r):C(p,o)?r.tagName+=o:r.script?(r.script+=""===o?M(r):N(r,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var l,h;switch(r.state){case A.TEXT_ENTITY:l=A.TEXT,h="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:l=A.ATTRIB_VALUE_QUOTED,h="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:l=A.ATTRIB_VALUE_UNQUOTED,h="attribValue"}if(";"===o)if(r.opt.unparsedEntities){var E=F(r);r.entity="",r.state=l,r.write(E)}else r[h]+=F(r),r.entity="",r.state=l;else C(r.entity.length?m:f,o)?r.entity+=o:(N(r,"Invalid character in entity name"),r[h]+="&"+r.entity+o,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),n=0,o=0,a=i.length;or)switch(i[o]){case"textNode":b(t);break;case"cdata":w(t,"oncdata",t.cdata),t.cdata="";break;case"script":w(t,"onscript",t.script),t.script="";break;default:R(t,"Max buffer length exceeded: "+i[o])}n=Math.max(n,s)}var c=e.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=c+t.position}(r);return r} -/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;b(e=this),""!==e.cdata&&(w(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(w(e,"onscript",e.script),e.script="")}};try{t=r(2203).Stream}catch(e){t=function(){}}t||(t=function(){});var o=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function a(e,r){if(!(this instanceof a))return new a(e,r);t.apply(this),this._parser=new n(e,r),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(e){i.emit("error",e),i._parser.error=null},this._decoder=null,o.forEach((function(e){Object.defineProperty(i,"on"+e,{get:function(){return i._parser["on"+e]},set:function(t){if(!t)return i.removeAllListeners(e),i._parser["on"+e]=t,t;i.on(e,t)},enumerable:!0,configurable:!1})}))}a.prototype=Object.create(t.prototype,{constructor:{value:a}}),a.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var t=r(3193).StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,r){var i=this;return i._parser["on"+e]||-1===o.indexOf(e)||(i._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),i.emit.apply(i,t)}),t.prototype.on.call(i,e,r)};var s="[CDATA[",c="DOCTYPE",u="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/2000/xmlns/",h={xml:u,xmlns:l},d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function g(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function v(e){return'"'===e||"'"===e}function y(e){return">"===e||g(e)}function C(e,t){return e.test(t)}function S(e,t){return!C(e,t)}var E,_,T,A=0;for(var I in e.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t],i="number"==typeof r?String.fromCharCode(r):r;e.ENTITIES[t]=i})),e.STATE)e.STATE[e.STATE[I]]=I;function D(e,t,r){e[t]&&e[t](r)}function w(e,t,r){e.textNode&&b(e),D(e,t,r)}function b(e){e.textNode=U(e.opt,e.textNode),e.textNode&&D(e,"ontext",e.textNode),e.textNode=""}function U(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function R(e,t){return b(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,D(e,"onerror",t),e}function O(e){return e.sawRoot&&!e.closedRoot&&N(e,"Unclosed root tag"),e.state!==A.BEGIN&&e.state!==A.BEGIN_WHITESPACE&&e.state!==A.TEXT&&R(e,"Unexpected end"),b(e),e.c="",e.closed=!0,D(e,"onend"),n.call(e,e.strict,e.opt),e}function N(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&R(e,t)}function P(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,r=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(r.ns=t.ns),e.attribList.length=0,w(e,"onopentagstart",r)}function B(e,t){var r=e.indexOf(":")<0?["",e]:e.split(":"),i=r[0],n=r[1];return t&&"xmlns"===e&&(i="xmlns",n=""),{prefix:i,local:n}}function L(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=B(e.attribName,!0),r=t.prefix,i=t.local;if("xmlns"===r)if("xml"===i&&e.attribValue!==u)N(e,"xml: prefix must be bound to "+u+"\nActual: "+e.attribValue);else if("xmlns"===i&&e.attribValue!==l)N(e,"xmlns: prefix must be bound to "+l+"\nActual: "+e.attribValue);else{var n=e.tag,o=e.tags[e.tags.length-1]||e;n.ns===o.ns&&(n.ns=Object.create(o.ns)),n.ns[i]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,w(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function x(e,t){if(e.opt.xmlns){var r=e.tag,i=B(e.tagName);r.prefix=i.prefix,r.local=i.local,r.uri=r.ns[i.prefix]||"",r.prefix&&!r.uri&&(N(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),r.uri=i.prefix);var n=e.tags[e.tags.length-1]||e;r.ns&&n.ns!==r.ns&&Object.keys(r.ns).forEach((function(t){w(e,"onopennamespace",{prefix:t,uri:r.ns[t]})}));for(var o=0,a=e.attribList.length;o",e.tagName="",void(e.state=A.SCRIPT);w(e,"onscript",e.script),e.script=""}var t=e.tags.length,r=e.tagName;e.strict||(r=r[e.looseCase]());for(var i=r;t--;){if(e.tags[t].name===i)break;N(e,"Unexpected close tag")}if(t<0)return N(e,"Unmatched closing tag: "+e.tagName),e.textNode+="",void(e.state=A.TEXT);e.tagName=r;for(var n=e.tags.length;n-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,w(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var c=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==c.ns&&Object.keys(o.ns).forEach((function(t){var r=o.ns[t];w(e,"onclosenamespace",{prefix:t,uri:r})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=A.TEXT}function F(e){var t,r=e.entity,i=r.toLowerCase(),n="";return e.ENTITIES[r]?e.ENTITIES[r]:e.ENTITIES[i]?e.ENTITIES[i]:("#"===(r=i).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),n=(t=parseInt(r,16)).toString(16)):(r=r.slice(1),n=(t=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(t)||n.toLowerCase()!==r?(N(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function k(e,t){"<"===t?(e.state=A.OPEN_WAKA,e.startTagPosition=e.position):g(t)||(N(e,"Non-whitespace before first tag."),e.textNode=t,e.state=A.TEXT)}function V(e,t){var r="";return t1114111||_(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(e=55296+((a-=65536)>>10),t=a%1024+56320,r.push(e,t)),(i+1===n||r.length>16384)&&(o+=E.apply(null,r),r.length=0)}return o},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(t)},6897:(e,t,r)=>{"use strict";var i=r(453),n=r(41),o=r(592)(),a=r(5795),s=r(9675),c=i("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,u=!0;if("length"in e&&a){var l=a(e,"length");l&&!l.configurable&&(i=!1),l&&!l.writable&&(u=!1)}return(i||u||!r)&&(o?n(e,"length",t,!0,!0):n(e,"length",t)),e}},3206:(e,t,r)=>{"use strict";var i=r(41),n=r(592)(),o=r(4462).functionsHaveConfigurableNames(),a=r(9675);e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");return arguments.length>2&&!!arguments[2]&&!o||(n?i(e,"name",t,!0,!0):i(e,"name",t)),e}},920:(e,t,r)=>{"use strict";var i=r(453),n=r(8075),o=r(8859),a=r(9675),s=i("%WeakMap%",!0),c=i("%Map%",!0),u=n("WeakMap.prototype.get",!0),l=n("WeakMap.prototype.set",!0),h=n("WeakMap.prototype.has",!0),d=n("Map.prototype.get",!0),p=n("Map.prototype.set",!0),f=n("Map.prototype.has",!0),m=function(e,t){for(var r,i=e;null!==(r=i.next);i=r)if(r.key===t)return i.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,i={assert:function(e){if(!i.has(e))throw new a("Side channel does not contain "+o(e))},get:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return u(e,i)}else if(c){if(t)return d(t,i)}else if(r)return function(e,t){var r=m(e,t);return r&&r.value}(r,i)},has:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return h(e,i)}else if(c){if(t)return f(t,i)}else if(r)return function(e,t){return!!m(e,t)}(r,i);return!1},set:function(i,n){s&&i&&("object"==typeof i||"function"==typeof i)?(e||(e=new s),l(e,i,n)):c?(t||(t=new c),p(t,i,n)):(r||(r={key:{},next:null}),function(e,t,r){var i=m(e,t);i?i.value=r:e.next={key:t,next:e.next,value:r}}(r,i,n))}};return i}},3476:(e,t,r)=>{r(2345).install()},2345:(e,t,r)=>{e=r.nmd(e);var i,n=r(9665).SourceMapConsumer,o=r(6928);try{(i=r(9896)).existsSync&&i.readFileSync||(i=null)}catch(e){}var a=r(2746);function s(e,t){return e.require(t)}var c=!1,u=!1,l=!1,h="auto",d={},p={},f=/^data:application\/json[^,]+base64,/,m=[],g=[];function v(){return"browser"===h||"node"!==h&&("undefined"!=typeof window&&"function"==typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type))}function y(e){return function(t){for(var r=0;r";var r=this.getLineNumber();if(null!=r){t+=":"+r;var i=this.getColumnNumber();i&&(t+=":"+i)}}var n="",o=this.getFunctionName(),a=!0,s=this.isConstructor();if(!(this.isToplevel()||s)){var c=this.getTypeName();"[object Object]"===c&&(c="null");var u=this.getMethodName();o?(c&&0!=o.indexOf(c)&&(n+=c+"."),n+=o,u&&o.indexOf("."+u)!=o.length-u.length-1&&(n+=" [as "+u+"]")):n+=c+"."+(u||"")}else s?n+="new "+(o||""):o?n+=o:(n+=t,a=!1);return a&&(n+=" ("+t+")"),n}function I(e){var t={};return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(r){t[r]=/^(?:is|get)/.test(r)?function(){return e[r].call(e)}:e[r]})),t.toString=A,t}function D(e,t){if(void 0===t&&(t={nextPosition:null,curPosition:null}),e.isNative())return t.curPosition=null,e;var r=e.getFileName()||e.getScriptNameOrSourceURL();if(r){var i=e.getLineNumber(),n=e.getColumnNumber()-1,o=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/.test("object"==typeof process&&null!==process?process.version:"")?0:62;1===i&&n>o&&!v()&&!e.isEval()&&(n-=o);var a=_({source:r,line:i,column:n});t.curPosition=a;var s=(e=I(e)).getFunctionName;return e.getFunctionName=function(){return null==t.nextPosition?s():t.nextPosition.name||s()},e.getFileName=function(){return a.source},e.getLineNumber=function(){return a.line},e.getColumnNumber=function(){return a.column+1},e.getScriptNameOrSourceURL=function(){return a.source},e}var c=e.isEval()&&e.getEvalOrigin();return c?(c=T(c),(e=I(e)).getEvalOrigin=function(){return c},e):e}function w(e,t){l&&(d={},p={});for(var r=(e.name||"Error")+": "+(e.message||""),i={nextPosition:null,curPosition:null},n=[],o=t.length-1;o>=0;o--)n.push("\n at "+D(t[o],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,r+n.reverse().join("")}function b(e){var t=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var r=t[1],n=+t[2],o=+t[3],a=d[r];if(!a&&i&&i.existsSync(r))try{a=i.readFileSync(r,"utf8")}catch(e){a=""}if(a){var s=a.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return r+":"+n+"\n"+s+"\n"+new Array(o).join(" ")+"^"}}return null}function U(e){var t=b(e),r=function(){if("object"==typeof process&&null!==process)return process.stderr}();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),t&&(console.error(),console.error(t)),console.error(e.stack),function(e){if("object"==typeof process&&null!==process&&"function"==typeof process.exit)process.exit(e)}(1)}g.push((function(e){var t,r=function(e){var t;if(v())try{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),t=4===r.readyState?r.responseText:null;var i=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(i)return i}catch(e){}t=C(e);for(var n,o,a=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/gm;o=a.exec(t);)n=o;return n?n[1]:null}(e);if(!r)return null;if(f.test(r)){var i=r.slice(r.indexOf(",")+1);t=a(i,"base64").toString(),r=e}else r=S(e,r),t=C(r);return t?{url:r,map:t}:null}));var R=m.slice(0),O=g.slice(0);t.wrapCallSite=D,t.getErrorSource=b,t.mapSourcePosition=_,t.retrieveSourceMap=E,t.install=function(t){if((t=t||{}).environment&&(h=t.environment,-1===["node","browser","auto"].indexOf(h)))throw new Error("environment "+h+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(m.length=0),m.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(g.length=0),g.unshift(t.retrieveSourceMap)),t.hookRequire&&!v()){var r=s(e,"module"),i=r.prototype._compile;i.__sourceMapSupport||(r.prototype._compile=function(e,t){return d[t]=e,p[t]=void 0,i.call(this,e,t)},r.prototype._compile.__sourceMapSupport=!0)}if(l||(l="emptyCacheBetweenOperations"in t&&t.emptyCacheBetweenOperations),c||(c=!0,Error.prepareStackTrace=w),!u){var n=!("handleUncaughtExceptions"in t)||t.handleUncaughtExceptions;try{!1===s(e,"worker_threads").isMainThread&&(n=!1)}catch(e){}n&&"object"==typeof process&&null!==process&&"function"==typeof process.on&&(u=!0,o=process.emit,process.emit=function(e){if("uncaughtException"===e){var t=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(t&&!r)return U(arguments[1])}return o.apply(this,arguments)})}var o},t.resetRetrieveHandlers=function(){m.length=0,g.length=0,m=R.slice(0),g=O.slice(0),E=y(g),C=y(m)}},735:(e,t,r)=>{var i=r(251),n=Object.prototype.hasOwnProperty,o="undefined"!=typeof Map;function a(){this._array=[],this._set=o?new Map:Object.create(null)}a.fromArray=function(e,t){for(var r=new a,i=0,n=e.length;i=0)return t}else{var r=i.toSetString(e);if(n.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},a.prototype.at=function(e){if(e>=0&&e{var i=r(2364);t.encode=function(e){var t,r="",n=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&n,(n>>>=5)>0&&(t|=32),r+=i.encode(t)}while(n>0);return r},t.decode=function(e,t,r){var n,o,a,s,c=e.length,u=0,l=0;do{if(t>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=i.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&o),u+=(o&=31)<>1,1&~a?s:-s),r.rest=t}},2364:(e,t)=>{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(e){if(0<=e&&e{function r(e,i,n,o,a,s){var c=Math.floor((i-e)/2)+e,u=a(n,o[c],!0);return 0===u?c:u>0?i-c>1?r(c,i,n,o,a,s):s==t.LEAST_UPPER_BOUND?i1?r(e,c,n,o,a,s):s==t.LEAST_UPPER_BOUND?c:e<0?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,i,n,o){if(0===i.length)return-1;var a=r(-1,i.length,e,i,n,o||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===n(i[a],i[a-1],!0);)--a;return a}},3302:(e,t,r)=>{var i=r(251);function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}n.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},n.prototype.add=function(e){var t,r,n,o,a,s;t=this._last,r=e,n=t.generatedLine,o=r.generatedLine,a=t.generatedColumn,s=r.generatedColumn,o>n||o==n&&s>=a||i.compareByGeneratedPositionsInflated(t,r)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.P=n},3801:(e,t)=>{function r(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function i(e,t,n,o){if(n{var i=r(251),n=r(1163),o=r(735).C,a=r(7092),s=r(3801).g;function c(e,t){var r=e;return"string"==typeof e&&(r=i.parseSourceMapInput(e)),null!=r.sections?new h(r,t):new u(r,t)}function u(e,t){var r=e;"string"==typeof e&&(r=i.parseSourceMapInput(e));var n=i.getArg(r,"version"),a=i.getArg(r,"sources"),s=i.getArg(r,"names",[]),c=i.getArg(r,"sourceRoot",null),u=i.getArg(r,"sourcesContent",null),l=i.getArg(r,"mappings"),h=i.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);c&&(c=i.normalize(c)),a=a.map(String).map(i.normalize).map((function(e){return c&&i.isAbsolute(c)&&i.isAbsolute(e)?i.relative(c,e):e})),this._names=o.fromArray(s.map(String),!0),this._sources=o.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(e){return i.computeSourceURL(c,e,t)})),this.sourceRoot=c,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=t,this.file=h}function l(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function h(e,t){var r=e;"string"==typeof e&&(r=i.parseSourceMapInput(e));var n=i.getArg(r,"version"),a=i.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new o,this._names=new o;var s={line:-1,column:0};this._sections=a.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=i.getArg(e,"offset"),n=i.getArg(r,"line"),o=i.getArg(r,"column");if(n=0){var s=this._originalMappings[a];if(void 0===e.column)for(var c=s.originalLine;s&&s.originalLine===c;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var u=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==u;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return o},t.SourceMapConsumer=c,u.prototype=Object.create(c.prototype),u.prototype.consumer=c,u.prototype._findSourceIndex=function(e){var t,r=e;if(null!=this.sourceRoot&&(r=i.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(t=0;t1&&(r.source=m+o[1],m+=o[1],r.originalLine=p+o[2],p=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=g+o[4],g+=o[4])),_.push(r),"number"==typeof r.originalLine&&E.push(r)}s(_,i.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,s(E,i.compareByOriginalPositions),this.__originalMappings=E},u.prototype._findMapping=function(e,t,r,i,o,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return n.search(e,t,o,a)},u.prototype.computeColumnSpans=function(){for(var e=0;e=0){var n=this._generatedMappings[r];if(n.generatedLine===t.generatedLine){var o=i.getArg(n,"source",null);null!==o&&(o=this._sources.at(o),o=i.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var a=i.getArg(n,"name",null);return null!==a&&(a=this._names.at(a)),{source:o,line:i.getArg(n,"originalLine",null),column:i.getArg(n,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},u.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},u.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var n,o=e;if(null!=this.sourceRoot&&(o=i.relative(this.sourceRoot,o)),null!=this.sourceRoot&&(n=i.urlParse(this.sourceRoot))){var a=o.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!n.path||"/"==n.path)&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(t)return null;throw new Error('"'+o+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(e){var t=i.getArg(e,"source");if((t=this._findSourceIndex(t))<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:i.getArg(e,"line"),originalColumn:i.getArg(e,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(e,"bias",c.GREATEST_LOWER_BOUND));if(n>=0){var o=this._originalMappings[n];if(o.source===r.source)return{line:i.getArg(o,"generatedLine",null),column:i.getArg(o,"generatedColumn",null),lastColumn:i.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},h.prototype=Object.create(c.prototype),h.prototype.constructor=c,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var e=[],t=0;t{var i=r(7092),n=r(251),o=r(735).C,a=r(3302).P;function s(e){e||(e={}),this._file=n.getArg(e,"file",null),this._sourceRoot=n.getArg(e,"sourceRoot",null),this._skipValidation=n.getArg(e,"skipValidation",!1),this._sources=new o,this._names=new o,this._mappings=new a,this._sourcesContents=null}s.prototype._version=3,s.fromSourceMap=function(e){var t=e.sourceRoot,r=new s({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(i.source=e.source,null!=t&&(i.source=n.relative(t,i.source)),i.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(i.name=e.name)),r.addMapping(i)})),e.sources.forEach((function(i){var o=i;null!==t&&(o=n.relative(t,i)),r._sources.has(o)||r._sources.add(o);var a=e.sourceContentFor(i);null!=a&&r.setSourceContent(i,a)})),r},s.prototype.addMapping=function(e){var t=n.getArg(e,"generated"),r=n.getArg(e,"original",null),i=n.getArg(e,"source",null),o=n.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,i,o),null!=i&&(i=String(i),this._sources.has(i)||this._sources.add(i)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:i,name:o})},s.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=n.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,t,r){var i=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');i=e.file}var a=this._sourceRoot;null!=a&&(i=n.relative(a,i));var s=new o,c=new o;this._mappings.unsortedForEach((function(t){if(t.source===i&&null!=t.originalLine){var o=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=o.source&&(t.source=o.source,null!=r&&(t.source=n.join(r,t.source)),null!=a&&(t.source=n.relative(a,t.source)),t.originalLine=o.line,t.originalColumn=o.column,null!=o.name&&(t.name=o.name))}var u=t.source;null==u||s.has(u)||s.add(u);var l=t.name;null==l||c.has(l)||c.add(l)}),this),this._sources=s,this._names=c,e.sources.forEach((function(t){var i=e.sourceContentFor(t);null!=i&&(null!=r&&(t=n.join(r,t)),null!=a&&(t=n.relative(a,t)),this.setSourceContent(t,i))}),this)},s.prototype._validateMapping=function(e,t,r,i){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||i)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))},s.prototype._serializeMappings=function(){for(var e,t,r,o,a=0,s=1,c=0,u=0,l=0,h=0,d="",p=this._mappings.toArray(),f=0,m=p.length;f0){if(!n.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=i.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(o=this._sources.indexOf(t.source),e+=i.encode(o-h),h=o,e+=i.encode(t.originalLine-1-u),u=t.originalLine-1,e+=i.encode(t.originalColumn-c),c=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=i.encode(r-l),l=r)),d+=e}return d},s.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},s.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.x=s},1683:(e,t,r)=>{var i=r(4041).x,n=r(251),o=/(\r?\n)/,a="$$$isSourceNode$$$";function s(e,t,r,i,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[a]=!0,null!=i&&this.add(i)}s.fromStringWithSourceMap=function(e,t,r){var i=new s,a=e.split(o),c=0,u=function(){return e()+(e()||"");function e(){return c=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},s.prototype.walk=function(e){for(var t,r=0,i=this.children.length;r0){for(t=[],r=0;r{t.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function n(e){var t=e.match(r);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function o(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(e){var r=e,i=n(e);if(i){if(!i.path)return e;r=i.path}for(var a,s=t.isAbsolute(r),c=r.split(/\/+/),u=0,l=c.length-1;l>=0;l--)"."===(a=c[l])?c.splice(l,1):".."===a?u++:u>0&&(""===a?(c.splice(l+1,u),u=0):(c.splice(l,2),u--));return""===(r=c.join("/"))&&(r=s?"/":"."),i?(i.path=r,o(i)):r}function s(e,t){""===e&&(e="."),""===t&&(t=".");var r=n(t),s=n(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||t.match(i))return t;if(s&&!s.host&&!s.path)return s.host=t,o(s);var c="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=c,o(s)):c}t.urlParse=n,t.urlGenerate=o,t.normalize=a,t.join=s,t.isAbsolute=function(e){return"/"===e.charAt(0)||r.test(e)},t.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var i=e.lastIndexOf("/");if(i<0)return t;if((e=e.slice(0,i)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var c=!("__proto__"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function h(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}t.toSetString=c?u:function(e){return l(e)?"$"+e:e},t.fromSetString=c?u:function(e){return l(e)?e.slice(1):e},t.compareByOriginalPositions=function(e,t,r){var i=h(e.source,t.source);return 0!==i||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)||r||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=e.generatedLine-t.generatedLine)?i:h(e.name,t.name)},t.compareByGeneratedPositionsDeflated=function(e,t,r){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||r||0!==(i=h(e.source,t.source))||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)?i:h(e.name,t.name)},t.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=h(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:h(e.name,t.name)},t.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(e,t,r){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),r){var i=n(r);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var c=i.path.lastIndexOf("/");c>=0&&(i.path=i.path.substring(0,c+1))}t=s(o(i),t)}return a(t)}},9665:(e,t,r)=>{r(4041).x,t.SourceMapConsumer=r(7446).SourceMapConsumer,r(1683)},175:(e,t,r)=>{var i=r(1094),n=r(3193).StringDecoder;e.exports=function(e,t,r){var o=new n,a="",s=r&&r.maxLength,c=!r||!1!==r.trailing;"function"==typeof e&&(t=e,e=null);e||(e=/\r?\n/);function u(e,r){if(t){try{r=t(r)}catch(t){return e.emit("error",t)}void 0!==r&&e.queue(r)}else e.queue(r)}function l(t,r){var i=((null!=a?a:"")+r).split(e);if(a=i.pop(),s&&a.length>s)return t.emit("error",new Error("maximum buffer reached"));for(var n=0;n{var i=r(4928),n=r(1094);e.exports=function(){var e;if(0==(e=1==arguments.length&&Array.isArray(arguments[0])?arguments[0]:[].slice.call(arguments)).length)return n();if(1==e.length)return e[0];var t=e[0],r=e[e.length-1],o=i(t,r);function a(){var e=[].slice.call(arguments);e.unshift("error"),o.emit.apply(o,e)}!function e(t){t.length<2||(t[0].pipe(t[1]),e(t.slice(1)))}(e);for(var s=1;s{"use strict";const i=r(857),n=r(2018),o=r(5884),{env:a}=process;let s;function c(e,{streamIsTTY:t,sniffFlags:r=!0}={}){const n=function(){if("FORCE_COLOR"in a)return"true"===a.FORCE_COLOR?1:"false"===a.FORCE_COLOR?0:0===a.FORCE_COLOR.length?1:Math.min(Number.parseInt(a.FORCE_COLOR,10),3)}();void 0!==n&&(s=n);const c=r?s:n;if(0===c)return 0;if(r){if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2}if(e&&!t&&void 0===c)return 0;const u=c||0;if("dumb"===a.TERM)return u;if("win32"===process.platform){const e=i.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in a)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((e=>e in a))||"codeship"===a.CI_NAME?1:u;if("TEAMCITY_VERSION"in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if("truecolor"===a.COLORTERM)return 3;if("TERM_PROGRAM"in a){const e=Number.parseInt((a.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(a.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||"COLORTERM"in a?1:u}function u(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(c(e,{streamIsTTY:e&&e.isTTY,...t}))}o("no-color")||o("no-colors")||o("color=false")||o("color=never")?s=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(s=1),e.exports={supportsColor:u,stdout:u({isTTY:n.isatty(1)}),stderr:u({isTTY:n.isatty(2)})}},1094:(e,t,r)=>{var i=r(2203);function n(e,t,r){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var n=!1,o=!1,a=[],s=!1,c=new i;function u(){for(;a.length&&!c.paused;){var e=a.shift();if(null===e)return c.emit("end");c.emit("data",e)}}return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(r&&!1===r.autoDestroy),c.write=function(t){return e.call(this,t),!c.paused},c.queue=c.push=function(e){return s||(null===e&&(s=!0),a.push(e),u()),c},c.on("end",(function(){c.readable=!1,!c.writable&&c.autoDestroy&&process.nextTick((function(){c.destroy()}))})),c.end=function(e){if(!n)return n=!0,arguments.length&&c.write(e),c.writable=!1,t.call(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!o)return o=!0,n=!0,a.length=0,c.writable=c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),u(),c.paused||c.emit("drain"),c},c}e.exports=n,n.through=n},294:e=>{"use strict";var t=function(e,t,r){process.nextTick((function(){e(t,r)}))};function r(){}function i(e,t){e.apply(null,t)}process.nextTick((function(e){42===e&&(t=process.nextTick)}),42),e.exports=function(e){var n=function r(o){var a=[o];function s(e){a.push(e)}function c(e){var o=arguments;for(n=function(e){return"[object Error]"===Object.prototype.toString.call(e)}(e)?r:s;a.length;)s(a.shift());function s(e){t(i,e,o)}}n=s,e(c)};return function(e){n(e||r)}}},6346:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FfmpegProcess=t.fetchFffmpeg=void 0;const s=o(r(5317)),c=a(r(857)),u=a(r(9896)),l=a(r(6928)),h=a(r(3785)),d=a(r(5692)),p={timeout:2e3,rejectUnauthorized:!1};function f(e,t,r){d.default.get(e,p,(e=>{if(301===e.statusCode||302===e.statusCode)return f(e.headers.location,t,r);console.log("[FFMPEG] File size is: "+e.headers["content-length"]),e.pipe(t);let i=Number(e.headers["content-length"]),n=0,o=new Date;e.on("data",(e=>{if(n+=e.length,(new Date).getTime()-o.getTime()>500){let e=Math.round(n/i*100);console.log(`[FFMPEG] Downloaded ${n}/${i} (${e}%)`),o=new Date}})),e.on("end",(()=>{t.close((()=>{r()})),t.end((()=>{console.log("[FFMPEG] Download ended.")}))}))}))}function m(e){const t=u.default.constants.S_IROTH|u.default.constants.S_IXOTH|u.default.constants.S_IRUSR|u.default.constants.S_IXUSR|u.default.constants.S_IRGRP|u.default.constants.S_IXGRP;try{u.default.accessSync(e,u.default.constants.R_OK|u.default.constants.X_OK)}catch(r){u.default.chmodSync(e,t)}}function g(e){try{if(0==u.default.statSync(e).size)u.default.rmSync(e);else{s.default.execSync(e+" -version").toString();console.log(`[FFMPEG] valid binary file at: ${e}`)}}catch(t){console.error("[FFMPEG] binary file corrupt? Removing it. Error: "+t),u.default.rmSync(e)}}t.fetchFffmpeg=function(e){const t=process.platform+"-"+process.arch,r=l.default.join(e,"ffmpeg");if(u.default.existsSync(r)&&(m(r),g(r)),!u.default.existsSync(r)){console.info(`Could not find ffmpeg at ${r}, installing ...`);const e="https://github.com/slyoldfox/ffmpeg-for-bticino/releases/download/v2024.5.1/ffmpeg-"+t;let i=u.default.createWriteStream(r);switch(t){case"darwin-x64":case"linux-x64":case"linux-arm":f(e,i,(()=>{m(r),g(r)}));break;default:console.error(`Unsupported platform, install your own 'ffmpeg' binary at this path: ${r}`)}}return r};t.FfmpegProcess=class{constructor(e,t,r,i,n,o=!1,a,c){n.debug("Stream command: "+r+" "+i,e,o);let u=!1;const l=Date.now();this.process=(0,s.spawn)(r,i.split(/\s+/),{env:process.env}),this.stdin=this.process.stdin,this.process.stdout.on("data",(t=>{const r=this.parseProgress(t);if(r&&!u&&r.frame>0){u=!0;const t=(Date.now()-l)/1e3,r="Getting the first frames took "+t+" seconds.";t<5?n.debug(r,e,o):t<22?n.warn(r,e):n.error(r,e)}}));h.default.createInterface({input:this.process.stderr,terminal:!1}).on("line",(t=>{c&&(c(),c=void 0),o&&t.match(/\[(panic|fatal|error)\]/)?n.error(t,e):o&&n.debug(t,e,!0)})),this.process.on("error",(r=>{n.error("FFmpeg process creation failed: "+r.message,e),c&&c(new Error("FFmpeg process creation failed")),a.stopStream(t)})),this.process.on("exit",((r,i)=>{this.killTimeout&&clearTimeout(this.killTimeout);const s="FFmpeg exited with code: "+r+" and signal: "+i;this.killTimeout&&0===r?n.debug(s+" (Expected)",e,o):null==r||255===r?this.process.killed?n.debug(s+" (Forced)",e,o):n.error(s+" (Unexpected)",e):(n.error(s+" (Error)",e),a.stopStream(t),!u&&c?c(new Error(s)):a.controller.forceStopStreamingSession(t))}))}parseProgress(e){const t=e.toString();if(0==t.indexOf("frame="))try{const e=new Map;return t.split(/\r?\n/).forEach((t=>{const r=t.split("=",2);e.set(r[0],r[1])})),{frame:parseInt(e.get("frame")),fps:parseFloat(e.get("fps")),stream_q:parseFloat(e.get("stream_0_0_q")),bitrate:parseFloat(e.get("bitrate")),total_size:parseInt(e.get("total_size")),out_time_us:parseInt(e.get("out_time_us")),out_time:e.get("out_time").trim(),dup_frames:parseInt(e.get("dup_frames")),drop_frames:parseInt(e.get("drop_frames")),speed:parseFloat(e.get("speed")),progress:e.get("progress").trim()}}catch{return}}stop(){this.process.stdin.write("q"+c.default.EOL),this.killTimeout=setTimeout((()=>{this.process.kill("SIGKILL")}),2e3)}}},5592:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StreamingDelegate=void 0;const n=r(3103),o=r(5317),a=r(3103),s=i(r(4280)),c=r(7194),u=r(6346),l=r(4679);t.StreamingDelegate=class{constructor(e){this.pendingSessions=new Map,this.ongoingSessions=new Map,this.timeouts=new Map,this.log=new l.Logger,this.cameraName=e.displayName,this.unbridge=!0,this.videoConfig=e,this.videoProcessor=e.videoProcessor||e.$internalVideoProcessor;const t={cameraStreamCount:this.videoConfig.maxStreams||2,delegate:this,streamingOptions:{supportedCryptoSuites:[0],video:{resolutions:[[320,180,30],[320,240,15],[320,240,30],[480,270,30],[480,360,30],[640,360,30],[640,480,30],[1280,720,30],[1280,960,30],[1920,1080,30],[1600,1200,30]],codec:{profiles:[0,1,2],levels:[0,1,2]}},audio:{twoWayAudio:!!this.videoConfig.returnAudioTarget,codecs:[{type:"AAC-eld",samplerate:16}]}}};this.controller=new n.DoorbellController(t)}determineResolution(e,t){const r={width:e.width,height:e.height};t||(void 0!==this.videoConfig.maxWidth&&(this.videoConfig.forceMax||e.width>this.videoConfig.maxWidth)&&(r.width=this.videoConfig.maxWidth),void 0!==this.videoConfig.maxHeight&&(this.videoConfig.forceMax||e.height>this.videoConfig.maxHeight)&&(r.height=this.videoConfig.maxHeight));const i=this.videoConfig.videoFilter?.split(",")||[],n=i.indexOf("none");return n>=0&&i.splice(n,1),r.snapFilter=i.join(","),n<0&&(r.width>0||r.height>0)&&(r.resizeFilter="scale="+(r.width>0?"'min("+r.width+",iw)'":"iw")+":"+(r.height>0?"'min("+r.height+",ih)'":"ih")+":force_original_aspect_ratio=decrease",i.push(r.resizeFilter),i.push("scale=trunc(iw/2)*2:trunc(ih/2)*2")),i.length>0&&(r.videoFilter=i.join(",")),r}fetchSnapshot(e){const t=this.videoConfig.stillImageSourceCacheTime||3e5;return this.snapshotPromise=new Promise(((r,i)=>{const n=setTimeout((()=>i(new Error("Operation timed out creating snapshot"))),6e3),a=Date.now(),s=(this.videoConfig.stillImageSource||this.videoConfig.source)+" -frames:v 1"+(e?" -filter:v "+e:"")+" -f image2 - -hide_banner -loglevel error";this.log.debug("Snapshot command: "+this.videoProcessor+" "+s,this.cameraName,this.videoConfig.debug);const c=(0,o.spawn)(this.videoProcessor,s.split(/\s+/),{env:process.env});let u=Buffer.alloc(0);c.stdout.on("data",(e=>{u=Buffer.concat([u,e])})),c.on("error",(e=>{clearTimeout(n),i("FFmpeg process creation failed: "+e.message)})),c.stderr.on("data",(e=>{e.toString().split("\n").forEach((e=>{this.videoConfig.debug&&e.length>0&&this.log.error(e,this.cameraName+"] [Snapshot")}))})),c.on("close",(()=>{u.length>0?(clearTimeout(n),r(u)):(clearTimeout(n),i("Failed to fetch snapshot.")),setTimeout((()=>{this.snapshotPromise=void 0}),t);const e=(Date.now()-a)/1e3;let o="Fetching snapshot took "+e+" seconds.";e<5||(this.unbridge||(o+=" It is highly recommended you switch to unbridge mode."),e<22?this.log.warn(o,this.cameraName):(o+=" The request has timed out and the snapshot has not been refreshed in HomeKit.",this.log.error(o,this.cameraName)))}))})),this.snapshotPromise}resizeSnapshot(e,t){return new Promise(((r,i)=>{const n="-i pipe: -frames:v 1"+(t?" -filter:v "+t:"")+" -f image2 -",a=(0,o.spawn)(this.videoProcessor,n.split(/\s+/),{env:process.env});let s=Buffer.alloc(0);a.stdout.on("data",(e=>{s=Buffer.concat([s,e])})),a.on("error",(e=>{i("FFmpeg process creation failed: "+e.message)})),a.on("close",(()=>{r(s)})),a.stdin.end(e)}))}async handleSnapshotRequest(e,t){const r=this.determineResolution(e,!0);try{const i=!!this.snapshotPromise;e.reason&&console.log("snapshot requested for reason:",e.reason);const n=Date.now(),o=await(this.snapshotPromise||this.fetchSnapshot(r.snapFilter)),a=await o;i||this.log.debug("Snapshot took: "+(Date.now()-n)+"ms",this.cameraName,this.videoConfig.debug),t(void 0,a)}catch(e){this.snapshotPromise=void 0,this.log.error(e,this.cameraName),t()}}async prepareStream(e,t){const r="ipv6"===e.addressVersion,i={type:"udp",ip:r?"::":"0.0.0.0",reserveTimeout:15},n=await(0,s.default)(i),o=a.CameraController.generateSynchronisationSource(),c=await(0,s.default)(i),u=a.CameraController.generateSynchronisationSource(),l={address:e.targetAddress,ipv6:r,videoPort:e.video.port,videoReturnPort:n,videoCryptoSuite:e.video.srtpCryptoSuite,videoSRTP:Buffer.concat([e.video.srtp_key,e.video.srtp_salt]),videoSSRC:o,audioPort:e.audio.port,audioReturnPort:c,audioCryptoSuite:e.audio.srtpCryptoSuite,audioSRTP:Buffer.concat([e.audio.srtp_key,e.audio.srtp_salt]),audioSSRC:u},h={video:{port:n,ssrc:o,srtp_key:e.video.srtp_key,srtp_salt:e.video.srtp_salt},audio:{port:c,ssrc:u,srtp_key:e.audio.srtp_key,srtp_salt:e.audio.srtp_salt}};this.pendingSessions.set(e.sessionID,l),t(void 0,h)}startStream(e,t){const r=this.pendingSessions.get(e.sessionID);if(r){const i=this.videoConfig.vcodec||"libx264",n=this.videoConfig.packetSize||1316;let o=this.videoConfig.encoderOptions;o||"libx264"!==i||(o="-preset ultrafast -tune zerolatency");const a=this.determineResolution(e.video,!1);let s=void 0!==this.videoConfig.maxFPS&&(this.videoConfig.forceMax||e.video.fps>this.videoConfig.maxFPS)?this.videoConfig.maxFPS:e.video.fps,l=void 0!==this.videoConfig.maxBitrate&&(this.videoConfig.forceMax||e.video.max_bit_rate>this.videoConfig.maxBitrate)?this.videoConfig.maxBitrate:e.video.max_bit_rate;"copy"===i&&(a.width=0,a.height=0,a.videoFilter=void 0,s=0,l=0),this.log.debug("Video stream requested: "+e.video.width+" x "+e.video.height+", "+e.video.fps+" fps, "+e.video.max_bit_rate+" kbps",this.cameraName,this.videoConfig.debug),this.log.info("Starting video stream: "+(a.width>0?a.width:"native")+" x "+(a.height>0?a.height:"native")+", "+(s>0?s:"native")+" fps, "+(l>0?l:"???")+" kbps"+(this.videoConfig.audio?" ("+e.audio.codec+")":""),this.cameraName);let h=this.videoConfig.source;h+=(this.videoConfig.mapvideo?" -map "+this.videoConfig.mapvideo:" -an -sn -dn")+" -codec:v "+i+" -pix_fmt yuv420p -color_range mpeg"+(s>0?" -r "+s:"")+" -f rawvideo"+(o?" "+o:"")+(a.videoFilter?" -filter:v "+a.videoFilter:"")+(l>0?" -b:v "+l+"k":"")+" -payload_type "+e.video.pt,h+=" -ssrc "+r.videoSSRC+" -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "+r.videoSRTP.toString("base64")+" srtp://"+r.address+":"+r.videoPort+"?rtcpport="+r.videoPort+"&pkt_size="+n,this.videoConfig.audio&&("OPUS"===e.audio.codec||"AAC-eld"===e.audio.codec?(h+=(this.videoConfig.mapaudio?" -map "+this.videoConfig.mapaudio:" -vn -sn -dn")+("OPUS"===e.audio.codec?" -codec:a libopus -application lowdelay":" -codec:a libfdk_aac -profile:a aac_eld")+" -flags +global_header -f null -ar "+e.audio.sample_rate+"k -b:a "+e.audio.max_bit_rate+"k -bufsize "+4*e.audio.sample_rate+"k -ac "+e.audio.channel+" -payload_type "+e.audio.pt,h+=" -ssrc "+r.audioSSRC+" -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "+r.audioSRTP.toString("base64")+" srtp://"+r.address+":"+r.audioPort+"?rtcpport="+r.audioPort+"&pkt_size=188"):this.log.error("Unsupported audio codec requested: "+e.audio.codec,this.cameraName)),h+=" -loglevel level"+(this.videoConfig.debug?"+verbose":"")+" -progress pipe:1";const d={};if(d.socket=(0,c.createSocket)(r.ipv6?"udp6":"udp4"),d.socket.on("error",(t=>{this.log.error("Socket error: "+t.message,this.cameraName),this.stopStream(e.sessionID)})),d.socket.on("message",(()=>{d.timeout&&clearTimeout(d.timeout),d.timeout=setTimeout((()=>{this.log.info("Device appears to be inactive. Stopping stream.",this.cameraName),this.controller.forceStopStreamingSession(e.sessionID),this.stopStream(e.sessionID)}),5*e.video.rtcp_interval*1e3)})),d.socket.bind(r.videoReturnPort),d.mainProcess=new u.FfmpegProcess(this.cameraName,e.sessionID,this.videoProcessor,h,this.log,this.videoConfig.debug,this,t),this.videoConfig.returnAudioTarget){const t="-hide_banner -protocol_whitelist pipe,udp,rtp,file,crypto -f sdp -c:a libfdk_aac -i pipe: "+this.videoConfig.returnAudioTarget+" -loglevel level"+(this.videoConfig.debugReturn?"+verbose":""),i=r.ipv6?"IP6":"IP4",n="v=0\r\no=- 0 0 IN "+i+" "+r.address+"\r\ns=Talk\r\nc=IN "+i+" "+r.address+"\r\nt=0 0\r\nm=audio "+r.audioReturnPort+" RTP/AVP 110\r\nb=AS:24\r\na=rtpmap:110 MPEG4-GENERIC/16000/1\r\na=rtcp-mux\r\na=fmtp:110 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=F8F0212C00BC00\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:"+r.audioSRTP.toString("base64")+"\r\n";d.returnProcess=new u.FfmpegProcess(this.cameraName+"] [Two-way",e.sessionID,this.videoProcessor,t,this.log,this.videoConfig.debugReturn,this),d.returnProcess.stdin.end(n)}this.ongoingSessions.set(e.sessionID,d),this.pendingSessions.delete(e.sessionID)}else this.log.error("Error finding session information.",this.cameraName),t(new Error("Error finding session information"))}handleStreamRequest(e,t){switch(e.type){case"start":this.startStream(e,t);break;case"reconfigure":this.log.debug("Received request to reconfigure: "+e.video.width+" x "+e.video.height+", "+e.video.fps+" fps, "+e.video.max_bit_rate+" kbps (Ignored)",this.cameraName,this.videoConfig.debug),t();break;case"stop":this.stopStream(e.sessionID),t()}}stopStream(e){const t=this.ongoingSessions.get(e);if(t){t.timeout&&clearTimeout(t.timeout);try{t.socket?.close()}catch(e){this.log.error("Error occurred closing socket: "+e,this.cameraName)}try{t.mainProcess?.stop()}catch(e){this.log.error("Error occurred terminating main FFmpeg process: "+e,this.cameraName)}try{t.returnProcess?.stop()}catch(e){this.log.error("Error occurred terminating two-way FFmpeg process: "+e,this.cameraName)}}this.ongoingSessions.delete(e),this.log.info("Stopped video stream.",this.cameraName)}}},4679:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;t.Logger=class{formatMessage(e,t){let r="";return t&&(r+="["+t+"] "),r+=e,r}info(e,t){console.info(this.formatMessage(e,t))}warn(e,t){console.warn(this.formatMessage(e,t))}error(e,t){console.error(this.formatMessage(e,t))}debug(e,t,r=!1){console.debug(this.formatMessage(e,t))}}},5920:function(e,t,r){"use strict";var i,n,o,a=this&&this.__classPrivateFieldGet||function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},s=this&&this.__classPrivateFieldSet||function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.HomekitManager=t.randomPinCode=t.createHAPUsername=void 0;const c=r(3103),u=r(6982),l=r(5592),h=r(6346);let d="0.0.0",p="0.0.0",f="C100X/C300X";function m(e){const t=e.getService(c.Service.AccessoryInformation);t.setCharacteristic(c.Characteristic.Manufacturer,"c300x-controller"),t.setCharacteristic(c.Characteristic.Model,f),t.setCharacteristic(c.Characteristic.SerialNumber,"v"+d),t.setCharacteristic(c.Characteristic.FirmwareRevision,p)}class g{constructor(e,t){i.add(this),this.name=e,this.eventbus=t;const r=c.uuid.generate("hap-nodejs:accessories:switch:"+e);this.accessory=new c.Accessory(e,r),m(this.accessory),this.switchService=this.accessory.addService(c.Service.Switch,e),this.switchService.getCharacteristic(c.Characteristic.On).on("set",((r,i)=>{r?t.emit("homekit:switch:on:"+e,this):t.emit("homekit:switch:off:"+e,this),i(null)}));const o=(s=1e3,u=1e4,Math.round(Math.random()*(u-s)+s));var s,u;setTimeout((()=>{a(this,i,"m",n).call(this)}),o)}switchedOn(e){return this.eventbus.on("homekit:switch:on:"+this.name,(()=>{e(this)})),this}switchedOff(e){return this.eventbus.on("homekit:switch:off:"+this.name,(()=>{e(this)})),this}updateState(e){return this.eventbus.on("homekit:switch:update:"+this.name,(()=>{e().then((e=>{this.switchService.getCharacteristic(c.Characteristic.On).updateValue(e)})).finally((()=>{setTimeout((()=>{a(this,i,"m",n).call(this)}),6e4)}))})),this}}i=new WeakSet,n=function(){this.eventbus.emit("homekit:switch:update:"+this.name)};class v{constructor(e,t,r){this.id=e,this.eventbus=r,o.set(this,!0);const i=c.uuid.generate("hap-nodejs:accessories:lock:"+t);this.accessory=new c.Accessory(t,i),m(this.accessory),this.lockService=this.accessory.addService(c.Service.LockMechanism,t),this.lockService.getCharacteristic(c.Characteristic.LockTargetState).on("set",((t,i)=>{t===c.Characteristic.LockTargetState.UNSECURED?(s(this,o,!1,"f"),r.emit("homekit:lock:unlock:"+e,this),i(),setTimeout((()=>{s(this,o,!0,"f"),r.emit("homekit:lock:lock:"+e,this)}),3e3)):t===c.Characteristic.LockTargetState.SECURED&&(i(),this.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockCurrentState.SECURED))})),this.lockService.getCharacteristic(c.Characteristic.LockCurrentState).on("get",(e=>{a(this,o,"f")?e(void 0,c.Characteristic.LockCurrentState.SECURED):e(void 0,c.Characteristic.LockCurrentState.UNSECURED)})),this.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockCurrentState.SECURED)}unlocked(e){return this.eventbus.on("homekit:lock:unlock:"+this.id,(()=>{e(this)})),this}}function y(){return Math.round(1e5*Math.random())%10}o=new WeakMap,t.createHAPUsername=function(){const e=[];for(let t=0;t<6;t++)e.push((0,u.randomBytes)(1).toString("hex"));return e.join(":")},t.randomPinCode=function(){return`${y()}${y()}${y()}-${y()}${y()}-${y()}${y()}${y()}`};t.HomekitManager=class{constructor(e,t,r,i,n,o){this.eventbus=e,c.HAPStorage.setCustomStoragePath(t+"/storage"),i.videoProcessor||(i.$internalVideoProcessor=(0,h.fetchFffmpeg)(t)),f=o,d=n,this.bridge=new c.Bridge(r.displayName,c.uuid.generate("hap-nodejs:bridges:homebridge")),m(this.bridge),console.log("Bridge pairing code: "+r.pinCode),this.bridge.publish({username:r.username,pincode:r.pinCode,category:2,addIdentifyingMaterial:!1})}addDoorbell(e){const t=new c.Accessory(e.displayName,c.uuid.generate("hap-nodejs:accessories:doorbell:"+e.displayName));m(t);const r=new l.StreamingDelegate(e);return t.configureController(r.controller),this.eventbus.on("homekit:pressed",(()=>{console.log("HOMEKIT PRESSED EVENT");t.getService(c.Service.Doorbell).getCharacteristic(c.Characteristic.ProgrammableSwitchEvent).updateValue(c.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)})),t.publish({username:e.username,pincode:e.pinCode,category:18}),console.log("Camera pairing code: "+e.pinCode),{doorbell:t,streamingDelegate:r}}addLock(e,t){const r=new v(e,t,this.eventbus);return this.eventbus.on("homekit:locked:"+e,(e=>{!0===e?(r.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockTargetState.SECURED),r.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockTargetState.SECURED)):!1===e&&(r.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockTargetState.UNSECURED),r.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockTargetState.UNSECURED))})),this.bridge.addBridgedAccessory(r.accessory),r}addSwitch(e){const t=new g(e,this.eventbus);return this.bridge.addBridgedAccessory(t.accessory),t}updateFirmwareVersion(e){p=e,m(this.bridge),this.bridge.bridgedAccessories.forEach((e=>{m(e)}))}}},8947:(e,t,r)=>{!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=i>>24&255,e[t+5]=i>>16&255,e[t+6]=i>>8&255,e[t+7]=255&i}function m(e,t,r,i,n){var o,a=0;for(o=0;o>>8)-1}function g(e,t,r,i){return m(e,t,r,i,16)}function v(e,t,r,i){return m(e,t,r,i,32)}function y(e,t,r,i){!function(e,t,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,C=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,S=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,E=o,_=a,T=s,A=c,I=u,D=l,w=h,b=d,U=p,R=f,O=m,N=g,P=v,B=y,L=C,x=S,M=0;M<20;M+=2)E^=(n=(P^=(n=(U^=(n=(I^=(n=E+P|0)<<7|n>>>25)+E|0)<<9|n>>>23)+I|0)<<13|n>>>19)+U|0)<<18|n>>>14,D^=(n=(_^=(n=(B^=(n=(R^=(n=D+_|0)<<7|n>>>25)+D|0)<<9|n>>>23)+R|0)<<13|n>>>19)+B|0)<<18|n>>>14,O^=(n=(w^=(n=(T^=(n=(L^=(n=O+w|0)<<7|n>>>25)+O|0)<<9|n>>>23)+L|0)<<13|n>>>19)+T|0)<<18|n>>>14,x^=(n=(N^=(n=(b^=(n=(A^=(n=x+N|0)<<7|n>>>25)+x|0)<<9|n>>>23)+A|0)<<13|n>>>19)+b|0)<<18|n>>>14,E^=(n=(A^=(n=(T^=(n=(_^=(n=E+A|0)<<7|n>>>25)+E|0)<<9|n>>>23)+_|0)<<13|n>>>19)+T|0)<<18|n>>>14,D^=(n=(I^=(n=(b^=(n=(w^=(n=D+I|0)<<7|n>>>25)+D|0)<<9|n>>>23)+w|0)<<13|n>>>19)+b|0)<<18|n>>>14,O^=(n=(R^=(n=(U^=(n=(N^=(n=O+R|0)<<7|n>>>25)+O|0)<<9|n>>>23)+N|0)<<13|n>>>19)+U|0)<<18|n>>>14,x^=(n=(L^=(n=(B^=(n=(P^=(n=x+L|0)<<7|n>>>25)+x|0)<<9|n>>>23)+P|0)<<13|n>>>19)+B|0)<<18|n>>>14;E=E+o|0,_=_+a|0,T=T+s|0,A=A+c|0,I=I+u|0,D=D+l|0,w=w+h|0,b=b+d|0,U=U+p|0,R=R+f|0,O=O+m|0,N=N+g|0,P=P+v|0,B=B+y|0,L=L+C|0,x=x+S|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=T>>>0&255,e[9]=T>>>8&255,e[10]=T>>>16&255,e[11]=T>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=w>>>0&255,e[25]=w>>>8&255,e[26]=w>>>16&255,e[27]=w>>>24&255,e[28]=b>>>0&255,e[29]=b>>>8&255,e[30]=b>>>16&255,e[31]=b>>>24&255,e[32]=U>>>0&255,e[33]=U>>>8&255,e[34]=U>>>16&255,e[35]=U>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=O>>>0&255,e[41]=O>>>8&255,e[42]=O>>>16&255,e[43]=O>>>24&255,e[44]=N>>>0&255,e[45]=N>>>8&255,e[46]=N>>>16&255,e[47]=N>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=L>>>0&255,e[57]=L>>>8&255,e[58]=L>>>16&255,e[59]=L>>>24&255,e[60]=x>>>0&255,e[61]=x>>>8&255,e[62]=x>>>16&255,e[63]=x>>>24&255}(e,t,r,i)}function C(e,t,r,i){!function(e,t,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,C=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,S=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,E=0;E<20;E+=2)o^=(n=(v^=(n=(p^=(n=(u^=(n=o+v|0)<<7|n>>>25)+o|0)<<9|n>>>23)+u|0)<<13|n>>>19)+p|0)<<18|n>>>14,l^=(n=(a^=(n=(y^=(n=(f^=(n=l+a|0)<<7|n>>>25)+l|0)<<9|n>>>23)+f|0)<<13|n>>>19)+y|0)<<18|n>>>14,m^=(n=(h^=(n=(s^=(n=(C^=(n=m+h|0)<<7|n>>>25)+m|0)<<9|n>>>23)+C|0)<<13|n>>>19)+s|0)<<18|n>>>14,S^=(n=(g^=(n=(d^=(n=(c^=(n=S+g|0)<<7|n>>>25)+S|0)<<9|n>>>23)+c|0)<<13|n>>>19)+d|0)<<18|n>>>14,o^=(n=(c^=(n=(s^=(n=(a^=(n=o+c|0)<<7|n>>>25)+o|0)<<9|n>>>23)+a|0)<<13|n>>>19)+s|0)<<18|n>>>14,l^=(n=(u^=(n=(d^=(n=(h^=(n=l+u|0)<<7|n>>>25)+l|0)<<9|n>>>23)+h|0)<<13|n>>>19)+d|0)<<18|n>>>14,m^=(n=(f^=(n=(p^=(n=(g^=(n=m+f|0)<<7|n>>>25)+m|0)<<9|n>>>23)+g|0)<<13|n>>>19)+p|0)<<18|n>>>14,S^=(n=(C^=(n=(y^=(n=(v^=(n=S+C|0)<<7|n>>>25)+S|0)<<9|n>>>23)+v|0)<<13|n>>>19)+y|0)<<18|n>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=h>>>0&255,e[17]=h>>>8&255,e[18]=h>>>16&255,e[19]=h>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=p>>>0&255,e[25]=p>>>8&255,e[26]=p>>>16&255,e[27]=p>>>24&255,e[28]=f>>>0&255,e[29]=f>>>8&255,e[30]=f>>>16&255,e[31]=f>>>24&255}(e,t,r,i)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,r,i,n,o,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;n>=64;){for(y(l,u,a,S),c=0;c<64;c++)e[t+c]=r[i+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;n-=64,t+=64,i+=64}if(n>0)for(y(l,u,a,S),c=0;c=64;){for(y(c,s,n,S),a=0;a<64;a++)e[t+a]=c[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(y(c,s,n,S),a=0;a>>13|r<<3),i=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|i<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(i>>>7|n<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function D(e,t,r,i,n,o){var a=new I(o);return a.update(r,i,n),a.finish(e,t),0}function w(e,t,r,i,n,o){var a=new Uint8Array(16);return D(a,0,r,i,n,o),g(e,t,a,0)}function b(e,t,r,i,n){var o;if(r<32)return-1;for(A(e,0,t,0,r,i,n),D(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function U(e,t,r,i,n){var o,a=new Uint8Array(32);if(r<32)return-1;if(T(a,0,32,i,n),0!==w(t,16,t,32,r-32,a))return-1;for(A(e,0,t,0,r,i,n),o=0;o<32;o++)e[o]=0;return 0}function R(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,i=1;for(t=0;t<16;t++)r=e[t]+i+65535,i=Math.floor(r/65536),e[t]=r-65536*i;e[0]+=i-1+37*(i-1)}function N(e,t,r){for(var i,n=~(r-1),o=0;o<16;o++)i=n&(e[o]^t[o]),e[o]^=i,t[o]^=i}function P(e,r){var i,n,o,a=t(),s=t();for(i=0;i<16;i++)s[i]=r[i];for(O(s),O(s),O(s),n=0;n<2;n++){for(a[0]=s[0]-65517,i=1;i<15;i++)a[i]=s[i]-65535-(a[i-1]>>16&1),a[i-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,N(s,a,1-o)}for(i=0;i<16;i++)e[2*i]=255&s[i],e[2*i+1]=s[i]>>8}function B(e,t){var r=new Uint8Array(32),i=new Uint8Array(32);return P(r,e),P(i,t),v(r,0,i,0)}function L(e){var t=new Uint8Array(32);return P(t,e),1&t[0]}function x(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function M(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]+r[i]}function F(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]-r[i]}function k(e,t,r){var i,n,o=0,a=0,s=0,c=0,u=0,l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=i*V),u+=38*(I+=i*H),l+=38*(D+=i*j),h+=38*(w+=i*G),d+=38*(b+=i*W),p+=38*(U+=i*Y),f+=38*(R+=i*q),m+=38*(O+=i*K),g+=38*(N+=i*$),v+=38*(P+=i*z),y+=38*(B+=i*Q),C+=38*(L+=i*X),o=(i=(o+=38*(E+=i*M))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),C=(i=C+n+65535)-65536*(n=Math.floor(i/65536)),S=(i=S+n+65535)-65536*(n=Math.floor(i/65536)),o=(i=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),C=(i=C+n+65535)-65536*(n=Math.floor(i/65536)),S=(i=S+n+65535)-65536*(n=Math.floor(i/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=d,e[8]=p,e[9]=f,e[10]=m,e[11]=g,e[12]=v,e[13]=y,e[14]=C,e[15]=S}function V(e,t){k(e,t,t)}function H(e,r){var i,n=t();for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)V(n,n),2!==i&&4!==i&&k(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function j(e,r){var i,n=t();for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)V(n,n),1!==i&&k(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function G(e,r,i){var n,o,a=new Uint8Array(32),s=new Float64Array(80),u=t(),l=t(),h=t(),d=t(),p=t(),f=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,x(s,i),o=0;o<16;o++)l[o]=s[o],d[o]=u[o]=h[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)N(u,l,n=a[o>>>3]>>>(7&o)&1),N(h,d,n),M(p,u,h),F(u,u,h),M(h,l,d),F(l,l,d),V(d,p),V(f,u),k(u,h,u),k(h,l,p),M(p,u,h),F(u,u,h),V(l,u),F(h,d,f),k(u,h,c),M(u,u,d),k(h,h,u),k(u,d,f),k(d,l,s),V(l,p),N(u,l,n),N(h,d,n);for(o=0;o<16;o++)s[o+16]=u[o],s[o+32]=h[o],s[o+48]=l[o],s[o+64]=d[o];var m=s.subarray(32),g=s.subarray(16);return H(m,m),k(g,g,m),P(e,g),0}function W(e,t){return G(e,t,o)}function Y(e,t){return i(t,32),W(e,t)}function q(e,t,r){var i=new Uint8Array(32);return G(i,r,t),C(e,n,i,S)}I.prototype.blocks=function(e,t,r){for(var i,n,o,a,s,c,u,l,h,d,p,f,m,g,v,y,C,S,E,_=this.fin?0:2048,T=this.h[0],A=this.h[1],I=this.h[2],D=this.h[3],w=this.h[4],b=this.h[5],U=this.h[6],R=this.h[7],O=this.h[8],N=this.h[9],P=this.r[0],B=this.r[1],L=this.r[2],x=this.r[3],M=this.r[4],F=this.r[5],k=this.r[6],V=this.r[7],H=this.r[8],j=this.r[9];r>=16;)d=h=0,d+=(T+=8191&(i=255&e[t+0]|(255&e[t+1])<<8))*P,d+=(A+=8191&(i>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*j),d+=(I+=8191&(n>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*H),d+=(D+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*V),h=(d+=(w+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*k))>>>13,d&=8191,d+=(b+=s>>>1&8191)*(5*F),d+=(U+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*M),d+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*x),d+=(O+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*L),p=h+=(d+=(N+=l>>>5|_)*(5*B))>>>13,p+=T*B,p+=A*P,p+=I*(5*j),p+=D*(5*H),h=(p+=w*(5*V))>>>13,p&=8191,p+=b*(5*k),p+=U*(5*F),p+=R*(5*M),p+=O*(5*x),h+=(p+=N*(5*L))>>>13,p&=8191,f=h,f+=T*L,f+=A*B,f+=I*P,f+=D*(5*j),h=(f+=w*(5*H))>>>13,f&=8191,f+=b*(5*V),f+=U*(5*k),f+=R*(5*F),f+=O*(5*M),m=h+=(f+=N*(5*x))>>>13,m+=T*x,m+=A*L,m+=I*B,m+=D*P,h=(m+=w*(5*j))>>>13,m&=8191,m+=b*(5*H),m+=U*(5*V),m+=R*(5*k),m+=O*(5*F),g=h+=(m+=N*(5*M))>>>13,g+=T*M,g+=A*x,g+=I*L,g+=D*B,h=(g+=w*P)>>>13,g&=8191,g+=b*(5*j),g+=U*(5*H),g+=R*(5*V),g+=O*(5*k),v=h+=(g+=N*(5*F))>>>13,v+=T*F,v+=A*M,v+=I*x,v+=D*L,h=(v+=w*B)>>>13,v&=8191,v+=b*P,v+=U*(5*j),v+=R*(5*H),v+=O*(5*V),y=h+=(v+=N*(5*k))>>>13,y+=T*k,y+=A*F,y+=I*M,y+=D*x,h=(y+=w*L)>>>13,y&=8191,y+=b*B,y+=U*P,y+=R*(5*j),y+=O*(5*H),C=h+=(y+=N*(5*V))>>>13,C+=T*V,C+=A*k,C+=I*F,C+=D*M,h=(C+=w*x)>>>13,C&=8191,C+=b*L,C+=U*B,C+=R*P,C+=O*(5*j),S=h+=(C+=N*(5*H))>>>13,S+=T*H,S+=A*V,S+=I*k,S+=D*F,h=(S+=w*M)>>>13,S&=8191,S+=b*x,S+=U*L,S+=R*B,S+=O*P,E=h+=(S+=N*(5*j))>>>13,E+=T*j,E+=A*H,E+=I*V,E+=D*k,h=(E+=w*F)>>>13,E&=8191,E+=b*M,E+=U*x,E+=R*L,E+=O*B,T=d=8191&(h=(h=((h+=(E+=N*P)>>>13)<<2)+h|0)+(d&=8191)|0),A=p+=h>>>=13,I=f&=8191,D=m&=8191,w=g&=8191,b=v&=8191,U=y&=8191,R=C&=8191,O=S&=8191,N=E&=8191,t+=16,r-=16;this.h[0]=T,this.h[1]=A,this.h[2]=I,this.h[3]=D,this.h[4]=w,this.h[5]=b,this.h[6]=U,this.h[7]=R,this.h[8]=O,this.h[9]=N},I.prototype.finish=function(e,t){var r,i,n,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,i=(1^r)-1,o=0;o<10;o++)a[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,o=1;o<8;o++)n=(this.h[o]+this.pad[o]|0)+(n>>>16)|0,this.h[o]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},I.prototype.update=function(e,t,r){var i,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),i=0;i=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(i=0;i=128;){for(_=0;_<16;_++)T=8*_+$,R[_]=r[T+0]<<24|r[T+1]<<16|r[T+2]<<8|r[T+3],O[_]=r[T+4]<<24|r[T+5]<<16|r[T+6]<<8|r[T+7];for(_=0;_<80;_++)if(n=N,o=P,a=B,s=L,c=x,u=M,l=F,k,d=V,p=H,f=j,m=G,g=W,v=Y,y=q,K,D=65535&(I=K),w=I>>>16,b=65535&(A=k),U=A>>>16,D+=65535&(I=(W>>>14|x<<18)^(W>>>18|x<<14)^(x>>>9|W<<23)),w+=I>>>16,b+=65535&(A=(x>>>14|W<<18)^(x>>>18|W<<14)^(W>>>9|x<<23)),U+=A>>>16,D+=65535&(I=W&Y^~W&q),w+=I>>>16,b+=65535&(A=x&M^~x&F),U+=A>>>16,A=z[2*_],D+=65535&(I=z[2*_+1]),w+=I>>>16,b+=65535&A,U+=A>>>16,A=R[_%16],w+=(I=O[_%16])>>>16,b+=65535&A,U+=A>>>16,b+=(w+=(D+=65535&I)>>>16)>>>16,D=65535&(I=E=65535&D|w<<16),w=I>>>16,b=65535&(A=S=65535&b|(U+=b>>>16)<<16),U=A>>>16,D+=65535&(I=(V>>>28|N<<4)^(N>>>2|V<<30)^(N>>>7|V<<25)),w+=I>>>16,b+=65535&(A=(N>>>28|V<<4)^(V>>>2|N<<30)^(V>>>7|N<<25)),U+=A>>>16,w+=(I=V&H^V&j^H&j)>>>16,b+=65535&(A=N&P^N&B^P&B),U+=A>>>16,h=65535&(b+=(w+=(D+=65535&I)>>>16)>>>16)|(U+=b>>>16)<<16,C=65535&D|w<<16,D=65535&(I=m),w=I>>>16,b=65535&(A=s),U=A>>>16,w+=(I=E)>>>16,b+=65535&(A=S),U+=A>>>16,P=n,B=o,L=a,x=s=65535&(b+=(w+=(D+=65535&I)>>>16)>>>16)|(U+=b>>>16)<<16,M=c,F=u,k=l,N=h,H=d,j=p,G=f,W=m=65535&D|w<<16,Y=g,q=v,K=y,V=C,_%16==15)for(T=0;T<16;T++)A=R[T],D=65535&(I=O[T]),w=I>>>16,b=65535&A,U=A>>>16,A=R[(T+9)%16],D+=65535&(I=O[(T+9)%16]),w+=I>>>16,b+=65535&A,U+=A>>>16,S=R[(T+1)%16],D+=65535&(I=((E=O[(T+1)%16])>>>1|S<<31)^(E>>>8|S<<24)^(E>>>7|S<<25)),w+=I>>>16,b+=65535&(A=(S>>>1|E<<31)^(S>>>8|E<<24)^S>>>7),U+=A>>>16,S=R[(T+14)%16],w+=(I=((E=O[(T+14)%16])>>>19|S<<13)^(S>>>29|E<<3)^(E>>>6|S<<26))>>>16,b+=65535&(A=(S>>>19|E<<13)^(E>>>29|S<<3)^S>>>6),U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,R[T]=65535&b|U<<16,O[T]=65535&D|w<<16;D=65535&(I=V),w=I>>>16,b=65535&(A=N),U=A>>>16,A=e[0],w+=(I=t[0])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[0]=N=65535&b|U<<16,t[0]=V=65535&D|w<<16,D=65535&(I=H),w=I>>>16,b=65535&(A=P),U=A>>>16,A=e[1],w+=(I=t[1])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[1]=P=65535&b|U<<16,t[1]=H=65535&D|w<<16,D=65535&(I=j),w=I>>>16,b=65535&(A=B),U=A>>>16,A=e[2],w+=(I=t[2])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[2]=B=65535&b|U<<16,t[2]=j=65535&D|w<<16,D=65535&(I=G),w=I>>>16,b=65535&(A=L),U=A>>>16,A=e[3],w+=(I=t[3])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[3]=L=65535&b|U<<16,t[3]=G=65535&D|w<<16,D=65535&(I=W),w=I>>>16,b=65535&(A=x),U=A>>>16,A=e[4],w+=(I=t[4])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[4]=x=65535&b|U<<16,t[4]=W=65535&D|w<<16,D=65535&(I=Y),w=I>>>16,b=65535&(A=M),U=A>>>16,A=e[5],w+=(I=t[5])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[5]=M=65535&b|U<<16,t[5]=Y=65535&D|w<<16,D=65535&(I=q),w=I>>>16,b=65535&(A=F),U=A>>>16,A=e[6],w+=(I=t[6])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[6]=F=65535&b|U<<16,t[6]=q=65535&D|w<<16,D=65535&(I=K),w=I>>>16,b=65535&(A=k),U=A>>>16,A=e[7],w+=(I=t[7])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[7]=k=65535&b|U<<16,t[7]=K=65535&D|w<<16,$+=128,i-=128}return i}function X(e,t,r){var i,n=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,Q(n,o,t,r),r%=128,i=0;i=0;--n)Z(e,t,i=r[n/8|0]>>(7&n)&1),J(t,e),J(e,e),Z(e,t,i)}function re(e,r){var i=[t(),t(),t(),t()];R(i[0],h),R(i[1],d),R(i[2],s),k(i[3],h,d),te(e,i,r)}function ie(e,r,n){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(n||i(r,32),X(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64,re(s,a),ee(e,s),o=0;o<32;o++)r[o+32]=e[o];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function oe(e,t){var r,i,n,o;for(i=63;i>=32;--i){for(r=0,n=i-32,o=i-12;n>4)*ne[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*ne[n];for(i=0;i<32;i++)t[i+1]+=t[i]>>8,e[i]=255&t[i]}function ae(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;oe(e,r)}function se(e,r,i,n){var o,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),h=[t(),t(),t(),t()];X(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=i+64;for(o=0;o>7&&F(e[0],a,e[0]),k(e[3],e[0],e[1]),0)}(d,n))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(he),t=new Uint8Array(de);return ie(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(fe(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(he),r=0;r{"use strict";var i=r(4761),n=r(1703),o=r(5128),a=r(3612),s=r(9803);e.exports=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e?null:i(e)?"String":n(e)?"Number":o(e)?"Boolean":a(e)?"Symbol":s(e)?"BigInt":void 0}},593:(e,t,r)=>{"use strict";var i=r(3802),n=r(256),o=r(7842),a=r(2648);e.exports=function(e){if(e&&"object"==typeof e){if(i(e))return"Map";if(n(e))return"Set";if(o(e))return"WeakMap";if(a(e))return"WeakSet"}return!1}},5767:(e,t,r)=>{"use strict";var i=r(2682),n=r(9209),o=r(487),a=r(8075),s=r(5795),c=a("Object.prototype.toString"),u=r(9092)(),l="undefined"==typeof globalThis?global:globalThis,h=n(),d=a("String.prototype.slice"),p=Object.getPrototypeOf,f=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1?t:"Object"===t&&function(e){var t=!1;return i(m,(function(r,i){if(!t)try{r(e),t=d(i,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return i(m,(function(r,i){if(!t)try{"$"+r(e)===i&&(t=d(i,1))}catch(e){}})),t}(e):null}},3177:function(e,t){(function(){"use strict";t.stripBOM=function(e){return"\ufeff"===e[0]?e.substring(1):e}}).call(this)},6712:function(e,t,r){(function(){"use strict";var e,i,n,o,a,s={}.hasOwnProperty;e=r(2046),i=r(6465).defaults,o=function(e){return"string"==typeof e&&(e.indexOf("&")>=0||e.indexOf(">")>=0||e.indexOf("<")>=0)},a=function(e){return""},n=function(e){return e.replace("]]>","]]]]>")},t.Builder=function(){function t(e){var t,r,n;for(t in this.options={},r=i[.2])s.call(r,t)&&(n=r[t],this.options[t]=n);for(t in e)s.call(e,t)&&(n=e[t],this.options[t]=n)}return t.prototype.buildObject=function(t){var r,n,c,u,l,h;return r=this.options.attrkey,n=this.options.charkey,1===Object.keys(t).length&&this.options.rootName===i[.2].rootName?t=t[l=Object.keys(t)[0]]:l=this.options.rootName,h=this,c=function(e,t){var i,u,l,d,p,f;if("object"!=typeof t)h.options.cdata&&o(t)?e.raw(a(t)):e.txt(t);else if(Array.isArray(t)){for(d in t)if(s.call(t,d))for(p in u=t[d])l=u[p],e=c(e.ele(p),l).up()}else for(p in t)if(s.call(t,p))if(u=t[p],p===r){if("object"==typeof u)for(i in u)f=u[i],e=e.att(i,f)}else if(p===n)e=h.options.cdata&&o(u)?e.raw(a(u)):e.txt(u);else if(Array.isArray(u))for(d in u)s.call(u,d)&&(e="string"==typeof(l=u[d])?h.options.cdata&&o(l)?e.ele(p).raw(a(l)).up():e.ele(p,l).up():c(e.ele(p),l).up());else"object"==typeof u?e=c(e.ele(p),u).up():"string"==typeof u&&h.options.cdata&&o(u)?e=e.ele(p).raw(a(u)).up():(null==u&&(u=""),e=e.ele(p,u.toString()).up());return e},u=e.create(l,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(u,t).end(this.options.renderOpts)},t}()}).call(this)},6465:function(e,t){(function(){t.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(this)},1912:function(e,t,r){(function(){"use strict";var e,i,n,o,a,s,c,u,l,h=function(e,t){return function(){return e.apply(t,arguments)}},d={}.hasOwnProperty;u=r(4043),o=r(4434),e=r(3177),c=r(2114),l=r(3557).setImmediate,i=r(6465).defaults,a=function(e){return"object"==typeof e&&null!=e&&0===Object.keys(e).length},s=function(e,t,r){var i,n;for(i=0,n=e.length;i0&&(u[e.options.childkey]=h),h=u;return i.length>0?e.assignOrPush(m,l,h):(e.options.explicitRoot&&(f=h,n(h={},l,f)),e.resultObject=h,e.saxParser.ended=!0,e.emit("end",e.resultObject))}}(this),r=function(e){return function(r){var n,o;if(o=i[i.length-1])return o[t]+=r,e.options.explicitChildren&&e.options.preserveChildrenOrder&&e.options.charsAsChildren&&(e.options.includeWhiteChars||""!==r.replace(/\\n/g,"").trim())&&(o[e.options.childkey]=o[e.options.childkey]||[],(n={"#name":"__text__"})[t]=r,e.options.normalize&&(n[t]=n[t].replace(/\s{2,}/g," ").trim()),o[e.options.childkey].push(n)),o}}(this),this.saxParser.ontext=r,this.saxParser.oncdata=function(e){var t;if(t=r(e))return t.cdata=!0}},o.prototype.parseString=function(t,r){var i;null!=r&&"function"==typeof r&&(this.on("end",(function(e){return this.reset(),r(null,e)})),this.on("error",(function(e){return this.reset(),r(e)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=e.stripBOM(t),this.options.async?(this.remaining=t,l(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(e){if(i=e,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",i),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw i}},o.prototype.parseStringPromise=function(e){return new Promise((t=this,function(r,i){return t.parseString(e,(function(e,t){return e?i(e):r(t)}))}));var t},o}(o),t.parseString=function(e,r,i){var n,o;return null!=i?("function"==typeof i&&(n=i),"object"==typeof r&&(o=r)):("function"==typeof r&&(n=r),o={}),new t.Parser(o).parseString(e,n)},t.parseStringPromise=function(e,r){var i;return"object"==typeof r&&(i=r),new t.Parser(i).parseStringPromise(e)}}).call(this)},2114:function(e,t){(function(){"use strict";var e;e=new RegExp(/(?!xmlns)^.*:/),t.normalize=function(e){return e.toLowerCase()},t.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},t.stripPrefix=function(t){return t.replace(e,"")},t.parseNumbers=function(e){return isNaN(e)||(e=e%1==0?parseInt(e,10):parseFloat(e)),e},t.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e="true"===e.toLowerCase()),e}}).call(this)},8805:function(e,t,r){(function(){"use strict";var e,i,n,o,a={}.hasOwnProperty;i=r(6465),e=r(6712),n=r(1912),o=r(2114),t.defaults=i.defaults,t.processors=o,t.ValidationError=function(e){function t(e){this.message=e}return function(e,t){for(var r in t)a.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(t,Error),t}(),t.Builder=e.Builder,t.Parser=n.Parser,t.parseString=n.parseString,t.parseStringPromise=n.parseStringPromise}).call(this)},4923:function(e){(function(){e.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},1737:function(e){(function(){e.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},9241:function(e){(function(){var t,r,i,n,o,a,s,c=[].slice,u={}.hasOwnProperty;t=function(){var e,t,r,i,n,a;if(a=arguments[0],n=2<=arguments.length?c.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(e=0,r=n.length;e":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},e.prototype.isEqualNode=function(e){return e.namespaceURI===this.namespaceURI&&(e.prefix===this.prefix&&(e.localName===this.localName&&e.value===this.value))},e}()}).call(this)},2691:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;t=r(1737),i=r(7457),e.exports=function(e){function r(e,i){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(i)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return this.options.writer.cdata(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},7457:function(e,t,r){(function(){var t,i={}.hasOwnProperty;t=r(468),e.exports=function(e){function t(e){t.__super__.constructor.call(this,e),this.value=""}return function(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(t,e),Object.defineProperty(t.prototype,"data",{get:function(){return this.value},set:function(e){return this.value=e||""}}),Object.defineProperty(t.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(e){return this.value=e||""}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.substringData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.appendData=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.insertData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.deleteData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.replaceData=function(e,t,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isEqualNode=function(e){return!!t.__super__.isEqualNode.apply(this,arguments).isEqualNode(e)&&e.data===this.data},t}(t)}).call(this)},2679:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;t=r(1737),i=r(7457),e.exports=function(e){function r(e,i){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(i)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return this.options.writer.comment(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},3074:function(e,t,r){(function(){var t,i;t=r(5660),i=r(2527),e.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new t,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(e.prototype,"parameterNames",{get:function(){return new i(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(e){return this.params.hasOwnProperty(e)?this.params[e]:null},e.prototype.canSetParameter=function(e,t){return!0},e.prototype.setParameter=function(e,t){return null!=t?this.params[e]=t:delete this.params[e]},e}()}).call(this)},5660:function(e){(function(){e.exports=function(){function e(){}return e.prototype.handleError=function(e){throw new Error(e)},e}()}).call(this)},7260:function(e){(function(){e.exports=function(){function e(){}return e.prototype.hasFeature=function(e,t){return!0},e.prototype.createDocumentType=function(e,t,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(e,t,r){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(e){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(e,t){throw new Error("This DOM method is not implemented.")},e}()}).call(this)},2527:function(e){(function(){e.exports=function(){function e(e){this.arr=e||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(e){return this.arr[e]||null},e.prototype.contains=function(e){return-1!==this.arr.indexOf(e)},e}()}).call(this)},4111:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n,o,a,s){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==n)throw new Error("Missing DTD attribute name. "+this.debugInfo(i));if(!o)throw new Error("Missing DTD attribute type. "+this.debugInfo(i));if(!a)throw new Error("Missing DTD attribute default. "+this.debugInfo(i));if(0!==a.indexOf("#")&&(a="#"+a),!a.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(i));if(s&&!a.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(i));this.elementName=this.stringify.name(i),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(n),this.attributeType=this.stringify.dtdAttType(o),s&&(this.defaultValue=this.stringify.dtdAttDefault(s)),this.defaultValueType=a}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},7696:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());n||(n="(#PCDATA)"),Array.isArray(n)&&(n="("+n.join(",")+")"),this.name=this.stringify.name(i),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(n)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},5529:function(e,t,r){(function(){var t,i,n,o={}.hasOwnProperty;n=r(9241).isObject,i=r(468),t=r(1737),e.exports=function(e){function r(e,i,o,a){if(r.__super__.constructor.call(this,e),null==o)throw new Error("Missing DTD entity name. "+this.debugInfo(o));if(null==a)throw new Error("Missing DTD entity value. "+this.debugInfo(o));if(this.pe=!!i,this.name=this.stringify.name(o),this.type=t.EntityDeclaration,n(a)){if(!a.pubID&&!a.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(o));if(a.pubID&&!a.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(o));if(this.internal=!1,null!=a.pubID&&(this.pubID=this.stringify.dtdPubID(a.pubID)),null!=a.sysID&&(this.sysID=this.stringify.dtdSysID(a.sysID)),null!=a.nData&&(this.nData=this.stringify.dtdNData(a.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(o))}else this.value=this.stringify.dtdEntityValue(a),this.internal=!0}return function(e,t){for(var r in t)o.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(r.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(r.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlVersion",{get:function(){return null}}),r.prototype.toString=function(e){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},8012:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD notation name. "+this.debugInfo(i));if(!n.pubID&&!n.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(i));this.name=this.stringify.name(i),this.type=t.NotationDeclaration,null!=n.pubID&&(this.pubID=this.stringify.dtdPubID(n.pubID)),null!=n.sysID&&(this.sysID=this.stringify.dtdSysID(n.sysID))}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),r.prototype.toString=function(e){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},4130:function(e,t,r){(function(){var t,i,n,o={}.hasOwnProperty;n=r(9241).isObject,i=r(468),t=r(1737),e.exports=function(e){function r(e,i,o,a){var s;r.__super__.constructor.call(this,e),n(i)&&(i=(s=i).version,o=s.encoding,a=s.standalone),i||(i="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(i),null!=o&&(this.encoding=this.stringify.xmlEncoding(o)),null!=a&&(this.standalone=this.stringify.xmlStandalone(a))}return function(e,t){for(var r in t)o.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.declaration(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},6376:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l={}.hasOwnProperty;u=r(9241).isObject,c=r(468),t=r(1737),i=r(4111),o=r(5529),n=r(7696),a=r(8012),s=r(4797),e.exports=function(e){function r(e,i,n){var o,a,s,c,l,h;if(r.__super__.constructor.call(this,e),this.type=t.DocType,e.children)for(a=0,s=(c=e.children).length;a=0;)this.up();return this.onEnd()},e.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},e.prototype.openNode=function(e){var r,n,o,a;if(!e.isOpen){if(this.root||0!==this.currentLevel||e.type!==t.Element||(this.root=e),n="",e.type===t.Element){for(o in this.writerOptions.state=i.OpenTag,n=this.writer.indent(e,this.writerOptions,this.currentLevel)+"<"+e.name,a=e.attribs)I.call(a,o)&&(r=a[o],n+=this.writer.attribute(r,this.writerOptions,this.currentLevel));n+=(e.children?">":"/>")+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=i.InsideTag}else this.writerOptions.state=i.OpenTag,n=this.writer.indent(e,this.writerOptions,this.currentLevel)+""),n+=this.writer.endline(e,this.writerOptions,this.currentLevel);return this.onData(n,this.currentLevel),e.isOpen=!0}},e.prototype.closeNode=function(e){var r;if(!e.isClosed)return r="",this.writerOptions.state=i.CloseTag,r=e.type===t.Element?this.writer.indent(e,this.writerOptions,this.currentLevel)+""+this.writer.endline(e,this.writerOptions,this.currentLevel):this.writer.indent(e,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=i.None,this.onData(r,this.currentLevel),e.isClosed=!0},e.prototype.onData=function(e,t){return this.documentStarted=!0,this.onDataCallback(e,t+1)},e.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},e.prototype.debugInfo=function(e){return null==e?"":"node: <"+e+">"},e.prototype.ele=function(){return this.element.apply(this,arguments)},e.prototype.nod=function(e,t,r){return this.node(e,t,r)},e.prototype.txt=function(e){return this.text(e)},e.prototype.dat=function(e){return this.cdata(e)},e.prototype.com=function(e){return this.comment(e)},e.prototype.ins=function(e,t){return this.instruction(e,t)},e.prototype.dec=function(e,t,r){return this.declaration(e,t,r)},e.prototype.dtd=function(e,t,r){return this.doctype(e,t,r)},e.prototype.e=function(e,t,r){return this.element(e,t,r)},e.prototype.n=function(e,t,r){return this.node(e,t,r)},e.prototype.t=function(e){return this.text(e)},e.prototype.d=function(e){return this.cdata(e)},e.prototype.c=function(e){return this.comment(e)},e.prototype.r=function(e){return this.raw(e)},e.prototype.i=function(e,t){return this.instruction(e,t)},e.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.ent=function(e,t){return this.entity(e,t)},e.prototype.pent=function(e,t){return this.pEntity(e,t)},e.prototype.not=function(e,t){return this.notation(e,t)},e}()}).call(this)},1218:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e){r.__super__.constructor.call(this,e),this.type=t.Dummy}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return""},r}(i)}).call(this)},3906:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l={}.hasOwnProperty;u=r(9241),c=u.isObject,s=u.isFunction,a=u.getValue,o=r(468),t=r(1737),i=r(4238),n=r(4797),e.exports=function(e){function r(e,i,n){var o,a,s,c;if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(i),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,null!=n&&this.attribute(n),e.type===t.Document&&(this.isRoot=!0,this.documentObject=e,e.rootObject=this,e.children))for(a=0,s=(c=e.children).length;a=n;t=0<=n?++i:--i)if(!this.attribs[t].isEqualNode(e.attribs[t]))return!1;return!0},r}(o)}).call(this)},4797:function(e){(function(){e.exports=function(){function e(e){this.nodes=e}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(e){return this.nodes[e]},e.prototype.setNamedItem=function(e){var t;return t=this.nodes[e.nodeName],this.nodes[e.nodeName]=e,t||null},e.prototype.removeNamedItem=function(e){var t;return t=this.nodes[e],delete this.nodes[e],t||null},e.prototype.item=function(e){return this.nodes[Object.keys(this.nodes)[e]]||null},e.prototype.getNamedItemNS=function(e,t){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(e){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(e,t){throw new Error("This DOM method is not implemented.")},e}()}).call(this)},468:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l,h,d,p,f,m,g,v,y,C={}.hasOwnProperty;y=r(9241),v=y.isObject,g=y.isFunction,m=y.isEmpty,f=y.getValue,u=null,n=null,o=null,a=null,s=null,d=null,p=null,h=null,c=null,i=null,l=null,t=null,e.exports=function(){function e(e){this.parent=e,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=r(3906),n=r(2691),o=r(2679),a=r(4130),s=r(6376),d=r(1268),p=r(2535),h=r(5915),c=r(1218),i=r(1737),l=r(6684),r(4797),t=r(4923))}return Object.defineProperty(e.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){var e;return e=this.parent.children.indexOf(this),this.parent.children[e-1]||null}}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){var e;return e=this.parent.children.indexOf(this),this.parent.children[e+1]||null}}),Object.defineProperty(e.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(e.prototype,"textContent",{get:function(){var e,t,r,n,o;if(this.nodeType===i.Element||this.nodeType===i.DocumentFragment){for(o="",t=0,r=(n=this.children).length;t":(null!=(r=this.parent)?r.name:void 0)?"node: <"+e+">, parent: <"+this.parent.name+">":"node: <"+e+">":""},e.prototype.ele=function(e,t,r){return this.element(e,t,r)},e.prototype.nod=function(e,t,r){return this.node(e,t,r)},e.prototype.txt=function(e){return this.text(e)},e.prototype.dat=function(e){return this.cdata(e)},e.prototype.com=function(e){return this.comment(e)},e.prototype.ins=function(e,t){return this.instruction(e,t)},e.prototype.doc=function(){return this.document()},e.prototype.dec=function(e,t,r){return this.declaration(e,t,r)},e.prototype.e=function(e,t,r){return this.element(e,t,r)},e.prototype.n=function(e,t,r){return this.node(e,t,r)},e.prototype.t=function(e){return this.text(e)},e.prototype.d=function(e){return this.cdata(e)},e.prototype.c=function(e){return this.comment(e)},e.prototype.r=function(e){return this.raw(e)},e.prototype.i=function(e,t){return this.instruction(e,t)},e.prototype.u=function(){return this.up()},e.prototype.importXMLBuilder=function(e){return this.importDocument(e)},e.prototype.replaceChild=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.removeChild=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendChild=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.hasChildNodes=function(){return 0!==this.children.length},e.prototype.cloneNode=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isSupported=function(e,t){return!0},e.prototype.hasAttributes=function(){return 0!==this.attribs.length},e.prototype.compareDocumentPosition=function(e){var r,i;return(r=this)===e?0:this.document()!==e.document()?(i=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?i|=t.Preceding:i|=t.Following,i):r.isAncestor(e)?t.Contains|t.Preceding:r.isDescendant(e)?t.Contains|t.Following:r.isPreceding(e)?t.Preceding:t.Following},e.prototype.isSameNode=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupPrefix=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isDefaultNamespace=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupNamespaceURI=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(e){var t,r,i;if(e.nodeType!==this.nodeType)return!1;if(e.children.length!==this.children.length)return!1;for(t=r=0,i=this.children.length-1;0<=i?r<=i:r>=i;t=0<=i?++r:--r)if(!this.children[t].isEqualNode(e.children[t]))return!1;return!0},e.prototype.getFeature=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setUserData=function(e,t,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getUserData=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.contains=function(e){return!!e&&(e===this||this.isDescendant(e))},e.prototype.isDescendant=function(e){var t,r,i,n;for(r=0,i=(n=this.children).length;rr},e.prototype.treePosition=function(e){var t,r;return r=0,t=!1,this.foreachTreeNode(this.document(),(function(i){if(r++,!t&&i===e)return t=!0})),t?r:-1},e.prototype.foreachTreeNode=function(e,t){var r,i,n,o,a;for(e||(e=this.document()),i=0,n=(o=e.children).length;i0){for(this.stream.write(" ["),this.stream.write(this.endline(e,t,r)),t.state=i.InsideTag,o=0,a=(s=e.children).length;o"),this.stream.write(this.endline(e,t,r)),t.state=i.None,this.closeNode(e,t,r)},r.prototype.element=function(e,r,n){var a,s,c,u,l,h,d,p,f;for(d in n||(n=0),this.openNode(e,r,n),r.state=i.OpenTag,this.stream.write(this.indent(e,r,n)+"<"+e.name),p=e.attribs)o.call(p,d)&&(a=p[d],this.attribute(a,r,n));if(u=0===(c=e.children.length)?null:e.children[0],0===c||e.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))r.allowEmpty?(this.stream.write(">"),r.state=i.CloseTag,this.stream.write("")):(r.state=i.CloseTag,this.stream.write(r.spaceBeforeSlash+"/>"));else if(!r.pretty||1!==c||u.type!==t.Text&&u.type!==t.Raw||null==u.value){for(this.stream.write(">"+this.endline(e,r,n)),r.state=i.InsideTag,l=0,h=(f=e.children).length;l")}else this.stream.write(">"),r.state=i.InsideTag,r.suppressPrettyCount++,!0,this.writeChildNode(u,r,n+1),r.suppressPrettyCount--,!1,r.state=i.CloseTag,this.stream.write("");return this.stream.write(this.endline(e,r,n)),r.state=i.None,this.closeNode(e,r,n)},r.prototype.processingInstruction=function(e,t,i){return this.stream.write(r.__super__.processingInstruction.call(this,e,t,i))},r.prototype.raw=function(e,t,i){return this.stream.write(r.__super__.raw.call(this,e,t,i))},r.prototype.text=function(e,t,i){return this.stream.write(r.__super__.text.call(this,e,t,i))},r.prototype.dtdAttList=function(e,t,i){return this.stream.write(r.__super__.dtdAttList.call(this,e,t,i))},r.prototype.dtdElement=function(e,t,i){return this.stream.write(r.__super__.dtdElement.call(this,e,t,i))},r.prototype.dtdEntity=function(e,t,i){return this.stream.write(r.__super__.dtdEntity.call(this,e,t,i))},r.prototype.dtdNotation=function(e,t,i){return this.stream.write(r.__super__.dtdNotation.call(this,e,t,i))},r}(n)}).call(this)},382:function(e,t,r){(function(){var t,i={}.hasOwnProperty;t=r(6286),e.exports=function(e){function t(e){t.__super__.constructor.call(this,e)}return function(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(t,e),t.prototype.document=function(e,t){var r,i,n,o,a;for(t=this.filterOptions(t),o="",i=0,n=(a=e.children).length;i","]]]]>"),this.assertLegalChar(e))},e.prototype.comment=function(e){if(this.options.noValidation)return e;if((e=""+e||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+e);return this.assertLegalChar(e)},e.prototype.raw=function(e){return this.options.noValidation?e:""+e||""},e.prototype.attValue=function(e){return this.options.noValidation?e:this.assertLegalChar(this.attEscape(e=""+e||""))},e.prototype.insTarget=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.insValue=function(e){if(this.options.noValidation)return e;if((e=""+e||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+e);return this.assertLegalChar(e)},e.prototype.xmlVersion=function(e){if(this.options.noValidation)return e;if(!(e=""+e||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+e);return e},e.prototype.xmlEncoding=function(e){if(this.options.noValidation)return e;if(!(e=""+e||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+e);return this.assertLegalChar(e)},e.prototype.xmlStandalone=function(e){return this.options.noValidation?e:e?"yes":"no"},e.prototype.dtdPubID=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdSysID=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdElementValue=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdAttType=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdAttDefault=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdEntityValue=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdNData=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(e){var t,r;if(this.options.noValidation)return e;if(t="","1.0"===this.options.version){if(t=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r=e.match(t))throw new Error("Invalid character in string: "+e+" at index "+r.index)}else if("1.1"===this.options.version&&(t=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r=e.match(t)))throw new Error("Invalid character in string: "+e+" at index "+r.index);return e},e.prototype.assertLegalName=function(e){var t;if(this.options.noValidation)return e;if(this.assertLegalChar(e),t=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!e.match(t))throw new Error("Invalid character in name");return e},e.prototype.textEscape=function(e){var t;return this.options.noValidation?e:(t=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(//g,">").replace(/\r/g," "))},e.prototype.attEscape=function(e){var t;return this.options.noValidation?e:(t=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(/0?new Array(i).join(t.indent):""},e.prototype.endline=function(e,t,r){return!t.pretty||t.suppressPrettyCount?"":t.newline},e.prototype.attribute=function(e,t,r){var i;return this.openAttribute(e,t,r),i=" "+e.name+'="'+e.value+'"',this.closeAttribute(e,t,r),i},e.prototype.cdata=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.comment=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"\x3c!-- ",t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=" --\x3e"+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.declaration=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"",n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.docType=function(e,t,r){var n,o,a,s,c;if(r||(r=0),this.openNode(e,t,r),t.state=i.OpenTag,s=this.indent(e,t,r),s+="0){for(s+=" [",s+=this.endline(e,t,r),t.state=i.InsideTag,o=0,a=(c=e.children).length;o",s+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),s},e.prototype.element=function(e,r,n){var a,s,c,u,l,h,d,p,f,m,g,v,y,C;for(f in n||(n=0),m=!1,g="",this.openNode(e,r,n),r.state=i.OpenTag,g+=this.indent(e,r,n)+"<"+e.name,v=e.attribs)o.call(v,f)&&(a=v[f],g+=this.attribute(a,r,n));if(u=0===(c=e.children.length)?null:e.children[0],0===c||e.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))r.allowEmpty?(g+=">",r.state=i.CloseTag,g+=""+this.endline(e,r,n)):(r.state=i.CloseTag,g+=r.spaceBeforeSlash+"/>"+this.endline(e,r,n));else if(!r.pretty||1!==c||u.type!==t.Text&&u.type!==t.Raw||null==u.value){if(r.dontPrettyTextNodes)for(l=0,d=(y=e.children).length;l"+this.endline(e,r,n),r.state=i.InsideTag,h=0,p=(C=e.children).length;h",m&&r.suppressPrettyCount--,g+=this.endline(e,r,n),r.state=i.None}else g+=">",r.state=i.InsideTag,r.suppressPrettyCount++,m=!0,g+=this.writeChildNode(u,r,n+1),r.suppressPrettyCount--,m=!1,r.state=i.CloseTag,g+=""+this.endline(e,r,n);return this.closeNode(e,r,n),g},e.prototype.writeChildNode=function(e,r,i){switch(e.type){case t.CData:return this.cdata(e,r,i);case t.Comment:return this.comment(e,r,i);case t.Element:return this.element(e,r,i);case t.Raw:return this.raw(e,r,i);case t.Text:return this.text(e,r,i);case t.ProcessingInstruction:return this.processingInstruction(e,r,i);case t.Dummy:return"";case t.Declaration:return this.declaration(e,r,i);case t.DocType:return this.docType(e,r,i);case t.AttributeDeclaration:return this.dtdAttList(e,r,i);case t.ElementDeclaration:return this.dtdElement(e,r,i);case t.EntityDeclaration:return this.dtdEntity(e,r,i);case t.NotationDeclaration:return this.dtdNotation(e,r,i);default:throw new Error("Unknown XML node type: "+e.constructor.name)}},e.prototype.processingInstruction=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"",n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.raw=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r),t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.text=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r),t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdAttList=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdElement=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdEntity=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdNotation=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.openNode=function(e,t,r){},e.prototype.closeNode=function(e,t,r){},e.prototype.openAttribute=function(e,t,r){},e.prototype.closeAttribute=function(e,t,r){},e}()}).call(this)},2046:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l,h;h=r(9241),u=h.assign,l=h.isFunction,n=r(7260),o=r(1933),a=r(400),c=r(382),s=r(6775),t=r(1737),i=r(8753),e.exports.create=function(e,t,r,i){var n,a;if(null==e)throw new Error("Root element needs a name.");return i=u({},t,r,i),a=(n=new o(i)).element(e),i.headless||(n.declaration(i),null==i.pubID&&null==i.sysID||n.dtd(i)),a},e.exports.begin=function(e,t,r){var i;return l(e)&&(t=(i=[e,t])[0],r=i[1],e={}),t?new a(e,t,r):new o(e)},e.exports.stringWriter=function(e){return new c(e)},e.exports.streamWriter=function(e,t){return new s(e,t)},e.exports.implementation=new n,e.exports.nodeType=t,e.exports.writerState=i}).call(this)},2613:e=>{"use strict";e.exports=require("assert")},181:e=>{"use strict";e.exports=require("buffer")},5317:e=>{"use strict";e.exports=require("child_process")},6982:e=>{"use strict";e.exports=require("crypto")},7194:e=>{"use strict";e.exports=require("dgram")},4434:e=>{"use strict";e.exports=require("events")},9896:e=>{"use strict";e.exports=require("fs")},8611:e=>{"use strict";e.exports=require("http")},5692:e=>{"use strict";e.exports=require("https")},9278:e=>{"use strict";e.exports=require("net")},857:e=>{"use strict";e.exports=require("os")},6928:e=>{"use strict";e.exports=require("path")},3785:e=>{"use strict";e.exports=require("readline")},2203:e=>{"use strict";e.exports=require("stream")},3193:e=>{"use strict";e.exports=require("string_decoder")},3557:e=>{"use strict";e.exports=require("timers")},2018:e=>{"use strict";e.exports=require("tty")},7016:e=>{"use strict";e.exports=require("url")},9023:e=>{"use strict";e.exports=require("util")},6094:(e,t,r)=>{var i,n=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0; +!function(t){"use strict";"function"==typeof bootstrap?bootstrap("promise",t):e.exports=t()}((function(){"use strict";var e=!1;try{throw new Error}catch(t){e=!!t.stack}var t,r=E(),i=function(){},n=function(){var e={task:void 0,next:null},t=e,r=!1,i=void 0,o=!1;function a(){for(;e.next;){var t=(e=e.next).task;e.task=void 0;var i=e.domain;i&&(e.domain=void 0,i.enter());try{t()}catch(e){if(o)throw i&&i.exit(),setTimeout(a,0),i&&i.enter(),e;setTimeout((function(){throw e}),0)}i&&i.exit()}r=!1}if(n=function(e){t=t.next={task:e,domain:o&&process.domain,next:null},r||(r=!0,i())},"undefined"!=typeof process&&process.nextTick)o=!0,i=function(){process.nextTick(a)};else if("function"==typeof setImmediate)i="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=function(){i=c,s.port1.onmessage=a,a()};var c=function(){s.port2.postMessage(0)};i=function(){setTimeout(a,0),c()}}else i=function(){setTimeout(a,0)};return n}(),o=Function.call;function a(e){return function(){return o.apply(e,arguments)}}var s,c=a(Array.prototype.slice),u=a(Array.prototype.reduce||function(e,t){var r=0,i=this.length;if(1===arguments.length)for(;;){if(r in this){t=this[r++];break}if(++r>=i)throw new TypeError}for(;r=r&&o<=W}function E(){if(e)try{throw new Error}catch(e){var r=e.stack.split("\n"),i=C(r[0].indexOf("@")>0?r[1]:r[2]);if(!i)return;return t=i[0],i[1]}}function _(e){return e instanceof D?e:R(e)?function(e){var t=T();return _.nextTick((function(){try{e.then(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}})),t.promise}(e):k(e)}function T(){var t,r=[],i=[],n=d(T.prototype),o=d(D.prototype);if(o.promiseDispatch=function(e,n,o){var a=c(arguments);r?(r.push(a),"when"===n&&o[1]&&i.push(o[1])):_.nextTick((function(){t.promiseDispatch.apply(t,a)}))},o.valueOf=function(){if(r)return o;var e=b(t);return U(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},_.longStackSupport&&e)try{throw new Error}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1)}function a(e){t=e,o.source=e,u(r,(function(t,r){_.nextTick((function(){e.promiseDispatch.apply(e,r)}))}),void 0),r=void 0,i=void 0}return n.promise=o,n.resolve=function(e){t||a(_(e))},n.fulfill=function(e){t||a(k(e))},n.reject=function(e){t||a(F(e))},n.notify=function(e){t||u(i,(function(t,r){_.nextTick((function(){r(e)}))}),void 0)},n}function A(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=T();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function I(e){return A((function(t,r){for(var i=0,n=e.length;i2?e.resolve(c(arguments,1)):e.resolve(r)}},_.Promise=A,_.promise=A,A.race=I,A.all=j,A.reject=F,A.resolve=_,_.passByCopy=function(e){return e},D.prototype.passByCopy=function(){return this},_.join=function(e,t){return _(e).join(t)},D.prototype.join=function(e){return _([this,e]).spread((function(e,t){if(e===t)return e;throw new Error("Can't join: not the same: "+e+" "+t)}))},_.race=I,D.prototype.race=function(){return this.then(_.race)},_.makePromise=D,D.prototype.toString=function(){return"[object Promise]"},D.prototype.then=function(e,t,r){var i=this,n=T(),o=!1;return _.nextTick((function(){i.promiseDispatch((function(t){o||(o=!0,n.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return F(e)}}(t)))}),"when",[function(e){o||(o=!0,n.resolve(function(e){if("function"==typeof t){v(e,i);try{return t(e)}catch(e){return F(e)}}return F(e)}(e)))}])})),i.promiseDispatch(void 0,"when",[void 0,function(e){var t,i=!1;try{t=function(e){return"function"==typeof r?r(e):e}(e)}catch(e){if(i=!0,!_.onerror)throw e;_.onerror(e)}i||n.notify(t)}]),n.promise},_.tap=function(e,t){return _(e).tap(t)},D.prototype.tap=function(e){return e=_(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},_.when=w,D.prototype.thenResolve=function(e){return this.then((function(){return e}))},_.thenResolve=function(e,t){return _(e).thenResolve(t)},D.prototype.thenReject=function(e){return this.then((function(){throw e}))},_.thenReject=function(e,t){return _(e).thenReject(t)},_.nearer=b,_.isPromise=U,_.isPromiseAlike=R,_.isPending=function(e){return U(e)&&"pending"===e.inspect().state},D.prototype.isPending=function(){return"pending"===this.inspect().state},_.isFulfilled=function(e){return!U(e)||"fulfilled"===e.inspect().state},D.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},_.isRejected=function(e){return U(e)&&"rejected"===e.inspect().state},D.prototype.isRejected=function(){return"rejected"===this.inspect().state};var O,N,P,B=[],L=[],x=!0;function M(){B.length=0,L.length=0,x||(x=!0)}function F(e){var t=D({when:function(t){return t&&function(e){if(x){var t=l(L,e);-1!==t&&(L.splice(t,1),B.splice(t,1))}}(this),t?t(e):this}},(function(){return this}),(function(){return{state:"rejected",reason:e}}));return function(e,t){x&&(L.push(e),t&&void 0!==t.stack?B.push(t.stack):B.push("(no stack) "+t))}(t,e),t}function k(e){return D({when:function(){return e},get:function(t){return e[t]},set:function(t,r){e[t]=r},delete:function(t){delete e[t]},post:function(t,r){return null==t?e.apply(void 0,r):e[t].apply(e,r)},apply:function(t,r){return e.apply(t,r)},keys:function(){return f(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function V(e,t,r){return _(e).spread(t,r)}function H(e,t,r){return _(e).dispatch(t,r)}function j(e){return w(e,(function(e){var t=0,r=T();return u(e,(function(i,n,o){var a;U(n)&&"fulfilled"===(a=n.inspect()).state?e[o]=a.value:(++t,w(n,(function(i){e[o]=i,0==--t&&r.resolve(e)}),r.reject,(function(e){r.notify({index:o,value:e})})))}),void 0),0===t&&r.resolve(e),r.promise}))}function G(e){return w(e,(function(e){return e=h(e,_),w(j(h(e,(function(e){return w(e,i,i)}))),(function(){return e}))}))}_.resetUnhandledRejections=M,_.getUnhandledReasons=function(){return B.slice()},_.stopUnhandledRejectionTracking=function(){M(),x=!1},M(),_.reject=F,_.fulfill=k,_.master=function(e){return D({isDef:function(){}},(function(t,r){return H(e,t,r)}),(function(){return _(e).inspect()}))},_.spread=V,D.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},_.async=function(e){return function(){function t(e,t){var o;if("undefined"==typeof StopIteration){try{o=r[e](t)}catch(e){return F(e)}return o.done?_(o.value):w(o.value,i,n)}try{o=r[e](t)}catch(e){return function(e){return"[object StopIteration]"===g(e)||e instanceof s}(e)?_(e.value):F(e)}return w(o,i,n)}var r=e.apply(this,arguments),i=t.bind(t,"next"),n=t.bind(t,"throw");return i()}},_.spawn=function(e){_.done(_.async(e)())},_.return=function(e){throw new s(e)},_.promised=function(e){return function(){return V([this,j(arguments)],(function(t,r){return e.apply(t,r)}))}},_.dispatch=H,D.prototype.dispatch=function(e,t){var r=this,i=T();return _.nextTick((function(){r.promiseDispatch(i.resolve,e,t)})),i.promise},_.get=function(e,t){return _(e).dispatch("get",[t])},D.prototype.get=function(e){return this.dispatch("get",[e])},_.set=function(e,t,r){return _(e).dispatch("set",[t,r])},D.prototype.set=function(e,t){return this.dispatch("set",[e,t])},_.del=_.delete=function(e,t){return _(e).dispatch("delete",[t])},D.prototype.del=D.prototype.delete=function(e){return this.dispatch("delete",[e])},_.mapply=_.post=function(e,t,r){return _(e).dispatch("post",[t,r])},D.prototype.mapply=D.prototype.post=function(e,t){return this.dispatch("post",[e,t])},_.send=_.mcall=_.invoke=function(e,t){return _(e).dispatch("post",[t,c(arguments,2)])},D.prototype.send=D.prototype.mcall=D.prototype.invoke=function(e){return this.dispatch("post",[e,c(arguments,1)])},_.fapply=function(e,t){return _(e).dispatch("apply",[void 0,t])},D.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},_.try=_.fcall=function(e){return _(e).dispatch("apply",[void 0,c(arguments,1)])},D.prototype.fcall=function(){return this.dispatch("apply",[void 0,c(arguments)])},_.fbind=function(e){var t=_(e),r=c(arguments,1);return function(){return t.dispatch("apply",[this,r.concat(c(arguments))])}},D.prototype.fbind=function(){var e=this,t=c(arguments);return function(){return e.dispatch("apply",[this,t.concat(c(arguments))])}},_.keys=function(e){return _(e).dispatch("keys",[])},D.prototype.keys=function(){return this.dispatch("keys",[])},_.all=j,D.prototype.all=function(){return j(this)},_.allResolved=(O=G,N="allResolved",P="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(N+" is deprecated, use "+P+" instead.",new Error("").stack),O.apply(O,arguments)}),D.prototype.allResolved=function(){return G(this)},_.allSettled=function(e){return _(e).allSettled()},D.prototype.allSettled=function(){return this.then((function(e){return j(h(e,(function(e){function t(){return e.inspect()}return(e=_(e)).then(t,t)})))}))},_.fail=_.catch=function(e,t){return _(e).then(void 0,t)},D.prototype.fail=D.prototype.catch=function(e){return this.then(void 0,e)},_.progress=function(e,t){return _(e).then(void 0,void 0,t)},D.prototype.progress=function(e){return this.then(void 0,void 0,e)},_.fin=_.finally=function(e,t){return _(e).finally(t)},D.prototype.fin=D.prototype.finally=function(e){return e=_(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},_.done=function(e,t,r,i){return _(e).done(t,r,i)},D.prototype.done=function(e,t,r){var i=function(e){_.nextTick((function(){if(v(e,n),!_.onerror)throw e;_.onerror(e)}))},n=e||t||r?this.then(e,t,r):this;"object"==typeof process&&process&&process.domain&&(i=process.domain.bind(i)),n.then(void 0,i)},_.timeout=function(e,t,r){return _(e).timeout(t,r)},D.prototype.timeout=function(e,t){var r=T(),i=setTimeout((function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),r.reject(t)}),e);return this.then((function(e){clearTimeout(i),r.resolve(e)}),(function(e){clearTimeout(i),r.reject(e)}),r.notify),r.promise},_.delay=function(e,t){return void 0===t&&(t=e,e=void 0),_(e).delay(t)},D.prototype.delay=function(e){return this.then((function(t){var r=T();return setTimeout((function(){r.resolve(t)}),e),r.promise}))},_.nfapply=function(e,t){return _(e).nfapply(t)},D.prototype.nfapply=function(e){var t=T(),r=c(e);return r.push(t.makeNodeResolver()),this.fapply(r).fail(t.reject),t.promise},_.nfcall=function(e){var t=c(arguments,1);return _(e).nfapply(t)},D.prototype.nfcall=function(){var e=c(arguments),t=T();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},_.nfbind=_.denodeify=function(e){var t=c(arguments,1);return function(){var r=t.concat(c(arguments)),i=T();return r.push(i.makeNodeResolver()),_(e).fapply(r).fail(i.reject),i.promise}},D.prototype.nfbind=D.prototype.denodeify=function(){var e=c(arguments);return e.unshift(this),_.denodeify.apply(void 0,e)},_.nbind=function(e,t){var r=c(arguments,2);return function(){var i=r.concat(c(arguments)),n=T();return i.push(n.makeNodeResolver()),_((function(){return e.apply(t,arguments)})).fapply(i).fail(n.reject),n.promise}},D.prototype.nbind=function(){var e=c(arguments,0);return e.unshift(this),_.nbind.apply(void 0,e)},_.nmapply=_.npost=function(e,t,r){return _(e).npost(t,r)},D.prototype.nmapply=D.prototype.npost=function(e,t){var r=c(t||[]),i=T();return r.push(i.makeNodeResolver()),this.dispatch("post",[e,r]).fail(i.reject),i.promise},_.nsend=_.nmcall=_.ninvoke=function(e,t){var r=c(arguments,2),i=T();return r.push(i.makeNodeResolver()),_(e).dispatch("post",[t,r]).fail(i.reject),i.promise},D.prototype.nsend=D.prototype.nmcall=D.prototype.ninvoke=function(e){var t=c(arguments,1),r=T();return t.push(r.makeNodeResolver()),this.dispatch("post",[e,t]).fail(r.reject),r.promise},_.nodeify=function(e,t){return _(e).nodeify(t)},D.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){_.nextTick((function(){e(null,t)}))}),(function(t){_.nextTick((function(){e(t)}))}))};var W=E();return _}))},7675:(e,t,r)=>{"use strict";var i=r(3206),n=r(9675),o=Object;e.exports=i((function(){if(null==this||this!==o(this))throw new n("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)},1589:(e,t,r)=>{"use strict";var i=r(8452),n=r(487),o=r(7675),a=r(5330),s=r(3984),c=n(a());i(c,{getPolyfill:a,implementation:o,shim:s}),e.exports=c},5330:(e,t,r)=>{"use strict";var i=r(7675),n=r(8452).supportsDescriptors,o=Object.getOwnPropertyDescriptor;e.exports=function(){if(n&&"gim"===/a/gim.flags){var e=o(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var t="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(r,"sticky",{get:function(){t+="y"}}),"dy"===t)return e.get}}return i}},3984:(e,t,r)=>{"use strict";var i=r(8452).supportsDescriptors,n=r(5330),o=Object.getOwnPropertyDescriptor,a=Object.defineProperty,s=TypeError,c=Object.getPrototypeOf,u=/a/;e.exports=function(){if(!i||!c)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=n(),t=c(u),r=o(t,"flags");return r&&r.get===e||a(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},2861:(e,t,r)=>{var i=r(181),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},4043:(e,t,r)=>{!function(e){e.parser=function(e,t){return new n(e,t)},e.SAXParser=n,e.SAXStream=a,e.createStream=function(e,t){return new a(e,t)},e.MAX_BUFFER_LENGTH=65536;var t,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function n(t,r){if(!(this instanceof n))return new n(t,r);var o=this;!function(e){for(var t=0,r=i.length;t"===o?(w(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=A.TEXT):v(o)?(r.state=A.SGML_DECL_QUOTED,r.sgmlDecl+=o):r.sgmlDecl+=o;continue;case A.SGML_DECL_QUOTED:o===r.q&&(r.state=A.SGML_DECL,r.q=""),r.sgmlDecl+=o;continue;case A.DOCTYPE:">"===o?(r.state=A.TEXT,w(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=o,"["===o?r.state=A.DOCTYPE_DTD:v(o)&&(r.state=A.DOCTYPE_QUOTED,r.q=o));continue;case A.DOCTYPE_QUOTED:r.doctype+=o,o===r.q&&(r.q="",r.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:"]"===o?(r.doctype+=o,r.state=A.DOCTYPE):"<"===o?(r.state=A.OPEN_WAKA,r.startTagPosition=r.position):v(o)?(r.doctype+=o,r.state=A.DOCTYPE_DTD_QUOTED,r.q=o):r.doctype+=o;continue;case A.DOCTYPE_DTD_QUOTED:r.doctype+=o,o===r.q&&(r.state=A.DOCTYPE_DTD,r.q="");continue;case A.COMMENT:"-"===o?r.state=A.COMMENT_ENDING:r.comment+=o;continue;case A.COMMENT_ENDING:"-"===o?(r.state=A.COMMENT_ENDED,r.comment=U(r.opt,r.comment),r.comment&&w(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+o,r.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==o?(N(r,"Malformed comment"),r.comment+="--"+o,r.state=A.COMMENT):r.doctype&&!0!==r.doctype?r.state=A.DOCTYPE_DTD:r.state=A.TEXT;continue;case A.CDATA:"]"===o?r.state=A.CDATA_ENDING:r.cdata+=o;continue;case A.CDATA_ENDING:"]"===o?r.state=A.CDATA_ENDING_2:(r.cdata+="]"+o,r.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===o?(r.cdata&&w(r,"oncdata",r.cdata),w(r,"onclosecdata"),r.cdata="",r.state=A.TEXT):"]"===o?r.cdata+="]":(r.cdata+="]]"+o,r.state=A.CDATA);continue;case A.PROC_INST:"?"===o?r.state=A.PROC_INST_ENDING:m(o)?r.state=A.PROC_INST_BODY:r.procInstName+=o;continue;case A.PROC_INST_BODY:if(!r.procInstBody&&m(o))continue;"?"===o?r.state=A.PROC_INST_ENDING:r.procInstBody+=o;continue;case A.PROC_INST_ENDING:">"===o?(w(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=A.TEXT):(r.procInstBody+="?"+o,r.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:C(p,o)?r.tagName+=o:(P(r),">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:(m(o)||N(r,"Invalid character in tag name"),r.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===o?(x(r,!0),M(r)):(N(r,"Forward-slash in opening tag not followed by >"),r.state=A.ATTRIB);continue;case A.ATTRIB:if(m(o))continue;">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:C(d,o)?(r.attribName=o,r.attribValue="",r.state=A.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===o?r.state=A.ATTRIB_VALUE:">"===o?(N(r,"Attribute without value"),r.attribValue=r.attribName,L(r),x(r)):m(o)?r.state=A.ATTRIB_NAME_SAW_WHITE:C(p,o)?r.attribName+=o:N(r,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===o)r.state=A.ATTRIB_VALUE;else{if(m(o))continue;N(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",w(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===o?x(r):C(d,o)?(r.attribName=o,r.state=A.ATTRIB_NAME):(N(r,"Invalid attribute name"),r.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(m(o))continue;v(o)?(r.q=o,r.state=A.ATTRIB_VALUE_QUOTED):(r.opt.unquotedAttributeValues||R(r,"Unquoted attribute value"),r.state=A.ATTRIB_VALUE_UNQUOTED,r.attribValue=o);continue;case A.ATTRIB_VALUE_QUOTED:if(o!==r.q){"&"===o?r.state=A.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=o;continue}L(r),r.q="",r.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:m(o)?r.state=A.ATTRIB:">"===o?x(r):"/"===o?r.state=A.OPEN_TAG_SLASH:C(d,o)?(N(r,"No whitespace between attributes"),r.attribName=o,r.attribValue="",r.state=A.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!y(o)){"&"===o?r.state=A.ATTRIB_VALUE_ENTITY_U:r.attribValue+=o;continue}L(r),">"===o?x(r):r.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(r.tagName)">"===o?M(r):C(p,o)?r.tagName+=o:r.script?(r.script+=""===o?M(r):N(r,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var l,h;switch(r.state){case A.TEXT_ENTITY:l=A.TEXT,h="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:l=A.ATTRIB_VALUE_QUOTED,h="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:l=A.ATTRIB_VALUE_UNQUOTED,h="attribValue"}if(";"===o){var E=F(r);r.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(E)?(r.entity="",r.state=l,r.write(E)):(r[h]+=E,r.entity="",r.state=l)}else C(r.entity.length?g:f,o)?r.entity+=o:(N(r,"Invalid character in entity name"),r[h]+="&"+r.entity+o,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),n=0,o=0,a=i.length;or)switch(i[o]){case"textNode":b(t);break;case"cdata":w(t,"oncdata",t.cdata),t.cdata="";break;case"script":w(t,"onscript",t.script),t.script="";break;default:R(t,"Max buffer length exceeded: "+i[o])}n=Math.max(n,s)}var c=e.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=c+t.position}(r);return r} +/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;b(e=this),""!==e.cdata&&(w(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(w(e,"onscript",e.script),e.script="")}};try{t=r(2203).Stream}catch(e){t=function(){}}t||(t=function(){});var o=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function a(e,r){if(!(this instanceof a))return new a(e,r);t.apply(this),this._parser=new n(e,r),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(e){i.emit("error",e),i._parser.error=null},this._decoder=null,o.forEach((function(e){Object.defineProperty(i,"on"+e,{get:function(){return i._parser["on"+e]},set:function(t){if(!t)return i.removeAllListeners(e),i._parser["on"+e]=t,t;i.on(e,t)},enumerable:!0,configurable:!1})}))}a.prototype=Object.create(t.prototype,{constructor:{value:a}}),a.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var t=r(3193).StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,r){var i=this;return i._parser["on"+e]||-1===o.indexOf(e)||(i._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),i.emit.apply(i,t)}),t.prototype.on.call(i,e,r)};var s="[CDATA[",c="DOCTYPE",u="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/2000/xmlns/",h={xml:u,xmlns:l},d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function m(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function v(e){return'"'===e||"'"===e}function y(e){return">"===e||m(e)}function C(e,t){return e.test(t)}function S(e,t){return!C(e,t)}var E,_,T,A=0;for(var I in e.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t],i="number"==typeof r?String.fromCharCode(r):r;e.ENTITIES[t]=i})),e.STATE)e.STATE[e.STATE[I]]=I;function D(e,t,r){e[t]&&e[t](r)}function w(e,t,r){e.textNode&&b(e),D(e,t,r)}function b(e){e.textNode=U(e.opt,e.textNode),e.textNode&&D(e,"ontext",e.textNode),e.textNode=""}function U(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function R(e,t){return b(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,D(e,"onerror",t),e}function O(e){return e.sawRoot&&!e.closedRoot&&N(e,"Unclosed root tag"),e.state!==A.BEGIN&&e.state!==A.BEGIN_WHITESPACE&&e.state!==A.TEXT&&R(e,"Unexpected end"),b(e),e.c="",e.closed=!0,D(e,"onend"),n.call(e,e.strict,e.opt),e}function N(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&R(e,t)}function P(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,r=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(r.ns=t.ns),e.attribList.length=0,w(e,"onopentagstart",r)}function B(e,t){var r=e.indexOf(":")<0?["",e]:e.split(":"),i=r[0],n=r[1];return t&&"xmlns"===e&&(i="xmlns",n=""),{prefix:i,local:n}}function L(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=B(e.attribName,!0),r=t.prefix,i=t.local;if("xmlns"===r)if("xml"===i&&e.attribValue!==u)N(e,"xml: prefix must be bound to "+u+"\nActual: "+e.attribValue);else if("xmlns"===i&&e.attribValue!==l)N(e,"xmlns: prefix must be bound to "+l+"\nActual: "+e.attribValue);else{var n=e.tag,o=e.tags[e.tags.length-1]||e;n.ns===o.ns&&(n.ns=Object.create(o.ns)),n.ns[i]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,w(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function x(e,t){if(e.opt.xmlns){var r=e.tag,i=B(e.tagName);r.prefix=i.prefix,r.local=i.local,r.uri=r.ns[i.prefix]||"",r.prefix&&!r.uri&&(N(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),r.uri=i.prefix);var n=e.tags[e.tags.length-1]||e;r.ns&&n.ns!==r.ns&&Object.keys(r.ns).forEach((function(t){w(e,"onopennamespace",{prefix:t,uri:r.ns[t]})}));for(var o=0,a=e.attribList.length;o",e.tagName="",void(e.state=A.SCRIPT);w(e,"onscript",e.script),e.script=""}var t=e.tags.length,r=e.tagName;e.strict||(r=r[e.looseCase]());for(var i=r;t--;){if(e.tags[t].name===i)break;N(e,"Unexpected close tag")}if(t<0)return N(e,"Unmatched closing tag: "+e.tagName),e.textNode+="",void(e.state=A.TEXT);e.tagName=r;for(var n=e.tags.length;n-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,w(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var c=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==c.ns&&Object.keys(o.ns).forEach((function(t){var r=o.ns[t];w(e,"onclosenamespace",{prefix:t,uri:r})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=A.TEXT}function F(e){var t,r=e.entity,i=r.toLowerCase(),n="";return e.ENTITIES[r]?e.ENTITIES[r]:e.ENTITIES[i]?e.ENTITIES[i]:("#"===(r=i).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),n=(t=parseInt(r,16)).toString(16)):(r=r.slice(1),n=(t=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(t)||n.toLowerCase()!==r?(N(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function k(e,t){"<"===t?(e.state=A.OPEN_WAKA,e.startTagPosition=e.position):m(t)||(N(e,"Non-whitespace before first tag."),e.textNode=t,e.state=A.TEXT)}function V(e,t){var r="";return t1114111||_(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(e=55296+((a-=65536)>>10),t=a%1024+56320,r.push(e,t)),(i+1===n||r.length>16384)&&(o+=E.apply(null,r),r.length=0)}return o},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(t)},6897:(e,t,r)=>{"use strict";var i=r(453),n=r(41),o=r(592)(),a=r(5795),s=r(9675),c=i("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,u=!0;if("length"in e&&a){var l=a(e,"length");l&&!l.configurable&&(i=!1),l&&!l.writable&&(u=!1)}return(i||u||!r)&&(o?n(e,"length",t,!0,!0):n(e,"length",t)),e}},3206:(e,t,r)=>{"use strict";var i=r(41),n=r(592)(),o=r(4462).functionsHaveConfigurableNames(),a=r(9675);e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");return arguments.length>2&&!!arguments[2]&&!o||(n?i(e,"name",t,!0,!0):i(e,"name",t)),e}},920:(e,t,r)=>{"use strict";var i=r(453),n=r(8075),o=r(8859),a=r(9675),s=i("%WeakMap%",!0),c=i("%Map%",!0),u=n("WeakMap.prototype.get",!0),l=n("WeakMap.prototype.set",!0),h=n("WeakMap.prototype.has",!0),d=n("Map.prototype.get",!0),p=n("Map.prototype.set",!0),f=n("Map.prototype.has",!0),g=function(e,t){for(var r,i=e;null!==(r=i.next);i=r)if(r.key===t)return i.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,i={assert:function(e){if(!i.has(e))throw new a("Side channel does not contain "+o(e))},get:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return u(e,i)}else if(c){if(t)return d(t,i)}else if(r)return function(e,t){var r=g(e,t);return r&&r.value}(r,i)},has:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return h(e,i)}else if(c){if(t)return f(t,i)}else if(r)return function(e,t){return!!g(e,t)}(r,i);return!1},set:function(i,n){s&&i&&("object"==typeof i||"function"==typeof i)?(e||(e=new s),l(e,i,n)):c?(t||(t=new c),p(t,i,n)):(r||(r={key:{},next:null}),function(e,t,r){var i=g(e,t);i?i.value=r:e.next={key:t,next:e.next,value:r}}(r,i,n))}};return i}},3476:(e,t,r)=>{r(2345).install()},2345:(e,t,r)=>{e=r.nmd(e);var i,n=r(9665).SourceMapConsumer,o=r(6928);try{(i=r(9896)).existsSync&&i.readFileSync||(i=null)}catch(e){}var a=r(2746);function s(e,t){return e.require(t)}var c=!1,u=!1,l=!1,h="auto",d={},p={},f=/^data:application\/json[^,]+base64,/,g=[],m=[];function v(){return"browser"===h||"node"!==h&&("undefined"!=typeof window&&"function"==typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type))}function y(e){return function(t){for(var r=0;r";var r=this.getLineNumber();if(null!=r){t+=":"+r;var i=this.getColumnNumber();i&&(t+=":"+i)}}var n="",o=this.getFunctionName(),a=!0,s=this.isConstructor();if(!(this.isToplevel()||s)){var c=this.getTypeName();"[object Object]"===c&&(c="null");var u=this.getMethodName();o?(c&&0!=o.indexOf(c)&&(n+=c+"."),n+=o,u&&o.indexOf("."+u)!=o.length-u.length-1&&(n+=" [as "+u+"]")):n+=c+"."+(u||"")}else s?n+="new "+(o||""):o?n+=o:(n+=t,a=!1);return a&&(n+=" ("+t+")"),n}function I(e){var t={};return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(r){t[r]=/^(?:is|get)/.test(r)?function(){return e[r].call(e)}:e[r]})),t.toString=A,t}function D(e,t){if(void 0===t&&(t={nextPosition:null,curPosition:null}),e.isNative())return t.curPosition=null,e;var r=e.getFileName()||e.getScriptNameOrSourceURL();if(r){var i=e.getLineNumber(),n=e.getColumnNumber()-1,o=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/.test("object"==typeof process&&null!==process?process.version:"")?0:62;1===i&&n>o&&!v()&&!e.isEval()&&(n-=o);var a=_({source:r,line:i,column:n});t.curPosition=a;var s=(e=I(e)).getFunctionName;return e.getFunctionName=function(){return null==t.nextPosition?s():t.nextPosition.name||s()},e.getFileName=function(){return a.source},e.getLineNumber=function(){return a.line},e.getColumnNumber=function(){return a.column+1},e.getScriptNameOrSourceURL=function(){return a.source},e}var c=e.isEval()&&e.getEvalOrigin();return c?(c=T(c),(e=I(e)).getEvalOrigin=function(){return c},e):e}function w(e,t){l&&(d={},p={});for(var r=(e.name||"Error")+": "+(e.message||""),i={nextPosition:null,curPosition:null},n=[],o=t.length-1;o>=0;o--)n.push("\n at "+D(t[o],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,r+n.reverse().join("")}function b(e){var t=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var r=t[1],n=+t[2],o=+t[3],a=d[r];if(!a&&i&&i.existsSync(r))try{a=i.readFileSync(r,"utf8")}catch(e){a=""}if(a){var s=a.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return r+":"+n+"\n"+s+"\n"+new Array(o).join(" ")+"^"}}return null}function U(e){var t=b(e),r=function(){if("object"==typeof process&&null!==process)return process.stderr}();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),t&&(console.error(),console.error(t)),console.error(e.stack),function(e){if("object"==typeof process&&null!==process&&"function"==typeof process.exit)process.exit(e)}(1)}m.push((function(e){var t,r=function(e){var t;if(v())try{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),t=4===r.readyState?r.responseText:null;var i=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(i)return i}catch(e){}t=C(e);for(var n,o,a=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/gm;o=a.exec(t);)n=o;return n?n[1]:null}(e);if(!r)return null;if(f.test(r)){var i=r.slice(r.indexOf(",")+1);t=a(i,"base64").toString(),r=e}else r=S(e,r),t=C(r);return t?{url:r,map:t}:null}));var R=g.slice(0),O=m.slice(0);t.wrapCallSite=D,t.getErrorSource=b,t.mapSourcePosition=_,t.retrieveSourceMap=E,t.install=function(t){if((t=t||{}).environment&&(h=t.environment,-1===["node","browser","auto"].indexOf(h)))throw new Error("environment "+h+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(g.length=0),g.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(m.length=0),m.unshift(t.retrieveSourceMap)),t.hookRequire&&!v()){var r=s(e,"module"),i=r.prototype._compile;i.__sourceMapSupport||(r.prototype._compile=function(e,t){return d[t]=e,p[t]=void 0,i.call(this,e,t)},r.prototype._compile.__sourceMapSupport=!0)}if(l||(l="emptyCacheBetweenOperations"in t&&t.emptyCacheBetweenOperations),c||(c=!0,Error.prepareStackTrace=w),!u){var n=!("handleUncaughtExceptions"in t)||t.handleUncaughtExceptions;try{!1===s(e,"worker_threads").isMainThread&&(n=!1)}catch(e){}n&&"object"==typeof process&&null!==process&&"function"==typeof process.on&&(u=!0,o=process.emit,process.emit=function(e){if("uncaughtException"===e){var t=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(t&&!r)return U(arguments[1])}return o.apply(this,arguments)})}var o},t.resetRetrieveHandlers=function(){g.length=0,m.length=0,g=R.slice(0),m=O.slice(0),E=y(m),C=y(g)}},735:(e,t,r)=>{var i=r(251),n=Object.prototype.hasOwnProperty,o="undefined"!=typeof Map;function a(){this._array=[],this._set=o?new Map:Object.create(null)}a.fromArray=function(e,t){for(var r=new a,i=0,n=e.length;i=0)return t}else{var r=i.toSetString(e);if(n.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},a.prototype.at=function(e){if(e>=0&&e{var i=r(2364);t.encode=function(e){var t,r="",n=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&n,(n>>>=5)>0&&(t|=32),r+=i.encode(t)}while(n>0);return r},t.decode=function(e,t,r){var n,o,a,s,c=e.length,u=0,l=0;do{if(t>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=i.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&o),u+=(o&=31)<>1,1&~a?s:-s),r.rest=t}},2364:(e,t)=>{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(e){if(0<=e&&e{function r(e,i,n,o,a,s){var c=Math.floor((i-e)/2)+e,u=a(n,o[c],!0);return 0===u?c:u>0?i-c>1?r(c,i,n,o,a,s):s==t.LEAST_UPPER_BOUND?i1?r(e,c,n,o,a,s):s==t.LEAST_UPPER_BOUND?c:e<0?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,i,n,o){if(0===i.length)return-1;var a=r(-1,i.length,e,i,n,o||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===n(i[a],i[a-1],!0);)--a;return a}},3302:(e,t,r)=>{var i=r(251);function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}n.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},n.prototype.add=function(e){var t,r,n,o,a,s;t=this._last,r=e,n=t.generatedLine,o=r.generatedLine,a=t.generatedColumn,s=r.generatedColumn,o>n||o==n&&s>=a||i.compareByGeneratedPositionsInflated(t,r)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.P=n},3801:(e,t)=>{function r(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function i(e,t,n,o){if(n{var i=r(251),n=r(1163),o=r(735).C,a=r(7092),s=r(3801).g;function c(e,t){var r=e;return"string"==typeof e&&(r=i.parseSourceMapInput(e)),null!=r.sections?new h(r,t):new u(r,t)}function u(e,t){var r=e;"string"==typeof e&&(r=i.parseSourceMapInput(e));var n=i.getArg(r,"version"),a=i.getArg(r,"sources"),s=i.getArg(r,"names",[]),c=i.getArg(r,"sourceRoot",null),u=i.getArg(r,"sourcesContent",null),l=i.getArg(r,"mappings"),h=i.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);c&&(c=i.normalize(c)),a=a.map(String).map(i.normalize).map((function(e){return c&&i.isAbsolute(c)&&i.isAbsolute(e)?i.relative(c,e):e})),this._names=o.fromArray(s.map(String),!0),this._sources=o.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(e){return i.computeSourceURL(c,e,t)})),this.sourceRoot=c,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=t,this.file=h}function l(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function h(e,t){var r=e;"string"==typeof e&&(r=i.parseSourceMapInput(e));var n=i.getArg(r,"version"),a=i.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new o,this._names=new o;var s={line:-1,column:0};this._sections=a.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=i.getArg(e,"offset"),n=i.getArg(r,"line"),o=i.getArg(r,"column");if(n=0){var s=this._originalMappings[a];if(void 0===e.column)for(var c=s.originalLine;s&&s.originalLine===c;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var u=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==u;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return o},t.SourceMapConsumer=c,u.prototype=Object.create(c.prototype),u.prototype.consumer=c,u.prototype._findSourceIndex=function(e){var t,r=e;if(null!=this.sourceRoot&&(r=i.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(t=0;t1&&(r.source=g+o[1],g+=o[1],r.originalLine=p+o[2],p=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),_.push(r),"number"==typeof r.originalLine&&E.push(r)}s(_,i.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,s(E,i.compareByOriginalPositions),this.__originalMappings=E},u.prototype._findMapping=function(e,t,r,i,o,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return n.search(e,t,o,a)},u.prototype.computeColumnSpans=function(){for(var e=0;e=0){var n=this._generatedMappings[r];if(n.generatedLine===t.generatedLine){var o=i.getArg(n,"source",null);null!==o&&(o=this._sources.at(o),o=i.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var a=i.getArg(n,"name",null);return null!==a&&(a=this._names.at(a)),{source:o,line:i.getArg(n,"originalLine",null),column:i.getArg(n,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},u.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},u.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var n,o=e;if(null!=this.sourceRoot&&(o=i.relative(this.sourceRoot,o)),null!=this.sourceRoot&&(n=i.urlParse(this.sourceRoot))){var a=o.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!n.path||"/"==n.path)&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(t)return null;throw new Error('"'+o+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(e){var t=i.getArg(e,"source");if((t=this._findSourceIndex(t))<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:i.getArg(e,"line"),originalColumn:i.getArg(e,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(e,"bias",c.GREATEST_LOWER_BOUND));if(n>=0){var o=this._originalMappings[n];if(o.source===r.source)return{line:i.getArg(o,"generatedLine",null),column:i.getArg(o,"generatedColumn",null),lastColumn:i.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},h.prototype=Object.create(c.prototype),h.prototype.constructor=c,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var e=[],t=0;t{var i=r(7092),n=r(251),o=r(735).C,a=r(3302).P;function s(e){e||(e={}),this._file=n.getArg(e,"file",null),this._sourceRoot=n.getArg(e,"sourceRoot",null),this._skipValidation=n.getArg(e,"skipValidation",!1),this._sources=new o,this._names=new o,this._mappings=new a,this._sourcesContents=null}s.prototype._version=3,s.fromSourceMap=function(e){var t=e.sourceRoot,r=new s({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(i.source=e.source,null!=t&&(i.source=n.relative(t,i.source)),i.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(i.name=e.name)),r.addMapping(i)})),e.sources.forEach((function(i){var o=i;null!==t&&(o=n.relative(t,i)),r._sources.has(o)||r._sources.add(o);var a=e.sourceContentFor(i);null!=a&&r.setSourceContent(i,a)})),r},s.prototype.addMapping=function(e){var t=n.getArg(e,"generated"),r=n.getArg(e,"original",null),i=n.getArg(e,"source",null),o=n.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,i,o),null!=i&&(i=String(i),this._sources.has(i)||this._sources.add(i)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:i,name:o})},s.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=n.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,t,r){var i=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');i=e.file}var a=this._sourceRoot;null!=a&&(i=n.relative(a,i));var s=new o,c=new o;this._mappings.unsortedForEach((function(t){if(t.source===i&&null!=t.originalLine){var o=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=o.source&&(t.source=o.source,null!=r&&(t.source=n.join(r,t.source)),null!=a&&(t.source=n.relative(a,t.source)),t.originalLine=o.line,t.originalColumn=o.column,null!=o.name&&(t.name=o.name))}var u=t.source;null==u||s.has(u)||s.add(u);var l=t.name;null==l||c.has(l)||c.add(l)}),this),this._sources=s,this._names=c,e.sources.forEach((function(t){var i=e.sourceContentFor(t);null!=i&&(null!=r&&(t=n.join(r,t)),null!=a&&(t=n.relative(a,t)),this.setSourceContent(t,i))}),this)},s.prototype._validateMapping=function(e,t,r,i){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||i)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))},s.prototype._serializeMappings=function(){for(var e,t,r,o,a=0,s=1,c=0,u=0,l=0,h=0,d="",p=this._mappings.toArray(),f=0,g=p.length;f0){if(!n.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=i.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(o=this._sources.indexOf(t.source),e+=i.encode(o-h),h=o,e+=i.encode(t.originalLine-1-u),u=t.originalLine-1,e+=i.encode(t.originalColumn-c),c=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=i.encode(r-l),l=r)),d+=e}return d},s.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},s.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.x=s},1683:(e,t,r)=>{var i=r(4041).x,n=r(251),o=/(\r?\n)/,a="$$$isSourceNode$$$";function s(e,t,r,i,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[a]=!0,null!=i&&this.add(i)}s.fromStringWithSourceMap=function(e,t,r){var i=new s,a=e.split(o),c=0,u=function(){return e()+(e()||"");function e(){return c=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},s.prototype.walk=function(e){for(var t,r=0,i=this.children.length;r0){for(t=[],r=0;r{t.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function n(e){var t=e.match(r);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function o(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(e){var r=e,i=n(e);if(i){if(!i.path)return e;r=i.path}for(var a,s=t.isAbsolute(r),c=r.split(/\/+/),u=0,l=c.length-1;l>=0;l--)"."===(a=c[l])?c.splice(l,1):".."===a?u++:u>0&&(""===a?(c.splice(l+1,u),u=0):(c.splice(l,2),u--));return""===(r=c.join("/"))&&(r=s?"/":"."),i?(i.path=r,o(i)):r}function s(e,t){""===e&&(e="."),""===t&&(t=".");var r=n(t),s=n(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||t.match(i))return t;if(s&&!s.host&&!s.path)return s.host=t,o(s);var c="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=c,o(s)):c}t.urlParse=n,t.urlGenerate=o,t.normalize=a,t.join=s,t.isAbsolute=function(e){return"/"===e.charAt(0)||r.test(e)},t.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var i=e.lastIndexOf("/");if(i<0)return t;if((e=e.slice(0,i)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var c=!("__proto__"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function h(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}t.toSetString=c?u:function(e){return l(e)?"$"+e:e},t.fromSetString=c?u:function(e){return l(e)?e.slice(1):e},t.compareByOriginalPositions=function(e,t,r){var i=h(e.source,t.source);return 0!==i||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)||r||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=e.generatedLine-t.generatedLine)?i:h(e.name,t.name)},t.compareByGeneratedPositionsDeflated=function(e,t,r){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||r||0!==(i=h(e.source,t.source))||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)?i:h(e.name,t.name)},t.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=h(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:h(e.name,t.name)},t.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(e,t,r){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),r){var i=n(r);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var c=i.path.lastIndexOf("/");c>=0&&(i.path=i.path.substring(0,c+1))}t=s(o(i),t)}return a(t)}},9665:(e,t,r)=>{r(4041).x,t.SourceMapConsumer=r(7446).SourceMapConsumer,r(1683)},175:(e,t,r)=>{var i=r(1094),n=r(3193).StringDecoder;e.exports=function(e,t,r){var o=new n,a="",s=r&&r.maxLength,c=!r||!1!==r.trailing;"function"==typeof e&&(t=e,e=null);e||(e=/\r?\n/);function u(e,r){if(t){try{r=t(r)}catch(t){return e.emit("error",t)}void 0!==r&&e.queue(r)}else e.queue(r)}function l(t,r){var i=((null!=a?a:"")+r).split(e);if(a=i.pop(),s&&a.length>s)return t.emit("error",new Error("maximum buffer reached"));for(var n=0;n{var i=r(4928),n=r(1094);e.exports=function(){var e;if(0==(e=1==arguments.length&&Array.isArray(arguments[0])?arguments[0]:[].slice.call(arguments)).length)return n();if(1==e.length)return e[0];var t=e[0],r=e[e.length-1],o=i(t,r);function a(){var e=[].slice.call(arguments);e.unshift("error"),o.emit.apply(o,e)}!function e(t){t.length<2||(t[0].pipe(t[1]),e(t.slice(1)))}(e);for(var s=1;s{"use strict";const i=r(857),n=r(2018),o=r(5884),{env:a}=process;let s;function c(e,{streamIsTTY:t,sniffFlags:r=!0}={}){const n=function(){if("FORCE_COLOR"in a)return"true"===a.FORCE_COLOR?1:"false"===a.FORCE_COLOR?0:0===a.FORCE_COLOR.length?1:Math.min(Number.parseInt(a.FORCE_COLOR,10),3)}();void 0!==n&&(s=n);const c=r?s:n;if(0===c)return 0;if(r){if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2}if(e&&!t&&void 0===c)return 0;const u=c||0;if("dumb"===a.TERM)return u;if("win32"===process.platform){const e=i.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in a)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((e=>e in a))||"codeship"===a.CI_NAME?1:u;if("TEAMCITY_VERSION"in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if("truecolor"===a.COLORTERM)return 3;if("TERM_PROGRAM"in a){const e=Number.parseInt((a.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(a.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||"COLORTERM"in a?1:u}function u(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(c(e,{streamIsTTY:e&&e.isTTY,...t}))}o("no-color")||o("no-colors")||o("color=false")||o("color=never")?s=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(s=1),e.exports={supportsColor:u,stdout:u({isTTY:n.isatty(1)}),stderr:u({isTTY:n.isatty(2)})}},1094:(e,t,r)=>{var i=r(2203);function n(e,t,r){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var n=!1,o=!1,a=[],s=!1,c=new i;function u(){for(;a.length&&!c.paused;){var e=a.shift();if(null===e)return c.emit("end");c.emit("data",e)}}return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(r&&!1===r.autoDestroy),c.write=function(t){return e.call(this,t),!c.paused},c.queue=c.push=function(e){return s||(null===e&&(s=!0),a.push(e),u()),c},c.on("end",(function(){c.readable=!1,!c.writable&&c.autoDestroy&&process.nextTick((function(){c.destroy()}))})),c.end=function(e){if(!n)return n=!0,arguments.length&&c.write(e),c.writable=!1,t.call(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!o)return o=!0,n=!0,a.length=0,c.writable=c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),u(),c.paused||c.emit("drain"),c},c}e.exports=n,n.through=n},294:e=>{"use strict";var t=function(e,t,r){process.nextTick((function(){e(t,r)}))};function r(){}function i(e,t){e.apply(null,t)}process.nextTick((function(e){42===e&&(t=process.nextTick)}),42),e.exports=function(e){var n=function r(o){var a=[o];function s(e){a.push(e)}function c(e){var o=arguments;for(n=function(e){return"[object Error]"===Object.prototype.toString.call(e)}(e)?r:s;a.length;)s(a.shift());function s(e){t(i,e,o)}}n=s,e(c)};return function(e){n(e||r)}}},6346:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FfmpegProcess=void 0,t.sleep=y,t.fetchFffmpeg=function(e){const t=process.platform+"-"+process.arch,r=l.default.join(e,"ffmpeg");u.default.existsSync(r)&&(m(r),v(r));if(!u.default.existsSync(r)){console.info(`Could not find ffmpeg at ${r}, installing ...`);const e=f+t;let i=u.default.createWriteStream(r);switch(t){case"darwin-x64":case"linux-x64":case"linux-arm":g(e,i,(()=>{m(r),v(r)}));break;default:console.error(`Unsupported platform, install your own 'ffmpeg' binary at this path: ${r}`)}}return r},t.safeKillFFmpeg=async function(e){if(!e)return;if(null!=e.exitCode)return;await new Promise((async t=>{e.on("exit",t);try{e.stdin.on("error",(()=>{})),e.stdin.write("q\n")}catch(e){}await y(2e3);for(const t of e.stdio)try{t?.destroy()}catch(e){}e.kill(),await y(2e3),e.kill("SIGKILL")}))};const s=o(r(5317)),c=a(r(857)),u=a(r(9896)),l=a(r(6928)),h=a(r(3785)),d=a(r(5692)),p={timeout:2e3,rejectUnauthorized:!1},f="https://github.com/slyoldfox/ffmpeg-for-bticino/releases/download/v2024.5.1/ffmpeg-";function g(e,t,r){d.default.get(e,p,(e=>{if(301===e.statusCode||302===e.statusCode)return g(e.headers.location,t,r);console.log("[FFMPEG] File size is: "+e.headers["content-length"]),e.pipe(t);let i=Number(e.headers["content-length"]),n=0,o=new Date;e.on("data",(e=>{if(n+=e.length,(new Date).getTime()-o.getTime()>500){let e=Math.round(n/i*100);console.log(`[FFMPEG] Downloaded ${n}/${i} (${e}%)`),o=new Date}})),e.on("end",(()=>{t.close((()=>{r()})),t.end((()=>{console.log("[FFMPEG] Download ended.")}))}))}))}function m(e){const t=u.default.constants.S_IROTH|u.default.constants.S_IXOTH|u.default.constants.S_IRUSR|u.default.constants.S_IXUSR|u.default.constants.S_IRGRP|u.default.constants.S_IXGRP;try{u.default.accessSync(e,u.default.constants.R_OK|u.default.constants.X_OK)}catch(r){u.default.chmodSync(e,t)}}function v(e){try{if(0==u.default.statSync(e).size)u.default.rmSync(e);else{s.default.execSync(e+" -version").toString();console.log(`[FFMPEG] valid binary file at: ${e}`)}}catch(t){console.error("[FFMPEG] binary file corrupt? Removing it. Error: "+t),u.default.rmSync(e)}}async function y(e){await new Promise((t=>setTimeout(t,e)))}t.FfmpegProcess=class{constructor(e,t,r,i,n,o=!1,a,c){n.debug("Stream command: "+r+" "+i,e,o);let u=!1;const l=Date.now();this.process=(0,s.spawn)(r,i.split(/\s+/),{env:process.env}),this.stdin=this.process.stdin,this.process.stdout.on("data",(t=>{const r=this.parseProgress(t);if(r&&!u&&r.frame>0){u=!0;const t=(Date.now()-l)/1e3,r="Getting the first frames took "+t+" seconds.";t<5?n.debug(r,e,o):t<22?n.warn(r,e):n.error(r,e)}}));h.default.createInterface({input:this.process.stderr,terminal:!1}).on("line",(t=>{c&&(c(),c=void 0),o&&t.match(/\[(panic|fatal|error)\]/)?n.error(t,e):o&&n.debug(t,e,!0)})),this.process.on("error",(r=>{n.error("FFmpeg process creation failed: "+r.message,e),c&&c(new Error("FFmpeg process creation failed")),a.stopStream(t)})),this.process.on("exit",((r,i)=>{this.killTimeout&&clearTimeout(this.killTimeout);const s="FFmpeg exited with code: "+r+" and signal: "+i;this.killTimeout&&0===r?n.debug(s+" (Expected)",e,o):null==r||255===r?this.process.killed?n.debug(s+" (Forced)",e,o):n.error(s+" (Unexpected)",e):(n.error(s+" (Error)",e),a.stopStream(t),!u&&c?c(new Error(s)):a.controller.forceStopStreamingSession(t))}))}parseProgress(e){const t=e.toString();if(0==t.indexOf("frame="))try{const e=new Map;return t.split(/\r?\n/).forEach((t=>{const r=t.split("=",2);e.set(r[0],r[1])})),{frame:parseInt(e.get("frame")),fps:parseFloat(e.get("fps")),stream_q:parseFloat(e.get("stream_0_0_q")),bitrate:parseFloat(e.get("bitrate")),total_size:parseInt(e.get("total_size")),out_time_us:parseInt(e.get("out_time_us")),out_time:e.get("out_time").trim(),dup_frames:parseInt(e.get("dup_frames")),drop_frames:parseInt(e.get("drop_frames")),speed:parseFloat(e.get("speed")),progress:e.get("progress").trim()}}catch{return}}stop(){this.process.stdin.write("q"+c.default.EOL),this.killTimeout=setTimeout((()=>{this.process.kill("SIGKILL")}),2e3)}}},4790:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RecordingDelegate=void 0;const n=r(3103),o=r(4679),a=r(4434),s=r(9278),c=r(5317),u=i(r(2613)),l=r(6346);class h{constructor(e,t,r,i,n){this.debugMode=!1,this.destroyed=!1,this.debugMode=e,this.connectPromise=new Promise((e=>this.connectResolve=e)),this.server=(0,s.createServer)(this.handleConnection.bind(this)),this.ffmpegPath=t,this.args=[],this.args.push(...r),this.args.push(...i),this.args.push("-f","mp4"),this.args.push(...n),this.args.push("-fflags","+genpts","-reset_timestamps","1"),this.args.push("-movflags","frag_keyframe+empty_moov+default_base_moof+skip_sidx+skip_trailer")}async start(){const e=(0,a.once)(this.server,"listening");if(this.server.listen(),await e,this.destroyed)return;const t=this.server.address().port;this.args.push("tcp://127.0.0.1:"+t),console.log(this.ffmpegPath+" "+this.args.join(" ")),this.childProcess=(0,c.spawn)(this.ffmpegPath,this.args,{env:process.env,stdio:this.debugMode?"pipe":"ignore"}),this.childProcess||console.error("ChildProcess is undefined directly after the init!"),this.debugMode&&(this.childProcess.stdout?.on("data",(e=>console.log(e.toString()))),this.childProcess.stderr?.on("data",(e=>console.log(e.toString()))))}destroy(){(0,l.safeKillFFmpeg)(this.childProcess),this.socket?.destroy(),this.socket=void 0,this.childProcess=void 0,this.destroyed=!0}handleConnection(e){this.server.close(),this.socket=e,this.connectResolve?.()}async*generator(){if(await this.connectPromise,!this.socket||!this.childProcess)throw console.log("Socket undefined "+!!this.socket+" childProcess undefined "+!!this.childProcess),new Error("Unexpected state!");for(;;){const e=await this.read(8),t=e.readInt32BE(0)-8,r=e.slice(4).toString(),i=await this.read(t);yield{header:e,length:t,type:r,data:i}}}async read(e){if(!this.socket)throw Error("FFMPEG tried reading from closed socket!");if(!e)return Buffer.alloc(0);const t=this.socket.read(e);return t||new Promise(((t,r)=>{const i=()=>{const r=this.socket.read(e);r&&(o(),t(r))},n=()=>{o(),r(new Error(`FFMPEG socket closed during read for ${e} bytes!`))},o=()=>{this.socket?.removeListener("readable",i),this.socket?.removeListener("close",n)};if(!this.socket)throw new Error("FFMPEG socket is closed now!");this.socket.on("readable",i),this.socket.on("close",n)}))}}t.RecordingDelegate=class{constructor(e,t){this.videoConfig=e,this.camera=t,this.log=new o.Logger,this.handlingStreamingRequest=!1}updateRecordingActive(e){this.log.debug(`Recording: ${e}`,this.videoConfig.displayName)}updateRecordingConfiguration(e){this.configuration=e}async*handleRecordingStreamRequest(e){(0,u.default)(!!this.configuration);this.handlingStreamingRequest=!0,(0,u.default)(0===this.configuration.videoCodec.type);2===this.configuration.videoCodec.parameters.profile||this.configuration.videoCodec.parameters.profile,2===this.configuration.videoCodec.parameters.level||this.configuration.videoCodec.parameters.level;let t;switch(this.configuration.audioCodec.samplerate){case 0:t="8";break;case 1:t="16";break;case 2:t="24";break;case 3:t="32";break;case 4:t="44.1";break;case 5:t="48";break;default:throw new Error("Unsupported audio samplerate: "+this.configuration.audioCodec.samplerate)}const r=this.controller?.recordingManagement?.recordingManagementService.getCharacteristic(n.Characteristic.RecordingAudioActive)?["-acodec","libfdk_aac",...0===this.configuration.audioCodec.type?["-profile:a","aac_low"]:["-profile:a","aac_eld"],"-ar",`${t}k`,"-b:a",`${this.configuration.audioCodec.bitrate}k`,"-ac",`${this.configuration.audioCodec.audioChannels}`]:[];if(this.server=new h(this.videoConfig.debug,this.videoConfig.$internalVideoProcessor,("-f rtsp "+this.videoConfig.source+"-recorder").split(/\s+/g),r,["-sn","-dn","-codec:v","copy"]),await this.server.start(),!this.server||this.server.destroyed)return;const i=[];try{for await(const e of this.server.generator()){i.push(e.header,e.data);const t=this.camera.getService(n.Service.MotionSensor)?.getCharacteristic(n.Characteristic.MotionDetected).value;if(console.log("mp4 box type "+e.type+" and length "+e.length+" motion: "+t),"moov"===e.type||"mdat"===e.type){const e=Buffer.concat(i);i.splice(0,i.length);const t=false;if(yield{data:e,isLast:t},t){console.log("Ending session due to motion stopped!");break}}}}catch(e){e.message.startsWith("FFMPEG")||console.error("Encountered unexpected error on generator "+e.stack)}}acknowledgeStream(e){this.closeRecordingStream(e)}closeRecordingStream(e,t){this.server&&(this.server.destroy(),this.server=void 0),this.handlingStreamingRequest=!1}setController(e){this.controller=e}}},5592:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StreamingDelegate=void 0;const n=r(5317),o=r(3103),a=i(r(4280)),s=r(7194),c=r(6346),u=r(4679);t.StreamingDelegate=class{constructor(e){this.log=new u.Logger,this.pendingSessions=new Map,this.ongoingSessions=new Map,this.timeouts=new Map,this.cameraName=e.displayName,this.unbridge=!0,this.videoConfig=e,this.videoProcessor=e.videoProcessor||e.$internalVideoProcessor}setController(e){this.controller=e}determineResolution(e,t){const r={width:e.width,height:e.height};t||(void 0!==this.videoConfig.maxWidth&&(this.videoConfig.forceMax||e.width>this.videoConfig.maxWidth)&&(r.width=this.videoConfig.maxWidth),void 0!==this.videoConfig.maxHeight&&(this.videoConfig.forceMax||e.height>this.videoConfig.maxHeight)&&(r.height=this.videoConfig.maxHeight));const i=this.videoConfig.videoFilter?.split(",")||[],n=i.indexOf("none");return n>=0&&i.splice(n,1),r.snapFilter=i.join(","),n<0&&(r.width>0||r.height>0)&&(r.resizeFilter="scale="+(r.width>0?"'min("+r.width+",iw)'":"iw")+":"+(r.height>0?"'min("+r.height+",ih)'":"ih")+":force_original_aspect_ratio=decrease",i.push(r.resizeFilter),i.push("scale=trunc(iw/2)*2:trunc(ih/2)*2")),i.length>0&&(r.videoFilter=i.join(",")),r}fetchSnapshot(e){const t=this.videoConfig.stillImageSourceCacheTime||3e5;return this.snapshotPromise=new Promise(((r,i)=>{const o=Date.now(),a=(this.videoConfig.stillImageSource||this.videoConfig.source)+" -frames:v 1"+(e?" -filter:v "+e:"")+" -f image2 - -hide_banner -loglevel error";this.log.debug("Snapshot command: "+this.videoProcessor+" "+a,this.cameraName,this.videoConfig.debug);const s=(0,n.spawn)(this.videoProcessor,a.split(/\s+/),{env:process.env}),u=setTimeout((()=>{(0,c.safeKillFFmpeg)(s),i(new Error("Operation timed out creating snapshot"))}),6e3);let l=Buffer.alloc(0);s.stdout.on("data",(e=>{l=Buffer.concat([l,e])})),s.on("error",(e=>{clearTimeout(u),i("FFmpeg process creation failed: "+e.message)})),s.stderr.on("data",(e=>{e.toString().split("\n").forEach((e=>{this.videoConfig.debug&&e.length>0&&this.log.error(e,this.cameraName+"] [Snapshot")}))})),s.on("close",(()=>{l.length>0?(clearTimeout(u),r(l)):(clearTimeout(u),i("Failed to fetch snapshot.")),setTimeout((()=>{this.snapshotPromise=void 0}),t);const e=(Date.now()-o)/1e3;let n="Fetching snapshot took "+e+" seconds.";e<5||(this.unbridge||(n+=" It is highly recommended you switch to unbridge mode."),e<22?this.log.warn(n,this.cameraName):(n+=" The request has timed out and the snapshot has not been refreshed in HomeKit.",this.log.error(n,this.cameraName)))}))})),this.snapshotPromise}resizeSnapshot(e,t){return new Promise(((r,i)=>{const o="-i pipe: -frames:v 1"+(t?" -filter:v "+t:"")+" -f image2 -",a=(0,n.spawn)(this.videoProcessor,o.split(/\s+/),{env:process.env});let s=Buffer.alloc(0);a.stdout.on("data",(e=>{s=Buffer.concat([s,e])})),a.on("error",(e=>{i("FFmpeg process creation failed: "+e.message)})),a.on("close",(()=>{r(s)})),a.stdin.end(e)}))}async handleSnapshotRequest(e,t){const r=this.determineResolution(e,!0);try{"event"===(1===e.reason?"event":"periodic")&&(this.snapshotPromise=void 0);const i=!!this.snapshotPromise,n=Date.now(),o=await(this.snapshotPromise||this.fetchSnapshot(r.snapFilter));i||this.log.debug("Snapshot took: "+(Date.now()-n)+"ms",this.cameraName,this.videoConfig.debug),t(void 0,o)}catch(e){this.snapshotPromise=void 0,this.log.error(e,this.cameraName),t()}}async prepareStream(e,t){const r="ipv6"===e.addressVersion,i={type:"udp",ip:r?"::":"0.0.0.0",reserveTimeout:15},n=await(0,a.default)(i),s=o.CameraController.generateSynchronisationSource(),c=await(0,a.default)(i),u=o.CameraController.generateSynchronisationSource(),l={address:e.targetAddress,ipv6:r,videoPort:e.video.port,videoReturnPort:n,videoCryptoSuite:e.video.srtpCryptoSuite,videoSRTP:Buffer.concat([e.video.srtp_key,e.video.srtp_salt]),videoSSRC:s,audioPort:e.audio.port,audioReturnPort:c,audioCryptoSuite:e.audio.srtpCryptoSuite,audioSRTP:Buffer.concat([e.audio.srtp_key,e.audio.srtp_salt]),audioSSRC:u},h={video:{port:n,ssrc:s,srtp_key:e.video.srtp_key,srtp_salt:e.video.srtp_salt},audio:{port:c,ssrc:u,srtp_key:e.audio.srtp_key,srtp_salt:e.audio.srtp_salt}};this.pendingSessions.set(e.sessionID,l),t(void 0,h)}startStream(e,t){const r=this.pendingSessions.get(e.sessionID);if(r){const i=this.videoConfig.vcodec||"libx264",n=this.videoConfig.packetSize||1316;let o=this.videoConfig.encoderOptions;o||"libx264"!==i||(o="-preset ultrafast -tune zerolatency");const a=this.determineResolution(e.video,!1);let u=void 0!==this.videoConfig.maxFPS&&(this.videoConfig.forceMax||e.video.fps>this.videoConfig.maxFPS)?this.videoConfig.maxFPS:e.video.fps,l=void 0!==this.videoConfig.maxBitrate&&(this.videoConfig.forceMax||e.video.max_bit_rate>this.videoConfig.maxBitrate)?this.videoConfig.maxBitrate:e.video.max_bit_rate;"copy"===i&&(a.width=0,a.height=0,a.videoFilter=void 0,u=0,l=0),this.log.debug("Video stream requested: "+e.video.width+" x "+e.video.height+", "+e.video.fps+" fps, "+e.video.max_bit_rate+" kbps",this.cameraName,this.videoConfig.debug),this.log.info("Starting video stream: "+(a.width>0?a.width:"native")+" x "+(a.height>0?a.height:"native")+", "+(u>0?u:"native")+" fps, "+(l>0?l:"???")+" kbps"+(this.videoConfig.audio?" ("+e.audio.codec+")":""),this.cameraName);let h=this.videoConfig.source;h+=(this.videoConfig.mapvideo?" -map "+this.videoConfig.mapvideo:" -an -sn -dn")+" -codec:v "+i+" -pix_fmt yuv420p -color_range mpeg"+(u>0?" -r "+u:"")+" -f rawvideo"+(o?" "+o:"")+(a.videoFilter?" -filter:v "+a.videoFilter:"")+(l>0?" -b:v "+l+"k":"")+" -payload_type "+e.video.pt,h+=" -ssrc "+r.videoSSRC+" -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "+r.videoSRTP.toString("base64")+" srtp://"+r.address+":"+r.videoPort+"?rtcpport="+r.videoPort+"&pkt_size="+n,this.videoConfig.audio&&("OPUS"===e.audio.codec||"AAC-eld"===e.audio.codec?(h+=(this.videoConfig.mapaudio?" -map "+this.videoConfig.mapaudio:" -vn -sn -dn")+("OPUS"===e.audio.codec?" -codec:a libopus -application lowdelay":" -codec:a libfdk_aac -profile:a aac_eld")+" -flags +global_header -f null -ar "+e.audio.sample_rate+"k -b:a "+e.audio.max_bit_rate+"k -bufsize "+4*e.audio.sample_rate+"k -ac "+e.audio.channel+" -payload_type "+e.audio.pt,h+=" -ssrc "+r.audioSSRC+" -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "+r.audioSRTP.toString("base64")+" srtp://"+r.address+":"+r.audioPort+"?rtcpport="+r.audioPort+"&pkt_size=188"):this.log.error("Unsupported audio codec requested: "+e.audio.codec,this.cameraName)),h+=" -loglevel level"+(this.videoConfig.debug?"+verbose":"")+" -progress pipe:1";const d={};if(d.socket=(0,s.createSocket)(r.ipv6?"udp6":"udp4"),d.socket.on("error",(t=>{this.log.error("Socket error: "+t.message,this.cameraName),this.stopStream(e.sessionID)})),d.socket.on("message",(()=>{d.timeout&&clearTimeout(d.timeout),d.timeout=setTimeout((()=>{this.log.info("Device appears to be inactive. Stopping stream.",this.cameraName),this.controller.forceStopStreamingSession(e.sessionID),this.stopStream(e.sessionID)}),5*e.video.rtcp_interval*1e3)})),d.socket.bind(r.videoReturnPort),d.mainProcess=new c.FfmpegProcess(this.cameraName,e.sessionID,this.videoProcessor,h,this.log,this.videoConfig.debug,this,t),this.videoConfig.returnAudioTarget){const t="-hide_banner -protocol_whitelist pipe,udp,rtp,file,crypto -f sdp -c:a libfdk_aac -i pipe: "+this.videoConfig.returnAudioTarget+" -loglevel level"+(this.videoConfig.debugReturn?"+verbose":""),i=r.ipv6?"IP6":"IP4",n="v=0\r\no=- 0 0 IN "+i+" "+r.address+"\r\ns=Talk\r\nc=IN "+i+" "+r.address+"\r\nt=0 0\r\nm=audio "+r.audioReturnPort+" RTP/AVP 110\r\nb=AS:24\r\na=rtpmap:110 MPEG4-GENERIC/16000/1\r\na=rtcp-mux\r\na=fmtp:110 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=F8F0212C00BC00\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:"+r.audioSRTP.toString("base64")+"\r\n";d.returnProcess=new c.FfmpegProcess(this.cameraName+"] [Two-way",e.sessionID,this.videoProcessor,t,this.log,this.videoConfig.debugReturn,this),d.returnProcess.stdin.end(n)}this.ongoingSessions.set(e.sessionID,d),this.pendingSessions.delete(e.sessionID)}else this.log.error("Error finding session information.",this.cameraName),t(new Error("Error finding session information"))}handleStreamRequest(e,t){switch(e.type){case"start":this.startStream(e,t);break;case"reconfigure":this.log.debug("Received request to reconfigure: "+e.video.width+" x "+e.video.height+", "+e.video.fps+" fps, "+e.video.max_bit_rate+" kbps (Ignored)",this.cameraName,this.videoConfig.debug),t();break;case"stop":this.stopStream(e.sessionID),t()}}stopStream(e){const t=this.ongoingSessions.get(e);if(t){t.timeout&&clearTimeout(t.timeout);try{t.socket?.close()}catch(e){this.log.error("Error occurred closing socket: "+e,this.cameraName)}try{t.mainProcess?.stop()}catch(e){this.log.error("Error occurred terminating main FFmpeg process: "+e,this.cameraName)}try{t.returnProcess?.stop()}catch(e){this.log.error("Error occurred terminating two-way FFmpeg process: "+e,this.cameraName)}}this.ongoingSessions.delete(e),this.log.info("Stopped video stream.",this.cameraName)}}},4679:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;t.Logger=class{formatMessage(e,t){let r="";return t&&(r+="["+t+"] "),r+=e,r}info(e,t){console.info(this.formatMessage(e,t))}warn(e,t){console.warn(this.formatMessage(e,t))}error(e,t){console.error(this.formatMessage(e,t))}debug(e,t,r=!1){console.debug(this.formatMessage(e,t))}}},5920:function(e,t,r){"use strict";var i,n,o,a=this&&this.__classPrivateFieldGet||function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},s=this&&this.__classPrivateFieldSet||function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.HomekitManager=void 0,t.createHAPUsername=function(){const e=[];for(let t=0;t<6;t++)e.push((0,u.randomBytes)(1).toString("hex"));return e.join(":")},t.randomPinCode=function(){return`${C()}${C()}${C()}-${C()}${C()}-${C()}${C()}${C()}`};const c=r(3103),u=r(6982),l=r(5592),h=r(6346),d=r(4790);let p="0.0.0",f="0.0.0",g="C100X/C300X";function m(e){const t=e.getService(c.Service.AccessoryInformation);t.setCharacteristic(c.Characteristic.Manufacturer,"c300x-controller"),t.setCharacteristic(c.Characteristic.Model,g),t.setCharacteristic(c.Characteristic.SerialNumber,"v"+p),t.setCharacteristic(c.Characteristic.FirmwareRevision,f)}class v{constructor(e,t){i.add(this),this.name=e,this.eventbus=t;const r=c.uuid.generate("hap-nodejs:accessories:switch:"+e);this.accessory=new c.Accessory(e,r),m(this.accessory),this.switchService=this.accessory.addService(c.Service.Switch,e),this.switchService.getCharacteristic(c.Characteristic.On).on("set",((r,i)=>{r?t.emit("homekit:switch:on:"+e,this):t.emit("homekit:switch:off:"+e,this),i(null)}));const o=(s=1e3,u=1e4,Math.round(Math.random()*(u-s)+s));var s,u;setTimeout((()=>{a(this,i,"m",n).call(this)}),o)}switchedOn(e){return this.eventbus.on("homekit:switch:on:"+this.name,(()=>{e(this)})),this}switchedOff(e){return this.eventbus.on("homekit:switch:off:"+this.name,(()=>{e(this)})),this}updateState(e){return this.eventbus.on("homekit:switch:update:"+this.name,(()=>{e().then((e=>{this.switchService.getCharacteristic(c.Characteristic.On).updateValue(e)})).finally((()=>{setTimeout((()=>{a(this,i,"m",n).call(this)}),6e4)}))})),this}}i=new WeakSet,n=function(){this.eventbus.emit("homekit:switch:update:"+this.name)};class y{constructor(e,t,r){this.id=e,this.eventbus=r,o.set(this,!0);const i=c.uuid.generate("hap-nodejs:accessories:lock:"+t);this.accessory=new c.Accessory(t,i),m(this.accessory),this.lockService=this.accessory.addService(c.Service.LockMechanism,t),this.lockService.getCharacteristic(c.Characteristic.LockTargetState).on("set",((t,i)=>{t===c.Characteristic.LockTargetState.UNSECURED?(s(this,o,!1,"f"),r.emit("homekit:lock:unlock:"+e,this),i(),setTimeout((()=>{s(this,o,!0,"f"),r.emit("homekit:lock:lock:"+e,this)}),3e3)):t===c.Characteristic.LockTargetState.SECURED&&(i(),this.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockCurrentState.SECURED))})),this.lockService.getCharacteristic(c.Characteristic.LockCurrentState).on("get",(e=>{a(this,o,"f")?e(void 0,c.Characteristic.LockCurrentState.SECURED):e(void 0,c.Characteristic.LockCurrentState.UNSECURED)})),this.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockCurrentState.SECURED)}unlocked(e){return this.eventbus.on("homekit:lock:unlock:"+this.id,(()=>{e(this)})),this}}function C(){return Math.round(1e5*Math.random())%10}o=new WeakMap;t.HomekitManager=class{constructor(e,t,r,i,n,o){this.eventbus=e,c.HAPStorage.setCustomStoragePath(t+"/storage"),i.videoProcessor||(i.$internalVideoProcessor=(0,h.fetchFffmpeg)(t)),g=o,p=n,this.bridge=new c.Bridge(r.displayName,c.uuid.generate("hap-nodejs:bridges:homebridge")),m(this.bridge),console.log("Bridge pairing code: "+r.pinCode),this.bridge.publish({advertiser:"ciao",username:r.username,pincode:r.pinCode,category:2,addIdentifyingMaterial:!1})}addDoorbell(e){this.doorbell=new c.Accessory(e.displayName,c.uuid.generate("hap-nodejs:accessories:doorbell:"+e.displayName)),m(this.doorbell);const t=new l.StreamingDelegate(e),r=new d.RecordingDelegate(e,this.doorbell),i=this.doorbell.addService(c.Service.MotionSensor),n=new c.DoorbellController(this.getCameraControllerOptions(e,this.doorbell,t,r));t.setController(n),r.setController(n),this.doorbell.configureController(n);const o=this.doorbell.getService(c.Service.Doorbell);return this.eventbus.on("homekit:pressed",(()=>{console.log("HOMEKIT PRESSED EVENT AT: "+Date()),o.getCharacteristic(c.Characteristic.ProgrammableSwitchEvent).updateValue(c.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)})),this.eventbus.on("homekit:motion",(e=>{console.log("HOMEKIT MOTION EVENT AT: "+Date()),i.getCharacteristic(c.Characteristic.MotionDetected).updateValue(!0),setTimeout((()=>{console.log("SET FALSE AT: "+Date()),i.getCharacteristic(c.Characteristic.MotionDetected).updateValue(!1)}),e||2e4)})),this.doorbell.publish({advertiser:"ciao",username:e.username,pincode:e.pinCode,category:18}),console.log("Camera pairing code: "+e.pinCode),{doorbell:this.doorbell,streamingDelegate:t}}addLock(e,t){const r=new y(e,t,this.eventbus);return this.eventbus.on("homekit:locked:"+e,(e=>{!0===e?(r.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockTargetState.SECURED),r.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockTargetState.SECURED)):!1===e&&(r.lockService.updateCharacteristic(c.Characteristic.LockCurrentState,c.Characteristic.LockTargetState.UNSECURED),r.lockService.updateCharacteristic(c.Characteristic.LockTargetState,c.Characteristic.LockTargetState.UNSECURED))})),this.bridge.addBridgedAccessory(r.accessory),r}addSwitch(e){const t=new v(e,this.eventbus);return this.bridge.addBridgedAccessory(t.accessory),t}updateFirmwareVersion(e){f=e,m(this.bridge),m(this.doorbell),this.bridge.bridgedAccessories.forEach((e=>{m(e)}))}getCameraControllerOptions(e,t,r,i){const n=e.hksv||!0,o=[[320,180,30],[320,240,15],[320,240,30],[480,270,30],[480,360,30],[640,360,30],[640,480,30],[1280,720,30],[1280,960,30],[1920,1080,30],[1600,1200,30]];return{cameraStreamCount:e.maxStreams||2,delegate:r,streamingOptions:{supportedCryptoSuites:[0],video:{resolutions:o,codec:{profiles:[0,1,2],levels:[0,1,2]}},audio:{twoWayAudio:!!e.returnAudioTarget,codecs:[{type:"AAC-eld",samplerate:16}]}},recording:n?{options:{prebufferLength:4e3,mediaContainerConfiguration:[{type:0,fragmentLength:4e3}],video:{type:0,parameters:{profiles:[0,1,2],levels:[0,1,2]},resolutions:o},audio:{codecs:{type:0,samplerate:2,bitrateMode:0,audioChannels:1}}},delegate:i}:void 0,sensors:n?{motion:t.getService(c.Service.MotionSensor),occupancy:void 0}:void 0}}}},8947:(e,t,r)=>{!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=i>>24&255,e[t+5]=i>>16&255,e[t+6]=i>>8&255,e[t+7]=255&i}function g(e,t,r,i,n){var o,a=0;for(o=0;o>>8)-1}function m(e,t,r,i){return g(e,t,r,i,16)}function v(e,t,r,i){return g(e,t,r,i,32)}function y(e,t,r,i){!function(e,t,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,C=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,S=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,E=o,_=a,T=s,A=c,I=u,D=l,w=h,b=d,U=p,R=f,O=g,N=m,P=v,B=y,L=C,x=S,M=0;M<20;M+=2)E^=(n=(P^=(n=(U^=(n=(I^=(n=E+P|0)<<7|n>>>25)+E|0)<<9|n>>>23)+I|0)<<13|n>>>19)+U|0)<<18|n>>>14,D^=(n=(_^=(n=(B^=(n=(R^=(n=D+_|0)<<7|n>>>25)+D|0)<<9|n>>>23)+R|0)<<13|n>>>19)+B|0)<<18|n>>>14,O^=(n=(w^=(n=(T^=(n=(L^=(n=O+w|0)<<7|n>>>25)+O|0)<<9|n>>>23)+L|0)<<13|n>>>19)+T|0)<<18|n>>>14,x^=(n=(N^=(n=(b^=(n=(A^=(n=x+N|0)<<7|n>>>25)+x|0)<<9|n>>>23)+A|0)<<13|n>>>19)+b|0)<<18|n>>>14,E^=(n=(A^=(n=(T^=(n=(_^=(n=E+A|0)<<7|n>>>25)+E|0)<<9|n>>>23)+_|0)<<13|n>>>19)+T|0)<<18|n>>>14,D^=(n=(I^=(n=(b^=(n=(w^=(n=D+I|0)<<7|n>>>25)+D|0)<<9|n>>>23)+w|0)<<13|n>>>19)+b|0)<<18|n>>>14,O^=(n=(R^=(n=(U^=(n=(N^=(n=O+R|0)<<7|n>>>25)+O|0)<<9|n>>>23)+N|0)<<13|n>>>19)+U|0)<<18|n>>>14,x^=(n=(L^=(n=(B^=(n=(P^=(n=x+L|0)<<7|n>>>25)+x|0)<<9|n>>>23)+P|0)<<13|n>>>19)+B|0)<<18|n>>>14;E=E+o|0,_=_+a|0,T=T+s|0,A=A+c|0,I=I+u|0,D=D+l|0,w=w+h|0,b=b+d|0,U=U+p|0,R=R+f|0,O=O+g|0,N=N+m|0,P=P+v|0,B=B+y|0,L=L+C|0,x=x+S|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=T>>>0&255,e[9]=T>>>8&255,e[10]=T>>>16&255,e[11]=T>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=w>>>0&255,e[25]=w>>>8&255,e[26]=w>>>16&255,e[27]=w>>>24&255,e[28]=b>>>0&255,e[29]=b>>>8&255,e[30]=b>>>16&255,e[31]=b>>>24&255,e[32]=U>>>0&255,e[33]=U>>>8&255,e[34]=U>>>16&255,e[35]=U>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=O>>>0&255,e[41]=O>>>8&255,e[42]=O>>>16&255,e[43]=O>>>24&255,e[44]=N>>>0&255,e[45]=N>>>8&255,e[46]=N>>>16&255,e[47]=N>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=B>>>0&255,e[53]=B>>>8&255,e[54]=B>>>16&255,e[55]=B>>>24&255,e[56]=L>>>0&255,e[57]=L>>>8&255,e[58]=L>>>16&255,e[59]=L>>>24&255,e[60]=x>>>0&255,e[61]=x>>>8&255,e[62]=x>>>16&255,e[63]=x>>>24&255}(e,t,r,i)}function C(e,t,r,i){!function(e,t,r,i){for(var n,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,C=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,S=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,E=0;E<20;E+=2)o^=(n=(v^=(n=(p^=(n=(u^=(n=o+v|0)<<7|n>>>25)+o|0)<<9|n>>>23)+u|0)<<13|n>>>19)+p|0)<<18|n>>>14,l^=(n=(a^=(n=(y^=(n=(f^=(n=l+a|0)<<7|n>>>25)+l|0)<<9|n>>>23)+f|0)<<13|n>>>19)+y|0)<<18|n>>>14,g^=(n=(h^=(n=(s^=(n=(C^=(n=g+h|0)<<7|n>>>25)+g|0)<<9|n>>>23)+C|0)<<13|n>>>19)+s|0)<<18|n>>>14,S^=(n=(m^=(n=(d^=(n=(c^=(n=S+m|0)<<7|n>>>25)+S|0)<<9|n>>>23)+c|0)<<13|n>>>19)+d|0)<<18|n>>>14,o^=(n=(c^=(n=(s^=(n=(a^=(n=o+c|0)<<7|n>>>25)+o|0)<<9|n>>>23)+a|0)<<13|n>>>19)+s|0)<<18|n>>>14,l^=(n=(u^=(n=(d^=(n=(h^=(n=l+u|0)<<7|n>>>25)+l|0)<<9|n>>>23)+h|0)<<13|n>>>19)+d|0)<<18|n>>>14,g^=(n=(f^=(n=(p^=(n=(m^=(n=g+f|0)<<7|n>>>25)+g|0)<<9|n>>>23)+m|0)<<13|n>>>19)+p|0)<<18|n>>>14,S^=(n=(C^=(n=(y^=(n=(v^=(n=S+C|0)<<7|n>>>25)+S|0)<<9|n>>>23)+v|0)<<13|n>>>19)+y|0)<<18|n>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=S>>>0&255,e[13]=S>>>8&255,e[14]=S>>>16&255,e[15]=S>>>24&255,e[16]=h>>>0&255,e[17]=h>>>8&255,e[18]=h>>>16&255,e[19]=h>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=p>>>0&255,e[25]=p>>>8&255,e[26]=p>>>16&255,e[27]=p>>>24&255,e[28]=f>>>0&255,e[29]=f>>>8&255,e[30]=f>>>16&255,e[31]=f>>>24&255}(e,t,r,i)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,r,i,n,o,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;n>=64;){for(y(l,u,a,S),c=0;c<64;c++)e[t+c]=r[i+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;n-=64,t+=64,i+=64}if(n>0)for(y(l,u,a,S),c=0;c=64;){for(y(c,s,n,S),a=0;a<64;a++)e[t+a]=c[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(y(c,s,n,S),a=0;a>>13|r<<3),i=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|i<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(i>>>7|n<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function D(e,t,r,i,n,o){var a=new I(o);return a.update(r,i,n),a.finish(e,t),0}function w(e,t,r,i,n,o){var a=new Uint8Array(16);return D(a,0,r,i,n,o),m(e,t,a,0)}function b(e,t,r,i,n){var o;if(r<32)return-1;for(A(e,0,t,0,r,i,n),D(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function U(e,t,r,i,n){var o,a=new Uint8Array(32);if(r<32)return-1;if(T(a,0,32,i,n),0!==w(t,16,t,32,r-32,a))return-1;for(A(e,0,t,0,r,i,n),o=0;o<32;o++)e[o]=0;return 0}function R(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,i=1;for(t=0;t<16;t++)r=e[t]+i+65535,i=Math.floor(r/65536),e[t]=r-65536*i;e[0]+=i-1+37*(i-1)}function N(e,t,r){for(var i,n=~(r-1),o=0;o<16;o++)i=n&(e[o]^t[o]),e[o]^=i,t[o]^=i}function P(e,r){var i,n,o,a=t(),s=t();for(i=0;i<16;i++)s[i]=r[i];for(O(s),O(s),O(s),n=0;n<2;n++){for(a[0]=s[0]-65517,i=1;i<15;i++)a[i]=s[i]-65535-(a[i-1]>>16&1),a[i-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,N(s,a,1-o)}for(i=0;i<16;i++)e[2*i]=255&s[i],e[2*i+1]=s[i]>>8}function B(e,t){var r=new Uint8Array(32),i=new Uint8Array(32);return P(r,e),P(i,t),v(r,0,i,0)}function L(e){var t=new Uint8Array(32);return P(t,e),1&t[0]}function x(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function M(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]+r[i]}function F(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]-r[i]}function k(e,t,r){var i,n,o=0,a=0,s=0,c=0,u=0,l=0,h=0,d=0,p=0,f=0,g=0,m=0,v=0,y=0,C=0,S=0,E=0,_=0,T=0,A=0,I=0,D=0,w=0,b=0,U=0,R=0,O=0,N=0,P=0,B=0,L=0,x=r[0],M=r[1],F=r[2],k=r[3],V=r[4],H=r[5],j=r[6],G=r[7],W=r[8],Y=r[9],q=r[10],K=r[11],$=r[12],z=r[13],Q=r[14],X=r[15];o+=(i=t[0])*x,a+=i*M,s+=i*F,c+=i*k,u+=i*V,l+=i*H,h+=i*j,d+=i*G,p+=i*W,f+=i*Y,g+=i*q,m+=i*K,v+=i*$,y+=i*z,C+=i*Q,S+=i*X,a+=(i=t[1])*x,s+=i*M,c+=i*F,u+=i*k,l+=i*V,h+=i*H,d+=i*j,p+=i*G,f+=i*W,g+=i*Y,m+=i*q,v+=i*K,y+=i*$,C+=i*z,S+=i*Q,E+=i*X,s+=(i=t[2])*x,c+=i*M,u+=i*F,l+=i*k,h+=i*V,d+=i*H,p+=i*j,f+=i*G,g+=i*W,m+=i*Y,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+=i*F,C+=i*k,S+=i*V,E+=i*H,_+=i*j,T+=i*G,A+=i*W,I+=i*Y,D+=i*q,w+=i*K,b+=i*$,U+=i*z,R+=i*Q,O+=i*X,v+=(i=t[12])*x,y+=i*M,C+=i*F,S+=i*k,E+=i*V,_+=i*H,T+=i*j,A+=i*G,I+=i*W,D+=i*Y,w+=i*q,b+=i*K,U+=i*$,R+=i*z,O+=i*Q,N+=i*X,y+=(i=t[13])*x,C+=i*M,S+=i*F,E+=i*k,_+=i*V,T+=i*H,A+=i*j,I+=i*G,D+=i*W,w+=i*Y,b+=i*q,U+=i*K,R+=i*$,O+=i*z,N+=i*Q,P+=i*X,C+=(i=t[14])*x,S+=i*M,E+=i*F,_+=i*k,T+=i*V,A+=i*H,I+=i*j,D+=i*G,w+=i*W,b+=i*Y,U+=i*q,R+=i*K,O+=i*$,N+=i*z,P+=i*Q,B+=i*X,S+=(i=t[15])*x,a+=38*(_+=i*F),s+=38*(T+=i*k),c+=38*(A+=i*V),u+=38*(I+=i*H),l+=38*(D+=i*j),h+=38*(w+=i*G),d+=38*(b+=i*W),p+=38*(U+=i*Y),f+=38*(R+=i*q),g+=38*(O+=i*K),m+=38*(N+=i*$),v+=38*(P+=i*z),y+=38*(B+=i*Q),C+=38*(L+=i*X),o=(i=(o+=38*(E+=i*M))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),C=(i=C+n+65535)-65536*(n=Math.floor(i/65536)),S=(i=S+n+65535)-65536*(n=Math.floor(i/65536)),o=(i=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=s+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),C=(i=C+n+65535)-65536*(n=Math.floor(i/65536)),S=(i=S+n+65535)-65536*(n=Math.floor(i/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=d,e[8]=p,e[9]=f,e[10]=g,e[11]=m,e[12]=v,e[13]=y,e[14]=C,e[15]=S}function V(e,t){k(e,t,t)}function H(e,r){var i,n=t();for(i=0;i<16;i++)n[i]=r[i];for(i=253;i>=0;i--)V(n,n),2!==i&&4!==i&&k(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function j(e,r){var i,n=t();for(i=0;i<16;i++)n[i]=r[i];for(i=250;i>=0;i--)V(n,n),1!==i&&k(n,n,r);for(i=0;i<16;i++)e[i]=n[i]}function G(e,r,i){var n,o,a=new Uint8Array(32),s=new Float64Array(80),u=t(),l=t(),h=t(),d=t(),p=t(),f=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,x(s,i),o=0;o<16;o++)l[o]=s[o],d[o]=u[o]=h[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)N(u,l,n=a[o>>>3]>>>(7&o)&1),N(h,d,n),M(p,u,h),F(u,u,h),M(h,l,d),F(l,l,d),V(d,p),V(f,u),k(u,h,u),k(h,l,p),M(p,u,h),F(u,u,h),V(l,u),F(h,d,f),k(u,h,c),M(u,u,d),k(h,h,u),k(u,d,f),k(d,l,s),V(l,p),N(u,l,n),N(h,d,n);for(o=0;o<16;o++)s[o+16]=u[o],s[o+32]=h[o],s[o+48]=l[o],s[o+64]=d[o];var g=s.subarray(32),m=s.subarray(16);return H(g,g),k(m,m,g),P(e,m),0}function W(e,t){return G(e,t,o)}function Y(e,t){return i(t,32),W(e,t)}function q(e,t,r){var i=new Uint8Array(32);return G(i,r,t),C(e,n,i,S)}I.prototype.blocks=function(e,t,r){for(var i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,C,S,E,_=this.fin?0:2048,T=this.h[0],A=this.h[1],I=this.h[2],D=this.h[3],w=this.h[4],b=this.h[5],U=this.h[6],R=this.h[7],O=this.h[8],N=this.h[9],P=this.r[0],B=this.r[1],L=this.r[2],x=this.r[3],M=this.r[4],F=this.r[5],k=this.r[6],V=this.r[7],H=this.r[8],j=this.r[9];r>=16;)d=h=0,d+=(T+=8191&(i=255&e[t+0]|(255&e[t+1])<<8))*P,d+=(A+=8191&(i>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*j),d+=(I+=8191&(n>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*H),d+=(D+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*V),h=(d+=(w+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*k))>>>13,d&=8191,d+=(b+=s>>>1&8191)*(5*F),d+=(U+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*M),d+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*x),d+=(O+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*L),p=h+=(d+=(N+=l>>>5|_)*(5*B))>>>13,p+=T*B,p+=A*P,p+=I*(5*j),p+=D*(5*H),h=(p+=w*(5*V))>>>13,p&=8191,p+=b*(5*k),p+=U*(5*F),p+=R*(5*M),p+=O*(5*x),h+=(p+=N*(5*L))>>>13,p&=8191,f=h,f+=T*L,f+=A*B,f+=I*P,f+=D*(5*j),h=(f+=w*(5*H))>>>13,f&=8191,f+=b*(5*V),f+=U*(5*k),f+=R*(5*F),f+=O*(5*M),g=h+=(f+=N*(5*x))>>>13,g+=T*x,g+=A*L,g+=I*B,g+=D*P,h=(g+=w*(5*j))>>>13,g&=8191,g+=b*(5*H),g+=U*(5*V),g+=R*(5*k),g+=O*(5*F),m=h+=(g+=N*(5*M))>>>13,m+=T*M,m+=A*x,m+=I*L,m+=D*B,h=(m+=w*P)>>>13,m&=8191,m+=b*(5*j),m+=U*(5*H),m+=R*(5*V),m+=O*(5*k),v=h+=(m+=N*(5*F))>>>13,v+=T*F,v+=A*M,v+=I*x,v+=D*L,h=(v+=w*B)>>>13,v&=8191,v+=b*P,v+=U*(5*j),v+=R*(5*H),v+=O*(5*V),y=h+=(v+=N*(5*k))>>>13,y+=T*k,y+=A*F,y+=I*M,y+=D*x,h=(y+=w*L)>>>13,y&=8191,y+=b*B,y+=U*P,y+=R*(5*j),y+=O*(5*H),C=h+=(y+=N*(5*V))>>>13,C+=T*V,C+=A*k,C+=I*F,C+=D*M,h=(C+=w*x)>>>13,C&=8191,C+=b*L,C+=U*B,C+=R*P,C+=O*(5*j),S=h+=(C+=N*(5*H))>>>13,S+=T*H,S+=A*V,S+=I*k,S+=D*F,h=(S+=w*M)>>>13,S&=8191,S+=b*x,S+=U*L,S+=R*B,S+=O*P,E=h+=(S+=N*(5*j))>>>13,E+=T*j,E+=A*H,E+=I*V,E+=D*k,h=(E+=w*F)>>>13,E&=8191,E+=b*M,E+=U*x,E+=R*L,E+=O*B,T=d=8191&(h=(h=((h+=(E+=N*P)>>>13)<<2)+h|0)+(d&=8191)|0),A=p+=h>>>=13,I=f&=8191,D=g&=8191,w=m&=8191,b=v&=8191,U=y&=8191,R=C&=8191,O=S&=8191,N=E&=8191,t+=16,r-=16;this.h[0]=T,this.h[1]=A,this.h[2]=I,this.h[3]=D,this.h[4]=w,this.h[5]=b,this.h[6]=U,this.h[7]=R,this.h[8]=O,this.h[9]=N},I.prototype.finish=function(e,t){var r,i,n,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,i=(1^r)-1,o=0;o<10;o++)a[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,o=1;o<8;o++)n=(this.h[o]+this.pad[o]|0)+(n>>>16)|0,this.h[o]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},I.prototype.update=function(e,t,r){var i,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),i=0;i=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(i=0;i=128;){for(_=0;_<16;_++)T=8*_+$,R[_]=r[T+0]<<24|r[T+1]<<16|r[T+2]<<8|r[T+3],O[_]=r[T+4]<<24|r[T+5]<<16|r[T+6]<<8|r[T+7];for(_=0;_<80;_++)if(n=N,o=P,a=B,s=L,c=x,u=M,l=F,k,d=V,p=H,f=j,g=G,m=W,v=Y,y=q,K,D=65535&(I=K),w=I>>>16,b=65535&(A=k),U=A>>>16,D+=65535&(I=(W>>>14|x<<18)^(W>>>18|x<<14)^(x>>>9|W<<23)),w+=I>>>16,b+=65535&(A=(x>>>14|W<<18)^(x>>>18|W<<14)^(W>>>9|x<<23)),U+=A>>>16,D+=65535&(I=W&Y^~W&q),w+=I>>>16,b+=65535&(A=x&M^~x&F),U+=A>>>16,A=z[2*_],D+=65535&(I=z[2*_+1]),w+=I>>>16,b+=65535&A,U+=A>>>16,A=R[_%16],w+=(I=O[_%16])>>>16,b+=65535&A,U+=A>>>16,b+=(w+=(D+=65535&I)>>>16)>>>16,D=65535&(I=E=65535&D|w<<16),w=I>>>16,b=65535&(A=S=65535&b|(U+=b>>>16)<<16),U=A>>>16,D+=65535&(I=(V>>>28|N<<4)^(N>>>2|V<<30)^(N>>>7|V<<25)),w+=I>>>16,b+=65535&(A=(N>>>28|V<<4)^(V>>>2|N<<30)^(V>>>7|N<<25)),U+=A>>>16,w+=(I=V&H^V&j^H&j)>>>16,b+=65535&(A=N&P^N&B^P&B),U+=A>>>16,h=65535&(b+=(w+=(D+=65535&I)>>>16)>>>16)|(U+=b>>>16)<<16,C=65535&D|w<<16,D=65535&(I=g),w=I>>>16,b=65535&(A=s),U=A>>>16,w+=(I=E)>>>16,b+=65535&(A=S),U+=A>>>16,P=n,B=o,L=a,x=s=65535&(b+=(w+=(D+=65535&I)>>>16)>>>16)|(U+=b>>>16)<<16,M=c,F=u,k=l,N=h,H=d,j=p,G=f,W=g=65535&D|w<<16,Y=m,q=v,K=y,V=C,_%16==15)for(T=0;T<16;T++)A=R[T],D=65535&(I=O[T]),w=I>>>16,b=65535&A,U=A>>>16,A=R[(T+9)%16],D+=65535&(I=O[(T+9)%16]),w+=I>>>16,b+=65535&A,U+=A>>>16,S=R[(T+1)%16],D+=65535&(I=((E=O[(T+1)%16])>>>1|S<<31)^(E>>>8|S<<24)^(E>>>7|S<<25)),w+=I>>>16,b+=65535&(A=(S>>>1|E<<31)^(S>>>8|E<<24)^S>>>7),U+=A>>>16,S=R[(T+14)%16],w+=(I=((E=O[(T+14)%16])>>>19|S<<13)^(S>>>29|E<<3)^(E>>>6|S<<26))>>>16,b+=65535&(A=(S>>>19|E<<13)^(E>>>29|S<<3)^S>>>6),U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,R[T]=65535&b|U<<16,O[T]=65535&D|w<<16;D=65535&(I=V),w=I>>>16,b=65535&(A=N),U=A>>>16,A=e[0],w+=(I=t[0])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[0]=N=65535&b|U<<16,t[0]=V=65535&D|w<<16,D=65535&(I=H),w=I>>>16,b=65535&(A=P),U=A>>>16,A=e[1],w+=(I=t[1])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[1]=P=65535&b|U<<16,t[1]=H=65535&D|w<<16,D=65535&(I=j),w=I>>>16,b=65535&(A=B),U=A>>>16,A=e[2],w+=(I=t[2])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[2]=B=65535&b|U<<16,t[2]=j=65535&D|w<<16,D=65535&(I=G),w=I>>>16,b=65535&(A=L),U=A>>>16,A=e[3],w+=(I=t[3])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[3]=L=65535&b|U<<16,t[3]=G=65535&D|w<<16,D=65535&(I=W),w=I>>>16,b=65535&(A=x),U=A>>>16,A=e[4],w+=(I=t[4])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[4]=x=65535&b|U<<16,t[4]=W=65535&D|w<<16,D=65535&(I=Y),w=I>>>16,b=65535&(A=M),U=A>>>16,A=e[5],w+=(I=t[5])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[5]=M=65535&b|U<<16,t[5]=Y=65535&D|w<<16,D=65535&(I=q),w=I>>>16,b=65535&(A=F),U=A>>>16,A=e[6],w+=(I=t[6])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[6]=F=65535&b|U<<16,t[6]=q=65535&D|w<<16,D=65535&(I=K),w=I>>>16,b=65535&(A=k),U=A>>>16,A=e[7],w+=(I=t[7])>>>16,b+=65535&A,U+=A>>>16,U+=(b+=(w+=(D+=65535&I)>>>16)>>>16)>>>16,e[7]=k=65535&b|U<<16,t[7]=K=65535&D|w<<16,$+=128,i-=128}return i}function X(e,t,r){var i,n=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,Q(n,o,t,r),r%=128,i=0;i=0;--n)Z(e,t,i=r[n/8|0]>>(7&n)&1),J(t,e),J(e,e),Z(e,t,i)}function re(e,r){var i=[t(),t(),t(),t()];R(i[0],h),R(i[1],d),R(i[2],s),k(i[3],h,d),te(e,i,r)}function ie(e,r,n){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(n||i(r,32),X(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64,re(s,a),ee(e,s),o=0;o<32;o++)r[o+32]=e[o];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function oe(e,t){var r,i,n,o;for(i=63;i>=32;--i){for(r=0,n=i-32,o=i-12;n>4)*ne[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*ne[n];for(i=0;i<32;i++)t[i+1]+=t[i]>>8,e[i]=255&t[i]}function ae(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;oe(e,r)}function se(e,r,i,n){var o,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),h=[t(),t(),t(),t()];X(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=i+64;for(o=0;o>7&&F(e[0],a,e[0]),k(e[3],e[0],e[1]),0)}(d,n))return-1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(he),t=new Uint8Array(de);return ie(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(fe(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(he),r=0;r{"use strict";var i=r(4761),n=r(1703),o=r(5128),a=r(3612),s=r(9803);e.exports=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e?null:i(e)?"String":n(e)?"Number":o(e)?"Boolean":a(e)?"Symbol":s(e)?"BigInt":void 0}},593:(e,t,r)=>{"use strict";var i=r(3802),n=r(256),o=r(7842),a=r(2648);e.exports=function(e){if(e&&"object"==typeof e){if(i(e))return"Map";if(n(e))return"Set";if(o(e))return"WeakMap";if(a(e))return"WeakSet"}return!1}},5767:(e,t,r)=>{"use strict";var i=r(2682),n=r(9209),o=r(487),a=r(8075),s=r(5795),c=a("Object.prototype.toString"),u=r(9092)(),l="undefined"==typeof globalThis?global:globalThis,h=n(),d=a("String.prototype.slice"),p=Object.getPrototypeOf,f=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1?t:"Object"===t&&function(e){var t=!1;return i(g,(function(r,i){if(!t)try{r(e),t=d(i,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return i(g,(function(r,i){if(!t)try{"$"+r(e)===i&&(t=d(i,1))}catch(e){}})),t}(e):null}},3177:function(e,t){(function(){"use strict";t.stripBOM=function(e){return"\ufeff"===e[0]?e.substring(1):e}}).call(this)},6712:function(e,t,r){(function(){"use strict";var e,i,n,o,a,s={}.hasOwnProperty;e=r(2046),i=r(6465).defaults,o=function(e){return"string"==typeof e&&(e.indexOf("&")>=0||e.indexOf(">")>=0||e.indexOf("<")>=0)},a=function(e){return""},n=function(e){return e.replace("]]>","]]]]>")},t.Builder=function(){function t(e){var t,r,n;for(t in this.options={},r=i[.2])s.call(r,t)&&(n=r[t],this.options[t]=n);for(t in e)s.call(e,t)&&(n=e[t],this.options[t]=n)}return t.prototype.buildObject=function(t){var r,n,c,u,l,h;return r=this.options.attrkey,n=this.options.charkey,1===Object.keys(t).length&&this.options.rootName===i[.2].rootName?t=t[l=Object.keys(t)[0]]:l=this.options.rootName,h=this,c=function(e,t){var i,u,l,d,p,f;if("object"!=typeof t)h.options.cdata&&o(t)?e.raw(a(t)):e.txt(t);else if(Array.isArray(t)){for(d in t)if(s.call(t,d))for(p in u=t[d])l=u[p],e=c(e.ele(p),l).up()}else for(p in t)if(s.call(t,p))if(u=t[p],p===r){if("object"==typeof u)for(i in u)f=u[i],e=e.att(i,f)}else if(p===n)e=h.options.cdata&&o(u)?e.raw(a(u)):e.txt(u);else if(Array.isArray(u))for(d in u)s.call(u,d)&&(e="string"==typeof(l=u[d])?h.options.cdata&&o(l)?e.ele(p).raw(a(l)).up():e.ele(p,l).up():c(e.ele(p),l).up());else"object"==typeof u?e=c(e.ele(p),u).up():"string"==typeof u&&h.options.cdata&&o(u)?e=e.ele(p).raw(a(u)).up():(null==u&&(u=""),e=e.ele(p,u.toString()).up());return e},u=e.create(l,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(u,t).end(this.options.renderOpts)},t}()}).call(this)},6465:function(e,t){(function(){t.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(this)},1912:function(e,t,r){(function(){"use strict";var e,i,n,o,a,s,c,u,l,h=function(e,t){return function(){return e.apply(t,arguments)}},d={}.hasOwnProperty;u=r(4043),o=r(4434),e=r(3177),c=r(2114),l=r(3557).setImmediate,i=r(6465).defaults,a=function(e){return"object"==typeof e&&null!=e&&0===Object.keys(e).length},s=function(e,t,r){var i,n;for(i=0,n=e.length;i0&&(u[e.options.childkey]=h),h=u;return i.length>0?e.assignOrPush(g,l,h):(e.options.explicitRoot&&(f=h,n(h={},l,f)),e.resultObject=h,e.saxParser.ended=!0,e.emit("end",e.resultObject))}}(this),r=function(e){return function(r){var n,o;if(o=i[i.length-1])return o[t]+=r,e.options.explicitChildren&&e.options.preserveChildrenOrder&&e.options.charsAsChildren&&(e.options.includeWhiteChars||""!==r.replace(/\\n/g,"").trim())&&(o[e.options.childkey]=o[e.options.childkey]||[],(n={"#name":"__text__"})[t]=r,e.options.normalize&&(n[t]=n[t].replace(/\s{2,}/g," ").trim()),o[e.options.childkey].push(n)),o}}(this),this.saxParser.ontext=r,this.saxParser.oncdata=function(e){var t;if(t=r(e))return t.cdata=!0}},o.prototype.parseString=function(t,r){var i;null!=r&&"function"==typeof r&&(this.on("end",(function(e){return this.reset(),r(null,e)})),this.on("error",(function(e){return this.reset(),r(e)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=e.stripBOM(t),this.options.async?(this.remaining=t,l(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(e){if(i=e,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",i),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw i}},o.prototype.parseStringPromise=function(e){return new Promise((t=this,function(r,i){return t.parseString(e,(function(e,t){return e?i(e):r(t)}))}));var t},o}(o),t.parseString=function(e,r,i){var n,o;return null!=i?("function"==typeof i&&(n=i),"object"==typeof r&&(o=r)):("function"==typeof r&&(n=r),o={}),new t.Parser(o).parseString(e,n)},t.parseStringPromise=function(e,r){var i;return"object"==typeof r&&(i=r),new t.Parser(i).parseStringPromise(e)}}).call(this)},2114:function(e,t){(function(){"use strict";var e;e=new RegExp(/(?!xmlns)^.*:/),t.normalize=function(e){return e.toLowerCase()},t.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},t.stripPrefix=function(t){return t.replace(e,"")},t.parseNumbers=function(e){return isNaN(e)||(e=e%1==0?parseInt(e,10):parseFloat(e)),e},t.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e="true"===e.toLowerCase()),e}}).call(this)},8805:function(e,t,r){(function(){"use strict";var e,i,n,o,a={}.hasOwnProperty;i=r(6465),e=r(6712),n=r(1912),o=r(2114),t.defaults=i.defaults,t.processors=o,t.ValidationError=function(e){function t(e){this.message=e}return function(e,t){for(var r in t)a.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(t,Error),t}(),t.Builder=e.Builder,t.Parser=n.Parser,t.parseString=n.parseString,t.parseStringPromise=n.parseStringPromise}).call(this)},4923:function(e){(function(){e.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},1737:function(e){(function(){e.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},9241:function(e){(function(){var t,r,i,n,o,a,s,c=[].slice,u={}.hasOwnProperty;t=function(){var e,t,r,i,n,a;if(a=arguments[0],n=2<=arguments.length?c.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(e=0,r=n.length;e":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},e.prototype.isEqualNode=function(e){return e.namespaceURI===this.namespaceURI&&(e.prefix===this.prefix&&(e.localName===this.localName&&e.value===this.value))},e}()}).call(this)},2691:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;t=r(1737),i=r(7457),e.exports=function(e){function r(e,i){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(i)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return this.options.writer.cdata(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},7457:function(e,t,r){(function(){var t,i={}.hasOwnProperty;t=r(468),e.exports=function(e){function t(e){t.__super__.constructor.call(this,e),this.value=""}return function(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(t,e),Object.defineProperty(t.prototype,"data",{get:function(){return this.value},set:function(e){return this.value=e||""}}),Object.defineProperty(t.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(e){return this.value=e||""}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.substringData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.appendData=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.insertData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.deleteData=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.replaceData=function(e,t,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},t.prototype.isEqualNode=function(e){return!!t.__super__.isEqualNode.apply(this,arguments).isEqualNode(e)&&e.data===this.data},t}(t)}).call(this)},2679:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;t=r(1737),i=r(7457),e.exports=function(e){function r(e,i){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(i)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return this.options.writer.comment(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},3074:function(e,t,r){(function(){var t,i;t=r(5660),i=r(2527),e.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new t,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(e.prototype,"parameterNames",{get:function(){return new i(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(e){return this.params.hasOwnProperty(e)?this.params[e]:null},e.prototype.canSetParameter=function(e,t){return!0},e.prototype.setParameter=function(e,t){return null!=t?this.params[e]=t:delete this.params[e]},e}()}).call(this)},5660:function(e){(function(){e.exports=function(){function e(){}return e.prototype.handleError=function(e){throw new Error(e)},e}()}).call(this)},7260:function(e){(function(){e.exports=function(){function e(){}return e.prototype.hasFeature=function(e,t){return!0},e.prototype.createDocumentType=function(e,t,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(e,t,r){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(e){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(e,t){throw new Error("This DOM method is not implemented.")},e}()}).call(this)},2527:function(e){(function(){e.exports=function(){function e(e){this.arr=e||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(e){return this.arr[e]||null},e.prototype.contains=function(e){return-1!==this.arr.indexOf(e)},e}()}).call(this)},4111:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n,o,a,s){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==n)throw new Error("Missing DTD attribute name. "+this.debugInfo(i));if(!o)throw new Error("Missing DTD attribute type. "+this.debugInfo(i));if(!a)throw new Error("Missing DTD attribute default. "+this.debugInfo(i));if(0!==a.indexOf("#")&&(a="#"+a),!a.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(i));if(s&&!a.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(i));this.elementName=this.stringify.name(i),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(n),this.attributeType=this.stringify.dtdAttType(o),s&&(this.defaultValue=this.stringify.dtdAttDefault(s)),this.defaultValueType=a}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},7696:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD element name. "+this.debugInfo());n||(n="(#PCDATA)"),Array.isArray(n)&&(n="("+n.join(",")+")"),this.name=this.stringify.name(i),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(n)}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},5529:function(e,t,r){(function(){var t,i,n,o={}.hasOwnProperty;n=r(9241).isObject,i=r(468),t=r(1737),e.exports=function(e){function r(e,i,o,a){if(r.__super__.constructor.call(this,e),null==o)throw new Error("Missing DTD entity name. "+this.debugInfo(o));if(null==a)throw new Error("Missing DTD entity value. "+this.debugInfo(o));if(this.pe=!!i,this.name=this.stringify.name(o),this.type=t.EntityDeclaration,n(a)){if(!a.pubID&&!a.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(o));if(a.pubID&&!a.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(o));if(this.internal=!1,null!=a.pubID&&(this.pubID=this.stringify.dtdPubID(a.pubID)),null!=a.sysID&&(this.sysID=this.stringify.dtdSysID(a.sysID)),null!=a.nData&&(this.nData=this.stringify.dtdNData(a.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(o))}else this.value=this.stringify.dtdEntityValue(a),this.internal=!0}return function(e,t){for(var r in t)o.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(r.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(r.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlVersion",{get:function(){return null}}),r.prototype.toString=function(e){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},8012:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e,i,n){if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing DTD notation name. "+this.debugInfo(i));if(!n.pubID&&!n.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(i));this.name=this.stringify.name(i),this.type=t.NotationDeclaration,null!=n.pubID&&(this.pubID=this.stringify.dtdPubID(n.pubID)),null!=n.sysID&&(this.sysID=this.stringify.dtdSysID(n.sysID))}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),r.prototype.toString=function(e){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},4130:function(e,t,r){(function(){var t,i,n,o={}.hasOwnProperty;n=r(9241).isObject,i=r(468),t=r(1737),e.exports=function(e){function r(e,i,o,a){var s;r.__super__.constructor.call(this,e),n(i)&&(i=(s=i).version,o=s.encoding,a=s.standalone),i||(i="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(i),null!=o&&(this.encoding=this.stringify.xmlEncoding(o)),null!=a&&(this.standalone=this.stringify.xmlStandalone(a))}return function(e,t){for(var r in t)o.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.toString=function(e){return this.options.writer.declaration(this,this.options.writer.filterOptions(e))},r}(i)}).call(this)},6376:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l={}.hasOwnProperty;u=r(9241).isObject,c=r(468),t=r(1737),i=r(4111),o=r(5529),n=r(7696),a=r(8012),s=r(4797),e.exports=function(e){function r(e,i,n){var o,a,s,c,l,h;if(r.__super__.constructor.call(this,e),this.type=t.DocType,e.children)for(a=0,s=(c=e.children).length;a=0;)this.up();return this.onEnd()},e.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},e.prototype.openNode=function(e){var r,n,o,a;if(!e.isOpen){if(this.root||0!==this.currentLevel||e.type!==t.Element||(this.root=e),n="",e.type===t.Element){for(o in this.writerOptions.state=i.OpenTag,n=this.writer.indent(e,this.writerOptions,this.currentLevel)+"<"+e.name,a=e.attribs)I.call(a,o)&&(r=a[o],n+=this.writer.attribute(r,this.writerOptions,this.currentLevel));n+=(e.children?">":"/>")+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=i.InsideTag}else this.writerOptions.state=i.OpenTag,n=this.writer.indent(e,this.writerOptions,this.currentLevel)+""),n+=this.writer.endline(e,this.writerOptions,this.currentLevel);return this.onData(n,this.currentLevel),e.isOpen=!0}},e.prototype.closeNode=function(e){var r;if(!e.isClosed)return r="",this.writerOptions.state=i.CloseTag,r=e.type===t.Element?this.writer.indent(e,this.writerOptions,this.currentLevel)+""+this.writer.endline(e,this.writerOptions,this.currentLevel):this.writer.indent(e,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=i.None,this.onData(r,this.currentLevel),e.isClosed=!0},e.prototype.onData=function(e,t){return this.documentStarted=!0,this.onDataCallback(e,t+1)},e.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},e.prototype.debugInfo=function(e){return null==e?"":"node: <"+e+">"},e.prototype.ele=function(){return this.element.apply(this,arguments)},e.prototype.nod=function(e,t,r){return this.node(e,t,r)},e.prototype.txt=function(e){return this.text(e)},e.prototype.dat=function(e){return this.cdata(e)},e.prototype.com=function(e){return this.comment(e)},e.prototype.ins=function(e,t){return this.instruction(e,t)},e.prototype.dec=function(e,t,r){return this.declaration(e,t,r)},e.prototype.dtd=function(e,t,r){return this.doctype(e,t,r)},e.prototype.e=function(e,t,r){return this.element(e,t,r)},e.prototype.n=function(e,t,r){return this.node(e,t,r)},e.prototype.t=function(e){return this.text(e)},e.prototype.d=function(e){return this.cdata(e)},e.prototype.c=function(e){return this.comment(e)},e.prototype.r=function(e){return this.raw(e)},e.prototype.i=function(e,t){return this.instruction(e,t)},e.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.ent=function(e,t){return this.entity(e,t)},e.prototype.pent=function(e,t){return this.pEntity(e,t)},e.prototype.not=function(e,t){return this.notation(e,t)},e}()}).call(this)},1218:function(e,t,r){(function(){var t,i,n={}.hasOwnProperty;i=r(468),t=r(1737),e.exports=function(e){function r(e){r.__super__.constructor.call(this,e),this.type=t.Dummy}return function(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(e){return""},r}(i)}).call(this)},3906:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l={}.hasOwnProperty;u=r(9241),c=u.isObject,s=u.isFunction,a=u.getValue,o=r(468),t=r(1737),i=r(4238),n=r(4797),e.exports=function(e){function r(e,i,n){var o,a,s,c;if(r.__super__.constructor.call(this,e),null==i)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(i),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,null!=n&&this.attribute(n),e.type===t.Document&&(this.isRoot=!0,this.documentObject=e,e.rootObject=this,e.children))for(a=0,s=(c=e.children).length;a=n;t=0<=n?++i:--i)if(!this.attribs[t].isEqualNode(e.attribs[t]))return!1;return!0},r}(o)}).call(this)},4797:function(e){(function(){e.exports=function(){function e(e){this.nodes=e}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(e){return this.nodes[e]},e.prototype.setNamedItem=function(e){var t;return t=this.nodes[e.nodeName],this.nodes[e.nodeName]=e,t||null},e.prototype.removeNamedItem=function(e){var t;return t=this.nodes[e],delete this.nodes[e],t||null},e.prototype.item=function(e){return this.nodes[Object.keys(this.nodes)[e]]||null},e.prototype.getNamedItemNS=function(e,t){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(e){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(e,t){throw new Error("This DOM method is not implemented.")},e}()}).call(this)},468:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l,h,d,p,f,g,m,v,y,C={}.hasOwnProperty;y=r(9241),v=y.isObject,m=y.isFunction,g=y.isEmpty,f=y.getValue,u=null,n=null,o=null,a=null,s=null,d=null,p=null,h=null,c=null,i=null,l=null,t=null,e.exports=function(){function e(e){this.parent=e,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=r(3906),n=r(2691),o=r(2679),a=r(4130),s=r(6376),d=r(1268),p=r(2535),h=r(5915),c=r(1218),i=r(1737),l=r(6684),r(4797),t=r(4923))}return Object.defineProperty(e.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){var e;return e=this.parent.children.indexOf(this),this.parent.children[e-1]||null}}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){var e;return e=this.parent.children.indexOf(this),this.parent.children[e+1]||null}}),Object.defineProperty(e.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(e.prototype,"textContent",{get:function(){var e,t,r,n,o;if(this.nodeType===i.Element||this.nodeType===i.DocumentFragment){for(o="",t=0,r=(n=this.children).length;t":(null!=(r=this.parent)?r.name:void 0)?"node: <"+e+">, parent: <"+this.parent.name+">":"node: <"+e+">":""},e.prototype.ele=function(e,t,r){return this.element(e,t,r)},e.prototype.nod=function(e,t,r){return this.node(e,t,r)},e.prototype.txt=function(e){return this.text(e)},e.prototype.dat=function(e){return this.cdata(e)},e.prototype.com=function(e){return this.comment(e)},e.prototype.ins=function(e,t){return this.instruction(e,t)},e.prototype.doc=function(){return this.document()},e.prototype.dec=function(e,t,r){return this.declaration(e,t,r)},e.prototype.e=function(e,t,r){return this.element(e,t,r)},e.prototype.n=function(e,t,r){return this.node(e,t,r)},e.prototype.t=function(e){return this.text(e)},e.prototype.d=function(e){return this.cdata(e)},e.prototype.c=function(e){return this.comment(e)},e.prototype.r=function(e){return this.raw(e)},e.prototype.i=function(e,t){return this.instruction(e,t)},e.prototype.u=function(){return this.up()},e.prototype.importXMLBuilder=function(e){return this.importDocument(e)},e.prototype.replaceChild=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.removeChild=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendChild=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.hasChildNodes=function(){return 0!==this.children.length},e.prototype.cloneNode=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isSupported=function(e,t){return!0},e.prototype.hasAttributes=function(){return 0!==this.attribs.length},e.prototype.compareDocumentPosition=function(e){var r,i;return(r=this)===e?0:this.document()!==e.document()?(i=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?i|=t.Preceding:i|=t.Following,i):r.isAncestor(e)?t.Contains|t.Preceding:r.isDescendant(e)?t.Contains|t.Following:r.isPreceding(e)?t.Preceding:t.Following},e.prototype.isSameNode=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupPrefix=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isDefaultNamespace=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupNamespaceURI=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(e){var t,r,i;if(e.nodeType!==this.nodeType)return!1;if(e.children.length!==this.children.length)return!1;for(t=r=0,i=this.children.length-1;0<=i?r<=i:r>=i;t=0<=i?++r:--r)if(!this.children[t].isEqualNode(e.children[t]))return!1;return!0},e.prototype.getFeature=function(e,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setUserData=function(e,t,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getUserData=function(e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.contains=function(e){return!!e&&(e===this||this.isDescendant(e))},e.prototype.isDescendant=function(e){var t,r,i,n;for(r=0,i=(n=this.children).length;rr},e.prototype.treePosition=function(e){var t,r;return r=0,t=!1,this.foreachTreeNode(this.document(),(function(i){if(r++,!t&&i===e)return t=!0})),t?r:-1},e.prototype.foreachTreeNode=function(e,t){var r,i,n,o,a;for(e||(e=this.document()),i=0,n=(o=e.children).length;i0){for(this.stream.write(" ["),this.stream.write(this.endline(e,t,r)),t.state=i.InsideTag,o=0,a=(s=e.children).length;o"),this.stream.write(this.endline(e,t,r)),t.state=i.None,this.closeNode(e,t,r)},r.prototype.element=function(e,r,n){var a,s,c,u,l,h,d,p,f;for(d in n||(n=0),this.openNode(e,r,n),r.state=i.OpenTag,this.stream.write(this.indent(e,r,n)+"<"+e.name),p=e.attribs)o.call(p,d)&&(a=p[d],this.attribute(a,r,n));if(u=0===(c=e.children.length)?null:e.children[0],0===c||e.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))r.allowEmpty?(this.stream.write(">"),r.state=i.CloseTag,this.stream.write("")):(r.state=i.CloseTag,this.stream.write(r.spaceBeforeSlash+"/>"));else if(!r.pretty||1!==c||u.type!==t.Text&&u.type!==t.Raw||null==u.value){for(this.stream.write(">"+this.endline(e,r,n)),r.state=i.InsideTag,l=0,h=(f=e.children).length;l")}else this.stream.write(">"),r.state=i.InsideTag,r.suppressPrettyCount++,this.writeChildNode(u,r,n+1),r.suppressPrettyCount--,r.state=i.CloseTag,this.stream.write("");return this.stream.write(this.endline(e,r,n)),r.state=i.None,this.closeNode(e,r,n)},r.prototype.processingInstruction=function(e,t,i){return this.stream.write(r.__super__.processingInstruction.call(this,e,t,i))},r.prototype.raw=function(e,t,i){return this.stream.write(r.__super__.raw.call(this,e,t,i))},r.prototype.text=function(e,t,i){return this.stream.write(r.__super__.text.call(this,e,t,i))},r.prototype.dtdAttList=function(e,t,i){return this.stream.write(r.__super__.dtdAttList.call(this,e,t,i))},r.prototype.dtdElement=function(e,t,i){return this.stream.write(r.__super__.dtdElement.call(this,e,t,i))},r.prototype.dtdEntity=function(e,t,i){return this.stream.write(r.__super__.dtdEntity.call(this,e,t,i))},r.prototype.dtdNotation=function(e,t,i){return this.stream.write(r.__super__.dtdNotation.call(this,e,t,i))},r}(n)}).call(this)},382:function(e,t,r){(function(){var t,i={}.hasOwnProperty;t=r(6286),e.exports=function(e){function t(e){t.__super__.constructor.call(this,e)}return function(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(t,e),t.prototype.document=function(e,t){var r,i,n,o,a;for(t=this.filterOptions(t),o="",i=0,n=(a=e.children).length;i","]]]]>"),this.assertLegalChar(e))},e.prototype.comment=function(e){if(this.options.noValidation)return e;if((e=""+e||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+e);return this.assertLegalChar(e)},e.prototype.raw=function(e){return this.options.noValidation?e:""+e||""},e.prototype.attValue=function(e){return this.options.noValidation?e:this.assertLegalChar(this.attEscape(e=""+e||""))},e.prototype.insTarget=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.insValue=function(e){if(this.options.noValidation)return e;if((e=""+e||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+e);return this.assertLegalChar(e)},e.prototype.xmlVersion=function(e){if(this.options.noValidation)return e;if(!(e=""+e||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+e);return e},e.prototype.xmlEncoding=function(e){if(this.options.noValidation)return e;if(!(e=""+e||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+e);return this.assertLegalChar(e)},e.prototype.xmlStandalone=function(e){return this.options.noValidation?e:e?"yes":"no"},e.prototype.dtdPubID=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdSysID=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdElementValue=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdAttType=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdAttDefault=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdEntityValue=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.dtdNData=function(e){return this.options.noValidation?e:this.assertLegalChar(""+e||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(e){var t,r;if(this.options.noValidation)return e;if(t="","1.0"===this.options.version){if(t=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r=e.match(t))throw new Error("Invalid character in string: "+e+" at index "+r.index)}else if("1.1"===this.options.version&&(t=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r=e.match(t)))throw new Error("Invalid character in string: "+e+" at index "+r.index);return e},e.prototype.assertLegalName=function(e){var t;if(this.options.noValidation)return e;if(this.assertLegalChar(e),t=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!e.match(t))throw new Error("Invalid character in name");return e},e.prototype.textEscape=function(e){var t;return this.options.noValidation?e:(t=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(//g,">").replace(/\r/g," "))},e.prototype.attEscape=function(e){var t;return this.options.noValidation?e:(t=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(/0?new Array(i).join(t.indent):""},e.prototype.endline=function(e,t,r){return!t.pretty||t.suppressPrettyCount?"":t.newline},e.prototype.attribute=function(e,t,r){var i;return this.openAttribute(e,t,r),i=" "+e.name+'="'+e.value+'"',this.closeAttribute(e,t,r),i},e.prototype.cdata=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.comment=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"\x3c!-- ",t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=" --\x3e"+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.declaration=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"",n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.docType=function(e,t,r){var n,o,a,s,c;if(r||(r=0),this.openNode(e,t,r),t.state=i.OpenTag,s=this.indent(e,t,r),s+="0){for(s+=" [",s+=this.endline(e,t,r),t.state=i.InsideTag,o=0,a=(c=e.children).length;o",s+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),s},e.prototype.element=function(e,r,n){var a,s,c,u,l,h,d,p,f,g,m,v,y,C;for(f in n||(n=0),g=!1,m="",this.openNode(e,r,n),r.state=i.OpenTag,m+=this.indent(e,r,n)+"<"+e.name,v=e.attribs)o.call(v,f)&&(a=v[f],m+=this.attribute(a,r,n));if(u=0===(c=e.children.length)?null:e.children[0],0===c||e.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))r.allowEmpty?(m+=">",r.state=i.CloseTag,m+=""+this.endline(e,r,n)):(r.state=i.CloseTag,m+=r.spaceBeforeSlash+"/>"+this.endline(e,r,n));else if(!r.pretty||1!==c||u.type!==t.Text&&u.type!==t.Raw||null==u.value){if(r.dontPrettyTextNodes)for(l=0,d=(y=e.children).length;l"+this.endline(e,r,n),r.state=i.InsideTag,h=0,p=(C=e.children).length;h",g&&r.suppressPrettyCount--,m+=this.endline(e,r,n),r.state=i.None}else m+=">",r.state=i.InsideTag,r.suppressPrettyCount++,g=!0,m+=this.writeChildNode(u,r,n+1),r.suppressPrettyCount--,g=!1,r.state=i.CloseTag,m+=""+this.endline(e,r,n);return this.closeNode(e,r,n),m},e.prototype.writeChildNode=function(e,r,i){switch(e.type){case t.CData:return this.cdata(e,r,i);case t.Comment:return this.comment(e,r,i);case t.Element:return this.element(e,r,i);case t.Raw:return this.raw(e,r,i);case t.Text:return this.text(e,r,i);case t.ProcessingInstruction:return this.processingInstruction(e,r,i);case t.Dummy:return"";case t.Declaration:return this.declaration(e,r,i);case t.DocType:return this.docType(e,r,i);case t.AttributeDeclaration:return this.dtdAttList(e,r,i);case t.ElementDeclaration:return this.dtdElement(e,r,i);case t.EntityDeclaration:return this.dtdEntity(e,r,i);case t.NotationDeclaration:return this.dtdNotation(e,r,i);default:throw new Error("Unknown XML node type: "+e.constructor.name)}},e.prototype.processingInstruction=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+"",n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.raw=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r),t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.text=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r),t.state=i.InsideTag,n+=e.value,t.state=i.CloseTag,n+=this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdAttList=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdElement=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdEntity=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.dtdNotation=function(e,t,r){var n;return this.openNode(e,t,r),t.state=i.OpenTag,n=this.indent(e,t,r)+""+this.endline(e,t,r),t.state=i.None,this.closeNode(e,t,r),n},e.prototype.openNode=function(e,t,r){},e.prototype.closeNode=function(e,t,r){},e.prototype.openAttribute=function(e,t,r){},e.prototype.closeAttribute=function(e,t,r){},e}()}).call(this)},2046:function(e,t,r){(function(){var t,i,n,o,a,s,c,u,l,h;h=r(9241),u=h.assign,l=h.isFunction,n=r(7260),o=r(1933),a=r(400),c=r(382),s=r(6775),t=r(1737),i=r(8753),e.exports.create=function(e,t,r,i){var n,a;if(null==e)throw new Error("Root element needs a name.");return i=u({},t,r,i),a=(n=new o(i)).element(e),i.headless||(n.declaration(i),null==i.pubID&&null==i.sysID||n.dtd(i)),a},e.exports.begin=function(e,t,r){var i;return l(e)&&(t=(i=[e,t])[0],r=i[1],e={}),t?new a(e,t,r):new o(e)},e.exports.stringWriter=function(e){return new c(e)},e.exports.streamWriter=function(e,t){return new s(e,t)},e.exports.implementation=new n,e.exports.nodeType=t,e.exports.writerState=i}).call(this)},2613:e=>{"use strict";e.exports=require("assert")},181:e=>{"use strict";e.exports=require("buffer")},5317:e=>{"use strict";e.exports=require("child_process")},6982:e=>{"use strict";e.exports=require("crypto")},7194:e=>{"use strict";e.exports=require("dgram")},4434:e=>{"use strict";e.exports=require("events")},9896:e=>{"use strict";e.exports=require("fs")},8611:e=>{"use strict";e.exports=require("http")},5692:e=>{"use strict";e.exports=require("https")},9278:e=>{"use strict";e.exports=require("net")},857:e=>{"use strict";e.exports=require("os")},6928:e=>{"use strict";e.exports=require("path")},3785:e=>{"use strict";e.exports=require("readline")},2203:e=>{"use strict";e.exports=require("stream")},3193:e=>{"use strict";e.exports=require("string_decoder")},3557:e=>{"use strict";e.exports=require("timers")},2018:e=>{"use strict";e.exports=require("tty")},7016:e=>{"use strict";e.exports=require("url")},9023:e=>{"use strict";e.exports=require("util")},6094:(e,t,r)=>{var i,n=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0; /** * @license * Copyright 2009 The Closure Library Authors @@ -53,5 +51,5 @@ var i=r(181),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t, * * SPDX-License-Identifier: Apache-2.0 */ -var t=null;try{if(r(857).cpus().find((e=>cpus.model.toLowerCase().includes("armv6"))))throw new Error("Workaround for V8 crashing on ARMv6 platform when using WASM");t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function i(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var a={},s={};function c(e,t){var r,i,n;return t?(n=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(r=l(e,0,!0),n&&(s[e]=r),r):(n=-128<=(e|=0)&&e<128)&&(i=a[e])?i:(r=l(e,e<0?-1:0,!1),n&&(a[e]=r),r)}function u(e,t){if(isNaN(e))return t?C:y;if(t){if(e<0)return C;if(e>=m)return A}else{if(e<=-g)return I;if(e+1>=g)return T}return e<0?u(-e,t).neg():l(e%f|0,e/f|0,t)}function l(e,t,r){return new i(e,t,r)}i.fromInt=c,i.fromNumber=u,i.fromBits=l;var h=Math.pow;function d(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?C:y;if((r=r||10)<2||360)throw Error("interior hyphen");if(0===i)return d(e.substring(1),t,r).neg();for(var n=u(h(r,8)),o=y,a=0;a>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},D.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=s).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<=0},D.isOdd=function(){return!(1&~this.low)},D.isEven=function(){return!(1&this.low)},D.equals=function(e){return n(e)||(e=p(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},D.eq=D.equals,D.notEquals=function(e){return!this.eq(e)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(e){return this.comp(e)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(e){return this.comp(e)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(e){return this.comp(e)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(e){return this.comp(e)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(e){if(n(e)||(e=p(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(S)},D.neg=D.negate,D.add=function(e){n(e)||(e=p(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,a=e.high>>>16,s=65535&e.high,c=e.low>>>16,u=0,h=0,d=0,f=0;return d+=(f+=o+(65535&e.low))>>>16,h+=(d+=i+c)>>>16,u+=(h+=r+s)>>>16,u+=t+a,l((d&=65535)<<16|(f&=65535),(u&=65535)<<16|(h&=65535),this.unsigned)},D.subtract=function(e){return n(e)||(e=p(e)),this.add(e.neg())},D.sub=D.subtract,D.multiply=function(e){if(this.isZero())return this;if(n(e)||(e=p(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?C:y;if(this.eq(I))return e.isOdd()?I:y;if(e.eq(I))return this.isOdd()?I:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(v)&&e.lt(v))return u(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,s=e.high>>>16,c=65535&e.high,h=e.low>>>16,d=65535&e.low,f=0,m=0,g=0,S=0;return g+=(S+=a*d)>>>16,m+=(g+=o*d)>>>16,g&=65535,m+=(g+=a*h)>>>16,f+=(m+=i*d)>>>16,m&=65535,f+=(m+=o*h)>>>16,m&=65535,f+=(m+=a*c)>>>16,f+=r*d+i*h+o*c+a*s,l((g&=65535)<<16|(S&=65535),(f&=65535)<<16|(m&=65535),this.unsigned)},D.mul=D.multiply,D.divide=function(e){if(n(e)||(e=p(e)),e.isZero())throw Error("division by zero");var r,i,o;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?C:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return C;if(e.gt(this.shru(1)))return E;o=C}else{if(this.eq(I))return e.eq(S)||e.eq(_)?I:e.eq(I)?S:(r=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?S:_:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(I))return this.unsigned?C:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=y}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),s=a<=48?1:h(2,a-48),c=u(r),d=c.mul(e);d.isNegative()||d.gt(i);)d=(c=u(r-=s,this.unsigned)).mul(e);c.isZero()&&(c=S),o=o.add(c),i=i.sub(d)}return o},D.div=D.divide,D.modulo=function(e){return n(e)||(e=p(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return l(~this.low,~this.high,this.unsigned)},D.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},D.clz=D.countLeadingZeros,D.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},D.ctz=D.countTrailingZeros,D.and=function(e){return n(e)||(e=p(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},D.or=function(e){return n(e)||(e=p(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},D.xor=function(e){return n(e)||(e=p(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},D.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<>>32-e,this.unsigned):l(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):l(32===e?this.high:this.high>>>e-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.rotateLeft=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.low<>>t,this.high<>>t,this.unsigned)):(t=32-(e-=32),l(this.high<>>t,this.low<>>t,this.unsigned))},D.rotl=D.rotateLeft,D.rotateRight=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.high<>>e,this.low<>>e,this.unsigned)):(t=32-(e-=32),l(this.low<>>e,this.high<>>e,this.unsigned))},D.rotr=D.rotateRight,D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},D.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},D.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,r){return r?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var w=i;return e.default=w,"default"in e?e.default:e}({});void 0===(i=function(){return n}.apply(t,[]))||(e.exports=i)},26:(e,t)=>{var r,i=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(e,t,r){if(t=~~t,(r=r||e.length-t)===i.size)return i.decode(e,t,r);if(r===n.size)return n.decode(e,t,r);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${n.size} for v6.`)},e.encode=function(e,t,r){r=~~r;const a=o(e);"function"==typeof t&&(t=t(r+a));if(a===i.size)return i.encode(e,t,r);return n.encode(e,t,r)},e.familyOf=function(e){return o(e)===i.size?1:2},e.name=void 0,e.sizeOf=o,e.v6=e.v4=void 0;const t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i={name:"v4",size:4,isFormat:e=>t.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);const i=e.length;let n=0;for(let o=0;o(t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`)};e.v4=i;const n={name:"v6",size:16,isFormat:e=>e.length>0&&r.test(e),encode(e,t,r){let i=(r=~~r)+16,n=-1,o=0,a=0,s=!0,c=!1;t=t||new Uint8Array(r+16);for(let u=0;u>8),r=97?l-=87:l>=65?l-=55:(l-=48,a=10*a+l),o=(o<<4)+l)}if(!1===s)!0===c?(r>8),r=n+2;e--)t[e]=t[e-2];t[n]=0,t[n+1]=0,n=r}if(n!==r&&-1!==n)for(r>i-2&&(r=i-2);i>n;)t[--i]=rn?t[--r]:0;else for(;r{"use strict";var i=r(6578),n="undefined"==typeof globalThis?global:globalThis;e.exports=function(){for(var e=[],t=0;t{"use strict";var t=Symbol.iterator;e.exports=function(e){if(null!=e&&void 0!==e[t])return e[t]()}},1635:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__addDisposableResource:()=>B,__assign:()=>o,__asyncDelegator:()=>I,__asyncGenerator:()=>A,__asyncValues:()=>D,__await:()=>T,__awaiter:()=>f,__classPrivateFieldGet:()=>O,__classPrivateFieldIn:()=>P,__classPrivateFieldSet:()=>N,__createBinding:()=>g,__decorate:()=>s,__disposeResources:()=>x,__esDecorate:()=>u,__exportStar:()=>v,__extends:()=>n,__generator:()=>m,__importDefault:()=>R,__importStar:()=>U,__makeTemplateObject:()=>w,__metadata:()=>p,__param:()=>c,__propKey:()=>h,__read:()=>C,__rest:()=>a,__runInitializers:()=>l,__setFunctionName:()=>d,__spread:()=>S,__spreadArray:()=>_,__spreadArrays:()=>E,__values:()=>y,default:()=>M});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,i){t(r,i,e)}}function u(e,t,r,i,n,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=i.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?i.static?e:e.prototype:null,h=t||(l?Object.getOwnPropertyDescriptor(l,i.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var g=(0,r[p])("accessor"===c?{get:h.get,set:h.set}:h[u],f);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=a(g.get))&&(h.get=s),(s=a(g.set))&&(h.set=s),(s=a(g.init))&&n.unshift(s)}else(s=a(g))&&("field"===c?n.unshift(s):h[u]=s)}l&&Object.defineProperty(l,i.name,h),d=!0}function l(e,t,r){for(var i=arguments.length>2,n=0;n0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function S(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(r=n[e](t)).value instanceof T?Promise.resolve(r.value.v).then(c,u):l(o[0][2],r)}catch(e){l(o[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function I(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:T(e[i](t)),done:!1}:n?n(t):t}:n}}function D(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=y(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var b=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function U(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&g(t,e,r);return b(t,e),t}function R(e){return e&&e.__esModule?e:{default:e}}function O(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)}function N(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r}function P(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function B(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function x(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var i=e.stack.pop();try{var n=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(n).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const M={__extends:n,__assign:o,__rest:a,__decorate:s,__param:c,__metadata:p,__awaiter:f,__generator:m,__createBinding:g,__exportStar:v,__values:y,__read:C,__spread:S,__spreadArrays:E,__spreadArray:_,__await:T,__asyncGenerator:A,__asyncDelegator:I,__asyncValues:D,__makeTemplateObject:w,__importStar:U,__importDefault:R,__classPrivateFieldGet:O,__classPrivateFieldSet:N,__classPrivateFieldIn:P,__addDisposableResource:B,__disposeResources:x}},3325:e=>{"use strict";e.exports={rE:"1.2.0"}},5783:e=>{"use strict";e.exports=JSON.parse('[{"type":"a","child":[{"type":"(","child":[{"type":"y","child":[]},{"type":"v","child":[]}]}]}]')},8389:e=>{"use strict";e.exports=JSON.parse('{"name":"hap-nodejs","version":"0.12.1","description":"HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.","main":"dist/index.js","types":"dist/index.d.ts","maintainers":["Andreas Bauer "],"author":"Khaos Tian (https://tz.is/)","homepage":"https://github.com/homebridge/HAP-NodeJS","license":"Apache-2.0","scripts":{"clean":"rimraf dist && rimraf coverage","lint":"eslint \'src/**/*.{js,ts,json}\'","build":"rimraf dist && tsc && node .github/node-persist-ignore.js","prepublishOnly":"npm run build","postpublish":"npm run clean","test":"jest","test-coverage":"jest --coverage","start":"node dist/BridgedCore.js","docs":"typedoc","lint-docs":"typedoc --emit none --treatWarningsAsErrors"},"keywords":["hap-nodejs","hap","homekit","homekit-accessory-protocol","homekit-server","homekit-protocol","homekit-device","homekit-accessory","hap-server","homekit-support","siri"],"repository":{"type":"git","url":"git+https://github.com/homebridge/HAP-NodeJS.git"},"bugs":{"url":"https://github.com/homebridge/HAP-NodeJS/issues"},"engines":{"node":"^18 || ^20"},"files":["README.md","LICENSE","dist","@types"],"dependencies":{"@homebridge/ciao":"^1.2.0","@homebridge/dbus-native":"^0.6.0","bonjour-hap":"^3.7.2","debug":"^4.3.4","fast-srp-hap":"^2.0.4","futoin-hkdf":"^1.5.3","node-persist":"^0.0.11","source-map-support":"^0.5.21","tslib":"^2.6.2","tweetnacl":"^1.0.3"},"devDependencies":{"@types/debug":"^4.1.12","@types/escape-html":"^1.0.4","@types/jest":"^29.5.12","@types/node":"^10.17.60","@typescript-eslint/eslint-plugin":"^5.62.0","@typescript-eslint/parser":"^5.62.0","axios":"^1.6.8","commander":"^12.0.0","escape-html":"^1.0.3","eslint":"^8.57.0","http-parser-js":"^0.5.8","jest":"^29.7.0","rimraf":"^3.0.2","semver":"^7.6.2","simple-plist":"~1.1.1","ts-jest":"^29.1.2","ts-node":"^10.9.2","typedoc":"^0.25.13","typescript":"^4.9.5"}}')}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var i=r(5920);for(var n in i)this[n]=i[n];i.__esModule&&Object.defineProperty(this,"__esModule",{value:!0})})(); +var t=null;try{if(r(857).cpus().find((e=>cpus.model.toLowerCase().includes("armv6"))))throw new Error("Workaround for V8 crashing on ARMv6 platform when using WASM");t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function i(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var a={},s={};function c(e,t){var r,i,n;return t?(n=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(r=l(e,0,!0),n&&(s[e]=r),r):(n=-128<=(e|=0)&&e<128)&&(i=a[e])?i:(r=l(e,e<0?-1:0,!1),n&&(a[e]=r),r)}function u(e,t){if(isNaN(e))return t?C:y;if(t){if(e<0)return C;if(e>=g)return A}else{if(e<=-m)return I;if(e+1>=m)return T}return e<0?u(-e,t).neg():l(e%f|0,e/f|0,t)}function l(e,t,r){return new i(e,t,r)}i.fromInt=c,i.fromNumber=u,i.fromBits=l;var h=Math.pow;function d(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?C:y;if((r=r||10)<2||360)throw Error("interior hyphen");if(0===i)return d(e.substring(1),t,r).neg();for(var n=u(h(r,8)),o=y,a=0;a>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},D.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=s).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<=0},D.isOdd=function(){return!(1&~this.low)},D.isEven=function(){return!(1&this.low)},D.equals=function(e){return n(e)||(e=p(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},D.eq=D.equals,D.notEquals=function(e){return!this.eq(e)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(e){return this.comp(e)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(e){return this.comp(e)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(e){return this.comp(e)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(e){return this.comp(e)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(e){if(n(e)||(e=p(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(S)},D.neg=D.negate,D.add=function(e){n(e)||(e=p(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,a=e.high>>>16,s=65535&e.high,c=e.low>>>16,u=0,h=0,d=0,f=0;return d+=(f+=o+(65535&e.low))>>>16,h+=(d+=i+c)>>>16,u+=(h+=r+s)>>>16,u+=t+a,l((d&=65535)<<16|(f&=65535),(u&=65535)<<16|(h&=65535),this.unsigned)},D.subtract=function(e){return n(e)||(e=p(e)),this.add(e.neg())},D.sub=D.subtract,D.multiply=function(e){if(this.isZero())return this;if(n(e)||(e=p(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?C:y;if(this.eq(I))return e.isOdd()?I:y;if(e.eq(I))return this.isOdd()?I:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(v)&&e.lt(v))return u(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,s=e.high>>>16,c=65535&e.high,h=e.low>>>16,d=65535&e.low,f=0,g=0,m=0,S=0;return m+=(S+=a*d)>>>16,g+=(m+=o*d)>>>16,m&=65535,g+=(m+=a*h)>>>16,f+=(g+=i*d)>>>16,g&=65535,f+=(g+=o*h)>>>16,g&=65535,f+=(g+=a*c)>>>16,f+=r*d+i*h+o*c+a*s,l((m&=65535)<<16|(S&=65535),(f&=65535)<<16|(g&=65535),this.unsigned)},D.mul=D.multiply,D.divide=function(e){if(n(e)||(e=p(e)),e.isZero())throw Error("division by zero");var r,i,o;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?C:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return C;if(e.gt(this.shru(1)))return E;o=C}else{if(this.eq(I))return e.eq(S)||e.eq(_)?I:e.eq(I)?S:(r=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?S:_:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(I))return this.unsigned?C:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=y}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),s=a<=48?1:h(2,a-48),c=u(r),d=c.mul(e);d.isNegative()||d.gt(i);)d=(c=u(r-=s,this.unsigned)).mul(e);c.isZero()&&(c=S),o=o.add(c),i=i.sub(d)}return o},D.div=D.divide,D.modulo=function(e){return n(e)||(e=p(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return l(~this.low,~this.high,this.unsigned)},D.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},D.clz=D.countLeadingZeros,D.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},D.ctz=D.countTrailingZeros,D.and=function(e){return n(e)||(e=p(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},D.or=function(e){return n(e)||(e=p(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},D.xor=function(e){return n(e)||(e=p(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},D.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<>>32-e,this.unsigned):l(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):l(32===e?this.high:this.high>>>e-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.rotateLeft=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.low<>>t,this.high<>>t,this.unsigned)):(t=32-(e-=32),l(this.high<>>t,this.low<>>t,this.unsigned))},D.rotl=D.rotateLeft,D.rotateRight=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.high<>>e,this.low<>>e,this.unsigned)):(t=32-(e-=32),l(this.low<>>e,this.high<>>e,this.unsigned))},D.rotr=D.rotateRight,D.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},D.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},D.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,r){return r?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var w=i;return e.default=w,"default"in e?e.default:e}({});void 0===(i=function(){return n}.apply(t,[]))||(e.exports=i)},26:(e,t)=>{var r,i=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(e,t,r){if(t=~~t,(r=r||e.length-t)===i.size)return i.decode(e,t,r);if(r===n.size)return n.decode(e,t,r);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${n.size} for v6.`)},e.encode=function(e,t,r){r=~~r;const a=o(e);"function"==typeof t&&(t=t(r+a));if(a===i.size)return i.encode(e,t,r);return n.encode(e,t,r)},e.familyOf=function(e){return o(e)===i.size?1:2},e.name=void 0,e.sizeOf=o,e.v6=e.v4=void 0;const t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i={name:"v4",size:4,isFormat:e=>t.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);const i=e.length;let n=0;for(let o=0;o(t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`)};e.v4=i;const n={name:"v6",size:16,isFormat:e=>e.length>0&&r.test(e),encode(e,t,r){let i=(r=~~r)+16,n=-1,o=0,a=0,s=!0,c=!1;t=t||new Uint8Array(r+16);for(let u=0;u>8),r=97?l-=87:l>=65?l-=55:(l-=48,a=10*a+l),o=(o<<4)+l)}if(!1===s)!0===c?(r>8),r=n+2;e--)t[e]=t[e-2];t[n]=0,t[n+1]=0,n=r}if(n!==r&&-1!==n)for(r>i-2&&(r=i-2);i>n;)t[--i]=rn?t[--r]:0;else for(;r{"use strict";var i=r(6578),n="undefined"==typeof globalThis?global:globalThis;e.exports=function(){for(var e=[],t=0;t{"use strict";var t=Symbol.iterator;e.exports=function(e){if(null!=e&&void 0!==e[t])return e[t]()}},1635:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__addDisposableResource:()=>B,__assign:()=>o,__asyncDelegator:()=>I,__asyncGenerator:()=>A,__asyncValues:()=>D,__await:()=>T,__awaiter:()=>f,__classPrivateFieldGet:()=>O,__classPrivateFieldIn:()=>P,__classPrivateFieldSet:()=>N,__createBinding:()=>m,__decorate:()=>s,__disposeResources:()=>x,__esDecorate:()=>u,__exportStar:()=>v,__extends:()=>n,__generator:()=>g,__importDefault:()=>R,__importStar:()=>U,__makeTemplateObject:()=>w,__metadata:()=>p,__param:()=>c,__propKey:()=>h,__read:()=>C,__rest:()=>a,__runInitializers:()=>l,__setFunctionName:()=>d,__spread:()=>S,__spreadArray:()=>_,__spreadArrays:()=>E,__values:()=>y,default:()=>M});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,i){t(r,i,e)}}function u(e,t,r,i,n,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=i.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?i.static?e:e.prototype:null,h=t||(l?Object.getOwnPropertyDescriptor(l,i.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var m=(0,r[p])("accessor"===c?{get:h.get,set:h.set}:h[u],f);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(s=a(m.get))&&(h.get=s),(s=a(m.set))&&(h.set=s),(s=a(m.init))&&n.unshift(s)}else(s=a(m))&&("field"===c?n.unshift(s):h[u]=s)}l&&Object.defineProperty(l,i.name,h),d=!0}function l(e,t,r){for(var i=arguments.length>2,n=0;n0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function S(){for(var e=[],t=0;t1||s(e,t)}))},t&&(i[e]=t(i[e])))}function s(e,t){try{(r=n[e](t)).value instanceof T?Promise.resolve(r.value.v).then(c,u):l(o[0][2],r)}catch(e){l(o[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function I(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:T(e[i](t)),done:!1}:n?n(t):t}:n}}function D(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=y(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var b=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function U(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&m(t,e,r);return b(t,e),t}function R(e){return e&&e.__esModule?e:{default:e}}function O(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)}function N(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r}function P(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function B(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function x(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var i=e.stack.pop();try{var n=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(n).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const M={__extends:n,__assign:o,__rest:a,__decorate:s,__param:c,__metadata:p,__awaiter:f,__generator:g,__createBinding:m,__exportStar:v,__values:y,__read:C,__spread:S,__spreadArrays:E,__spreadArray:_,__await:T,__asyncGenerator:A,__asyncDelegator:I,__asyncValues:D,__makeTemplateObject:w,__importStar:U,__importDefault:R,__classPrivateFieldGet:O,__classPrivateFieldSet:N,__classPrivateFieldIn:P,__addDisposableResource:B,__disposeResources:x}},3325:e=>{"use strict";e.exports={rE:"1.2.0"}},5783:e=>{"use strict";e.exports=JSON.parse('[{"type":"a","child":[{"type":"(","child":[{"type":"y","child":[]},{"type":"v","child":[]}]}]}]')},8389:e=>{"use strict";e.exports=JSON.parse('{"name":"hap-nodejs","version":"0.12.2","description":"HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.","main":"dist/index.js","types":"dist/index.d.ts","maintainers":["Andreas Bauer "],"author":"Khaos Tian (https://tz.is/)","homepage":"https://github.com/homebridge/HAP-NodeJS","license":"Apache-2.0","scripts":{"clean":"rimraf dist && rimraf coverage","lint":"eslint \'src/**/*.{js,ts,json}\'","build":"rimraf dist && tsc && node .github/node-persist-ignore.js","prepublishOnly":"npm run build","postpublish":"npm run clean","test":"jest","test-coverage":"jest --coverage","start":"node dist/BridgedCore.js","docs":"typedoc","lint-docs":"typedoc --emit none --treatWarningsAsErrors"},"keywords":["hap-nodejs","hap","homekit","homekit-accessory-protocol","homekit-server","homekit-protocol","homekit-device","homekit-accessory","hap-server","homekit-support","siri"],"repository":{"type":"git","url":"git+https://github.com/homebridge/HAP-NodeJS.git"},"bugs":{"url":"https://github.com/homebridge/HAP-NodeJS/issues"},"engines":{"node":"^18 || ^20"},"files":["README.md","LICENSE","dist","@types"],"dependencies":{"@homebridge/ciao":"^1.2.0","@homebridge/dbus-native":"^0.6.0","bonjour-hap":"^3.7.2","debug":"^4.3.5","fast-srp-hap":"^2.0.4","futoin-hkdf":"^1.5.3","node-persist":"^0.0.12","source-map-support":"^0.5.21","tslib":"^2.6.2","tweetnacl":"^1.0.3"},"devDependencies":{"@types/debug":"^4.1.12","@types/escape-html":"^1.0.4","@types/jest":"^29.5.12","@types/node":"^20.13.0","@types/plist":"^3.0.5","@typescript-eslint/eslint-plugin":"^7.11.0","@typescript-eslint/parser":"^7.11.0","axios":"^1.7.2","commander":"^12.1.0","escape-html":"^1.0.3","eslint":"^8.57.0","http-parser-js":"^0.5.8","jest":"^29.7.0","rimraf":"^5.0.7","semver":"^7.6.2","simple-plist":"^1.4.0-0","ts-jest":"^29.1.4","ts-node":"^10.9.2","typedoc":"^0.25.13","typescript":"^5.4.5"}}')}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var i=r(5920);for(var n in i)this[n]=i[n];i.__esModule&&Object.defineProperty(this,"__esModule",{value:!0})})(); //# sourceMappingURL=homekit-bundle.js.map \ No newline at end of file diff --git a/lib/homekit/homekit-bundle.js.map b/lib/homekit/homekit-bundle.js.map index f68b3bf..f87858e 100644 --- a/lib/homekit/homekit-bundle.js.map +++ b/lib/homekit/homekit-bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"homekit-bundle.js","mappings":"wCACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQE,YAAcF,EAAQG,qBAAuBH,EAAQI,aAAeJ,EAAQK,aAAeL,EAAQM,iBAAc,EACzH,MAAMC,EAAU,EAAQ,MAElBC,EAAWD,EAAQE,gBAAgB,EAAQ,OAC3CC,EAAUH,EAAQE,gBAAgB,EAAQ,OAC1CE,EAAW,EAAQ,MACnBC,EAAQL,EAAQE,gBAAgB,EAAQ,OACxCI,EAAe,EAAQ,MACvBC,EAAY,EAAQ,MACpBC,EAAe,EAAQ,MACvBC,EAAc,EAAQ,KACtBC,EAAc,EAAQ,MACtBC,EAAc,EAAQ,MACtBC,EAAmB,EAAQ,MAC3BC,EAAU,EAAQ,MAClBC,EAAmB,EAAQ,MAC3BC,EAAc,EAAQ,MACtBC,EAAkBhB,EAAQiB,aAAa,EAAQ,OAC/CC,EAAqB,EAAQ,MAC7BC,GAAQ,EAAIhB,EAAQiB,SAAS,oBAC7BC,EAA6B,mBAC7BC,EAA0B,8BAMhC,IAAIvB,EAuBAD,EAWAD,EAuBAD,GAxDJ,SAAWG,GAEPA,EAAqB,QAAI,UACzBA,EAAqB,QAAI,UACzBA,EAAqB,QAAI,UACzBA,EAA4B,eAAI,iBAChCA,EAAkB,KAAI,OACtBA,EAAiB,IAAI,MACrBA,EAAqB,QAAI,UACzBA,EAAkB,KAAI,OACtBA,EAAsB,SAAI,WAC1BA,EAAiB,IAAI,MACrBA,EAAkB,KAAI,OACtBA,EAAkB,KAAI,OACtBA,EAAqB,QAAI,UACzBA,EAAwB,WAAI,aAC5BA,EAAoB,OAAI,SACxBA,EAAqB,QAAI,SAC5B,CAlBD,CAkBGA,IAAgBN,E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M,eACAf,kBACA69K,yBACAE,yBACAk1B,wBACAC,0BACAM,qB,4lEC/WEG,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB1tM,IAAjB2tM,EACH,OAAOA,EAAav0M,QAGrB,IAAIw5B,EAAS46K,EAAyBE,GAAY,CACjDh1L,GAAIg1L,EACJE,QAAQ,EACRx0M,QAAS,CAAC,GAUX,OANAy0M,EAAoBH,GAAUp3K,KAAK1D,EAAOx5B,QAASw5B,EAAQA,EAAOx5B,QAASq0M,GAG3E76K,EAAOg7K,QAAS,EAGTh7K,EAAOx5B,OACf,CCxBAq0M,EAAoB/vJ,EAAI,CAACtkD,EAASunB,KACjC,IAAI,IAAIjgB,KAAOigB,EACX8sL,EAAoBt4J,EAAEx0B,EAAYjgB,KAAS+sM,EAAoBt4J,EAAE/7C,EAASsH,IAC5ExH,OAAOC,eAAeC,EAASsH,EAAK,CAAEs/B,YAAY,EAAMtiC,IAAKijB,EAAWjgB,IAE1E,ECND+sM,EAAoBt4J,EAAI,CAACjhB,EAAK8gB,IAAU97C,OAAO09B,UAAUgF,eAAetF,KAAKpC,EAAK8gB,GCClFy4J,EAAoB9/J,EAAKv0C,IACH,oBAAXuhD,QAA0BA,OAAOi5F,aAC1C16I,OAAOC,eAAeC,EAASuhD,OAAOi5F,YAAa,CAAEv6I,MAAO,WAE7DH,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,GAAO,ECL9Do0M,EAAoBK,IAAOl7K,IAC1BA,EAAOm7K,MAAQ,GACVn7K,EAAOg4I,WAAUh4I,EAAOg4I,SAAW,IACjCh4I,GCAR,IAAIo7K,EAAsBP,EAAoB,M","sources":["webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/CiaoService.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/MDNSServer.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/NetworkManager.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/Responder.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/DNSLabelCoder.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/DNSPacket.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/Question.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/ResourceRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/dns-string-utils.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/AAAARecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/ARecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/CNAMERecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/NSECRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/OPTRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/PTRRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/SRVRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/TXTRecord.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/coder/records/index.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/index.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/responder/Announcer.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/responder/Prober.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/responder/QueryResponse.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/responder/QueuedResponse.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/responder/TruncatedQuery.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/dns-equal.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/domain-formatter.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/errors.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/promise-utils.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/sorted-array.js","webpack://c300x-controller/./node_modules/@homebridge/ciao/lib/util/tiebreaking.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/index.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/align.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/bus.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/constants.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/dbus-buffer.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/handshake.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/introspect.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/marshall.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/marshallers.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/message.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/readline.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/server-handshake.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/server.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/signature.js","webpack://c300x-controller/./node_modules/@homebridge/dbus-native/lib/stdifaces.js","webpack://c300x-controller/./node_modules/@homebridge/put/index.js","webpack://c300x-controller/./node_modules/array-buffer-byte-length/index.js","webpack://c300x-controller/./node_modules/array-flatten/array-flatten.js","webpack://c300x-controller/./node_modules/bonjour-hap/index.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/Browser.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/Prober.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/Registry.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/Server.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/Service.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/helpers.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/utils/dnsEqual.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/utils/network.js","webpack://c300x-controller/./node_modules/bonjour-hap/lib/utils/txtDecoder.js","webpack://c300x-controller/./node_modules/buffer-from/index.js","webpack://c300x-controller/./node_modules/call-bind/callBound.js","webpack://c300x-controller/./node_modules/call-bind/index.js","webpack://c300x-controller/./node_modules/debug/src/browser.js","webpack://c300x-controller/./node_modules/debug/src/common.js","webpack://c300x-controller/./node_modules/debug/src/index.js","webpack://c300x-controller/./node_modules/debug/src/node.js","webpack://c300x-controller/./node_modules/deep-equal/index.js","webpack://c300x-controller/./node_modules/define-data-property/index.js","webpack://c300x-controller/./node_modules/define-properties/index.js","webpack://c300x-controller/./node_modules/dns-packet/classes.js","webpack://c300x-controller/./node_modules/dns-packet/index.js","webpack://c300x-controller/./node_modules/dns-packet/opcodes.js","webpack://c300x-controller/./node_modules/dns-packet/optioncodes.js","webpack://c300x-controller/./node_modules/dns-packet/rcodes.js","webpack://c300x-controller/./node_modules/dns-packet/types.js","webpack://c300x-controller/./node_modules/duplexer/index.js","webpack://c300x-controller/./node_modules/es-define-property/index.js","webpack://c300x-controller/./node_modules/es-errors/eval.js","webpack://c300x-controller/./node_modules/es-errors/index.js","webpack://c300x-controller/./node_modules/es-errors/range.js","webpack://c300x-controller/./node_modules/es-errors/ref.js","webpack://c300x-controller/./node_modules/es-errors/syntax.js","webpack://c300x-controller/./node_modules/es-errors/type.js","webpack://c300x-controller/./node_modules/es-errors/uri.js","webpack://c300x-controller/./node_modules/event-stream/index.js","webpack://c300x-controller/./node_modules/fast-deep-equal/index.js","webpack://c300x-controller/./node_modules/fast-srp-hap/jsbn/jsbn.js","webpack://c300x-controller/./node_modules/fast-srp-hap/lib/params.js","webpack://c300x-controller/./node_modules/fast-srp-hap/lib/srp.js","webpack://c300x-controller/./node_modules/for-each/index.js","webpack://c300x-controller/./node_modules/from/index.js","webpack://c300x-controller/./node_modules/function-bind/implementation.js","webpack://c300x-controller/./node_modules/function-bind/index.js","webpack://c300x-controller/./node_modules/functions-have-names/index.js","webpack://c300x-controller/./node_modules/futoin-hkdf/hkdf.js","webpack://c300x-controller/./node_modules/get-intrinsic/index.js","webpack://c300x-controller/./node_modules/gopd/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/accessories/types.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/internal-types.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/Accessory.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/AccessoryLoader.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/Advertiser.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/Bridge.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/Characteristic.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/HAPServer.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/Service.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/camera/Camera.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/camera/RTPProxy.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/camera/RTPStreamManagement.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/camera/RecordingManagement.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/camera/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/CameraController.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/Controller.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/DoorbellController.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/RemoteController.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/controller/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/datastream/DataStreamManagement.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/datastream/DataStreamParser.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/datastream/DataStreamServer.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/datastream/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/definitions/index.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/model/AccessoryInfo.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/model/ControllerStorage.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/model/HAPStorage.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/model/IdentifierCache.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/tv/AccessControlManagement.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/clone.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/color-utils.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/eventedhttp.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/hapCrypto.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/hapStatusError.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/net-utils.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/once.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/promise-utils.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/request-util.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/time.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/tlv.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/util/uuid.js","webpack://c300x-controller/./node_modules/hap-nodejs/dist/lib/ sync","webpack://c300x-controller/./node_modules/hap-nodejs/dist/types.js","webpack://c300x-controller/./node_modules/has-bigints/index.js","webpack://c300x-controller/./node_modules/has-flag/index.js","webpack://c300x-controller/./node_modules/has-property-descriptors/index.js","webpack://c300x-controller/./node_modules/has-proto/index.js","webpack://c300x-controller/./node_modules/has-symbols/index.js","webpack://c300x-controller/./node_modules/has-symbols/shams.js","webpack://c300x-controller/./node_modules/has-tostringtag/shams.js","webpack://c300x-controller/./node_modules/hasown/index.js","webpack://c300x-controller/./node_modules/is-arguments/index.js","webpack://c300x-controller/./node_modules/is-array-buffer/index.js","webpack://c300x-controller/./node_modules/is-bigint/index.js","webpack://c300x-controller/./node_modules/is-boolean-object/index.js","webpack://c300x-controller/./node_modules/is-callable/index.js","webpack://c300x-controller/./node_modules/is-date-object/index.js","webpack://c300x-controller/./node_modules/is-map/index.js","webpack://c300x-controller/./node_modules/is-number-object/index.js","webpack://c300x-controller/./node_modules/is-regex/index.js","webpack://c300x-controller/./node_modules/is-set/index.js","webpack://c300x-controller/./node_modules/is-shared-array-buffer/index.js","webpack://c300x-controller/./node_modules/is-string/index.js","webpack://c300x-controller/./node_modules/is-symbol/index.js","webpack://c300x-controller/./node_modules/is-weakmap/index.js","webpack://c300x-controller/./node_modules/is-weakset/index.js","webpack://c300x-controller/./node_modules/isarray/index.js","webpack://c300x-controller/./node_modules/map-stream/index.js","webpack://c300x-controller/./node_modules/mkdirp/index.js","webpack://c300x-controller/./node_modules/ms/index.js","webpack://c300x-controller/./node_modules/multicast-dns-service-types/index.js","webpack://c300x-controller/./node_modules/multicast-dns/index.js","webpack://c300x-controller/./node_modules/node-persist/src/local-storage.js","webpack://c300x-controller/./node_modules/node-persist/src/node-persist.js","webpack://c300x-controller/./node_modules/object-inspect/index.js","webpack://c300x-controller/./node_modules/object-inspect/util.inspect.js","webpack://c300x-controller/./node_modules/object-is/implementation.js","webpack://c300x-controller/./node_modules/object-is/index.js","webpack://c300x-controller/./node_modules/object-is/polyfill.js","webpack://c300x-controller/./node_modules/object-is/shim.js","webpack://c300x-controller/./node_modules/object-keys/implementation.js","webpack://c300x-controller/./node_modules/object-keys/index.js","webpack://c300x-controller/./node_modules/object-keys/isArguments.js","webpack://c300x-controller/./node_modules/object.assign/implementation.js","webpack://c300x-controller/./node_modules/object.assign/index.js","webpack://c300x-controller/./node_modules/object.assign/polyfill.js","webpack://c300x-controller/./node_modules/object.assign/shim.js","webpack://c300x-controller/./node_modules/pause-stream/index.js","webpack://c300x-controller/./node_modules/pick-port/index.js","webpack://c300x-controller/./node_modules/pick-port/lib/tcp.js","webpack://c300x-controller/./node_modules/pick-port/lib/udp.js","webpack://c300x-controller/./node_modules/possible-typed-array-names/index.js","webpack://c300x-controller/./node_modules/q/q.js","webpack://c300x-controller/./node_modules/regexp.prototype.flags/implementation.js","webpack://c300x-controller/./node_modules/regexp.prototype.flags/index.js","webpack://c300x-controller/./node_modules/regexp.prototype.flags/polyfill.js","webpack://c300x-controller/./node_modules/regexp.prototype.flags/shim.js","webpack://c300x-controller/./node_modules/safe-buffer/index.js","webpack://c300x-controller/./node_modules/sax/lib/sax.js","webpack://c300x-controller/./node_modules/set-function-length/index.js","webpack://c300x-controller/./node_modules/set-function-name/index.js","webpack://c300x-controller/./node_modules/side-channel/index.js","webpack://c300x-controller/./node_modules/source-map-support/register.js","webpack://c300x-controller/./node_modules/source-map-support/source-map-support.js","webpack://c300x-controller/./node_modules/source-map/lib/array-set.js","webpack://c300x-controller/./node_modules/source-map/lib/base64-vlq.js","webpack://c300x-controller/./node_modules/source-map/lib/base64.js","webpack://c300x-controller/./node_modules/source-map/lib/binary-search.js","webpack://c300x-controller/./node_modules/source-map/lib/mapping-list.js","webpack://c300x-controller/./node_modules/source-map/lib/quick-sort.js","webpack://c300x-controller/./node_modules/source-map/lib/source-map-consumer.js","webpack://c300x-controller/./node_modules/source-map/lib/source-map-generator.js","webpack://c300x-controller/./node_modules/source-map/lib/source-node.js","webpack://c300x-controller/./node_modules/source-map/lib/util.js","webpack://c300x-controller/./node_modules/source-map/source-map.js","webpack://c300x-controller/./node_modules/split/index.js","webpack://c300x-controller/./node_modules/stream-combiner/index.js","webpack://c300x-controller/./node_modules/supports-color/index.js","webpack://c300x-controller/./node_modules/through/index.js","webpack://c300x-controller/./node_modules/thunky/index.js","webpack://c300x-controller/./bundles/ffmpeg.ts","webpack://c300x-controller/./bundles/homekit-camera.ts","webpack://c300x-controller/./bundles/homekit-logger.ts","webpack://c300x-controller/./bundles/homekit-manager.ts","webpack://c300x-controller/./node_modules/tweetnacl/nacl-fast.js","webpack://c300x-controller/./node_modules/which-boxed-primitive/index.js","webpack://c300x-controller/./node_modules/which-collection/index.js","webpack://c300x-controller/./node_modules/which-typed-array/index.js","webpack://c300x-controller/./node_modules/xml2js/lib/bom.js","webpack://c300x-controller/./node_modules/xml2js/lib/builder.js","webpack://c300x-controller/./node_modules/xml2js/lib/defaults.js","webpack://c300x-controller/./node_modules/xml2js/lib/parser.js","webpack://c300x-controller/./node_modules/xml2js/lib/processors.js","webpack://c300x-controller/./node_modules/xml2js/lib/xml2js.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/DocumentPosition.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/NodeType.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/Utility.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/WriterState.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLAttribute.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLCData.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLCharacterData.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLComment.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDOMConfiguration.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDOMImplementation.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDOMStringList.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDTDAttList.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDTDElement.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDTDEntity.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDTDNotation.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDeclaration.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDocType.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDocument.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDocumentCB.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLDummy.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLElement.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLNode.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLNodeList.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLRaw.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLStreamWriter.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLStringWriter.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLStringifier.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLText.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/XMLWriterBase.js","webpack://c300x-controller/./node_modules/xmlbuilder/lib/index.js","webpack://c300x-controller/external node-commonjs \"assert\"","webpack://c300x-controller/external node-commonjs \"buffer\"","webpack://c300x-controller/external node-commonjs \"child_process\"","webpack://c300x-controller/external node-commonjs \"crypto\"","webpack://c300x-controller/external node-commonjs \"dgram\"","webpack://c300x-controller/external node-commonjs \"events\"","webpack://c300x-controller/external node-commonjs \"fs\"","webpack://c300x-controller/external node-commonjs \"http\"","webpack://c300x-controller/external node-commonjs \"https\"","webpack://c300x-controller/external node-commonjs \"net\"","webpack://c300x-controller/external node-commonjs \"os\"","webpack://c300x-controller/external node-commonjs \"path\"","webpack://c300x-controller/external node-commonjs \"readline\"","webpack://c300x-controller/external node-commonjs \"stream\"","webpack://c300x-controller/external node-commonjs \"string_decoder\"","webpack://c300x-controller/external node-commonjs \"timers\"","webpack://c300x-controller/external node-commonjs \"tty\"","webpack://c300x-controller/external node-commonjs \"url\"","webpack://c300x-controller/external node-commonjs \"util\"","webpack://c300x-controller/./node_modules/@homebridge/long/umd/index.js","webpack://c300x-controller/./node_modules/@leichtgewicht/ip-codec/index.cjs","webpack://c300x-controller/./node_modules/available-typed-arrays/index.js","webpack://c300x-controller/./node_modules/es-get-iterator/node.js","webpack://c300x-controller/./node_modules/tslib/tslib.es6.mjs","webpack://c300x-controller/webpack/bootstrap","webpack://c300x-controller/webpack/runtime/define property getters","webpack://c300x-controller/webpack/runtime/hasOwnProperty shorthand","webpack://c300x-controller/webpack/runtime/make namespace object","webpack://c300x-controller/webpack/runtime/node module decorator","webpack://c300x-controller/webpack/startup"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CiaoService = exports.InternalServiceEvent = exports.ServiceEvent = exports.ServiceState = exports.ServiceType = void 0;\nconst tslib_1 = require(\"tslib\");\n/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst events_1 = require(\"events\");\nconst net_1 = tslib_1.__importDefault(require(\"net\"));\nconst AAAARecord_1 = require(\"./coder/records/AAAARecord\");\nconst ARecord_1 = require(\"./coder/records/ARecord\");\nconst NSECRecord_1 = require(\"./coder/records/NSECRecord\");\nconst PTRRecord_1 = require(\"./coder/records/PTRRecord\");\nconst SRVRecord_1 = require(\"./coder/records/SRVRecord\");\nconst TXTRecord_1 = require(\"./coder/records/TXTRecord\");\nconst ResourceRecord_1 = require(\"./coder/ResourceRecord\");\nconst index_1 = require(\"./index\");\nconst NetworkManager_1 = require(\"./NetworkManager\");\nconst dns_equal_1 = require(\"./util/dns-equal\");\nconst domainFormatter = tslib_1.__importStar(require(\"./util/domain-formatter\"));\nconst domain_formatter_1 = require(\"./util/domain-formatter\");\nconst debug = (0, debug_1.default)(\"ciao:CiaoService\");\nconst numberedServiceNamePattern = /^(.*) \\((\\d+)\\)$/; // matches a name lik \"My Service (2)\"\nconst numberedHostnamePattern = /^(.*)-\\((\\d+)\\)(\\.\\w{2,}.)$/; // matches a hostname like \"My-Computer-(2).local.\"\n/**\n * This enum defines some commonly used service types.\n * This is also referred to as service name (as of RFC 6763).\n * A service name must not be longer than 15 characters (RFC 6763 7.2).\n */\nvar ServiceType;\n(function (ServiceType) {\n // noinspection JSUnusedGlobalSymbols\n ServiceType[\"AIRDROP\"] = \"airdrop\";\n ServiceType[\"AIRPLAY\"] = \"airplay\";\n ServiceType[\"AIRPORT\"] = \"airport\";\n ServiceType[\"COMPANION_LINK\"] = \"companion-link\";\n ServiceType[\"DACP\"] = \"dacp\";\n ServiceType[\"HAP\"] = \"hap\";\n ServiceType[\"HOMEKIT\"] = \"homekit\";\n ServiceType[\"HTTP\"] = \"http\";\n ServiceType[\"HTTP_ALT\"] = \"http_alt\";\n ServiceType[\"IPP\"] = \"ipp\";\n ServiceType[\"IPPS\"] = \"ipps\";\n ServiceType[\"RAOP\"] = \"raop\";\n ServiceType[\"scanner\"] = \"scanner\";\n ServiceType[\"TOUCH_ABLE\"] = \"touch-able\";\n ServiceType[\"DNS_SD\"] = \"dns-sd\";\n ServiceType[\"PRINTER\"] = \"printer\";\n})(ServiceType || (exports.ServiceType = ServiceType = {}));\n/**\n * @private\n */\nvar ServiceState;\n(function (ServiceState) {\n ServiceState[\"UNANNOUNCED\"] = \"unannounced\";\n ServiceState[\"PROBING\"] = \"probing\";\n ServiceState[\"PROBED\"] = \"probed\";\n ServiceState[\"ANNOUNCING\"] = \"announcing\";\n ServiceState[\"ANNOUNCED\"] = \"announced\";\n})(ServiceState || (exports.ServiceState = ServiceState = {}));\n/**\n * Events thrown by a CiaoService\n */\nvar ServiceEvent;\n(function (ServiceEvent) {\n /**\n * Event is called when the Prober identifies that the name for the service is already used\n * and thus resolve the name conflict by adjusting the name (e.g. adding '(2)' to the name).\n * This change must be persisted and thus a listener must hook up to this event\n * in order for the name to be persisted.\n */\n ServiceEvent[\"NAME_CHANGED\"] = \"name-change\";\n /**\n * Event is called when the Prober identifies that the hostname for the service is already used\n * and thus resolve the name conflict by adjusting the hostname (e.g. adding '(2)' to the hostname).\n * The name change must be persisted. As the hostname is an optional parameter, it is derived\n * from the service name if not supplied.\n * If you supply a custom hostname (not automatically derived from the service name) you must\n * hook up a listener to this event in order for the hostname to be persisted.\n */\n ServiceEvent[\"HOSTNAME_CHANGED\"] = \"hostname-change\";\n})(ServiceEvent || (exports.ServiceEvent = ServiceEvent = {}));\n/**\n * Events thrown by a CiaoService, internal use only!\n * @private\n */\nvar InternalServiceEvent;\n(function (InternalServiceEvent) {\n InternalServiceEvent[\"PUBLISH\"] = \"publish\";\n InternalServiceEvent[\"UNPUBLISH\"] = \"unpublish\";\n InternalServiceEvent[\"REPUBLISH\"] = \"republish\";\n InternalServiceEvent[\"RECORD_UPDATE\"] = \"records-update\";\n InternalServiceEvent[\"RECORD_UPDATE_ON_INTERFACE\"] = \"records-update-interface\";\n})(InternalServiceEvent || (exports.InternalServiceEvent = InternalServiceEvent = {}));\n/**\n * The CiaoService class represents a service which can be advertised on the network.\n *\n * A service is identified by its fully qualified domain name (FQDN), which consist of\n * the service name, the service type, the protocol and the service domain (.local by default).\n *\n * The service defines a hostname and a port where the advertised service can be reached.\n *\n * Additionally, a TXT record can be published, which can contain information (in form of key-value pairs),\n * which might be useful to a querier.\n *\n * A CiaoService class is always bound to a {@link Responder} and can be created using the\n * {@link Responder.createService} method in the Responder class.\n * Once the instance is created, {@link advertise} can be called to announce the service on the network.\n */\nclass CiaoService extends events_1.EventEmitter {\n /**\n * Constructs a new service. Please use {@link Responder.createService} to create new service.\n * When calling the constructor a callee must listen to certain events in order to provide\n * correct functionality.\n * @private used by the Responder instance to create a new service\n */\n constructor(networkManager, options) {\n super();\n /**\n * this field is entirely controlled by the Responder class\n * @private use by the Responder to set the current service state\n */\n this.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n this.destroyed = false;\n (0, assert_1.default)(networkManager, \"networkManager is required\");\n (0, assert_1.default)(options, \"parameters options is required\");\n (0, assert_1.default)(options.name, \"service options parameter 'name' is required\");\n (0, assert_1.default)(options.type, \"service options parameter 'type' is required\");\n (0, assert_1.default)(options.type.length <= 15, \"service options parameter 'type' must not be longer than 15 characters\");\n this.networkManager = networkManager;\n this.name = options.name;\n this.type = options.type;\n this.subTypes = options.subtypes;\n this.protocol = options.protocol || \"tcp\" /* Protocol.TCP */;\n this.serviceDomain = options.domain || \"local\";\n this.fqdn = this.formatFQDN();\n this.loweredFqdn = (0, dns_equal_1.dnsLowerCase)(this.fqdn);\n this.typePTR = domainFormatter.stringify({\n type: this.type,\n protocol: this.protocol,\n domain: this.serviceDomain,\n });\n this.loweredTypePTR = (0, dns_equal_1.dnsLowerCase)(this.typePTR);\n if (this.subTypes) {\n this.subTypePTRs = this.subTypes.map(subtype => domainFormatter.stringify({\n subtype: subtype,\n type: this.type,\n protocol: this.protocol,\n domain: this.serviceDomain,\n })).map(dns_equal_1.dnsLowerCase);\n }\n this.hostname = domainFormatter.formatHostname(options.hostname || this.name, this.serviceDomain)\n .replace(/ /g, \"-\"); // replacing all spaces with dashes in the hostname\n this.loweredHostname = (0, dns_equal_1.dnsLowerCase)(this.hostname);\n this.port = options.port;\n if (options.restrictedAddresses) {\n (0, assert_1.default)(options.restrictedAddresses.length, \"The service property 'restrictedAddresses' cannot be an empty array!\");\n this.restrictedAddresses = new Map();\n for (const entry of options.restrictedAddresses) {\n if (net_1.default.isIP(entry)) {\n if (entry === \"0.0.0.0\" || entry === \"::\") {\n throw new Error(`[${this.fqdn}] Unspecified ip address (${entry}) cannot be used to restrict on to!`);\n }\n const interfaceName = NetworkManager_1.NetworkManager.resolveInterface(entry);\n if (!interfaceName) {\n throw new Error(`[${this.fqdn}] Could not restrict service to address ${entry} as we could not resolve it to an interface name!`);\n }\n const current = this.restrictedAddresses.get(interfaceName);\n if (current) {\n // empty interface signals \"catch all\" was already configured for this\n if (current.length && !current.includes(entry)) {\n current.push(entry);\n }\n }\n else {\n this.restrictedAddresses.set(interfaceName, [entry]);\n }\n }\n else {\n this.restrictedAddresses.set(entry, []); // empty array signals \"use all addresses for interface\"\n }\n }\n }\n this.disableIpv6 = options.disabledIpv6;\n this.txt = options.txt ? CiaoService.txtBuffersFromRecord(options.txt) : [];\n // checks if hostname or name are already numbered and adjusts the numbers if necessary\n this.incrementName(true);\n }\n /**\n * This method start the advertising process of the service:\n * - The service name (and hostname) will be probed unique on all interfaces (as defined in RFC 6762 8.1).\n * - Once probed unique the service will be announced (as defined in RFC 6762 8.3).\n *\n * The returned promise resolves once the last announcement packet was successfully sent on all network interfaces.\n * The promise might be rejected caused by one of the following reasons:\n * - A probe query could not be sent successfully\n * - Prober could not find a unique service name while trying for a minute (timeout)\n * - One of the announcement packets could not be sent successfully\n */\n advertise() {\n (0, assert_1.default)(!this.destroyed, \"Cannot publish destroyed service!\");\n (0, assert_1.default)(this.port, \"Service port must be defined before advertising the service on the network!\");\n if (this.listeners(\"name-change\" /* ServiceEvent.NAME_CHANGED */).length === 0) {\n debug(\"[%s] WARN: No listeners found for a potential name change on the 'name-change' event!\", this.name);\n }\n return new Promise((resolve, reject) => {\n this.emit(\"publish\" /* InternalServiceEvent.PUBLISH */, error => error ? reject(error) : resolve());\n });\n }\n /**\n * This method will remove the advertisement for the service on all connected network interfaces.\n * If the service is still in the Probing state, probing will simply be cancelled.\n *\n * @returns Promise will resolve once the last goodbye packet was sent out\n */\n end() {\n (0, assert_1.default)(!this.destroyed, \"Cannot end destroyed service!\");\n if (this.serviceState === \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n this.emit(\"unpublish\" /* InternalServiceEvent.UNPUBLISH */, error => error ? reject(error) : resolve());\n });\n }\n /**\n * This method must be called if you want to free the memory used by this service.\n * The service instance is not usable anymore after this call.\n *\n * If the service is still announced, the service will first be removed\n * from the network by calling {@link end}.\n *\n * @returns\n */\n async destroy() {\n await this.end();\n this.destroyed = true;\n this.removeAllListeners();\n }\n /**\n * @returns The fully qualified domain name of the service, used to identify the service.\n */\n getFQDN() {\n return this.fqdn;\n }\n /**\n * @returns The service type pointer.\n */\n getTypePTR() {\n return this.typePTR;\n }\n /**\n * @returns Array of subtype pointers (undefined if no subtypes are specified).\n */\n getLowerCasedSubtypePTRs() {\n return this.subTypePTRs;\n }\n /**\n * @returns The current hostname of the service.\n */\n getHostname() {\n return this.hostname;\n }\n /**\n * @returns The port the service is advertising for.\n * {@code -1} is returned when the port is not yet set.\n */\n getPort() {\n return this.port || -1;\n }\n /**\n * @returns The current TXT of the service represented as Buffer array.\n * @private There is not need for this to be public API\n */\n getTXT() {\n return this.txt;\n }\n /**\n * @private used for internal comparison {@link dnsLowerCase}\n */\n getLowerCasedFQDN() {\n return this.loweredFqdn;\n }\n /**\n * @private used for internal comparison {@link dnsLowerCase}\n */\n getLowerCasedTypePTR() {\n return this.loweredTypePTR;\n }\n /**\n * @private used for internal comparison {@link dnsLowerCase}\n */\n getLowerCasedHostname() {\n return this.loweredHostname;\n }\n /**\n * Sets or updates the txt of the service.\n *\n * @param {ServiceTxt} txt - The updated txt record.\n * @param {boolean} silent - If set to true no announcement is sent for the updated record.\n */\n updateTxt(txt, silent = false) {\n (0, assert_1.default)(!this.destroyed, \"Cannot update destroyed service!\");\n (0, assert_1.default)(txt, \"txt cannot be undefined\");\n this.txt = CiaoService.txtBuffersFromRecord(txt);\n debug(\"[%s] Updating txt record%s...\", this.name, silent ? \" silently\" : \"\");\n if (this.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n this.rebuildServiceRecords();\n if (silent) {\n return;\n }\n if (this.currentAnnouncer.hasSentLastAnnouncement()) {\n // if the announcer hasn't sent the last announcement, the above call of rebuildServiceRecords will\n // result in updated records on the next announcement. Otherwise, we still need to announce the updated records\n this.currentAnnouncer.awaitAnnouncement().then(() => {\n this.queueTxtUpdate();\n });\n }\n }\n else if (this.serviceState === \"announced\" /* ServiceState.ANNOUNCED */) {\n this.rebuildServiceRecords();\n if (silent) {\n return;\n }\n this.queueTxtUpdate();\n }\n }\n queueTxtUpdate() {\n if (this.txtTimer) {\n return;\n }\n else {\n // we debounce txt updates, otherwise if api users would spam txt updates, we would receive the txt record\n // while we already update our txt to the next call, thus causing a conflict being detected.\n // We would then continue with Probing (to ensure uniqueness) and could then receive following spammed updates as conflicts,\n // and we would change our name without it being necessary\n this.txtTimer = setTimeout(() => {\n this.txtTimer = undefined;\n if (this.serviceState !== \"announced\" /* ServiceState.ANNOUNCED */) { // stuff changed in the last 50 milliseconds\n return;\n }\n this.emit(\"records-update\" /* InternalServiceEvent.RECORD_UPDATE */, {\n answers: [this.txtRecord()],\n additionals: [this.serviceNSECRecord()],\n });\n }, 50);\n }\n }\n /**\n * Sets or updates the port of the service.\n * A new port number can only be set when the service is still UNANNOUNCED.\n * Otherwise, an assertion error will be thrown.\n *\n * @param {number} port - The new port number.\n */\n updatePort(port) {\n (0, assert_1.default)(this.serviceState === \"unannounced\" /* ServiceState.UNANNOUNCED */, \"Port number cannot be changed when service is already advertised!\");\n this.port = port;\n }\n /**\n * This method updates the name of the service.\n * @param name - The new service name.\n * @private Currently not public API and only used for bonjour conformance testing.\n */\n updateName(name) {\n if (this.serviceState === \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n this.name = name;\n this.fqdn = this.formatFQDN();\n this.loweredFqdn = (0, dns_equal_1.dnsLowerCase)(this.fqdn);\n return Promise.resolve();\n }\n else {\n return this.end() // send goodbye packets for the current name\n .then(() => {\n this.name = name;\n this.fqdn = this.formatFQDN();\n this.loweredFqdn = (0, dns_equal_1.dnsLowerCase)(this.fqdn);\n // service records are going to be rebuilt on the 'advertise' step\n return this.advertise();\n });\n }\n }\n static txtBuffersFromRecord(txt) {\n const result = [];\n Object.entries(txt).forEach(([key, value]) => {\n const entry = key + \"=\" + value;\n result.push(Buffer.from(entry));\n });\n return result;\n }\n /**\n * @param networkUpdate\n * @private\n */\n handleNetworkInterfaceUpdate(networkUpdate) {\n (0, assert_1.default)(!this.destroyed, \"Cannot update network of destroyed service!\");\n // this will currently only be called when service is ANNOUNCED or in ANNOUNCING state\n if (this.serviceState !== \"announced\" /* ServiceState.ANNOUNCED */) {\n if (this.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n this.rebuildServiceRecords();\n if (this.currentAnnouncer.hasSentLastAnnouncement()) {\n // if the announcer hasn't sent the last announcement, the above call of rebuildServiceRecords will\n // result in updated records on the next announcement. Otherwise, we still need to announce the updated records\n this.currentAnnouncer.awaitAnnouncement().then(() => {\n this.handleNetworkInterfaceUpdate(networkUpdate);\n });\n }\n }\n return; // service records are rebuilt short before the 'announce' step\n }\n // we don't care about removed interfaces. We can't send goodbye records on a non-existing interface\n this.rebuildServiceRecords();\n // records for a removed interface are now no longer present after the call above\n // records for a new interface got now built by the call above\n /* logic disabled for now\n if (networkUpdate.changes) {\n // we could optimize this and don't send the announcement of records if we have also added a new interface\n // Though probing will take at least 750 ms and thus sending it out immediately will get the information out faster.\n \n for (const change of networkUpdate.changes) {\n if (!this.advertisesOnInterface(change.name, true)) {\n continue;\n }\n \n let restrictedAddresses: IPAddress[] | undefined = this.restrictedAddresses? this.restrictedAddresses.get(change.name): undefined;\n if (restrictedAddresses && restrictedAddresses.length === 0) {\n restrictedAddresses = undefined;\n }\n const records: ResourceRecord[] = [];\n \n if (change.outdatedIpv4 && (!restrictedAddresses || restrictedAddresses.includes(change.outdatedIpv4))) {\n records.push(new ARecord(this.hostname, change.outdatedIpv4, true, 0));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.outdatedIpv4), this.hostname, false, 0));\n }\n if (change.outdatedIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.outdatedIpv6))) {\n records.push(new AAAARecord(this.hostname, change.outdatedIpv6, true, 0));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.outdatedIpv6), this.hostname, false, 0));\n }\n if (change.outdatedGloballyRoutableIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.outdatedGloballyRoutableIpv6))) {\n records.push(new AAAARecord(this.hostname, change.outdatedGloballyRoutableIpv6, true, 0));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.outdatedGloballyRoutableIpv6), this.hostname, false, 0));\n }\n if (change.outdatedUniqueLocalIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.outdatedUniqueLocalIpv6))) {\n records.push(new AAAARecord(this.hostname, change.outdatedUniqueLocalIpv6, true, 0));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.outdatedUniqueLocalIpv6), this.hostname, false, 0));\n }\n \n if (change.updatedIpv4 && (!restrictedAddresses || restrictedAddresses.includes(change.updatedIpv4))) {\n records.push(new ARecord(this.hostname, change.updatedIpv4, true));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.updatedIpv4), this.hostname));\n }\n if (change.updatedIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.updatedIpv6))) {\n records.push(new AAAARecord(this.hostname, change.updatedIpv6, true));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.updatedIpv6), this.hostname));\n }\n if (change.updatedGloballyRoutableIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.updatedGloballyRoutableIpv6))) {\n records.push(new AAAARecord(this.hostname, change.updatedGloballyRoutableIpv6, true));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.updatedGloballyRoutableIpv6), this.hostname));\n }\n if (change.updatedUniqueLocalIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(change.updatedUniqueLocalIpv6))) {\n records.push(new AAAARecord(this.hostname, change.updatedUniqueLocalIpv6, true));\n // records.push(new PTRRecord(formatReverseAddressPTRName(change.updatedUniqueLocalIpv6), this.hostname));\n }\n \n this.emit(InternalServiceEvent.RECORD_UPDATE_ON_INTERFACE, change.name, records);\n }\n }\n */\n if (networkUpdate.added || networkUpdate.changes) {\n // a new network interface got added. We must return into probing state,\n // as we don't know if we still own uniqueness for our service name on the new network.\n // To make things easy and keep the SAME name on all networks, we probe on ALL interfaces.\n // at this moment the new socket won't be bound. Though probing steps are delayed,\n // thus, when sending the first request, the socket will be bound, and we don't need to wait here\n this.emit(\"republish\" /* InternalServiceEvent.REPUBLISH */, error => {\n if (error) {\n console.log(\"FATAL Error occurred trying to re-announce service \" + this.fqdn + \"! We can't recover from this!\");\n console.log(error.stack);\n process.exit(1); // we have a service which should be announced, though we failed to re-announce.\n // if this should ever happen in reality, whe might want to introduce a more sophisticated recovery\n // for situations where it makes sense\n }\n });\n }\n }\n /**\n * This method is called by the Prober when encountering a conflict on the network.\n * It advises the service to change its name, like incrementing a number appended to the name.\n * So \"My Service\" will become \"My Service (2)\", and \"My Service (2)\" would become \"My Service (3)\"\n * @private must only be called by the {@link Prober}\n */\n incrementName(nameCheckOnly) {\n if (this.serviceState !== \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n throw new Error(\"Service name can only be incremented when in state UNANNOUNCED!\");\n }\n const oldName = this.name;\n const oldHostname = this.hostname;\n let nameBase;\n let nameNumber;\n let hostnameBase;\n let hostnameTLD;\n let hostnameNumber;\n const nameMatcher = this.name.match(numberedServiceNamePattern);\n if (nameMatcher) { // if it matched. Extract the current nameNumber\n nameBase = nameMatcher[1];\n nameNumber = parseInt(nameMatcher[2]);\n (0, assert_1.default)(nameNumber, `Failed to extract name number from ${this.name}. Resulted in ${nameNumber}`);\n }\n else {\n nameBase = this.name;\n nameNumber = 1;\n }\n const hostnameMatcher = this.hostname.match(numberedHostnamePattern);\n if (hostnameMatcher) { // if it matched. Extract the current nameNumber\n hostnameBase = hostnameMatcher[1];\n hostnameTLD = hostnameMatcher[3];\n hostnameNumber = parseInt(hostnameMatcher[2]);\n (0, assert_1.default)(hostnameNumber, `Failed to extract hostname number from ${this.hostname}. Resulted in ${hostnameNumber}`);\n }\n else {\n // we need to substring, to not match the root label \".\"\n const lastDot = this.hostname.substring(0, this.hostname.length - 1).lastIndexOf(\".\");\n hostnameBase = this.hostname.slice(0, lastDot);\n hostnameTLD = this.hostname.slice(lastDot);\n hostnameNumber = 1;\n }\n if (!nameCheckOnly) {\n // increment the numbers\n nameNumber++;\n hostnameNumber++;\n }\n const newNumber = Math.max(nameNumber, hostnameNumber);\n // reassemble the name\n this.name = newNumber === 1 ? nameBase : `${nameBase} (${newNumber})`;\n this.hostname = newNumber === 1 ? `${hostnameBase}${hostnameTLD}` : `${hostnameBase}-(${newNumber})${hostnameTLD}`;\n this.loweredHostname = (0, dns_equal_1.dnsLowerCase)(this.hostname);\n this.fqdn = this.formatFQDN(); // update the fqdn\n this.loweredFqdn = (0, dns_equal_1.dnsLowerCase)(this.fqdn);\n // we must inform the user that the names changed, so the new names can be persisted\n // This is done after the Probing finish, as multiple name changes could happen in one probing session\n // It is the responsibility of the Prober to call the informAboutNameUpdates function\n if (this.name !== oldName || this.hostname !== oldHostname) {\n debug(\"[%s] Service changed name '%s' -> '%s', '%s' -> '%s'\", this.name, oldName, this.name, oldHostname, this.hostname);\n }\n if (!nameCheckOnly) {\n this.rebuildServiceRecords(); // rebuild all services\n }\n }\n /**\n * @private called by the Prober once finished with probing to signal a (or more)\n * name change(s) happened {@see incrementName}.\n */\n informAboutNameUpdates() {\n // we trust the prober that this function is only called when the name was actually changed\n const nameCalled = this.emit(\"name-change\" /* ServiceEvent.NAME_CHANGED */, this.name);\n const hostnameCalled = this.emit(\"hostname-change\" /* ServiceEvent.HOSTNAME_CHANGED */, domainFormatter.removeTLD(this.hostname));\n // at least one event should be listened to. We can figure out the number from one or another\n if (!nameCalled && !hostnameCalled) {\n console.warn(`CIAO: [${this.name}] Service changed name but nobody was listening on the 'name-change' event!`);\n }\n }\n formatFQDN() {\n if (this.serviceState !== \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n throw new Error(\"Name can't be changed after service was already announced!\");\n }\n const fqdn = domainFormatter.stringify({\n name: this.name,\n type: this.type,\n protocol: this.protocol,\n domain: this.serviceDomain,\n });\n (0, assert_1.default)(fqdn.length <= 255, \"A fully qualified domain name cannot be longer than 255 characters\");\n return fqdn;\n }\n /**\n * @private called once the service data/state is updated and the records should be updated with the new data\n */\n rebuildServiceRecords() {\n (0, assert_1.default)(this.port, \"port must be set before building records\");\n debug(\"[%s] Rebuilding service records...\", this.name);\n const aRecordMap = {};\n const aaaaRecordMap = {};\n const aaaaRoutableRecordMap = {};\n const aaaaUniqueLocalRecordMap = {};\n const reverseAddressMap = {};\n let subtypePTRs = undefined;\n for (const [name, networkInterface] of this.networkManager.getInterfaceMap()) {\n if (!this.advertisesOnInterface(name, true)) {\n continue;\n }\n let restrictedAddresses = this.restrictedAddresses ? this.restrictedAddresses.get(name) : undefined;\n if (restrictedAddresses && restrictedAddresses.length === 0) {\n restrictedAddresses = undefined;\n }\n if (networkInterface.ipv4 && (!restrictedAddresses || restrictedAddresses.includes(networkInterface.ipv4))) {\n aRecordMap[name] = new ARecord_1.ARecord(this.hostname, networkInterface.ipv4, true);\n reverseAddressMap[networkInterface.ipv4] = new PTRRecord_1.PTRRecord((0, domain_formatter_1.formatReverseAddressPTRName)(networkInterface.ipv4), this.hostname);\n }\n if (networkInterface.ipv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(networkInterface.ipv6))) {\n aaaaRecordMap[name] = new AAAARecord_1.AAAARecord(this.hostname, networkInterface.ipv6, true);\n reverseAddressMap[networkInterface.ipv6] = new PTRRecord_1.PTRRecord((0, domain_formatter_1.formatReverseAddressPTRName)(networkInterface.ipv6), this.hostname);\n }\n if (networkInterface.globallyRoutableIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(networkInterface.globallyRoutableIpv6))) {\n aaaaRoutableRecordMap[name] = new AAAARecord_1.AAAARecord(this.hostname, networkInterface.globallyRoutableIpv6, true);\n reverseAddressMap[networkInterface.globallyRoutableIpv6] = new PTRRecord_1.PTRRecord((0, domain_formatter_1.formatReverseAddressPTRName)(networkInterface.globallyRoutableIpv6), this.hostname);\n }\n if (networkInterface.uniqueLocalIpv6 && !this.disableIpv6 && (!restrictedAddresses || restrictedAddresses.includes(networkInterface.uniqueLocalIpv6))) {\n aaaaUniqueLocalRecordMap[name] = new AAAARecord_1.AAAARecord(this.hostname, networkInterface.uniqueLocalIpv6, true);\n reverseAddressMap[networkInterface.uniqueLocalIpv6] = new PTRRecord_1.PTRRecord((0, domain_formatter_1.formatReverseAddressPTRName)(networkInterface.uniqueLocalIpv6), this.hostname);\n }\n }\n if (this.subTypePTRs) {\n subtypePTRs = [];\n for (const ptr of this.subTypePTRs) {\n subtypePTRs.push(new PTRRecord_1.PTRRecord(ptr, this.fqdn));\n }\n }\n this.serviceRecords = {\n ptr: new PTRRecord_1.PTRRecord(this.typePTR, this.fqdn),\n subtypePTRs: subtypePTRs, // possibly undefined\n metaQueryPtr: new PTRRecord_1.PTRRecord(index_1.Responder.SERVICE_TYPE_ENUMERATION_NAME, this.typePTR),\n srv: new SRVRecord_1.SRVRecord(this.fqdn, this.hostname, this.port, true),\n txt: new TXTRecord_1.TXTRecord(this.fqdn, this.txt, true),\n serviceNSEC: new NSECRecord_1.NSECRecord(this.fqdn, this.fqdn, [16 /* RType.TXT */, 33 /* RType.SRV */], 4500, true), // 4500 ttl of src and txt\n a: aRecordMap,\n aaaa: aaaaRecordMap,\n aaaaR: aaaaRoutableRecordMap,\n aaaaULA: aaaaUniqueLocalRecordMap,\n reverseAddressPTRs: reverseAddressMap,\n addressNSEC: new NSECRecord_1.NSECRecord(this.hostname, this.hostname, [1 /* RType.A */, 28 /* RType.AAAA */], 120, true), // 120 TTL of A and AAAA records\n };\n }\n /**\n * Returns if the given service is advertising on the provided network interface.\n *\n * @param name - The desired interface name.\n * @param skipAddressCheck - If true it is not checked if the service actually has\n * an address record for the given interface.\n * @private returns if the service should be advertised on the given service\n */\n advertisesOnInterface(name, skipAddressCheck) {\n var _a, _b, _c, _d;\n return !this.restrictedAddresses || this.restrictedAddresses.has(name) && (skipAddressCheck ||\n // must have at least one address record on the given interface\n !!((_a = this.serviceRecords) === null || _a === void 0 ? void 0 : _a.a[name]) || !!((_b = this.serviceRecords) === null || _b === void 0 ? void 0 : _b.aaaa[name])\n || !!((_c = this.serviceRecords) === null || _c === void 0 ? void 0 : _c.aaaaR[name]) || !!((_d = this.serviceRecords) === null || _d === void 0 ? void 0 : _d.aaaaULA[name]));\n }\n /**\n * @private used to get a copy of the main PTR record\n */\n ptrRecord() {\n return this.serviceRecords.ptr.clone();\n }\n /**\n * @private used to get a copy of the array of subtype PTR records\n */\n subtypePtrRecords() {\n return this.serviceRecords.subtypePTRs ? ResourceRecord_1.ResourceRecord.clone(this.serviceRecords.subtypePTRs) : [];\n }\n /**\n * @private used to get a copy of the meta-query PTR record\n */\n metaQueryPtrRecord() {\n return this.serviceRecords.metaQueryPtr.clone();\n }\n /**\n * @private used to get a copy of the SRV record\n */\n srvRecord() {\n return this.serviceRecords.srv.clone();\n }\n /**\n * @private used to get a copy of the TXT record\n */\n txtRecord() {\n return this.serviceRecords.txt.clone();\n }\n /**\n * @private used to get a copy of the A record\n */\n aRecord(name) {\n const record = this.serviceRecords.a[name];\n return record ? record.clone() : undefined;\n }\n /**\n * @private used to get a copy of the AAAA record for the link-local ipv6 address\n */\n aaaaRecord(name) {\n const record = this.serviceRecords.aaaa[name];\n return record ? record.clone() : undefined;\n }\n /**\n * @private used to get a copy of the AAAA record for the routable ipv6 address\n */\n aaaaRoutableRecord(name) {\n const record = this.serviceRecords.aaaaR[name];\n return record ? record.clone() : undefined;\n }\n /**\n * @private used to get a copy of the AAAA for the unique local ipv6 address\n */\n aaaaUniqueLocalRecord(name) {\n const record = this.serviceRecords.aaaaULA[name];\n return record ? record.clone() : undefined;\n }\n /**\n * @private used to get a copy of the A and AAAA records\n */\n allAddressRecords() {\n const records = [];\n Object.values(this.serviceRecords.a).forEach(record => {\n records.push(record.clone());\n });\n Object.values(this.serviceRecords.aaaa).forEach(record => {\n records.push(record.clone());\n });\n Object.values(this.serviceRecords.aaaaR).forEach(record => {\n records.push(record.clone());\n });\n Object.values(this.serviceRecords.aaaaULA).forEach(record => {\n records.push(record.clone());\n });\n return records;\n }\n /**\n * @private used to get a copy of the address NSEC record\n */\n addressNSECRecord() {\n return this.serviceRecords.addressNSEC.clone();\n }\n /**\n * @private user to get a copy of the service NSEC record\n */\n serviceNSECRecord(shortenTTL = false) {\n const record = this.serviceRecords.serviceNSEC.clone();\n if (shortenTTL) {\n record.ttl = 120;\n }\n return record;\n }\n /**\n * @param address - The IP address to check.\n * @private used to check if given address is exposed by this service\n */\n hasAddress(address) {\n return !!this.serviceRecords.reverseAddressPTRs[address];\n }\n}\nexports.CiaoService = CiaoService;\n//# sourceMappingURL=CiaoService.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MDNSServer = exports.SendResultFormatError = exports.SendResultFailedRatio = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst dgram_1 = tslib_1.__importDefault(require(\"dgram\"));\nconst DNSPacket_1 = require(\"./coder/DNSPacket\");\nconst NetworkManager_1 = require(\"./NetworkManager\");\nconst domain_formatter_1 = require(\"./util/domain-formatter\");\nconst errors_1 = require(\"./util/errors\");\nconst promise_utils_1 = require(\"./util/promise-utils\");\nconst debug = (0, debug_1.default)(\"ciao:MDNSServer\");\n/**\n * Returns the ration of rejected SendResults in the array.\n * A ratio of 0 indicates all sends were successful.\n * A ration of 1 indicates all sends failed.\n * A number in between signals that some of the sends failed.\n *\n * @param results - Array of {@link SendResult}\n */\nfunction SendResultFailedRatio(results) {\n if (results.length === 0) {\n return 0;\n }\n let failedCount = 0;\n for (const result of results) {\n if (result.status !== \"fulfilled\") {\n failedCount++;\n }\n }\n return failedCount / results.length;\n}\nexports.SendResultFailedRatio = SendResultFailedRatio;\nfunction SendResultFormatError(results, prefix, includeStack = false) {\n let failedCount = 0;\n for (const result of results) {\n if (result.status !== \"fulfilled\") {\n failedCount++;\n }\n }\n if (!prefix) {\n prefix = \"Failed to send packets\";\n }\n if (failedCount < results.length) {\n prefix += ` (${failedCount}/${results.length}):`;\n }\n else {\n prefix += \":\";\n }\n if (includeStack) {\n let string = \"=============================\\n\" + prefix;\n for (const result of results) {\n if (result.status === \"rejected\") {\n string += \"\\n--------------------\\n\" +\n \"Failed to send packet on interface \" + result.interface + \": \" + result.reason.stack;\n }\n else if (result.status === \"timeout\") {\n string += \"\\n--------------------\\n\" +\n \"Sending packet on interface \" + result.interface + \" timed out!\";\n }\n }\n string += \"\\n=============================\";\n return string;\n }\n else {\n let string = prefix;\n for (const result of results) {\n if (result.status === \"rejected\") {\n string += \"\\n- Failed to send packet on interface \" + result.interface + \": \" + result.reason.message;\n }\n else if (result.status === \"timeout\") {\n string += \"\\n- Sending packet on interface \" + result.interface + \" timed out!\";\n }\n }\n return string;\n }\n}\nexports.SendResultFormatError = SendResultFormatError;\n/**\n * This class can be used to create a mdns server to send and receive mdns packets on the local network.\n *\n * Currently only udp4 sockets will be advertised.\n */\nclass MDNSServer {\n constructor(handler, options) {\n this.sockets = new Map();\n this.sentPackets = new Map();\n // RFC 6762 15.1. If we are not the first responder bound to 5353 we can't receive unicast responses\n // thus the QU flag must not be used in queries. Responders are only affected when sending probe queries.\n // Probe queries should be sent with QU set, though can't be sent with QU when we can't receive unicast responses.\n this.suppressUnicastResponseFlag = false;\n this.bound = false;\n this.closed = false;\n (0, assert_1.default)(handler, \"handler cannot be undefined\");\n this.handler = handler;\n this.networkManager = new NetworkManager_1.NetworkManager({\n interface: options && options.interface,\n excludeIpv6: options && options.disableIpv6,\n excludeIpv6Only: true, // we currently have no udp6 sockets advertising anything, thus no need to manage interface which only have ipv6\n });\n this.networkManager.on(\"network-update\" /* NetworkManagerEvent.NETWORK_UPDATE */, this.handleUpdatedNetworkInterfaces.bind(this));\n }\n getNetworkManager() {\n return this.networkManager;\n }\n getBoundInterfaceNames() {\n return this.sockets.keys();\n }\n async bind() {\n if (this.closed) {\n throw new Error(\"Cannot rebind closed server!\");\n }\n // RFC 6762 15.1. suggest that we probe if we are not the only socket.\n // though as ciao will probably always be installed besides an existing mdns responder, we just assume that without probing\n // As it only affects probe queries, impact isn't that big.\n this.suppressUnicastResponseFlag = true;\n // wait for the first network interfaces to be discovered\n await this.networkManager.waitForInit();\n const promises = [];\n for (const [name, networkInterface] of this.networkManager.getInterfaceMap()) {\n const socket = this.createDgramSocket(name, true);\n const promise = this.bindSocket(socket, networkInterface, \"IPv4\" /* IPFamily.IPv4 */)\n .catch(reason => {\n // TODO if bind errors we probably will never bind again\n console.log(\"Could not bind detected network interface: \" + reason.stack);\n });\n promises.push(promise);\n }\n return Promise.all(promises).then(() => {\n this.bound = true;\n // map void[] to void\n });\n }\n shutdown() {\n this.networkManager.shutdown();\n for (const socket of this.sockets.values()) {\n socket.close();\n }\n this.bound = false;\n this.closed = true;\n this.sockets.clear();\n }\n sendQueryBroadcast(query, service) {\n const packets = DNSPacket_1.DNSPacket.createDNSQueryPackets(query);\n if (packets.length > 1) {\n debug(\"Query broadcast is split into %d packets!\", packets.length);\n }\n const promises = [];\n for (const packet of packets) {\n promises.push(this.sendOnAllNetworksForService(packet, service));\n }\n return Promise.all(promises).then((values) => {\n const results = [];\n for (const value of values) { // replace with .flat method when we have node >= 11.0.0 requirement\n results.concat(value);\n }\n return results;\n });\n }\n sendResponseBroadcast(response, service) {\n const packet = DNSPacket_1.DNSPacket.createDNSResponsePacketsFromRRSet(response);\n return this.sendOnAllNetworksForService(packet, service);\n }\n sendResponse(response, endpointOrInterface, callback) {\n this.send(response, endpointOrInterface).then(result => {\n if (result.status === \"rejected\") {\n if (callback) {\n callback(new Error(\"Encountered socket error on \" + result.reason.name + \": \" + result.reason.message));\n }\n else {\n MDNSServer.logSocketError(result.interface, result.reason);\n }\n }\n else if (callback) {\n callback();\n }\n });\n }\n sendOnAllNetworksForService(packet, service) {\n this.checkUnicastResponseFlag(packet);\n const message = packet.encode();\n this.assertBeforeSend(message, \"IPv4\" /* IPFamily.IPv4 */);\n const promises = [];\n for (const [name, socket] of this.sockets) {\n if (!service.advertisesOnInterface(name)) {\n // I don't like the fact that we put the check inside the MDNSServer, as it should be independent of the above layer.\n // Though I think this is currently the easiest approach.\n continue;\n }\n const promise = new Promise(resolve => {\n socket.send(message, MDNSServer.MDNS_PORT, MDNSServer.MULTICAST_IPV4, error => {\n if (error) {\n if (!MDNSServer.isSilencedSocketError(error)) {\n resolve({\n status: \"rejected\",\n interface: name,\n reason: error,\n });\n return;\n }\n }\n else {\n this.maintainSentPacketsInterface(name, message);\n }\n resolve({\n status: \"fulfilled\",\n interface: name,\n });\n });\n });\n promises.push(Promise.race([\n promise,\n (0, promise_utils_1.PromiseTimeout)(MDNSServer.SEND_TIMEOUT).then(() => ({\n status: \"timeout\",\n interface: name,\n })),\n ]));\n }\n return Promise.all(promises);\n }\n send(packet, endpointOrInterface) {\n this.checkUnicastResponseFlag(packet);\n const message = packet.encode();\n this.assertBeforeSend(message, \"IPv4\" /* IPFamily.IPv4 */);\n let address;\n let port;\n let name;\n if (typeof endpointOrInterface === \"string\") { // it's a network interface name\n address = MDNSServer.MULTICAST_IPV4;\n port = MDNSServer.MDNS_PORT;\n name = endpointOrInterface;\n }\n else {\n address = endpointOrInterface.address;\n port = endpointOrInterface.port;\n name = endpointOrInterface.interface;\n }\n const socket = this.sockets.get(name);\n if (!socket) {\n throw new errors_1.InterfaceNotFoundError(`Could not find socket for given network interface '${name}'`);\n }\n return new Promise(resolve => {\n socket.send(message, port, address, error => {\n if (error) {\n if (!MDNSServer.isSilencedSocketError(error)) {\n resolve({\n status: \"rejected\",\n interface: name,\n reason: error,\n });\n return;\n }\n }\n else {\n this.maintainSentPacketsInterface(name, message);\n }\n resolve({\n status: \"fulfilled\",\n interface: name,\n });\n });\n });\n }\n checkUnicastResponseFlag(packet) {\n if (this.suppressUnicastResponseFlag && packet.type === 0 /* PacketType.QUERY */) {\n packet.questions.forEach(record => record.unicastResponseFlag = false);\n }\n }\n assertBeforeSend(message, family) {\n if (this.closed) {\n throw new errors_1.ServerClosedError(\"Cannot send packets on a closed mdns server!\");\n }\n (0, assert_1.default)(this.bound, \"Cannot send packets before server is not bound!\");\n const ipHeaderSize = family === \"IPv4\" /* IPFamily.IPv4 */ ? MDNSServer.DEFAULT_IP4_HEADER : MDNSServer.DEFAULT_IP6_HEADER;\n // RFC 6762 17.\n (0, assert_1.default)(ipHeaderSize + MDNSServer.UDP_HEADER + message.length <= 9000, \"DNS cannot exceed the size of 9000 bytes even with IP Fragmentation!\");\n }\n maintainSentPacketsInterface(name, packet) {\n const base64 = packet.toString(\"base64\");\n const packets = this.sentPackets.get(name);\n if (!packets) {\n this.sentPackets.set(name, [base64]);\n }\n else {\n packets.push(base64);\n }\n }\n checkIfPacketWasPreviouslySentFromUs(name, packet) {\n const base64 = packet.toString(\"base64\");\n const packets = this.sentPackets.get(name);\n if (packets) {\n const index = packets.indexOf(base64);\n if (index !== -1) {\n packets.splice(index, 1);\n return true;\n }\n }\n return false;\n }\n createDgramSocket(name, reuseAddr = false, type = \"udp4\") {\n const socket = dgram_1.default.createSocket({\n type: type,\n reuseAddr: reuseAddr,\n });\n socket.on(\"message\", this.handleMessage.bind(this, name));\n socket.on(\"error\", error => {\n if (!MDNSServer.isSilencedSocketError(error)) {\n MDNSServer.logSocketError(name, error);\n }\n });\n return socket;\n }\n bindSocket(socket, networkInterface, family) {\n return new Promise((resolve, reject) => {\n const errorHandler = (error) => reject(new Error(\"Failed to bind on interface \" + networkInterface.name + \": \" + error.message));\n socket.once(\"error\", errorHandler);\n socket.on(\"close\", () => {\n this.sockets.delete(networkInterface.name);\n });\n socket.bind(MDNSServer.MDNS_PORT, () => {\n socket.setRecvBufferSize(800 * 1024); // setting max recv buffer size to 800KiB (Pi will max out at 352KiB)\n socket.removeListener(\"error\", errorHandler);\n const multicastAddress = family === \"IPv4\" /* IPFamily.IPv4 */ ? MDNSServer.MULTICAST_IPV4 : MDNSServer.MULTICAST_IPV6;\n const interfaceAddress = family === \"IPv4\" /* IPFamily.IPv4 */ ? networkInterface.ipv4 : networkInterface.ipv6;\n (0, assert_1.default)(interfaceAddress, \"Interface address for \" + networkInterface.name + \" cannot be undefined!\");\n try {\n socket.addMembership(multicastAddress, interfaceAddress);\n socket.setMulticastInterface(interfaceAddress);\n socket.setMulticastTTL(MDNSServer.MDNS_TTL); // outgoing multicast datagrams\n socket.setTTL(MDNSServer.MDNS_TTL); // outgoing unicast datagrams\n socket.setMulticastLoopback(true); // We can't disable multicast loopback, as otherwise queriers on the same host won't receive our packets\n this.sockets.set(networkInterface.name, socket);\n resolve();\n }\n catch (error) {\n try {\n socket.close();\n }\n catch (error) {\n debug(\"Error while closing socket which failed to bind. Error may be expected: \" + error.message);\n }\n reject(new Error(\"Error binding socket on \" + networkInterface.name + \": \" + error.stack));\n }\n });\n });\n }\n handleMessage(name, buffer, rinfo) {\n if (!this.bound) {\n return;\n }\n const networkInterface = this.networkManager.getInterface(name);\n if (!networkInterface) {\n debug(\"Received packet on non existing network interface: %s!\", name);\n return;\n }\n if (this.checkIfPacketWasPreviouslySentFromUs(networkInterface.name, buffer)) {\n // multicastLoopback is enabled for every interface, meaning we would receive our own response\n // packets here. Thus, we silence them. We can't disable multicast loopback, as otherwise\n // queriers on the same host won't receive our packets\n return;\n }\n const ip4Netaddress = (0, domain_formatter_1.getNetAddress)(rinfo.address, networkInterface.ip4Netmask);\n // We have the following problem on linux based platforms:\n // When setting up a socket like above (binding on 0.0.0.0:5353) and then adding membership for 224.0.0.251 for\n // A CERTAIN! interface, we will nonetheless receive packets from ALL other interfaces even the loopback interfaces.\n // This is not the case on platforms like e.g. macOS. There stuff is properly filtered, and we only receive packets\n // for the given interface we specified in our membership.\n // This has the problem, that when receiving packets from other interfaces, that we leak addresses which don't\n // exist on the given interface. We can't do much about it, as in typically multiple subnet networks, it is valid\n // that we receive a packet from an ip address which doesn't belong into the subnet of our given interface.\n // What we can do at least, is the following two things:\n // * if we are listening on the loopback interface, we filter out any traffic which doesn't belong to the loopback interface\n // * if we receive a packet from the loopback interface, we filter those out as well.\n // With that we at least ensure that the loopback address is never sent out to the network.\n // This is what we do below:\n if (networkInterface.loopback) {\n if (ip4Netaddress !== networkInterface.ipv4Netaddress) {\n return;\n }\n }\n else if (this.networkManager.isLoopbackNetaddressV4(ip4Netaddress)) {\n debug(\"Received packet on interface '%s' which is not coming from the same subnet: %o\", name, { address: rinfo.address, netaddress: ip4Netaddress, interface: networkInterface.ipv4 });\n return;\n }\n let packet;\n try {\n packet = DNSPacket_1.DNSPacket.decode(rinfo, buffer);\n }\n catch (error) {\n debug(\"Received a malformed packet from %o on interface %s. This might or might not be a problem. \" +\n \"Here is the received packet for debugging purposes '%s'. \" +\n \"Packet decoding failed with %s\", rinfo, name, buffer.toString(\"base64\"), error.stack);\n return;\n }\n if (packet.opcode !== 0 /* OpCode.QUERY */) {\n // RFC 6762 18.3 we MUST ignore messages with opcodes other than zero (QUERY)\n return;\n }\n if (packet.rcode !== 0 /* RCode.NoError */) {\n // RFC 6762 18.3 we MUST ignore messages with response code other than zero (NoError)\n return;\n }\n const endpoint = {\n address: rinfo.address,\n port: rinfo.port,\n interface: name,\n };\n if (packet.type === 0 /* PacketType.QUERY */) {\n try {\n this.handler.handleQuery(packet, endpoint);\n }\n catch (error) {\n console.warn(\"Error occurred handling incoming (on \" + name + \") dns query packet: \" + error.stack);\n }\n }\n else if (packet.type === 1 /* PacketType.RESPONSE */) {\n if (rinfo.port !== MDNSServer.MDNS_PORT) {\n // RFC 6762 6. Multicast DNS implementations MUST silently ignore any Multicast DNS responses\n // they receive where the source UDP port is not 5353.\n return;\n }\n try {\n this.handler.handleResponse(packet, endpoint);\n }\n catch (error) {\n console.warn(\"Error occurred handling incoming (on \" + name + \") dns response packet: \" + error.stack);\n }\n }\n }\n static isSilencedSocketError(error) {\n // silence those errors\n // they happen when the host is not reachable (EADDRNOTAVAIL for 224.0.0.251 or EHOSTDOWN for any unicast traffic)\n // caused by yet undetected network changes.\n // as we listen to 0.0.0.0 and the socket stays valid, this is not a problem\n const silenced = error.message.includes(\"EADDRNOTAVAIL\") || error.message.includes(\"EHOSTDOWN\")\n || error.message.includes(\"ENETUNREACH\") || error.message.includes(\"EHOSTUNREACH\")\n || error.message.includes(\"EPERM\") || error.message.includes(\"EINVAL\");\n if (silenced) {\n debug(\"Silenced and ignored error (This is/should not be a problem, this message is only for informational purposes): \" + error.message);\n }\n return silenced;\n }\n static logSocketError(name, error) {\n console.warn(`Encountered MDNS socket error on socket '${name}' : ${error.stack}`);\n return;\n }\n handleUpdatedNetworkInterfaces(networkUpdate) {\n if (networkUpdate.removed) {\n for (const networkInterface of networkUpdate.removed) {\n const socket = this.sockets.get(networkInterface.name);\n this.sockets.delete(networkInterface.name);\n if (socket) {\n socket.close();\n }\n }\n }\n if (networkUpdate.changes) {\n for (const change of networkUpdate.changes) {\n const socket = this.sockets.get(change.name);\n (0, assert_1.default)(socket, \"Couldn't find socket for network change!\");\n if (!change.outdatedIpv4 && change.updatedIpv4) {\n // this does currently not happen, as we exclude ipv6 only interfaces\n // thus such a change would be happening through the ADDED array\n assert_1.default.fail(\"Reached illegal state! IPv4 address changed from undefined to defined!\");\n }\n else if (change.outdatedIpv4 && !change.updatedIpv4) {\n // this does currently not happen, as we exclude ipv6 only interfaces\n // thus such a change would be happening through the REMOVED array\n assert_1.default.fail(\"Reached illegal state! IPV4 address change from defined to undefined!\");\n }\n else if (change.outdatedIpv4 && change.updatedIpv4) {\n try {\n socket.dropMembership(MDNSServer.MULTICAST_IPV4, change.outdatedIpv4);\n }\n catch (error) {\n debug(\"Thrown expected error when dropping outdated address membership: \" + error.message);\n }\n try {\n socket.addMembership(MDNSServer.MULTICAST_IPV4, change.updatedIpv4);\n }\n catch (error) {\n debug(\"Thrown expected error when adding new address membership: \" + error.message);\n }\n socket.setMulticastInterface(change.updatedIpv4);\n }\n }\n }\n if (networkUpdate.added) {\n for (const networkInterface of networkUpdate.added) {\n const socket = this.createDgramSocket(networkInterface.name, true);\n this.bindSocket(socket, networkInterface, \"IPv4\" /* IPFamily.IPv4 */).catch(reason => {\n // TODO if bind errors we probably will never bind again\n console.log(\"Could not bind detected network interface: \" + reason.stack);\n });\n }\n }\n }\n}\nexports.MDNSServer = MDNSServer;\nMDNSServer.DEFAULT_IP4_HEADER = 20;\nMDNSServer.DEFAULT_IP6_HEADER = 40;\nMDNSServer.UDP_HEADER = 8;\nMDNSServer.MDNS_PORT = 5353;\nMDNSServer.MDNS_TTL = 255;\nMDNSServer.MULTICAST_IPV4 = \"224.0.0.251\";\nMDNSServer.MULTICAST_IPV6 = \"FF02::FB\";\nMDNSServer.SEND_TIMEOUT = 200; // milliseconds\n//# sourceMappingURL=MDNSServer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NetworkManager = exports.NetworkManagerEvent = exports.WifiState = exports.IPFamily = void 0;\nconst tslib_1 = require(\"tslib\");\n/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst child_process_1 = tslib_1.__importDefault(require(\"child_process\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst events_1 = require(\"events\");\nconst fast_deep_equal_1 = tslib_1.__importDefault(require(\"fast-deep-equal\"));\nconst net_1 = tslib_1.__importDefault(require(\"net\"));\nconst os_1 = tslib_1.__importDefault(require(\"os\"));\nconst domain_formatter_1 = require(\"./util/domain-formatter\");\nconst debug = (0, debug_1.default)(\"ciao:NetworkManager\");\nvar IPFamily;\n(function (IPFamily) {\n IPFamily[\"IPv4\"] = \"IPv4\";\n IPFamily[\"IPv6\"] = \"IPv6\";\n})(IPFamily || (exports.IPFamily = IPFamily = {}));\nvar WifiState;\n(function (WifiState) {\n WifiState[WifiState[\"UNDEFINED\"] = 0] = \"UNDEFINED\";\n WifiState[WifiState[\"NOT_A_WIFI_INTERFACE\"] = 1] = \"NOT_A_WIFI_INTERFACE\";\n WifiState[WifiState[\"NOT_ASSOCIATED\"] = 2] = \"NOT_ASSOCIATED\";\n WifiState[WifiState[\"CONNECTED\"] = 3] = \"CONNECTED\";\n})(WifiState || (exports.WifiState = WifiState = {}));\nvar NetworkManagerEvent;\n(function (NetworkManagerEvent) {\n NetworkManagerEvent[\"NETWORK_UPDATE\"] = \"network-update\";\n})(NetworkManagerEvent || (exports.NetworkManagerEvent = NetworkManagerEvent = {}));\n/**\n * The NetworkManager maintains a representation of the network interfaces define on the host system.\n * It periodically checks for updated network information.\n *\n * The NetworkManager makes the following decision when checking for interfaces:\n * * First of all it gathers the default network interface of the system (by checking the routing table of the os)\n * * The following interfaces are going to be tracked:\n * * The loopback interface\n * * All interfaces which match the subnet of the default interface\n * * All interfaces which contain a globally unique (aka globally routable) ipv6 address\n */\nclass NetworkManager extends events_1.EventEmitter {\n constructor(options) {\n super();\n this.currentInterfaces = new Map();\n /**\n * A subset of our network interfaces, holding only loopback interfaces (or what node considers \"internal\").\n */\n this.loopbackInterfaces = new Map();\n this.setMaxListeners(100); // we got one listener for every Responder, 100 should be fine for now\n if (options && options.interface) {\n let interfaces;\n if (typeof options.interface === \"string\") {\n interfaces = [options.interface];\n }\n else if (Array.isArray(options.interface)) {\n interfaces = options.interface;\n }\n else {\n throw new Error(\"Found invalid type for 'interfaces' NetworkManager option!\");\n }\n const restrictedInterfaces = [];\n for (const iface of interfaces) {\n if (net_1.default.isIP(iface)) {\n const interfaceName = NetworkManager.resolveInterface(iface);\n if (interfaceName) {\n restrictedInterfaces.push(interfaceName);\n }\n else {\n console.log(\"CIAO: Interface was specified as ip (%s), though couldn't find a matching interface for the given address.\", options.interface);\n }\n }\n else {\n restrictedInterfaces.push(iface);\n }\n }\n if (restrictedInterfaces.length === 0) {\n console.log(\"CIAO: 'restrictedInterfaces' array was empty. Going to fallback to bind on all available interfaces.\");\n }\n else {\n this.restrictedInterfaces = restrictedInterfaces;\n }\n }\n this.excludeIpv6 = !!(options && options.excludeIpv6);\n this.excludeIpv6Only = this.excludeIpv6 || !!(options && options.excludeIpv6Only);\n if (options) {\n debug(\"Created NetworkManager with options: %s\", JSON.stringify(options));\n }\n this.initPromise = new Promise(resolve => {\n this.getCurrentNetworkInterfaces().then(map => {\n this.currentInterfaces = map;\n const otherInterfaces = Object.keys(os_1.default.networkInterfaces());\n const interfaceNames = [];\n for (const name of this.currentInterfaces.keys()) {\n interfaceNames.push(name);\n const index = otherInterfaces.indexOf(name);\n if (index !== -1) {\n otherInterfaces.splice(index, 1);\n }\n }\n debug(\"Initial networks [%s] ignoring [%s]\", interfaceNames.join(\", \"), otherInterfaces.join(\", \"));\n this.initPromise = undefined;\n resolve();\n this.scheduleNextJob();\n });\n });\n }\n async waitForInit() {\n if (this.initPromise) {\n await this.initPromise;\n }\n }\n shutdown() {\n if (this.currentTimer) {\n clearTimeout(this.currentTimer);\n this.currentTimer = undefined;\n }\n this.removeAllListeners();\n }\n getInterfaceMap() {\n if (this.initPromise) {\n assert_1.default.fail(\"Not yet initialized!\");\n }\n return this.currentInterfaces;\n }\n getInterface(name) {\n if (this.initPromise) {\n assert_1.default.fail(\"Not yet initialized!\");\n }\n return this.currentInterfaces.get(name);\n }\n isLoopbackNetaddressV4(netaddress) {\n for (const networkInterface of this.loopbackInterfaces.values()) {\n if (networkInterface.ipv4Netaddress === netaddress) {\n return true;\n }\n }\n return false;\n }\n scheduleNextJob() {\n this.currentTimer = setTimeout(this.checkForNewInterfaces.bind(this), NetworkManager.POLLING_TIME);\n this.currentTimer.unref(); // this timer won't prevent shutdown\n }\n async checkForNewInterfaces() {\n const latestInterfaces = await this.getCurrentNetworkInterfaces();\n if (!this.currentTimer) { // if the timer is undefined, NetworkManager was shut down\n return;\n }\n let added = undefined;\n let removed = undefined;\n let changes = undefined;\n for (const [name, networkInterface] of latestInterfaces) {\n const currentInterface = this.currentInterfaces.get(name);\n if (currentInterface) { // the interface could potentially have changed\n if (!(0, fast_deep_equal_1.default)(currentInterface, networkInterface)) {\n // indeed the interface changed\n const change = {\n name: name,\n };\n if (currentInterface.ipv4 !== networkInterface.ipv4) { // check for changed ipv4\n if (currentInterface.ipv4) {\n change.outdatedIpv4 = currentInterface.ipv4;\n }\n if (networkInterface.ipv4) {\n change.updatedIpv4 = networkInterface.ipv4;\n }\n }\n if (currentInterface.ipv6 !== networkInterface.ipv6) { // check for changed link-local ipv6\n if (currentInterface.ipv6) {\n change.outdatedIpv6 = currentInterface.ipv6;\n }\n if (networkInterface.ipv6) {\n change.updatedIpv6 = networkInterface.ipv6;\n }\n }\n if (currentInterface.globallyRoutableIpv6 !== networkInterface.globallyRoutableIpv6) { // check for changed routable ipv6\n if (currentInterface.globallyRoutableIpv6) {\n change.outdatedGloballyRoutableIpv6 = currentInterface.globallyRoutableIpv6;\n }\n if (networkInterface.globallyRoutableIpv6) {\n change.updatedGloballyRoutableIpv6 = networkInterface.globallyRoutableIpv6;\n }\n }\n if (currentInterface.uniqueLocalIpv6 !== networkInterface.uniqueLocalIpv6) { // check for changed ula\n if (currentInterface.uniqueLocalIpv6) {\n change.outdatedUniqueLocalIpv6 = currentInterface.uniqueLocalIpv6;\n }\n if (networkInterface.uniqueLocalIpv6) {\n change.updatedUniqueLocalIpv6 = networkInterface.uniqueLocalIpv6;\n }\n }\n this.currentInterfaces.set(name, networkInterface);\n if (networkInterface.loopback) {\n this.loopbackInterfaces.set(name, networkInterface);\n }\n (changes !== null && changes !== void 0 ? changes : (changes = [])).push(change);\n }\n }\n else { // new interface was added/started\n this.currentInterfaces.set(name, networkInterface);\n if (networkInterface.loopback) {\n this.currentInterfaces.set(name, networkInterface);\n }\n (added !== null && added !== void 0 ? added : (added = [])).push(networkInterface);\n }\n }\n // at this point we updated any existing interfaces and added all new interfaces\n // thus if the length of below is not the same interface must have been removed\n // this check ensures that we do not unnecessarily loop twice through our interfaces\n if (this.currentInterfaces.size !== latestInterfaces.size) {\n for (const [name, networkInterface] of this.currentInterfaces) {\n if (!latestInterfaces.has(name)) { // interface was removed\n this.currentInterfaces.delete(name);\n this.loopbackInterfaces.delete(name);\n (removed !== null && removed !== void 0 ? removed : (removed = [])).push(networkInterface);\n }\n }\n }\n if (added || removed || changes) { // emit an event only if anything changed\n const addedString = added ? added.map(iface => iface.name).join(\",\") : \"\";\n const removedString = removed ? removed.map(iface => iface.name).join(\",\") : \"\";\n const changesString = changes ? changes.map(iface => {\n let string = `{ name: ${iface.name} `;\n if (iface.outdatedIpv4 || iface.updatedIpv4) {\n string += `, ${iface.outdatedIpv4} -> ${iface.updatedIpv4} `;\n }\n if (iface.outdatedIpv6 || iface.updatedIpv6) {\n string += `, ${iface.outdatedIpv6} -> ${iface.updatedIpv6} `;\n }\n if (iface.outdatedGloballyRoutableIpv6 || iface.updatedGloballyRoutableIpv6) {\n string += `, ${iface.outdatedGloballyRoutableIpv6} -> ${iface.updatedGloballyRoutableIpv6} `;\n }\n if (iface.outdatedUniqueLocalIpv6 || iface.updatedUniqueLocalIpv6) {\n string += `, ${iface.outdatedUniqueLocalIpv6} -> ${iface.updatedUniqueLocalIpv6} `;\n }\n return string + \"}\";\n }).join(\",\") : \"\";\n debug(\"Detected network changes: added: [%s], removed: [%s], changes: [%s]!\", addedString, removedString, changesString);\n this.emit(\"network-update\" /* NetworkManagerEvent.NETWORK_UPDATE */, {\n added: added,\n removed: removed,\n changes: changes,\n });\n }\n this.scheduleNextJob();\n }\n async getCurrentNetworkInterfaces() {\n let names;\n if (this.restrictedInterfaces) {\n names = this.restrictedInterfaces;\n const loopback = NetworkManager.getLoopbackInterface();\n if (!names.includes(loopback)) {\n names.push(loopback);\n }\n }\n else {\n try {\n names = await NetworkManager.getNetworkInterfaceNames();\n }\n catch (error) {\n debug(`WARNING Detecting network interfaces for platform '${os_1.default.platform()}' failed. Trying to assume network interfaces! (${error.message})`);\n // fallback way of gathering network interfaces (remember, there are docker images where the arp command is not installed)\n names = NetworkManager.assumeNetworkInterfaceNames();\n }\n }\n const interfaces = new Map();\n const networkInterfaces = os_1.default.networkInterfaces();\n for (const name of names) {\n const infos = networkInterfaces[name];\n if (!infos) {\n continue;\n }\n let ipv4Info = undefined;\n let ipv6Info = undefined;\n let routableIpv6Info = undefined;\n let uniqueLocalIpv6Info = undefined;\n let internal = false;\n for (const info of infos) {\n if (info.internal) {\n internal = true;\n }\n // @ts-expect-error Nodejs 18+ uses the number 4 instead of the string \"IPv4\"\n if ((info.family === \"IPv4\" || info.family === 4) && !ipv4Info) {\n ipv4Info = info;\n // @ts-expect-error Nodejs 18+ uses the number 4 instead of the string \"IPv4\"\n }\n else if (info.family === \"IPv6\" || info.family === 6) {\n if (this.excludeIpv6) {\n continue;\n }\n if (info.scopeid && !ipv6Info) { // we only care about non zero scope (aka link-local ipv6)\n ipv6Info = info;\n }\n else if (info.scopeid === 0) { // global routable ipv6\n if (info.address.startsWith(\"fc\") || info.address.startsWith(\"fd\")) {\n if (!uniqueLocalIpv6Info) {\n uniqueLocalIpv6Info = info;\n }\n }\n else if (!routableIpv6Info) {\n routableIpv6Info = info;\n }\n }\n }\n if (ipv4Info && ipv6Info && routableIpv6Info && uniqueLocalIpv6Info) {\n break;\n }\n }\n (0, assert_1.default)(ipv4Info || ipv6Info, \"Could not find valid addresses for interface '\" + name + \"'\");\n if (this.excludeIpv6Only && !ipv4Info) {\n continue;\n }\n const networkInterface = {\n name: name,\n loopback: internal,\n mac: ((ipv4Info === null || ipv4Info === void 0 ? void 0 : ipv4Info.mac) || (ipv6Info === null || ipv6Info === void 0 ? void 0 : ipv6Info.mac)),\n };\n if (ipv4Info) {\n networkInterface.ipv4 = ipv4Info.address;\n networkInterface.ip4Netmask = ipv4Info.netmask;\n networkInterface.ipv4Netaddress = (0, domain_formatter_1.getNetAddress)(ipv4Info.address, ipv4Info.netmask);\n }\n if (ipv6Info) {\n networkInterface.ipv6 = ipv6Info.address;\n networkInterface.ipv6Netmask = ipv6Info.netmask;\n }\n if (routableIpv6Info) {\n networkInterface.globallyRoutableIpv6 = routableIpv6Info.address;\n networkInterface.globallyRoutableIpv6Netmask = routableIpv6Info.netmask;\n }\n if (uniqueLocalIpv6Info) {\n networkInterface.uniqueLocalIpv6 = uniqueLocalIpv6Info.address;\n networkInterface.uniqueLocalIpv6Netmask = uniqueLocalIpv6Info.netmask;\n }\n interfaces.set(name, networkInterface);\n }\n return interfaces;\n }\n static resolveInterface(address) {\n let interfaceName;\n outer: for (const [name, infoArray] of Object.entries(os_1.default.networkInterfaces())) {\n for (const info of infoArray !== null && infoArray !== void 0 ? infoArray : []) {\n if (info.address === address) {\n interfaceName = name;\n break outer; // exit out of both loops\n }\n }\n }\n return interfaceName;\n }\n static async getNetworkInterfaceNames() {\n // this function will always include the loopback interface\n let promise;\n switch (os_1.default.platform()) {\n case \"win32\":\n promise = NetworkManager.getWindowsNetworkInterfaces();\n break;\n case \"linux\": {\n promise = NetworkManager.getLinuxNetworkInterfaces();\n break;\n }\n case \"darwin\":\n promise = NetworkManager.getDarwinNetworkInterfaces();\n break;\n case \"freebsd\": {\n promise = NetworkManager.getFreeBSDNetworkInterfaces();\n break;\n }\n case \"openbsd\":\n case \"sunos\": {\n promise = NetworkManager.getOpenBSD_SUNOS_NetworkInterfaces();\n break;\n }\n default:\n debug(\"Found unsupported platform %s\", os_1.default.platform());\n return Promise.reject(new Error(\"unsupported platform!\"));\n }\n let names;\n try {\n names = await promise;\n }\n catch (error) {\n if (error.message !== NetworkManager.NOTHING_FOUND_MESSAGE) {\n throw error;\n }\n names = [];\n }\n const loopback = NetworkManager.getLoopbackInterface();\n if (!names.includes(loopback)) {\n names.unshift(loopback);\n }\n return promise;\n }\n static assumeNetworkInterfaceNames() {\n // this method is a fallback trying to calculate network related interfaces in an platform independent way\n const names = [];\n Object.entries(os_1.default.networkInterfaces()).forEach(([name, infos]) => {\n for (const info of infos !== null && infos !== void 0 ? infos : []) {\n // we add the loopback interface or interfaces which got a unique (global or local) ipv6 address\n // we currently don't just add all interfaces with ipv4 addresses as are often interfaces like VPNs, container/vms related\n // unique global or unique local ipv6 addresses give an indication that we are truly connected to \"the Internet\"\n // as something like SLAAC must be going on\n // in the end\n // @ts-expect-error Nodejs 18+ uses the number 4/6 instead of the string \"IPv4\"/\"IPv6\"\n if (info.internal || (info.family === \"IPv4\" || info.family === 4) || (info.family === \"IPv6\" || info.family === 6) && info.scopeid === 0) {\n if (!names.includes(name)) {\n names.push(name);\n }\n break;\n }\n }\n });\n return names;\n }\n static getLoopbackInterface() {\n for (const [name, infos] of Object.entries(os_1.default.networkInterfaces())) {\n for (const info of infos !== null && infos !== void 0 ? infos : []) {\n if (info.internal) {\n return name;\n }\n }\n }\n throw new Error(\"Could not detect loopback interface!\");\n }\n static getWindowsNetworkInterfaces() {\n // does not return loopback interface\n return new Promise((resolve, reject) => {\n child_process_1.default.exec(\"arp -a | findstr /C:\\\"---\\\"\", (error, stdout) => {\n if (error) {\n reject(error);\n return;\n }\n const lines = stdout.split(os_1.default.EOL);\n const addresses = [];\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim().split(\" \");\n if (line[line.length - 3]) {\n addresses.push(line[line.length - 3]);\n }\n else {\n debug(`WINDOWS: Failed to read interface name from line ${i}: '${lines[i]}'`);\n }\n }\n const names = [];\n for (const address of addresses) {\n const name = NetworkManager.resolveInterface(address);\n if (name) {\n if (!names.includes(name)) {\n names.push(name);\n }\n }\n else {\n debug(`WINDOWS: Couldn't resolve to an interface name from '${address}'`);\n }\n }\n if (names.length) {\n resolve(names);\n }\n else {\n reject(new Error(NetworkManager.NOTHING_FOUND_MESSAGE));\n }\n });\n });\n }\n static getDarwinNetworkInterfaces() {\n /*\n * Previous efforts used the routing table to get all relevant network interfaces.\n * Particularly using \"netstat -r -f inet -n\".\n * First attempt was to use the \"default\" interface to the 0.0.0.0 catch all route using \"route get 0.0.0.0\".\n * Though this fails when the router isn't connected to the internet, thus no \"internet route\" exists.\n */\n // does not return loopback interface\n return new Promise((resolve, reject) => {\n // for ipv6 \"ndp -a -n |grep -v permanent\" with filtering for \"expired\"\n child_process_1.default.exec(\"arp -a -n -l\", async (error, stdout) => {\n if (error) {\n reject(error);\n return;\n }\n const lines = stdout.split(os_1.default.EOL);\n const names = [];\n for (let i = 1; i < lines.length - 1; i++) {\n const interfaceName = lines[i].trim().split(NetworkManager.SPACE_PATTERN)[4];\n if (!interfaceName) {\n debug(`DARWIN: Failed to read interface name from line ${i}: '${lines[i]}'`);\n continue;\n }\n if (!names.includes(interfaceName)) {\n names.push(interfaceName);\n }\n }\n const promises = [];\n for (const name of names) {\n const promise = NetworkManager.getDarwinWifiNetworkState(name).then(state => {\n if (state !== 1 /* WifiState.NOT_A_WIFI_INTERFACE */ && state !== 3 /* WifiState.CONNECTED */) {\n // removing wifi networks which are not connected to any networks\n const index = names.indexOf(name);\n if (index !== -1) {\n names.splice(index, 1);\n }\n }\n });\n promises.push(promise);\n }\n await Promise.all(promises);\n if (names.length) {\n resolve(names);\n }\n else {\n reject(new Error(NetworkManager.NOTHING_FOUND_MESSAGE));\n }\n });\n });\n }\n static getLinuxNetworkInterfaces() {\n // does not return loopback interface\n return new Promise((resolve, reject) => {\n // we use \"ip neigh\" here instead of the aliases like \"ip neighbour\" or \"ip neighbor\"\n // as those were only added like 5 years ago https://github.com/shemminger/iproute2/commit/ede723964a065992bf9d0dbe3f780e65ca917872\n child_process_1.default.exec(\"ip neigh show\", (error, stdout) => {\n if (error) {\n if (error.message.includes(\"ip: not found\")) {\n debug(\"LINUX: ip was not found on the system. Falling back to assuming network interfaces!\");\n resolve(NetworkManager.assumeNetworkInterfaceNames());\n return;\n }\n reject(error);\n return;\n }\n const lines = stdout.split(os_1.default.EOL);\n const names = [];\n for (let i = 0; i < lines.length - 1; i++) {\n const parts = lines[i].trim().split(NetworkManager.SPACE_PATTERN);\n let devIndex = 0;\n for (; devIndex < parts.length; devIndex++) {\n if (parts[devIndex] === \"dev\") {\n // the next index marks the interface name\n break;\n }\n }\n if (devIndex >= parts.length) {\n debug(`LINUX: Out of bounds when reading interface name from line ${i}: '${lines[i]}'`);\n continue;\n }\n const interfaceName = parts[devIndex + 1];\n if (!interfaceName) {\n debug(`LINUX: Failed to read interface name from line ${i}: '${lines[i]}'`);\n continue;\n }\n if (!names.includes(interfaceName)) {\n names.push(interfaceName);\n }\n }\n if (names.length) {\n resolve(names);\n }\n else {\n reject(new Error(NetworkManager.NOTHING_FOUND_MESSAGE));\n }\n });\n });\n }\n static getFreeBSDNetworkInterfaces() {\n // does not return loopback interface\n return new Promise((resolve, reject) => {\n child_process_1.default.exec(\"arp -a -n\", (error, stdout) => {\n if (error) {\n reject(error);\n return;\n }\n const lines = stdout.split(os_1.default.EOL);\n const names = [];\n for (let i = 0; i < lines.length - 1; i++) {\n const interfaceName = lines[i].trim().split(NetworkManager.SPACE_PATTERN)[5];\n if (!interfaceName) {\n debug(`FreeBSD: Failed to read interface name from line ${i}: '${lines[i]}'`);\n continue;\n }\n if (!names.includes(interfaceName)) {\n names.push(interfaceName);\n }\n }\n if (names.length) {\n resolve(names);\n }\n else {\n reject(new Error(NetworkManager.NOTHING_FOUND_MESSAGE));\n }\n });\n });\n }\n static getOpenBSD_SUNOS_NetworkInterfaces() {\n // does not return loopback interface\n return new Promise((resolve, reject) => {\n // for ipv6 something like \"ndp -a -n | grep R\" (grep for reachable; maybe exclude permanent?)\n child_process_1.default.exec(\"arp -a -n\", (error, stdout) => {\n if (error) {\n reject(error);\n return;\n }\n const interfaceArrayOffset = os_1.default.platform() === \"sunos\" ? 0 : 2;\n const lines = stdout.split(os_1.default.EOL);\n const names = [];\n for (let i = 1; i < lines.length - 1; i++) {\n const interfaceName = lines[i].trim().split(NetworkManager.SPACE_PATTERN)[interfaceArrayOffset];\n if (!interfaceName) {\n debug(`${os_1.default.platform()}: Failed to read interface name from line ${i}: '${lines[i]}'`);\n continue;\n }\n if (!names.includes(interfaceName)) {\n names.push(interfaceName);\n }\n }\n if (names.length) {\n resolve(names);\n }\n else {\n reject(new Error(NetworkManager.NOTHING_FOUND_MESSAGE));\n }\n });\n });\n }\n static getDarwinWifiNetworkState(name) {\n return new Promise(resolve => {\n /*\n * networksetup outputs the following in the listed scenarios:\n *\n * executed for an interface which is not a Wi-Fi interface:\n * \" is not a Wi-Fi interface.\n * Error: Error obtaining wireless information.\"\n *\n * executed for a turned off Wi-Fi interface:\n * \"You are not associated with an AirPort network.\n * Wi-Fi power is currently off.\"\n *\n * executed for a turned on Wi-Fi interface which is not connected:\n * \"You are not associated with an AirPort network.\"\n *\n * executed for a connected Wi-Fi interface:\n * \"Current Wi-Fi Network: \"\n *\n * Other messages handled here.\n * \"All Wi-Fi network services are disabled\": encountered on macOS VM machines\n */\n child_process_1.default.exec(\"networksetup -getairportnetwork \" + name, (error, stdout) => {\n if (error) {\n if (stdout.includes(\"not a Wi-Fi interface\")) {\n resolve(1 /* WifiState.NOT_A_WIFI_INTERFACE */);\n return;\n }\n console.log(`CIAO WARN: While checking networksetup for ${name} encountered an error (${error.message}) with output: ${stdout.replace(os_1.default.EOL, \"; \")}`);\n resolve(0 /* WifiState.UNDEFINED */);\n return;\n }\n let wifiState = 0 /* WifiState.UNDEFINED */;\n if (stdout.includes(\"not a Wi-Fi interface\")) {\n wifiState = 1 /* WifiState.NOT_A_WIFI_INTERFACE */;\n }\n else if (stdout.includes(\"Current Wi-Fi Network\")) {\n wifiState = 3 /* WifiState.CONNECTED */;\n }\n else if (stdout.includes(\"not associated\")) {\n wifiState = 2 /* WifiState.NOT_ASSOCIATED */;\n }\n else if (stdout.includes(\"All Wi-Fi network services are disabled\")) {\n // typically encountered on a macOS VM or something not having a WiFi card\n wifiState = 1 /* WifiState.NOT_A_WIFI_INTERFACE */;\n }\n else {\n console.log(`CIAO WARN: While checking networksetup for ${name} encountered an unknown output: ${stdout.replace(os_1.default.EOL, \"; \")}`);\n }\n resolve(wifiState);\n });\n });\n }\n}\nexports.NetworkManager = NetworkManager;\nNetworkManager.SPACE_PATTERN = /\\s+/g;\nNetworkManager.NOTHING_FOUND_MESSAGE = \"no interfaces found\";\nNetworkManager.POLLING_TIME = 15 * 1000; // 15 seconds\n//# sourceMappingURL=NetworkManager.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Responder = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst CiaoService_1 = require(\"./CiaoService\");\nconst DNSPacket_1 = require(\"./coder/DNSPacket\");\nconst Question_1 = require(\"./coder/Question\");\nconst AAAARecord_1 = require(\"./coder/records/AAAARecord\");\nconst ARecord_1 = require(\"./coder/records/ARecord\");\nconst PTRRecord_1 = require(\"./coder/records/PTRRecord\");\nconst SRVRecord_1 = require(\"./coder/records/SRVRecord\");\nconst TXTRecord_1 = require(\"./coder/records/TXTRecord\");\nconst MDNSServer_1 = require(\"./MDNSServer\");\nconst Announcer_1 = require(\"./responder/Announcer\");\nconst Prober_1 = require(\"./responder/Prober\");\nconst QueryResponse_1 = require(\"./responder/QueryResponse\");\nconst QueuedResponse_1 = require(\"./responder/QueuedResponse\");\nconst TruncatedQuery_1 = require(\"./responder/TruncatedQuery\");\nconst errors_1 = require(\"./util/errors\");\nconst promise_utils_1 = require(\"./util/promise-utils\");\nconst sorted_array_1 = require(\"./util/sorted-array\");\nconst debug = (0, debug_1.default)(\"ciao:Responder\");\nconst queuedResponseComparator = (a, b) => {\n return a.estimatedTimeToBeSent - b.estimatedTimeToBeSent;\n};\nvar ConflictType;\n(function (ConflictType) {\n ConflictType[ConflictType[\"NO_CONFLICT\"] = 0] = \"NO_CONFLICT\";\n ConflictType[ConflictType[\"CONFLICTING_RDATA\"] = 1] = \"CONFLICTING_RDATA\";\n ConflictType[ConflictType[\"CONFLICTING_TTL\"] = 2] = \"CONFLICTING_TTL\";\n})(ConflictType || (ConflictType = {}));\n/**\n * A Responder instance represents a running MDNSServer and a set of advertised services.\n *\n * It will handle any service related operations, like advertising, sending goodbye packets or sending record updates.\n * It handles answering questions arriving at the multicast address.\n */\nclass Responder {\n /**\n * Refer to {@link getResponder} in the index file\n *\n * @private should not be used directly. Please use the getResponder method defined in index file.\n */\n static getResponder(options) {\n const optionsString = options ? JSON.stringify(options) : \"\";\n const responder = this.INSTANCES.get(optionsString);\n if (responder) {\n responder.refCount++;\n return responder;\n }\n else {\n const responder = new Responder(options);\n this.INSTANCES.set(optionsString, responder);\n responder.optionsString = optionsString;\n return responder;\n }\n }\n constructor(options) {\n this.refCount = 1;\n this.optionsString = \"\";\n this.bound = false;\n /**\n * Announced services is indexed by the {@link dnsLowerCase} if the fqdn (as of RFC 1035 3.1).\n * As soon as the probing step is finished the service is added to the announced services Map.\n */\n this.announcedServices = new Map();\n /**\n * map representing all our shared PTR records.\n * Typically, we hold stuff like '_services._dns-sd._udp.local' (RFC 6763 9.), '_hap._tcp.local'.\n * Also, pointers for every subtype like '_printer._sub._http._tcp.local' are inserted here.\n *\n * For every pointer we may hold multiple entries (like multiple services can advertise on _hap._tcp.local).\n * The key as well as all values are {@link dnsLowerCase}\n */\n this.servicePointer = new Map();\n this.truncatedQueries = {}; // indexed by :\n this.delayedMulticastResponses = [];\n this.server = new MDNSServer_1.MDNSServer(this, options);\n this.promiseChain = this.start();\n this.server.getNetworkManager().on(\"network-update\" /* NetworkManagerEvent.NETWORK_UPDATE */, this.handleNetworkUpdate.bind(this));\n this.ignoreUnicastResponseFlag = options === null || options === void 0 ? void 0 : options.ignoreUnicastResponseFlag;\n if (options === null || options === void 0 ? void 0 : options.periodicBroadcasts) {\n this.broadcastInterval = setTimeout(this.handlePeriodicBroadcasts.bind(this), 30000).unref();\n }\n }\n handlePeriodicBroadcasts() {\n this.broadcastInterval = undefined;\n debug(\"Sending periodic announcement on \" + Array.from(this.server.getNetworkManager().getInterfaceMap().keys()).join(\", \"));\n for (const networkInterface of this.server.getNetworkManager().getInterfaceMap().values()) {\n const question = new Question_1.Question(\"_hap._tcp.local.\", 12 /* QType.PTR */, false);\n const responses = this.answerQuestion(question, {\n port: 5353,\n address: (networkInterface.ipv4Netaddress || networkInterface.globallyRoutableIpv6 || networkInterface.uniqueLocalIpv6 || networkInterface.ipv6),\n interface: networkInterface.name,\n });\n QueryResponse_1.QueryResponse.combineResponses(responses);\n for (const response of responses) {\n if (!response.hasAnswers()) {\n continue;\n }\n this.server.sendResponse(response.asPacket(), networkInterface.name);\n }\n }\n this.broadcastInterval = setTimeout(this.handlePeriodicBroadcasts.bind(this), Math.random() * 3000 + 27000).unref();\n }\n /**\n * Creates a new CiaoService instance and links it to this Responder instance.\n *\n * @param {ServiceOptions} options - Defines all information about the service which should be created.\n * @returns The newly created {@link CiaoService} instance can be used to advertise and manage the created service.\n */\n createService(options) {\n const service = new CiaoService_1.CiaoService(this.server.getNetworkManager(), options);\n service.on(\"publish\" /* InternalServiceEvent.PUBLISH */, this.advertiseService.bind(this, service));\n service.on(\"unpublish\" /* InternalServiceEvent.UNPUBLISH */, this.unpublishService.bind(this, service));\n service.on(\"republish\" /* InternalServiceEvent.REPUBLISH */, this.republishService.bind(this, service));\n service.on(\"records-update\" /* InternalServiceEvent.RECORD_UPDATE */, this.handleServiceRecordUpdate.bind(this, service));\n service.on(\"records-update-interface\" /* InternalServiceEvent.RECORD_UPDATE_ON_INTERFACE */, this.handleServiceRecordUpdateOnInterface.bind(this, service));\n return service;\n }\n /**\n * This method should be called when you want to unpublish all service exposed by this Responder.\n * This method SHOULD be called before the node application exists, so any host on the\n * network is informed of the shutdown of this machine.\n * Calling the shutdown method is mandatory for a clean termination (sending goodbye packets).\n *\n * The shutdown method must only be called ONCE.\n *\n * @returns The Promise resolves once all goodbye packets were sent\n * (or immediately if any other users have a reference to this Responder instance).\n */\n shutdown() {\n this.refCount--; // we trust the user here, that the shutdown will not be executed twice or something :thinking:\n if (this.refCount > 0) {\n return Promise.resolve();\n }\n if (this.currentProber) {\n // Services which are in Probing step aren't included in announcedServices Map\n // thus we need to cancel them as well\n this.currentProber.cancel();\n }\n if (this.broadcastInterval) {\n clearTimeout(this.broadcastInterval);\n }\n Responder.INSTANCES.delete(this.optionsString);\n debug(\"Shutting down Responder...\");\n const promises = [];\n for (const service of this.announcedServices.values()) {\n promises.push(this.unpublishService(service));\n }\n return Promise.all(promises).then(() => {\n this.server.shutdown();\n this.bound = false;\n });\n }\n getAnnouncedServices() {\n return this.announcedServices.values();\n }\n start() {\n if (this.bound) {\n throw new Error(\"Server is already bound!\");\n }\n this.bound = true;\n return this.server.bind();\n }\n advertiseService(service, callback) {\n if (service.serviceState === \"announced\" /* ServiceState.ANNOUNCED */) {\n throw new Error(\"Can't publish a service that is already announced. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n else if (service.serviceState === \"probing\" /* ServiceState.PROBING */) {\n return this.promiseChain.then(() => {\n if (service.currentAnnouncer) {\n return service.currentAnnouncer.awaitAnnouncement();\n }\n });\n }\n else if (service.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n (0, assert_1.default)(service.currentAnnouncer, \"Service is in state ANNOUNCING though has no linked announcer!\");\n if (service.currentAnnouncer.isSendingGoodbye()) {\n return service.currentAnnouncer.awaitAnnouncement().then(() => this.advertiseService(service, callback));\n }\n else {\n return service.currentAnnouncer.cancel().then(() => this.advertiseService(service, callback));\n }\n }\n debug(\"[%s] Going to advertise service...\", service.getFQDN()); // TODO include restricted addresses and stuff\n // multicast loopback is not enabled for our sockets, though we do some stuff, so Prober will handle potential\n // name conflicts with our own services:\n // - One Responder will always run ONE prober: no need to handle simultaneous probe tiebreaking\n // - Prober will call the Responder to generate responses to its queries to\n // resolve name conflicts the same way as with other services on the network\n this.promiseChain = this.promiseChain // we synchronize all ongoing probes here\n .then(() => service.rebuildServiceRecords()) // build the records the first time for the prober\n .then(() => this.probe(service)); // probe errors are catch below\n return this.promiseChain.then(() => {\n // we are not returning the promise returned by announced here, only PROBING is synchronized\n this.announce(service).catch(reason => {\n // handle announce errors\n console.log(`[${service.getFQDN()}] failed announcing with reason: ${reason}. Trying again in 2 seconds!`);\n return (0, promise_utils_1.PromiseTimeout)(2000).then(() => this.advertiseService(service, () => {\n // empty\n }));\n });\n callback(); // service is considered announced. After the call to the announce() method the service state is set to ANNOUNCING\n }, reason => {\n /*\n * I know seems unintuitive to place the probe error handling below here, miles away from the probe method call.\n * Trust me it makes sense (encountered regression now two times in a row).\n * 1. We can't put it in the THEN call above, since then errors simply won't be handled from the probe method call.\n * (CANCEL error would be passed through and would result in some unwanted stack trace)\n * 2. We can't add a catch call above, since otherwise we would silence the CANCEL would be silenced and announce\n * would be called anyway.\n */\n // handle probe error\n if (reason === Prober_1.Prober.CANCEL_REASON) {\n callback();\n }\n else { // other errors are only thrown when sockets error occur\n console.log(`[${service.getFQDN()}] failed probing with reason: ${reason}. Trying again in 2 seconds!`);\n return (0, promise_utils_1.PromiseTimeout)(2000).then(() => this.advertiseService(service, callback));\n }\n });\n }\n async republishService(service, callback, delayAnnounce = false) {\n if (service.serviceState !== \"announced\" /* ServiceState.ANNOUNCED */ && service.serviceState !== \"announcing\" /* ServiceState.ANNOUNCING */) {\n throw new Error(\"Can't unpublish a service which isn't announced yet. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n debug(\"[%s] Readvertising service...\", service.getFQDN());\n if (service.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n (0, assert_1.default)(service.currentAnnouncer, \"Service is in state ANNOUNCING though has no linked announcer!\");\n const promise = service.currentAnnouncer.isSendingGoodbye()\n ? service.currentAnnouncer.awaitAnnouncement()\n : service.currentAnnouncer.cancel();\n return promise.then(() => this.advertiseService(service, callback));\n }\n // first of all remove it from our advertisedService Map and remove all the maintained PTRs\n this.clearService(service);\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */; // the service is now considered unannounced\n // and now we basically just announce the service by doing probing and the 'announce' step\n if (delayAnnounce) {\n return (0, promise_utils_1.PromiseTimeout)(1000)\n .then(() => this.advertiseService(service, callback));\n }\n else {\n return this.advertiseService(service, callback);\n }\n }\n unpublishService(service, callback) {\n if (service.serviceState === \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n throw new Error(\"Can't unpublish a service which isn't announced yet. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n if (service.serviceState === \"announced\" /* ServiceState.ANNOUNCED */ || service.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n if (service.serviceState === \"announcing\" /* ServiceState.ANNOUNCING */) {\n (0, assert_1.default)(service.currentAnnouncer, \"Service is in state ANNOUNCING though has no linked announcer!\");\n if (service.currentAnnouncer.isSendingGoodbye()) {\n return service.currentAnnouncer.awaitAnnouncement(); // we are already sending a goodbye\n }\n return service.currentAnnouncer.cancel().then(() => {\n service.serviceState = \"announced\" /* ServiceState.ANNOUNCED */; // unpublishService requires announced state\n return this.unpublishService(service, callback);\n });\n }\n debug(\"[%s] Removing service from the network\", service.getFQDN());\n this.clearService(service);\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n let promise = this.goodbye(service);\n if (callback) {\n promise = promise.then(() => callback(), reason => {\n console.log(`[${service.getFQDN()}] failed goodbye with reason: ${reason}.`);\n callback();\n });\n }\n return promise;\n }\n else if (service.serviceState === \"probing\" /* ServiceState.PROBING */) {\n debug(\"[%s] Canceling probing\", service.getFQDN());\n if (this.currentProber && this.currentProber.getService() === service) {\n this.currentProber.cancel();\n this.currentProber = undefined;\n }\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n }\n callback && callback();\n return Promise.resolve();\n }\n clearService(service) {\n const serviceFQDN = service.getLowerCasedFQDN();\n const typePTR = service.getLowerCasedTypePTR();\n const subtypePTRs = service.getLowerCasedSubtypePTRs(); // possibly undefined\n this.removePTR(Responder.SERVICE_TYPE_ENUMERATION_NAME, typePTR);\n this.removePTR(typePTR, serviceFQDN);\n if (subtypePTRs) {\n for (const ptr of subtypePTRs) {\n this.removePTR(ptr, serviceFQDN);\n }\n }\n this.announcedServices.delete(service.getLowerCasedFQDN());\n }\n addPTR(ptr, name) {\n // we don't call lower case here, as we expect the caller to have done that already\n // name = dnsLowerCase(name); // worst case is that the meta query ptr record contains lower cased destination\n const names = this.servicePointer.get(ptr);\n if (names) {\n if (!names.includes(name)) {\n names.push(name);\n }\n }\n else {\n this.servicePointer.set(ptr, [name]);\n }\n }\n removePTR(ptr, name) {\n const names = this.servicePointer.get(ptr);\n if (names) {\n const index = names.indexOf(name);\n if (index !== -1) {\n names.splice(index, 1);\n }\n if (names.length === 0) {\n this.servicePointer.delete(ptr);\n }\n }\n }\n probe(service) {\n if (service.serviceState !== \"unannounced\" /* ServiceState.UNANNOUNCED */) {\n throw new Error(\"Can't probe for a service which is announced already. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n service.serviceState = \"probing\" /* ServiceState.PROBING */;\n (0, assert_1.default)(this.currentProber === undefined, \"Tried creating new Prober when there already was one active!\");\n this.currentProber = new Prober_1.Prober(this, this.server, service);\n return this.currentProber.probe()\n .then(() => {\n this.currentProber = undefined;\n service.serviceState = \"probed\" /* ServiceState.PROBED */;\n }, reason => {\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n this.currentProber = undefined;\n return Promise.reject(reason); // forward reason\n });\n }\n announce(service) {\n if (service.serviceState !== \"probed\" /* ServiceState.PROBED */) {\n throw new Error(\"Cannot announce service which was not probed unique. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n (0, assert_1.default)(service.currentAnnouncer === undefined, \"Service \" + service.getFQDN() + \" is already announcing!\");\n service.serviceState = \"announcing\" /* ServiceState.ANNOUNCING */;\n const announcer = new Announcer_1.Announcer(this.server, service, {\n repetitions: 3,\n });\n service.currentAnnouncer = announcer;\n const serviceFQDN = service.getLowerCasedFQDN();\n const typePTR = service.getLowerCasedTypePTR();\n const subtypePTRs = service.getLowerCasedSubtypePTRs(); // possibly undefined\n this.addPTR(Responder.SERVICE_TYPE_ENUMERATION_NAME, typePTR);\n this.addPTR(typePTR, serviceFQDN);\n if (subtypePTRs) {\n for (const ptr of subtypePTRs) {\n this.addPTR(ptr, serviceFQDN);\n }\n }\n this.announcedServices.set(serviceFQDN, service);\n return announcer.announce().then(() => {\n service.serviceState = \"announced\" /* ServiceState.ANNOUNCED */;\n service.currentAnnouncer = undefined;\n }, reason => {\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n service.currentAnnouncer = undefined;\n this.clearService(service); // also removes entry from announcedServices\n if (reason !== Announcer_1.Announcer.CANCEL_REASON) {\n // forward reason if it is not a cancellation.\n // We do not forward cancel reason. Announcements only get cancelled if we have something \"better\" to do.\n // So the race is already handled by us.\n return Promise.reject(reason);\n }\n });\n }\n handleServiceRecordUpdate(service, response, callback) {\n var _a;\n // when updating we just repeat the 'announce' step\n if (service.serviceState !== \"announced\" /* ServiceState.ANNOUNCED */) { // different states are already handled in CiaoService where this event handler is fired\n throw new Error(\"Cannot update txt of service which is not announced yet. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n debug(\"[%s] Updating %d record(s) for given service!\", service.getFQDN(), response.answers.length + (((_a = response.additionals) === null || _a === void 0 ? void 0 : _a.length) || 0));\n // TODO we should do a announcement at this point \"in theory\"\n this.server.sendResponseBroadcast(response, service).then(results => {\n const failRatio = (0, MDNSServer_1.SendResultFailedRatio)(results);\n if (failRatio === 1) {\n console.log((0, MDNSServer_1.SendResultFormatError)(results, `Failed to send records update for '${service.getFQDN()}'`), true);\n if (callback) {\n callback(new Error(\"Updating records failed as of socket errors!\"));\n }\n return; // all failed => updating failed\n }\n if (failRatio > 0) {\n // some queries on some interfaces failed, but not all. We log that but consider that to be a success\n // at this point we are not responsible for removing stale network interfaces or something\n debug((0, MDNSServer_1.SendResultFormatError)(results, `Some of the record updates for '${service.getFQDN()}' failed`));\n // SEE no return here\n }\n if (callback) {\n callback();\n }\n });\n }\n handleServiceRecordUpdateOnInterface(service, name, records, callback) {\n // when updating we just repeat the 'announce' step\n if (service.serviceState !== \"announced\" /* ServiceState.ANNOUNCED */) { // different states are already handled in CiaoService where this event handler is fired\n throw new Error(\"Cannot update txt of service which is not announced yet. Received \" + service.serviceState + \" for service \" + service.getFQDN());\n }\n debug(\"[%s] Updating %d record(s) for given service on interface %s!\", service.getFQDN(), records.length, name);\n const packet = DNSPacket_1.DNSPacket.createDNSResponsePacketsFromRRSet({ answers: records });\n this.server.sendResponse(packet, name, callback);\n }\n goodbye(service) {\n (0, assert_1.default)(service.currentAnnouncer === undefined, \"Service \" + service.getFQDN() + \" is already announcing!\");\n service.serviceState = \"announcing\" /* ServiceState.ANNOUNCING */;\n const announcer = new Announcer_1.Announcer(this.server, service, {\n repetitions: 1,\n goodbye: true,\n });\n service.currentAnnouncer = announcer;\n return announcer.announce().then(() => {\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n service.currentAnnouncer = undefined;\n }, reason => {\n // just assume unannounced. we won't be answering anymore, so the record will be flushed from cache sometime.\n service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n service.currentAnnouncer = undefined;\n return Promise.reject(reason);\n });\n }\n handleNetworkUpdate(change) {\n for (const service of this.announcedServices.values()) {\n service.handleNetworkInterfaceUpdate(change);\n }\n }\n /**\n * @private method called by the MDNSServer when an incoming query needs ot be handled\n */\n handleQuery(packet, endpoint) {\n const start = new Date().getTime();\n const endpointId = endpoint.address + \":\" + endpoint.port + \":\" + endpoint.interface; // used to match truncated queries\n const previousQuery = this.truncatedQueries[endpointId];\n if (previousQuery) {\n const truncatedQueryResult = previousQuery.appendDNSPacket(packet);\n switch (truncatedQueryResult) {\n case 1 /* TruncatedQueryResult.ABORT */: // returned when we detect, that continuously TC queries are sent\n delete this.truncatedQueries[endpointId];\n debug(\"[%s] Aborting to wait for more truncated queries. Waited a total of %d ms receiving %d queries\", endpointId, previousQuery.getTotalWaitTime(), previousQuery.getArrivedPacketCount());\n return;\n case 2 /* TruncatedQueryResult.AGAIN_TRUNCATED */:\n debug(\"[%s] Received a query marked as truncated, waiting for more to arrive\", endpointId);\n return; // wait for the next packet\n case 3 /* TruncatedQueryResult.FINISHED */:\n delete this.truncatedQueries[endpointId];\n packet = previousQuery.getPacket(); // replace packet with the complete deal\n debug(\"[%s] Last part of the truncated query arrived. Received %d packets taking a total of %d ms\", endpointId, previousQuery.getArrivedPacketCount(), previousQuery.getTotalWaitTime());\n break;\n }\n }\n else if (packet.flags.truncation) {\n // RFC 6763 18.5 truncate flag indicates that additional known-answer records follow shortly\n debug(\"Received truncated query from \" + JSON.stringify(endpoint) + \" waiting for more to come!\");\n const truncatedQuery = new TruncatedQuery_1.TruncatedQuery(packet);\n this.truncatedQueries[endpointId] = truncatedQuery;\n truncatedQuery.on(\"timeout\" /* TruncatedQueryEvent.TIMEOUT */, () => {\n // called when more than 400-500ms pass until the next packet arrives\n debug(\"[%s] Timeout passed since the last truncated query was received. Discarding %d packets received in %d ms.\", endpointId, truncatedQuery.getArrivedPacketCount(), truncatedQuery.getTotalWaitTime());\n delete this.truncatedQueries[endpointId];\n });\n return; // wait for the next query\n }\n const isUnicastQuerier = endpoint.port !== MDNSServer_1.MDNSServer.MDNS_PORT; // explained below\n const isProbeQuery = packet.authorities.size > 0;\n let udpPayloadSize = undefined; // payload size supported by the querier\n for (const record of packet.additionals.values()) {\n if (record.type === 41 /* RType.OPT */) {\n udpPayloadSize = record.udpPayloadSize;\n break;\n }\n }\n // responses must not include questions RFC 6762 6.\n // known answer suppression according to RFC 6762 7.1.\n const multicastResponses = [];\n const unicastResponses = [];\n // gather answers for all the questions\n packet.questions.forEach(question => {\n const responses = this.answerQuestion(question, endpoint, packet.answers);\n if (isUnicastQuerier || question.unicastResponseFlag && !this.ignoreUnicastResponseFlag) {\n unicastResponses.push(...responses);\n }\n else {\n multicastResponses.push(...responses);\n }\n });\n if (this.currentProber) {\n this.currentProber.handleQuery(packet, endpoint);\n }\n if (isUnicastQuerier) {\n // we are dealing with a legacy unicast dns query (RFC 6762 6.7.)\n // * MUSTS: response via unicast, repeat query ID, repeat questions, clear cache flush bit\n // * SHOULDS: ttls should not be greater than 10s as legacy resolvers don't take part in the cache coherency mechanism\n for (let i = 0; i < unicastResponses.length; i++) {\n const response = unicastResponses[i];\n // only add questions to the first packet (will be combined anyway) and we must ensure\n // each packet stays unique in its records\n response.markLegacyUnicastResponse(packet.id, i === 0 ? Array.from(packet.questions.values()) : undefined);\n }\n }\n // RFC 6762 6.4. Response aggregation:\n // When possible, a responder SHOULD, for the sake of network\n // efficiency, aggregate as many responses as possible into a single\n // Multicast DNS response message. For example, when a responder has\n // several responses it plans to send, each delayed by a different\n // interval, then earlier responses SHOULD be delayed by up to an\n // additional 500 ms if that will permit them to be aggregated with\n // other responses scheduled to go out a little later.\n QueryResponse_1.QueryResponse.combineResponses(multicastResponses, udpPayloadSize);\n QueryResponse_1.QueryResponse.combineResponses(unicastResponses, udpPayloadSize);\n if (isUnicastQuerier && unicastResponses.length > 1) {\n // RFC 6762 18.5. In legacy unicast response messages, the TC bit has the same meaning\n // as in conventional Unicast DNS: it means that the response was too\n // large to fit in a single packet, so the querier SHOULD reissue its\n // query using TCP in order to receive the larger response.\n unicastResponses.splice(1, unicastResponses.length - 1); // discard all other\n unicastResponses[0].markTruncated();\n }\n for (const unicastResponse of unicastResponses) {\n if (!unicastResponse.hasAnswers()) {\n continue;\n }\n this.server.sendResponse(unicastResponse.asPacket(), endpoint);\n const time = new Date().getTime() - start;\n debug(\"Sending response via unicast to %s (took %d ms): %s\", JSON.stringify(endpoint), time, unicastResponse.asString(udpPayloadSize));\n }\n for (const multicastResponse of multicastResponses) {\n if (!multicastResponse.hasAnswers()) {\n continue;\n }\n if ((multicastResponse.containsSharedAnswer() || packet.questions.size > 1) && !isProbeQuery) {\n // We must delay the response on an interval of 20-120ms if we can't assure that we are the only one responding (shared records).\n // This is also the case if there are multiple questions. If multiple questions are asked\n // we probably could not answer them all (because not all of them were directed to us).\n // All those conditions are overridden if this is a probe query. To those queries we must respond instantly!\n const time = new Date().getTime() - start;\n this.enqueueDelayedMulticastResponse(multicastResponse.asPacket(), endpoint.interface, time);\n }\n else {\n // otherwise the response is sent immediately, if there isn't any packet in the queue\n // so first step is, check if there is a packet in the queue we are about to send out\n // which can be combined with our current packet without adding a delay > 500ms\n let sentWithLaterPacket = false;\n for (let i = 0; i < this.delayedMulticastResponses.length; i++) {\n const delayedResponse = this.delayedMulticastResponses[i];\n if (delayedResponse.getTimeTillSent() > QueuedResponse_1.QueuedResponse.MAX_DELAY) {\n // all packets following won't be compatible either\n break;\n }\n if (delayedResponse.combineWithUniqueResponseIfPossible(multicastResponse, endpoint.interface)) {\n const time = new Date().getTime() - start;\n sentWithLaterPacket = true;\n debug(\"Multicast response on interface %s containing unique records (took %d ms) was combined with response which is sent out later\", endpoint.interface, time);\n break;\n }\n }\n if (!sentWithLaterPacket) {\n this.server.sendResponse(multicastResponse.asPacket(), endpoint.interface);\n const time = new Date().getTime() - start;\n debug(\"Sending response via multicast on network %s (took %d ms): %s\", endpoint.interface, time, multicastResponse.asString(udpPayloadSize));\n }\n }\n }\n }\n /**\n * @private method called by the MDNSServer when an incoming response needs to be handled\n */\n handleResponse(packet, endpoint) {\n // any questions in a response must be ignored RFC 6762 6.\n if (this.currentProber) { // if there is a probing process running currently, just forward all messages to it\n this.currentProber.handleResponse(packet, endpoint);\n }\n for (const service of this.announcedServices.values()) {\n let conflictingRData = false;\n let ttlConflicts = 0; // we currently do a full-blown announcement with all records, we could in the future track which records have invalid ttl\n for (const record of packet.answers.values()) {\n const type = Responder.checkRecordConflictType(service, record, endpoint);\n if (type === 1 /* ConflictType.CONFLICTING_RDATA */) {\n conflictingRData = true;\n break; // we will republish in any case\n }\n else if (type === 2 /* ConflictType.CONFLICTING_TTL */) {\n ttlConflicts++;\n }\n }\n if (!conflictingRData) {\n for (const record of packet.additionals.values()) {\n const type = Responder.checkRecordConflictType(service, record, endpoint);\n if (type === 1 /* ConflictType.CONFLICTING_RDATA */) {\n conflictingRData = true;\n break; // we will republish in any case\n }\n else if (type === 2 /* ConflictType.CONFLICTING_TTL */) {\n ttlConflicts++;\n }\n }\n }\n if (conflictingRData) {\n // noinspection JSIgnoredPromiseFromCall\n this.republishService(service, error => {\n if (error) {\n console.log(`FATAL Error occurred trying to resolve conflict for service ${service.getFQDN()}! We can't recover from this!`);\n console.log(error.stack);\n process.exit(1); // we have a service which should be announced, though we failed to reannounce.\n // if this should ever happen in reality, whe might want to introduce a more sophisticated recovery\n // for situations where it makes sense\n }\n }, true);\n }\n else if (ttlConflicts && !service.currentAnnouncer) {\n service.serviceState = \"announcing\" /* ServiceState.ANNOUNCING */; // all code above doesn't expect an Announcer object in state ANNOUNCED\n const announcer = new Announcer_1.Announcer(this.server, service, {\n repetitions: 1, // we send exactly one packet to correct any ttl values in neighbouring caches\n });\n service.currentAnnouncer = announcer;\n announcer.announce().then(() => {\n service.currentAnnouncer = undefined;\n service.serviceState = \"announced\" /* ServiceState.ANNOUNCED */;\n }, reason => {\n service.currentAnnouncer = undefined;\n service.serviceState = \"announced\" /* ServiceState.ANNOUNCED */;\n if (reason === Announcer_1.Announcer.CANCEL_REASON) {\n return; // nothing to worry about\n }\n console.warn(\"When trying to resolve a ttl conflict on the network, we were unable to send our response packet: \" + reason.message);\n });\n }\n }\n }\n static checkRecordConflictType(service, record, endpoint) {\n // RFC 6762 9. Conflict Resolution:\n // A conflict occurs when a Multicast DNS responder has a unique record\n // for which it is currently authoritative, and it receives a Multicast\n // DNS response message containing a record with the same name, rrtype\n // and rrclass, but inconsistent rdata. What may be considered\n // inconsistent is context-sensitive, except that resource records with\n // identical rdata are never considered inconsistent, even if they\n // originate from different hosts. This is to permit use of proxies and\n // other fault-tolerance mechanisms that may cause more than one\n // responder to be capable of issuing identical answers on the network.\n //\n // A common example of a resource record type that is intended to be\n // unique, not shared between hosts, is the address record that maps a\n // host's name to its IP address. Should a host witness another host\n // announce an address record with the same name but a different IP\n // address, then that is considered inconsistent, and that address\n // record is considered to be in conflict.\n //\n // Whenever a Multicast DNS responder receives any Multicast DNS\n // response (solicited or otherwise) containing a conflicting resource\n // record in any of the Resource Record Sections, the Multicast DNS\n // responder MUST immediately reset its conflicted unique record to\n // probing state, and go through the startup steps described above in\n // Section 8, \"Probing and Announcing on Startup\". The protocol used in\n // the Probing phase will determine a winner and a loser, and the loser\n // MUST cease using the name, and reconfigure.\n if (!service.advertisesOnInterface(endpoint.interface)) {\n return 0 /* ConflictType.NO_CONFLICT */;\n }\n const recordName = record.getLowerCasedName();\n if (recordName === service.getLowerCasedFQDN()) {\n if (record.type === 33 /* RType.SRV */) {\n const srvRecord = record;\n if (srvRecord.getLowerCasedHostname() !== service.getLowerCasedHostname()) {\n debug(\"[%s] Noticed conflicting record on the network. SRV with hostname: %s\", service.getFQDN(), srvRecord.hostname);\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n else if (srvRecord.port !== service.getPort()) {\n debug(\"[%s] Noticed conflicting record on the network. SRV with port: %s\", service.getFQDN(), srvRecord.port);\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n if (srvRecord.ttl < SRVRecord_1.SRVRecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n else if (record.type === 16 /* RType.TXT */) {\n const txtRecord = record;\n const txt = service.getTXT();\n if (txt.length !== txtRecord.txt.length) { // length differs, can't be the same data\n debug(\"[%s] Noticed conflicting record on the network. TXT with differing data length\", service.getFQDN());\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n for (let i = 0; i < txt.length; i++) {\n const buffer0 = txt[i];\n const buffer1 = txtRecord.txt[i];\n if (buffer0.length !== buffer1.length || buffer0.toString(\"hex\") !== buffer1.toString(\"hex\")) {\n debug(\"[%s] Noticed conflicting record on the network. TXT with differing data.\", service.getFQDN());\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n }\n if (txtRecord.ttl < TXTRecord_1.TXTRecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n }\n else if (recordName === service.getLowerCasedHostname()) {\n if (record.type === 1 /* RType.A */) {\n const aRecord = record;\n if (!service.hasAddress(aRecord.ipAddress)) {\n // if the service doesn't expose the listed address we have a conflict\n debug(\"[%s] Noticed conflicting record on the network. A with ip address: %s\", service.getFQDN(), aRecord.ipAddress);\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n if (aRecord.ttl < ARecord_1.ARecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n else if (record.type === 28 /* RType.AAAA */) {\n const aaaaRecord = record;\n if (!service.hasAddress(aaaaRecord.ipAddress)) {\n // if the service doesn't expose the listed address we have a conflict\n debug(\"[%s] Noticed conflicting record on the network. AAAA with ip address: %s\", service.getFQDN(), aaaaRecord.ipAddress);\n return 1 /* ConflictType.CONFLICTING_RDATA */;\n }\n if (aaaaRecord.ttl < AAAARecord_1.AAAARecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n }\n else if (record.type === 12 /* RType.PTR */) {\n const ptrRecord = record;\n if (recordName === service.getLowerCasedTypePTR()) {\n if (ptrRecord.getLowerCasedPTRName() === service.getLowerCasedFQDN() && ptrRecord.ttl < PTRRecord_1.PTRRecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n else if (recordName === Responder.SERVICE_TYPE_ENUMERATION_NAME) {\n // nothing to do here, I guess\n }\n else {\n const subTypes = service.getLowerCasedSubtypePTRs();\n if (subTypes && subTypes.includes(recordName)\n && ptrRecord.getLowerCasedPTRName() === service.getLowerCasedFQDN() && ptrRecord.ttl < PTRRecord_1.PTRRecord.DEFAULT_TTL / 2) {\n return 2 /* ConflictType.CONFLICTING_TTL */;\n }\n }\n }\n return 0 /* ConflictType.NO_CONFLICT */;\n }\n enqueueDelayedMulticastResponse(packet, interfaceName, time) {\n const response = new QueuedResponse_1.QueuedResponse(packet, interfaceName);\n response.calculateRandomDelay();\n (0, sorted_array_1.sortedInsert)(this.delayedMulticastResponses, response, queuedResponseComparator);\n // run combine/delay checks\n for (let i = 0; i < this.delayedMulticastResponses.length; i++) {\n const response0 = this.delayedMulticastResponses[i];\n // search for any packets sent out after this packet\n for (let j = i + 1; j < this.delayedMulticastResponses.length; j++) {\n const response1 = this.delayedMulticastResponses[j];\n if (!response0.delayWouldBeInTimelyManner(response1)) {\n // all packets following won't be compatible either\n break;\n }\n if (response0.combineWithNextPacketIfPossible(response1)) {\n // combine was a success and the packet got delay\n // remove the packet from the queue\n const index = this.delayedMulticastResponses.indexOf(response0);\n if (index !== -1) {\n this.delayedMulticastResponses.splice(index, 1);\n }\n i--; // reduce i, as one element got removed from the queue\n break;\n }\n // otherwise we continue with maybe some packets further ahead\n }\n }\n if (!response.delayed) {\n // only set timer if packet got not delayed\n response.scheduleResponse(() => {\n const index = this.delayedMulticastResponses.indexOf(response);\n if (index !== -1) {\n this.delayedMulticastResponses.splice(index, 1);\n }\n try {\n this.server.sendResponse(response.getPacket(), interfaceName);\n debug(\"Sending (delayed %dms) response via multicast on network interface %s (took %d ms): %s\", Math.round(response.getTimeSinceCreation()), interfaceName, time, response.getPacket().asLoggingString());\n }\n catch (error) {\n if (error.name === errors_1.ERR_INTERFACE_NOT_FOUND) {\n debug(\"Multicast response (delayed %dms) was cancelled as the network interface %s is no longer available!\", Math.round(response.getTimeSinceCreation()), interfaceName);\n }\n else if (error.name === errors_1.ERR_SERVER_CLOSED) {\n debug(\"Multicast response (delayed %dms) was cancelled as the server is about to be shutdown!\", Math.round(response.getTimeSinceCreation()));\n }\n else {\n throw error;\n }\n }\n });\n }\n }\n answerQuestion(question, endpoint, knownAnswers) {\n // RFC 6762 6: The determination of whether a given record answers a given question\n // is made using the standard DNS rules: the record name must match the\n // question name, the record rrtype must match the question qtype unless\n // the qtype is \"ANY\" (255) or the rrtype is \"CNAME\" (5), and the record\n // rrclass must match the question qclass unless the qclass is \"ANY\" (255).\n if (question.class !== 1 /* QClass.IN */ && question.class !== 255 /* QClass.ANY */) {\n // We just publish answers with IN class. So only IN or ANY questions classes will match\n return [];\n }\n const serviceResponses = [];\n let metaQueryResponse = undefined;\n if (question.type === 12 /* QType.PTR */ || question.type === 255 /* QType.ANY */ || question.type === 5 /* QType.CNAME */) {\n const destinations = this.servicePointer.get(question.getLowerCasedName()); // look up the pointer, all entries are dnsLowerCased\n if (destinations) {\n // if it's a pointer name, we handle it here\n for (const data of destinations) {\n // check if the PTR is pointing towards a service, like in questions for PTR '_hap._tcp.local'\n // if that's the case, let the question be answered by the service itself\n const service = this.announcedServices.get(data);\n if (service) {\n if (service.advertisesOnInterface(endpoint.interface)) {\n // call the method for original question, so additionals get added properly\n const response = Responder.answerServiceQuestion(service, question, endpoint, knownAnswers);\n if (response.hasAnswers()) {\n serviceResponses.push(response);\n }\n }\n }\n else {\n if (!metaQueryResponse) {\n metaQueryResponse = new QueryResponse_1.QueryResponse(knownAnswers);\n serviceResponses.unshift(metaQueryResponse);\n }\n // it's probably question for PTR '_services._dns-sd._udp.local'\n // the PTR will just point to something like '_hap._tcp.local' thus no additional records need to be included\n metaQueryResponse.addAnswer(new PTRRecord_1.PTRRecord(question.name, data));\n // we may send out meta queries on interfaces where there aren't any services, because they are\n // restricted to other interfaces.\n }\n }\n return serviceResponses; // if we got in this if-body, it was a pointer name and we handled it correctly\n } /* else if (loweredQuestionName.endsWith(\".in-addr.arpa\") || loweredQuestionName.endsWith(\".ip6.arpa\")) { // reverse address lookup\n const address = ipAddressFromReversAddressName(loweredQuestionName);\n \n for (const service of this.announcedServices.values()) {\n const record = service.reverseAddressMapping(address);\n if (record) {\n mainResponse.addAnswer(record);\n }\n }\n }\n We won't actually respond to reverse address queries.\n This typically confuses responders like avahi, which then over and over try to increment the hostname.\n */\n }\n for (const service of this.announcedServices.values()) {\n if (!service.advertisesOnInterface(endpoint.interface)) {\n continue;\n }\n const response = Responder.answerServiceQuestion(service, question, endpoint, knownAnswers);\n if (response.hasAnswers()) {\n serviceResponses.push(response);\n }\n }\n return serviceResponses;\n }\n static answerServiceQuestion(service, question, endpoint, knownAnswers) {\n // This assumes to be called from answerQuestion inside the Responder class and thus that certain\n // preconditions or special cases are already covered.\n // For one, we assume classes are already matched.\n const response = new QueryResponse_1.QueryResponse(knownAnswers);\n const loweredQuestionName = question.getLowerCasedName();\n const askingAny = question.type === 255 /* QType.ANY */ || question.type === 5 /* QType.CNAME */;\n const addAnswer = response.addAnswer.bind(response);\n const addAdditional = response.addAdditional.bind(response);\n // RFC 6762 6.2. In the event that a device has only IPv4 addresses but no IPv6\n // addresses, or vice versa, then the appropriate NSEC record SHOULD be\n // placed into the additional section, so that queriers can know with\n // certainty that the device has no addresses of that kind.\n if (loweredQuestionName === service.getLowerCasedTypePTR()) {\n if (askingAny || question.type === 12 /* QType.PTR */) {\n const added = response.addAnswer(service.ptrRecord());\n if (added) {\n // only add additionals if answer is not suppressed by the known answer section\n // RFC 6763 12.1: include additionals: srv, txt, a, aaaa\n response.addAdditional(service.txtRecord(), service.srvRecord());\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAdditional);\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAdditional);\n response.addAdditional(service.serviceNSECRecord(), service.addressNSECRecord());\n }\n }\n }\n else if (loweredQuestionName === service.getLowerCasedFQDN()) {\n if (askingAny) {\n response.addAnswer(service.txtRecord());\n const addedSrv = response.addAnswer(service.srvRecord());\n if (addedSrv) {\n // RFC 6763 12.2: include additionals: a, aaaa\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAdditional);\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAdditional);\n response.addAdditional(service.serviceNSECRecord(), service.addressNSECRecord());\n }\n }\n else if (question.type === 33 /* QType.SRV */) {\n const added = response.addAnswer(service.srvRecord());\n if (added) {\n // RFC 6763 12.2: include additionals: a, aaaa\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAdditional);\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAdditional);\n response.addAdditional(service.serviceNSECRecord(true), service.addressNSECRecord());\n }\n }\n else if (question.type === 16 /* QType.TXT */) {\n response.addAnswer(service.txtRecord());\n response.addAdditional(service.serviceNSECRecord());\n // RFC 6763 12.3: not any other additionals\n }\n }\n else if (loweredQuestionName === service.getLowerCasedHostname() || loweredQuestionName + \"local.\" === service.getLowerCasedHostname()) {\n if (askingAny) {\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAnswer);\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAnswer);\n response.addAdditional(service.addressNSECRecord());\n }\n else if (question.type === 1 /* QType.A */) {\n // RFC 6762 6.2 When a Multicast DNS responder places an IPv4 or IPv6 address record\n // (rrtype \"A\" or \"AAAA\") into a response message, it SHOULD also place\n // any records of the other address type with the same name into the\n // additional section, if there is space in the message.\n const added = this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAnswer);\n if (added) {\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAdditional);\n }\n response.addAdditional(service.addressNSECRecord()); // always add the negative response, always assert dominance\n }\n else if (question.type === 28 /* QType.AAAA */) {\n // RFC 6762 6.2 When a Multicast DNS responder places an IPv4 or IPv6 address record\n // (rrtype \"A\" or \"AAAA\") into a response message, it SHOULD also place\n // any records of the other address type with the same name into the\n // additional section, if there is space in the message.\n const added = this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAnswer);\n if (added) {\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAdditional);\n }\n response.addAdditional(service.addressNSECRecord()); // always add the negative response, always assert dominance\n }\n }\n else if (service.getLowerCasedSubtypePTRs()) {\n if (askingAny || question.type === 12 /* QType.PTR */) {\n const dnsLowerSubTypes = service.getLowerCasedSubtypePTRs();\n const index = dnsLowerSubTypes.indexOf(loweredQuestionName);\n if (index !== -1) { // we have a subtype for the question\n const records = service.subtypePtrRecords();\n const record = records[index];\n (0, assert_1.default)(loweredQuestionName === record.name, \"Question Name didn't match selected sub type ptr record!\");\n const added = response.addAnswer(record);\n if (added) {\n // RFC 6763 12.1: include additionals: srv, txt, a, aaaa\n response.addAdditional(service.txtRecord(), service.srvRecord());\n this.addAddressRecords(service, endpoint, 1 /* RType.A */, addAdditional);\n this.addAddressRecords(service, endpoint, 28 /* RType.AAAA */, addAdditional);\n response.addAdditional(service.serviceNSECRecord(), service.addressNSECRecord());\n }\n }\n }\n }\n return response;\n }\n /**\n * This method is a helper method to reduce the complexity inside {@link answerServiceQuestion}.\n * The method calculates which A and AAAA records to be added for a given {@code endpoint} using\n * the records from the provided {@code service}.\n * It will add the records by calling the provided {@code dest} method.\n *\n * @param {CiaoService} service - service which records to be use\n * @param {EndpointInfo} endpoint - endpoint information providing the interface\n * @param {RType.A | RType.AAAA} type - defines the type of records to be added\n * @param {RecordAddMethod} dest - defines the destination which the records should be added\n * @returns true if any records got added\n */\n static addAddressRecords(service, endpoint, type, dest) {\n if (type === 1 /* RType.A */) {\n const record = service.aRecord(endpoint.interface);\n return record ? dest(record) : false;\n }\n else if (type === 28 /* RType.AAAA */) {\n const record = service.aaaaRecord(endpoint.interface);\n const routableRecord = service.aaaaRoutableRecord(endpoint.interface);\n const ulaRecord = service.aaaaUniqueLocalRecord(endpoint.interface);\n let addedAny = false;\n if (record) {\n addedAny = dest(record);\n }\n if (routableRecord) {\n const added = dest(routableRecord);\n addedAny = addedAny || added;\n }\n if (ulaRecord) {\n const added = dest(ulaRecord);\n addedAny = addedAny || added;\n }\n return addedAny;\n }\n else {\n assert_1.default.fail(\"Illegal argument!\");\n }\n }\n}\nexports.Responder = Responder;\n/**\n * @private\n */\nResponder.SERVICE_TYPE_ENUMERATION_NAME = \"_services._dns-sd._udp.local.\";\nResponder.INSTANCES = new Map();\n//# sourceMappingURL=Responder.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NonCompressionLabelCoder = exports.DNSLabelCoder = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nclass DNSLabelCoder {\n constructor(legacyUnicastEncoding) {\n this.trackedLengths = [];\n this.writtenNames = [];\n this.legacyUnicastEncoding = legacyUnicastEncoding || false;\n }\n initBuf(buffer) {\n this.buffer = buffer;\n }\n initRRLocation(recordOffset, rDataOffset, rDataLength) {\n this.startOfRR = recordOffset;\n this.startOfRData = rDataOffset;\n this.rDataLength = rDataLength;\n }\n clearRRLocation() {\n this.startOfRR = undefined;\n this.startOfRData = undefined;\n this.rDataLength = undefined;\n }\n getUncompressedNameLength(name) {\n if (name === \".\") {\n return 1; // root label takes one zero byte\n }\n (0, assert_1.default)(name.endsWith(\".\"), \"Supplied illegal name which doesn't end with the root label!\");\n let length = 0;\n const labels = name.split(\".\");\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label && i < labels.length - 1) {\n assert_1.default.fail(\"Label \" + i + \" in name '\" + name + \"' was empty\");\n }\n length += DNSLabelCoder.getLabelLength(label);\n }\n return length;\n }\n getNameLength(name) {\n if (DNSLabelCoder.DISABLE_COMPRESSION) {\n return this.getUncompressedNameLength(name);\n }\n if (name === \".\") {\n return 1; // root label takes one zero byte and is not compressible\n }\n (0, assert_1.default)(name.endsWith(\".\"), \"Supplied illegal name which doesn't end with the root label!\");\n const labelLengths = name.split(\".\")\n .map(label => DNSLabelCoder.getLabelLength(label));\n const nameLength = {\n name: name,\n length: 0, // total length needed for encoding (with compression enabled)\n labelLengths: labelLengths,\n };\n let candidateSharingLongestSuffix = undefined;\n let longestSuffixLength = 0; // amount of labels which are identical\n // pointers MUST only point to PRIOR label locations\n for (let i = 0; i < this.trackedLengths.length; i++) {\n const element = this.trackedLengths[i];\n const suffixLength = DNSLabelCoder.computeLabelSuffixLength(element.name, name);\n // it is very important that this is an GREATER and not just a GREATER EQUAL!!!!\n // don't change anything unless you fully understand all implications (0, and big comment block below)\n if (suffixLength > longestSuffixLength) {\n candidateSharingLongestSuffix = element;\n longestSuffixLength = suffixLength;\n }\n }\n let length = 0;\n if (candidateSharingLongestSuffix) {\n // in theory, it is possible that the candidate has a pointer which \"fromIndex\" is smaller than\n // the \"toIndex\" we are pointing to below. This could result in that we point to a location which\n // never gets written into the buffer, thus we can't point to it.\n // But as we always start in order (with the first element in our array; see for loop above)\n // we will always find the label first, which such a theoretical candidate is also pointing at\n const pointingFromIndex = labelLengths.length - 1 - longestSuffixLength; // -1 as the empty root label is always included\n for (let i = 0; i < pointingFromIndex; i++) {\n length += labelLengths[i];\n }\n length += 2; // 2 byte for the pointer\n }\n else {\n for (let i = 0; i < labelLengths.length; i++) {\n length += labelLengths[i];\n }\n }\n nameLength.length = length;\n this.trackedLengths.push(nameLength);\n return nameLength.length;\n }\n encodeUncompressedName(name, offset) {\n if (!this.buffer) {\n assert_1.default.fail(\"Illegal state. Buffer not initialized!\");\n }\n return DNSLabelCoder.encodeUncompressedName(name, this.buffer, offset);\n }\n static encodeUncompressedName(name, buffer, offset) {\n (0, assert_1.default)(name.endsWith(\".\"), \"Name does not end with the root label\");\n const oldOffset = offset;\n const labels = name === \".\"\n ? [\"\"]\n : name.split(\".\");\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (label === \"\") {\n (0, assert_1.default)(i === labels.length - 1, \"Encountered root label being not at the end of the domain name\");\n buffer.writeUInt8(0, offset++); // write a terminating zero\n break;\n }\n // write length byte followed by the label data\n const length = buffer.write(label, offset + 1);\n buffer.writeUInt8(length, offset);\n offset += length + 1;\n }\n return offset - oldOffset; // written bytes\n }\n encodeName(name, offset) {\n if (DNSLabelCoder.DISABLE_COMPRESSION) {\n return this.encodeUncompressedName(name, offset);\n }\n if (!this.buffer) {\n assert_1.default.fail(\"Illegal state. Buffer not initialized!\");\n }\n if (name === \".\") {\n this.buffer.writeUInt8(0, offset); // write a terminating zero\n return 1;\n }\n const oldOffset = offset;\n const labels = name.split(\".\");\n const writtenName = {\n name: name,\n writtenLabels: new Array(labels.length).fill(-1), // init with \"-1\" meaning unknown location\n };\n let candidateSharingLongestSuffix = undefined;\n let longestSuffixLength = 0; // amount of labels which are identical\n for (let i = 0; i < this.writtenNames.length; i++) {\n const element = this.writtenNames[i];\n const suffixLength = DNSLabelCoder.computeLabelSuffixLength(element.name, name);\n // it is very important that this is an GREATER and not just a GREATER EQUAL!!!!\n // don't change anything unless you fully understand all implications (0, and big comment block below)\n if (suffixLength > longestSuffixLength) {\n candidateSharingLongestSuffix = element;\n longestSuffixLength = suffixLength;\n }\n }\n if (candidateSharingLongestSuffix) {\n // in theory, it is possible that the candidate has a pointer which \"fromIndex\" is smaller than\n // the \"toIndex\" we are pointing to below. This could result in that we point to a location which\n // never gets written into the buffer, thus we can't point to it.\n // But as we always start in order (with the first element in our array; see for loop above)\n // we will always find the label first, which such a theoretical candidate is also pointing at\n const pointingFromIndex = labels.length - 1 - longestSuffixLength; // -1 as the empty root label is always included\n const pointingToIndex = candidateSharingLongestSuffix.writtenLabels.length - 1 - longestSuffixLength;\n for (let i = 0; i < pointingFromIndex; i++) {\n writtenName.writtenLabels[i] = offset;\n offset += DNSLabelCoder.writeLabel(labels[i], this.buffer, offset);\n }\n const pointerDestination = candidateSharingLongestSuffix.writtenLabels[pointingToIndex];\n (0, assert_1.default)(pointerDestination !== -1, \"Label which was pointed at wasn't yet written to the buffer!\");\n (0, assert_1.default)(pointerDestination <= DNSLabelCoder.NOT_POINTER_MASK, \"Pointer exceeds to length of a maximum of 14 bits\");\n (0, assert_1.default)(pointerDestination < offset, \"Pointer can only point to a prior location\");\n const pointer = DNSLabelCoder.POINTER_MASK | pointerDestination;\n this.buffer.writeUInt16BE(pointer, offset);\n offset += 2;\n }\n else {\n for (let i = 0; i < labels.length; i++) {\n writtenName.writtenLabels[i] = offset;\n offset += DNSLabelCoder.writeLabel(labels[i], this.buffer, offset);\n }\n }\n this.writtenNames.push(writtenName);\n return offset - oldOffset; // written bytes\n }\n decodeName(offset, resolvePointers = true) {\n if (!this.buffer) {\n assert_1.default.fail(\"Illegal state. Buffer not initialized!\");\n }\n const oldOffset = offset;\n let name = \"\";\n for (;;) {\n const length = this.buffer.readUInt8(offset++);\n if (length === 0) { // zero byte to terminate the name\n name += \".\";\n break; // root label marks end of name\n }\n const labelTypePattern = length & DNSLabelCoder.POINTER_MASK_ONE_BYTE;\n if (labelTypePattern) {\n if (labelTypePattern === DNSLabelCoder.POINTER_MASK_ONE_BYTE) {\n // we got a pointer here\n const pointer = this.buffer.readUInt16BE(offset - 1) & DNSLabelCoder.NOT_POINTER_MASK; // extract the offset\n offset++; // increment for the second byte of the pointer\n if (!resolvePointers) {\n name += name ? \".~\" : \"~\";\n break;\n }\n // if we would allow pointers to a later location, we MUST ensure that we don't end up in an endless loop\n (0, assert_1.default)(pointer < oldOffset, \"Pointer at \" + (offset - 2) + \" MUST point to a prior location!\");\n name += (name ? \".\" : \"\") + this.decodeName(pointer).data; // recursively decode the rest of the name\n break; // pointer marks end of name\n }\n else if (labelTypePattern === DNSLabelCoder.LOCAL_COMPRESSION_ONE_BYTE) {\n let localPointer = this.buffer.readUInt16BE(offset - 1) & DNSLabelCoder.NOT_POINTER_MASK;\n offset++; // increment for the second byte of the pointer;\n if (!resolvePointers) {\n name += name ? \".~\" : \"~\";\n break;\n }\n if (localPointer >= 0 && localPointer < 255) { // 255 is reserved\n (0, assert_1.default)(this.startOfRR !== undefined, \"Cannot decompress locally compressed name as record is not initialized!\");\n localPointer += this.startOfRR;\n (0, assert_1.default)(localPointer < oldOffset, \"LocalPointer <255 at \" + (offset - 2) + \" MUST point to a prior location!\");\n name += (name ? \".\" : \"\") + this.decodeName(localPointer).data; // recursively decode the rest of the name\n }\n else if (localPointer >= 256) {\n (0, assert_1.default)(this.startOfRData !== undefined && this.rDataLength !== undefined, \"Cannot decompress locally compressed name as record is not initialized!\");\n localPointer -= -256; // subtract the offset 256\n localPointer += this.startOfRData;\n (0, assert_1.default)(localPointer < oldOffset, \"LocationPoint >265 at \" + (offset + 2) + \" MUST point to a prior location!\");\n name += (name ? \".\" : \"\") + this.decodeName(localPointer).data; // recursively decode the rest of the name\n }\n else {\n assert_1.default.fail(\"Encountered unknown pointer range \" + localPointer);\n }\n break; // pointer marks end of name\n }\n else if (labelTypePattern === DNSLabelCoder.EXTENDED_LABEL_TYPE_ONE_BYTE) {\n const extendedLabelType = length & DNSLabelCoder.NOT_POINTER_MASK_ONE_BYTE;\n assert_1.default.fail(\"Received extended label type \" + extendedLabelType + \" at \" + (offset - 1));\n }\n else {\n assert_1.default.fail(\"Encountered unknown pointer type: \" + Buffer.from([labelTypePattern >> 6]).toString(\"hex\") + \" (with original byte \" +\n Buffer.from([length]).toString(\"hex\") + \")\");\n }\n }\n const label = this.buffer.toString(\"utf-8\", offset, offset + length);\n offset += length;\n name += (name ? \".\" : \"\") + label;\n }\n return {\n data: name,\n readBytes: offset - oldOffset,\n };\n }\n static getLabelLength(label) {\n if (!label) { // empty label aka root label\n return 1; // root label takes one zero byte\n }\n else {\n const byteLength = Buffer.byteLength(label);\n (0, assert_1.default)(byteLength <= 63, \"Label cannot be longer than 63 bytes (\" + label + \")\");\n return 1 + byteLength; // length byte + label data\n }\n }\n static writeLabel(label, buffer, offset) {\n if (!label) {\n buffer.writeUInt8(0, offset);\n return 1;\n }\n else {\n const length = buffer.write(label, offset + 1);\n buffer.writeUInt8(length, offset);\n return length + 1;\n }\n }\n static computeLabelSuffixLength(a, b) {\n (0, assert_1.default)(a.length !== 0 && b.length !== 0, \"Encountered empty name when comparing suffixes!\");\n const lastAIndex = a.length - 1;\n const lastBIndex = b.length - 1;\n let equalLabels = 0;\n let exitByBreak = false;\n // we start with i=1 as the last character will always be the root label terminator \".\"\n for (let i = 1; i <= lastAIndex && i <= lastBIndex; i++) {\n // we are comparing both strings backwards\n const aChar = a.charAt(lastAIndex - i);\n const bChar = b.charAt(lastBIndex - i);\n (0, assert_1.default)(!!aChar && !!bChar, \"Seemingly encountered out of bounds trying to calculate suffixes\");\n if (aChar !== bChar) {\n exitByBreak = true;\n break; // encountered the first character to differ\n }\n else if (aChar === \".\") {\n // we reached the label terminator, thus we count up the labels which are equal\n equalLabels++;\n }\n }\n if (!exitByBreak) {\n equalLabels++; // accommodate for the top level label (fqdn doesn't start with a dot)\n }\n return equalLabels;\n }\n}\nexports.DNSLabelCoder = DNSLabelCoder;\nDNSLabelCoder.DISABLE_COMPRESSION = false;\n// RFC 1035 4.1.4. Message compression:\n// In order to reduce the size of messages, the domain system utilizes a\n// compression scheme which eliminates the repetition of domain names in a\n// message. In this scheme, an entire domain name or a list of labels at\n// the end of a domain name is replaced with a pointer to a PRIOR occurrence\n// of the same name.\n//\n// The compression scheme allows a domain name in a message to be\n// represented as either:\n// - a sequence of labels ending in a zero octet\n// - a pointer\n// - a sequence of labels ending with a pointer\n// RFC 6762 name compression for rdata should be used in: NS, CNAME, PTR, DNAME, SOA, MX, AFSDB, RT, KX, RP, PX, SRV, NSEC\nDNSLabelCoder.POINTER_MASK = 0xC000; // 2 bytes, starting with 11\nDNSLabelCoder.POINTER_MASK_ONE_BYTE = 0xC0; // same deal as above, just on a 1 byte level\nDNSLabelCoder.LOCAL_COMPRESSION_ONE_BYTE = 0x80; // \"10\" label type https://tools.ietf.org/html/draft-ietf-dnsind-local-compression-05#section-4\nDNSLabelCoder.EXTENDED_LABEL_TYPE_ONE_BYTE = 0x40; // \"01\" edns extended label type https://tools.ietf.org/html/rfc6891#section-4.2\nDNSLabelCoder.NOT_POINTER_MASK = 0x3FFF;\nDNSLabelCoder.NOT_POINTER_MASK_ONE_BYTE = 0x3F;\nclass NonCompressionLabelCoder extends DNSLabelCoder {\n getNameLength(name) {\n return this.getUncompressedNameLength(name);\n }\n encodeName(name, offset) {\n return this.encodeUncompressedName(name, offset);\n }\n}\nexports.NonCompressionLabelCoder = NonCompressionLabelCoder;\nNonCompressionLabelCoder.INSTANCE = new NonCompressionLabelCoder();\n//# sourceMappingURL=DNSLabelCoder.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DNSPacket = exports.PacketType = exports.QClass = exports.RClass = exports.QType = exports.RType = exports.RCode = exports.OpCode = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst fast_deep_equal_1 = tslib_1.__importDefault(require(\"fast-deep-equal\"));\nconst dns_string_utils_1 = require(\"./dns-string-utils\");\nconst DNSLabelCoder_1 = require(\"./DNSLabelCoder\");\nconst Question_1 = require(\"./Question\");\nrequire(\"./records\");\nconst ResourceRecord_1 = require(\"./ResourceRecord\");\nvar OpCode;\n(function (OpCode) {\n OpCode[OpCode[\"QUERY\"] = 0] = \"QUERY\";\n // incomplete list\n})(OpCode || (exports.OpCode = OpCode = {}));\nvar RCode;\n(function (RCode) {\n RCode[RCode[\"NoError\"] = 0] = \"NoError\";\n // incomplete list\n})(RCode || (exports.RCode = RCode = {}));\nvar RType;\n(function (RType) {\n RType[RType[\"A\"] = 1] = \"A\";\n RType[RType[\"CNAME\"] = 5] = \"CNAME\";\n RType[RType[\"PTR\"] = 12] = \"PTR\";\n RType[RType[\"TXT\"] = 16] = \"TXT\";\n RType[RType[\"AAAA\"] = 28] = \"AAAA\";\n RType[RType[\"SRV\"] = 33] = \"SRV\";\n RType[RType[\"OPT\"] = 41] = \"OPT\";\n RType[RType[\"NSEC\"] = 47] = \"NSEC\";\n // incomplete list\n})(RType || (exports.RType = RType = {}));\nvar QType;\n(function (QType) {\n QType[QType[\"A\"] = 1] = \"A\";\n QType[QType[\"CNAME\"] = 5] = \"CNAME\";\n QType[QType[\"PTR\"] = 12] = \"PTR\";\n QType[QType[\"TXT\"] = 16] = \"TXT\";\n QType[QType[\"AAAA\"] = 28] = \"AAAA\";\n QType[QType[\"SRV\"] = 33] = \"SRV\";\n // OPT = 41, // RFC 6891\n QType[QType[\"NSEC\"] = 47] = \"NSEC\";\n QType[QType[\"ANY\"] = 255] = \"ANY\";\n // incomplete list\n})(QType || (exports.QType = QType = {}));\nvar RClass;\n(function (RClass) {\n RClass[RClass[\"IN\"] = 1] = \"IN\";\n // incomplete list\n})(RClass || (exports.RClass = RClass = {}));\nvar QClass;\n(function (QClass) {\n QClass[QClass[\"IN\"] = 1] = \"IN\";\n QClass[QClass[\"ANY\"] = 255] = \"ANY\";\n // incomplete list\n})(QClass || (exports.QClass = QClass = {}));\nvar PacketType;\n(function (PacketType) {\n PacketType[PacketType[\"QUERY\"] = 0] = \"QUERY\";\n PacketType[PacketType[\"RESPONSE\"] = 1] = \"RESPONSE\";\n})(PacketType || (exports.PacketType = PacketType = {}));\nfunction isQuery(query) {\n return \"answers\" in query;\n}\nfunction isProbeQuery(query) {\n return \"authorities\" in query;\n}\nclass DNSPacket {\n constructor(definition) {\n this.questions = new Map();\n this.answers = new Map();\n this.authorities = new Map();\n this.additionals = new Map();\n this.estimatedEncodingLength = 0; // upper bound for the resulting encoding length, should only be called via the getter\n this.lastCalculatedLength = 0;\n this.lengthDirty = true;\n this.id = definition.id || 0;\n this.legacyUnicastEncoding = definition.legacyUnicast || false;\n this.type = definition.type;\n this.opcode = definition.opcode || 0 /* OpCode.QUERY */;\n this.flags = definition.flags || {};\n this.rcode = definition.rCode || 0 /* RCode.NoError */;\n if (this.type === 1 /* PacketType.RESPONSE */) {\n this.flags.authoritativeAnswer = true; // RFC 6763 18.4 AA is always set for responses in mdns\n }\n if (definition.questions) {\n this.addQuestions(...definition.questions);\n }\n if (definition.answers) {\n this.addAnswers(...definition.answers);\n }\n if (definition.authorities) {\n this.addAuthorities(...definition.authorities);\n }\n if (definition.additionals) {\n this.addAdditionals(...definition.additionals);\n }\n }\n static createDNSQueryPacket(definition, udpPayloadSize = this.UDP_PAYLOAD_SIZE_IPV4) {\n const packets = this.createDNSQueryPackets(definition, udpPayloadSize);\n (0, assert_1.default)(packets.length === 1, \"Cannot user short method createDNSQueryPacket when query packets are more than one: is \" + packets.length);\n return packets[0];\n }\n static createDNSQueryPackets(definition, udpPayloadSize = this.UDP_PAYLOAD_SIZE_IPV4) {\n const packets = [];\n // packet is like the \"main\" packet\n const packet = new DNSPacket({\n type: 0 /* PacketType.QUERY */,\n questions: definition.questions,\n additionals: isQuery(definition) ? definition.additionals : undefined, // OPT record is included in additionals section\n });\n packets.push(packet);\n if (packet.getEstimatedEncodingLength() > udpPayloadSize) {\n const compressedLength = packet.getEncodingLength(); // calculating the real length will update the estimated property as well\n if (compressedLength > udpPayloadSize) {\n // if we are still above the payload size we have a problem\n assert_1.default.fail(\"Cannot send query where already the query section is exceeding the udpPayloadSize (\" + compressedLength + \">\" + udpPayloadSize + \")!\");\n }\n }\n // related https://en.wikipedia.org/wiki/Knapsack_problem\n if (isQuery(definition) && definition.answers) {\n let currentPacket = packet;\n let i = 0;\n const answers = definition.answers.concat([]); // concat basically creates a copy of the array\n // sort the answers ascending on their encoding length; otherwise we would need to check if a packets fits in a previously created packet\n answers.sort((a, b) => {\n return a.getEncodingLength(DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE) - b.getEncodingLength(DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE);\n });\n // in the loop below, we check if we need to truncate the list of known-answers in the query\n while (i < answers.length) {\n for (; i < answers.length; i++) {\n const answer = answers[i];\n const estimatedSize = answer.getEncodingLength(DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE);\n if (packet.getEstimatedEncodingLength() + estimatedSize <= udpPayloadSize) { // size check on estimated calculations\n currentPacket.addAnswers(answer);\n }\n else if (packet.getEncodingLength() + estimatedSize <= udpPayloadSize) { // check if the record may fit when message compression is used.\n // we may still have a false positive here, as they currently can't compute the REAL encoding for the answer\n // record, thus we rely on the estimated size\n currentPacket.addAnswers(answer);\n }\n else {\n if (currentPacket.questions.size === 0 && currentPacket.answers.size === 0) {\n // we encountered a record which is too big and can't fit in a udpPayloadSize sized packet\n // RFC 6762 17. In the case of a single Multicast DNS resource record that is too\n // large to fit in a single MTU-sized multicast response packet, a\n // Multicast DNS responder SHOULD send the resource record alone, in a\n // single IP datagram, using multiple IP fragments.\n packet.addAnswers(answer);\n }\n break;\n }\n }\n if (i < answers.length) { // if there are more records left, we need to truncate the packet again\n currentPacket.flags.truncation = true; // first of all, mark the previous packet as truncated\n currentPacket = new DNSPacket({ type: 0 /* PacketType.QUERY */ });\n packets.push(currentPacket);\n }\n }\n }\n else if (isProbeQuery(definition) && definition.authorities) {\n packet.addAuthorities(...definition.authorities);\n const compressedLength = packet.getEncodingLength();\n if (compressedLength > udpPayloadSize) {\n assert_1.default.fail(`Probe query packet exceeds the mtu size (${compressedLength}>${udpPayloadSize}). Can't split probe queries at the moment!`);\n }\n } // otherwise, the packet consist of only questions\n return packets;\n }\n static createDNSResponsePacketsFromRRSet(definition, udpPayloadSize = this.UDP_PAYLOAD_SIZE_IPV4) {\n const packet = new DNSPacket({\n id: definition.id,\n legacyUnicast: definition.legacyUnicast,\n type: 1 /* PacketType.RESPONSE */,\n flags: { authoritativeAnswer: true }, // RFC 6763 18.4 AA is always set for responses in mdns\n // possible questions sent back to an unicast querier (unicast dns contain only one question, so no size problem here)\n questions: definition.questions,\n answers: definition.answers,\n additionals: definition.additionals,\n });\n if (packet.getEncodingLength() > udpPayloadSize) {\n assert_1.default.fail(\"Couldn't construct a dns response packet from a rr set which fits in an udp payload sized packet!\");\n }\n return packet;\n }\n canBeCombinedWith(packet, udpPayloadSize = DNSPacket.UDP_PAYLOAD_SIZE_IPV4) {\n // packet header must be identical\n return this.id === packet.id && this.type === packet.type\n && this.opcode === packet.opcode && (0, fast_deep_equal_1.default)(this.flags, packet.flags)\n && this.rcode === packet.rcode\n // and the data must fit into a udpPayloadSize sized packet\n && this.getEncodingLength() + packet.getEncodingLength() <= udpPayloadSize;\n }\n combineWith(packet) {\n this.setLegacyUnicastEncoding(this.legacyUnicastEncoding || packet.legacyUnicastEncoding);\n this.addRecords(this.questions, packet.questions.values());\n this.addRecords(this.answers, packet.answers.values(), this.additionals);\n this.addRecords(this.authorities, packet.authorities.values());\n this.addRecords(this.additionals, packet.additionals.values());\n }\n addQuestions(...questions) {\n return this.addRecords(this.questions, questions);\n }\n addAnswers(...answers) {\n return this.addRecords(this.answers, answers, this.additionals);\n }\n addAuthorities(...authorities) {\n return this.addRecords(this.authorities, authorities);\n }\n addAdditionals(...additionals) {\n return this.addRecords(this.additionals, additionals);\n }\n addRecords(recordList, added, removeFromWhenAdded) {\n let addedAny = false;\n for (const record of added) {\n if (recordList.has(record.asString())) {\n continue;\n }\n if (this.estimatedEncodingLength) {\n this.estimatedEncodingLength += record.getEncodingLength(DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE);\n }\n recordList.set(record.asString(), record);\n addedAny = true;\n this.lengthDirty = true;\n if (removeFromWhenAdded) {\n removeFromWhenAdded.delete(record.asString());\n }\n }\n return addedAny;\n }\n setLegacyUnicastEncoding(legacyUnicastEncoding) {\n if (this.legacyUnicastEncoding !== legacyUnicastEncoding) {\n this.lengthDirty = true; // above option changes length of SRV records\n }\n this.legacyUnicastEncoding = legacyUnicastEncoding;\n }\n legacyUnicastEncodingEnabled() {\n return this.legacyUnicastEncoding;\n }\n getEstimatedEncodingLength() {\n if (this.estimatedEncodingLength) {\n return this.estimatedEncodingLength;\n }\n const labelCoder = DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE;\n let length = DNSPacket.DNS_PACKET_HEADER_SIZE;\n for (const record of this.questions.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.answers.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.authorities.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.additionals.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n this.estimatedEncodingLength = length;\n return length;\n }\n getEncodingLength(coder) {\n if (!this.lengthDirty) {\n return this.lastCalculatedLength;\n }\n const labelCoder = coder || new DNSLabelCoder_1.DNSLabelCoder(this.legacyUnicastEncoding);\n let length = DNSPacket.DNS_PACKET_HEADER_SIZE;\n for (const record of this.questions.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.answers.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.authorities.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n for (const record of this.additionals.values()) {\n length += record.getEncodingLength(labelCoder);\n }\n this.lengthDirty = false; // reset dirty flag\n this.lastCalculatedLength = length;\n this.estimatedEncodingLength = length;\n return length;\n }\n encode() {\n const labelCoder = new DNSLabelCoder_1.DNSLabelCoder(this.legacyUnicastEncoding);\n const length = this.getEncodingLength(labelCoder);\n const buffer = Buffer.allocUnsafe(length);\n labelCoder.initBuf(buffer);\n let offset = 0;\n buffer.writeUInt16BE(this.id, offset);\n offset += 2;\n let flags = (this.type << 15) | (this.opcode << 11) | this.rcode;\n if (this.flags.authoritativeAnswer) {\n flags |= DNSPacket.AUTHORITATIVE_ANSWER_MASK;\n }\n if (this.flags.truncation) {\n flags |= DNSPacket.TRUNCATION_MASK;\n }\n if (this.flags.recursionDesired) {\n flags |= DNSPacket.RECURSION_DESIRED_MASK;\n }\n if (this.flags.recursionAvailable) {\n flags |= DNSPacket.RECURSION_AVAILABLE_MASK;\n }\n if (this.flags.zero) {\n flags |= DNSPacket.ZERO_HEADER_MASK;\n }\n if (this.flags.authenticData) {\n flags |= DNSPacket.AUTHENTIC_DATA_MASK;\n }\n if (this.flags.checkingDisabled) {\n flags |= DNSPacket.CHECKING_DISABLED_MASK;\n }\n buffer.writeUInt16BE(flags, offset);\n offset += 2;\n buffer.writeUInt16BE(this.questions.size, offset);\n offset += 2;\n buffer.writeUInt16BE(this.answers.size, offset);\n offset += 2;\n buffer.writeUInt16BE(this.authorities.size, offset);\n offset += 2;\n buffer.writeUInt16BE(this.additionals.size, offset);\n offset += 2;\n for (const question of this.questions.values()) {\n const length = question.encode(labelCoder, buffer, offset);\n offset += length;\n }\n for (const record of this.answers.values()) {\n const length = record.encode(labelCoder, buffer, offset);\n offset += length;\n }\n for (const record of this.authorities.values()) {\n const length = record.encode(labelCoder, buffer, offset);\n offset += length;\n }\n for (const record of this.additionals.values()) {\n const length = record.encode(labelCoder, buffer, offset);\n offset += length;\n }\n (0, assert_1.default)(offset === buffer.length, \"Bytes written didn't match the buffer size!\");\n return buffer;\n }\n static decode(context, buffer, offset = 0) {\n const labelCoder = new DNSLabelCoder_1.DNSLabelCoder();\n labelCoder.initBuf(buffer);\n const id = buffer.readUInt16BE(offset);\n offset += 2;\n const flags = buffer.readUInt16BE(offset);\n offset += 2;\n const questionLength = buffer.readUInt16BE(offset);\n offset += 2;\n const answerLength = buffer.readUInt16BE(offset);\n offset += 2;\n const authoritiesLength = buffer.readUInt16BE(offset);\n offset += 2;\n const additionalsLength = buffer.readUInt16BE(offset);\n offset += 2;\n const questions = [];\n const answers = [];\n const authorities = [];\n const additionals = [];\n offset += DNSPacket.decodeList(context, labelCoder, buffer, offset, questionLength, Question_1.Question.decode.bind(Question_1.Question), questions);\n offset += DNSPacket.decodeList(context, labelCoder, buffer, offset, answerLength, ResourceRecord_1.ResourceRecord.decode.bind(ResourceRecord_1.ResourceRecord), answers);\n offset += DNSPacket.decodeList(context, labelCoder, buffer, offset, authoritiesLength, ResourceRecord_1.ResourceRecord.decode.bind(ResourceRecord_1.ResourceRecord), authorities);\n offset += DNSPacket.decodeList(context, labelCoder, buffer, offset, additionalsLength, ResourceRecord_1.ResourceRecord.decode.bind(ResourceRecord_1.ResourceRecord), additionals);\n (0, assert_1.default)(offset === buffer.length, \"Didn't read the full buffer (offset=\" + offset + \", length=\" + buffer.length + \")\");\n const qr = (flags >> 15);\n const opcode = ((flags >> 11) & 0xf);\n const rCode = (flags & 0xf);\n const packetFlags = {};\n if (flags & this.AUTHORITATIVE_ANSWER_MASK) {\n packetFlags.authoritativeAnswer = true;\n }\n if (flags & this.TRUNCATION_MASK) {\n packetFlags.truncation = true;\n }\n if (flags & this.RECURSION_DESIRED_MASK) {\n packetFlags.recursionDesired = true;\n }\n if (flags & this.RECURSION_AVAILABLE_MASK) {\n packetFlags.recursionAvailable = true;\n }\n if (flags & this.ZERO_HEADER_MASK) {\n packetFlags.zero = true;\n }\n if (flags & this.AUTHENTIC_DATA_MASK) {\n packetFlags.authenticData = true;\n }\n if (flags & this.CHECKING_DISABLED_MASK) {\n packetFlags.checkingDisabled = true;\n }\n return new DNSPacket({\n id: id,\n type: qr,\n opcode: opcode,\n rCode: rCode,\n flags: packetFlags,\n questions: questions,\n answers: answers,\n authorities: authorities,\n additionals: additionals,\n });\n }\n static decodeList(context, coder, buffer, offset, length, decoder, destination) {\n const oldOffset = offset;\n for (let i = 0; i < length; i++) {\n const decoded = decoder(context, coder, buffer, offset);\n offset += decoded.readBytes;\n if (decoded.data) { // if the rdata is not supported by us, or we encountered a parsing error, we ignore the record\n destination.push(decoded.data);\n }\n }\n return offset - oldOffset;\n }\n asLoggingString(udpPayloadSize) {\n let answerString = \"\";\n let additionalsString = \"\";\n for (const record of this.answers.values()) {\n if (answerString) {\n answerString += \",\";\n }\n answerString += (0, dns_string_utils_1.dnsTypeToString)(record.type);\n }\n for (const record of this.additionals.values()) {\n if (additionalsString) {\n additionalsString += \",\";\n }\n additionalsString += (0, dns_string_utils_1.dnsTypeToString)(record.type);\n }\n const optionsStrings = [];\n if (this.legacyUnicastEncodingEnabled()) {\n optionsStrings.push(\"U\");\n }\n if (udpPayloadSize) {\n optionsStrings.push(\"UPS: \" + udpPayloadSize);\n }\n const optionsString = optionsStrings.length !== 0 ? ` (${optionsStrings})` : \"\";\n return `[${answerString}] answers and [${additionalsString}] additionals with size ${this.getEncodingLength()}B${optionsString}`;\n }\n}\nexports.DNSPacket = DNSPacket;\nDNSPacket.UDP_PAYLOAD_SIZE_IPV4 = (process.env.CIAO_UPS ? parseInt(process.env.CIAO_UPS) : 1440);\n// noinspection JSUnusedGlobalSymbols\nDNSPacket.UDP_PAYLOAD_SIZE_IPV6 = (process.env.CIAO_UPS ? parseInt(process.env.CIAO_UPS) : 1440);\nDNSPacket.AUTHORITATIVE_ANSWER_MASK = 0x400;\nDNSPacket.TRUNCATION_MASK = 0x200;\nDNSPacket.RECURSION_DESIRED_MASK = 0x100;\nDNSPacket.RECURSION_AVAILABLE_MASK = 0x80;\nDNSPacket.ZERO_HEADER_MASK = 0x40;\nDNSPacket.AUTHENTIC_DATA_MASK = 0x20;\nDNSPacket.CHECKING_DISABLED_MASK = 0x10;\n// 2 bytes ID, 2 bytes flags, 2 bytes question count, 2 bytes answer count, 2 bytes authorities count; 2 bytes additionals count\nDNSPacket.DNS_PACKET_HEADER_SIZE = 12;\n//# sourceMappingURL=DNSPacket.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Question = void 0;\nconst dns_equal_1 = require(\"../util/dns-equal\");\nclass Question {\n constructor(name, type, unicastResponseFlag = false, clazz = 1 /* QClass.IN */) {\n this.unicastResponseFlag = false;\n if (!name.endsWith(\".\")) {\n name += \".\";\n }\n this.name = name;\n this.type = type;\n this.class = clazz;\n this.unicastResponseFlag = unicastResponseFlag;\n }\n getLowerCasedName() {\n return this.lowerCasedName || (this.lowerCasedName = (0, dns_equal_1.dnsLowerCase)(this.name));\n }\n getEncodingLength(coder) {\n return coder.getNameLength(this.name) + 4; // 2 bytes type; 2 bytes class\n }\n encode(coder, buffer, offset) {\n const oldOffset = offset;\n const nameLength = coder.encodeName(this.name, offset);\n offset += nameLength;\n buffer.writeUInt16BE(this.type, offset);\n offset += 2;\n let qClass = this.class;\n if (this.unicastResponseFlag) {\n qClass |= Question.QU_MASK;\n }\n buffer.writeUInt16BE(qClass, offset);\n offset += 2;\n return offset - oldOffset; // written bytes\n }\n clone() {\n return new Question(this.name, this.type, this.unicastResponseFlag, this.class);\n }\n asString() {\n return `Q ${this.name} ${this.type} ${this.class}`;\n }\n static decode(context, coder, buffer, offset) {\n const oldOffset = offset;\n const decodedName = coder.decodeName(offset);\n offset += decodedName.readBytes;\n const type = buffer.readUInt16BE(offset);\n offset += 2;\n const qClass = buffer.readUInt16BE(offset);\n offset += 2;\n const clazz = (qClass & this.NOT_QU_MASK);\n const quFlag = !!(qClass & this.QU_MASK);\n const question = new Question(decodedName.data, type, quFlag, clazz);\n return {\n data: question,\n readBytes: offset - oldOffset,\n };\n }\n}\nexports.Question = Question;\nQuestion.QU_MASK = 0x8000; // 2 bytes, first bit set\nQuestion.NOT_QU_MASK = 0x7FFF;\n//# sourceMappingURL=Question.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResourceRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst dns_equal_1 = require(\"../util/dns-equal\");\nconst dns_string_utils_1 = require(\"./dns-string-utils\");\nconst DNSLabelCoder_1 = require(\"./DNSLabelCoder\");\nconst debug = (0, debug_1.default)(\"ciao:decoder\");\nclass ResourceRecord {\n constructor(name, type, ttl = ResourceRecord.RR_DEFAULT_TTL, flushFlag = false, clazz = 1 /* RClass.IN */) {\n this.flushFlag = false;\n if (typeof name === \"string\") {\n if (!name.endsWith(\".\")) {\n name = name + \".\";\n }\n this.name = name;\n this.type = type;\n this.class = clazz;\n this.ttl = ttl;\n this.flushFlag = flushFlag;\n }\n else {\n this.name = name.name;\n this.type = name.type;\n this.class = name.class;\n this.ttl = name.ttl;\n this.flushFlag = name.flushFlag;\n }\n }\n getLowerCasedName() {\n return this.lowerCasedName || (this.lowerCasedName = (0, dns_equal_1.dnsLowerCase)(this.name));\n }\n getEncodingLength(coder) {\n return coder.getNameLength(this.name)\n + 10 // 2 bytes TYPE; 2 bytes class, 4 bytes TTL, 2 bytes RDLength\n + this.getRDataEncodingLength(coder);\n }\n encode(coder, buffer, offset) {\n const oldOffset = offset;\n const nameLength = coder.encodeName(this.name, offset);\n offset += nameLength;\n buffer.writeUInt16BE(this.type, offset);\n offset += 2;\n let rClass = this.class;\n if (this.flushFlag) {\n // for pseudo records like OPT, TSIG, TKEY, SIG0 the top bit should not be interpreted as the flush flag\n // though we do not support those (OPT seems to be the only used, though no idea for what [by Apple for mdns])\n rClass |= ResourceRecord.FLUSH_MASK;\n }\n buffer.writeUInt16BE(rClass, offset);\n offset += 2;\n buffer.writeUInt32BE(this.ttl, offset);\n offset += 4;\n const dataLength = this.encodeRData(coder, buffer, offset + 2);\n buffer.writeUInt16BE(dataLength, offset);\n offset += 2 + dataLength;\n return offset - oldOffset; // written bytes\n }\n getRawData() {\n const coder = DNSLabelCoder_1.NonCompressionLabelCoder.INSTANCE; // this forces uncompressed names\n const length = this.getRDataEncodingLength(coder);\n const buffer = Buffer.allocUnsafe(length);\n coder.initBuf(buffer);\n const writtenBytes = this.encodeRData(coder, buffer, 0);\n (0, assert_1.default)(writtenBytes === buffer.length, \"Didn't completely write to the buffer! (\" + writtenBytes + \"!=\" + buffer.length + \")\");\n coder.initBuf(); // reset buffer to undefined\n return buffer;\n }\n static clone(records) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n return records.map(record => record.clone());\n }\n getRecordRepresentation() {\n return {\n name: this.name,\n type: this.type,\n class: this.class,\n ttl: this.ttl,\n flushFlag: this.flushFlag,\n };\n }\n /**\n * Returns if this and the supplied record are the same (ignoring ttl and flush flag)\n * @param record\n */\n aboutEqual(record) {\n return this.type === record.type && this.name === record.name && this.class === record.class\n && this.dataEquals(record);\n }\n representsSameData(record) {\n return this.type === record.type && this.name === record.name && this.class === record.class;\n }\n asString() {\n // same as aboutEqual, ttl is not included\n return `RR ${this.name} ${this.type} ${this.class} ${this.dataAsString()}`;\n }\n static decode(context, coder, buffer, offset) {\n const oldOffset = offset;\n const decodedHeader = this.decodeRecordHeader(coder, buffer, offset);\n offset += decodedHeader.readBytes;\n const header = decodedHeader.data;\n const rrDecoder = this.typeToRecordDecoder.get(header.type);\n if (!rrDecoder) {\n return { readBytes: (offset + header.rDataLength) - oldOffset };\n }\n coder.initRRLocation(oldOffset, offset, header.rDataLength); // defines record offset and rdata offset for local compression\n const rdata = buffer.subarray(0, offset + header.rDataLength);\n let decodedRecord;\n try {\n // we slice the buffer (below), so out of bounds error are instantly detected\n decodedRecord = rrDecoder(coder, header, rdata, offset);\n }\n catch (error) {\n debug(`Received malformed rdata section for ${(0, dns_string_utils_1.dnsTypeToString)(header.type)} ${header.name} ${header.ttl} \\\nfrom ${context.address}:${context.port} with data '${rdata.subarray(offset).toString(\"hex\")}': ${error.stack}`);\n return { readBytes: (offset + header.rDataLength) - oldOffset };\n }\n offset += decodedRecord.readBytes;\n coder.clearRRLocation();\n return {\n data: decodedRecord.data,\n readBytes: offset - oldOffset,\n };\n }\n static decodeRecordHeader(coder, buffer, offset) {\n const oldOffset = offset;\n const decodedName = coder.decodeName(offset);\n offset += decodedName.readBytes;\n const type = buffer.readUInt16BE(offset);\n offset += 2;\n const rClass = buffer.readUInt16BE(offset);\n offset += 2;\n let clazz;\n let flushFlag = false;\n if (type !== 41 /* RType.OPT */) {\n clazz = (rClass & this.NOT_FLUSH_MASK);\n flushFlag = !!(rClass & this.FLUSH_MASK);\n }\n else {\n // OPT class field encodes udpPayloadSize field\n clazz = rClass;\n }\n const ttl = buffer.readUInt32BE(offset);\n offset += 4;\n const rDataLength = buffer.readUInt16BE(offset);\n offset += 2;\n const rHeader = {\n name: decodedName.data,\n type: type,\n class: clazz,\n ttl: ttl,\n flushFlag: flushFlag,\n rDataLength: rDataLength,\n };\n return {\n data: rHeader,\n readBytes: offset - oldOffset,\n };\n }\n}\nexports.ResourceRecord = ResourceRecord;\nResourceRecord.typeToRecordDecoder = new Map();\nResourceRecord.FLUSH_MASK = 0x8000; // 2 bytes, first bit set\nResourceRecord.NOT_FLUSH_MASK = 0x7FFF;\nResourceRecord.RR_DEFAULT_TTL_SHORT = 120; // 120 seconds\nResourceRecord.RR_DEFAULT_TTL = 4500; // 75 minutes\n//# sourceMappingURL=ResourceRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dnsTypeToString = void 0;\nfunction dnsTypeToString(type) {\n switch (type) {\n case 1:\n return \"A\";\n case 5:\n return \"CNAME\";\n case 12:\n return \"PTR\";\n case 16:\n return \"TXT\";\n case 28:\n return \"AAAA\";\n case 33:\n return \"SRV\";\n case 41:\n return \"OPT\";\n case 47:\n return \"NSEC\";\n case 255:\n return \"ANY\";\n }\n return \"UNSUPPORTED_\" + type;\n}\nexports.dnsTypeToString = dnsTypeToString;\n//# sourceMappingURL=dns-string-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AAAARecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst net_1 = tslib_1.__importDefault(require(\"net\"));\nconst domain_formatter_1 = require(\"../../util/domain-formatter\");\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass AAAARecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, ipAddress, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 28 /* RType.AAAA */, ttl || AAAARecord.RR_DEFAULT_TTL_SHORT, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 28 /* RType.AAAA */);\n super(name);\n }\n (0, assert_1.default)(net_1.default.isIPv6(ipAddress), \"IP address is not in v6 format!\");\n this.ipAddress = ipAddress;\n }\n getRDataEncodingLength() {\n return 16; // 16 byte ipv6 address\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const address = (0, domain_formatter_1.enlargeIPv6)(this.ipAddress);\n const bytes = address.split(\":\");\n (0, assert_1.default)(bytes.length === 8, \"invalid ip address\");\n for (const byte of bytes) {\n const number = parseInt(byte, 16);\n buffer.writeUInt16BE(number, offset);\n offset += 2;\n }\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const ipBytes = new Array(8);\n for (let i = 0; i < 8; i++) {\n const number = buffer.readUInt16BE(offset);\n offset += 2;\n ipBytes[i] = number.toString(16);\n }\n const ipAddress = (0, domain_formatter_1.shortenIPv6)(ipBytes.join(\":\"));\n return {\n data: new AAAARecord(header, ipAddress),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new AAAARecord(this.getRecordRepresentation(), this.ipAddress);\n }\n dataAsString() {\n return this.ipAddress;\n }\n dataEquals(record) {\n return this.ipAddress === record.ipAddress;\n }\n}\nexports.AAAARecord = AAAARecord;\nAAAARecord.DEFAULT_TTL = 120;\n//# sourceMappingURL=AAAARecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ARecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst net_1 = tslib_1.__importDefault(require(\"net\"));\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass ARecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, ipAddress, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 1 /* RType.A */, ttl || ARecord.RR_DEFAULT_TTL_SHORT, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 1 /* RType.A */);\n super(name);\n }\n (0, assert_1.default)(net_1.default.isIPv4(ipAddress), \"IP address is not in v4 format!\");\n this.ipAddress = ipAddress;\n }\n getRDataEncodingLength() {\n return 4; // 4 byte ipv4 address\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const bytes = this.ipAddress.split(\".\");\n (0, assert_1.default)(bytes.length === 4, \"invalid ip address\");\n for (const byte of bytes) {\n const number = parseInt(byte, 10);\n buffer.writeUInt8(number, offset++);\n }\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const ipBytes = new Array(4);\n for (let i = 0; i < 4; i++) {\n const byte = buffer.readUInt8(offset++);\n ipBytes[i] = byte.toString(10);\n }\n const ipAddress = ipBytes.join(\".\");\n return {\n data: new ARecord(header, ipAddress),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new ARecord(this.getRecordRepresentation(), this.ipAddress);\n }\n dataAsString() {\n return this.ipAddress;\n }\n dataEquals(record) {\n return this.ipAddress === record.ipAddress;\n }\n}\nexports.ARecord = ARecord;\nARecord.DEFAULT_TTL = 120;\n//# sourceMappingURL=ARecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CNAMERecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst dns_equal_1 = require(\"../../util/dns-equal\");\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass CNAMERecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, cname, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 5 /* RType.CNAME */, ttl, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 5 /* RType.CNAME */);\n super(name);\n }\n if (!cname.endsWith(\".\")) {\n cname += \".\";\n }\n this.cname = cname;\n }\n getLowerCasedCName() {\n return this.lowerCasedCName || (this.lowerCasedCName = (0, dns_equal_1.dnsLowerCase)(this.cname));\n }\n getRDataEncodingLength(coder) {\n return coder.getNameLength(this.cname);\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const cnameLength = coder.encodeName(this.cname, offset);\n offset += cnameLength;\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const decodedName = coder.decodeName(offset);\n offset += decodedName.readBytes;\n return {\n data: new CNAMERecord(header, decodedName.data),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new CNAMERecord(this.getRecordRepresentation(), this.cname);\n }\n dataAsString() {\n return this.cname;\n }\n dataEquals(record) {\n return this.getLowerCasedCName() === record.getLowerCasedCName();\n }\n}\nexports.CNAMERecord = CNAMERecord;\nCNAMERecord.DEFAULT_TTL = ResourceRecord_1.ResourceRecord.RR_DEFAULT_TTL;\n//# sourceMappingURL=CNAMERecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NSECRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst fast_deep_equal_1 = tslib_1.__importDefault(require(\"fast-deep-equal\"));\nconst dns_equal_1 = require(\"../../util/dns-equal\");\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass NSECRecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, nextDomainName, rrtypes, ttl, flushFlag) {\n if (typeof name === \"string\") {\n super(name, 47 /* RType.NSEC */, ttl || NSECRecord.RR_DEFAULT_TTL_SHORT, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 47 /* RType.NSEC */);\n super(name);\n }\n if (!nextDomainName.endsWith(\".\")) {\n nextDomainName += \".\";\n }\n this.nextDomainName = nextDomainName;\n this.rrTypeWindows = NSECRecord.rrTypesToWindowMap(rrtypes);\n }\n getLowerCasedNextDomainName() {\n return this.lowerCasedNextDomainName || (this.lowerCasedNextDomainName = (0, dns_equal_1.dnsLowerCase)(this.nextDomainName));\n }\n getRRTypesBitMapEncodingLength() {\n let rrTypesBitMapLength = 0;\n for (const window of this.rrTypeWindows) {\n (0, assert_1.default)(window.rrtypes.length > 0, \"types array for windowId \" + window.windowId + \" cannot be empty!\");\n rrTypesBitMapLength += 2 // 1 byte for windowId; 1 byte for bitmap length\n + window.bitMapSize;\n }\n return rrTypesBitMapLength;\n }\n getRDataEncodingLength(coder) {\n // RFC 4034 4.1.1. name compression MUST NOT be used for the nextDomainName, though RFC 6762 18.14 specifies it should\n return (coder.legacyUnicastEncoding\n ? coder.getUncompressedNameLength(this.nextDomainName)\n : coder.getUncompressedNameLength(this.nextDomainName)) // we skip compression for NSEC records for now, as Ubiquiti mdns forward can't handle that\n + this.getRRTypesBitMapEncodingLength();\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const length = coder.legacyUnicastEncoding\n ? coder.encodeUncompressedName(this.nextDomainName, offset)\n : coder.encodeUncompressedName(this.nextDomainName, offset); // we skip compression for NSEC records for now, as Ubiquiti mdns forward can't handle that\n offset += length;\n // RFC 4034 4.1.2. type bit maps field has the following format ( Window Block # | Bitmap Length | Bitmap )+ (with | concatenation)\n // e.g. 0x00 0x01 0x40 => defines the window 0; bitmap length 1; and the bitmap 10000000, meaning the first bit is\n // set for the 0th window => rrTypes = [A]. The bitmap length depends on the rtype with the highest value for the\n // given value (max 32 bytes per bitmap)\n for (const window of this.rrTypeWindows) {\n buffer.writeUInt8(window.windowId, offset++);\n buffer.writeUInt8(window.bitMapSize, offset++);\n const bitmap = Buffer.alloc(window.bitMapSize);\n for (const type of window.rrtypes) {\n const byteNum = (type & 0xFF) >> 3; // basically floored division by 8\n let mask = bitmap.readUInt8(byteNum);\n mask |= 1 << (7 - (type & 0x7)); // OR with 1 shifted according to the lowest 3 bits\n bitmap.writeUInt8(mask, byteNum);\n }\n bitmap.copy(buffer, offset);\n offset += bitmap.length;\n }\n return offset - oldOffset;\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n /**\n * Quick note to the line below. We base \"false\" as the second argument to decodeName, telling\n * it to not resolve pointers.\n * We discovered that especially UniFi routers with a VLAN setup and mdns forwarding enabled,\n * fail to properly encode pointers inside the nextDomainName field.\n * Those pointers simply point to random points in the record data, resulting in decoding to fail.\n * As the field doesn't have any meaning, and we simply don't use it, we just skip decoding for now.\n */\n const decodedNextDomainName = coder.decodeName(offset, false);\n offset += decodedNextDomainName.readBytes;\n const rrTypes = [];\n while (offset < buffer.length) {\n const windowId = buffer.readUInt8(offset++);\n const bitMapLength = buffer.readUInt8(offset++);\n const upperRType = windowId << 8;\n for (let block = 0; block < bitMapLength; block++) {\n const byte = buffer.readUInt8(offset++);\n for (let bit = 0; bit < 8; bit++) { // iterate over every bit\n if (byte & (1 << (7 - bit))) { // check if bit is set\n const rType = upperRType | (block << 3) | bit; // OR upperWindowNum | basically block * 8 | bit number\n rrTypes.push(rType);\n }\n }\n }\n }\n return {\n data: new NSECRecord(header, decodedNextDomainName.data, rrTypes),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new NSECRecord(this.getRecordRepresentation(), this.nextDomainName, NSECRecord.windowsToRRTypes(this.rrTypeWindows));\n }\n dataAsString() {\n return `${this.nextDomainName} [${NSECRecord.windowsToRRTypes(this.rrTypeWindows).map(rtype => \"\" + rtype).join(\",\")}]`;\n }\n dataEquals(record) {\n return this.getLowerCasedNextDomainName() === record.getLowerCasedNextDomainName() && (0, fast_deep_equal_1.default)(this.rrTypeWindows, record.rrTypeWindows);\n }\n static rrTypesToWindowMap(rrtypes) {\n const rrTypeWindows = [];\n for (const rrtype of rrtypes) {\n const windowId = rrtype >> 8;\n let window = undefined;\n for (const window0 of rrTypeWindows) {\n if (window0.windowId === windowId) {\n window = window0;\n break;\n }\n }\n if (!window) {\n window = {\n windowId: windowId,\n bitMapSize: Math.ceil((rrtype & 0xFF) / 8),\n rrtypes: [rrtype],\n };\n rrTypeWindows.push(window);\n }\n else {\n window.rrtypes.push(rrtype);\n const bitMapSize = Math.ceil((rrtype & 0xFF) / 8);\n if (bitMapSize > window.bitMapSize) {\n window.bitMapSize = bitMapSize;\n }\n }\n }\n // sort by windowId\n rrTypeWindows.sort((a, b) => a.windowId - b.windowId);\n rrTypeWindows.forEach(window => window.rrtypes.sort((a, b) => a - b));\n return rrTypeWindows;\n }\n static windowsToRRTypes(windows) {\n const rrtypes = [];\n for (const window of windows) {\n rrtypes.push(...window.rrtypes);\n }\n return rrtypes;\n }\n}\nexports.NSECRecord = NSECRecord;\n//# sourceMappingURL=NSECRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OPTRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst fast_deep_equal_1 = tslib_1.__importDefault(require(\"fast-deep-equal\"));\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass OPTRecord extends ResourceRecord_1.ResourceRecord {\n constructor(udpPayloadSize, options, extendedRCode, flags, ednsVersion, ttl) {\n if (typeof udpPayloadSize === \"number\") {\n super(\".\", 41 /* RType.OPT */, ttl, false, udpPayloadSize);\n this.udpPayloadSize = udpPayloadSize;\n }\n else {\n (0, assert_1.default)(udpPayloadSize.type === 41 /* RType.OPT */);\n super(udpPayloadSize);\n this.udpPayloadSize = udpPayloadSize.class;\n }\n this.extendedRCode = extendedRCode || 0;\n this.ednsVersion = ednsVersion || OPTRecord.EDNS_VERSION;\n this.flags = {\n dnsSecOK: (flags === null || flags === void 0 ? void 0 : flags.dnsSecOK) || false,\n zero: (flags === null || flags === void 0 ? void 0 : flags.zero) || 0,\n ...flags,\n };\n this.options = options || [];\n }\n getRDataEncodingLength() {\n let length = 0;\n for (const option of this.options) {\n length += 2 + 2 + option.data.length; // 2 byte code; 2 byte length prefix; binary data\n }\n return length;\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const classOffset = offset - 8;\n const ttlOffset = offset - 6;\n // just to be sure\n buffer.writeUInt16BE(this.udpPayloadSize, classOffset);\n buffer.writeUInt8(this.extendedRCode, ttlOffset);\n buffer.writeUInt8(this.ednsVersion, ttlOffset + 1);\n let flags = this.flags.zero || 0;\n if (this.flags.dnsSecOK) {\n flags |= OPTRecord.DNS_SEC_OK_MASK;\n }\n buffer.writeUInt16BE(flags, ttlOffset + 2);\n for (const option of this.options) {\n buffer.writeUInt16BE(option.code, offset);\n offset += 2;\n buffer.writeUInt16BE(option.data.length, offset);\n offset += 2;\n option.data.copy(buffer, offset);\n offset += option.data.length;\n }\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const classOffset = offset - 8;\n const ttlOffset = offset - 6;\n const udpPayloadSize = buffer.readUInt16BE(classOffset);\n const extendedRCode = buffer.readUInt8(ttlOffset);\n const ednsVersion = buffer.readUInt8(ttlOffset + 1);\n const flagsField = buffer.readUInt16BE(ttlOffset + 2);\n const flags = {\n dnsSecOK: !!(flagsField & OPTRecord.DNS_SEC_OK_MASK),\n zero: flagsField & OPTRecord.NOT_DNS_SEC_OK_MASK,\n };\n const options = [];\n while (offset < buffer.length) {\n const code = buffer.readUInt16BE(offset);\n offset += 2;\n const length = buffer.readUInt16BE(offset);\n offset += 2;\n const data = buffer.subarray(offset, offset + length);\n offset += length;\n options.push({\n code: code,\n data: data,\n });\n }\n header.class = udpPayloadSize;\n header.ttl = 4500; // default\n return {\n data: new OPTRecord(header, options, extendedRCode, flags, ednsVersion),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new OPTRecord(this.getRecordRepresentation(), this.options, this.extendedRCode, this.flags, this.ednsVersion);\n }\n dataAsString() {\n return `${this.udpPayloadSize} ${this.extendedRCode} ${this.ednsVersion} ${JSON.stringify(this.flags)} [${this.options\n .map(opt => `${opt.code} ${opt.data.toString(\"base64\")}`).join(\",\")}]`;\n }\n dataEquals(record) {\n return this.udpPayloadSize === record.udpPayloadSize && this.extendedRCode === record.extendedRCode\n && this.ednsVersion === record.ednsVersion\n && OPTRecord.optionsEquality(this.options, record.options) && (0, fast_deep_equal_1.default)(this.flags, record.flags);\n }\n static optionsEquality(a, b) {\n // deepEquals on buffers doesn't really work\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i].code !== b[i].code) {\n return false;\n }\n else if (a[i].data.toString(\"hex\") !== b[i].data.toString(\"hex\")) {\n return false;\n }\n }\n return true;\n }\n}\nexports.OPTRecord = OPTRecord;\nOPTRecord.EDNS_VERSION = 0;\nOPTRecord.DNS_SEC_OK_MASK = 0x8000; // 2 bytes, first bit set\nOPTRecord.NOT_DNS_SEC_OK_MASK = 0x7FFF;\n//# sourceMappingURL=OPTRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PTRRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst dns_equal_1 = require(\"../../util/dns-equal\");\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass PTRRecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, ptrName, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 12 /* RType.PTR */, ttl, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 12 /* RType.PTR */);\n super(name);\n }\n if (!ptrName.endsWith(\".\")) {\n ptrName += \".\";\n }\n this.ptrName = ptrName;\n }\n getLowerCasedPTRName() {\n return this.lowerCasedPtrName || (this.lowerCasedPtrName = (0, dns_equal_1.dnsLowerCase)(this.ptrName));\n }\n getRDataEncodingLength(coder) {\n return coder.getNameLength(this.ptrName);\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n const ptrNameLength = coder.encodeName(this.ptrName, offset);\n offset += ptrNameLength;\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const decodedName = coder.decodeName(offset);\n offset += decodedName.readBytes;\n return {\n data: new PTRRecord(header, decodedName.data),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new PTRRecord(this.getRecordRepresentation(), this.ptrName);\n }\n dataAsString() {\n return this.ptrName;\n }\n dataEquals(record) {\n return this.getLowerCasedPTRName() === record.getLowerCasedPTRName();\n }\n}\nexports.PTRRecord = PTRRecord;\nPTRRecord.DEFAULT_TTL = ResourceRecord_1.ResourceRecord.RR_DEFAULT_TTL;\n//# sourceMappingURL=PTRRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SRVRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst dns_equal_1 = require(\"../../util/dns-equal\");\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass SRVRecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, hostname, port, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 33 /* RType.SRV */, ttl || SRVRecord.RR_DEFAULT_TTL_SHORT, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 33 /* RType.SRV */);\n super(name);\n }\n if (!hostname.endsWith(\".\")) {\n this.hostname = hostname + \".\";\n }\n else {\n this.hostname = hostname;\n }\n this.port = port;\n // priority and weight are not supported to encode or read\n this.priority = 0;\n this.weight = 0;\n }\n getLowerCasedHostname() {\n return this.lowerCasedHostname || (this.lowerCasedHostname = (0, dns_equal_1.dnsLowerCase)(this.hostname));\n }\n getRDataEncodingLength(coder) {\n return 6 // 2 byte priority; 2 byte weight; 2 byte port;\n // as of RFC 2782 name compression MUST NOT be used for the hostname, though RFC 6762 18.14 specifies it should\n + (coder.legacyUnicastEncoding\n ? coder.getUncompressedNameLength(this.hostname)\n : coder.getNameLength(this.hostname));\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n buffer.writeUInt16BE(this.priority, offset);\n offset += 2;\n buffer.writeUInt16BE(this.weight, offset);\n offset += 2;\n buffer.writeUInt16BE(this.port, offset);\n offset += 2;\n const hostnameLength = coder.legacyUnicastEncoding\n ? coder.encodeUncompressedName(this.hostname, offset)\n : coder.encodeName(this.hostname, offset);\n offset += hostnameLength;\n return offset - oldOffset; // written bytes\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n //const priority = buffer.readUInt16BE(offset);\n offset += 2;\n //const weight = buffer.readUInt16BE(offset);\n offset += 2;\n const port = buffer.readUInt16BE(offset);\n offset += 2;\n const decodedHostname = coder.decodeName(offset);\n offset += decodedHostname.readBytes;\n return {\n data: new SRVRecord(header, decodedHostname.data, port),\n readBytes: offset - oldOffset,\n };\n }\n clone() {\n return new SRVRecord(this.getRecordRepresentation(), this.hostname, this.port);\n }\n dataAsString() {\n return `${this.hostname} ${this.port} ${this.priority} ${this.weight}`;\n }\n dataEquals(record) {\n return this.getLowerCasedHostname() === record.getLowerCasedHostname() && this.port === record.port && this.weight === record.weight && this.priority === record.priority;\n }\n}\nexports.SRVRecord = SRVRecord;\nSRVRecord.DEFAULT_TTL = 120;\n//# sourceMappingURL=SRVRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TXTRecord = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nclass TXTRecord extends ResourceRecord_1.ResourceRecord {\n constructor(name, txt, flushFlag, ttl) {\n if (typeof name === \"string\") {\n super(name, 16 /* RType.TXT */, ttl, flushFlag);\n }\n else {\n (0, assert_1.default)(name.type === 16 /* RType.TXT */);\n super(name);\n }\n this.txt = txt.length === 0 ? [Buffer.from([])] : txt;\n }\n getRDataEncodingLength() {\n let length = 0;\n for (const buffer of this.txt) {\n length += 1 + buffer.length;\n (0, assert_1.default)(buffer.length <= 255, \"One txt character-string can only have a length of 255 chars\");\n }\n return length;\n }\n encodeRData(coder, buffer, offset) {\n const oldOffset = offset;\n for (const txt of this.txt) {\n buffer.writeUInt8(txt.length, offset++);\n txt.copy(buffer, offset);\n offset += txt.length;\n }\n return offset - oldOffset; // written bytes\n }\n clone() {\n return new TXTRecord(this.getRecordRepresentation(), this.txt);\n }\n dataAsString() {\n return `[${this.txt.map(line => `${line.toString(\"base64\")}`).join(\",\")}]`;\n }\n dataEquals(record) {\n // deepEquals on buffers doesn't really work\n if (this.txt.length !== record.txt.length) {\n return false;\n }\n for (let i = 0; i < this.txt.length; i++) {\n if (this.txt[i].toString(\"hex\") !== record.txt[i].toString(\"hex\")) {\n return false;\n }\n }\n return true;\n }\n static decodeData(coder, header, buffer, offset) {\n const oldOffset = offset;\n const txtData = [];\n while (offset < buffer.length) {\n const length = buffer.readUInt8(offset++);\n txtData.push(buffer.subarray(offset, offset + length));\n offset += length;\n }\n return {\n data: new TXTRecord(header, txtData),\n readBytes: offset - oldOffset,\n };\n }\n}\nexports.TXTRecord = TXTRecord;\nTXTRecord.DEFAULT_TTL = ResourceRecord_1.ResourceRecord.RR_DEFAULT_TTL;\n//# sourceMappingURL=TXTRecord.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ResourceRecord_1 = require(\"../ResourceRecord\");\nconst AAAARecord_1 = require(\"./AAAARecord\");\nconst ARecord_1 = require(\"./ARecord\");\nconst CNAMERecord_1 = require(\"./CNAMERecord\");\nconst NSECRecord_1 = require(\"./NSECRecord\");\nconst OPTRecord_1 = require(\"./OPTRecord\");\nconst PTRRecord_1 = require(\"./PTRRecord\");\nconst SRVRecord_1 = require(\"./SRVRecord\");\nconst TXTRecord_1 = require(\"./TXTRecord\");\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(28 /* RType.AAAA */, AAAARecord_1.AAAARecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(1 /* RType.A */, ARecord_1.ARecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(5 /* RType.CNAME */, CNAMERecord_1.CNAMERecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(47 /* RType.NSEC */, NSECRecord_1.NSECRecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(12 /* RType.PTR */, PTRRecord_1.PTRRecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(33 /* RType.SRV */, SRVRecord_1.SRVRecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(41 /* RType.OPT */, OPTRecord_1.OPTRecord.decodeData);\nResourceRecord_1.ResourceRecord.typeToRecordDecoder.set(16 /* RType.TXT */, TXTRecord_1.TXTRecord.decodeData);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getResponder = exports.Protocol = void 0;\nconst tslib_1 = require(\"tslib\");\nrequire(\"source-map-support/register\"); // registering node-source-map-support for typescript stack traces\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst version = require(\"../package.json\").version;\nif (version.includes(\"beta\") || process.env.BCT) { // enable debug output if beta version or running bonjour conformance testing\n const debug = process.env.DEBUG;\n if (!debug || !debug.includes(\"ciao\")) {\n if (!debug) {\n debug_1.default.enable(\"ciao:*\");\n }\n else {\n debug_1.default.enable(debug + \",ciao:*\");\n }\n }\n}\nrequire(\"./coder/records/index\");\nconst Responder_1 = require(\"./Responder\");\ntslib_1.__exportStar(require(\"./CiaoService\"), exports);\ntslib_1.__exportStar(require(\"./Responder\"), exports);\nfunction printInitInfo() {\n const debug = (0, debug_1.default)(\"ciao:init\");\n debug(\"Loading ciao v\" + version + \"...\");\n}\nprintInitInfo();\n/**\n * Defines the transport protocol of a service.\n *\n * As of RFC 6763 7. TCP must be used for any applications using tcp.\n * For applications using any other transport protocol UDP must be used.\n * This applies to all other transport protocols like SCTP, DCCP, RTMFP, etc\n */\nvar Protocol;\n(function (Protocol) {\n Protocol[\"TCP\"] = \"tcp\";\n Protocol[\"UDP\"] = \"udp\";\n})(Protocol || (exports.Protocol = Protocol = {}));\n/**\n * This method is used to get a responder for the provided (optional) set of options.\n *\n * Ciao tries to create as few Responder instances as possible.\n * Thus, it will share the same Responder instance for the same set of options.\n *\n * @param options - If specified, the options will be passed to the underlying mdns server.\n * @returns A Responder instance for the given options. Might be shared with others using the same options.\n */\nfunction getResponder(options) {\n return Responder_1.Responder.getResponder(options);\n}\nexports.getResponder = getResponder;\nexports.default = {\n getResponder: getResponder,\n};\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Announcer = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst DNSPacket_1 = require(\"../coder/DNSPacket\");\nconst MDNSServer_1 = require(\"../MDNSServer\");\nconst promise_utils_1 = require(\"../util/promise-utils\");\nconst debug = (0, debug_1.default)(\"ciao:Announcer\");\n/**\n * This class is used to execute the 'announce' process for a given service as define in RFC 6762 8.3.\n *\n * The Multicast DNS responder MUST send at least two unsolicited\n * responses, one second apart. To provide increased robustness against\n * packet loss, a responder MAY send up to eight unsolicited responses,\n * provided that the interval between unsolicited responses increases by\n * at least a factor of two with every response sent.\n *\n */\nclass Announcer {\n constructor(server, service, options) {\n this.repetitions = 1;\n this.announceIntervalIncreaseFactor = 2; // RFC states a factor of AT LEAST two (could be higher as it seems)\n this.goodbye = false;\n this.sentAnnouncements = 0;\n this.sentLastAnnouncement = false;\n this.nextInterval = 1000;\n this.nextAnnouncementTime = 0;\n (0, assert_1.default)(server, \"server must be defined\");\n (0, assert_1.default)(service, \"service must be defined\");\n this.server = server;\n this.service = service;\n if (options) {\n if (options.repetitions !== undefined) {\n this.repetitions = options.repetitions;\n }\n if (options.goodbye) {\n this.goodbye = true;\n }\n }\n (0, assert_1.default)(this.repetitions > 0 && this.repetitions <= 8, \"repetitions must in [1;8]\");\n }\n announce() {\n debug(\"[%s] Sending %s for service\", this.service.getFQDN(), this.goodbye ? \"goodbye\" : \"announcement\");\n if (!this.goodbye) {\n // could happen that the txt record was updated while probing.\n // just to be sure to announce all the latest data, we will rebuild the services.\n this.service.rebuildServiceRecords();\n }\n return (this.promise = new Promise((resolve, reject) => {\n this.promiseResolve = resolve;\n this.promiseReject = reject;\n this.timer = setTimeout(this.sendAnnouncement.bind(this), 0);\n this.timer.unref();\n this.nextAnnouncementTime = new Date().getTime();\n }));\n }\n async cancel() {\n debug(\"[%s] Canceling %s\", this.service.getFQDN(), this.goodbye ? \"goodbye\" : \"announcement\");\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n this.promiseReject(Announcer.CANCEL_REASON);\n // the promise handlers are not called instantly, thus we give the opportunity to wait for the\n // program originally doing the announcement to clean up\n return this.awaitAnnouncement().catch(reason => {\n if (reason !== Announcer.CANCEL_REASON) {\n return Promise.reject(reason);\n }\n });\n }\n hasSentLastAnnouncement() {\n return this.sentLastAnnouncement;\n }\n async awaitAnnouncement() {\n await this.promise;\n }\n isSendingGoodbye() {\n return this.goodbye;\n }\n sendAnnouncement() {\n // minimum required is to send two unsolicited responses, one second apart\n // we could announce up to 8 times in total (time between messages must increase by two every message)\n debug(\"[%s] Sending %s number %d\", this.service.getFQDN(), this.goodbye ? \"goodbye\" : \"announcement\", this.sentAnnouncements + 1);\n // we rebuild every time,\n const records = [\n this.service.ptrRecord(), ...this.service.subtypePtrRecords(),\n this.service.srvRecord(), this.service.txtRecord(),\n // A and AAAA records are added below when sending. Which records get added depends on the network the announcement happens for\n ];\n if (this.goodbye) {\n for (const record of records) {\n record.ttl = 0; // setting ttl to zero to indicate \"goodbye\"\n }\n }\n else {\n records.push(this.service.metaQueryPtrRecord());\n }\n if (this.sentAnnouncements + 1 >= this.repetitions) {\n this.sentLastAnnouncement = true;\n }\n Announcer.sendResponseAddingAddressRecords(this.server, this.service, records, this.goodbye).then(results => {\n const failRatio = (0, MDNSServer_1.SendResultFailedRatio)(results);\n if (failRatio === 1) {\n console.error((0, MDNSServer_1.SendResultFormatError)(results, `[${this.service.getFQDN()}] Failed to send ${this.goodbye ? \"goodbye\" : \"announcement\"} requests`), true);\n this.promiseReject(new Error(`${this.goodbye ? \"Goodbye\" : \"Announcement\"} failed as of socket errors!`));\n return; // all failed => thus announcement failed\n }\n if (failRatio > 0) {\n // some queries on some interfaces failed, but not all. We log that but consider that to be a success\n // at this point we are not responsible for removing stale network interfaces or something\n debug((0, MDNSServer_1.SendResultFormatError)(results, `Some of the ${this.goodbye ? \"goodbye\" : \"announcement\"} requests for '${this.service.getFQDN()}' encountered an error`));\n // SEE no return here\n }\n if (this.service.serviceState !== \"announcing\" /* ServiceState.ANNOUNCING */) {\n debug(\"[%s] Service is no longer in announcing state. Stopping. (Received %s)\", this.service.getFQDN(), this.service.serviceState);\n return;\n }\n this.sentAnnouncements++;\n if (this.sentAnnouncements >= this.repetitions) {\n this.promiseResolve();\n }\n else {\n this.timer = setTimeout(this.sendAnnouncement.bind(this), this.nextInterval);\n this.timer.unref();\n this.nextAnnouncementTime = new Date().getTime() + this.nextInterval;\n this.nextInterval *= this.announceIntervalIncreaseFactor;\n }\n });\n }\n static sendResponseAddingAddressRecords(server, service, records, goodbye) {\n const promises = [];\n for (const name of server.getBoundInterfaceNames()) {\n if (!service.advertisesOnInterface(name)) {\n continue;\n }\n const answer = records.concat([]);\n const aRecord = service.aRecord(name);\n const aaaaRecord = service.aaaaRecord(name);\n const aaaaRoutableRecord = service.aaaaRoutableRecord(name);\n const aaaaUniqueLocalRecord = service.aaaaUniqueLocalRecord(name);\n //const reversMappings: PTRRecord[] = service.reverseAddressMappings(networkInterface);\n const nsecRecord = service.addressNSECRecord();\n const serviceNsecRecord = service.serviceNSECRecord();\n if (aRecord) {\n if (goodbye) {\n aRecord.ttl = 0;\n }\n answer.push(aRecord);\n }\n if (aaaaRecord) {\n if (goodbye) {\n aaaaRecord.ttl = 0;\n }\n answer.push(aaaaRecord);\n }\n if (aaaaRoutableRecord) {\n if (goodbye) {\n aaaaRoutableRecord.ttl = 0;\n }\n answer.push(aaaaRoutableRecord);\n }\n if (aaaaUniqueLocalRecord) {\n if (goodbye) {\n aaaaUniqueLocalRecord.ttl = 0;\n }\n answer.push(aaaaUniqueLocalRecord);\n }\n /*\n for (const reversMapping of reversMappings) {\n if (goodbye) {\n reversMapping.ttl = 0;\n }\n answer.push(reversMapping);\n }\n */\n if (goodbye) {\n nsecRecord.ttl = 0;\n serviceNsecRecord.ttl = 0;\n }\n const additionals = [];\n additionals.push(nsecRecord, serviceNsecRecord);\n const packet = DNSPacket_1.DNSPacket.createDNSResponsePacketsFromRRSet({\n answers: answer,\n additionals: additionals,\n });\n promises.push(Promise.race([\n server.send(packet, name),\n (0, promise_utils_1.PromiseTimeout)(MDNSServer_1.MDNSServer.SEND_TIMEOUT).then(() => ({\n status: \"timeout\",\n interface: name,\n })),\n ]));\n }\n return Promise.all(promises);\n }\n}\nexports.Announcer = Announcer;\nAnnouncer.CANCEL_REASON = \"CIAO ANNOUNCEMENT CANCELLED\";\n//# sourceMappingURL=Announcer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Prober = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst Question_1 = require(\"../coder/Question\");\nconst MDNSServer_1 = require(\"../MDNSServer\");\nconst tiebreaking = tslib_1.__importStar(require(\"../util/tiebreaking\"));\nconst tiebreaking_1 = require(\"../util/tiebreaking\");\nconst PROBE_INTERVAL = 250; // 250ms as defined in RFC 6762 8.1.\nconst LIMITED_PROBE_INTERVAL = 1000;\nconst debug = (0, debug_1.default)(\"ciao:Prober\");\n/**\n * This class is used to execute the probing process for a given service as defined\n * in RFC 6762 8.1.\n * This ensures that we advertise the service under a unique name.\n * It also provides a conflict resolution algorithm if multiple clients probing\n * for the same name are detected.\n */\nclass Prober {\n constructor(responder, server, service) {\n this.records = [];\n this.currentInterval = PROBE_INTERVAL;\n this.serviceEncounteredNameChange = false;\n this.sentFirstProbeQuery = false; // we MUST ignore responses received BEFORE the first probe is sent\n this.sentQueriesForCurrentTry = 0;\n this.sentQueries = 0;\n (0, assert_1.default)(responder, \"responder must be defined\");\n (0, assert_1.default)(server, \"server must be defined\");\n (0, assert_1.default)(service, \"service must be defined\");\n this.responder = responder;\n this.server = server;\n this.service = service;\n }\n getService() {\n return this.service;\n }\n /**\n * This method is called to start the actual probing process.\n * Once the service is considered unique on the network and can be announced the promise returns.\n * While probing multiple name changes can happen\n *\n * @returns a promise which returns when the service is considered unique on the network\n */\n probe() {\n /*\n * Probing is basically the following process: We send three \"probe\" queries to check\n * if the desired service name is already on the network.\n * The request are sent with a delay of 250ms between them and the first\n * request starting with a random delay.\n * If we don't receive any response to our requests we consider the probing to be successful\n * and continue with announcing our service.\n */\n debug(\"Starting to probe for '%s'...\", this.service.getFQDN());\n return new Promise((resolve, reject) => {\n this.promiseResolve = resolve;\n this.promiseReject = reject;\n this.timer = setTimeout(this.sendProbeRequest.bind(this), Math.random() * PROBE_INTERVAL);\n this.timer.unref();\n });\n }\n cancel() {\n this.clear();\n this.promiseReject(Prober.CANCEL_REASON);\n }\n clear() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n // reset all values to default (so the Prober can be reused if it wasn't successful)\n this.sentFirstProbeQuery = false;\n this.sentQueriesForCurrentTry = 0;\n }\n /**\n * End the current ongoing probing requests. If\n * @param success\n */\n endProbing(success) {\n // reset all values to default (so the Prober can be reused if it wasn't successful)\n this.clear();\n if (success) {\n debug(\"Probing for '%s' finished successfully\", this.service.getFQDN());\n this.promiseResolve();\n if (this.serviceEncounteredNameChange) {\n this.service.informAboutNameUpdates();\n }\n }\n }\n sendProbeRequest() {\n if (this.sentQueriesForCurrentTry === 0) { // this is the first query sent, init some stuff\n // RFC 6762 8.2. When a host is probing for a group of related records with the same\n // name (e.g., the SRV and TXT record describing a DNS-SD service), only\n // a single question need be placed in the Question Section, since query\n // type \"ANY\" (255) is used, which will elicit answers for all records\n // with that name. However, for tiebreaking to work correctly in all\n // cases, the Authority Section must contain *all* the records and\n // proposed rdata being probed for uniqueness.\n // it states *all* records, though we include ALL A/AAAA records as well, even\n // though it may not be relevant data if the probe query is published on different interfaces.\n // Having the same \"format\" probed on all interfaces, the simultaneous probe tiebreaking\n // algorithm can work correctly. Otherwise, we would conflict with ourselves in a situation were\n // a device is connected to the same network via Wi-Fi and Ethernet.\n this.records = [\n this.service.srvRecord(), this.service.txtRecord(),\n this.service.ptrRecord(), ...this.service.subtypePtrRecords(),\n ...this.service.allAddressRecords(), //...this.service.allReverseAddressMappings(),\n ].sort(tiebreaking_1.rrComparator); // we sort them for the tiebreaking algorithm\n this.records.forEach(record => record.flushFlag = false);\n }\n if (this.sentQueriesForCurrentTry >= 3) {\n // we sent three requests, and it seems like we weren't canceled, so we have a success right here\n this.endProbing(true);\n return;\n }\n if (this.sentQueries >= 15) {\n this.currentInterval = LIMITED_PROBE_INTERVAL;\n }\n debug(\"Sending prober query number %d for '%s'...\", this.sentQueriesForCurrentTry + 1, this.service.getFQDN());\n (0, assert_1.default)(this.records.length > 0, \"Tried sending probing request for zero record length!\");\n const questions = [\n // probes SHOULD be sent with unicast response flag as of the RFC\n // MDNServer might overwrite the QU flag to false, as we can't use unicast if there is another responder on the machine\n new Question_1.Question(this.service.getFQDN(), 255 /* QType.ANY */, true),\n new Question_1.Question(this.service.getHostname(), 255 /* QType.ANY */, true),\n ];\n this.server.sendQueryBroadcast({\n questions: questions,\n // TODO certified homekit accessories only include the main service PTR record\n authorities: this.records, // include records we want to announce in authorities to support Simultaneous Probe Tiebreaking (RFC 6762 8.2.)\n }, this.service).then(results => {\n const failRatio = (0, MDNSServer_1.SendResultFailedRatio)(results);\n if (failRatio === 1) {\n console.error((0, MDNSServer_1.SendResultFormatError)(results, `Failed to send probe queries for '${this.service.getFQDN()}'`), true);\n this.endProbing(false);\n this.promiseReject(new Error(\"Probing failed as of socket errors!\"));\n return; // all failed => thus probing failed\n }\n if (failRatio > 0) {\n // some queries on some interfaces failed, but not all. We log that but consider that to be a success\n // at this point we are not responsible for removing stale network interfaces or something\n debug((0, MDNSServer_1.SendResultFormatError)(results, `Some of the probe queries for '${this.service.getFQDN()}' encountered an error`));\n // SEE no return here\n }\n if (this.service.serviceState !== \"probing\" /* ServiceState.PROBING */) {\n debug(\"Service '%s' is no longer in probing state. Stopping.\", this.service.getFQDN());\n return;\n }\n this.sentFirstProbeQuery = true;\n this.sentQueriesForCurrentTry++;\n this.sentQueries++;\n this.timer = setTimeout(this.sendProbeRequest.bind(this), this.currentInterval);\n this.timer.unref();\n this.checkLocalConflicts();\n });\n }\n checkLocalConflicts() {\n let containsAnswer = false;\n for (const service of this.responder.getAnnouncedServices()) {\n if (service.getLowerCasedFQDN() === this.service.getLowerCasedFQDN() || service.getLowerCasedHostname() === this.service.getLowerCasedHostname()) {\n containsAnswer = true;\n break;\n }\n }\n if (containsAnswer) {\n debug(\"Probing for '%s' failed as of local service. Doing a name change\", this.service.getFQDN());\n this.handleNameChange();\n }\n }\n handleResponse(packet, endpoint) {\n if (!this.sentFirstProbeQuery || !this.service.advertisesOnInterface(endpoint.interface)) {\n return;\n }\n let containsAnswer = false;\n // search answers and additionals for answers to our probe queries\n for (const record of packet.answers.values()) {\n if (record.getLowerCasedName() === this.service.getLowerCasedFQDN() || record.getLowerCasedName() === this.service.getLowerCasedHostname()) {\n containsAnswer = true;\n break;\n }\n }\n for (const record of packet.additionals.values()) {\n if (record.getLowerCasedName() === this.service.getLowerCasedFQDN() || record.getLowerCasedName() === this.service.getLowerCasedHostname()) {\n containsAnswer = true;\n break;\n }\n }\n if (containsAnswer) { // abort and cancel probes\n debug(\"Probing for '%s' failed. Doing a name change\", this.service.getFQDN());\n this.handleNameChange();\n }\n }\n handleNameChange() {\n this.endProbing(false); // reset the prober\n this.service.serviceState = \"unannounced\" /* ServiceState.UNANNOUNCED */;\n this.service.incrementName();\n this.service.serviceState = \"probing\" /* ServiceState.PROBING */;\n this.serviceEncounteredNameChange = true;\n this.timer = setTimeout(this.sendProbeRequest.bind(this), 1000);\n this.timer.unref();\n }\n handleQuery(packet, endpoint) {\n if (!this.sentFirstProbeQuery || !this.service.advertisesOnInterface(endpoint.interface)) {\n return;\n }\n // if we are currently probing and receiving a query which is also a probing query\n // which matches the desired name we run the tiebreaking algorithm to decide on the winner\n let needsTiebreaking = false;\n for (const question of packet.questions.values()) {\n if (question.getLowerCasedName() === this.service.getLowerCasedFQDN() || question.getLowerCasedName() === this.service.getLowerCasedHostname()) {\n needsTiebreaking = true;\n break;\n }\n }\n if (needsTiebreaking) {\n this.doTiebreaking(packet);\n }\n }\n doTiebreaking(packet) {\n if (!this.sentFirstProbeQuery) { // ignore queries if we are not sending\n return;\n }\n // first of all check if the contents of authorities answers our query\n let conflict = packet.authorities.size === 0;\n for (const record of packet.authorities.values()) {\n if (record.getLowerCasedName() === this.service.getLowerCasedFQDN() || record.getLowerCasedName() === this.service.getLowerCasedHostname()) {\n conflict = true;\n break;\n }\n }\n if (!conflict) {\n return;\n }\n // now run the actual tiebreaking algorithm to decide the winner\n // tiebreaking is actually run pretty often, as we always receive our own packets\n // first of all build our own records\n const answers = this.records; // already sorted\n const opponent = Array.from(packet.authorities.values()).sort(tiebreaking.rrComparator);\n const result = tiebreaking.runTiebreaking(answers, opponent);\n if (result === 1 /* TiebreakingResult.HOST */) {\n debug(\"'%s' won the tiebreak. We gonna ignore the other probing request!\", this.service.getFQDN());\n }\n else if (result === -1 /* TiebreakingResult.OPPONENT */) {\n debug(\"'%s' lost the tiebreak. We are waiting a second and try to probe again...\", this.service.getFQDN());\n this.endProbing(false); // cancel the current probing\n // wait 1 second and probe again (this is to guard against stale probe packets)\n // If it wasn't a stale probe packet, the other host will correctly respond to our probe queries by then\n this.timer = setTimeout(this.sendProbeRequest.bind(this), 1000);\n this.timer.unref();\n }\n else {\n //debug(\"Tiebreaking for '%s' detected exact same records on the network. There is actually no conflict!\", this.service.getFQDN());\n }\n }\n}\nexports.Prober = Prober;\nProber.CANCEL_REASON = \"CIAO PROBING CANCELLED\";\n//# sourceMappingURL=Prober.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.QueryResponse = void 0;\nconst DNSPacket_1 = require(\"../coder/DNSPacket\");\nclass QueryResponse {\n constructor(knownAnswers) {\n this.sharedAnswer = false;\n this.dnsPacket = new DNSPacket_1.DNSPacket({ type: 1 /* PacketType.RESPONSE */ });\n this.knownAnswers = knownAnswers;\n }\n asPacket() {\n return this.dnsPacket;\n }\n asString(udpPayloadSize) {\n return this.dnsPacket.asLoggingString(udpPayloadSize);\n }\n containsSharedAnswer() {\n return this.sharedAnswer;\n }\n addAnswer(...records) {\n let addedAny = false;\n for (const record of records) {\n if (this.isKnownAnswer(record)) {\n // record is a known answer to the querier\n continue;\n }\n const added = this.dnsPacket.addAnswers(record);\n if (added) {\n addedAny = true;\n if (!record.flushFlag) {\n this.sharedAnswer = true;\n }\n }\n }\n return addedAny;\n }\n addAdditional(...records) {\n let addedAny = false;\n for (const record of records) {\n if (this.isKnownAnswer(record)) {\n // check if the additional record is a known answer, otherwise there is no need to send it\n continue;\n }\n if (this.dnsPacket.answers.has(record.asString())) {\n continue; // if it is already in the answer section, don't include it in additionals\n }\n const added = this.dnsPacket.addAdditionals(record);\n if (added) {\n addedAny = true;\n }\n }\n return addedAny;\n }\n markLegacyUnicastResponse(id, questions) {\n // we are dealing with a legacy unicast dns query (RFC 6762 6.7.)\n // * MUSTS: response via unicast, repeat query ID, repeat questions (actually it should just be one), clear cache flush bit\n // * SHOULDS: ttls should not be greater than 10s as legacy resolvers don't take part in the cache coherency mechanism\n this.dnsPacket.id = id;\n if (questions) {\n this.dnsPacket.addQuestions(...questions);\n }\n this.dnsPacket.answers.forEach(answers => {\n answers.flushFlag = false;\n answers.ttl = 10;\n });\n this.dnsPacket.additionals.forEach(answers => {\n answers.flushFlag = false;\n answers.ttl = 10;\n });\n this.dnsPacket.setLegacyUnicastEncoding(true); // legacy unicast also affects the encoder (must not use compression for the SRV record) so we need to tell him\n }\n markTruncated() {\n this.dnsPacket.flags.truncation = true;\n }\n hasAnswers() {\n // we may still have additionals, though there is no reason when answers is empty\n // removeKnownAnswer may have removed all answers and only additionals are known.\n return this.dnsPacket.answers.size > 0;\n }\n isKnownAnswer(record) {\n if (!this.knownAnswers) {\n return false;\n }\n const knownAnswer = this.knownAnswers.get(record.asString());\n // we will still send the response if the known answer has half of the original ttl according to RFC 6762 7.1.\n // so only if the ttl is more than half than the original ttl we consider it a valid known answer\n return knownAnswer !== undefined && knownAnswer.ttl > record.ttl / 2;\n }\n static combineResponses(responses, udpPayloadSize) {\n for (let i = 0; i < responses.length - 1; i++) {\n const current = responses[i];\n const currentPacket = current.dnsPacket;\n const next = responses[i + 1];\n const nextPacket = next.dnsPacket;\n if (currentPacket.canBeCombinedWith(nextPacket, udpPayloadSize)) {\n // combine the packet with next one\n currentPacket.combineWith(nextPacket);\n // remove next from the array\n responses.splice(i + 1, 1);\n // we won't combine the known answer section, with current implementation they will always be the same\n current.sharedAnswer = current.sharedAnswer || next.sharedAnswer;\n // decrement i, so we check again if the \"current\" packet can be combined with the packet after \"next\"\n i--;\n }\n }\n }\n}\nexports.QueryResponse = QueryResponse;\n//# sourceMappingURL=QueryResponse.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.QueuedResponse = void 0;\n/**\n * Represents a delay response packet which is going to be sent over multicast.\n */\nclass QueuedResponse {\n constructor(packet, interfaceName) {\n this.timeOfCreation = new Date().getTime(); // epoch time millis\n this.estimatedTimeToBeSent = 0; // epoch time millis\n this.delay = -1;\n this.packet = packet;\n this.interfaceName = interfaceName;\n }\n getPacket() {\n return this.packet;\n }\n /**\n * This method returns the total delay of the represented dns response packet.\n * If this QueuedResponse consists of already combined packets\n * (meaning other packets already got delayed in order to be sent out with this packet),\n * the totalDelay will represent the maximum delay of any contained packet.\n *\n * @returns The total delay.\n */\n getTimeSinceCreation() {\n return new Date().getTime() - this.timeOfCreation;\n }\n getTimeTillSent() {\n return Math.max(0, this.estimatedTimeToBeSent - new Date().getTime());\n }\n calculateRandomDelay() {\n this.delay = Math.random() * 100 + 20; // delay of 20ms - 120ms\n this.estimatedTimeToBeSent = new Date().getTime() + this.delay;\n }\n scheduleResponse(callback) {\n this.timer = setTimeout(callback, this.delay);\n this.timer.unref(); // timer doesn't prevent termination\n }\n delayWouldBeInTimelyManner(next) {\n const delay = next.estimatedTimeToBeSent - this.timeOfCreation;\n return delay <= QueuedResponse.MAX_DELAY;\n }\n /**\n * Combines this queue response packet with the {@code next} queued response packet if those can be combined.\n * Packets can be combined if the udpPayloadSize allows for it AND if the current packet\n * won't be delayed more than 500 ms from its time of creation AND the packets get sent on the same interface.\n *\n * @param next - A queued response which is schedule AFTER the current queued response.\n * @returns {@code true} will be returned if the queued response was combined with the specified {@code next} response.\n */\n combineWithNextPacketIfPossible(next) {\n // below check, which is commented out would be necessary, current implementation will check that\n // with function above, thus there is no need to check again.\n /*\n if (!this.delayWouldBeInTimelyManner(next)) {\n return false;\n }\n */\n if (this.interfaceName !== next.interfaceName) {\n // can't combine packets which get sent via different interfaces\n return false;\n }\n if (!next.packet.canBeCombinedWith(this.packet)) {\n // packets can't be combined\n return false;\n }\n next.packet.combineWith(this.packet);\n next.timeOfCreation = Math.min(this.timeOfCreation, next.timeOfCreation);\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n this.delayed = true;\n return true;\n }\n combineWithUniqueResponseIfPossible(response, interfaceName) {\n if (this.interfaceName !== interfaceName) {\n // can't combine packets which get sent via different interfaces\n return false;\n }\n if (!this.packet.canBeCombinedWith(response.asPacket())) {\n return false; // packets can't be combined\n }\n this.packet.combineWith(response.asPacket());\n return true;\n }\n}\nexports.QueuedResponse = QueuedResponse;\nQueuedResponse.MAX_DELAY = 500; // milliseconds\n//# sourceMappingURL=QueuedResponse.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TruncatedQuery = exports.TruncatedQueryEvent = exports.TruncatedQueryResult = void 0;\n/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\nconst events_1 = require(\"events\");\nvar TruncatedQueryResult;\n(function (TruncatedQueryResult) {\n TruncatedQueryResult[TruncatedQueryResult[\"ABORT\"] = 1] = \"ABORT\";\n TruncatedQueryResult[TruncatedQueryResult[\"AGAIN_TRUNCATED\"] = 2] = \"AGAIN_TRUNCATED\";\n TruncatedQueryResult[TruncatedQueryResult[\"FINISHED\"] = 3] = \"FINISHED\";\n})(TruncatedQueryResult || (exports.TruncatedQueryResult = TruncatedQueryResult = {}));\nvar TruncatedQueryEvent;\n(function (TruncatedQueryEvent) {\n TruncatedQueryEvent[\"TIMEOUT\"] = \"timeout\";\n})(TruncatedQueryEvent || (exports.TruncatedQueryEvent = TruncatedQueryEvent = {}));\nclass TruncatedQuery extends events_1.EventEmitter {\n constructor(packet) {\n super();\n this.arrivedPackets = 1; // just for the stats\n this.timeOfArrival = new Date().getTime();\n this.packet = packet;\n this.timer = this.resetTimer();\n }\n getPacket() {\n return this.packet;\n }\n getArrivedPacketCount() {\n return this.arrivedPackets;\n }\n getTotalWaitTime() {\n return new Date().getTime() - this.timeOfArrival;\n }\n appendDNSPacket(packet) {\n this.packet.combineWith(packet);\n this.arrivedPackets++;\n if (packet.flags.truncation) { // if the appended packet is again truncated, restart the timeout\n const time = new Date().getTime();\n if (time - this.timeOfArrival > 5 * 1000) { // if the first packet, is more than 5 seconds old, we abort\n return 1 /* TruncatedQueryResult.ABORT */;\n }\n this.resetTimer();\n return 2 /* TruncatedQueryResult.AGAIN_TRUNCATED */;\n }\n else {\n clearTimeout(this.timer);\n this.removeAllListeners();\n return 3 /* TruncatedQueryResult.FINISHED */;\n }\n }\n resetTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n // timeout in time interval between 400-500ms\n return this.timer = setTimeout(this.timeout.bind(this), 400 + Math.random() * 100);\n }\n timeout() {\n this.emit(\"timeout\" /* TruncatedQueryEvent.TIMEOUT */);\n this.removeAllListeners();\n }\n}\nexports.TruncatedQuery = TruncatedQuery;\n//# sourceMappingURL=TruncatedQuery.js.map","\"use strict\";\n// name equality checks according to RFC 1035 3.1\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dnsLowerCase = void 0;\nconst asciiPattern = /[A-Z]/g;\nfunction dnsLowerCase(value) {\n return value.replace(asciiPattern, s => s.toLowerCase());\n}\nexports.dnsLowerCase = dnsLowerCase;\n//# sourceMappingURL=dns-equal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getNetAddress = exports.ipAddressFromReversAddressName = exports.formatReverseAddressPTRName = exports.shortenIPv6 = exports.enlargeIPv6 = exports.removeTLD = exports.formatHostname = exports.stringify = exports.parseFQDN = void 0;\nconst tslib_1 = require(\"tslib\");\nconst assert_1 = tslib_1.__importDefault(require(\"assert\"));\nconst net_1 = tslib_1.__importDefault(require(\"net\"));\nfunction isProtocol(part) {\n return part === \"_\" + \"tcp\" /* Protocol.TCP */ || part === \"_\" + \"udp\" /* Protocol.UDP */;\n}\nfunction isSub(part) {\n return part === \"_sub\";\n}\nfunction removePrefixedUnderscore(part) {\n return part.startsWith(\"_\") ? part.slice(1) : part;\n}\nfunction isSubTypePTRParts(parts) {\n return \"subtype\" in parts;\n}\nfunction parseFQDN(fqdn) {\n const parts = fqdn.split(\".\");\n (0, assert_1.default)(parts.length >= 3, \"Received illegal fqdn: \" + fqdn);\n let i = parts.length - 1;\n let domain = \"\";\n while (!isProtocol(parts[i])) {\n domain = removePrefixedUnderscore(parts[i]) + (domain ? \".\" + domain : \"\");\n i--;\n }\n (0, assert_1.default)(i >= 1, \"Failed to parse illegal fqdn: \" + fqdn);\n const protocol = removePrefixedUnderscore(parts[i--]);\n const type = removePrefixedUnderscore(parts[i--]);\n if (i < 0) {\n return {\n domain: domain,\n protocol: protocol,\n type: type,\n };\n }\n else if (isSub(parts[i])) {\n i--; // skip \"_sub\";\n (0, assert_1.default)(i === 0, \"Received illegal formatted sub type fqdn: \" + fqdn);\n const subtype = removePrefixedUnderscore(parts[i]);\n return {\n domain: domain,\n protocol: protocol,\n type: type,\n subtype: subtype,\n };\n }\n else {\n // the name can contain dots as of RFC 6763 4.1.1.\n const name = removePrefixedUnderscore(parts.slice(0, i + 1).join(\".\"));\n return {\n domain: domain,\n protocol: protocol,\n type: type,\n name: name,\n };\n }\n}\nexports.parseFQDN = parseFQDN;\nfunction stringify(parts) {\n (0, assert_1.default)(parts.type, \"type cannot be undefined\");\n (0, assert_1.default)(parts.type.length <= 15, \"type must not be longer than 15 characters\");\n let prefix;\n if (isSubTypePTRParts(parts)) {\n prefix = `_${parts.subtype}._sub.`;\n }\n else {\n prefix = parts.name ? `${parts.name}.` : \"\";\n }\n return `${prefix}_${parts.type}._${parts.protocol || \"tcp\" /* Protocol.TCP */}.${parts.domain || \"local\"}.`;\n}\nexports.stringify = stringify;\nfunction formatHostname(hostname, domain = \"local\") {\n (0, assert_1.default)(!hostname.endsWith(\".\"), \"hostname must not end with the root label!\");\n const tld = \".\" + domain;\n return (!hostname.endsWith(tld) ? hostname + tld : hostname) + \".\";\n}\nexports.formatHostname = formatHostname;\nfunction removeTLD(hostname) {\n if (hostname.endsWith(\".\")) { // check for the DNS root label\n hostname = hostname.substring(0, hostname.length - 1);\n }\n const lastDot = hostname.lastIndexOf(\".\");\n return hostname.slice(0, lastDot);\n}\nexports.removeTLD = removeTLD;\nfunction enlargeIPv6(address) {\n (0, assert_1.default)(net_1.default.isIPv6(address), \"Illegal argument. Must be ipv6 address!\");\n // we are not supporting ipv4-mapped ipv6 addresses here\n (0, assert_1.default)(!address.includes(\".\"), \"ipv4-mapped ipv6 addresses are currently unsupported!\");\n const split = address.split(\":\");\n if (split[0] === \"\") {\n split.splice(0, 1);\n while (split.length < 8) {\n split.unshift(\"0000\");\n }\n }\n else if (split[split.length - 1] === \"\") {\n split.splice(split.length - 1, 1);\n while (split.length < 8) {\n split.push(\"0000\");\n }\n }\n else if (split.length < 8) {\n let emptySection;\n for (emptySection = 0; emptySection < split.length; emptySection++) {\n if (split[emptySection] === \"\") { // find the first empty section\n break;\n }\n }\n const replacements = new Array(9 - split.length).fill(\"0000\");\n split.splice(emptySection, 1, ...replacements);\n }\n for (let i = 0; i < split.length; i++) {\n const element = split[i];\n if (element.length < 4) {\n const zeros = new Array(4 - element.length).fill(\"0\").join(\"\");\n split.splice(i, 1, zeros + element);\n }\n }\n const result = split.join(\":\");\n (0, assert_1.default)(split.length <= 8, `Resulting ipv6 address has more than 8 sections (${result})!`);\n return result;\n}\nexports.enlargeIPv6 = enlargeIPv6;\nfunction shortenIPv6(address) {\n if (typeof address === \"string\") {\n address = address.split(\":\");\n }\n for (let i = 0; i < address.length; i++) {\n const part = address[i];\n let j = 0;\n for (; j < Math.min(3, part.length - 1); j++) { // search for the first index which is non-zero, but leaving at least one zero\n if (part.charAt(j) !== \"0\") {\n break;\n }\n }\n address[i] = part.substr(j);\n }\n let longestBlockOfZerosIndex = -1;\n let longestBlockOfZerosLength = 0;\n for (let i = 0; i < address.length; i++) { // this is not very optimized, but it works\n if (address[i] !== \"0\") {\n continue;\n }\n let zerosCount = 1;\n let j = i + 1;\n for (; j < address.length; j++) {\n if (address[j] === \"0\") {\n zerosCount++;\n }\n else {\n break;\n }\n }\n if (zerosCount > longestBlockOfZerosLength) {\n longestBlockOfZerosIndex = i;\n longestBlockOfZerosLength = zerosCount;\n }\n i = j; // skip all the zeros we already checked + the one after that, we know that's not a zero\n }\n if (longestBlockOfZerosIndex !== -1) {\n const startOrEnd = longestBlockOfZerosIndex === 0 || (longestBlockOfZerosIndex + longestBlockOfZerosLength === 8);\n address[longestBlockOfZerosIndex] = startOrEnd ? \":\" : \"\";\n if (longestBlockOfZerosLength > 1) {\n address.splice(longestBlockOfZerosIndex + 1, longestBlockOfZerosLength - 1);\n }\n }\n const result = address.join(\":\");\n if (result === \":\") { // special case for the unspecified address\n return \"::\";\n }\n return result;\n}\nexports.shortenIPv6 = shortenIPv6;\nfunction formatReverseAddressPTRName(address) {\n if (net_1.default.isIPv4(address)) {\n const split = address.split(\".\").reverse();\n return split.join(\".\") + \".in-addr.arpa\";\n }\n else if (net_1.default.isIPv6(address)) {\n address = enlargeIPv6(address).toUpperCase();\n const nibbleSplit = address.replace(/:/g, \"\").split(\"\").reverse();\n (0, assert_1.default)(nibbleSplit.length === 32, \"Encountered invalid ipv6 address length! \" + nibbleSplit.length);\n return nibbleSplit.join(\".\") + \".ip6.arpa\";\n }\n else {\n throw new Error(\"Supplied illegal ip address format: \" + address);\n }\n}\nexports.formatReverseAddressPTRName = formatReverseAddressPTRName;\nfunction ipAddressFromReversAddressName(name) {\n name = name.toLowerCase();\n if (name.endsWith(\".in-addr.arpa\")) {\n const split = name.replace(\".in-addr.arpa\", \"\").split(\".\").reverse();\n return split.join(\".\");\n }\n else if (name.endsWith(\".ip6.arpa\")) {\n const split = name.replace(\".ip6.arpa\", \"\").split(\".\").reverse();\n (0, assert_1.default)(split.length === 32, \"Encountered illegal length for .ip6.arpa split!\");\n const parts = [];\n for (let i = 0; i < split.length; i += 4) {\n parts.push(split.slice(i, i + 4).join(\"\"));\n }\n return shortenIPv6(parts.join(\":\"));\n }\n else {\n throw new Error(\"Supplied unknown reverse address name format: \" + name);\n }\n}\nexports.ipAddressFromReversAddressName = ipAddressFromReversAddressName;\nfunction getNetAddress(address, netmask) {\n (0, assert_1.default)(net_1.default.isIP(address) === net_1.default.isIP(netmask), \"IP address version must match. Netmask cannot have a version different from the address!\");\n if (net_1.default.isIPv4(address)) {\n const addressParts = address.split(\".\");\n const netmaskParts = netmask.split(\".\");\n const netAddressParts = new Array(4);\n for (let i = 0; i < addressParts.length; i++) {\n const addressNum = parseInt(addressParts[i]);\n const netmaskNum = parseInt(netmaskParts[i]);\n netAddressParts[i] = (addressNum & netmaskNum).toString();\n }\n return netAddressParts.join(\".\");\n }\n else if (net_1.default.isIPv6(address)) {\n const addressParts = enlargeIPv6(address).split(\":\");\n const netmaskParts = enlargeIPv6(netmask).split(\":\");\n const netAddressParts = new Array(8);\n for (let i = 0; i < addressParts.length; i++) {\n const addressNum = parseInt(addressParts[i], 16);\n const netmaskNum = parseInt(netmaskParts[i], 16);\n netAddressParts[i] = (addressNum & netmaskNum).toString(16);\n }\n return shortenIPv6(enlargeIPv6(netAddressParts.join(\":\")));\n }\n else {\n throw new Error(\"Illegal argument. Address is not an ip address!\");\n }\n}\nexports.getNetAddress = getNetAddress;\n//# sourceMappingURL=domain-formatter.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ServerClosedError = exports.InterfaceNotFoundError = exports.ERR_SERVER_CLOSED = exports.ERR_INTERFACE_NOT_FOUND = void 0;\nexports.ERR_INTERFACE_NOT_FOUND = \"ERR_INTERFACE_NOT_FOUND\";\nexports.ERR_SERVER_CLOSED = \"ERR_SERVER_CLOSED\";\nclass InterfaceNotFoundError extends Error {\n constructor(message) {\n super(message);\n this.name = \"ERR_INTERFACE_NOT_FOUND\";\n }\n}\nexports.InterfaceNotFoundError = InterfaceNotFoundError;\nclass ServerClosedError extends Error {\n constructor(message) {\n super(message);\n this.name = exports.ERR_SERVER_CLOSED;\n }\n}\nexports.ServerClosedError = ServerClosedError;\n//# sourceMappingURL=errors.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PromiseTimeout = void 0;\nfunction PromiseTimeout(timeout) {\n return new Promise(resolve => {\n setTimeout(() => resolve(), timeout);\n });\n}\nexports.PromiseTimeout = PromiseTimeout;\n//# sourceMappingURL=promise-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sortedInsert = void 0;\n/**\n * Insert into sorted array using binary search.\n *\n * @param array - An already sorted array.\n * @param element - The element to be inserted.\n * @param comparator - Comparator to determine the order for the elements.\n */\nfunction sortedInsert(array, element, comparator) {\n let low = 0;\n let high = array.length - 1;\n let destination = -1; // if it doesn't change, we insert at position 0 (array is empty)\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const comparison = comparator(element, array[mid]);\n if (comparison === 0) {\n destination = mid + 1; // we currently don't care in which order items are sorted which have the same \"order key\"\n break;\n }\n if (comparison < 0) { // meaning element < array[mid]\n high = mid - 1;\n }\n else { // meaning element > array[mid]\n low = mid + 1;\n }\n }\n if (array.length === 0) {\n destination = 0;\n }\n else if (destination < 0) {\n if (comparator(element, array[low]) > 0) {\n destination = low + 1;\n }\n else {\n destination = low;\n }\n }\n // abuse splice method to insert at destination\n array.splice(destination, 0, element);\n}\nexports.sortedInsert = sortedInsert;\n//# sourceMappingURL=sorted-array.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.runTiebreaking = exports.TiebreakingResult = exports.rrComparator = void 0;\nfunction rrComparator(recordA, recordB) {\n if (recordA.class !== recordB.class) {\n return recordA.class - recordB.class;\n }\n if (recordA.type !== recordB.type) {\n return recordA.type - recordB.type;\n }\n // now follows a raw comparison of the binary data\n const aData = recordA.getRawData();\n const bData = recordB.getRawData();\n const maxLength = Math.max(aData.length, bData.length); // get the biggest length\n for (let i = 0; i < maxLength; i++) {\n if (i >= aData.length && i < bData.length) { // a ran out of data and b still holds data\n return -1;\n }\n else if (i >= bData.length && i < aData.length) { // b ran out of data and a still hold data\n return 1;\n }\n const aByte = aData.readUInt8(i);\n const bByte = bData.readUInt8(i);\n if (aByte !== bByte) {\n return aByte < bByte ? -1 : 1;\n }\n }\n // if we reach here we have a tie. both records represent the SAME data.\n return 0;\n}\nexports.rrComparator = rrComparator;\nvar TiebreakingResult;\n(function (TiebreakingResult) {\n /**\n * The opponent is considered the winner\n */\n TiebreakingResult[TiebreakingResult[\"OPPONENT\"] = -1] = \"OPPONENT\";\n /**\n * Both try to expose the exact same data\n */\n TiebreakingResult[TiebreakingResult[\"TIE\"] = 0] = \"TIE\";\n /**\n * The host is considered the winner\n */\n TiebreakingResult[TiebreakingResult[\"HOST\"] = 1] = \"HOST\";\n})(TiebreakingResult || (exports.TiebreakingResult = TiebreakingResult = {}));\n/**\n * Runs the tiebreaking algorithm to resolve the race condition of simultaneous probing.\n * The input sets MUST already be sorted.\n *\n * @param {ResourceRecord[]} host - sorted list of records the host wants to publish\n * @param {ResourceRecord[]} opponent - sorted list of records the opponent wants to publish\n * @returns the result {@see TiebreakingResult} of the tiebreaking algorithm\n */\nfunction runTiebreaking(host, opponent) {\n const maxLength = Math.max(host.length, opponent.length);\n for (let i = 0; i < maxLength; i++) {\n if (i >= host.length && i < opponent.length) { // host runs out of records and opponent still has some\n return -1 /* TiebreakingResult.OPPONENT */; // opponent wins\n }\n else if (i >= opponent.length && i < host.length) { // opponent runs out of records and host still has some\n return 1 /* TiebreakingResult.HOST */; // host wins\n }\n const recordComparison = rrComparator(host[i], opponent[i]);\n if (recordComparison !== 0) {\n return recordComparison;\n }\n }\n return 0 /* TiebreakingResult.TIE */; // they expose the exact same data\n}\nexports.runTiebreaking = runTiebreaking;\n//# sourceMappingURL=tiebreaking.js.map","// dbus.freedesktop.org/doc/dbus-specification.html\n\nconst EventEmitter = require('events').EventEmitter;\nconst net = require('net');\n\nconst constants = require('./lib/constants');\nconst message = require('./lib/message');\nconst clientHandshake = require('./lib/handshake');\nconst serverHandshake = require('./lib/server-handshake');\nconst MessageBus = require('./lib/bus');\nconst server = require('./lib/server');\n\nfunction createStream(opts) {\n if (opts.stream) return opts.stream;\n var host = opts.host;\n var port = opts.port;\n var socket = opts.socket;\n if (socket) return net.createConnection(socket);\n if (port) return net.createConnection(port, host);\n\n var busAddress = opts.busAddress || process.env.DBUS_SESSION_BUS_ADDRESS;\n if (!busAddress) throw new Error('unknown bus address');\n\n var addresses = busAddress.split(';');\n for (var i = 0; i < addresses.length; ++i) {\n var address = addresses[i];\n var familyParams = address.split(':');\n var family = familyParams[0];\n var params = {};\n familyParams[1].split(',').map(function (p) {\n var keyVal = p.split('=');\n params[keyVal[0]] = keyVal[1];\n });\n\n try {\n switch (family.toLowerCase()) {\n case 'tcp':\n host = params.host || 'localhost';\n port = params.port;\n return net.createConnection(port, host);\n case 'unix':\n if (params.socket) return net.createConnection(params.socket);\n if (params.abstract) {\n var abs = require('abstract-socket');\n return abs.connect('\\u0000' + params.abstract);\n }\n if (params.path) return net.createConnection(params.path);\n throw new Error(\n \"not enough parameters for 'unix' connection - you need to specify 'socket' or 'abstract' or 'path' parameter\"\n );\n case 'unixexec':\n var eventStream = require('event-stream');\n var spawn = require('child_process').spawn;\n var args = [];\n for (var n = 1; params['arg' + n]; n++) args.push(params['arg' + n]);\n var child = spawn(params.path, args);\n\n return eventStream.duplex(child.stdin, child.stdout);\n default:\n throw new Error('unknown address type:' + family);\n }\n } catch (e) {\n if (i < addresses.length - 1) {\n console.warn(e.message);\n continue;\n } else {\n throw e;\n }\n }\n }\n}\n\nfunction createConnection(opts) {\n var self = new EventEmitter();\n if (!opts) opts = {};\n var stream = (self.stream = createStream(opts));\n stream.setNoDelay();\n\n stream.on('error', function (err) {\n // forward network and stream errors\n self.emit('error', err);\n });\n\n stream.on('end', function () {\n self.emit('end');\n self.message = function () {\n console.warn(\"Didn't write bytes to closed stream\");\n };\n });\n\n self.end = function () {\n stream.end();\n return self;\n };\n\n var handshake = opts.server ? serverHandshake : clientHandshake;\n handshake(stream, opts, function (error, guid) {\n if (error) {\n return self.emit('error', error);\n }\n self.guid = guid;\n self.emit('connect');\n message.unmarshalMessages(\n stream,\n function (message) {\n self.emit('message', message);\n },\n opts\n );\n });\n\n self._messages = [];\n\n // pre-connect version, buffers all messages. replaced after connect\n self.message = function (msg) {\n self._messages.push(msg);\n };\n\n self.once('connect', function () {\n self.state = 'connected';\n for (var i = 0; i < self._messages.length; ++i) {\n stream.write(message.marshall(self._messages[i]));\n }\n self._messages.length = 0;\n\n // no need to buffer once connected\n self.message = function (msg) {\n stream.write(message.marshall(msg));\n };\n });\n\n return self;\n}\n\nmodule.exports.createClient = function (params) {\n var connection = createConnection(params || {});\n return new MessageBus(connection, params || {});\n};\n\nmodule.exports.systemBus = function () {\n return module.exports.createClient({\n busAddress:\n process.env.DBUS_SYSTEM_BUS_ADDRESS ||\n 'unix:path=/var/run/dbus/system_bus_socket'\n });\n};\n\nmodule.exports.sessionBus = function (opts) {\n return module.exports.createClient(opts);\n};\n\nmodule.exports.messageType = constants.messageType;\nmodule.exports.createConnection = createConnection;\n\nmodule.exports.createServer = server.createServer;\n","const Buffer = require('safe-buffer').Buffer;\n\nfunction align(ps, n) {\n var pad = n - (ps._offset % n);\n if (pad === 0 || pad === n) return;\n // TODO: write8(0) in a loop (3 to 7 times here) could be more efficient\n var padBuff = Buffer.alloc(pad);\n ps.put(Buffer.from(padBuff));\n ps._offset += pad;\n}\n\nexports.align = align;\n","const EventEmitter = require('events').EventEmitter;\nconst constants = require('./constants');\nconst stdDbusIfaces = require('./stdifaces');\nconst introspect = require('./introspect').introspectBus;\n\nmodule.exports = function bus(conn, opts) {\n if (!(this instanceof bus)) {\n return new bus(conn);\n }\n if (!opts) opts = {};\n\n var self = this;\n this.connection = conn;\n this.serial = 1;\n this.cookies = {}; // TODO: rename to methodReturnHandlers\n this.methodCallHandlers = {};\n this.signals = new EventEmitter();\n this.exportedObjects = {};\n\n this.invoke = function (msg, callback) {\n if (!msg.type) msg.type = constants.messageType.methodCall;\n msg.serial = self.serial++;\n this.cookies[msg.serial] = callback;\n self.connection.message(msg);\n };\n\n this.invokeDbus = function (msg, callback) {\n if (!msg.path) msg.path = '/org/freedesktop/DBus';\n if (!msg.destination) msg.destination = 'org.freedesktop.DBus';\n if (!msg['interface']) msg['interface'] = 'org.freedesktop.DBus';\n self.invoke(msg, callback);\n };\n\n this.mangle = function (path, iface, member) {\n var obj = {};\n if (typeof path === 'object') {\n // handle one argumant case mangle(msg)\n obj.path = path.path;\n obj['interface'] = path['interface'];\n obj.member = path.member;\n } else {\n obj.path = path;\n obj['interface'] = iface;\n obj.member = member;\n }\n return JSON.stringify(obj);\n };\n\n this.sendSignal = function (path, iface, name, signature, args) {\n var signalMsg = {\n type: constants.messageType.signal,\n serial: self.serial++,\n interface: iface,\n path: path,\n member: name\n };\n if (signature) {\n signalMsg.signature = signature;\n signalMsg.body = args;\n }\n self.connection.message(signalMsg);\n };\n\n // Warning: errorName must respect the same rules as interface names (must contain a dot)\n this.sendError = function (msg, errorName, errorText) {\n var reply = {\n type: constants.messageType.error,\n serial: self.serial++,\n replySerial: msg.serial,\n destination: msg.sender,\n errorName: errorName,\n signature: 's',\n body: [errorText]\n };\n this.connection.message(reply);\n };\n\n this.sendReply = function (msg, signature, body) {\n var reply = {\n type: constants.messageType.methodReturn,\n serial: self.serial++,\n replySerial: msg.serial,\n destination: msg.sender,\n signature: signature,\n body: body\n };\n this.connection.message(reply);\n };\n\n // route reply/error\n this.connection.on('message', function (msg) {\n function invoke(impl, func, resultSignature) {\n Promise.resolve()\n .then(function () {\n return func.apply(impl, (msg.body || []).concat(msg));\n })\n .then(\n function (methodReturnResult) {\n var methodReturnReply = {\n type: constants.messageType.methodReturn,\n serial: self.serial++,\n destination: msg.sender,\n replySerial: msg.serial\n };\n if (methodReturnResult !== null) {\n methodReturnReply.signature = resultSignature;\n methodReturnReply.body = [methodReturnResult];\n }\n self.connection.message(methodReturnReply);\n },\n function (e) {\n self.sendError(\n msg,\n e.dbusName || 'org.freedesktop.DBus.Error.Failed',\n e.message || ''\n );\n }\n );\n }\n\n var handler;\n if (\n msg.type === constants.messageType.methodReturn ||\n msg.type === constants.messageType.error\n ) {\n handler = self.cookies[msg.replySerial];\n if (handler) {\n delete self.cookies[msg.replySerial];\n var props = {\n connection: self.connection,\n bus: self,\n message: msg,\n signature: msg.signature\n };\n var args = msg.body || [];\n if (msg.type === constants.messageType.methodReturn) {\n args = [null].concat(args); // first argument - no errors, null\n handler.apply(props, args); // body as array of arguments\n } else {\n handler.call(props, { name: msg.errorName, message: args }); // body as first argument\n }\n }\n } else if (msg.type === constants.messageType.signal) {\n self.signals.emit(self.mangle(msg), msg.body, msg.signature);\n } else {\n // methodCall\n\n if (stdDbusIfaces(msg, self)) return;\n\n // exported interfaces handlers\n var obj, iface, impl;\n if ((obj = self.exportedObjects[msg.path])) {\n if ((iface = obj[msg['interface']])) {\n // now we are ready to serve msg.member\n impl = iface[1];\n var func = impl[msg.member];\n if (!func) {\n self.sendError(\n msg,\n 'org.freedesktop.DBus.Error.UnknownMethod',\n `Method \"${msg.member}\" on interface \"${msg.interface}\" doesn't exist`\n );\n return;\n }\n // TODO safety check here\n var resultSignature = iface[0].methods[msg.member][1];\n invoke(impl, func, resultSignature);\n return;\n } else {\n console.error(`Interface ${msg['interface']} is not supported`);\n // TODO: respond with standard dbus error\n }\n }\n // setMethodCall handlers\n handler = self.methodCallHandlers[self.mangle(msg)];\n if (handler) {\n invoke(null, handler[0], handler[1]);\n } else {\n self.sendError(\n msg,\n 'org.freedesktop.DBus.Error.UnknownService',\n 'Uh oh oh'\n );\n }\n }\n });\n\n this.setMethodCallHandler = function (objectPath, iface, member, handler) {\n var key = self.mangle(objectPath, iface, member);\n self.methodCallHandlers[key] = handler;\n };\n\n this.exportInterface = function (obj, path, iface) {\n var entry;\n if (!self.exportedObjects[path]) {\n entry = self.exportedObjects[path] = {};\n } else {\n entry = self.exportedObjects[path];\n }\n entry[iface.name] = [iface, obj];\n // monkey-patch obj.emit()\n if (typeof obj.emit === 'function') {\n var oldEmit = obj.emit;\n obj.emit = function () {\n var args = Array.prototype.slice.apply(arguments);\n var signalName = args[0];\n if (!signalName) throw new Error('Trying to emit undefined signa');\n\n //send signal to bus\n var signal;\n if (iface.signals && iface.signals[signalName]) {\n signal = iface.signals[signalName];\n var signalMsg = {\n type: constants.messageType.signal,\n serial: self.serial++,\n interface: iface.name,\n path: path,\n member: signalName\n };\n if (signal[0]) {\n signalMsg.signature = signal[0];\n signalMsg.body = args.slice(1);\n }\n self.connection.message(signalMsg);\n self.serial++;\n }\n // note that local emit is likely to be called before signal arrives\n // to remote subscriber\n oldEmit.apply(obj, args);\n };\n }\n // TODO: emit ObjectManager's InterfaceAdded\n };\n\n // register name\n if (opts.direct !== true) {\n this.invokeDbus({ member: 'Hello' }, function (err, name) {\n if (err) throw new Error(err);\n self.name = name;\n });\n } else {\n self.name = null;\n }\n\n function DBusObject(name, service) {\n this.name = name;\n this.service = service;\n this.as = function (name) {\n return this.proxy[name];\n };\n }\n\n function DBusService(name, bus) {\n this.name = name;\n this.bus = bus;\n this.getObject = function (name, callback) {\n if (name === undefined)\n return callback(new Error('Object name is null or undefined'));\n var obj = new DBusObject(name, this);\n introspect(obj, function (err, ifaces, nodes) {\n if (err) return callback(err);\n obj.proxy = ifaces;\n obj.nodes = nodes;\n callback(null, obj);\n });\n };\n\n this.getInterface = function (objName, ifaceName, callback) {\n this.getObject(objName, function (err, obj) {\n if (err) return callback(err);\n callback(null, obj.as(ifaceName));\n });\n };\n }\n\n this.getService = function (name) {\n return new DBusService(name, this);\n };\n\n this.getObject = function (path, name, callback) {\n var service = this.getService(path);\n return service.getObject(name, callback);\n };\n\n this.getInterface = function (path, objname, name, callback) {\n return this.getObject(path, objname, function (err, obj) {\n if (err) return callback(err);\n callback(null, obj.as(name));\n });\n };\n\n // TODO: refactor\n\n // bus meta functions\n this.addMatch = function (match, callback) {\n this.invokeDbus(\n { member: 'AddMatch', signature: 's', body: [match] },\n callback\n );\n };\n\n this.removeMatch = function (match, callback) {\n this.invokeDbus(\n { member: 'RemoveMatch', signature: 's', body: [match] },\n callback\n );\n };\n\n this.getId = function (callback) {\n this.invokeDbus({ member: 'GetId' }, callback);\n };\n\n this.requestName = function (name, flags, callback) {\n this.invokeDbus(\n { member: 'RequestName', signature: 'su', body: [name, flags] },\n function (err, name) {\n if (callback) callback(err, name);\n }\n );\n };\n\n this.releaseName = function (name, callback) {\n this.invokeDbus(\n { member: 'ReleaseName', signature: 's', body: [name] },\n callback\n );\n };\n\n this.listNames = function (callback) {\n this.invokeDbus({ member: 'ListNames' }, callback);\n };\n\n this.listActivatableNames = function (callback) {\n this.invokeDbus({ member: 'ListActivatableNames' }, callback);\n };\n\n this.updateActivationEnvironment = function (env, callback) {\n this.invokeDbus(\n {\n member: 'UpdateActivationEnvironment',\n signature: 'a{ss}',\n body: [env]\n },\n callback\n );\n };\n\n this.startServiceByName = function (name, flags, callback) {\n this.invokeDbus(\n { member: 'StartServiceByName', signature: 'su', body: [name, flags] },\n callback\n );\n };\n\n this.getConnectionUnixUser = function (name, callback) {\n this.invokeDbus(\n { member: 'GetConnectionUnixUser', signature: 's', body: [name] },\n callback\n );\n };\n\n this.getConnectionUnixProcessId = function (name, callback) {\n this.invokeDbus(\n { member: 'GetConnectionUnixProcessID', signature: 's', body: [name] },\n callback\n );\n };\n\n this.getNameOwner = function (name, callback) {\n this.invokeDbus(\n { member: 'GetNameOwner', signature: 's', body: [name] },\n callback\n );\n };\n\n this.nameHasOwner = function (name, callback) {\n this.invokeDbus(\n { member: 'NameHasOwner', signature: 's', body: [name] },\n callback\n );\n };\n};\n","module.exports = {\n messageType: {\n invalid: 0,\n methodCall: 1,\n methodReturn: 2,\n error: 3,\n signal: 4\n },\n\n headerTypeName: [\n null,\n 'path',\n 'interface',\n 'member',\n 'errorName',\n 'replySerial',\n 'destination',\n 'sender',\n 'signature'\n ],\n\n // TODO: merge to single hash? e.g path -> [1, 'o']\n fieldSignature: {\n path: 'o',\n interface: 's',\n member: 's',\n errorName: 's',\n replySerial: 'u',\n destination: 's',\n sender: 's',\n signature: 'g'\n },\n headerTypeId: {\n path: 1,\n interface: 2,\n member: 3,\n errorName: 4,\n replySerial: 5,\n destination: 6,\n sender: 7,\n signature: 8\n },\n protocolVersion: 1,\n flags: {\n noReplyExpected: 1,\n noAutoStart: 2\n },\n endianness: {\n le: 108,\n be: 66\n },\n messageSignature: 'yyyyuua(yv)',\n defaultAuthMethods: ['EXTERNAL', 'DBUS_COOKIE_SHA1', 'ANONYMOUS']\n};\n","const Long = require('@homebridge/long');\nconst parseSignature = require('./signature');\n\n// Buffer + position + global start position ( used in alignment )\nfunction DBusBuffer(buffer, startPos, options) {\n if (typeof options !== 'object') {\n options = { ayBuffer: true, ReturnLongjs: false };\n } else if (options.ayBuffer === undefined) {\n // default settings object\n options.ayBuffer = true; // enforce truthy default props\n }\n this.options = options;\n this.buffer = buffer;\n (this.startPos = startPos ? startPos : 0), (this.pos = 0);\n}\n\nDBusBuffer.prototype.align = function (power) {\n var allbits = (1 << power) - 1;\n var paddedOffset = ((this.pos + this.startPos + allbits) >> power) << power;\n this.pos = paddedOffset - this.startPos;\n};\n\nDBusBuffer.prototype.readInt8 = function () {\n this.pos++;\n return this.buffer[this.pos - 1];\n};\n\nDBusBuffer.prototype.readSInt16 = function () {\n this.align(1);\n var res = this.buffer.readInt16LE(this.pos);\n this.pos += 2;\n return res;\n};\n\nDBusBuffer.prototype.readInt16 = function () {\n this.align(1);\n var res = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n return res;\n};\n\nDBusBuffer.prototype.readSInt32 = function () {\n this.align(2);\n var res = this.buffer.readInt32LE(this.pos);\n this.pos += 4;\n return res;\n};\n\nDBusBuffer.prototype.readInt32 = function () {\n this.align(2);\n var res = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n return res;\n};\n\nDBusBuffer.prototype.readDouble = function () {\n this.align(3);\n var res = this.buffer.readDoubleLE(this.pos);\n this.pos += 8;\n return res;\n};\n\nDBusBuffer.prototype.readString = function (len) {\n if (len === 0) {\n this.pos++;\n return '';\n }\n var res = this.buffer.toString('utf8', this.pos, this.pos + len);\n this.pos += len + 1; // dbus strings are always zero-terminated ('s' and 'g' types)\n return res;\n};\n\nDBusBuffer.prototype.readTree = function readTree(tree) {\n switch (tree.type) {\n case '(':\n case '{':\n case 'r':\n this.align(3);\n return this.readStruct(tree.child);\n case 'a':\n if (!tree.child || tree.child.length !== 1)\n throw new Error('Incorrect array element signature');\n var arrayBlobLength = this.readInt32();\n return this.readArray(tree.child[0], arrayBlobLength);\n case 'v':\n return this.readVariant();\n default:\n return this.readSimpleType(tree.type);\n }\n};\n\nDBusBuffer.prototype.read = function read(signature) {\n var tree = parseSignature(signature);\n return this.readStruct(tree);\n};\n\nDBusBuffer.prototype.readVariant = function readVariant() {\n var signature = this.readSimpleType('g');\n var tree = parseSignature(signature);\n return [tree, this.readStruct(tree)];\n};\n\nDBusBuffer.prototype.readStruct = function readStruct(struct) {\n var result = [];\n for (var i = 0; i < struct.length; ++i) {\n result.push(this.readTree(struct[i]));\n }\n return result;\n};\n\nDBusBuffer.prototype.readArray = function readArray(eleType, arrayBlobSize) {\n var result;\n var start = this.pos;\n\n // special case: treat ay as Buffer\n if (eleType.type === 'y' && this.options.ayBuffer) {\n this.pos += arrayBlobSize;\n return this.buffer.slice(start, this.pos);\n }\n\n // end of array is start of first element + array size\n // we need to add 4 bytes if not on 8-byte boundary\n // and array element needs 8 byte alignment\n if (['x', 't', 'd', '{', '(', 'r'].indexOf(eleType.type) !== -1)\n this.align(3);\n var end = this.pos + arrayBlobSize;\n result = [];\n while (this.pos < end) result.push(this.readTree(eleType));\n return result;\n};\n\nDBusBuffer.prototype.readSimpleType = function readSimpleType(t) {\n var data, len, word0, word1;\n switch (t) {\n case 'y':\n return this.readInt8();\n case 'b':\n // TODO: spec says that true is strictly 1 and false is strictly 0\n // shold we error (or warn?) when non 01 values?\n return this.readInt32() ? true : false;\n case 'n':\n return this.readSInt16();\n case 'q':\n return this.readInt16();\n case 'u':\n return this.readInt32();\n case 'i':\n return this.readSInt32();\n case 'g':\n len = this.readInt8();\n return this.readString(len);\n case 's':\n case 'o':\n len = this.readInt32();\n return this.readString(len);\n // TODO: validate object path here\n //if (t === 'o' && !isValidObjectPath(str))\n // throw new Error('string is not a valid object path'));\n case 'x':\n //signed\n this.align(3);\n word0 = this.readInt32();\n word1 = this.readInt32();\n data = Long.fromBits(word0, word1, false);\n if (this.options.ReturnLongjs) return data;\n return data.toNumber(); // convert to number (good up to 53 bits)\n case 't':\n //unsigned\n this.align(3);\n word0 = this.readInt32();\n word1 = this.readInt32();\n data = Long.fromBits(word0, word1, true);\n if (this.options.ReturnLongjs) return data;\n return data.toNumber(); // convert to number (good up to 53 bits)\n case 'd':\n return this.readDouble();\n default:\n throw new Error(`Unsupported type: ${t}`);\n }\n};\n\nmodule.exports = DBusBuffer;\n","const Buffer = require('safe-buffer').Buffer;\nconst crypto = require('crypto');\nconst fs = require('fs');\nconst path = require('path');\n\nconst constants = require('./constants');\nconst readLine = require('./readline');\n\nfunction sha1(input) {\n var shasum = crypto.createHash('sha1');\n shasum.update(input);\n return shasum.digest('hex');\n}\n\nfunction getUserHome() {\n return process.env[process.platform.match(/$win/) ? 'USERPROFILE' : 'HOME'];\n}\n\nfunction getCookie(context, id, cb) {\n // http://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms-sha\n var dirname = path.join(getUserHome(), '.dbus-keyrings');\n // > There is a default context, \"org_freedesktop_general\" that's used by servers that do not specify otherwise.\n if (context.length === 0) context = 'org_freedesktop_general';\n\n var filename = path.join(dirname, context);\n // check it's not writable by others and readable by user\n fs.stat(dirname, function (err, stat) {\n if (err) return cb(err);\n if (stat.mode & 0o22)\n return cb(\n new Error(\n 'User keyrings directory is writeable by other users. Aborting authentication'\n )\n );\n // eslint-disable-next-line no-prototype-builtins\n if (process.hasOwnProperty('getuid') && stat.uid !== process.getuid())\n return cb(\n new Error(\n 'Keyrings directory is not owned by the current user. Aborting authentication!'\n )\n );\n fs.readFile(filename, 'ascii', function (err, keyrings) {\n if (err) return cb(err);\n var lines = keyrings.split('\\n');\n for (var l = 0; l < lines.length; ++l) {\n var data = lines[l].split(' ');\n if (id === data[0]) return cb(null, data[2]);\n }\n return cb(new Error('cookie not found'));\n });\n });\n}\n\nfunction hexlify(input) {\n return Buffer.from(input.toString(), 'ascii').toString('hex');\n}\n\nmodule.exports = function auth(stream, opts, cb) {\n // filter used to make a copy so we don't accidently change opts data\n var authMethods;\n if (opts.authMethods) {\n authMethods = opts.authMethods;\n } else {\n authMethods = constants.defaultAuthMethods;\n }\n stream.write('\\0');\n tryAuth(stream, authMethods.slice(), cb);\n};\n\nfunction tryAuth(stream, methods, cb) {\n if (methods.length === 0) {\n return cb(new Error('No authentication methods left to try'));\n }\n\n var authMethod = methods.shift();\n // eslint-disable-next-line no-prototype-builtins\n var uid = process.hasOwnProperty('getuid') ? process.getuid() : 0;\n var id = hexlify(uid);\n\n function beginOrNextAuth() {\n readLine(stream, function (line) {\n var ok = line.toString('ascii').match(/^([A-Za-z]+) (.*)/);\n if (ok && ok[1] === 'OK') {\n stream.write('BEGIN\\r\\n');\n return cb(null, ok[2]); // ok[2] = guid. Do we need it?\n } else {\n // TODO: parse error!\n if (!methods.empty) {\n tryAuth(stream, methods, cb);\n } else {\n return cb(line);\n }\n }\n });\n }\n\n switch (authMethod) {\n case 'EXTERNAL':\n stream.write(`AUTH ${authMethod} ${id}\\r\\n`);\n beginOrNextAuth();\n break;\n case 'DBUS_COOKIE_SHA1':\n stream.write(`AUTH ${authMethod} ${id}\\r\\n`);\n readLine(stream, function (line) {\n var data = Buffer.from(line.toString().split(' ')[1].trim(), 'hex')\n .toString()\n .split(' ');\n var cookieContext = data[0];\n var cookieId = data[1];\n var serverChallenge = data[2];\n // any random 16 bytes should work, sha1(rnd) to make it simplier\n var clientChallenge = crypto.randomBytes(16).toString('hex');\n getCookie(cookieContext, cookieId, function (err, cookie) {\n if (err) return cb(err);\n var response = sha1(\n [serverChallenge, clientChallenge, cookie].join(':')\n );\n var reply = hexlify(clientChallenge + response);\n stream.write(`DATA ${reply}\\r\\n`);\n beginOrNextAuth();\n });\n });\n break;\n case 'ANONYMOUS':\n stream.write('AUTH ANONYMOUS \\r\\n');\n beginOrNextAuth();\n break;\n default:\n console.error(`Unsupported auth method: ${authMethod}`);\n beginOrNextAuth();\n break;\n }\n}\n","const xml2js = require('xml2js');\n\nmodule.exports.introspectBus = function (obj, callback) {\n var bus = obj.service.bus;\n bus.invoke(\n {\n destination: obj.service.name,\n path: obj.name,\n interface: 'org.freedesktop.DBus.Introspectable',\n member: 'Introspect'\n },\n function (err, xml) {\n module.exports.processXML(err, xml, obj, callback);\n }\n );\n};\n\nmodule.exports.processXML = function (err, xml, obj, callback) {\n if (err) return callback(err);\n var parser = new xml2js.Parser();\n parser.parseString(xml, function (err, result) {\n if (err) return callback(err);\n if (!result.node) throw new Error('No root XML node');\n result = result.node; // unwrap the root node\n // If no interface, try first sub node?\n if (!result.interface) {\n if (result.node && result.node.length > 0 && result.node[0]['$']) {\n var subObj = Object.assign(obj, {});\n if (subObj.name.slice(-1) !== '/') subObj.name += '/';\n subObj.name += result.node[0]['$'].name;\n return module.exports.introspectBus(subObj, callback);\n }\n return callback(new Error('No such interface found'));\n }\n var proxy = {};\n var nodes = [];\n var ifaceName, method, property, iface, arg, signature, currentIface;\n var ifaces = result['interface'];\n var xmlnodes = result['node'] || [];\n\n for (var n = 1; n < xmlnodes.length; ++n) {\n // Start at 1 because we want to skip the root node\n nodes.push(xmlnodes[n]['$']['name']);\n }\n\n for (var i = 0; i < ifaces.length; ++i) {\n iface = ifaces[i];\n ifaceName = iface['$'].name;\n currentIface = proxy[ifaceName] = new DBusInterface(obj, ifaceName);\n\n for (var m = 0; iface.method && m < iface.method.length; ++m) {\n method = iface.method[m];\n signature = '';\n var methodName = method['$'].name;\n for (var a = 0; method.arg && a < method.arg.length; ++a) {\n arg = method.arg[a]['$'];\n if (arg.direction === 'in') signature += arg.type;\n }\n // add method\n currentIface.$createMethod(methodName, signature);\n }\n for (var p = 0; iface.property && p < iface.property.length; ++p) {\n property = iface.property[p];\n currentIface.$createProp(\n property['$'].name,\n property['$'].type,\n property['$'].access\n );\n }\n // TODO: introspect signals\n }\n callback(null, proxy, nodes);\n });\n};\n\nfunction DBusInterface(parent_obj, ifname) {\n // Since methods and props presently get added directly to the object, to avoid collision with existing names we must use $ naming convention as $ is invalid for dbus member names\n // https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names\n this.$parent = parent_obj; // parent DbusObject\n this.$name = ifname; // string interface name\n this.$methods = {}; // dictionary of methods (exposed for test), should we just store signature or use object to store more info?\n //this.$signals = {};\n this.$properties = {};\n this.$callbacks = [];\n this.$sigHandlers = [];\n}\nDBusInterface.prototype.$getSigHandler = function (callback) {\n var index;\n if ((index = this.$callbacks.indexOf(callback)) === -1) {\n index = this.$callbacks.push(callback) - 1;\n this.$sigHandlers[index] = function (messageBody) {\n callback.apply(null, messageBody);\n };\n }\n return this.$sigHandlers[index];\n};\nDBusInterface.prototype.addListener = DBusInterface.prototype.on = function (\n signame,\n callback\n) {\n // http://dbus.freedesktop.org/doc/api/html/group__DBusBus.html#ga4eb6401ba014da3dbe3dc4e2a8e5b3ef\n // An example is \"type='signal',sender='org.freedesktop.DBus', interface='org.freedesktop.DBus',member='Foo', path='/bar/foo',destination=':452345.34'\" ...\n var bus = this.$parent.service.bus;\n var signalFullName = bus.mangle(this.$parent.name, this.$name, signame);\n if (!bus.signals.listeners(signalFullName).length) {\n // This is the first time, so call addMatch\n var match = getMatchRule(this.$parent.name, this.$name, signame);\n bus.addMatch(\n match,\n function (err) {\n if (err) throw new Error(err);\n bus.signals.on(signalFullName, this.$getSigHandler(callback));\n }.bind(this)\n );\n } else {\n // The match is already there, just add event listener\n bus.signals.on(signalFullName, this.$getSigHandler(callback));\n }\n};\nDBusInterface.prototype.removeListener = DBusInterface.prototype.off =\n function (signame, callback) {\n var bus = this.$parent.service.bus;\n var signalFullName = bus.mangle(this.$parent.name, this.$name, signame);\n bus.signals.removeListener(signalFullName, this.$getSigHandler(callback));\n if (!bus.signals.listeners(signalFullName).length) {\n // There is no event handlers for this match\n var match = getMatchRule(this.$parent.name, this.$name, signame);\n bus.removeMatch(\n match,\n function (err) {\n if (err) throw new Error(err);\n // Now it is safe to empty these arrays\n this.$callbacks.length = 0;\n this.$sigHandlers.length = 0;\n }.bind(this)\n );\n }\n };\nDBusInterface.prototype.$createMethod = function (mName, signature) {\n this.$methods[mName] = signature;\n this[mName] = function () {\n this.$callMethod(mName, arguments);\n };\n};\nDBusInterface.prototype.$callMethod = function (mName, args) {\n var bus = this.$parent.service.bus;\n if (!Array.isArray(args)) args = Array.from(args); // Array.prototype.slice.apply(args)\n var callback =\n typeof args[args.length - 1] === 'function' ? args.pop() : function () {};\n var msg = {\n destination: this.$parent.service.name,\n path: this.$parent.name,\n interface: this.$name,\n member: mName\n };\n if (this.$methods[mName] !== '') {\n msg.signature = this.$methods[mName];\n msg.body = args;\n }\n bus.invoke(msg, callback);\n};\nDBusInterface.prototype.$createProp = function (\n propName,\n propType,\n propAccess\n) {\n this.$properties[propName] = { type: propType, access: propAccess };\n Object.defineProperty(this, propName, {\n enumerable: true,\n get: () => (callback) => this.$readProp(propName, callback),\n set: function (val) {\n this.$writeProp(propName, val);\n }\n });\n};\nDBusInterface.prototype.$readProp = function (propName, callback) {\n var bus = this.$parent.service.bus;\n bus.invoke(\n {\n destination: this.$parent.service.name,\n path: this.$parent.name,\n interface: 'org.freedesktop.DBus.Properties',\n member: 'Get',\n signature: 'ss',\n body: [this.$name, propName]\n },\n function (err, val) {\n if (err) {\n callback(err);\n } else {\n var signature = val[0];\n if (signature.length === 1) {\n callback(err, val[1][0]);\n } else {\n callback(err, val[1]);\n }\n }\n }\n );\n};\nDBusInterface.prototype.$writeProp = function (propName, val) {\n var bus = this.$parent.service.bus;\n bus.invoke({\n destination: this.$parent.service.name,\n path: this.$parent.name,\n interface: 'org.freedesktop.DBus.Properties',\n member: 'Set',\n signature: 'ssv',\n body: [this.$name, propName, [this.$properties[propName].type, val]]\n });\n};\n\nfunction getMatchRule(objName, ifName, signame) {\n return `type='signal',path='${objName}',interface='${ifName}',member='${signame}'`;\n}\n","const assert = require('assert');\n\nconst parseSignature = require('./signature');\nconst put = require('@homebridge/put');\nconst Marshallers = require('./marshallers');\nconst align = require('./align').align;\n\nmodule.exports = function marshall(signature, data, offset) {\n if (typeof offset === 'undefined') offset = 0;\n var tree = parseSignature(signature);\n if (!Array.isArray(data) || data.length !== tree.length) {\n throw new Error(\n `message body does not match message signature. Body:${JSON.stringify(\n data\n )}, signature:${signature}`\n );\n }\n var putstream = put();\n putstream._offset = offset;\n var buf = writeStruct(putstream, tree, data).buffer();\n return buf;\n};\n\n// TODO: serialise JS objects as a{sv}\n//function writeHash(ps, treeKey, treeVal, data) {\n//\n//}\n\nfunction writeStruct(ps, tree, data) {\n if (tree.length !== data.length) {\n throw new Error('Invalid struct data');\n }\n for (var i = 0; i < tree.length; ++i) {\n write(ps, tree[i], data[i]);\n }\n return ps;\n}\n\nfunction write(ps, ele, data) {\n switch (ele.type) {\n case '(':\n case '{':\n align(ps, 8);\n writeStruct(ps, ele.child, data);\n break;\n case 'a':\n // array serialisation:\n // length of array body aligned at 4 byte boundary\n // (optional 4 bytes to align first body element on 8-byte boundary if element\n // body\n var arrPut = put();\n arrPut._offset = ps._offset;\n var _offset = arrPut._offset;\n writeSimple(arrPut, 'u', 0); // array length placeholder\n var lengthOffset = arrPut._offset - 4 - _offset;\n // we need to alighn here because alignment is not included in array length\n if (['x', 't', 'd', '{', '('].indexOf(ele.child[0].type) !== -1)\n align(arrPut, 8);\n var startOffset = arrPut._offset;\n for (var i = 0; i < data.length; ++i)\n write(arrPut, ele.child[0], data[i]);\n var arrBuff = arrPut.buffer();\n var length = arrPut._offset - startOffset;\n // lengthOffset in the range 0 to 3 depending on number of align bytes padded _before_ arrayLength\n arrBuff.writeUInt32LE(length, lengthOffset);\n ps.put(arrBuff);\n ps._offset += arrBuff.length;\n break;\n case 'v':\n // TODO: allow serialisation of simple types as variants, e. g 123 -> ['u', 123], true -> ['b', 1], 'abc' -> ['s', 'abc']\n assert.equal(data.length, 2, 'variant data should be [signature, data]');\n var signatureEle = {\n type: 'g',\n child: []\n };\n write(ps, signatureEle, data[0]);\n var tree = parseSignature(data[0]);\n assert(tree.length === 1);\n write(ps, tree[0], data[1]);\n break;\n default:\n return writeSimple(ps, ele.type, data);\n }\n}\n\nvar stringTypes = ['g', 'o', 's'];\n\nfunction writeSimple(ps, type, data) {\n if (typeof data === 'undefined')\n throw new Error(\n \"Serialisation of JS 'undefined' type is not supported by d-bus\"\n );\n if (data === null)\n throw new Error('Serialisation of null value is not supported by d-bus');\n\n if (Buffer.isBuffer(data)) data = data.toString(); // encoding?\n if (stringTypes.indexOf(type) !== -1 && typeof data !== 'string') {\n throw new Error(\n `Expected string or buffer argument, got ${JSON.stringify(\n data\n )} of type '${type}'`\n );\n }\n\n var simpleMarshaller = Marshallers.MakeSimpleMarshaller(type);\n simpleMarshaller.marshall(ps, data);\n return ps;\n}\n","const Buffer = require('safe-buffer').Buffer;\nconst align = require('./align').align;\nconst parseSignature = require('../lib/signature');\nconst Long = require('@homebridge/long');\n/**\n * MakeSimpleMarshaller\n * @param signature - the signature of the data you want to check\n * @returns a simple marshaller with the \"check\" method\n *\n * check returns nothing - it only raises errors if the data is\n * invalid for the signature\n */\nvar MakeSimpleMarshaller = function (signature) {\n var marshaller = {};\n function checkValidString(data) {\n if (typeof data !== 'string') {\n throw new Error(`Data: ${data} was not of type string`);\n } else if (data.indexOf('\\0') !== -1) {\n throw new Error('String contains null byte');\n }\n }\n\n function checkValidSignature(data) {\n if (data.length > 0xff) {\n throw new Error(\n `Data: ${data} is too long for signature type (${data.length} > 255)`\n );\n }\n\n var parenCount = 0;\n for (var ii = 0; ii < data.length; ++ii) {\n if (parenCount > 32) {\n throw new Error(\n `Maximum container type nesting exceeded in signature type:${data}`\n );\n }\n switch (data[ii]) {\n case '(':\n ++parenCount;\n break;\n case ')':\n --parenCount;\n break;\n default:\n /* no-op */\n break;\n }\n }\n parseSignature(data);\n }\n\n switch (signature) {\n case 'o':\n // object path\n // TODO: verify object path here?\n case 's': // eslint-disable-line no-fallthrough\n //STRING\n marshaller.check = function (data) {\n checkValidString(data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n // utf8 string\n align(ps, 4);\n const buff = Buffer.from(data, 'utf8');\n ps.word32le(buff.length).put(buff).word8(0);\n ps._offset += 5 + buff.length;\n };\n break;\n case 'g':\n //SIGNATURE\n marshaller.check = function (data) {\n checkValidString(data);\n checkValidSignature(data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n // signature\n const buff = Buffer.from(data, 'ascii');\n ps.word8(data.length).put(buff).word8(0);\n ps._offset += 2 + buff.length;\n };\n break;\n case 'y':\n //BYTE\n marshaller.check = function (data) {\n checkInteger(data);\n checkRange(0x00, 0xff, data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n ps.word8(data);\n ps._offset++;\n };\n break;\n case 'b':\n //BOOLEAN\n marshaller.check = function (data) {\n checkBoolean(data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n // booleans serialised as 0/1 unsigned 32 bit int\n data = data ? 1 : 0;\n align(ps, 4);\n ps.word32le(data);\n ps._offset += 4;\n };\n break;\n case 'n':\n //INT16\n marshaller.check = function (data) {\n checkInteger(data);\n checkRange(-0x7fff - 1, 0x7fff, data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n align(ps, 2);\n const buff = Buffer.alloc(2);\n buff.writeInt16LE(parseInt(data), 0);\n ps.put(buff);\n ps._offset += 2;\n };\n break;\n case 'q':\n //UINT16\n marshaller.check = function (data) {\n checkInteger(data);\n checkRange(0, 0xffff, data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n align(ps, 2);\n ps.word16le(data);\n ps._offset += 2;\n };\n break;\n case 'i':\n //INT32\n marshaller.check = function (data) {\n checkInteger(data);\n checkRange(-0x7fffffff - 1, 0x7fffffff, data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n align(ps, 4);\n const buff = Buffer.alloc(4);\n buff.writeInt32LE(parseInt(data), 0);\n ps.put(buff);\n ps._offset += 4;\n };\n break;\n case 'u':\n //UINT32\n marshaller.check = function (data) {\n checkInteger(data);\n checkRange(0, 0xffffffff, data);\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n // 32 t unsigned int\n align(ps, 4);\n ps.word32le(data);\n ps._offset += 4;\n };\n break;\n case 't':\n //UINT64\n marshaller.check = function (data) {\n return checkLong(data, false);\n };\n marshaller.marshall = function (ps, data) {\n data = this.check(data);\n align(ps, 8);\n ps.word32le(data.low);\n ps.word32le(data.high);\n ps._offset += 8;\n };\n break;\n case 'x':\n //INT64\n marshaller.check = function (data) {\n return checkLong(data, true);\n };\n marshaller.marshall = function (ps, data) {\n data = this.check(data);\n align(ps, 8);\n ps.word32le(data.low);\n ps.word32le(data.high);\n ps._offset += 8;\n };\n break;\n case 'd':\n //DOUBLE\n marshaller.check = function (data) {\n if (typeof data !== 'number') {\n throw new Error(`Data: ${data} was not of type number`);\n } else if (Number.isNaN(data)) {\n throw new Error(`Data: ${data} was not a number`);\n } else if (!Number.isFinite(data)) {\n throw new Error('Number outside range');\n }\n };\n marshaller.marshall = function (ps, data) {\n this.check(data);\n align(ps, 8);\n const buff = Buffer.alloc(8);\n buff.writeDoubleLE(parseFloat(data), 0);\n ps.put(buff);\n ps._offset += 8;\n };\n break;\n default:\n throw new Error(`Unknown data type format: ${signature}`);\n }\n return marshaller;\n};\nexports.MakeSimpleMarshaller = MakeSimpleMarshaller;\n\nvar checkRange = function (minValue, maxValue, data) {\n if (data > maxValue || data < minValue) {\n throw new Error('Number outside range');\n }\n};\n\nvar checkInteger = function (data) {\n if (typeof data !== 'number') {\n throw new Error(`Data: ${data} was not of type number`);\n }\n if (Math.floor(data) !== data) {\n throw new Error(`Data: ${data} was not an integer`);\n }\n};\n\nvar checkBoolean = function (data) {\n if (!(typeof data === 'boolean' || data === 0 || data === 1))\n throw new Error(`Data: ${data} was not of type boolean`);\n};\n\n// This is essentially a tweaked version of 'fromValue' from Long.js with error checking.\n// This can take number or string of decimal characters or 'Long' instance (or Long-style object with props low,high,unsigned).\nvar makeLong = function (val, signed) {\n if (val instanceof Long) return val;\n if (val instanceof Number) val = val.valueOf();\n if (typeof val === 'number') {\n try {\n // Long.js won't alert you to precision loss in passing more than 53 bit ints through a double number, so we check here\n checkInteger(val);\n if (signed) {\n checkRange(-0x1fffffffffffff, 0x1fffffffffffff, val);\n } else {\n checkRange(0, 0x1fffffffffffff, val);\n }\n } catch (e) {\n e.message += ' (Number type can only carry 53 bit integer)';\n throw e;\n }\n try {\n return Long.fromNumber(val, !signed);\n } catch (e) {\n e.message = `Error converting number to 64bit integer \"${e.message}\"`;\n throw e;\n }\n }\n if (typeof val === 'string' || val instanceof String) {\n var radix = 10;\n val = val.trim().toUpperCase(); // remove extra whitespace and make uppercase (for hex)\n if (val.substring(0, 2) === '0X') {\n radix = 16;\n val = val.substring(2);\n } else if (val.substring(0, 3) === '-0X') {\n // unusual, but just in case?\n radix = 16;\n val = `-${val.substring(3)}`;\n }\n val = val.replace(/^0+(?=\\d)/, ''); // dump leading zeroes\n var data;\n try {\n data = Long.fromString(val, !signed, radix);\n } catch (e) {\n e.message = `Error converting string to 64bit integer '${e.message}'`;\n throw e;\n }\n // If string represents a number outside of 64 bit range, it can quietly overflow.\n // We assume if things converted correctly the string coming out of Long should match what went into it.\n if (data.toString(radix).toUpperCase() !== val)\n throw new Error(\n `Data: '${val}' did not convert correctly to ${\n signed ? 'signed' : 'unsigned'\n } 64 bit`\n );\n return data;\n }\n // Throws for non-objects, converts non-instanceof Long:\n try {\n return Long.fromBits(val.low, val.high, val.unsigned);\n } catch (e) {\n e.message = `Error converting object to 64bit integer '${e.message}'`;\n throw e;\n }\n};\n\nvar checkLong = function (data, signed) {\n if (!Long.isLong(data)) {\n data = makeLong(data, signed);\n }\n\n // Do we enforce that Long.js object unsigned/signed match the field even if it is still in range?\n // Probably, might help users avoid unintended bugs?\n if (signed) {\n if (data.unsigned)\n throw new Error(\n 'Longjs object is unsigned, but marshalling into signed 64 bit field'\n );\n if (data.gt(Long.MAX_VALUE) || data.lt(Long.MIN_VALUE)) {\n throw new Error(`Data: ${data} was out of range (64-bit signed)`);\n }\n } else {\n if (!data.unsigned)\n throw new Error(\n 'Longjs object is signed, but marshalling into unsigned 64 bit field'\n );\n // NOTE: data.gt(Long.MAX_UNSIGNED_VALUE) will catch if Long.js object is a signed value but is still within unsigned range!\n // Since we are enforcing signed type matching between Long.js object and field, this note should not matter.\n if (data.gt(Long.MAX_UNSIGNED_VALUE) || data.lt(0)) {\n throw new Error(`Data: ${data} was out of range (64-bit unsigned)`);\n }\n }\n return data;\n};\n","const Buffer = require('safe-buffer').Buffer;\nconst marshall = require('./marshall');\nconst constants = require('./constants');\nconst DBusBuffer = require('./dbus-buffer');\n\nconst headerSignature = require('./header-signature.json');\n\nmodule.exports.unmarshalMessages = function messageParser(\n stream,\n onMessage,\n opts\n) {\n var state = 0; // 0: header, 1: fields + body\n var header, fieldsAndBody;\n var fieldsLength, fieldsLengthPadded;\n var fieldsAndBodyLength = 0;\n var bodyLength = 0;\n stream.on('readable', function () {\n while (1) {\n if (state === 0) {\n header = stream.read(16);\n if (!header) break;\n state = 1;\n\n fieldsLength = header.readUInt32LE(12);\n fieldsLengthPadded = ((fieldsLength + 7) >> 3) << 3;\n bodyLength = header.readUInt32LE(4);\n fieldsAndBodyLength = fieldsLengthPadded + bodyLength;\n } else {\n fieldsAndBody = stream.read(fieldsAndBodyLength);\n if (!fieldsAndBody) break;\n state = 0;\n\n var messageBuffer = new DBusBuffer(fieldsAndBody, undefined, opts);\n var unmarshalledHeader = messageBuffer.readArray(\n headerSignature[0].child[0],\n fieldsLength\n );\n messageBuffer.align(3);\n var headerName;\n var message = {};\n message.serial = header.readUInt32LE(8);\n\n for (var i = 0; i < unmarshalledHeader.length; ++i) {\n headerName = constants.headerTypeName[unmarshalledHeader[i][0]];\n message[headerName] = unmarshalledHeader[i][1][1][0];\n }\n\n message.type = header[1];\n message.flags = header[2];\n\n if (bodyLength > 0 && message.signature) {\n message.body = messageBuffer.read(message.signature);\n }\n onMessage(message);\n }\n }\n });\n};\n\n// given buffer which contains entire message deserialise it\n// TODO: factor out common code\nmodule.exports.unmarshall = function unmarshall(buff, opts) {\n var msgBuf = new DBusBuffer(buff, undefined, opts);\n var headers = msgBuf.read('yyyyuua(yv)');\n var message = {};\n for (var i = 0; i < headers[6].length; ++i) {\n var headerName = constants.headerTypeName[headers[6][i][0]];\n message[headerName] = headers[6][i][1][1][0];\n }\n message.type = headers[1];\n message.flags = headers[2];\n message.serial = headers[5];\n msgBuf.align(3);\n message.body = msgBuf.read(message.signature);\n return message;\n};\n\nmodule.exports.marshall = function marshallMessage(message) {\n if (!message.serial) throw new Error('Missing or invalid serial');\n var flags = message.flags || 0;\n var type = message.type || constants.messageType.methodCall;\n var bodyLength = 0;\n var bodyBuff;\n if (message.signature && message.body) {\n bodyBuff = marshall(message.signature, message.body);\n bodyLength = bodyBuff.length;\n }\n var header = [\n constants.endianness.le,\n type,\n flags,\n constants.protocolVersion,\n bodyLength,\n message.serial\n ];\n var headerBuff = marshall('yyyyuu', header);\n var fields = [];\n constants.headerTypeName.forEach(function (fieldName) {\n var fieldVal = message[fieldName];\n if (fieldVal) {\n fields.push([\n constants.headerTypeId[fieldName],\n [constants.fieldSignature[fieldName], fieldVal]\n ]);\n }\n });\n var fieldsBuff = marshall('a(yv)', [fields], 12);\n var headerLenAligned =\n ((headerBuff.length + fieldsBuff.length + 7) >> 3) << 3;\n var messageLen = headerLenAligned + bodyLength;\n var messageBuff = Buffer.alloc(messageLen);\n headerBuff.copy(messageBuff);\n fieldsBuff.copy(messageBuff, headerBuff.length);\n if (bodyLength > 0) bodyBuff.copy(messageBuff, headerLenAligned);\n\n return messageBuff;\n};\n","const Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = function readOneLine(stream, cb) {\n var bytes = [];\n function readable() {\n while (1) {\n var buf = stream.read(1);\n if (!buf) return;\n var b = buf[0];\n if (b === 0x0a) {\n try {\n cb(Buffer.from(bytes));\n } catch (error) {\n stream.emit('error', error);\n }\n stream.removeListener('readable', readable);\n return;\n }\n bytes.push(b);\n }\n }\n stream.on('readable', readable);\n};\n","const Buffer = require('safe-buffer').Buffer;\nconst readLine = require('./readline');\n\nmodule.exports = function serverHandshake(stream, opts, cb) {\n stream.name = 'SERVER SERVER';\n readLine(stream, function (hello) {\n console.log(['hello string: ', hello.toString(), hello]);\n stream.write('REJECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS\\r\\n');\n readLine(stream, function () {\n stream.write(\n `DATA ${Buffer.from(\n 'org_freedesktop_general 642038150 b9ce247a275f427c8586e4c9de9bb951'\n ).toString('hex')}\\r\\n`\n );\n readLine(stream, function () {\n stream.write(\n 'OK 6f72675f667265656465736b746f705f67656e6572616c20353631303331333937206239636532343761323735663432376338353836653463396465396262393531\\r\\n'\n );\n readLine(stream, function (begin) {\n console.log(['AFTER begin: ', begin.toString()]);\n cb(null);\n });\n });\n });\n });\n};\n\n// cookie: 561031397 1410749774 3a83c8200f930e7af4de135e8abd299b681a1f44dbb85399\n\n// 1539856202\n\n// server: org_freedesktop_general 561031397 b9ce247a275f427c8586e4c9de9bb951\n// client: bwFSDjS0TJerqb0l 82986a987194788803d7da2a4b00e801cff9bdfd\n// 82986a987194788803d7da2a4b00e801cff9bdfd = sha1(b9ce247a275f427c8586e4c9de9bb951:bwFSDjS0TJerqb0l:3a83c8200f930e7af4de135e8abd299b681a1f44dbb85399)\n// server: OK e12a29dd7ffe3effac5eb95054123f80\n\n//dbus.write('DATA 6f72675f667265656465736b746f705f67656e6572616c203636383430 31303032 203733653733313762383630356537323937623438303233376336353234343533\\r\\n');\n","const dbus = require('../index');\nconst net = require('net');\n\nmodule.exports.createServer = function (handler) {\n function Server() {\n var id = 123;\n this.server = net.createServer(function (socket) {\n socket.idd = id;\n id++;\n\n var dbusConn = dbus.createConnection({ stream: socket, server: true });\n if (handler) handler(dbusConn);\n // TODO: inherit from EE this.emit('connect', dbusConn);\n });\n this.listen = this.server.listen.bind(this.server);\n }\n return new Server();\n};\n","// parse signature from string to tree\n\nvar match = {\n '{': '}',\n '(': ')'\n};\n\nvar knownTypes = {};\n'(){}ybnqiuxtdsogarvehm*?@&^'.split('').forEach(function (c) {\n knownTypes[c] = true;\n});\n\nmodule.exports = function parseSignature(signature) {\n var index = 0;\n function next() {\n if (index < signature.length) {\n var c = signature[index];\n ++index;\n return c;\n }\n return null;\n }\n\n function parseOne(c) {\n function checkNotEnd(c) {\n if (!c) throw new Error('Bad signature: unexpected end');\n return c;\n }\n\n if (!knownTypes[c])\n throw new Error(`Unknown type: \"${c}\" in signature \"${signature}\"`);\n\n var ele;\n var res = { type: c, child: [] };\n switch (c) {\n case 'a': // array\n ele = next();\n checkNotEnd(ele);\n res.child.push(parseOne(ele));\n return res;\n case '{': // dict entry\n case '(': // struct\n while ((ele = next()) !== null && ele !== match[c])\n res.child.push(parseOne(ele));\n checkNotEnd(ele);\n return res;\n }\n return res;\n }\n\n var ret = [];\n var c;\n while ((c = next()) !== null) ret.push(parseOne(c));\n return ret;\n};\n\n// command-line test\n//console.log(JSON.stringify(module.exports(process.argv[2]), null, 4));\n//var tree = module.exports('a(ssssbbbbbbbbuasa{ss}sa{sv})a(ssssssbbssa{ss}sa{sv})a(ssssssbsassa{sv})');\n//console.log(tree);\n//console.log(fromTree(tree))\n","const constants = require('./constants');\nconst parseSignature = require('./signature');\n\n// TODO: use xmlbuilder\n\nvar xmlHeader =\n '';\nvar stdIfaces;\n\nmodule.exports = function (msg, bus) {\n if (\n msg['interface'] === 'org.freedesktop.DBus.Introspectable' &&\n msg.member === 'Introspect'\n ) {\n if (msg.path === '/') msg.path = '';\n\n var resultXml = [xmlHeader];\n var nodes = {};\n // TODO: this is not very efficiant for large number of exported objects\n // need to build objects tree as they are exported and walk this tree on introspect request\n for (var path in bus.exportedObjects) {\n if (path.indexOf(msg.path) === 0) {\n // objects path starts with requested\n var introspectableObj = bus.exportedObjects[msg.path];\n if (introspectableObj) {\n nodes[msg.path] = introspectableObj;\n } else {\n if (path[msg.path.length] !== '/') continue;\n var localPath = path.substr(msg.path.length);\n var pathParts = localPath.split('/');\n var localName = pathParts[1];\n nodes[localName] = null;\n }\n }\n }\n\n var length = Object.keys(nodes).length;\n if (length === 0) {\n resultXml.push('');\n } else if (length === 1) {\n var obj = nodes[Object.keys(nodes)[0]];\n if (obj) {\n resultXml.push('');\n for (var ifaceNode in obj) {\n resultXml.push(interfaceToXML(obj[ifaceNode][0]));\n }\n resultXml.push(stdIfaces);\n resultXml.push('');\n } else {\n resultXml.push(\n `\\n \\n `\n );\n }\n } else {\n resultXml.push('');\n for (var name in nodes) {\n if (nodes[name] === null) {\n resultXml.push(` `);\n } else {\n obj = nodes[name];\n resultXml.push(` `);\n for (var ifaceName in obj) {\n resultXml.push(interfaceToXML(obj[ifaceName][0]));\n }\n resultXml.push(stdIfaces);\n resultXml.push(' ');\n }\n }\n resultXml.push('');\n }\n\n const introspectableReply = {\n type: constants.messageType.methodReturn,\n serial: bus.serial++,\n replySerial: msg.serial,\n destination: msg.sender,\n signature: 's',\n body: [resultXml.join('\\n')]\n };\n bus.connection.message(introspectableReply);\n return 1;\n } else if (msg['interface'] === 'org.freedesktop.DBus.Properties') {\n var interfaceName = msg.body[0];\n var propertiesObj = bus.exportedObjects[msg.path];\n // TODO: !propertiesObj -> UnknownObject http://www.freedesktop.org/wiki/Software/DBusBindingErrors\n if (!propertiesObj || !propertiesObj[interfaceName]) {\n // TODO:\n bus.sendError(\n msg,\n 'org.freedesktop.DBus.Error.UnknownMethod',\n 'Uh oh oh'\n );\n return 1;\n }\n var impl = propertiesObj[interfaceName][1];\n\n const propertiesReply = {\n type: constants.messageType.methodReturn,\n serial: bus.serial++,\n replySerial: msg.serial,\n destination: msg.sender\n };\n if (msg.member === 'Get' || msg.member === 'Set') {\n var propertyName = msg.body[1];\n var propType = propertiesObj[interfaceName][0].properties[propertyName];\n if (msg.member === 'Get') {\n var propValue = impl[propertyName];\n propertiesReply.signature = 'v';\n propertiesReply.body = [[propType, propValue]];\n } else {\n impl[propertyName] = 1234; // TODO: read variant and set property value\n }\n } else if (msg.member === 'GetAll') {\n propertiesReply.signature = 'a{sv}';\n var props = [];\n for (var p in propertiesObj[interfaceName][0].properties) {\n var propertySignature = propertiesObj[interfaceName][0].properties[p];\n props.push([p, [propertySignature, impl[p]]]);\n }\n propertiesReply.body = [props];\n }\n bus.connection.message(propertiesReply);\n return 1;\n } else if (msg['interface'] === 'org.freedesktop.DBus.Peer') {\n // TODO: implement bus.replyTo(srcMsg, signature, body) method\n const peerReply = {\n type: constants.messageType.methodReturn,\n serial: bus.serial++,\n replySerial: msg.serial,\n destination: msg.sender\n };\n if (msg.member === 'Ping') {\n // empty body\n } else if (msg.member === 'GetMachineId') {\n peerReply.signature = 's';\n peerReply.body = ['This is a machine id. TODO: implement'];\n }\n bus.connection.message(peerReply);\n return 1;\n }\n return 0;\n};\n\n// TODO: move to introspect.js\nfunction interfaceToXML(iface) {\n var result = [];\n var dumpArgs = function (argsSignature, argsNames, direction) {\n if (!argsSignature) return;\n var args = parseSignature(argsSignature);\n args.forEach(function (arg, num) {\n var argName = argsNames ? argsNames[num] : direction + num;\n var dirStr = direction === 'signal' ? '' : `\" direction=\"${direction}`;\n result.push(\n ` `\n );\n });\n };\n result.push(` `);\n if (iface.methods) {\n for (var methodName in iface.methods) {\n var method = iface.methods[methodName];\n result.push(` `);\n dumpArgs(method[0], method[2], 'in');\n dumpArgs(method[1], method[3], 'out');\n result.push(' ');\n }\n }\n if (iface.signals) {\n for (var signalName in iface.signals) {\n var signal = iface.signals[signalName];\n result.push(` `);\n dumpArgs(signal[0], signal.slice(1), 'signal');\n result.push(' ');\n }\n }\n if (iface.properties) {\n for (const propertyName in iface.properties) {\n // TODO: decide how to encode access\n result.push(\n ` `\n );\n }\n }\n result.push(' ');\n return result.join('\\n');\n}\n\nfunction dumpSignature(s) {\n var result = [];\n s.forEach(function (sig) {\n result.push(sig.type + dumpSignature(sig.child));\n if (sig.type === '{') result.push('}');\n if (sig.type === '(') result.push(')');\n });\n return result.join('');\n}\nstdIfaces =\n ' \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n ';\n","const assert = require('assert');\n\nmodule.exports = Put;\nfunction Put () {\n if (!(this instanceof Put)) return new Put;\n\n var words = [];\n var len = 0;\n\n this.put = function (buf) {\n words.push({ buffer : buf });\n len += buf.length;\n return this;\n };\n\n this.word8 = function (x) {\n words.push({ bytes : 1, value : x });\n len += 1;\n return this;\n };\n\n this.floatle = function (x) {\n words.push({ bytes : 'float', endian : 'little', value : x });\n len += 4;\n return this;\n };\n\n [ 8, 16, 24, 32, 64 ].forEach((function (bits) {\n this['word' + bits + 'be'] = function (x) {\n words.push({ endian : 'big', bytes : bits / 8, value : x });\n len += bits / 8;\n return this;\n };\n\n this['word' + bits + 'le'] = function (x) {\n words.push({ endian : 'little', bytes : bits / 8, value : x });\n len += bits / 8;\n return this;\n };\n }).bind(this));\n\n this.pad = function (bytes) {\n assert(Number.isInteger(bytes), \"pad(bytes) must be supplied with an integer!\");\n words.push({ endian : 'big', bytes : bytes, value : 0 });\n len += bytes;\n return this;\n };\n\n this.length = function () {\n return len;\n };\n\n this.buffer = function () {\n var buf = Buffer.alloc(len);\n var offset = 0;\n words.forEach(function (word) {\n if (word.buffer) {\n word.buffer.copy(buf, offset, 0);\n offset += word.buffer.length;\n }\n else if (word.bytes === 'float') {\n // s * f * 2^e\n var v = Math.abs(word.value);\n var s = (word.value >= 0) * 1;\n var e = Math.ceil(Math.log(v) / Math.LN2);\n var f = v / (1 << e);\n console.dir([s,e,f]);\n\n console.log(word.value);\n\n // s:1, e:7, f:23\n // [seeeeeee][efffffff][ffffffff][ffffffff]\n buf[offset++] = (s << 7) & ~~(e / 2);\n buf[offset++] = ((e & 1) << 7) & ~~(f / (1 << 16));\n buf[offset++] = 0;\n buf[offset++] = 0;\n offset += 4;\n }\n else {\n var big = word.endian === 'big';\n var ix = big ? [ (word.bytes - 1) * 8, -8 ] : [ 0, 8 ];\n\n for (\n var i = ix[0];\n big ? i >= 0 : i < word.bytes * 8;\n i += ix[1]\n ) {\n if (i >= 32) {\n buf[offset++] = Math.floor(word.value / Math.pow(2, i)) & 0xff;\n }\n else {\n buf[offset++] = (word.value >> i) & 0xff;\n }\n }\n }\n });\n return buf;\n };\n\n this.write = function (stream) {\n stream.write(this.buffer());\n };\n}\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\nvar $byteLength = callBound('ArrayBuffer.prototype.byteLength', true);\n\nvar isArrayBuffer = require('is-array-buffer');\n\n/** @type {import('.')} */\nmodule.exports = function byteLength(ab) {\n\tif (!isArrayBuffer(ab)) {\n\t\treturn NaN;\n\t}\n\treturn $byteLength ? $byteLength(ab) : ab.byteLength;\n}; // in node < 0.11, byteLength is an own nonconfigurable property\n","'use strict'\n\n/**\n * Expose `arrayFlatten`.\n */\nmodule.exports = flatten\nmodule.exports.from = flattenFrom\nmodule.exports.depth = flattenDepth\nmodule.exports.fromDepth = flattenFromDepth\n\n/**\n * Flatten an array.\n *\n * @param {Array} array\n * @return {Array}\n */\nfunction flatten (array) {\n if (!Array.isArray(array)) {\n throw new TypeError('Expected value to be an array')\n }\n\n return flattenFrom(array)\n}\n\n/**\n * Flatten an array-like structure.\n *\n * @param {Array} array\n * @return {Array}\n */\nfunction flattenFrom (array) {\n return flattenDown(array, [])\n}\n\n/**\n * Flatten an array-like structure with depth.\n *\n * @param {Array} array\n * @param {number} depth\n * @return {Array}\n */\nfunction flattenDepth (array, depth) {\n if (!Array.isArray(array)) {\n throw new TypeError('Expected value to be an array')\n }\n\n return flattenFromDepth(array, depth)\n}\n\n/**\n * Flatten an array-like structure with depth.\n *\n * @param {Array} array\n * @param {number} depth\n * @return {Array}\n */\nfunction flattenFromDepth (array, depth) {\n if (typeof depth !== 'number') {\n throw new TypeError('Expected the depth to be a number')\n }\n\n return flattenDownDepth(array, [], depth)\n}\n\n/**\n * Flatten an array indefinitely.\n *\n * @param {Array} array\n * @param {Array} result\n * @return {Array}\n */\nfunction flattenDown (array, result) {\n for (var i = 0; i < array.length; i++) {\n var value = array[i]\n\n if (Array.isArray(value)) {\n flattenDown(value, result)\n } else {\n result.push(value)\n }\n }\n\n return result\n}\n\n/**\n * Flatten an array with depth.\n *\n * @param {Array} array\n * @param {Array} result\n * @param {number} depth\n * @return {Array}\n */\nfunction flattenDownDepth (array, result, depth) {\n depth--\n\n for (var i = 0; i < array.length; i++) {\n var value = array[i]\n\n if (depth > -1 && Array.isArray(value)) {\n flattenDownDepth(value, result, depth)\n } else {\n result.push(value)\n }\n }\n\n return result\n}\n","'use strict'\n\nconst Registry = require('./lib/Registry.js')\nconst Server = require('./lib/Server.js')\nconst Browser = require('./lib/Browser.js')\n\nfunction Bonjour (opts) {\n if (!(this instanceof Bonjour)) { return new Bonjour(opts) }\n\n this._server = new Server(opts)\n this._registry = new Registry(this._server)\n}\n\nBonjour.prototype = {\n publish: function (opts) {\n return this._registry.publish(opts)\n },\n\n unpublishAll: function (cb) {\n this._registry.unpublishAll(cb)\n },\n\n find: function (opts, onup) {\n return new Browser(this._server.mdns, opts, onup)\n },\n\n findOne: function (opts, cb) {\n const browser = new Browser(this._server.mdns, opts)\n browser.once('up', function (service) {\n browser.stop()\n if (cb) cb(service)\n })\n return browser\n },\n\n destroy: function () {\n this._registry.destroy()\n this._server.mdns.destroy()\n }\n}\n\nmodule.exports = Bonjour\n","'use strict'\n\nconst util = require('util')\nconst EventEmitter = require('events').EventEmitter\nconst serviceName = require('multicast-dns-service-types')\nconst dnsEqual = require('./utils/dnsEqual')\nconst dnsTxt = require('./utils/txtDecoder')\n\nconst TLD = '.local'\nconst WILDCARD = '_services._dns-sd._udp' + TLD\n\nmodule.exports = Browser\n\nutil.inherits(Browser, EventEmitter)\n\n/**\n * Start a browser\n *\n * The browser listens for services by querying for PTR records of a given\n * type, protocol and domain, e.g. _http._tcp.local.\n *\n * If no type is given, a wild card search is performed.\n *\n * An internal list of online services is kept which starts out empty. When\n * ever a new service is discovered, it's added to the list and an \"up\" event\n * is emitted with that service. When it's discovered that the service is no\n * longer available, it is removed from the list and a \"down\" event is emitted\n * with that service.\n */\nfunction Browser (mdns, opts, onup) {\n if (typeof opts === 'function') return new Browser(mdns, null, opts)\n\n EventEmitter.call(this)\n\n this._mdns = mdns\n this._onresponse = null\n this._serviceMap = {}\n this._txt = dnsTxt(opts.txt)\n\n if (!opts || !opts.type) {\n this._name = WILDCARD\n this._wildcard = true\n } else {\n this._name = serviceName.stringify(opts.type, opts.protocol || 'tcp') + TLD\n if (opts.name) this._name = opts.name + '.' + this._name\n this._wildcard = false\n }\n\n this.services = []\n\n if (onup) this.on('up', onup)\n\n this.start()\n}\n\nBrowser.prototype.start = function () {\n if (this._onresponse) return\n\n const self = this\n\n // List of names for the browser to listen for. In a normal search this will\n // be the primary name stored on the browser. In case of a wildcard search\n // the names will be determined at runtime as responses come in.\n const nameMap = {}\n if (!this._wildcard) nameMap[this._name] = true\n\n this._onresponse = function (packet, rinfo) {\n if (self._wildcard) {\n packet.answers.forEach(function (answer) {\n if (answer.type !== 'PTR' || answer.name !== self._name || answer.name in nameMap) return\n nameMap[answer.data] = true\n self._mdns.query(answer.data, 'PTR')\n })\n }\n\n Object.keys(nameMap).forEach(function (name) {\n // unregister all services shutting down\n goodbyes(name, packet).forEach(self._removeService.bind(self))\n\n // register all new services\n const matches = buildServicesFor(name, packet, self._txt, rinfo)\n if (matches.length === 0) return\n\n matches.forEach(function (service) {\n if (self._serviceMap[service.fqdn]) {\n self._updateService(service)\n } else {\n self._addService(service)\n }\n })\n })\n }\n\n this._mdns.on('response', this._onresponse)\n this.update()\n}\n\nBrowser.prototype.stop = function () {\n if (!this._onresponse) return\n\n this._mdns.removeListener('response', this._onresponse)\n this._onresponse = null\n}\n\nBrowser.prototype.update = function () {\n this._mdns.query(this._name, 'PTR')\n}\n\nBrowser.prototype._addService = function (service) {\n this.services.push(service)\n this._serviceMap[service.fqdn] = true\n this.emit('up', service)\n}\n\nBrowser.prototype._updateService = function (service) {\n let cachedService, index\n this.services.some(function (s, i) {\n if (dnsEqual(s.fqdn, service.fqdn)) {\n cachedService = s\n index = i\n return true\n }\n return false\n })\n if (!cachedService) return\n this.services[index] = service\n this.emit('update', service)\n}\n\nBrowser.prototype._removeService = function (fqdn) {\n let service, index\n this.services.some(function (s, i) {\n if (dnsEqual(s.fqdn, fqdn)) {\n service = s\n index = i\n return true\n }\n return false\n })\n if (!service) return\n this.services.splice(index, 1)\n delete this._serviceMap[fqdn]\n this.emit('down', service)\n}\n\n// PTR records with a TTL of 0 is considered a \"goodbye\" announcement. I.e. a\n// DNS response broadcasted when a service shuts down in order to let the\n// network know that the service is no longer going to be available.\n//\n// For more info see:\n// https://tools.ietf.org/html/rfc6762#section-8.4\n//\n// This function returns an array of all resource records considered a goodbye\n// record\nfunction goodbyes (name, packet) {\n return packet.answers.concat(packet.additionals)\n .filter(function (rr) {\n return rr.type === 'PTR' && rr.ttl === 0 && dnsEqual(rr.name, name)\n })\n .map(function (rr) {\n return rr.data\n })\n}\n\nfunction buildServicesFor (name, packet, txt, referer) {\n const records = packet.answers.concat(packet.additionals).filter(function (rr) {\n return rr.ttl > 0 // ignore goodbye messages\n })\n\n return records\n .filter(function (rr) {\n return rr.type === 'PTR' && dnsEqual(rr.name, name)\n })\n .map(function (ptr) {\n const service = {\n addresses: []\n }\n\n records\n .filter(function (rr) {\n return (rr.type === 'SRV' || rr.type === 'TXT') && dnsEqual(rr.name, ptr.data)\n })\n .forEach(function (rr) {\n if (rr.type === 'SRV') {\n const parts = rr.name.split('.')\n const name = parts[0]\n const types = serviceName.parse(parts.slice(1, -1).join('.'))\n service.name = name\n service.fqdn = rr.name\n service.host = rr.data.target\n service.referer = referer\n service.port = rr.data.port\n service.type = types.name\n service.protocol = types.protocol\n service.subtypes = types.subtypes\n } else if (rr.type === 'TXT') {\n // rr.data is an Array of Buffer instead of Buffer\n service.rawTxt = rr.data // array of buffers, each representing a block\n service.txt = txt.decodeBlocks(service.rawTxt)\n }\n })\n\n if (!service.name) return undefined\n\n records\n .filter(function (rr) {\n return (rr.type === 'A' || rr.type === 'AAAA') && dnsEqual(rr.name, service.host)\n })\n .forEach(function (rr) {\n service.addresses.push(rr.data)\n })\n\n return service\n })\n .filter(function (rr) {\n return !!rr\n })\n}\n","'use strict'\n\nconst dnsEqual = require('./utils/dnsEqual')\n\n/**\n * Check if a service name is already in use on the network.\n *\n * Used before announcing the new service.\n *\n * To guard against race conditions where multiple services are started\n * simultaneously on the network, wait a random amount of time (between\n * 0 and 250 ms) before probing.\n *\n * TODO: Add support for Simultaneous Probe Tiebreaking:\n * https://tools.ietf.org/html/rfc6762#section-8.2\n */\n\nconst Prober = function (mdns, service, cb) {\n this.sent = false\n this.retries = 0\n this.timer = null\n this.cb = cb\n this.mdns = mdns\n this.service = service\n this.bound = this.onMDNSresponse.bind(this)\n this.matchRRBound = this.matchRR.bind(this)\n}\n\nProber.prototype = {\n\n start: function () {\n this.mdns.on('response', this.bound)\n setTimeout(this.try.bind(this), Math.random() * 250)\n },\n\n try: function () {\n // abort if the service have or is being stopped in the meantime\n if (!this.service._activated || this.service._destroyed) return\n\n this.mdns.query(this.service.fqdn, 'ANY', function () {\n // This function will optionally be called with an error object. We'll\n // just silently ignore it and retry as we normally would\n this.sent = true\n this.timer = setTimeout(++this.retries < 3 ? this.try.bind(this) : this.done.bind(this, false), 250)\n this.timer.unref()\n }.bind(this))\n },\n\n matchRR: function (rr) {\n return dnsEqual(rr.name, this.service.fqdn)\n },\n\n onMDNSresponse: function (packet) {\n // Apparently conflicting Multicast DNS responses received *before*\n // the first probe packet is sent MUST be silently ignored (see\n // discussion of stale probe packets in RFC 6762 Section 8.2,\n // \"Simultaneous Probe Tiebreaking\" at\n // https://tools.ietf.org/html/rfc6762#section-8.2\n if (!this.sent) { return }\n\n if (packet.answers.some(this.matchRRBound) || packet.additionals.some(this.matchRRBound)) { this.done(true) }\n },\n\n done: function (success) {\n this.mdns.removeListener('response', this.bound)\n clearTimeout(this.timer)\n this.cb(success)\n }\n\n}\n\nmodule.exports = Prober\n","'use strict'\n\nconst flatten = require('array-flatten')\nconst Service = require('./Service.js')\nconst Prober = require('./Prober.js')\n\nconst Registry = function (server) {\n this._server = server\n this._services = []\n}\n\nRegistry.prototype = {\n\n publish: function (opts) {\n opts = opts || {}\n const service = new Service(opts)\n service.on('service-publish', this._onServicePublish.bind(this))\n service.on('service-unpublish', this._onServiceUnpublish.bind(this))\n service.on('service-announce-request', this._onAnnounceRequest.bind(this))\n service.on('service-packet-change', this._onServiceChange.bind(this))\n service.start()\n return service\n },\n\n unpublishAll: function (cb) {\n this._tearDown(this._services, cb)\n this._services = []\n },\n\n destroy: function () {\n for (let i = 0; i < this._services.length; i++) { this._services[i].destroy() }\n },\n\n /**\n * Stop the given services\n *\n * Besides removing a service from the mDNS registry, a \"goodbye\"\n * message is sent for each service to let the network know about the\n * shutdown.\n */\n _tearDown: function (services, cb) {\n if (!Array.isArray(services)) { services = [services] }\n\n services = services.filter(function (service) {\n return service._activated // ignore services not currently starting or started\n })\n\n const records = flatten.depth(services.map(function (service) {\n service.deactivate()\n const records = service._records(true)\n records.forEach(function (record) {\n record.ttl = 0 // prepare goodbye message\n })\n return records\n }), 1)\n\n if (records.length === 0) { return cb && cb() }\n\n this._server.unregister(records)\n\n this._server.mdns.respond(records, this._onTearDownComplete.bind(this, services, cb))\n },\n\n _onTearDownComplete: function (services, cb) {\n for (let i = 0; i < services.length; i++) { services[i].published = false }\n\n if (cb) { cb.apply(null, Array.prototype.slice.call(arguments, 2)) }\n },\n\n _onServiceChange: function (oldPackets) {\n this._server.unregister(oldPackets)\n },\n\n /**\n * Initial service announcement\n *\n * Used to announce new services when they are first registered.\n *\n * Broadcasts right away, then after 3 seconds, 9 seconds, 27 seconds,\n * and so on, up to a maximum interval of one hour.\n */\n _onAnnounceRequest: function (packet, silent, cb) {\n this._server.register(packet)\n if (!silent) {\n this._server.mdns.respond(packet, cb)\n }\n },\n\n _onServiceUnpublish: function (service, cb) {\n const index = this._services.indexOf(service)\n\n this._tearDown(service, cb)\n\n if (index !== -1) { this._services.splice(index, 1) }\n },\n\n _onServicePublish: function (service) {\n this._services.push(service)\n\n if (service.probe) { (new Prober(this._server.mdns, service, this._onProbeComplete.bind(this, service))).start() } else { service.announce() }\n },\n\n _onProbeComplete: function (service, exists) {\n if (!exists) { return service.announce() }\n\n // Handle error\n service.stop()\n service.emit('error', new Error('Service name is already in use on the network'))\n }\n\n}\n\nmodule.exports = Registry\n","'use strict'\n\nconst multicastdns = require('multicast-dns')\nconst dnsEqual = require('./utils/dnsEqual')\nconst flatten = require('array-flatten')\nconst helpers = require('./helpers.js')\n\nconst Server = function (opts) {\n this.mdns = multicastdns(opts)\n this.mdns.setMaxListeners(0)\n this.registry = {}\n this.mdns.on('query', this._respondToQuery.bind(this))\n}\n\nServer.prototype = {\n _respondToQuery: function (query) {\n for (let i = 0; i < query.questions.length; i++) {\n const question = query.questions[i]\n\n const type = question.type\n const name = question.name\n\n // generate the answers section\n const answers = type === 'ANY'\n ? flatten.depth(Object.keys(this.registry).map(this._recordsFor.bind(this, name)), 1)\n : this._recordsFor(name, type)\n\n if (answers.length === 0) return\n\n // generate the additionals section\n let additionals = []\n if (type !== 'ANY') {\n answers.forEach(answer => {\n if (answer.type !== 'PTR') return\n additionals = additionals\n .concat(this._recordsFor(answer.data, 'SRV'))\n .concat(this._recordsFor(answer.data, 'TXT'))\n })\n\n // to populate the A and AAAA records, we need to get a set of unique\n // targets from the SRV record\n additionals\n .filter(record => {\n return record.type === 'SRV'\n })\n .map(record => {\n return record.data.target\n })\n .filter(helpers.unique())\n .forEach(target => {\n additionals = additionals\n .concat(this._recordsFor(target, 'A'))\n .concat(this._recordsFor(target, 'AAAA'))\n })\n }\n\n this.mdns.respond({\n answers,\n additionals\n }, err => {\n if (err) throw err // TODO: Handle this (if no callback is given, the error will be ignored)\n })\n }\n },\n\n register: function (records) {\n if (!Array.isArray(records)) { records = [records] }\n\n for (let i = 0; i < records.length; i++) {\n const record = records[i]\n let subRegistry = this.registry[record.type]\n\n if (!subRegistry) {\n subRegistry = this.registry[record.type] = []\n } else if (subRegistry.some(helpers.isDuplicateRecord(record))) {\n continue\n }\n\n subRegistry.push(record)\n }\n },\n\n unregister: function (records) {\n if (!Array.isArray(records)) { records = [records] }\n\n for (let i = 0; i < records.length; i++) {\n const record = records[i]\n const type = record.type\n\n if (!(type in this.registry)) { continue }\n\n this.registry[type] = this.registry[type].filter(r => {\n return r.name !== record.name\n })\n }\n },\n\n _recordsFor: function (name, type) {\n if (!(type in this.registry)) { return [] }\n\n return this.registry[type].filter(record => {\n const recordName = ~name.indexOf('.') ? record.name : record.name.split('.')[0]\n return dnsEqual(recordName, name)\n })\n }\n\n}\n\nmodule.exports = Server\n","'use strict'\n\nconst os = require('os')\nconst util = require('util')\nconst net = require('net')\nconst assert = require('assert')\nconst EventEmitter = require('events').EventEmitter\nconst serviceName = require('multicast-dns-service-types')\nconst network = require('./utils/network')\n\nconst TLD = '.local'\nconst REANNOUNCE_MAX_MS = 60 * 60 * 1000\nconst REANNOUNCE_FACTOR = 3\n\nconst Service = function (opts) {\n if (!opts.name) throw new Error('Required name not given')\n if (!opts.type) throw new Error('Required type not given')\n if (!opts.port) throw new Error('Required port not given')\n\n this.name = opts.name\n this.protocol = opts.protocol || 'tcp'\n this.probe = opts.probe !== false\n this.type = serviceName.stringify(opts.type, this.protocol)\n this.host = opts.host || os.hostname()\n this.port = opts.port\n this.fqdn = this.name + '.' + this.type + TLD\n this.subtypes = opts.subtypes || null\n this.txt = opts.txt || null\n this.published = false\n\n // adds the meta query to the records array\n // this option can only be turned on if only one service is advertised on the responder\n // otherwise it will break when one service is removed from the network\n this.addUnsafeServiceEnumerationRecord = opts.addUnsafeServiceEnumerationRecord || false\n\n this.restrictedAddresses = undefined\n if (opts.restrictedAddresses) {\n assert(opts.restrictedAddresses.length, \"The service property 'restrictedAddresses' cannot be an empty array!\")\n this.restrictedAddresses = new Map()\n\n for (const entry of opts.restrictedAddresses) {\n if (net.isIP(entry)) {\n if (entry === '0.0.0.0' || entry === '::') {\n throw new Error(`[${this.fqdn}] Unspecified ip address (${entry}) cannot be used to restrict on to!`)\n }\n\n const interfaceName = network.resolveInterface(entry)\n if (!interfaceName) {\n throw new Error(`[${this.fqdn}] Could not restrict service to address ${entry} as we could not resolve it to an interface name!`)\n }\n\n const current = this.restrictedAddresses.get(interfaceName)\n if (current) {\n // empty interface signals \"catch all\" was already configured for this\n if (current.length && !current.includes(entry)) {\n current.push(entry)\n }\n } else {\n this.restrictedAddresses.set(interfaceName, [entry])\n }\n } else {\n this.restrictedAddresses.set(entry, []) // empty array signals \"use all addresses for interface\"\n }\n }\n }\n\n this.disabledIpv6 = opts.disabledIpv6 || false\n\n this._activated = false // indicates intent - true: starting/started, false: stopping/stopped\n}\n\nutil.inherits(Service, EventEmitter)\n\nconst proto = {\n\n start: function () {\n if (this._activated) { return }\n\n this._activated = true\n\n this.emit('service-publish', this)\n },\n\n stop: function (cb) {\n if (!this._activated) {\n cb()\n return\n }\n\n this.emit('service-unpublish', this, cb)\n },\n\n updateTxt: function (txt, silent) {\n if (this.packet) { this.emit('service-packet-change', this.packet, this.onAnnounceComplete.bind(this)) }\n this.packet = null\n this.txt = txt\n\n if (!this.published) { return }\n\n this._unpublish()\n this.announce(silent)\n },\n\n announce: function (silent) {\n if (this._destroyed) { return }\n\n if (!this.packet) { this.packet = this._records() }\n\n if (this.timer) { clearTimeout(this.timer) }\n\n this.delay = 1000\n this.emit('service-announce-request', this.packet, silent || false, this.onAnnounceComplete.bind(this))\n },\n\n onAnnounceComplete: function () {\n if (!this.published) {\n this._activated = true // not sure if this is needed here\n this.published = true\n this.emit('up')\n }\n\n this.delay = this.delay * REANNOUNCE_FACTOR\n if (this.delay < REANNOUNCE_MAX_MS && !this._destroyed && this._activated) {\n this.timer = setTimeout(this.announce.bind(this), this.delay).unref()\n } else {\n this.timer = undefined\n this.delay = undefined\n }\n },\n\n deactivate: function () {\n this._unpublish()\n this._activated = false\n },\n\n destroy: function () {\n this._unpublish()\n this.removeAllListeners()\n this._destroyed = true\n },\n\n _unpublish: function () {\n if (this.timer) { clearTimeout(this.timer) }\n\n this.published = false\n },\n\n _records: function (teardown) {\n const records = [this._rrPtr(), this._rrSrv(), this._rrTxt()]\n\n records.push(...this._addressRecords())\n\n if (!teardown && this.addUnsafeServiceEnumerationRecord) {\n records.push(this._rrMetaPtr())\n }\n\n return records\n },\n\n _addressRecords: function () {\n const records = []\n const addresses = []\n\n Object.entries(os.networkInterfaces()).forEach(([name, interfaces]) => {\n let restrictedAddresses = this.restrictedAddresses ? this.restrictedAddresses.get(name) : undefined\n if (this.restrictedAddresses && !restrictedAddresses) {\n return\n }\n\n if (restrictedAddresses && restrictedAddresses.length === 0) {\n restrictedAddresses = undefined\n }\n\n interfaces.forEach(iface => {\n if (iface.internal || addresses.includes(iface.address)) {\n return\n }\n\n if (restrictedAddresses && restrictedAddresses.includes(iface.address)) {\n return\n }\n\n if (iface.family === 'IPv4') {\n records.push(this._rrA(iface.address))\n addresses.push(iface.address)\n } else if (!this.disabledIpv6) {\n records.push(this._rrAaaa(iface.address))\n addresses.push(iface.address)\n }\n })\n })\n\n return records\n },\n\n _rrMetaPtr: function () {\n return {\n name: '_services._dns-sd._udp.local',\n type: 'PTR',\n ttl: 4500,\n data: this.type + TLD\n }\n },\n\n _rrPtr: function () {\n return {\n name: this.type + TLD,\n type: 'PTR',\n ttl: 4500,\n data: this.fqdn\n }\n },\n\n _rrSrv: function () {\n return {\n name: this.fqdn,\n type: 'SRV',\n ttl: 120,\n flush: true,\n data: {\n port: this.port,\n target: this.host\n }\n }\n },\n\n _rrTxt: function () {\n const data = []\n if (this.txt) {\n const txtRecords = this.txt\n const keys = Object.keys(txtRecords)\n keys.forEach((key) => {\n const val = txtRecords[key]\n data.push(key + '=' + val)\n })\n }\n return {\n name: this.fqdn,\n type: 'TXT',\n ttl: 4500,\n flush: true,\n data\n }\n },\n\n _rrA: function (ip) {\n return {\n name: this.host,\n type: 'A',\n ttl: 120,\n flush: true,\n data: ip\n }\n },\n\n _rrAaaa: function (ip) {\n return {\n name: this.host,\n type: 'AAAA',\n ttl: 120,\n flush: true,\n data: ip\n }\n }\n\n}\n\nfor (const x in proto) { Service.prototype[x] = proto[x] }\n\nmodule.exports = Service\n","const deepEqual = require('deep-equal')\n\nmodule.exports = {\n\n isDuplicateRecord: function (a) {\n return function (b) {\n return a.type === b.type &&\n a.name === b.name &&\n deepEqual(a.data, b.data)\n }\n },\n\n unique: function () {\n const set = []\n return function (obj) {\n if (~set.indexOf(obj)) return false\n set.push(obj)\n return true\n }\n }\n\n}\n","'use strict'\n\nconst r = /[A-Z]/g\n\nmodule.exports = function (a, b) {\n a = a.replace(r, replacer)\n b = b.replace(r, replacer)\n return a === b\n}\n\nfunction replacer (m) {\n return m.toLowerCase()\n}\n","const os = require('os')\n\nfunction resolveInterface (address) {\n for (const [name, infoArray] of Object.entries(os.networkInterfaces())) {\n for (const info of infoArray) {\n if (info.address === address) {\n return name\n }\n }\n }\n\n return undefined\n}\n\nmodule.exports = {\n resolveInterface\n}\n","'use strict'\n\nconst equalSign = Buffer.from('=')\n\nmodule.exports = function (opts) {\n const binary = opts ? opts.binary : false\n const that = {}\n\n that.decodeBlocks = function (bufArray) {\n const data = {}\n\n bufArray.forEach(buf => {\n if (buf.length === 0) {\n return // ignore: most likely a single zero byte\n }\n\n const i = buf.indexOf(equalSign)\n\n if (i === -1) { // equal sign does not exist\n data[buf.toString().toLowerCase()] = true\n } else if (i > 0) { // we ignore zero key-length blocks\n const key = buf.slice(0, i).toString().toLowerCase()\n\n if (key in data) { // ignore: overwriting not allowed\n return\n }\n\n const valueBuf = buf.slice(i + 1)\n data[key] = binary ? valueBuf : valueBuf.toString()\n }\n })\n\n return data\n }\n\n return that\n}\n","/* eslint-disable node/no-deprecated-api */\n\nvar toString = Object.prototype.toString\n\nvar isModern = (\n typeof Buffer !== 'undefined' &&\n typeof Buffer.alloc === 'function' &&\n typeof Buffer.allocUnsafe === 'function' &&\n typeof Buffer.from === 'function'\n)\n\nfunction isArrayBuffer (input) {\n return toString.call(input).slice(8, -1) === 'ArrayBuffer'\n}\n\nfunction fromArrayBuffer (obj, byteOffset, length) {\n byteOffset >>>= 0\n\n var maxLength = obj.byteLength - byteOffset\n\n if (maxLength < 0) {\n throw new RangeError(\"'offset' is out of bounds\")\n }\n\n if (length === undefined) {\n length = maxLength\n } else {\n length >>>= 0\n\n if (length > maxLength) {\n throw new RangeError(\"'length' is out of bounds\")\n }\n }\n\n return isModern\n ? Buffer.from(obj.slice(byteOffset, byteOffset + length))\n : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)))\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n return isModern\n ? Buffer.from(string, encoding)\n : new Buffer(string, encoding)\n}\n\nfunction bufferFrom (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (isArrayBuffer(value)) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n return isModern\n ? Buffer.from(value)\n : new Buffer(value)\n}\n\nmodule.exports = bufferFrom\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\nvar setFunctionLength = require('set-function-length');\n\nvar $TypeError = require('es-errors/type');\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $defineProperty = require('es-define-property');\nvar $max = GetIntrinsic('%Math.max%');\n\nmodule.exports = function callBind(originalFunction) {\n\tif (typeof originalFunction !== 'function') {\n\t\tthrow new $TypeError('a function is required');\n\t}\n\tvar func = $reflectApply(bind, $call, arguments);\n\treturn setFunctionLength(\n\t\tfunc,\n\t\t1 + $max(0, originalFunction.length - (arguments.length - 1)),\n\t\ttrue\n\t);\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/**\n * Detect Electron renderer / nwjs process, which is node, but we should\n * treat as a browser.\n */\n\nif (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {\n\tmodule.exports = require('./browser.js');\n} else {\n\tmodule.exports = require('./node.js');\n}\n","/**\n * Module dependencies.\n */\n\nconst tty = require('tty');\nconst util = require('util');\n\n/**\n * This is the Node.js implementation of `debug()`.\n */\n\nexports.init = init;\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.destroy = util.deprecate(\n\t() => {},\n\t'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'\n);\n\n/**\n * Colors.\n */\n\nexports.colors = [6, 2, 3, 4, 5, 1];\n\ntry {\n\t// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)\n\t// eslint-disable-next-line import/no-extraneous-dependencies\n\tconst supportsColor = require('supports-color');\n\n\tif (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {\n\t\texports.colors = [\n\t\t\t20,\n\t\t\t21,\n\t\t\t26,\n\t\t\t27,\n\t\t\t32,\n\t\t\t33,\n\t\t\t38,\n\t\t\t39,\n\t\t\t40,\n\t\t\t41,\n\t\t\t42,\n\t\t\t43,\n\t\t\t44,\n\t\t\t45,\n\t\t\t56,\n\t\t\t57,\n\t\t\t62,\n\t\t\t63,\n\t\t\t68,\n\t\t\t69,\n\t\t\t74,\n\t\t\t75,\n\t\t\t76,\n\t\t\t77,\n\t\t\t78,\n\t\t\t79,\n\t\t\t80,\n\t\t\t81,\n\t\t\t92,\n\t\t\t93,\n\t\t\t98,\n\t\t\t99,\n\t\t\t112,\n\t\t\t113,\n\t\t\t128,\n\t\t\t129,\n\t\t\t134,\n\t\t\t135,\n\t\t\t148,\n\t\t\t149,\n\t\t\t160,\n\t\t\t161,\n\t\t\t162,\n\t\t\t163,\n\t\t\t164,\n\t\t\t165,\n\t\t\t166,\n\t\t\t167,\n\t\t\t168,\n\t\t\t169,\n\t\t\t170,\n\t\t\t171,\n\t\t\t172,\n\t\t\t173,\n\t\t\t178,\n\t\t\t179,\n\t\t\t184,\n\t\t\t185,\n\t\t\t196,\n\t\t\t197,\n\t\t\t198,\n\t\t\t199,\n\t\t\t200,\n\t\t\t201,\n\t\t\t202,\n\t\t\t203,\n\t\t\t204,\n\t\t\t205,\n\t\t\t206,\n\t\t\t207,\n\t\t\t208,\n\t\t\t209,\n\t\t\t214,\n\t\t\t215,\n\t\t\t220,\n\t\t\t221\n\t\t];\n\t}\n} catch (error) {\n\t// Swallow - we only care if `supports-color` is available; it doesn't have to be.\n}\n\n/**\n * Build up the default `inspectOpts` object from the environment variables.\n *\n * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js\n */\n\nexports.inspectOpts = Object.keys(process.env).filter(key => {\n\treturn /^debug_/i.test(key);\n}).reduce((obj, key) => {\n\t// Camel-case\n\tconst prop = key\n\t\t.substring(6)\n\t\t.toLowerCase()\n\t\t.replace(/_([a-z])/g, (_, k) => {\n\t\t\treturn k.toUpperCase();\n\t\t});\n\n\t// Coerce string value into JS value\n\tlet val = process.env[key];\n\tif (/^(yes|on|true|enabled)$/i.test(val)) {\n\t\tval = true;\n\t} else if (/^(no|off|false|disabled)$/i.test(val)) {\n\t\tval = false;\n\t} else if (val === 'null') {\n\t\tval = null;\n\t} else {\n\t\tval = Number(val);\n\t}\n\n\tobj[prop] = val;\n\treturn obj;\n}, {});\n\n/**\n * Is stdout a TTY? Colored output is enabled when `true`.\n */\n\nfunction useColors() {\n\treturn 'colors' in exports.inspectOpts ?\n\t\tBoolean(exports.inspectOpts.colors) :\n\t\ttty.isatty(process.stderr.fd);\n}\n\n/**\n * Adds ANSI color escape codes if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\tconst {namespace: name, useColors} = this;\n\n\tif (useColors) {\n\t\tconst c = this.color;\n\t\tconst colorCode = '\\u001B[3' + (c < 8 ? c : '8;5;' + c);\n\t\tconst prefix = ` ${colorCode};1m${name} \\u001B[0m`;\n\n\t\targs[0] = prefix + args[0].split('\\n').join('\\n' + prefix);\n\t\targs.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\\u001B[0m');\n\t} else {\n\t\targs[0] = getDate() + name + ' ' + args[0];\n\t}\n}\n\nfunction getDate() {\n\tif (exports.inspectOpts.hideDate) {\n\t\treturn '';\n\t}\n\treturn new Date().toISOString() + ' ';\n}\n\n/**\n * Invokes `util.format()` with the specified arguments and writes to stderr.\n */\n\nfunction log(...args) {\n\treturn process.stderr.write(util.format(...args) + '\\n');\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\tif (namespaces) {\n\t\tprocess.env.DEBUG = namespaces;\n\t} else {\n\t\t// If you set a process.env field to null or undefined, it gets cast to the\n\t\t// string 'null' or 'undefined'. Just delete instead.\n\t\tdelete process.env.DEBUG;\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n\treturn process.env.DEBUG;\n}\n\n/**\n * Init logic for `debug` instances.\n *\n * Create a new `inspectOpts` object in case `useColors` is set\n * differently for a particular `debug` instance.\n */\n\nfunction init(debug) {\n\tdebug.inspectOpts = {};\n\n\tconst keys = Object.keys(exports.inspectOpts);\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tdebug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %o to `util.inspect()`, all on a single line.\n */\n\nformatters.o = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts)\n\t\t.split('\\n')\n\t\t.map(str => str.trim())\n\t\t.join(' ');\n};\n\n/**\n * Map %O to `util.inspect()`, allowing multiple lines if needed.\n */\n\nformatters.O = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts);\n};\n","'use strict';\n\nvar assign = require('object.assign');\nvar callBound = require('call-bind/callBound');\nvar flags = require('regexp.prototype.flags');\nvar GetIntrinsic = require('get-intrinsic');\nvar getIterator = require('es-get-iterator');\nvar getSideChannel = require('side-channel');\nvar is = require('object-is');\nvar isArguments = require('is-arguments');\nvar isArray = require('isarray');\nvar isArrayBuffer = require('is-array-buffer');\nvar isDate = require('is-date-object');\nvar isRegex = require('is-regex');\nvar isSharedArrayBuffer = require('is-shared-array-buffer');\nvar objectKeys = require('object-keys');\nvar whichBoxedPrimitive = require('which-boxed-primitive');\nvar whichCollection = require('which-collection');\nvar whichTypedArray = require('which-typed-array');\nvar byteLength = require('array-buffer-byte-length');\n\nvar sabByteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);\n\nvar $getTime = callBound('Date.prototype.getTime');\nvar gPO = Object.getPrototypeOf;\nvar $objToString = callBound('Object.prototype.toString');\n\nvar $Set = GetIntrinsic('%Set%', true);\nvar $mapHas = callBound('Map.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSize = callBound('Map.prototype.size', true);\nvar $setAdd = callBound('Set.prototype.add', true);\nvar $setDelete = callBound('Set.prototype.delete', true);\nvar $setHas = callBound('Set.prototype.has', true);\nvar $setSize = callBound('Set.prototype.size', true);\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L401-L414\nfunction setHasEqualElement(set, val1, opts, channel) {\n var i = getIterator(set);\n var result;\n while ((result = i.next()) && !result.done) {\n if (internalDeepEqual(val1, result.value, opts, channel)) { // eslint-disable-line no-use-before-define\n // Remove the matching element to make sure we do not check that again.\n $setDelete(set, result.value);\n return true;\n }\n }\n\n return false;\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L416-L439\nfunction findLooseMatchingPrimitives(prim) {\n if (typeof prim === 'undefined') {\n return null;\n }\n if (typeof prim === 'object') { // Only pass in null as object!\n return void 0;\n }\n if (typeof prim === 'symbol') {\n return false;\n }\n if (typeof prim === 'string' || typeof prim === 'number') {\n // Loose equal entries exist only if the string is possible to convert to a regular number and not NaN.\n return +prim === +prim; // eslint-disable-line no-implicit-coercion\n }\n return true;\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L449-L460\nfunction mapMightHaveLoosePrim(a, b, prim, item, opts, channel) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) {\n return altValue;\n }\n var curB = $mapGet(b, altValue);\n var looseOpts = assign({}, opts, { strict: false });\n if (\n (typeof curB === 'undefined' && !$mapHas(b, altValue))\n // eslint-disable-next-line no-use-before-define\n || !internalDeepEqual(item, curB, looseOpts, channel)\n ) {\n return false;\n }\n // eslint-disable-next-line no-use-before-define\n return !$mapHas(a, altValue) && internalDeepEqual(item, curB, looseOpts, channel);\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L441-L447\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) {\n return altValue;\n }\n\n return $setHas(b, altValue) && !$setHas(a, altValue);\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L518-L533\nfunction mapHasEqualEntry(set, map, key1, item1, opts, channel) {\n var i = getIterator(set);\n var result;\n var key2;\n while ((result = i.next()) && !result.done) {\n key2 = result.value;\n if (\n // eslint-disable-next-line no-use-before-define\n internalDeepEqual(key1, key2, opts, channel)\n // eslint-disable-next-line no-use-before-define\n && internalDeepEqual(item1, $mapGet(map, key2), opts, channel)\n ) {\n $setDelete(set, key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction internalDeepEqual(actual, expected, options, channel) {\n var opts = options || {};\n\n // 7.1. All identical values are equivalent, as determined by ===.\n if (opts.strict ? is(actual, expected) : actual === expected) {\n return true;\n }\n\n var actualBoxed = whichBoxedPrimitive(actual);\n var expectedBoxed = whichBoxedPrimitive(expected);\n if (actualBoxed !== expectedBoxed) {\n return false;\n }\n\n // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.\n if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {\n return opts.strict ? is(actual, expected) : actual == expected; // eslint-disable-line eqeqeq\n }\n\n /*\n * 7.4. For all other Object pairs, including Array objects, equivalence is\n * determined by having the same number of owned properties (as verified\n * with Object.prototype.hasOwnProperty.call), the same set of keys\n * (although not necessarily the same order), equivalent values for every\n * corresponding key, and an identical 'prototype' property. Note: this\n * accounts for both named and indexed properties on Arrays.\n */\n // see https://github.com/nodejs/node/commit/d3aafd02efd3a403d646a3044adcf14e63a88d32 for memos/channel inspiration\n\n var hasActual = channel.has(actual);\n var hasExpected = channel.has(expected);\n var sentinel;\n if (hasActual && hasExpected) {\n if (channel.get(actual) === channel.get(expected)) {\n return true;\n }\n } else {\n sentinel = {};\n }\n if (!hasActual) { channel.set(actual, sentinel); }\n if (!hasExpected) { channel.set(expected, sentinel); }\n\n // eslint-disable-next-line no-use-before-define\n return objEquiv(actual, expected, opts, channel);\n}\n\nfunction isBuffer(x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') {\n return false;\n }\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') {\n return false;\n }\n\n return !!(x.constructor && x.constructor.isBuffer && x.constructor.isBuffer(x));\n}\n\nfunction setEquiv(a, b, opts, channel) {\n if ($setSize(a) !== $setSize(b)) {\n return false;\n }\n var iA = getIterator(a);\n var iB = getIterator(b);\n var resultA;\n var resultB;\n var set;\n while ((resultA = iA.next()) && !resultA.done) {\n if (resultA.value && typeof resultA.value === 'object') {\n if (!set) { set = new $Set(); }\n $setAdd(set, resultA.value);\n } else if (!$setHas(b, resultA.value)) {\n if (opts.strict) { return false; }\n if (!setMightHaveLoosePrim(a, b, resultA.value)) {\n return false;\n }\n if (!set) { set = new $Set(); }\n $setAdd(set, resultA.value);\n }\n }\n if (set) {\n while ((resultB = iB.next()) && !resultB.done) {\n // We have to check if a primitive value is already matching and only if it's not, go hunting for it.\n if (resultB.value && typeof resultB.value === 'object') {\n if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) {\n return false;\n }\n } else if (\n !opts.strict\n && !$setHas(a, resultB.value)\n && !setHasEqualElement(set, resultB.value, opts.strict, channel)\n ) {\n return false;\n }\n }\n return $setSize(set) === 0;\n }\n return true;\n}\n\nfunction mapEquiv(a, b, opts, channel) {\n if ($mapSize(a) !== $mapSize(b)) {\n return false;\n }\n var iA = getIterator(a);\n var iB = getIterator(b);\n var resultA;\n var resultB;\n var set;\n var key;\n var item1;\n var item2;\n while ((resultA = iA.next()) && !resultA.done) {\n key = resultA.value[0];\n item1 = resultA.value[1];\n if (key && typeof key === 'object') {\n if (!set) { set = new $Set(); }\n $setAdd(set, key);\n } else {\n item2 = $mapGet(b, key);\n if ((typeof item2 === 'undefined' && !$mapHas(b, key)) || !internalDeepEqual(item1, item2, opts, channel)) {\n if (opts.strict) {\n return false;\n }\n if (!mapMightHaveLoosePrim(a, b, key, item1, opts, channel)) {\n return false;\n }\n if (!set) { set = new $Set(); }\n $setAdd(set, key);\n }\n }\n }\n\n if (set) {\n while ((resultB = iB.next()) && !resultB.done) {\n key = resultB.value[0];\n item2 = resultB.value[1];\n if (key && typeof key === 'object') {\n if (!mapHasEqualEntry(set, a, key, item2, opts, channel)) {\n return false;\n }\n } else if (\n !opts.strict\n && (!a.has(key) || !internalDeepEqual($mapGet(a, key), item2, opts, channel))\n && !mapHasEqualEntry(set, a, key, item2, assign({}, opts, { strict: false }), channel)\n ) {\n return false;\n }\n }\n return $setSize(set) === 0;\n }\n return true;\n}\n\nfunction objEquiv(a, b, opts, channel) {\n /* eslint max-statements: [2, 100], max-lines-per-function: [2, 120], max-depth: [2, 5], max-lines: [2, 400] */\n var i, key;\n\n if (typeof a !== typeof b) { return false; }\n if (a == null || b == null) { return false; }\n\n if ($objToString(a) !== $objToString(b)) { return false; }\n\n if (isArguments(a) !== isArguments(b)) { return false; }\n\n var aIsArray = isArray(a);\n var bIsArray = isArray(b);\n if (aIsArray !== bIsArray) { return false; }\n\n // TODO: replace when a cross-realm brand check is available\n var aIsError = a instanceof Error;\n var bIsError = b instanceof Error;\n if (aIsError !== bIsError) { return false; }\n if (aIsError || bIsError) {\n if (a.name !== b.name || a.message !== b.message) { return false; }\n }\n\n var aIsRegex = isRegex(a);\n var bIsRegex = isRegex(b);\n if (aIsRegex !== bIsRegex) { return false; }\n if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) {\n return false;\n }\n\n var aIsDate = isDate(a);\n var bIsDate = isDate(b);\n if (aIsDate !== bIsDate) { return false; }\n if (aIsDate || bIsDate) { // && would work too, because both are true or both false here\n if ($getTime(a) !== $getTime(b)) { return false; }\n }\n if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }\n\n var aWhich = whichTypedArray(a);\n var bWhich = whichTypedArray(b);\n if (aWhich !== bWhich) {\n return false;\n }\n if (aWhich || bWhich) { // && would work too, because both are true or both false here\n if (a.length !== b.length) { return false; }\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) { return false; }\n }\n return true;\n }\n\n var aIsBuffer = isBuffer(a);\n var bIsBuffer = isBuffer(b);\n if (aIsBuffer !== bIsBuffer) { return false; }\n if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here\n if (a.length !== b.length) { return false; }\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) { return false; }\n }\n return true;\n }\n\n var aIsArrayBuffer = isArrayBuffer(a);\n var bIsArrayBuffer = isArrayBuffer(b);\n if (aIsArrayBuffer !== bIsArrayBuffer) { return false; }\n if (aIsArrayBuffer || bIsArrayBuffer) { // && would work too, because both are true or both false here\n if (byteLength(a) !== byteLength(b)) { return false; }\n return typeof Uint8Array === 'function' && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel);\n }\n\n var aIsSAB = isSharedArrayBuffer(a);\n var bIsSAB = isSharedArrayBuffer(b);\n if (aIsSAB !== bIsSAB) { return false; }\n if (aIsSAB || bIsSAB) { // && would work too, because both are true or both false here\n if (sabByteLength(a) !== sabByteLength(b)) { return false; }\n return typeof Uint8Array === 'function' && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel);\n }\n\n if (typeof a !== typeof b) { return false; }\n\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n // having the same number of owned properties (keys incorporates hasOwnProperty)\n if (ka.length !== kb.length) { return false; }\n\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) { return false; } // eslint-disable-line eqeqeq\n }\n\n // equivalent values for every corresponding key, and ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!internalDeepEqual(a[key], b[key], opts, channel)) { return false; }\n }\n\n var aCollection = whichCollection(a);\n var bCollection = whichCollection(b);\n if (aCollection !== bCollection) {\n return false;\n }\n if (aCollection === 'Set' || bCollection === 'Set') { // aCollection === bCollection\n return setEquiv(a, b, opts, channel);\n }\n if (aCollection === 'Map') { // aCollection === bCollection\n return mapEquiv(a, b, opts, channel);\n }\n\n return true;\n}\n\nmodule.exports = function deepEqual(a, b, opts) {\n return internalDeepEqual(a, b, opts, getSideChannel());\n};\n","'use strict';\n\nvar $defineProperty = require('es-define-property');\n\nvar $SyntaxError = require('es-errors/syntax');\nvar $TypeError = require('es-errors/type');\n\nvar gopd = require('gopd');\n\n/** @type {import('.')} */\nmodule.exports = function defineDataProperty(\n\tobj,\n\tproperty,\n\tvalue\n) {\n\tif (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {\n\t\tthrow new $TypeError('`obj` must be an object or a function`');\n\t}\n\tif (typeof property !== 'string' && typeof property !== 'symbol') {\n\t\tthrow new $TypeError('`property` must be a string or a symbol`');\n\t}\n\tif (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {\n\t\tthrow new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {\n\t\tthrow new $TypeError('`nonWritable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {\n\t\tthrow new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 6 && typeof arguments[6] !== 'boolean') {\n\t\tthrow new $TypeError('`loose`, if provided, must be a boolean');\n\t}\n\n\tvar nonEnumerable = arguments.length > 3 ? arguments[3] : null;\n\tvar nonWritable = arguments.length > 4 ? arguments[4] : null;\n\tvar nonConfigurable = arguments.length > 5 ? arguments[5] : null;\n\tvar loose = arguments.length > 6 ? arguments[6] : false;\n\n\t/* @type {false | TypedPropertyDescriptor} */\n\tvar desc = !!gopd && gopd(obj, property);\n\n\tif ($defineProperty) {\n\t\t$defineProperty(obj, property, {\n\t\t\tconfigurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,\n\t\t\tenumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,\n\t\t\tvalue: value,\n\t\t\twritable: nonWritable === null && desc ? desc.writable : !nonWritable\n\t\t});\n\t} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {\n\t\t// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable\n\t\tobj[property] = value; // eslint-disable-line no-param-reassign\n\t} else {\n\t\tthrow new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');\n\t}\n};\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar defineDataProperty = require('define-data-property');\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar supportsDescriptors = require('has-property-descriptors')();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object) {\n\t\tif (predicate === true) {\n\t\t\tif (object[name] === value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (!isFunction(predicate) || !predicate()) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (supportsDescriptors) {\n\t\tdefineDataProperty(object, name, value, true);\n\t} else {\n\t\tdefineDataProperty(object, name, value);\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","'use strict'\n\nexports.toString = function (klass) {\n switch (klass) {\n case 1: return 'IN'\n case 2: return 'CS'\n case 3: return 'CH'\n case 4: return 'HS'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + klass\n}\n\nexports.toClass = function (name) {\n switch (name.toUpperCase()) {\n case 'IN': return 1\n case 'CS': return 2\n case 'CH': return 3\n case 'HS': return 4\n case 'ANY': return 255\n }\n return 0\n}\n","'use strict'\n\nconst Buffer = require('buffer').Buffer\nconst types = require('./types')\nconst rcodes = require('./rcodes')\nconst opcodes = require('./opcodes')\nconst classes = require('./classes')\nconst optioncodes = require('./optioncodes')\nconst ip = require('@leichtgewicht/ip-codec')\n\nconst QUERY_FLAG = 0\nconst RESPONSE_FLAG = 1 << 15\nconst FLUSH_MASK = 1 << 15\nconst NOT_FLUSH_MASK = ~FLUSH_MASK\nconst QU_MASK = 1 << 15\nconst NOT_QU_MASK = ~QU_MASK\n\nconst name = exports.name = {}\n\nname.encode = function (str, buf, offset, { mail = false } = {}) {\n if (!buf) buf = Buffer.alloc(name.encodingLength(str))\n if (!offset) offset = 0\n const oldOffset = offset\n\n // strip leading and trailing .\n const n = str.replace(/^\\.|\\.$/gm, '')\n if (n.length) {\n let list = []\n if (mail) {\n let localPart = ''\n n.split('.').forEach(label => {\n if (label.endsWith('\\\\')) {\n localPart += (localPart.length ? '.' : '') + label.slice(0, -1)\n } else {\n if (list.length === 0 && localPart.length) {\n list.push(localPart + '.' + label)\n } else {\n list.push(label)\n }\n }\n })\n } else {\n list = n.split('.')\n }\n\n for (let i = 0; i < list.length; i++) {\n const len = buf.write(list[i], offset + 1)\n buf[offset] = len\n offset += len + 1\n }\n }\n\n buf[offset++] = 0\n\n name.encode.bytes = offset - oldOffset\n return buf\n}\n\nname.encode.bytes = 0\n\nname.decode = function (buf, offset, { mail = false } = {}) {\n if (!offset) offset = 0\n\n const list = []\n let oldOffset = offset\n let totalLength = 0\n let consumedBytes = 0\n let jumped = false\n\n while (true) {\n if (offset >= buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const len = buf[offset++]\n consumedBytes += jumped ? 0 : 1\n\n if (len === 0) {\n break\n } else if ((len & 0xc0) === 0) {\n if (offset + len > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n totalLength += len + 1\n if (totalLength > 254) {\n throw new Error('Cannot decode name (name too long)')\n }\n let label = buf.toString('utf-8', offset, offset + len)\n if (mail) {\n label = label.replace(/\\./g, '\\\\.')\n }\n list.push(label)\n offset += len\n consumedBytes += jumped ? 0 : len\n } else if ((len & 0xc0) === 0xc0) {\n if (offset + 1 > buf.length) {\n throw new Error('Cannot decode name (buffer overflow)')\n }\n const jumpOffset = buf.readUInt16BE(offset - 1) - 0xc000\n if (jumpOffset >= oldOffset) {\n // Allow only pointers to prior data. RFC 1035, section 4.1.4 states:\n // \"[...] an entire domain name or a list of labels at the end of a domain name\n // is replaced with a pointer to a prior occurance (sic) of the same name.\"\n throw new Error('Cannot decode name (bad pointer)')\n }\n offset = jumpOffset\n oldOffset = jumpOffset\n consumedBytes += jumped ? 0 : 1\n jumped = true\n } else {\n throw new Error('Cannot decode name (bad label)')\n }\n }\n\n name.decode.bytes = consumedBytes\n return list.length === 0 ? '.' : list.join('.')\n}\n\nname.decode.bytes = 0\n\nname.encodingLength = function (n) {\n if (n === '.' || n === '..') return 1\n return Buffer.byteLength(n.replace(/^\\.|\\.$/gm, '')) + 2\n}\n\nconst string = {}\n\nstring.encode = function (s, buf, offset) {\n if (!buf) buf = Buffer.alloc(string.encodingLength(s))\n if (!offset) offset = 0\n\n const len = buf.write(s, offset + 1)\n buf[offset] = len\n string.encode.bytes = len + 1\n return buf\n}\n\nstring.encode.bytes = 0\n\nstring.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf[offset]\n const s = buf.toString('utf-8', offset + 1, offset + 1 + len)\n string.decode.bytes = len + 1\n return s\n}\n\nstring.decode.bytes = 0\n\nstring.encodingLength = function (s) {\n return Buffer.byteLength(s) + 1\n}\n\nconst header = {}\n\nheader.encode = function (h, buf, offset) {\n if (!buf) buf = header.encodingLength(h)\n if (!offset) offset = 0\n\n const flags = (h.flags || 0) & 32767\n const type = h.type === 'response' ? RESPONSE_FLAG : QUERY_FLAG\n\n buf.writeUInt16BE(h.id || 0, offset)\n buf.writeUInt16BE(flags | type, offset + 2)\n buf.writeUInt16BE(h.questions.length, offset + 4)\n buf.writeUInt16BE(h.answers.length, offset + 6)\n buf.writeUInt16BE(h.authorities.length, offset + 8)\n buf.writeUInt16BE(h.additionals.length, offset + 10)\n\n return buf\n}\n\nheader.encode.bytes = 12\n\nheader.decode = function (buf, offset) {\n if (!offset) offset = 0\n if (buf.length < 12) throw new Error('Header must be 12 bytes')\n const flags = buf.readUInt16BE(offset + 2)\n\n return {\n id: buf.readUInt16BE(offset),\n type: flags & RESPONSE_FLAG ? 'response' : 'query',\n flags: flags & 32767,\n flag_qr: ((flags >> 15) & 0x1) === 1,\n opcode: opcodes.toString((flags >> 11) & 0xf),\n flag_aa: ((flags >> 10) & 0x1) === 1,\n flag_tc: ((flags >> 9) & 0x1) === 1,\n flag_rd: ((flags >> 8) & 0x1) === 1,\n flag_ra: ((flags >> 7) & 0x1) === 1,\n flag_z: ((flags >> 6) & 0x1) === 1,\n flag_ad: ((flags >> 5) & 0x1) === 1,\n flag_cd: ((flags >> 4) & 0x1) === 1,\n rcode: rcodes.toString(flags & 0xf),\n questions: new Array(buf.readUInt16BE(offset + 4)),\n answers: new Array(buf.readUInt16BE(offset + 6)),\n authorities: new Array(buf.readUInt16BE(offset + 8)),\n additionals: new Array(buf.readUInt16BE(offset + 10))\n }\n}\n\nheader.decode.bytes = 12\n\nheader.encodingLength = function () {\n return 12\n}\n\nconst runknown = exports.unknown = {}\n\nrunknown.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(runknown.encodingLength(data))\n if (!offset) offset = 0\n\n buf.writeUInt16BE(data.length, offset)\n data.copy(buf, offset + 2)\n\n runknown.encode.bytes = data.length + 2\n return buf\n}\n\nrunknown.encode.bytes = 0\n\nrunknown.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf.readUInt16BE(offset)\n const data = buf.slice(offset + 2, offset + 2 + len)\n runknown.decode.bytes = len + 2\n return data\n}\n\nrunknown.decode.bytes = 0\n\nrunknown.encodingLength = function (data) {\n return data.length + 2\n}\n\nconst rns = exports.ns = {}\n\nrns.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rns.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n buf.writeUInt16BE(name.encode.bytes, offset)\n rns.encode.bytes = name.encode.bytes + 2\n return buf\n}\n\nrns.encode.bytes = 0\n\nrns.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf.readUInt16BE(offset)\n const dd = name.decode(buf, offset + 2)\n\n rns.decode.bytes = len + 2\n return dd\n}\n\nrns.decode.bytes = 0\n\nrns.encodingLength = function (data) {\n return name.encodingLength(data) + 2\n}\n\nconst rsoa = exports.soa = {}\n\nrsoa.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rsoa.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n name.encode(data.mname, buf, offset)\n offset += name.encode.bytes\n name.encode(data.rname, buf, offset, { mail: true })\n offset += name.encode.bytes\n buf.writeUInt32BE(data.serial || 0, offset)\n offset += 4\n buf.writeUInt32BE(data.refresh || 0, offset)\n offset += 4\n buf.writeUInt32BE(data.retry || 0, offset)\n offset += 4\n buf.writeUInt32BE(data.expire || 0, offset)\n offset += 4\n buf.writeUInt32BE(data.minimum || 0, offset)\n offset += 4\n\n buf.writeUInt16BE(offset - oldOffset - 2, oldOffset)\n rsoa.encode.bytes = offset - oldOffset\n return buf\n}\n\nrsoa.encode.bytes = 0\n\nrsoa.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mname = name.decode(buf, offset)\n offset += name.decode.bytes\n data.rname = name.decode(buf, offset, { mail: true })\n offset += name.decode.bytes\n data.serial = buf.readUInt32BE(offset)\n offset += 4\n data.refresh = buf.readUInt32BE(offset)\n offset += 4\n data.retry = buf.readUInt32BE(offset)\n offset += 4\n data.expire = buf.readUInt32BE(offset)\n offset += 4\n data.minimum = buf.readUInt32BE(offset)\n offset += 4\n\n rsoa.decode.bytes = offset - oldOffset\n return data\n}\n\nrsoa.decode.bytes = 0\n\nrsoa.encodingLength = function (data) {\n return 22 + name.encodingLength(data.mname) + name.encodingLength(data.rname)\n}\n\nconst rtxt = exports.txt = {}\n\nrtxt.encode = function (data, buf, offset) {\n if (!Array.isArray(data)) data = [data]\n for (let i = 0; i < data.length; i++) {\n if (typeof data[i] === 'string') {\n data[i] = Buffer.from(data[i])\n }\n if (!Buffer.isBuffer(data[i])) {\n throw new Error('Must be a Buffer')\n }\n }\n\n if (!buf) buf = Buffer.alloc(rtxt.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n\n data.forEach(function (d) {\n buf[offset++] = d.length\n d.copy(buf, offset, 0, d.length)\n offset += d.length\n })\n\n buf.writeUInt16BE(offset - oldOffset - 2, oldOffset)\n rtxt.encode.bytes = offset - oldOffset\n return buf\n}\n\nrtxt.encode.bytes = 0\n\nrtxt.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n let remaining = buf.readUInt16BE(offset)\n offset += 2\n\n let data = []\n while (remaining > 0) {\n const len = buf[offset++]\n --remaining\n if (remaining < len) {\n throw new Error('Buffer overflow')\n }\n data.push(buf.slice(offset, offset + len))\n offset += len\n remaining -= len\n }\n\n rtxt.decode.bytes = offset - oldOffset\n return data\n}\n\nrtxt.decode.bytes = 0\n\nrtxt.encodingLength = function (data) {\n if (!Array.isArray(data)) data = [data]\n let length = 2\n data.forEach(function (buf) {\n if (typeof buf === 'string') {\n length += Buffer.byteLength(buf) + 1\n } else {\n length += buf.length + 1\n }\n })\n return length\n}\n\nconst rnull = exports.null = {}\n\nrnull.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rnull.encodingLength(data))\n if (!offset) offset = 0\n\n if (typeof data === 'string') data = Buffer.from(data)\n if (!data) data = Buffer.alloc(0)\n\n const oldOffset = offset\n offset += 2\n\n const len = data.length\n data.copy(buf, offset, 0, len)\n offset += len\n\n buf.writeUInt16BE(offset - oldOffset - 2, oldOffset)\n rnull.encode.bytes = offset - oldOffset\n return buf\n}\n\nrnull.encode.bytes = 0\n\nrnull.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n const len = buf.readUInt16BE(offset)\n\n offset += 2\n\n const data = buf.slice(offset, offset + len)\n offset += len\n\n rnull.decode.bytes = offset - oldOffset\n return data\n}\n\nrnull.decode.bytes = 0\n\nrnull.encodingLength = function (data) {\n if (!data) return 2\n return (Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data)) + 2\n}\n\nconst rhinfo = exports.hinfo = {}\n\nrhinfo.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rhinfo.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n string.encode(data.cpu, buf, offset)\n offset += string.encode.bytes\n string.encode(data.os, buf, offset)\n offset += string.encode.bytes\n buf.writeUInt16BE(offset - oldOffset - 2, oldOffset)\n rhinfo.encode.bytes = offset - oldOffset\n return buf\n}\n\nrhinfo.encode.bytes = 0\n\nrhinfo.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.cpu = string.decode(buf, offset)\n offset += string.decode.bytes\n data.os = string.decode(buf, offset)\n offset += string.decode.bytes\n rhinfo.decode.bytes = offset - oldOffset\n return data\n}\n\nrhinfo.decode.bytes = 0\n\nrhinfo.encodingLength = function (data) {\n return string.encodingLength(data.cpu) + string.encodingLength(data.os) + 2\n}\n\nconst rptr = exports.ptr = {}\nconst rcname = exports.cname = rptr\nconst rdname = exports.dname = rptr\n\nrptr.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rptr.encodingLength(data))\n if (!offset) offset = 0\n\n name.encode(data, buf, offset + 2)\n buf.writeUInt16BE(name.encode.bytes, offset)\n rptr.encode.bytes = name.encode.bytes + 2\n return buf\n}\n\nrptr.encode.bytes = 0\n\nrptr.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const data = name.decode(buf, offset + 2)\n rptr.decode.bytes = name.decode.bytes + 2\n return data\n}\n\nrptr.decode.bytes = 0\n\nrptr.encodingLength = function (data) {\n return name.encodingLength(data) + 2\n}\n\nconst rsrv = exports.srv = {}\n\nrsrv.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rsrv.encodingLength(data))\n if (!offset) offset = 0\n\n buf.writeUInt16BE(data.priority || 0, offset + 2)\n buf.writeUInt16BE(data.weight || 0, offset + 4)\n buf.writeUInt16BE(data.port || 0, offset + 6)\n name.encode(data.target, buf, offset + 8)\n\n const len = name.encode.bytes + 6\n buf.writeUInt16BE(len, offset)\n\n rsrv.encode.bytes = len + 2\n return buf\n}\n\nrsrv.encode.bytes = 0\n\nrsrv.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf.readUInt16BE(offset)\n\n const data = {}\n data.priority = buf.readUInt16BE(offset + 2)\n data.weight = buf.readUInt16BE(offset + 4)\n data.port = buf.readUInt16BE(offset + 6)\n data.target = name.decode(buf, offset + 8)\n\n rsrv.decode.bytes = len + 2\n return data\n}\n\nrsrv.decode.bytes = 0\n\nrsrv.encodingLength = function (data) {\n return 8 + name.encodingLength(data.target)\n}\n\nconst rcaa = exports.caa = {}\n\nrcaa.ISSUER_CRITICAL = 1 << 7\n\nrcaa.encode = function (data, buf, offset) {\n const len = rcaa.encodingLength(data)\n\n if (!buf) buf = Buffer.alloc(rcaa.encodingLength(data))\n if (!offset) offset = 0\n\n if (data.issuerCritical) {\n data.flags = rcaa.ISSUER_CRITICAL\n }\n\n buf.writeUInt16BE(len - 2, offset)\n offset += 2\n buf.writeUInt8(data.flags || 0, offset)\n offset += 1\n string.encode(data.tag, buf, offset)\n offset += string.encode.bytes\n buf.write(data.value, offset)\n offset += Buffer.byteLength(data.value)\n\n rcaa.encode.bytes = len\n return buf\n}\n\nrcaa.encode.bytes = 0\n\nrcaa.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const len = buf.readUInt16BE(offset)\n offset += 2\n\n const oldOffset = offset\n const data = {}\n data.flags = buf.readUInt8(offset)\n offset += 1\n data.tag = string.decode(buf, offset)\n offset += string.decode.bytes\n data.value = buf.toString('utf-8', offset, oldOffset + len)\n\n data.issuerCritical = !!(data.flags & rcaa.ISSUER_CRITICAL)\n\n rcaa.decode.bytes = len + 2\n\n return data\n}\n\nrcaa.decode.bytes = 0\n\nrcaa.encodingLength = function (data) {\n return string.encodingLength(data.tag) + string.encodingLength(data.value) + 2\n}\n\nconst rmx = exports.mx = {}\n\nrmx.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rmx.encodingLength(data))\n if (!offset) offset = 0\n\n const oldOffset = offset\n offset += 2\n buf.writeUInt16BE(data.preference || 0, offset)\n offset += 2\n name.encode(data.exchange, buf, offset)\n offset += name.encode.bytes\n\n buf.writeUInt16BE(offset - oldOffset - 2, oldOffset)\n rmx.encode.bytes = offset - oldOffset\n return buf\n}\n\nrmx.encode.bytes = 0\n\nrmx.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.preference = buf.readUInt16BE(offset)\n offset += 2\n data.exchange = name.decode(buf, offset)\n offset += name.decode.bytes\n\n rmx.decode.bytes = offset - oldOffset\n return data\n}\n\nrmx.encodingLength = function (data) {\n return 4 + name.encodingLength(data.exchange)\n}\n\nconst ra = exports.a = {}\n\nra.encode = function (host, buf, offset) {\n if (!buf) buf = Buffer.alloc(ra.encodingLength(host))\n if (!offset) offset = 0\n\n buf.writeUInt16BE(4, offset)\n offset += 2\n ip.v4.encode(host, buf, offset)\n ra.encode.bytes = 6\n return buf\n}\n\nra.encode.bytes = 0\n\nra.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = ip.v4.decode(buf, offset)\n ra.decode.bytes = 6\n return host\n}\n\nra.decode.bytes = 0\n\nra.encodingLength = function () {\n return 6\n}\n\nconst raaaa = exports.aaaa = {}\n\nraaaa.encode = function (host, buf, offset) {\n if (!buf) buf = Buffer.alloc(raaaa.encodingLength(host))\n if (!offset) offset = 0\n\n buf.writeUInt16BE(16, offset)\n offset += 2\n ip.v6.encode(host, buf, offset)\n raaaa.encode.bytes = 18\n return buf\n}\n\nraaaa.encode.bytes = 0\n\nraaaa.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n offset += 2\n const host = ip.v6.decode(buf, offset)\n raaaa.decode.bytes = 18\n return host\n}\n\nraaaa.decode.bytes = 0\n\nraaaa.encodingLength = function () {\n return 18\n}\n\nconst roption = exports.option = {}\n\nroption.encode = function (option, buf, offset) {\n if (!buf) buf = Buffer.alloc(roption.encodingLength(option))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const code = optioncodes.toCode(option.code)\n buf.writeUInt16BE(code, offset)\n offset += 2\n if (option.data) {\n buf.writeUInt16BE(option.data.length, offset)\n offset += 2\n option.data.copy(buf, offset)\n offset += option.data.length\n } else {\n switch (code) {\n // case 3: NSID. No encode makes sense.\n // case 5,6,7: Not implementable\n case 8: // ECS\n // note: do IP math before calling\n const spl = option.sourcePrefixLength || 0\n const fam = option.family || ip.familyOf(option.ip)\n const ipBuf = ip.encode(option.ip, Buffer.alloc)\n const ipLen = Math.ceil(spl / 8)\n buf.writeUInt16BE(ipLen + 4, offset)\n offset += 2\n buf.writeUInt16BE(fam, offset)\n offset += 2\n buf.writeUInt8(spl, offset++)\n buf.writeUInt8(option.scopePrefixLength || 0, offset++)\n\n ipBuf.copy(buf, offset, 0, ipLen)\n offset += ipLen\n break\n // case 9: EXPIRE (experimental)\n // case 10: COOKIE. No encode makes sense.\n case 11: // KEEP-ALIVE\n if (option.timeout) {\n buf.writeUInt16BE(2, offset)\n offset += 2\n buf.writeUInt16BE(option.timeout, offset)\n offset += 2\n } else {\n buf.writeUInt16BE(0, offset)\n offset += 2\n }\n break\n case 12: // PADDING\n const len = option.length || 0\n buf.writeUInt16BE(len, offset)\n offset += 2\n buf.fill(0, offset, offset + len)\n offset += len\n break\n // case 13: CHAIN. Experimental.\n case 14: // KEY-TAG\n const tagsLen = option.tags.length * 2\n buf.writeUInt16BE(tagsLen, offset)\n offset += 2\n for (const tag of option.tags) {\n buf.writeUInt16BE(tag, offset)\n offset += 2\n }\n break\n default:\n throw new Error(`Unknown roption code: ${option.code}`)\n }\n }\n\n roption.encode.bytes = offset - oldOffset\n return buf\n}\n\nroption.encode.bytes = 0\n\nroption.decode = function (buf, offset) {\n if (!offset) offset = 0\n const option = {}\n option.code = buf.readUInt16BE(offset)\n option.type = optioncodes.toString(option.code)\n offset += 2\n const len = buf.readUInt16BE(offset)\n offset += 2\n option.data = buf.slice(offset, offset + len)\n switch (option.code) {\n // case 3: NSID. No decode makes sense.\n case 8: // ECS\n option.family = buf.readUInt16BE(offset)\n offset += 2\n option.sourcePrefixLength = buf.readUInt8(offset++)\n option.scopePrefixLength = buf.readUInt8(offset++)\n const padded = Buffer.alloc((option.family === 1) ? 4 : 16)\n buf.copy(padded, 0, offset, offset + len - 4)\n option.ip = ip.decode(padded)\n break\n // case 12: Padding. No decode makes sense.\n case 11: // KEEP-ALIVE\n if (len > 0) {\n option.timeout = buf.readUInt16BE(offset)\n offset += 2\n }\n break\n case 14:\n option.tags = []\n for (let i = 0; i < len; i += 2) {\n option.tags.push(buf.readUInt16BE(offset))\n offset += 2\n }\n // don't worry about default. caller will use data if desired\n }\n\n roption.decode.bytes = len + 4\n return option\n}\n\nroption.decode.bytes = 0\n\nroption.encodingLength = function (option) {\n if (option.data) {\n return option.data.length + 4\n }\n const code = optioncodes.toCode(option.code)\n switch (code) {\n case 8: // ECS\n const spl = option.sourcePrefixLength || 0\n return Math.ceil(spl / 8) + 8\n case 11: // KEEP-ALIVE\n return (typeof option.timeout === 'number') ? 6 : 4\n case 12: // PADDING\n return option.length + 4\n case 14: // KEY-TAG\n return 4 + (option.tags.length * 2)\n }\n throw new Error(`Unknown roption code: ${option.code}`)\n}\n\nconst ropt = exports.opt = {}\n\nropt.encode = function (options, buf, offset) {\n if (!buf) buf = Buffer.alloc(ropt.encodingLength(options))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const rdlen = encodingLengthList(options, roption)\n buf.writeUInt16BE(rdlen, offset)\n offset = encodeList(options, roption, buf, offset + 2)\n\n ropt.encode.bytes = offset - oldOffset\n return buf\n}\n\nropt.encode.bytes = 0\n\nropt.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const options = []\n let rdlen = buf.readUInt16BE(offset)\n offset += 2\n let o = 0\n while (rdlen > 0) {\n options[o++] = roption.decode(buf, offset)\n offset += roption.decode.bytes\n rdlen -= roption.decode.bytes\n }\n ropt.decode.bytes = offset - oldOffset\n return options\n}\n\nropt.decode.bytes = 0\n\nropt.encodingLength = function (options) {\n return 2 + encodingLengthList(options || [], roption)\n}\n\nconst rdnskey = exports.dnskey = {}\n\nrdnskey.PROTOCOL_DNSSEC = 3\nrdnskey.ZONE_KEY = 0x80\nrdnskey.SECURE_ENTRYPOINT = 0x8000\n\nrdnskey.encode = function (key, buf, offset) {\n if (!buf) buf = Buffer.alloc(rdnskey.encodingLength(key))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const keydata = key.key\n if (!Buffer.isBuffer(keydata)) {\n throw new Error('Key must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf.writeUInt16BE(key.flags, offset)\n offset += 2\n buf.writeUInt8(rdnskey.PROTOCOL_DNSSEC, offset)\n offset += 1\n buf.writeUInt8(key.algorithm, offset)\n offset += 1\n keydata.copy(buf, offset, 0, keydata.length)\n offset += keydata.length\n\n rdnskey.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rdnskey.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrdnskey.encode.bytes = 0\n\nrdnskey.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var key = {}\n var length = buf.readUInt16BE(offset)\n offset += 2\n key.flags = buf.readUInt16BE(offset)\n offset += 2\n if (buf.readUInt8(offset) !== rdnskey.PROTOCOL_DNSSEC) {\n throw new Error('Protocol must be 3')\n }\n offset += 1\n key.algorithm = buf.readUInt8(offset)\n offset += 1\n key.key = buf.slice(offset, oldOffset + length + 2)\n offset += key.key.length\n rdnskey.decode.bytes = offset - oldOffset\n return key\n}\n\nrdnskey.decode.bytes = 0\n\nrdnskey.encodingLength = function (key) {\n return 6 + Buffer.byteLength(key.key)\n}\n\nconst rrrsig = exports.rrsig = {}\n\nrrrsig.encode = function (sig, buf, offset) {\n if (!buf) buf = Buffer.alloc(rrrsig.encodingLength(sig))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const signature = sig.signature\n if (!Buffer.isBuffer(signature)) {\n throw new Error('Signature must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf.writeUInt16BE(types.toType(sig.typeCovered), offset)\n offset += 2\n buf.writeUInt8(sig.algorithm, offset)\n offset += 1\n buf.writeUInt8(sig.labels, offset)\n offset += 1\n buf.writeUInt32BE(sig.originalTTL, offset)\n offset += 4\n buf.writeUInt32BE(sig.expiration, offset)\n offset += 4\n buf.writeUInt32BE(sig.inception, offset)\n offset += 4\n buf.writeUInt16BE(sig.keyTag, offset)\n offset += 2\n name.encode(sig.signersName, buf, offset)\n offset += name.encode.bytes\n signature.copy(buf, offset, 0, signature.length)\n offset += signature.length\n\n rrrsig.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rrrsig.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrrrsig.encode.bytes = 0\n\nrrrsig.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var sig = {}\n var length = buf.readUInt16BE(offset)\n offset += 2\n sig.typeCovered = types.toString(buf.readUInt16BE(offset))\n offset += 2\n sig.algorithm = buf.readUInt8(offset)\n offset += 1\n sig.labels = buf.readUInt8(offset)\n offset += 1\n sig.originalTTL = buf.readUInt32BE(offset)\n offset += 4\n sig.expiration = buf.readUInt32BE(offset)\n offset += 4\n sig.inception = buf.readUInt32BE(offset)\n offset += 4\n sig.keyTag = buf.readUInt16BE(offset)\n offset += 2\n sig.signersName = name.decode(buf, offset)\n offset += name.decode.bytes\n sig.signature = buf.slice(offset, oldOffset + length + 2)\n offset += sig.signature.length\n rrrsig.decode.bytes = offset - oldOffset\n return sig\n}\n\nrrrsig.decode.bytes = 0\n\nrrrsig.encodingLength = function (sig) {\n return 20 +\n name.encodingLength(sig.signersName) +\n Buffer.byteLength(sig.signature)\n}\n\nconst rrp = exports.rp = {}\n\nrrp.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rrp.encodingLength(data))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(data.mbox || '.', buf, offset, { mail: true })\n offset += name.encode.bytes\n name.encode(data.txt || '.', buf, offset)\n offset += name.encode.bytes\n rrp.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rrp.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrrp.encode.bytes = 0\n\nrrp.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const data = {}\n offset += 2\n data.mbox = name.decode(buf, offset, { mail: true }) || '.'\n offset += name.decode.bytes\n data.txt = name.decode(buf, offset) || '.'\n offset += name.decode.bytes\n rrp.decode.bytes = offset - oldOffset\n return data\n}\n\nrrp.decode.bytes = 0\n\nrrp.encodingLength = function (data) {\n return 2 + name.encodingLength(data.mbox || '.') + name.encodingLength(data.txt || '.')\n}\n\nconst typebitmap = {}\n\ntypebitmap.encode = function (typelist, buf, offset) {\n if (!buf) buf = Buffer.alloc(typebitmap.encodingLength(typelist))\n if (!offset) offset = 0\n const oldOffset = offset\n\n var typesByWindow = []\n for (var i = 0; i < typelist.length; i++) {\n var typeid = types.toType(typelist[i])\n if (typesByWindow[typeid >> 8] === undefined) {\n typesByWindow[typeid >> 8] = []\n }\n typesByWindow[typeid >> 8][(typeid >> 3) & 0x1F] |= 1 << (7 - (typeid & 0x7))\n }\n\n for (i = 0; i < typesByWindow.length; i++) {\n if (typesByWindow[i] !== undefined) {\n var windowBuf = Buffer.from(typesByWindow[i])\n buf.writeUInt8(i, offset)\n offset += 1\n buf.writeUInt8(windowBuf.length, offset)\n offset += 1\n windowBuf.copy(buf, offset)\n offset += windowBuf.length\n }\n }\n\n typebitmap.encode.bytes = offset - oldOffset\n return buf\n}\n\ntypebitmap.encode.bytes = 0\n\ntypebitmap.decode = function (buf, offset, length) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var typelist = []\n while (offset - oldOffset < length) {\n var window = buf.readUInt8(offset)\n offset += 1\n var windowLength = buf.readUInt8(offset)\n offset += 1\n for (var i = 0; i < windowLength; i++) {\n var b = buf.readUInt8(offset + i)\n for (var j = 0; j < 8; j++) {\n if (b & (1 << (7 - j))) {\n var typeid = types.toString((window << 8) | (i << 3) | j)\n typelist.push(typeid)\n }\n }\n }\n offset += windowLength\n }\n\n typebitmap.decode.bytes = offset - oldOffset\n return typelist\n}\n\ntypebitmap.decode.bytes = 0\n\ntypebitmap.encodingLength = function (typelist) {\n var extents = []\n for (var i = 0; i < typelist.length; i++) {\n var typeid = types.toType(typelist[i])\n extents[typeid >> 8] = Math.max(extents[typeid >> 8] || 0, typeid & 0xFF)\n }\n\n var len = 0\n for (i = 0; i < extents.length; i++) {\n if (extents[i] !== undefined) {\n len += 2 + Math.ceil((extents[i] + 1) / 8)\n }\n }\n\n return len\n}\n\nconst rnsec = exports.nsec = {}\n\nrnsec.encode = function (record, buf, offset) {\n if (!buf) buf = Buffer.alloc(rnsec.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // Leave space for length\n name.encode(record.nextDomain, buf, offset)\n offset += name.encode.bytes\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rnsec.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrnsec.encode.bytes = 0\n\nrnsec.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var record = {}\n var length = buf.readUInt16BE(offset)\n offset += 2\n record.nextDomain = name.decode(buf, offset)\n offset += name.decode.bytes\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec.decode.bytes = offset - oldOffset\n return record\n}\n\nrnsec.decode.bytes = 0\n\nrnsec.encodingLength = function (record) {\n return 2 +\n name.encodingLength(record.nextDomain) +\n typebitmap.encodingLength(record.rrtypes)\n}\n\nconst rnsec3 = exports.nsec3 = {}\n\nrnsec3.encode = function (record, buf, offset) {\n if (!buf) buf = Buffer.alloc(rnsec3.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const salt = record.salt\n if (!Buffer.isBuffer(salt)) {\n throw new Error('salt must be a Buffer')\n }\n\n const nextDomain = record.nextDomain\n if (!Buffer.isBuffer(nextDomain)) {\n throw new Error('nextDomain must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf.writeUInt8(record.algorithm, offset)\n offset += 1\n buf.writeUInt8(record.flags, offset)\n offset += 1\n buf.writeUInt16BE(record.iterations, offset)\n offset += 2\n buf.writeUInt8(salt.length, offset)\n offset += 1\n salt.copy(buf, offset, 0, salt.length)\n offset += salt.length\n buf.writeUInt8(nextDomain.length, offset)\n offset += 1\n nextDomain.copy(buf, offset, 0, nextDomain.length)\n offset += nextDomain.length\n typebitmap.encode(record.rrtypes, buf, offset)\n offset += typebitmap.encode.bytes\n\n rnsec3.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rnsec3.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrnsec3.encode.bytes = 0\n\nrnsec3.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var record = {}\n var length = buf.readUInt16BE(offset)\n offset += 2\n record.algorithm = buf.readUInt8(offset)\n offset += 1\n record.flags = buf.readUInt8(offset)\n offset += 1\n record.iterations = buf.readUInt16BE(offset)\n offset += 2\n const saltLength = buf.readUInt8(offset)\n offset += 1\n record.salt = buf.slice(offset, offset + saltLength)\n offset += saltLength\n const hashLength = buf.readUInt8(offset)\n offset += 1\n record.nextDomain = buf.slice(offset, offset + hashLength)\n offset += hashLength\n record.rrtypes = typebitmap.decode(buf, offset, length - (offset - oldOffset))\n offset += typebitmap.decode.bytes\n\n rnsec3.decode.bytes = offset - oldOffset\n return record\n}\n\nrnsec3.decode.bytes = 0\n\nrnsec3.encodingLength = function (record) {\n return 8 +\n record.salt.length +\n record.nextDomain.length +\n typebitmap.encodingLength(record.rrtypes)\n}\n\nconst rds = exports.ds = {}\n\nrds.encode = function (digest, buf, offset) {\n if (!buf) buf = Buffer.alloc(rds.encodingLength(digest))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const digestdata = digest.digest\n if (!Buffer.isBuffer(digestdata)) {\n throw new Error('Digest must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf.writeUInt16BE(digest.keyTag, offset)\n offset += 2\n buf.writeUInt8(digest.algorithm, offset)\n offset += 1\n buf.writeUInt8(digest.digestType, offset)\n offset += 1\n digestdata.copy(buf, offset, 0, digestdata.length)\n offset += digestdata.length\n\n rds.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rds.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrds.encode.bytes = 0\n\nrds.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n var digest = {}\n var length = buf.readUInt16BE(offset)\n offset += 2\n digest.keyTag = buf.readUInt16BE(offset)\n offset += 2\n digest.algorithm = buf.readUInt8(offset)\n offset += 1\n digest.digestType = buf.readUInt8(offset)\n offset += 1\n digest.digest = buf.slice(offset, oldOffset + length + 2)\n offset += digest.digest.length\n rds.decode.bytes = offset - oldOffset\n return digest\n}\n\nrds.decode.bytes = 0\n\nrds.encodingLength = function (digest) {\n return 6 + Buffer.byteLength(digest.digest)\n}\n\nconst rsshfp = exports.sshfp = {}\n\nrsshfp.getFingerprintLengthForHashType = function getFingerprintLengthForHashType (hashType) {\n switch (hashType) {\n case 1: return 20\n case 2: return 32\n }\n}\n\nrsshfp.encode = function encode (record, buf, offset) {\n if (!buf) buf = Buffer.alloc(rsshfp.encodingLength(record))\n if (!offset) offset = 0\n const oldOffset = offset\n\n offset += 2 // The function call starts with the offset pointer at the RDLENGTH field, not the RDATA one\n buf[offset] = record.algorithm\n offset += 1\n buf[offset] = record.hash\n offset += 1\n\n const fingerprintBuf = Buffer.from(record.fingerprint.toUpperCase(), 'hex')\n if (fingerprintBuf.length !== rsshfp.getFingerprintLengthForHashType(record.hash)) {\n throw new Error('Invalid fingerprint length')\n }\n fingerprintBuf.copy(buf, offset)\n offset += fingerprintBuf.byteLength\n\n rsshfp.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rsshfp.encode.bytes - 2, oldOffset)\n\n return buf\n}\n\nrsshfp.encode.bytes = 0\n\nrsshfp.decode = function decode (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const record = {}\n offset += 2 // Account for the RDLENGTH field\n record.algorithm = buf[offset]\n offset += 1\n record.hash = buf[offset]\n offset += 1\n\n const fingerprintLength = rsshfp.getFingerprintLengthForHashType(record.hash)\n record.fingerprint = buf.slice(offset, offset + fingerprintLength).toString('hex').toUpperCase()\n offset += fingerprintLength\n rsshfp.decode.bytes = offset - oldOffset\n return record\n}\n\nrsshfp.decode.bytes = 0\n\nrsshfp.encodingLength = function (record) {\n return 4 + Buffer.from(record.fingerprint, 'hex').byteLength\n}\n\nconst rnaptr = exports.naptr = {}\n\nrnaptr.encode = function (data, buf, offset) {\n if (!buf) buf = Buffer.alloc(rnaptr.encodingLength(data))\n if (!offset) offset = 0\n const oldOffset = offset\n offset += 2\n buf.writeUInt16BE(data.order || 0, offset)\n offset += 2\n buf.writeUInt16BE(data.preference || 0, offset)\n offset += 2\n string.encode(data.flags, buf, offset)\n offset += string.encode.bytes\n string.encode(data.services, buf, offset)\n offset += string.encode.bytes\n string.encode(data.regexp, buf, offset)\n offset += string.encode.bytes\n name.encode(data.replacement, buf, offset)\n offset += name.encode.bytes\n rnaptr.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rnaptr.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrnaptr.encode.bytes = 0\n\nrnaptr.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n const data = {}\n offset += 2\n data.order = buf.readUInt16BE(offset)\n offset += 2\n data.preference = buf.readUInt16BE(offset)\n offset += 2\n data.flags = string.decode(buf, offset)\n offset += string.decode.bytes\n data.services = string.decode(buf, offset)\n offset += string.decode.bytes\n data.regexp = string.decode(buf, offset)\n offset += string.decode.bytes\n data.replacement = name.decode(buf, offset)\n offset += name.decode.bytes\n rnaptr.decode.bytes = offset - oldOffset\n return data\n}\n\nrnaptr.decode.bytes = 0\n\nrnaptr.encodingLength = function (data) {\n return string.encodingLength(data.flags) +\n string.encodingLength(data.services) +\n string.encodingLength(data.regexp) +\n name.encodingLength(data.replacement) + 6\n}\n\nconst rtlsa = exports.tlsa = {}\n\nrtlsa.encode = function (cert, buf, offset) {\n if (!buf) buf = Buffer.alloc(rtlsa.encodingLength(cert))\n if (!offset) offset = 0\n const oldOffset = offset\n\n const certdata = cert.certificate\n if (!Buffer.isBuffer(certdata)) {\n throw new Error('Certificate must be a Buffer')\n }\n\n offset += 2 // Leave space for length\n buf.writeUInt8(cert.usage, offset)\n offset += 1\n buf.writeUInt8(cert.selector, offset)\n offset += 1\n buf.writeUInt8(cert.matchingType, offset)\n offset += 1\n certdata.copy(buf, offset, 0, certdata.length)\n offset += certdata.length\n\n rtlsa.encode.bytes = offset - oldOffset\n buf.writeUInt16BE(rtlsa.encode.bytes - 2, oldOffset)\n return buf\n}\n\nrtlsa.encode.bytes = 0\n\nrtlsa.decode = function (buf, offset) {\n if (!offset) offset = 0\n const oldOffset = offset\n\n const cert = {}\n const length = buf.readUInt16BE(offset)\n offset += 2\n cert.usage = buf.readUInt8(offset)\n offset += 1\n cert.selector = buf.readUInt8(offset)\n offset += 1\n cert.matchingType = buf.readUInt8(offset)\n offset += 1\n cert.certificate = buf.slice(offset, oldOffset + length + 2)\n offset += cert.certificate.length\n rtlsa.decode.bytes = offset - oldOffset\n return cert\n}\n\nrtlsa.decode.bytes = 0\n\nrtlsa.encodingLength = function (cert) {\n return 5 + Buffer.byteLength(cert.certificate)\n}\n\nconst renc = exports.record = function (type) {\n switch (type.toUpperCase()) {\n case 'A': return ra\n case 'PTR': return rptr\n case 'CNAME': return rcname\n case 'DNAME': return rdname\n case 'TXT': return rtxt\n case 'NULL': return rnull\n case 'AAAA': return raaaa\n case 'SRV': return rsrv\n case 'HINFO': return rhinfo\n case 'CAA': return rcaa\n case 'NS': return rns\n case 'SOA': return rsoa\n case 'MX': return rmx\n case 'OPT': return ropt\n case 'DNSKEY': return rdnskey\n case 'RRSIG': return rrrsig\n case 'RP': return rrp\n case 'NSEC': return rnsec\n case 'NSEC3': return rnsec3\n case 'SSHFP': return rsshfp\n case 'DS': return rds\n case 'NAPTR': return rnaptr\n case 'TLSA': return rtlsa\n }\n return runknown\n}\n\nconst answer = exports.answer = {}\n\nanswer.encode = function (a, buf, offset) {\n if (!buf) buf = Buffer.alloc(answer.encodingLength(a))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(a.name, buf, offset)\n offset += name.encode.bytes\n\n buf.writeUInt16BE(types.toType(a.type), offset)\n\n if (a.type.toUpperCase() === 'OPT') {\n if (a.name !== '.') {\n throw new Error('OPT name must be root.')\n }\n buf.writeUInt16BE(a.udpPayloadSize || 4096, offset + 2)\n buf.writeUInt8(a.extendedRcode || 0, offset + 4)\n buf.writeUInt8(a.ednsVersion || 0, offset + 5)\n buf.writeUInt16BE(a.flags || 0, offset + 6)\n\n offset += 8\n ropt.encode(a.options || [], buf, offset)\n offset += ropt.encode.bytes\n } else {\n let klass = classes.toClass(a.class === undefined ? 'IN' : a.class)\n if (a.flush) klass |= FLUSH_MASK // the 1st bit of the class is the flush bit\n buf.writeUInt16BE(klass, offset + 2)\n buf.writeUInt32BE(a.ttl || 0, offset + 4)\n\n offset += 8\n const enc = renc(a.type)\n enc.encode(a.data, buf, offset)\n offset += enc.encode.bytes\n }\n\n answer.encode.bytes = offset - oldOffset\n return buf\n}\n\nanswer.encode.bytes = 0\n\nanswer.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const a = {}\n const oldOffset = offset\n\n a.name = name.decode(buf, offset)\n offset += name.decode.bytes\n a.type = types.toString(buf.readUInt16BE(offset))\n if (a.type === 'OPT') {\n a.udpPayloadSize = buf.readUInt16BE(offset + 2)\n a.extendedRcode = buf.readUInt8(offset + 4)\n a.ednsVersion = buf.readUInt8(offset + 5)\n a.flags = buf.readUInt16BE(offset + 6)\n a.flag_do = ((a.flags >> 15) & 0x1) === 1\n a.options = ropt.decode(buf, offset + 8)\n offset += 8 + ropt.decode.bytes\n } else {\n const klass = buf.readUInt16BE(offset + 2)\n a.ttl = buf.readUInt32BE(offset + 4)\n\n a.class = classes.toString(klass & NOT_FLUSH_MASK)\n a.flush = !!(klass & FLUSH_MASK)\n\n const enc = renc(a.type)\n a.data = enc.decode(buf, offset + 8)\n offset += 8 + enc.decode.bytes\n }\n\n answer.decode.bytes = offset - oldOffset\n return a\n}\n\nanswer.decode.bytes = 0\n\nanswer.encodingLength = function (a) {\n const data = (a.data !== null && a.data !== undefined) ? a.data : a.options\n return name.encodingLength(a.name) + 8 + renc(a.type).encodingLength(data)\n}\n\nconst question = exports.question = {}\n\nquestion.encode = function (q, buf, offset) {\n if (!buf) buf = Buffer.alloc(question.encodingLength(q))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n name.encode(q.name, buf, offset)\n offset += name.encode.bytes\n\n buf.writeUInt16BE(types.toType(q.type), offset)\n offset += 2\n\n buf.writeUInt16BE(classes.toClass(q.class === undefined ? 'IN' : q.class), offset)\n offset += 2\n\n question.encode.bytes = offset - oldOffset\n return q\n}\n\nquestion.encode.bytes = 0\n\nquestion.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const q = {}\n\n q.name = name.decode(buf, offset)\n offset += name.decode.bytes\n\n q.type = types.toString(buf.readUInt16BE(offset))\n offset += 2\n\n q.class = classes.toString(buf.readUInt16BE(offset))\n offset += 2\n\n const qu = !!(q.class & QU_MASK)\n if (qu) q.class &= NOT_QU_MASK\n\n question.decode.bytes = offset - oldOffset\n return q\n}\n\nquestion.decode.bytes = 0\n\nquestion.encodingLength = function (q) {\n return name.encodingLength(q.name) + 4\n}\n\nexports.AUTHORITATIVE_ANSWER = 1 << 10\nexports.TRUNCATED_RESPONSE = 1 << 9\nexports.RECURSION_DESIRED = 1 << 8\nexports.RECURSION_AVAILABLE = 1 << 7\nexports.AUTHENTIC_DATA = 1 << 5\nexports.CHECKING_DISABLED = 1 << 4\nexports.DNSSEC_OK = 1 << 15\n\nexports.encode = function (result, buf, offset) {\n const allocing = !buf\n\n if (allocing) buf = Buffer.alloc(exports.encodingLength(result))\n if (!offset) offset = 0\n\n const oldOffset = offset\n\n if (!result.questions) result.questions = []\n if (!result.answers) result.answers = []\n if (!result.authorities) result.authorities = []\n if (!result.additionals) result.additionals = []\n\n header.encode(result, buf, offset)\n offset += header.encode.bytes\n\n offset = encodeList(result.questions, question, buf, offset)\n offset = encodeList(result.answers, answer, buf, offset)\n offset = encodeList(result.authorities, answer, buf, offset)\n offset = encodeList(result.additionals, answer, buf, offset)\n\n exports.encode.bytes = offset - oldOffset\n\n // just a quick sanity check\n if (allocing && exports.encode.bytes !== buf.length) {\n return buf.slice(0, exports.encode.bytes)\n }\n\n return buf\n}\n\nexports.encode.bytes = 0\n\nexports.decode = function (buf, offset) {\n if (!offset) offset = 0\n\n const oldOffset = offset\n const result = header.decode(buf, offset)\n offset += header.decode.bytes\n\n offset = decodeList(result.questions, question, buf, offset)\n offset = decodeList(result.answers, answer, buf, offset)\n offset = decodeList(result.authorities, answer, buf, offset)\n offset = decodeList(result.additionals, answer, buf, offset)\n\n exports.decode.bytes = offset - oldOffset\n\n return result\n}\n\nexports.decode.bytes = 0\n\nexports.encodingLength = function (result) {\n return header.encodingLength(result) +\n encodingLengthList(result.questions || [], question) +\n encodingLengthList(result.answers || [], answer) +\n encodingLengthList(result.authorities || [], answer) +\n encodingLengthList(result.additionals || [], answer)\n}\n\nexports.streamEncode = function (result) {\n const buf = exports.encode(result)\n const sbuf = Buffer.alloc(2)\n sbuf.writeUInt16BE(buf.byteLength)\n const combine = Buffer.concat([sbuf, buf])\n exports.streamEncode.bytes = combine.byteLength\n return combine\n}\n\nexports.streamEncode.bytes = 0\n\nexports.streamDecode = function (sbuf) {\n const len = sbuf.readUInt16BE(0)\n if (sbuf.byteLength < len + 2) {\n // not enough data\n return null\n }\n const result = exports.decode(sbuf.slice(2))\n exports.streamDecode.bytes = exports.decode.bytes\n return result\n}\n\nexports.streamDecode.bytes = 0\n\nfunction encodingLengthList (list, enc) {\n let len = 0\n for (let i = 0; i < list.length; i++) len += enc.encodingLength(list[i])\n return len\n}\n\nfunction encodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n enc.encode(list[i], buf, offset)\n offset += enc.encode.bytes\n }\n return offset\n}\n\nfunction decodeList (list, enc, buf, offset) {\n for (let i = 0; i < list.length; i++) {\n list[i] = enc.decode(buf, offset)\n offset += enc.decode.bytes\n }\n return offset\n}\n","'use strict'\n\n/*\n * Traditional DNS header OPCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5\n */\n\nexports.toString = function (opcode) {\n switch (opcode) {\n case 0: return 'QUERY'\n case 1: return 'IQUERY'\n case 2: return 'STATUS'\n case 3: return 'OPCODE_3'\n case 4: return 'NOTIFY'\n case 5: return 'UPDATE'\n case 6: return 'OPCODE_6'\n case 7: return 'OPCODE_7'\n case 8: return 'OPCODE_8'\n case 9: return 'OPCODE_9'\n case 10: return 'OPCODE_10'\n case 11: return 'OPCODE_11'\n case 12: return 'OPCODE_12'\n case 13: return 'OPCODE_13'\n case 14: return 'OPCODE_14'\n case 15: return 'OPCODE_15'\n }\n return 'OPCODE_' + opcode\n}\n\nexports.toOpcode = function (code) {\n switch (code.toUpperCase()) {\n case 'QUERY': return 0\n case 'IQUERY': return 1\n case 'STATUS': return 2\n case 'OPCODE_3': return 3\n case 'NOTIFY': return 4\n case 'UPDATE': return 5\n case 'OPCODE_6': return 6\n case 'OPCODE_7': return 7\n case 'OPCODE_8': return 8\n case 'OPCODE_9': return 9\n case 'OPCODE_10': return 10\n case 'OPCODE_11': return 11\n case 'OPCODE_12': return 12\n case 'OPCODE_13': return 13\n case 'OPCODE_14': return 14\n case 'OPCODE_15': return 15\n }\n return 0\n}\n","'use strict'\n\nexports.toString = function (type) {\n switch (type) {\n // list at\n // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11\n case 1: return 'LLQ'\n case 2: return 'UL'\n case 3: return 'NSID'\n case 5: return 'DAU'\n case 6: return 'DHU'\n case 7: return 'N3U'\n case 8: return 'CLIENT_SUBNET'\n case 9: return 'EXPIRE'\n case 10: return 'COOKIE'\n case 11: return 'TCP_KEEPALIVE'\n case 12: return 'PADDING'\n case 13: return 'CHAIN'\n case 14: return 'KEY_TAG'\n case 26946: return 'DEVICEID'\n }\n if (type < 0) {\n return null\n }\n return `OPTION_${type}`\n}\n\nexports.toCode = function (name) {\n if (typeof name === 'number') {\n return name\n }\n if (!name) {\n return -1\n }\n switch (name.toUpperCase()) {\n case 'OPTION_0': return 0\n case 'LLQ': return 1\n case 'UL': return 2\n case 'NSID': return 3\n case 'OPTION_4': return 4\n case 'DAU': return 5\n case 'DHU': return 6\n case 'N3U': return 7\n case 'CLIENT_SUBNET': return 8\n case 'EXPIRE': return 9\n case 'COOKIE': return 10\n case 'TCP_KEEPALIVE': return 11\n case 'PADDING': return 12\n case 'CHAIN': return 13\n case 'KEY_TAG': return 14\n case 'DEVICEID': return 26946\n case 'OPTION_65535': return 65535\n }\n const m = name.match(/_(\\d+)$/)\n if (m) {\n return parseInt(m[1], 10)\n }\n return -1\n}\n","'use strict'\n\n/*\n * Traditional DNS header RCODEs (4-bits) defined by IANA in\n * https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml\n */\n\nexports.toString = function (rcode) {\n switch (rcode) {\n case 0: return 'NOERROR'\n case 1: return 'FORMERR'\n case 2: return 'SERVFAIL'\n case 3: return 'NXDOMAIN'\n case 4: return 'NOTIMP'\n case 5: return 'REFUSED'\n case 6: return 'YXDOMAIN'\n case 7: return 'YXRRSET'\n case 8: return 'NXRRSET'\n case 9: return 'NOTAUTH'\n case 10: return 'NOTZONE'\n case 11: return 'RCODE_11'\n case 12: return 'RCODE_12'\n case 13: return 'RCODE_13'\n case 14: return 'RCODE_14'\n case 15: return 'RCODE_15'\n }\n return 'RCODE_' + rcode\n}\n\nexports.toRcode = function (code) {\n switch (code.toUpperCase()) {\n case 'NOERROR': return 0\n case 'FORMERR': return 1\n case 'SERVFAIL': return 2\n case 'NXDOMAIN': return 3\n case 'NOTIMP': return 4\n case 'REFUSED': return 5\n case 'YXDOMAIN': return 6\n case 'YXRRSET': return 7\n case 'NXRRSET': return 8\n case 'NOTAUTH': return 9\n case 'NOTZONE': return 10\n case 'RCODE_11': return 11\n case 'RCODE_12': return 12\n case 'RCODE_13': return 13\n case 'RCODE_14': return 14\n case 'RCODE_15': return 15\n }\n return 0\n}\n","'use strict'\n\nexports.toString = function (type) {\n switch (type) {\n case 1: return 'A'\n case 10: return 'NULL'\n case 28: return 'AAAA'\n case 18: return 'AFSDB'\n case 42: return 'APL'\n case 257: return 'CAA'\n case 60: return 'CDNSKEY'\n case 59: return 'CDS'\n case 37: return 'CERT'\n case 5: return 'CNAME'\n case 49: return 'DHCID'\n case 32769: return 'DLV'\n case 39: return 'DNAME'\n case 48: return 'DNSKEY'\n case 43: return 'DS'\n case 55: return 'HIP'\n case 13: return 'HINFO'\n case 45: return 'IPSECKEY'\n case 25: return 'KEY'\n case 36: return 'KX'\n case 29: return 'LOC'\n case 15: return 'MX'\n case 35: return 'NAPTR'\n case 2: return 'NS'\n case 47: return 'NSEC'\n case 50: return 'NSEC3'\n case 51: return 'NSEC3PARAM'\n case 12: return 'PTR'\n case 46: return 'RRSIG'\n case 17: return 'RP'\n case 24: return 'SIG'\n case 6: return 'SOA'\n case 99: return 'SPF'\n case 33: return 'SRV'\n case 44: return 'SSHFP'\n case 32768: return 'TA'\n case 249: return 'TKEY'\n case 52: return 'TLSA'\n case 250: return 'TSIG'\n case 16: return 'TXT'\n case 252: return 'AXFR'\n case 251: return 'IXFR'\n case 41: return 'OPT'\n case 255: return 'ANY'\n }\n return 'UNKNOWN_' + type\n}\n\nexports.toType = function (name) {\n switch (name.toUpperCase()) {\n case 'A': return 1\n case 'NULL': return 10\n case 'AAAA': return 28\n case 'AFSDB': return 18\n case 'APL': return 42\n case 'CAA': return 257\n case 'CDNSKEY': return 60\n case 'CDS': return 59\n case 'CERT': return 37\n case 'CNAME': return 5\n case 'DHCID': return 49\n case 'DLV': return 32769\n case 'DNAME': return 39\n case 'DNSKEY': return 48\n case 'DS': return 43\n case 'HIP': return 55\n case 'HINFO': return 13\n case 'IPSECKEY': return 45\n case 'KEY': return 25\n case 'KX': return 36\n case 'LOC': return 29\n case 'MX': return 15\n case 'NAPTR': return 35\n case 'NS': return 2\n case 'NSEC': return 47\n case 'NSEC3': return 50\n case 'NSEC3PARAM': return 51\n case 'PTR': return 12\n case 'RRSIG': return 46\n case 'RP': return 17\n case 'SIG': return 24\n case 'SOA': return 6\n case 'SPF': return 99\n case 'SRV': return 33\n case 'SSHFP': return 44\n case 'TA': return 32768\n case 'TKEY': return 249\n case 'TLSA': return 52\n case 'TSIG': return 250\n case 'TXT': return 16\n case 'AXFR': return 252\n case 'IXFR': return 251\n case 'OPT': return 41\n case 'ANY': return 255\n case '*': return 255\n }\n if (name.toUpperCase().startsWith('UNKNOWN_')) return parseInt(name.slice(8))\n return 0\n}\n","var Stream = require(\"stream\")\nvar writeMethods = [\"write\", \"end\", \"destroy\"]\nvar readMethods = [\"resume\", \"pause\"]\nvar readEvents = [\"data\", \"close\"]\nvar slice = Array.prototype.slice\n\nmodule.exports = duplex\n\nfunction forEach (arr, fn) {\n if (arr.forEach) {\n return arr.forEach(fn)\n }\n\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i], i)\n }\n}\n\nfunction duplex(writer, reader) {\n var stream = new Stream()\n var ended = false\n\n forEach(writeMethods, proxyWriter)\n\n forEach(readMethods, proxyReader)\n\n forEach(readEvents, proxyStream)\n\n reader.on(\"end\", handleEnd)\n\n writer.on(\"drain\", function() {\n stream.emit(\"drain\")\n })\n\n writer.on(\"error\", reemit)\n reader.on(\"error\", reemit)\n\n stream.writable = writer.writable\n stream.readable = reader.readable\n\n return stream\n\n function proxyWriter(methodName) {\n stream[methodName] = method\n\n function method() {\n return writer[methodName].apply(writer, arguments)\n }\n }\n\n function proxyReader(methodName) {\n stream[methodName] = method\n\n function method() {\n stream.emit(methodName)\n var func = reader[methodName]\n if (func) {\n return func.apply(reader, arguments)\n }\n reader.emit(methodName)\n }\n }\n\n function proxyStream(methodName) {\n reader.on(methodName, reemit)\n\n function reemit() {\n var args = slice.call(arguments)\n args.unshift(methodName)\n stream.emit.apply(stream, args)\n }\n }\n\n function handleEnd() {\n if (ended) {\n return\n }\n ended = true\n var args = slice.call(arguments)\n args.unshift(\"end\")\n stream.emit.apply(stream, args)\n }\n\n function reemit(err) {\n stream.emit(\"error\", err)\n }\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\n/** @type {import('.')} */\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = false;\n\t}\n}\n\nmodule.exports = $defineProperty;\n","'use strict';\n\n/** @type {import('./eval')} */\nmodule.exports = EvalError;\n","'use strict';\n\n/** @type {import('.')} */\nmodule.exports = Error;\n","'use strict';\n\n/** @type {import('./range')} */\nmodule.exports = RangeError;\n","'use strict';\n\n/** @type {import('./ref')} */\nmodule.exports = ReferenceError;\n","'use strict';\n\n/** @type {import('./syntax')} */\nmodule.exports = SyntaxError;\n","'use strict';\n\n/** @type {import('./type')} */\nmodule.exports = TypeError;\n","'use strict';\n\n/** @type {import('./uri')} */\nmodule.exports = URIError;\n","//filter will reemit the data if cb(err,pass) pass is truthy\n\n// reduce is more tricky\n// maybe we want to group the reductions or emit progress updates occasionally\n// the most basic reduce just emits one 'data' event after it has recieved 'end'\n\nvar Stream = require('stream').Stream\n , es = exports\n , through = require('through')\n , from = require('from')\n , duplex = require('duplexer')\n , map = require('map-stream')\n , pause = require('pause-stream')\n , split = require('split')\n , pipeline = require('stream-combiner')\n , immediately = global.setImmediate || process.nextTick;\n\nes.Stream = Stream //re-export Stream from core\nes.through = through\nes.from = from\nes.duplex = duplex\nes.map = map\nes.pause = pause\nes.split = split\nes.pipeline = es.connect = es.pipe = pipeline\n// merge / concat\n//\n// combine multiple streams into a single stream.\n// will emit end only once\n\nes.concat = //actually this should be called concat\nes.merge = function (/*streams...*/) {\n var toMerge = [].slice.call(arguments)\n if (toMerge.length === 1 && (toMerge[0] instanceof Array)) {\n toMerge = toMerge[0] //handle array as arguments object\n }\n var stream = new Stream()\n stream.setMaxListeners(0) // allow adding more than 11 streams\n var endCount = 0\n stream.writable = stream.readable = true\n\n if (toMerge.length) {\n toMerge.forEach(function (e) {\n e.pipe(stream, {end: false})\n var ended = false\n e.on('end', function () {\n if(ended) return\n ended = true\n endCount ++\n if(endCount == toMerge.length)\n stream.emit('end')\n })\n })\n } else {\n process.nextTick(function () {\n stream.emit('end')\n })\n }\n \n stream.write = function (data) {\n this.emit('data', data)\n }\n stream.destroy = function () {\n toMerge.forEach(function (e) {\n if(e.destroy) e.destroy()\n })\n }\n return stream\n}\n\n\n// writable stream, collects all events into an array\n// and calls back when 'end' occurs\n// mainly I'm using this to test the other functions\n\nes.collect =\nes.writeArray = function (done) {\n if ('function' !== typeof done)\n throw new Error('function writeArray (done): done must be function')\n\n var a = new Stream ()\n , array = [], isDone = false\n a.write = function (l) {\n array.push(l)\n }\n a.end = function () {\n isDone = true\n done(null, array)\n }\n a.writable = true\n a.readable = false\n a.destroy = function () {\n a.writable = a.readable = false\n if(isDone) return\n done(new Error('destroyed before end'), array)\n }\n return a\n}\n\n//return a Stream that reads the properties of an object\n//respecting pause() and resume()\n\nes.readArray = function (array) {\n var stream = new Stream()\n , i = 0\n , paused = false\n , ended = false\n\n stream.readable = true\n stream.writable = false\n\n if(!Array.isArray(array))\n throw new Error('event-stream.read expects an array')\n\n stream.resume = function () {\n if(ended) return\n paused = false\n var l = array.length\n while(i < l && !paused && !ended) {\n stream.emit('data', array[i++])\n }\n if(i == l && !ended)\n ended = true, stream.readable = false, stream.emit('end')\n }\n process.nextTick(stream.resume)\n stream.pause = function () {\n paused = true\n }\n stream.destroy = function () {\n ended = true\n stream.emit('close')\n }\n return stream\n}\n\n//\n// readable (asyncFunction)\n// return a stream that calls an async function while the stream is not paused.\n//\n// the function must take: (count, callback) {...\n//\n\nes.readable =\nfunction (func, continueOnError) {\n var stream = new Stream()\n , i = 0\n , paused = false\n , ended = false\n , reading = false\n\n stream.readable = true\n stream.writable = false\n\n if('function' !== typeof func)\n throw new Error('event-stream.readable expects async function')\n\n stream.on('end', function () { ended = true })\n\n function get (err, data) {\n\n if(err) {\n stream.emit('error', err)\n if(!continueOnError) stream.emit('end')\n } else if (arguments.length > 1)\n stream.emit('data', data)\n\n immediately(function () {\n if(ended || paused || reading) return\n try {\n reading = true\n func.call(stream, i++, function () {\n reading = false\n get.apply(null, arguments)\n })\n } catch (err) {\n stream.emit('error', err)\n }\n })\n }\n stream.resume = function () {\n paused = false\n get()\n }\n process.nextTick(get)\n stream.pause = function () {\n paused = true\n }\n stream.destroy = function () {\n stream.emit('end')\n stream.emit('close')\n ended = true\n }\n return stream\n}\n\n\n//\n// map sync\n//\n\nes.mapSync = function (sync) {\n return es.through(function write(data) {\n var mappedData\n try {\n mappedData = sync(data)\n } catch (err) {\n return this.emit('error', err)\n }\n if (mappedData !== undefined)\n this.emit('data', mappedData)\n })\n}\n\n//\n// filterSync\n//\n\nes.filterSync = function (test) {\n return es.through(function(data){\n var s = this\n if (test(data)) {\n s.queue(data)\n }\n });\n}\n\n//\n// flatmapSync\n//\n\nes.flatmapSync = function (mapper) {\n return es.through(function(data) {\n var s = this\n data.forEach(function(e) {\n s.queue(mapper(e))\n })\n })\n}\n\n//\n// log just print out what is coming through the stream, for debugging\n//\n\nes.log = function (name) {\n return es.through(function (data) {\n var args = [].slice.call(arguments)\n if(name) console.error(name, data)\n else console.error(data)\n this.emit('data', data)\n })\n}\n\n\n//\n// child -- pipe through a child process\n//\n\nes.child = function (child) {\n\n return es.duplex(child.stdin, child.stdout)\n\n}\n\n//\n// parse\n//\n// must be used after es.split() to ensure that each chunk represents a line\n// source.pipe(es.split()).pipe(es.parse())\n\nes.parse = function (options) {\n var emitError = !!(options ? options.error : false)\n return es.through(function (data) {\n var obj\n try {\n if(data) //ignore empty lines\n obj = JSON.parse(data.toString())\n } catch (err) {\n if (emitError)\n return this.emit('error', err)\n return console.error(err, 'attempting to parse:', data)\n }\n //ignore lines that where only whitespace.\n if(obj !== undefined)\n this.emit('data', obj)\n })\n}\n//\n// stringify\n//\n\nes.stringify = function () {\n var Buffer = require('buffer').Buffer\n return es.mapSync(function (e){\n return JSON.stringify(Buffer.isBuffer(e) ? e.toString() : e) + '\\n'\n })\n}\n\n//\n// replace a string within a stream.\n//\n// warn: just concatenates the string and then does str.split().join().\n// probably not optimal.\n// for smallish responses, who cares?\n// I need this for shadow-npm so it's only relatively small json files.\n\nes.replace = function (from, to) {\n return es.pipeline(es.split(from), es.join(to))\n}\n\n//\n// join chunks with a joiner. just like Array#join\n// also accepts a callback that is passed the chunks appended together\n// this is still supported for legacy reasons.\n//\n\nes.join = function (str) {\n\n //legacy api\n if('function' === typeof str)\n return es.wait(str)\n\n var first = true\n return es.through(function (data) {\n if(!first)\n this.emit('data', str)\n first = false\n this.emit('data', data)\n return true\n })\n}\n\n\n//\n// wait. callback when 'end' is emitted, with all chunks appended as string.\n//\n\nes.wait = function (callback) {\n var arr = []\n return es.through(function (data) { arr.push(data) },\n function () {\n var body = Buffer.isBuffer(arr[0]) ? Buffer.concat(arr)\n : arr.join('')\n this.emit('data', body)\n this.emit('end')\n if(callback) callback(null, body)\n })\n}\n\nes.pipeable = function () {\n throw new Error('[EVENT-STREAM] es.pipeable is deprecated')\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/*\n * Basic JavaScript BN library - subset useful for RSA encryption.\n *\n * Copyright (c) 2003-2005 Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n\n/*\n *\n * Copyright (c) 2015 Zarmack Tanen\n * Fixed .toString(16) to be compatible with node >0.12.7 because hexWrite()\n * only accepts %2=0 strings\n *\n *\n * Added Node.js Buffers support\n * 2014 rzcoder\n */\n\nvar crypt = require('crypto');\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n\n// (public) Constructor\nfunction BigInteger(a, b) {\n if (a != null) {\n if (\"number\" == typeof a) {\n this.fromNumber(a, b);\n } else if (Buffer.isBuffer(a)) {\n this.fromBuffer(a);\n } else if (b == null && \"string\" != typeof a) {\n this.fromByteArray(a);\n } else {\n this.fromString(a, b);\n }\n }\n}\n\n// return new, unset BigInteger\nfunction nbi() {\n return new BigInteger(null);\n}\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff, xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff, xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n}\n\n// We need to select the fastest one that works in this environment.\n//if (j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n//\tBigInteger.prototype.am = am2;\n//\tdbits = 30;\n//} else if (j_lm && (navigator.appName != \"Netscape\")) {\n//\tBigInteger.prototype.am = am1;\n//\tdbits = 26;\n//} else { // Mozilla/Netscape seems to prefer am3\n//\tBigInteger.prototype.am = am3;\n//\tdbits = 28;\n//}\n\n// For node.js, we pick am3 with max dbits to 28.\nBigInteger.prototype.am = am3;\ndbits = 28;\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1 << dbits) - 1);\nBigInteger.prototype.DV = (1 << dbits);\n\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nvar BI_RC = new Array();\nvar rr, vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\n\nfunction int2char(n) {\n return BI_RM.charAt(n);\n}\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c == null) ? -1 : c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];\n r.t = this.t;\n r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = (x < 0) ? -1 : 0;\n if (x > 0) this[0] = x;\n else if (x < -1) this[0] = x + DV;\n else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(data, radix, unsigned) {\n var k;\n switch (radix) {\n case 2:\n k = 1;\n break;\n case 4:\n k = 2;\n break;\n case 8:\n k = 3;\n break;\n case 16:\n k = 4;\n break;\n case 32:\n k = 5;\n break;\n case 256:\n k = 8;\n break;\n default:\n this.fromRadix(data, radix);\n return;\n }\n\n this.t = 0;\n this.s = 0;\n\n var i = data.length;\n var mi = false;\n var sh = 0;\n\n while (--i >= 0) {\n var x = (k == 8) ? data[i] & 0xff : intAt(data, i);\n if (x < 0) {\n if (data.charAt(i) == \"-\") mi = true;\n continue;\n }\n mi = false;\n if (sh === 0)\n this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n }\n else\n this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n if ((!unsigned) && k == 8 && (data[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n}\n\nfunction bnpFromByteArray(a, unsigned) {\n this.fromString(a, 256, unsigned)\n}\n\nfunction bnpFromBuffer(a) {\n this.fromString(a, 256, true)\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c) --this.t;\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n //! Fix to be compatible with node >0.12.7 Buffer.js\n if(b == 16 && r.length % 2 != 0)\n\t r = \"0\" + r;\n return m ? r : \"0\";\n}\n\n// (public) -this\nfunction bnNegate() {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n}\n\n// (public) |this|\nfunction bnAbs() {\n return (this.s < 0) ? this.negate() : this;\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s - a.s;\n if (r != 0) return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0) return (this.s < 0) ? -r : r;\n while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r;\n return 0;\n}\n\nfunction bnEqual(a) {\n console.log(this.compareTo(a));\n return (this.compareTo(a) == 0) ? true: false;\n}\n\nfunction bnGreater(a) {\n return (this.compareTo(a) > 0) ? true : false;\n}\n\nfunction bnGreaterOrEqual(a) {\n return (this.compareTo(a) >= 0) ? true : false;\n}\n\nfunction bnLesser(a) {\n return (this.compareTo(a) < 0) ? true : false;\n}\n\nfunction bnLesserOrEqual(a) {\n return (this.compareTo(a) <= 0) ? true : false;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1, t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if (this.t <= 0) return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];\n for (i = n - 1; i >= 0; --i) r[i] = 0;\n r.t = this.t + n;\n r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) r[i - n] = this[i];\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (i = ds - 1; i >= 0; --i) r[i] = 0;\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n var i = 0, c = 0, m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c < -1) r[i++] = this.DV + c;\n else if (c > 0) r[i++] = c;\n r.t = i;\n r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(), y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0) r[i] = 0;\n for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n r.s = 0;\n r.clamp();\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n while (--i >= 0) r[i] = 0;\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) return;\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0);\n if (r != null) this.copyTo(r);\n return;\n }\n if (r == null) r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]);\t// normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n }\n else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 === 0) return;\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;\n var i = r.t, j = i - ys, t = (q == null) ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y);\t// \"negative\" y so we can replace sub with am later\n while (y.t < ys) y[y.t++] = 0;\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\t// Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd) r.subTo(t, r);\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) BigInteger.ZERO.subTo(q, q);\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0) r.rShiftTo(nsh, r);\t// Denormalize remainder\n if (ts < 0) BigInteger.ZERO.subTo(r, r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n return r;\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) {\n this.m = m;\n}\nfunction cConvert(x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n else return x;\n}\nfunction cRevert(x) {\n return x;\n}\nfunction cReduce(x) {\n x.divRemTo(this.m, null, x);\n}\nfunction cMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\nfunction cSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n}\n\nClassic.prototype.convert = cConvert;\nClassic.prototype.revert = cRevert;\nClassic.prototype.reduce = cReduce;\nClassic.prototype.mulTo = cMulTo;\nClassic.prototype.sqrTo = cSqrTo;\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if (this.t < 1) return 0;\n var x = this[0];\n if ((x & 1) === 0) return 0;\n var y = x & 3;\t\t// y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf;\t// y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff;\t// y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff;\t// y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV;\t\t// y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while (x.t <= this.mt2)\t// pad x so am has enough room later\n x[x.t++] = 0;\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (protected) true iff this is even\nfunction bnpIsEven() {\n return ((this.t > 0) ? (this[0] & 1) : this.s) === 0;\n}\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e, z) {\n if (e > 0xffffffff || e < 1) return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0) z.mulTo(r2, g, r);\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e, m) {\n var z;\n if (e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);\n return this.exp(e, z);\n}\n\n// Copyright (c) 2005-2009 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n\n// Extended JavaScript BN functions, required for RSA private ops.\n\n// Version 1.1: new BigInteger(\"0\", 10) returns \"proper\" zero\n// Version 1.2: square() API, isProbablePrime fix\n\n//(public)\nfunction bnClone() {\n var r = nbi();\n this.copyTo(r);\n return r;\n}\n\n//(public) return value as integer\nfunction bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;\n else if (this.t === 0) return -1;\n }\n else if (this.t == 1) return this[0];\n else if (this.t === 0) return 0;\n// assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n}\n\n//(public) return value as byte\nfunction bnByteValue() {\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\n}\n\n//(public) return value as short (assumes DB>=16)\nfunction bnShortValue() {\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\n}\n\n//(protected) return x s.t. r^x < DV\nfunction bnpChunkSize(r) {\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\n}\n\n//(public) 0 if this === 0, 1 if this > 0\nfunction bnSigNum() {\n if (this.s < 0) return -1;\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;\n else return 1;\n}\n\n//(protected) convert to radix string\nfunction bnpToRadix(b) {\n if (b == null) b = 10;\n if (this.signum() === 0 || b < 2 || b > 36) return \"0\";\n var cs = this.chunkSize(b);\n var a = Math.pow(b, cs);\n var d = nbv(a), y = nbi(), z = nbi(), r = \"\";\n this.divRemTo(d, y, z);\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d, y, z);\n }\n return z.intValue().toString(b) + r;\n}\n\n//(protected) convert from radix string\nfunction bnpFromRadix(s, b) {\n this.fromInt(0);\n if (b == null) b = 10;\n var cs = this.chunkSize(b);\n var d = Math.pow(b, cs), mi = false, j = 0, w = 0;\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\" && this.signum() === 0) mi = true;\n continue;\n }\n w = b * w + x;\n if (++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w, 0);\n j = 0;\n w = 0;\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j));\n this.dAddOffset(w, 0);\n }\n if (mi) BigInteger.ZERO.subTo(this, this);\n}\n\n//(protected) alternate constructor\nfunction bnpFromNumber(a, b) {\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) this.fromInt(1);\n else {\n this.fromNumber(a);\n if (!this.testBit(a - 1))\t// force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n if (this.isEven()) this.dAddOffset(1, 0); // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0);\n if (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n }\n }\n } else {\n // new BigInteger(int,RNG)\n var x = crypt.randomBytes((a >> 3) + 1)\n var t = a & 7;\n\n if (t > 0)\n x[0] &= ((1 << t) - 1);\n else\n x[0] = 0;\n\n this.fromByteArray(x);\n }\n}\n\n//(public) convert to bigendian byte array\nfunction bnToByteArray() {\n var i = this.t, r = new Array();\n r[0] = this.s;\n var p = this.DB - (i * this.DB) % 8, d, k = 0;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p)\n r[k++] = d | (this.s << (this.DB - p));\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\n d |= this[--i] >> (p += this.DB - 8);\n }\n else {\n d = (this[i] >> (p -= 8)) & 0xff;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if ((d & 0x80) != 0) d |= -256;\n if (k === 0 && (this.s & 0x80) != (d & 0x80)) ++k;\n if (k > 0 || d != this.s) r[k++] = d;\n }\n }\n return r;\n}\n\n/**\n * return Buffer object\n * @param trim {boolean} slice buffer if first element == 0\n * @returns {Buffer}\n */\nfunction bnToBuffer(trimOrSize) {\n var res = Buffer.from(this.toByteArray());\n if (trimOrSize === true && res[0] === 0) {\n res = res.slice(1);\n } else if (typeof trimOrSize == 'number') {\n if (res.length > trimOrSize) {\n for (var i = 0; i < res.length - trimOrSize; i++) {\n if (res[i] !== 0) {\n return null;\n }\n }\n return res.slice(res.length - trimOrSize);\n } else if (res.length < trimOrSize) {\n var padded = Buffer.alloc(trimOrSize);\n padded.fill(0, 0, trimOrSize - res.length);\n res.copy(padded, trimOrSize - res.length);\n return padded;\n }\n }\n return res;\n}\n\nfunction bnEquals(a) {\n return (this.compareTo(a) == 0);\n}\nfunction bnMin(a) {\n return (this.compareTo(a) < 0) ? this : a;\n}\nfunction bnMax(a) {\n return (this.compareTo(a) > 0) ? this : a;\n}\n\n//(protected) r = this op a (bitwise)\nfunction bnpBitwiseTo(a, op, r) {\n var i, f, m = Math.min(a.t, this.t);\n for (i = 0; i < m; ++i) r[i] = op(this[i], a[i]);\n if (a.t < this.t) {\n f = a.s & this.DM;\n for (i = m; i < this.t; ++i) r[i] = op(this[i], f);\n r.t = this.t;\n }\n else {\n f = this.s & this.DM;\n for (i = m; i < a.t; ++i) r[i] = op(f, a[i]);\n r.t = a.t;\n }\n r.s = op(this.s, a.s);\n r.clamp();\n}\n\n//(public) this & a\nfunction op_and(x, y) {\n return x & y;\n}\nfunction bnAnd(a) {\n var r = nbi();\n this.bitwiseTo(a, op_and, r);\n return r;\n}\n\n//(public) this | a\nfunction op_or(x, y) {\n return x | y;\n}\nfunction bnOr(a) {\n var r = nbi();\n this.bitwiseTo(a, op_or, r);\n return r;\n}\n\n//(public) this ^ a\nfunction op_xor(x, y) {\n return x ^ y;\n}\nfunction bnXor(a) {\n var r = nbi();\n this.bitwiseTo(a, op_xor, r);\n return r;\n}\n\n//(public) this & ~a\nfunction op_andnot(x, y) {\n return x & ~y;\n}\nfunction bnAndNot(a) {\n var r = nbi();\n this.bitwiseTo(a, op_andnot, r);\n return r;\n}\n\n//(public) ~this\nfunction bnNot() {\n var r = nbi();\n for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i];\n r.t = this.t;\n r.s = ~this.s;\n return r;\n}\n\n//(public) this << n\nfunction bnShiftLeft(n) {\n var r = nbi();\n if (n < 0) this.rShiftTo(-n, r); else this.lShiftTo(n, r);\n return r;\n}\n\n//(public) this >> n\nfunction bnShiftRight(n) {\n var r = nbi();\n if (n < 0) this.lShiftTo(-n, r); else this.rShiftTo(n, r);\n return r;\n}\n\n//return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\n if (x === 0) return -1;\n var r = 0;\n if ((x & 0xffff) === 0) {\n x >>= 16;\n r += 16;\n }\n if ((x & 0xff) === 0) {\n x >>= 8;\n r += 8;\n }\n if ((x & 0xf) === 0) {\n x >>= 4;\n r += 4;\n }\n if ((x & 3) === 0) {\n x >>= 2;\n r += 2;\n }\n if ((x & 1) === 0) ++r;\n return r;\n}\n\n//(public) returns index of lowest 1-bit (or -1 if none)\nfunction bnGetLowestSetBit() {\n for (var i = 0; i < this.t; ++i)\n if (this[i] != 0) return i * this.DB + lbit(this[i]);\n if (this.s < 0) return this.t * this.DB;\n return -1;\n}\n\n//return number of 1 bits in x\nfunction cbit(x) {\n var r = 0;\n while (x != 0) {\n x &= x - 1;\n ++r;\n }\n return r;\n}\n\n//(public) return number of set bits\nfunction bnBitCount() {\n var r = 0, x = this.s & this.DM;\n for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x);\n return r;\n}\n\n//(public) true iff nth bit is set\nfunction bnTestBit(n) {\n var j = Math.floor(n / this.DB);\n if (j >= this.t) return (this.s != 0);\n return ((this[j] & (1 << (n % this.DB))) != 0);\n}\n\n//(protected) this op (1<>= this.DB;\n }\n if (a.t < this.t) {\n c += a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c > 0) r[i++] = c;\n else if (c < -1) r[i++] = this.DV + c;\n r.t = i;\n r.clamp();\n}\n\n//(public) this + a\nfunction bnAdd(a) {\n var r = nbi();\n this.addTo(a, r);\n return r;\n}\n\n//(public) this - a\nfunction bnSubtract(a) {\n var r = nbi();\n this.subTo(a, r);\n return r;\n}\n\n//(public) this * a\nfunction bnMultiply(a) {\n var r = nbi();\n this.multiplyTo(a, r);\n return r;\n}\n\n// (public) this^2\nfunction bnSquare() {\n var r = nbi();\n this.squareTo(r);\n return r;\n}\n\n//(public) this / a\nfunction bnDivide(a) {\n var r = nbi();\n this.divRemTo(a, r, null);\n return r;\n}\n\n//(public) this % a\nfunction bnRemainder(a) {\n var r = nbi();\n this.divRemTo(a, null, r);\n return r;\n}\n\n//(public) [this/a,this%a]\nfunction bnDivideAndRemainder(a) {\n var q = nbi(), r = nbi();\n this.divRemTo(a, q, r);\n return new Array(q, r);\n}\n\n//(protected) this *= n, this >= 0, 1 < n < DV\nfunction bnpDMultiply(n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n ++this.t;\n this.clamp();\n}\n\n//(protected) this += n << w words, this >= 0\nfunction bnpDAddOffset(n, w) {\n if (n === 0) return;\n while (this.t <= w) this[this.t++] = 0;\n this[w] += n;\n while (this[w] >= this.DV) {\n this[w] -= this.DV;\n if (++w >= this.t) this[this.t++] = 0;\n ++this[w];\n }\n}\n\n//A \"null\" reducer\nfunction NullExp() {\n}\nfunction nNop(x) {\n return x;\n}\nfunction nMulTo(x, y, r) {\n x.multiplyTo(y, r);\n}\nfunction nSqrTo(x, r) {\n x.squareTo(r);\n}\n\nNullExp.prototype.convert = nNop;\nNullExp.prototype.revert = nNop;\nNullExp.prototype.mulTo = nMulTo;\nNullExp.prototype.sqrTo = nSqrTo;\n\n//(public) this^e\nfunction bnPow(e) {\n return this.exp(e, new NullExp());\n}\n\n//(protected) r = lower n words of \"this * a\", a.t <= n\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyLowerTo(a, n, r) {\n var i = Math.min(this.t + a.t, n);\n r.s = 0; // assumes a,this >= 0\n r.t = i;\n while (i > 0) r[--i] = 0;\n var j;\n for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i);\n r.clamp();\n}\n\n//(protected) r = \"this * a\" without lower n words, n > 0\n//\"this\" should be the larger one if appropriate.\nfunction bnpMultiplyUpperTo(a, n, r) {\n --n;\n var i = r.t = this.t + a.t - n;\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0) r[i] = 0;\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n r.clamp();\n r.drShiftTo(1, r);\n}\n\n//Barrett modular reduction\nfunction Barrett(m) {\n// setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n this.mu = this.r2.divide(m);\n this.m = m;\n}\n\nfunction barrettConvert(x) {\n if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m);\n else if (x.compareTo(this.m) < 0) return x;\n else {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n}\n\nfunction barrettRevert(x) {\n return x;\n}\n\n//x = x mod m (HAC 14.42)\nfunction barrettReduce(x) {\n x.drShiftTo(this.m.t - 1, this.r2);\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1;\n x.clamp();\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1);\n x.subTo(this.r2, x);\n while (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n//r = x^2 mod m; x != r\nfunction barrettSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n}\n\n//r = x*y mod m; x,y != r\nfunction barrettMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\n\nBarrett.prototype.convert = barrettConvert;\nBarrett.prototype.revert = barrettRevert;\nBarrett.prototype.reduce = barrettReduce;\nBarrett.prototype.mulTo = barrettMulTo;\nBarrett.prototype.sqrTo = barrettSqrTo;\n\n//(public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if (i <= 0) return r;\n else if (i < 18) k = 1;\n else if (i < 48) k = 3;\n else if (i < 144) k = 4;\n else if (i < 768) k = 5;\n else k = 6;\n if (i < 8)\n z = new Classic(m);\n else if (m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n\n// precomputation\n var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\n g[1] = z.convert(this);\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n\n var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km;\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0) w |= e[j - 1] >> (this.DB + i - k1);\n }\n\n n = k;\n while ((w & 1) === 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) {\t// ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0) z.sqrTo(r, r2); else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n\n while (j >= 0 && (e[j] & (1 << i)) === 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n}\n\n//(public) gcd(this,a) (HAC 14.54)\nfunction bnGCD(a) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit(), g = y.getLowestSetBit();\n if (g < 0) return x;\n if (i < g) g = i;\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x);\n if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y);\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n }\n if (g > 0) y.lShiftTo(g, y);\n return y;\n}\n\n//(protected) this % n, n < 2^26\nfunction bnpModInt(n) {\n if (n <= 0) return 0;\n var d = this.DV % n, r = (this.s < 0) ? n - 1 : 0;\n if (this.t > 0)\n if (d === 0) r = this[0] % n;\n else for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n;\n return r;\n}\n\n//(public) 1/this % m (HAC 14.61)\nfunction bnModInverse(m) {\n var ac = m.isEven();\n if ((this.isEven() && ac) || m.signum() === 0) return BigInteger.ZERO;\n var u = m.clone(), v = this.clone();\n var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u);\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a);\n b.subTo(m, b);\n }\n a.rShiftTo(1, a);\n }\n else if (!b.isEven()) b.subTo(m, b);\n b.rShiftTo(1, b);\n }\n while (v.isEven()) {\n v.rShiftTo(1, v);\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c);\n d.subTo(m, d);\n }\n c.rShiftTo(1, c);\n }\n else if (!d.isEven()) d.subTo(m, d);\n d.rShiftTo(1, d);\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u);\n if (ac) a.subTo(c, a);\n b.subTo(d, b);\n }\n else {\n v.subTo(u, v);\n if (ac) c.subTo(a, c);\n d.subTo(b, d);\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;\n if (d.compareTo(m) >= 0) return d.subtract(m);\n if (d.signum() < 0) d.addTo(m, d); else return d;\n if (d.signum() < 0) return d.add(m); else return d;\n}\n\nvar lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n\n//(public) test primality with certainty >= 1-.5^t\nfunction bnIsProbablePrime(t) {\n var i, x = this.abs();\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i)\n if (x[0] == lowprimes[i]) return true;\n return false;\n }\n if (x.isEven()) return false;\n i = 1;\n while (i < lowprimes.length) {\n var m = lowprimes[i], j = i + 1;\n while (j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while (i < j) if (m % lowprimes[i++] === 0) return false;\n }\n return x.millerRabin(t);\n}\n\n//(protected) true if probably prime (HAC 4.24, Miller-Rabin)\nfunction bnpMillerRabin(t) {\n var n1 = this.subtract(BigInteger.ONE);\n var k = n1.getLowestSetBit();\n if (k <= 0) return false;\n var r = n1.shiftRight(k);\n t = (t + 1) >> 1;\n if (t > lowprimes.length) t = lowprimes.length;\n var a = nbi();\n for (var i = 0; i < t; ++i) {\n //Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n var y = a.modPow(r, this);\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this);\n if (y.compareTo(BigInteger.ONE) === 0) return false;\n }\n if (y.compareTo(n1) != 0) return false;\n }\n }\n return true;\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.fromByteArray = bnpFromByteArray;\nBigInteger.prototype.fromBuffer = bnpFromBuffer;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.isEven = bnpIsEven;\nBigInteger.prototype.exp = bnpExp;\n\nBigInteger.prototype.chunkSize = bnpChunkSize;\nBigInteger.prototype.toRadix = bnpToRadix;\nBigInteger.prototype.fromRadix = bnpFromRadix;\nBigInteger.prototype.fromNumber = bnpFromNumber;\nBigInteger.prototype.bitwiseTo = bnpBitwiseTo;\nBigInteger.prototype.changeBit = bnpChangeBit;\nBigInteger.prototype.addTo = bnpAddTo;\nBigInteger.prototype.dMultiply = bnpDMultiply;\nBigInteger.prototype.dAddOffset = bnpDAddOffset;\nBigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\nBigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\nBigInteger.prototype.modInt = bnpModInt;\nBigInteger.prototype.millerRabin = bnpMillerRabin;\n\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.modPowInt = bnModPowInt;\n\nBigInteger.prototype.clone = bnClone;\nBigInteger.prototype.intValue = bnIntValue;\nBigInteger.prototype.byteValue = bnByteValue;\nBigInteger.prototype.shortValue = bnShortValue;\nBigInteger.prototype.signum = bnSigNum;\nBigInteger.prototype.toByteArray = bnToByteArray;\nBigInteger.prototype.toBuffer = bnToBuffer;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.eq = bnEqual;\nBigInteger.prototype.gt = bnGreater;\nBigInteger.prototype.gte = bnGreaterOrEqual;\nBigInteger.prototype.lt = bnLesser;\nBigInteger.prototype.lte = bnLesserOrEqual;\nBigInteger.prototype.min = bnMin;\nBigInteger.prototype.max = bnMax;\nBigInteger.prototype.and = bnAnd;\nBigInteger.prototype.or = bnOr;\nBigInteger.prototype.xor = bnXor;\nBigInteger.prototype.andNot = bnAndNot;\nBigInteger.prototype.not = bnNot;\nBigInteger.prototype.shiftLeft = bnShiftLeft;\nBigInteger.prototype.shiftRight = bnShiftRight;\nBigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\nBigInteger.prototype.bitCount = bnBitCount;\nBigInteger.prototype.testBit = bnTestBit;\nBigInteger.prototype.setBit = bnSetBit;\nBigInteger.prototype.clearBit = bnClearBit;\nBigInteger.prototype.flipBit = bnFlipBit;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.remainder = bnRemainder;\nBigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\nBigInteger.prototype.modPow = bnModPow;\nBigInteger.prototype.modInverse = bnModInverse;\nBigInteger.prototype.pow = bnPow;\nBigInteger.prototype.gcd = bnGCD;\nBigInteger.prototype.isProbablePrime = bnIsProbablePrime;\nBigInteger.int2char = int2char;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\n// JSBN-specific extension\nBigInteger.prototype.square = bnSquare;\n\n//BigInteger interfaces not implemented in jsbn:\n\n//BigInteger(int signum, byte[] magnitude)\n//double doubleValue()\n//float floatValue()\n//int hashCode()\n//long longValue()\n//static BigInteger valueOf(long val)\n\nmodule.exports = BigInteger;\n","\"use strict\";\n/**\n * SRP Group Parameters\n * http://tools.ietf.org/html/rfc5054#appendix-A\n *\n * The 1024-, 1536-, and 2048-bit groups are taken from software\n * developed by Tom Wu and Eugene Jhong for the Stanford SRP\n * distribution, and subsequently proven to be prime. The larger primes\n * are taken from [MODP], but generators have been calculated that are\n * primitive roots of N, unlike the generators in [MODP].\n *\n * The 1024-bit and 1536-bit groups MUST be supported.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.params = exports.hex = void 0;\n// since these are meant to be used internally, all values are numbers. If\n// you want to add parameter sets, you'll need to convert them to bignums.\nconst BigInteger = require(\"../jsbn/jsbn\");\nfunction hex(s) {\n return new BigInteger(s.split(/\\s|\\n/).join(\"\"), 16);\n}\nexports.hex = hex;\nexports.params = {\n 1024: {\n N_length_bits: 1024,\n N: hex(`\n EEAF0AB9 ADB38DD6 9C33F80A FA8FC5E8 60726187 75FF3C0B 9EA2314C\n 9C256576 D674DF74 96EA81D3 383B4813 D692C6E0 E0D5D8E2 50B98BE4\n 8E495C1D 6089DAD1 5DC7D7B4 6154D6B6 CE8EF4AD 69B15D49 82559B29\n 7BCF1885 C529F566 660E57EC 68EDBC3C 05726CC0 2FD4CBF4 976EAA9A\n FD5138FE 8376435B 9FC61D2F C0EB06E3\n `),\n g: hex(\"02\"),\n hash: \"sha1\",\n },\n 1536: {\n N_length_bits: 1536,\n N: hex(`\n 9DEF3CAF B939277A B1F12A86 17A47BBB DBA51DF4 99AC4C80 BEEEA961\n 4B19CC4D 5F4F5F55 6E27CBDE 51C6A94B E4607A29 1558903B A0D0F843\n 80B655BB 9A22E8DC DF028A7C EC67F0D0 8134B1C8 B9798914 9B609E0B\n E3BAB63D 47548381 DBC5B1FC 764E3F4B 53DD9DA1 158BFD3E 2B9C8CF5\n 6EDF0195 39349627 DB2FD53D 24B7C486 65772E43 7D6C7F8C E442734A\n F7CCB7AE 837C264A E3A9BEB8 7F8A2FE9 B8B5292E 5A021FFF 5E91479E\n 8CE7A28C 2442C6F3 15180F93 499A234D CF76E3FE D135F9BB\n `),\n g: hex(\"02\"),\n hash: \"sha1\",\n },\n 2048: {\n N_length_bits: 2048,\n N: hex(`\n AC6BDB41 324A9A9B F166DE5E 1389582F AF72B665 1987EE07 FC319294\n 3DB56050 A37329CB B4A099ED 8193E075 7767A13D D52312AB 4B03310D\n CD7F48A9 DA04FD50 E8083969 EDB767B0 CF609517 9A163AB3 661A05FB\n D5FAAAE8 2918A996 2F0B93B8 55F97993 EC975EEA A80D740A DBF4FF74\n 7359D041 D5C33EA7 1D281E44 6B14773B CA97B43A 23FB8016 76BD207A\n 436C6481 F1D2B907 8717461A 5B9D32E6 88F87748 544523B5 24B0D57D\n 5EA77A27 75D2ECFA 032CFBDB F52FB378 61602790 04E57AE6 AF874E73\n 03CE5329 9CCC041C 7BC308D8 2A5698F3 A8D0C382 71AE35F8 E9DBFBB6\n 94B5C803 D89F7AE4 35DE236D 525F5475 9B65E372 FCD68EF2 0FA7111F\n 9E4AFF73\n `),\n g: hex(\"02\"),\n hash: \"sha256\",\n },\n 3072: {\n N_length_bits: 3072,\n N: hex(`\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n `),\n g: hex(\"05\"),\n hash: \"sha256\",\n },\n hap: {\n N_length_bits: 3072,\n N: hex(`\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A93AD2CA FFFFFFFF FFFFFFFF\n `),\n g: hex(\"05\"),\n hash: \"sha512\",\n },\n 4096: {\n N_length_bits: 4096,\n N: hex(`\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34063199\n FFFFFFFF FFFFFFFF\n `),\n g: hex(\"05\"),\n hash: \"sha256\",\n },\n 6244: {\n N_length_bits: 6244,\n N: hex(`\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DCC4024 FFFFFFFF FFFFFFFF\n `),\n g: hex(\"05\"),\n hash: \"sha256\",\n },\n 8192: {\n N_length_bits: 8192,\n N: hex(`\n FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08\n 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B\n 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9\n A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6\n 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8\n FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D\n 670C354E 4ABC9804 F1746C08 CA18217C 32905E46 2E36CE3B E39E772C\n 180E8603 9B2783A2 EC07A28F B5C55DF0 6F4C52C9 DE2BCBF6 95581718\n 3995497C EA956AE5 15D22618 98FA0510 15728E5A 8AAAC42D AD33170D\n 04507A33 A85521AB DF1CBA64 ECFB8504 58DBEF0A 8AEA7157 5D060C7D\n B3970F85 A6E1E4C7 ABF5AE8C DB0933D7 1E8C94E0 4A25619D CEE3D226\n 1AD2EE6B F12FFA06 D98A0864 D8760273 3EC86A64 521F2B18 177B200C\n BBE11757 7A615D6C 770988C0 BAD946E2 08E24FA0 74E5AB31 43DB5BFC\n E0FD108E 4B82D120 A9210801 1A723C12 A787E6D7 88719A10 BDBA5B26\n 99C32718 6AF4E23C 1A946834 B6150BDA 2583E9CA 2AD44CE8 DBBBC2DB\n 04DE8EF9 2E8EFC14 1FBECAA6 287C5947 4E6BC05D 99B2964F A090C3A2\n 233BA186 515BE7ED 1F612970 CEE2D7AF B81BDD76 2170481C D0069127\n D5B05AA9 93B4EA98 8D8FDDC1 86FFB7DC 90A6C08F 4DF435C9 34028492\n 36C3FAB4 D27C7026 C1D4DCB2 602646DE C9751E76 3DBA37BD F8FF9406\n AD9E530E E5DB382F 413001AE B06A53ED 9027D831 179727B0 865A8918\n DA3EDBEB CF9B14ED 44CE6CBA CED4BB1B DB7F1447 E6CC254B 33205151\n 2BD7AF42 6FB8F401 378CD2BF 5983CA01 C64B92EC F032EA15 D1721D03\n F482D7CE 6E74FEF6 D55E702F 46980C82 B5A84031 900B1C9E 59E7C97F\n BEC7E8F3 23A97A7E 36CC88BE 0F1D45B7 FF585AC5 4BD407B2 2B4154AA\n CC8F6D7E BF48E1D8 14CC5ED2 0F8037E0 A79715EE F29BE328 06A1D58B\n B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632\n 387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E\n 6DBE1159 74A3926F 12FEE5E4 38777CB6 A932DF8C D8BEC4D0 73B931BA\n 3BC832B6 8D9DD300 741FA7BF 8AFC47ED 2576F693 6BA42466 3AAB639C\n 5AE4F568 3423B474 2BF1C978 238F16CB E39D652D E3FDB8BE FC848AD9\n 22222E04 A4037C07 13EB57A8 1A23F0C7 3473FC64 6CEA306B 4BCBC886\n 2F8385DD FA9D4B7F A2C087E8 79683303 ED5BDD3A 062B3CF5 B3A278A6\n 6D2A13F8 3F44F82D DF310EE0 74AB6A36 4597E899 A0255DC1 64F31CC5\n 0846851D F9AB4819 5DED7EA1 B1D510BD 7EE74D73 FAF36BC3 1ECFA268\n 359046F4 EB879F92 4009438B 481C6CD7 889A002E D5EE382B C9190DA6\n FC026E47 9558E447 5677E9AA 9E3050E2 765694DF C81F56E8 80B96E71\n 60C980DD 98EDD3DF FFFFFFFF FFFFFFFF\n `),\n g: hex(\"13\"),\n hash: \"sha256\",\n },\n};\nexports.default = exports.params;\n//# sourceMappingURL=params.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SrpServer = exports.SrpClient = exports.SRP = void 0;\nconst crypto_1 = __importDefault(require(\"crypto\"));\nconst assert_1 = __importDefault(require(\"assert\"));\nconst BigInteger = require(\"../jsbn/jsbn\");\nconst params_1 = require(\"./params\");\nconst zero = new BigInteger(0, 10);\nfunction assert_(val, msg) {\n if (!val) {\n throw new Error(msg || \"assertion\");\n }\n}\nfunction assertIsBuffer(arg, argname = \"arg\") {\n assert_(Buffer.isBuffer(arg), `Type error: ${argname} must be a buffer`);\n}\nfunction assertIsBigInteger(arg, argname = \"arg\") {\n assert_(arg instanceof BigInteger, `Type error: ${argname} must be a BigInteger`);\n}\n/**\n * If a conversion is explicitly specified with the operator PAD(),\n * the integer will first be implicitly converted, then the resultant\n * byte-string will be left-padded with zeros (if necessary) until its\n * length equals the implicitly-converted length of N.\n *\n * @param {Buffer} n Number to pad\n * @param {number} len Length of the resulting Buffer\n * @return {Buffer}\n */\nfunction padTo(n, len) {\n assertIsBuffer(n, \"n\");\n const padding = len - n.length;\n assert_(padding > -1, \"Negative padding. Very uncomfortable.\");\n const result = Buffer.alloc(len);\n result.fill(0, 0, padding);\n n.copy(result, padding);\n assert_1.default.strictEqual(result.length, len);\n return result;\n}\nfunction padToN(number, params) {\n assertIsBigInteger(number);\n const n = number.toString(16).length % 2 !== 0 ? \"0\" + number.toString(16) : number.toString(16);\n return padTo(Buffer.from(n, \"hex\"), params.N_length_bits / 8);\n}\n/**\n * Compute the intermediate value x as a hash of three buffers:\n * salt, identity, and password. And a colon. FOUR buffers.\n *\n * x = H(s | H(I | \":\" | P))\n *\n * @param {object} params\n * @param {Buffer} salt\n * @param {Buffer} I User identity\n * @param {Buffer} P User password\n * @return {BigInteger} User secret\n */\nfunction getx(params, salt, I, P) {\n assertIsBuffer(salt, \"salt (salt)\");\n assertIsBuffer(I, \"identity (I)\");\n assertIsBuffer(P, \"password (P)\");\n const hashIP = crypto_1.default.createHash(params.hash)\n .update(Buffer.concat([I, Buffer.from(\":\"), P]))\n .digest();\n const hashX = crypto_1.default.createHash(params.hash)\n .update(salt)\n .update(hashIP)\n .digest();\n return new BigInteger(hashX);\n}\nclass SRP {\n /**\n * The verifier is calculated as described in Section 3 of [SRP-RFC].\n * We give the algorithm here for convenience.\n *\n * The verifier (v) is computed based on the salt (s), user name (I),\n * password (P), and group parameters (N, g).\n *\n * x = H(s | H(I | \":\" | P))\n * v = g^x % N\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @param {Buffer} salt\n * @param {Buffer} I User identity\n * @param {Buffer} P User password\n * @return {Buffer}\n */\n static computeVerifier(params, salt, I, P) {\n assertIsBuffer(salt, \"salt (salt)\");\n assertIsBuffer(I, \"identity (I)\");\n assertIsBuffer(P, \"password (P)\");\n const v_num = params.g.modPow(getx(params, salt, I, P), params.N);\n return v_num.toBuffer(params.N_length_bits / 8);\n }\n static genKey(bytes = 32, callback) {\n // bytes is optional\n if (typeof bytes !== \"number\") {\n callback = bytes;\n bytes = 32;\n }\n if (!callback) {\n return new Promise((rs, rj) => SRP.genKey(bytes, (err, data) => err ? rj(err) : rs(data)));\n }\n crypto_1.default.randomBytes(bytes, (err, buf) => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, buf);\n });\n }\n}\nexports.SRP = SRP;\nSRP.params = params_1.params;\n/**\n * Calculate the SRP-6 multiplier.\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @return {BigInteger}\n */\nfunction getk(params) {\n const k_buf = crypto_1.default\n .createHash(params.hash)\n .update(padToN(params.N, params))\n .update(padToN(params.g, params))\n .digest();\n return new BigInteger(k_buf);\n}\n/**\n * The server key exchange message also contains the server's public\n * value (B). The server calculates this value as B = k*v + g^b % N,\n * where b is a random number that SHOULD be at least 256 bits in length\n * and k = H(N | PAD(g)).\n *\n * Note: as the tests imply, the entire expression is mod N.\n *\n * @param {SrpParams} params Group parameters, with .N, .g, .hash\n * @param {BigInteger} k\n * @param {BigInteger} v Verifier (stored)\n * @param {BigInteger} b Server secret exponent\n * @return {Buffer} B - The server public message\n */\nfunction getB(params, k, v, b) {\n assertIsBigInteger(v);\n assertIsBigInteger(k);\n assertIsBigInteger(b);\n const r = k.multiply(v).add(params.g.modPow(b, params.N)).mod(params.N);\n return r.toBuffer(params.N_length_bits / 8);\n}\n/**\n * The client key exchange message carries the client's public value\n * (A). The client calculates this value as A = g^a % N, where a is a\n * random number that SHOULD be at least 256 bits in length.\n *\n * Note: for this implementation, we take that to mean 256/8 bytes.\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @param {BigInteger} a_num Client secret exponent\n * @return {Buffer} A - The client public message\n */\nfunction getA(params, a_num) {\n assertIsBigInteger(a_num);\n if (Math.ceil(a_num.toString(16).length / 2) < 32) {\n console.warn(\"getA: client key length %d is less than the recommended 256 bits\", a_num.bitLength());\n }\n return params.g.modPow(a_num, params.N).toBuffer(params.N_length_bits / 8);\n}\n/**\n * getu() hashes the two public messages together, to obtain a scrambling\n * parameter \"u\" which cannot be predicted by either party ahead of time.\n * This makes it safe to use the message ordering defined in the SRP-6a\n * paper, in which the server reveals their \"B\" value before the client\n * commits to their \"A\" value.\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @param {Buffer} A Client ephemeral public key\n * @param {Buffer} B Server ephemeral public key\n * @return {BigInteger} u - Shared scrambling parameter\n */\nfunction getu(params, A, B) {\n assertIsBuffer(A, \"A\");\n assertIsBuffer(B, \"B\");\n const u_buf = crypto_1.default.createHash(params.hash)\n .update(padTo(A, params.N_length_bits / 8))\n .update(padTo(B, params.N_length_bits / 8))\n .digest();\n return new BigInteger(u_buf);\n}\n/**\n * The TLS premaster secret as calculated by the client\n *\n * @param {SrpParams} params Group parameters, with .N, .g, .hash\n * @param {BigInteger} k_num\n * @param {BigInteger} x_num\n * @param {BigInteger} a_num\n * @param {BigInteger} B_num\n * @param {BigInteger} u_num\n * @return {Buffer}\n */\nfunction client_getS(params, k_num, x_num, a_num, B_num, u_num) {\n assertIsBigInteger(k_num);\n assertIsBigInteger(x_num);\n assertIsBigInteger(a_num);\n assertIsBigInteger(B_num);\n assertIsBigInteger(u_num);\n if ((zero.compareTo(B_num) >= 0) || (params.N.compareTo(B_num) <= 0)) {\n throw new Error(\"invalid server-supplied \\\"B\\\", must be 1..N-1\");\n }\n const S_num = B_num.subtract(k_num.multiply(params.g.modPow(x_num, params.N)))\n .modPow(a_num.add(u_num.multiply(x_num)), params.N)\n .mod(params.N);\n return S_num.toBuffer(params.N_length_bits / 8);\n}\n/**\n * The TLS premastersecret as calculated by the server\n *\n * @param {BigInteger} params Group parameters, with .N, .g, .hash\n * @param {BigInteger} v_num Verifier (stored on server)\n * @param {BigInteger} A_num Ephemeral client public key (read from client)\n * @param {BigInteger} b_num Server ephemeral private key (generated for session)\n * @param {BigInteger} u_num {@see getu}\n * @return {Buffer}\n */\nfunction server_getS(params, v_num, A_num, b_num, u_num) {\n assertIsBigInteger(v_num);\n assertIsBigInteger(A_num);\n assertIsBigInteger(b_num);\n assertIsBigInteger(u_num);\n if ((zero.compareTo(A_num) >= 0) || (params.N.compareTo(A_num) <= 0)) {\n throw new Error(\"invalid client-supplied \\\"A\\\", must be 1..N-1\");\n }\n const S_num = A_num.multiply(v_num.modPow(u_num, params.N))\n .modPow(b_num, params.N)\n .mod(params.N);\n return S_num.toBuffer(params.N_length_bits / 8);\n}\n/**\n * Compute the shared session key K from S\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @param {Buffer} S_buf Session key\n * @return {Buffer}\n */\nfunction getK(params, S_buf) {\n assertIsBuffer(S_buf, \"S\");\n if (params.hash === \"sha1\") {\n // use t_mgf1 interleave for short sha1 hashes\n return Buffer.concat([\n crypto_1.default.createHash(params.hash).update(S_buf).update(Buffer.from([0, 0, 0, 0])).digest(),\n crypto_1.default.createHash(params.hash).update(S_buf).update(Buffer.from([0, 0, 0, 1])).digest(),\n ]);\n }\n else {\n // use hash as-is otherwise\n return crypto_1.default.createHash(params.hash).update(S_buf).digest();\n }\n}\nfunction getM1(params, u_buf, s_buf, A_buf, B_buf, K_buf) {\n if (arguments.length > 4) {\n assertIsBuffer(u_buf, \"identity (I)\");\n assertIsBuffer(s_buf, \"salt (s)\");\n assertIsBuffer(A_buf, \"client public key (A)\");\n assertIsBuffer(B_buf, \"server public key (B)\");\n assertIsBuffer(K_buf, \"session key (K)\");\n const hN = crypto_1.default.createHash(params.hash).update(params.N.toBuffer(true)).digest();\n const hG = crypto_1.default.createHash(params.hash).update(params.g.toBuffer(true)).digest();\n for (let i = 0; i < hN.length; i++) {\n hN[i] ^= hG[i];\n }\n const hU = crypto_1.default.createHash(params.hash).update(u_buf).digest();\n return crypto_1.default.createHash(params.hash)\n .update(hN).update(hU).update(s_buf)\n .update(A_buf).update(B_buf).update(K_buf)\n .digest();\n }\n else {\n [A_buf, B_buf, s_buf] = [u_buf, s_buf, A_buf];\n assertIsBuffer(A_buf, \"A\");\n assertIsBuffer(B_buf, \"B\");\n assertIsBuffer(s_buf, \"S\");\n return crypto_1.default.createHash(params.hash)\n .update(A_buf).update(B_buf).update(s_buf)\n .digest();\n }\n}\nfunction getM2(params, A_buf, M1_buf, K_buf) {\n assertIsBuffer(A_buf, \"A\");\n assertIsBuffer(M1_buf, \"M1\");\n assertIsBuffer(K_buf, \"K\");\n return crypto_1.default.createHash(params.hash)\n .update(A_buf).update(M1_buf).update(K_buf)\n .digest();\n}\nfunction equal(buf1, buf2) {\n // constant-time comparison. A drop in the ocean compared to our\n // non-constant-time modexp operations, but still good practice.\n return buf1.toString(\"hex\") === buf2.toString(\"hex\");\n}\nclass SrpClient {\n /**\n * Create an SRP client.\n *\n * @param {object} params Group parameters, with .N, .g, .hash\n * @param {Buffer} salt_buf User salt (from server)\n * @param {Buffer} identity_buf Identity/username\n * @param {Buffer} password_buf Password\n * @param {Buffer} secret1_buf Client private key {@see genKey}\n * @param {boolean} hap\n */\n constructor(params, salt_buf, identity_buf, password_buf, secret1_buf, hap = true) {\n assertIsBuffer(salt_buf, \"salt (s)\");\n assertIsBuffer(identity_buf, \"identity (I)\");\n assertIsBuffer(password_buf, \"password (P)\");\n assertIsBuffer(secret1_buf, \"secret1\");\n this._params = params;\n this._k = getk(params);\n this._x = getx(params, salt_buf, identity_buf, password_buf);\n this._a = new BigInteger(secret1_buf);\n if (hap) {\n this._I = identity_buf;\n this._s = salt_buf;\n }\n this._A = getA(params, this._a);\n }\n /**\n * Returns the client's public key (A).\n *\n * @return {Buffer}\n */\n computeA() {\n return this._A;\n }\n /**\n * Sets the server's public key (B).\n *\n * @param {Buffer} B_buf The server's public key\n */\n setB(B_buf) {\n const u_num = getu(this._params, this._A, B_buf);\n const S_buf_x = client_getS(this._params, this._k, this._x, this._a, new BigInteger(B_buf), u_num);\n this._K = getK(this._params, S_buf_x);\n this._u = u_num; // only for tests\n this._S = S_buf_x; // only for tests\n this._B = B_buf;\n if (this._I && this._s) {\n this._M1 = getM1(this._params, this._I, this._s, this._A, this._B, this._K);\n }\n else {\n this._M1 = getM1(this._params, this._A, this._B, this._S);\n }\n this._M2 = getM2(this._params, this._A, this._M1, this._K);\n }\n /**\n * Gets the M1 value.\n * This requires setting the server's public key {@see Client.setB}.\n *\n * @return {Buffer}\n */\n computeM1() {\n if (this._M1 === undefined) {\n throw new Error(\"incomplete protocol\");\n }\n return this._M1;\n }\n /**\n * Checks the server was able to calculate M2.\n * This requires setting the server's public key {@see Client.setB}.\n *\n * @param M2 The server's M2 value\n */\n checkM2(M2) {\n if (!equal(this._M2, M2)) {\n throw new Error(\"server is not authentic\");\n }\n }\n /**\n * Returns the shared session key.\n *\n * @return {Buffer}\n */\n computeK() {\n if (this._K === undefined) {\n throw new Error(\"incomplete protocol\");\n }\n return this._K;\n }\n}\nexports.SrpClient = SrpClient;\nclass SrpServer {\n constructor(params, salt_buf, identity_buf, password_buf, secret2_buf) {\n this._params = params;\n this._k = getk(params);\n if (arguments.length > 3) {\n assertIsBuffer(salt_buf, \"salt (salt)\");\n assertIsBuffer(identity_buf, \"identity (I)\");\n assertIsBuffer(password_buf, \"password (P)\");\n assertIsBuffer(secret2_buf, \"secret2\");\n this._b = new BigInteger(secret2_buf);\n this._v = new BigInteger(SRP.computeVerifier(params, salt_buf, identity_buf, password_buf));\n this._I = identity_buf;\n this._s = salt_buf;\n }\n else if (salt_buf instanceof Buffer) {\n const verifier_buf = salt_buf;\n // noinspection JSUnusedAssignment\n [secret2_buf, salt_buf, identity_buf, password_buf] = [identity_buf, undefined, undefined, undefined];\n assertIsBuffer(verifier_buf, \"verifier (v)\");\n assertIsBuffer(secret2_buf, \"secret2\");\n this._b = new BigInteger(secret2_buf);\n this._v = new BigInteger(verifier_buf);\n }\n else {\n const identity = salt_buf;\n // noinspection JSUnusedAssignment\n [secret2_buf, salt_buf, identity_buf, password_buf] = [identity_buf, undefined, undefined, undefined];\n // noinspection SuspiciousTypeOfGuard\n (0, assert_1.default)(identity.username instanceof Buffer || typeof identity.username === \"string\", \"identity.username (I) must be a string or Buffer\");\n assertIsBuffer(identity.salt, \"identity.salt (s)\");\n (0, assert_1.default)(\"password\" in identity || \"verifier\" in identity, \"identity requires a password or verifier\");\n if (\"verifier\" in identity) {\n assertIsBuffer(identity.verifier, \"identity.verifier (v)\");\n }\n else {\n // noinspection SuspiciousTypeOfGuard\n (0, assert_1.default)(identity.password instanceof Buffer || typeof identity.password === \"string\", \"identity.password (p) must be a string or Buffer\");\n }\n assertIsBuffer(secret2_buf, \"secret2\");\n const username = typeof identity.username === \"string\" ? Buffer.from(identity.username) : identity.username;\n this._b = new BigInteger(secret2_buf);\n if (\"verifier\" in identity) {\n this._v = new BigInteger(identity.verifier);\n }\n else {\n this._v = new BigInteger(SRP.computeVerifier(params, identity.salt, username, typeof identity.password === \"string\" ? Buffer.from(identity.password) : identity.password));\n }\n this._I = username;\n this._s = identity.salt;\n }\n this._B = getB(params, this._k, this._v, this._b);\n }\n /**\n * Returns the server's public key (B).\n *\n * @return {Buffer}\n */\n computeB() {\n return this._B;\n }\n /**\n * Sets the client's public key (A).\n *\n * @param {Buffer} A The client's public key\n */\n setA(A) {\n const u_num = getu(this._params, A, this._B);\n const S_buf = server_getS(this._params, this._v, new BigInteger(A), this._b, u_num);\n this._K = getK(this._params, S_buf);\n this._u = u_num; // only for tests\n this._S = S_buf; // only for tests\n if (this._I && this._s) {\n this._M1 = getM1(this._params, this._I, this._s, A, this._B, this._K);\n }\n else {\n this._M1 = getM1(this._params, A, this._B, this._S);\n }\n this._M2 = getM2(this._params, A, this._M1, this._K);\n }\n /**\n * Checks the client was able to calculate M1.\n *\n * @param {Buffer} M1 The client's M1 value\n */\n checkM1(M1) {\n if (this._M1 === undefined) {\n throw new Error(\"incomplete protocol\");\n }\n if (!equal(this._M1, M1)) {\n throw new Error(\"client did not use the same password\");\n }\n }\n /**\n * Returns the shared session key.\n *\n * @return {Buffer}\n */\n computeK() {\n if (this._K === undefined) {\n throw new Error(\"incomplete protocol\");\n }\n return this._K;\n }\n /**\n * Gets the M2 value.\n * This requires setting the client's public key {@see Server.setA}.\n *\n * @return {Buffer}\n */\n computeM2() {\n if (this._M2 === undefined) {\n throw new Error(\"incomplete protocol\");\n }\n return this._M2;\n }\n}\nexports.SrpServer = SrpServer;\n//# sourceMappingURL=srp.js.map","'use strict';\n\nvar isCallable = require('is-callable');\n\nvar toStr = Object.prototype.toString;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n};\n\nvar forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n};\n\nvar forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n};\n\nvar forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n};\n\nmodule.exports = forEach;\n","\n'use strict';\n\nvar Stream = require('stream')\n\n// from\n//\n// a stream that reads from an source.\n// source may be an array, or a function.\n// from handles pause behaviour for you.\n\nmodule.exports =\nfunction from (source) {\n if(Array.isArray(source)) {\n\t\tvar source_index = 0, source_len = source.length;\n return from (function (i) {\n if(source_index < source_len)\n this.emit('data', source[source_index++])\n else\n this.emit('end')\n return true\n })\n }\n var s = new Stream(), i = 0\n s.ended = false\n s.started = false\n s.readable = true\n s.writable = false\n s.paused = false\n s.ended = false\n s.pause = function () {\n s.started = true\n s.paused = true\n }\n function next () {\n s.started = true\n if(s.ended) return\n while(!s.ended && !s.paused && source.call(s, i++, function () {\n if(!s.ended && !s.paused)\n process.nextTick(next);\n }))\n ;\n }\n s.resume = function () {\n s.started = true\n s.paused = false\n next()\n }\n s.on('end', function () {\n s.ended = true\n s.readable = false\n process.nextTick(s.destroy)\n })\n s.destroy = function () {\n s.ended = true\n s.emit('close') \n }\n /*\n by default, the stream will start emitting at nextTick\n if you want, you can pause it, after pipeing.\n you can also resume before next tick, and that will also\n work.\n */\n process.nextTick(function () {\n if(!s.started) s.resume()\n })\n return s\n}\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar toStr = Object.prototype.toString;\nvar max = Math.max;\nvar funcType = '[object Function]';\n\nvar concatty = function concatty(a, b) {\n var arr = [];\n\n for (var i = 0; i < a.length; i += 1) {\n arr[i] = a[i];\n }\n for (var j = 0; j < b.length; j += 1) {\n arr[j + a.length] = b[j];\n }\n\n return arr;\n};\n\nvar slicy = function slicy(arrLike, offset) {\n var arr = [];\n for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {\n arr[j] = arrLike[i];\n }\n return arr;\n};\n\nvar joiny = function (arr, joiner) {\n var str = '';\n for (var i = 0; i < arr.length; i += 1) {\n str += arr[i];\n if (i + 1 < arr.length) {\n str += joiner;\n }\n }\n return str;\n};\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.apply(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slicy(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n concatty(args, arguments)\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n }\n return target.apply(\n that,\n concatty(args, arguments)\n );\n\n };\n\n var boundLength = max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs[i] = '$' + i;\n }\n\n bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar functionsHaveNames = function functionsHaveNames() {\n\treturn typeof function f() {}.name === 'string';\n};\n\nvar gOPD = Object.getOwnPropertyDescriptor;\nif (gOPD) {\n\ttry {\n\t\tgOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\tgOPD = null;\n\t}\n}\n\nfunctionsHaveNames.functionsHaveConfigurableNames = function functionsHaveConfigurableNames() {\n\tif (!functionsHaveNames() || !gOPD) {\n\t\treturn false;\n\t}\n\tvar desc = gOPD(function () {}, 'name');\n\treturn !!desc && !!desc.configurable;\n};\n\nvar $bind = Function.prototype.bind;\n\nfunctionsHaveNames.boundFunctionsHaveNames = function boundFunctionsHaveNames() {\n\treturn functionsHaveNames() && typeof $bind === 'function' && function f() {}.bind().name !== '';\n};\n\nmodule.exports = functionsHaveNames;\n","'use strict';\n\n/**\n * @file\n *\n * Copyright 2018 FutoIn Project (https://futoin.org)\n * Copyright 2018 Andrey Galkin \n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst { Buffer } = require( 'buffer' );\nconst { createHash, createHmac } = require( 'crypto' );\n\nconst g_digestLenCache = {};\n\n/**\n * Get expected hash length.\n *\n * @func\n * @alias hkdf.hash_length\n * @param {string} hash - Hash algorithm (as in underlying Node.js crypto library)\n * @returns {integer} hash digest byte length\n *\n * @note Values are hardcoded with fallback for unknown algorithms.\n */\nconst hash_length = ( hash ) => {\n switch ( hash ) {\n case 'sha256': return 32;\n case 'sha512': return 64;\n case 'sha224': return 28;\n case 'sha384': return 48;\n case 'sha3-256': return 32;\n case 'sha3-512': return 64;\n case 'sha3-224': return 28;\n case 'sha3-384': return 48;\n case 'blake2s256': return 32;\n case 'blake2b512': return 64;\n case 'sha1': return 20;\n case 'md5': return 16;\n default: {\n let len = g_digestLenCache[hash];\n\n if ( len === undefined ) {\n len = createHash( hash ).digest().length;\n g_digestLenCache[hash] = len;\n }\n\n return len;\n }\n }\n};\n\n/**\n * HKDF extract action.\n *\n * @func\n * @alias hkdf.extract\n * @param {string} hash - Hash algorithm (as in underlying Node.js crypto library)\n * @param {integer} hash_len - Hash digest length\n * @param {Buffer|string} ikm - Initial Keying Material\n * @param {Buffer|string} salt - Optional salt (recommended)\n * @returns {Buffer} A buffer with pseudorandom key\n *\n * @note Values are hardcoded with fallback for unknown algorithms.\n */\nconst hkdf_extract = ( hash, hash_len, ikm, salt ) => {\n const b_ikm = Buffer.isBuffer( ikm ) ? ikm : Buffer.from( ikm );\n const b_salt = ( salt && salt.length ) ? Buffer.from( salt ) : Buffer.alloc( hash_len, 0 );\n\n return createHmac( hash, b_salt ).update( b_ikm ).digest();\n};\n\n/**\n * HKDF expand action.\n *\n * @func\n * @alias hkdf.expand\n * @param {string} hash - Hash algorithm (as in underlying Node.js crypto library)\n * @param {integer} hash_len - Hash digest length\n * @param {Buffer|string} prk - A buffer with pseudorandom key\n * @param {integer} length - length of output keying material in octets\n * @param {Buffer|string} info - Optional context (safe to skip)\n * @returns {Buffer} A buffer with output keying material\n *\n * @note Values are hardcoded with fallback for unknown algorithms.\n */\nconst hkdf_expand = ( hash, hash_len, prk, length, info ) => {\n const b_info = Buffer.isBuffer( info ) ? info : Buffer.from( info || '' );\n const info_len = b_info.length;\n\n const steps = Math.ceil( length / hash_len );\n\n if ( steps > 0xFF ) {\n throw new Error( `OKM length ${length} is too long for ${hash} hash` );\n }\n\n // use single buffer with unnecessary create/copy/move operations\n const t = Buffer.alloc( hash_len * steps + info_len + 1 );\n\n for ( let c = 1, start = 0, end = 0; c <= steps; ++c ) {\n // add info\n b_info.copy( t, end );\n // add counter\n t[ end + info_len ] = c;\n\n createHmac( hash, prk )\n // use view: T(C) = T(C-1) | info | C\n .update( t.slice( start, end + info_len + 1 ) )\n .digest()\n // put back to the same buffer\n .copy( t, end );\n\n start = end; // used for T(C-1) start\n end += hash_len; // used for T(C-1) end & overall end\n }\n\n return t.slice( 0, length );\n};\n\n/**\n * HMAC-based Extract-and-Expand Key Derivation Function (HKDF)\n *\n * @param {Buffer|string} ikm - Initial Keying Material\n * @param {integer} length - Required byte length of output\n * @param {Buffer|string} salt='' - Optional salt (recommended)\n * @param {Buffer|string} info='' - Optional context (safe to skip)\n * @param {string} hash='SHA-256' - HMAC hash function to use\n * @returns {Buffer} Raw buffer with derived key of @p length bytes\n */\nfunction hkdf( ikm, length, { salt='', info='', hash='SHA-256' } = {} ) {\n hash = hash.toLowerCase().replace( '-', '' );\n\n // 0. Hash length\n const hash_len = hash_length( hash );\n\n // 1. extract\n const prk = hkdf_extract( hash, hash_len, ikm, salt );\n\n // 2. expand\n return hkdf_expand( hash, hash_len, prk, length, info );\n}\n\nObject.defineProperties( hkdf, {\n hash_length : {\n configurable: false,\n enumerable: false,\n writable: false,\n value: hash_length,\n },\n extract : {\n configurable: false,\n enumerable: false,\n writable: false,\n value: hkdf_extract,\n },\n expand : {\n configurable: false,\n enumerable: false,\n writable: false,\n value: hkdf_expand,\n },\n} );\n\nmodule.exports = hkdf;\n","'use strict';\n\nvar undefined;\n\nvar $Error = require('es-errors');\nvar $EvalError = require('es-errors/eval');\nvar $RangeError = require('es-errors/range');\nvar $ReferenceError = require('es-errors/ref');\nvar $SyntaxError = require('es-errors/syntax');\nvar $TypeError = require('es-errors/type');\nvar $URIError = require('es-errors/uri');\n\nvar $Function = Function;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\nvar hasProto = require('has-proto')();\n\nvar getProto = Object.getPrototypeOf || (\n\thasProto\n\t\t? function (x) { return x.__proto__; } // eslint-disable-line no-proto\n\t\t: null\n);\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t__proto__: null,\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': $Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': $EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': $RangeError,\n\t'%ReferenceError%': $ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': $URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nif (getProto) {\n\ttry {\n\t\tnull.error; // eslint-disable-line no-unused-expressions\n\t} catch (e) {\n\t\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\t\tvar errorProto = getProto(getProto(e));\n\t\tINTRINSICS['%Error.prototype%'] = errorProto;\n\t}\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen && getProto) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t__proto__: null,\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('hasown');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\n\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","\"use strict\";\n//HomeKit Types UUID's\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MANUFACTURER_CTYPE = exports.LOGS_CTYPE = exports.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE = exports.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE = exports.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE = exports.IDENTIFY_CTYPE = exports.HUE_CTYPE = exports.HEATING_THRESHOLD_CTYPE = exports.CURRENT_TEMPERATURE_CTYPE = exports.CURRENT_RELATIVE_HUMIDITY_CTYPE = exports.CURRENT_LOCK_MECHANISM_STATE_CTYPE = exports.CURRENT_DOOR_STATE_CTYPE = exports.CONTACT_SENSOR_STATE_CTYPE = exports.COOLING_THRESHOLD_CTYPE = exports.BATTERY_LEVEL_CTYPE = exports.BRIGHTNESS_CTYPE = exports.AUDIO_FEEDBACK_CTYPE = exports.ADMIN_ONLY_ACCESS_CTYPE = exports.ALARM_TARGET_STATE_CTYPE = exports.ALARM_CURRENT_STATE_CTYPE = exports.TEMPERATURE_SENSOR_STYPE = exports.HUMIDITY_SENSOR_STYPE = exports.MOTION_SENSOR_STYPE = exports.CONTACT_SENSOR_STYPE = exports.OCCUPANCY_SENSOR_STYPE = exports.WINDOW_COVERING_STYPE = exports.ALARM_STYPE = exports.LOCK_MANAGEMENT_STYPE = exports.LOCK_MECHANISM_STYPE = exports.OUTLET_STYPE = exports.FAN_STYPE = exports.ACCESSORY_INFORMATION_STYPE = exports.GARAGE_DOOR_OPENER_STYPE = exports.THERMOSTAT_STYPE = exports.SWITCH_STYPE = exports.LIGHTBULB_STYPE = exports.PROGRAMMABLE_SWITCH_TCTYPE = exports.WINDOW_COVERING_TCTYPE = exports.WINDOW_TCTYPE = exports.DOOR_TCTYPE = exports.ALARM_SYSTEM_TCTYPE = exports.SENSOR_TCTYPE = exports.THERMOSTAT_TCTYPE = exports.SWITCH_TCTYPE = exports.OUTLET_TCTYPE = exports.DOOR_LOCK_TCTYPE = exports.LIGHTBULB_TCTYPE = exports.GARAGE_DOOR_OPENER_TCTYPE = exports.FAN_TCTYPE = exports.OTHER_TCTYPE = void 0;\nexports.TARGETHEATINGCOOLING_CTYPE = exports.CURRENTHEATINGCOOLING_CTYPE = exports.WINDOW_COVERING_OPERATION_STATE_CTYPE = exports.WINDOW_COVERING_CURRENT_POSITION_CTYPE = exports.WINDOW_COVERING_TARGET_POSITION_CTYPE = exports.VERSION_CTYPE = exports.TEMPERATURE_UNITS_CTYPE = exports.TARGET_TEMPERATURE_CTYPE = exports.TARGET_RELATIVE_HUMIDITY_CTYPE = exports.TARGET_LOCK_MECHANISM_STATE_CTYPE = exports.TARGET_DOORSTATE_CTYPE = exports.STATUS_FAULT_CTYPE = exports.STATUS_LOW_BATTERY_CTYPE = exports.FIRMWARE_REVISION_CTYPE = exports.SERIAL_NUMBER_CTYPE = exports.SATURATION_CTYPE = exports.ROTATION_SPEED_CTYPE = exports.ROTATION_DIRECTION_CTYPE = exports.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE = exports.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE = exports.POWER_STATE_CTYPE = exports.OCCUPANCY_DETECTED_CTYPE = exports.OUTLET_IN_USE_CTYPE = exports.OBSTRUCTION_DETECTED_CTYPE = exports.NAME_CTYPE = exports.MOTION_DETECTED_CTYPE = exports.MODEL_CTYPE = void 0;\nvar stPre = \"000000\";\nvar stPost = \"-0000-1000-8000-0026BB765291\";\n//HomeKitTransportCategoryTypes\nexports.OTHER_TCTYPE = 1;\nexports.FAN_TCTYPE = 3;\nexports.GARAGE_DOOR_OPENER_TCTYPE = 4;\nexports.LIGHTBULB_TCTYPE = 5;\nexports.DOOR_LOCK_TCTYPE = 6;\nexports.OUTLET_TCTYPE = 7;\nexports.SWITCH_TCTYPE = 8;\nexports.THERMOSTAT_TCTYPE = 9;\nexports.SENSOR_TCTYPE = 10;\nexports.ALARM_SYSTEM_TCTYPE = 11;\nexports.DOOR_TCTYPE = 12;\nexports.WINDOW_TCTYPE = 13;\nexports.WINDOW_COVERING_TCTYPE = 14;\nexports.PROGRAMMABLE_SWITCH_TCTYPE = 15;\n//HomeKitServiceTypes\nexports.LIGHTBULB_STYPE = stPre + \"43\" + stPost;\nexports.SWITCH_STYPE = stPre + \"49\" + stPost;\nexports.THERMOSTAT_STYPE = stPre + \"4A\" + stPost;\nexports.GARAGE_DOOR_OPENER_STYPE = stPre + \"41\" + stPost;\nexports.ACCESSORY_INFORMATION_STYPE = stPre + \"3E\" + stPost;\nexports.FAN_STYPE = stPre + \"40\" + stPost;\nexports.OUTLET_STYPE = stPre + \"47\" + stPost;\nexports.LOCK_MECHANISM_STYPE = stPre + \"45\" + stPost;\nexports.LOCK_MANAGEMENT_STYPE = stPre + \"44\" + stPost;\nexports.ALARM_STYPE = stPre + \"7E\" + stPost;\nexports.WINDOW_COVERING_STYPE = stPre + \"8C\" + stPost;\nexports.OCCUPANCY_SENSOR_STYPE = stPre + \"86\" + stPost;\nexports.CONTACT_SENSOR_STYPE = stPre + \"80\" + stPost;\nexports.MOTION_SENSOR_STYPE = stPre + \"85\" + stPost;\nexports.HUMIDITY_SENSOR_STYPE = stPre + \"82\" + stPost;\nexports.TEMPERATURE_SENSOR_STYPE = stPre + \"8A\" + stPost;\n//HomeKitCharacteristicsTypes\nexports.ALARM_CURRENT_STATE_CTYPE = stPre + \"66\" + stPost;\nexports.ALARM_TARGET_STATE_CTYPE = stPre + \"67\" + stPost;\nexports.ADMIN_ONLY_ACCESS_CTYPE = stPre + \"01\" + stPost;\nexports.AUDIO_FEEDBACK_CTYPE = stPre + \"05\" + stPost;\nexports.BRIGHTNESS_CTYPE = stPre + \"08\" + stPost;\nexports.BATTERY_LEVEL_CTYPE = stPre + \"68\" + stPost;\nexports.COOLING_THRESHOLD_CTYPE = stPre + \"0D\" + stPost;\nexports.CONTACT_SENSOR_STATE_CTYPE = stPre + \"6A\" + stPost;\nexports.CURRENT_DOOR_STATE_CTYPE = stPre + \"0E\" + stPost;\nexports.CURRENT_LOCK_MECHANISM_STATE_CTYPE = stPre + \"1D\" + stPost;\nexports.CURRENT_RELATIVE_HUMIDITY_CTYPE = stPre + \"10\" + stPost;\nexports.CURRENT_TEMPERATURE_CTYPE = stPre + \"11\" + stPost;\nexports.HEATING_THRESHOLD_CTYPE = stPre + \"12\" + stPost;\nexports.HUE_CTYPE = stPre + \"13\" + stPost;\nexports.IDENTIFY_CTYPE = stPre + \"14\" + stPost;\nexports.LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE = stPre + \"1A\" + stPost;\nexports.LOCK_MANAGEMENT_CONTROL_POINT_CTYPE = stPre + \"19\" + stPost;\nexports.LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE = stPre + \"1C\" + stPost;\nexports.LOGS_CTYPE = stPre + \"1F\" + stPost;\nexports.MANUFACTURER_CTYPE = stPre + \"20\" + stPost;\nexports.MODEL_CTYPE = stPre + \"21\" + stPost;\nexports.MOTION_DETECTED_CTYPE = stPre + \"22\" + stPost;\nexports.NAME_CTYPE = stPre + \"23\" + stPost;\nexports.OBSTRUCTION_DETECTED_CTYPE = stPre + \"24\" + stPost;\nexports.OUTLET_IN_USE_CTYPE = stPre + \"26\" + stPost;\nexports.OCCUPANCY_DETECTED_CTYPE = stPre + \"71\" + stPost;\nexports.POWER_STATE_CTYPE = stPre + \"25\" + stPost;\nexports.PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE = stPre + \"73\" + stPost;\nexports.PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE = stPre + \"74\" + stPost;\nexports.ROTATION_DIRECTION_CTYPE = stPre + \"28\" + stPost;\nexports.ROTATION_SPEED_CTYPE = stPre + \"29\" + stPost;\nexports.SATURATION_CTYPE = stPre + \"2F\" + stPost;\nexports.SERIAL_NUMBER_CTYPE = stPre + \"30\" + stPost;\nexports.FIRMWARE_REVISION_CTYPE = stPre + \"52\" + stPost;\nexports.STATUS_LOW_BATTERY_CTYPE = stPre + \"79\" + stPost;\nexports.STATUS_FAULT_CTYPE = stPre + \"77\" + stPost;\nexports.TARGET_DOORSTATE_CTYPE = stPre + \"32\" + stPost;\nexports.TARGET_LOCK_MECHANISM_STATE_CTYPE = stPre + \"1E\" + stPost;\nexports.TARGET_RELATIVE_HUMIDITY_CTYPE = stPre + \"34\" + stPost;\nexports.TARGET_TEMPERATURE_CTYPE = stPre + \"35\" + stPost;\nexports.TEMPERATURE_UNITS_CTYPE = stPre + \"36\" + stPost;\nexports.VERSION_CTYPE = stPre + \"37\" + stPost;\nexports.WINDOW_COVERING_TARGET_POSITION_CTYPE = stPre + \"7C\" + stPost;\nexports.WINDOW_COVERING_CURRENT_POSITION_CTYPE = stPre + \"6D\" + stPost;\nexports.WINDOW_COVERING_OPERATION_STATE_CTYPE = stPre + \"72\" + stPost;\nexports.CURRENTHEATINGCOOLING_CTYPE = stPre + \"0F\" + stPost;\nexports.TARGETHEATINGCOOLING_CTYPE = stPre + \"33\" + stPost;\n//# sourceMappingURL=types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.init = exports.HAPLibraryVersion = exports.LegacyTypes = exports.uuid = exports.AccessoryLoader = void 0;\nvar tslib_1 = require(\"tslib\");\nrequire(\"source-map-support/register\"); // registering node-source-map-support for typescript stack traces\nrequire(\"./lib/definitions\"); // must be loaded before Characteristic and Service class\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar HAPStorage_1 = require(\"./lib/model/HAPStorage\");\n/**\n * @group Utils\n */\nexports.AccessoryLoader = tslib_1.__importStar(require(\"./lib/AccessoryLoader\"));\n/**\n * @group Utils\n */\nexports.uuid = tslib_1.__importStar(require(\"./lib/util/uuid\"));\ntslib_1.__exportStar(require(\"./lib/model/HAPStorage\"), exports);\ntslib_1.__exportStar(require(\"./lib/Accessory\"), exports);\ntslib_1.__exportStar(require(\"./lib/Bridge\"), exports);\ntslib_1.__exportStar(require(\"./lib/Service\"), exports);\ntslib_1.__exportStar(require(\"./lib/Characteristic\"), exports);\ntslib_1.__exportStar(require(\"./lib/AccessoryLoader\"), exports);\ntslib_1.__exportStar(require(\"./lib/camera\"), exports);\ntslib_1.__exportStar(require(\"./lib/tv/AccessControlManagement\"), exports);\ntslib_1.__exportStar(require(\"./lib/HAPServer\"), exports);\ntslib_1.__exportStar(require(\"./lib/datastream\"), exports);\ntslib_1.__exportStar(require(\"./lib/controller\"), exports);\ntslib_1.__exportStar(require(\"./lib/model/AccessoryInfo\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/clone\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/once\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/tlv\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/hapStatusError\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/color-utils\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/time\"), exports);\ntslib_1.__exportStar(require(\"./lib/util/eventedhttp\"), exports);\ntslib_1.__exportStar(require(\"./types\"), exports);\n/**\n * @group Utils\n */\nexports.LegacyTypes = tslib_1.__importStar(require(\"./accessories/types\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Advertiser\");\n/**\n * This method can be used to retrieve the current running library version of the HAP-NodeJS framework.\n * @returns The SemVer version string.\n *\n * @group Utils\n */\nfunction HAPLibraryVersion() {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var packageJson = require(\"../package.json\");\n return packageJson.version;\n}\nexports.HAPLibraryVersion = HAPLibraryVersion;\nfunction printInit() {\n debug(\"Initializing HAP-NodeJS v%s ...\", HAPLibraryVersion());\n}\nprintInit();\n/**\n *\n * @param {string} storagePath\n * @deprecated the need to manually initialize the internal storage was removed. If you want to set a custom\n * storage path location, please use {@link HAPStorage.setCustomStoragePath} directly.\n *\n * @group Utils\n */\nfunction init(storagePath) {\n console.log(\"DEPRECATED: The need to manually initialize HAP (by calling the init method) was removed. \" +\n \"If you want to set a custom storage path location, please ust HAPStorage.setCustomStoragePath directly. \" +\n \"This method will be removed in the next major update!\");\n if (storagePath) {\n HAPStorage_1.HAPStorage.setCustomStoragePath(storagePath);\n }\n}\nexports.init = init;\nvar Services = tslib_1.__importStar(require(\"./lib/definitions/ServiceDefinitions\"));\nvar Characteristics = tslib_1.__importStar(require(\"./lib/definitions/CharacteristicDefinitions\"));\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HAPMimeTypes = exports.PairingStates = exports.PairMethods = exports.TLVValues = exports.consideredTrue = void 0;\n/**\n * @group Utils\n */\nfunction consideredTrue(input) {\n if (!input) {\n return false;\n }\n return input === \"true\" || input === \"1\";\n}\nexports.consideredTrue = consideredTrue;\n/**\n * @group HAP Accessory Server\n */\nvar TLVValues;\n(function (TLVValues) {\n // noinspection JSUnusedGlobalSymbols\n TLVValues[TLVValues[\"REQUEST_TYPE\"] = 0] = \"REQUEST_TYPE\";\n TLVValues[TLVValues[\"METHOD\"] = 0] = \"METHOD\";\n TLVValues[TLVValues[\"USERNAME\"] = 1] = \"USERNAME\";\n TLVValues[TLVValues[\"IDENTIFIER\"] = 1] = \"IDENTIFIER\";\n TLVValues[TLVValues[\"SALT\"] = 2] = \"SALT\";\n TLVValues[TLVValues[\"PUBLIC_KEY\"] = 3] = \"PUBLIC_KEY\";\n TLVValues[TLVValues[\"PASSWORD_PROOF\"] = 4] = \"PASSWORD_PROOF\";\n TLVValues[TLVValues[\"ENCRYPTED_DATA\"] = 5] = \"ENCRYPTED_DATA\";\n TLVValues[TLVValues[\"SEQUENCE_NUM\"] = 6] = \"SEQUENCE_NUM\";\n TLVValues[TLVValues[\"STATE\"] = 6] = \"STATE\";\n TLVValues[TLVValues[\"ERROR_CODE\"] = 7] = \"ERROR_CODE\";\n TLVValues[TLVValues[\"RETRY_DELAY\"] = 8] = \"RETRY_DELAY\";\n TLVValues[TLVValues[\"CERTIFICATE\"] = 9] = \"CERTIFICATE\";\n TLVValues[TLVValues[\"PROOF\"] = 10] = \"PROOF\";\n TLVValues[TLVValues[\"SIGNATURE\"] = 10] = \"SIGNATURE\";\n TLVValues[TLVValues[\"PERMISSIONS\"] = 11] = \"PERMISSIONS\";\n TLVValues[TLVValues[\"FRAGMENT_DATA\"] = 12] = \"FRAGMENT_DATA\";\n TLVValues[TLVValues[\"FRAGMENT_LAST\"] = 13] = \"FRAGMENT_LAST\";\n TLVValues[TLVValues[\"SEPARATOR\"] = 255] = \"SEPARATOR\"; // Zero-length TLV that separates different TLVs in a list.\n})(TLVValues = exports.TLVValues || (exports.TLVValues = {}));\n/**\n * @group HAP Accessory Server\n */\nvar PairMethods;\n(function (PairMethods) {\n // noinspection JSUnusedGlobalSymbols\n PairMethods[PairMethods[\"PAIR_SETUP\"] = 0] = \"PAIR_SETUP\";\n PairMethods[PairMethods[\"PAIR_SETUP_WITH_AUTH\"] = 1] = \"PAIR_SETUP_WITH_AUTH\";\n PairMethods[PairMethods[\"PAIR_VERIFY\"] = 2] = \"PAIR_VERIFY\";\n PairMethods[PairMethods[\"ADD_PAIRING\"] = 3] = \"ADD_PAIRING\";\n PairMethods[PairMethods[\"REMOVE_PAIRING\"] = 4] = \"REMOVE_PAIRING\";\n PairMethods[PairMethods[\"LIST_PAIRINGS\"] = 5] = \"LIST_PAIRINGS\";\n})(PairMethods = exports.PairMethods || (exports.PairMethods = {}));\n/**\n * Pairing states (pair-setup or pair-verify). Encoded in {@link TLVValues.SEQUENCE_NUM}.\n *\n * @group HAP Accessory Server\n */\nvar PairingStates;\n(function (PairingStates) {\n PairingStates[PairingStates[\"M1\"] = 1] = \"M1\";\n PairingStates[PairingStates[\"M2\"] = 2] = \"M2\";\n PairingStates[PairingStates[\"M3\"] = 3] = \"M3\";\n PairingStates[PairingStates[\"M4\"] = 4] = \"M4\";\n PairingStates[PairingStates[\"M5\"] = 5] = \"M5\";\n PairingStates[PairingStates[\"M6\"] = 6] = \"M6\";\n})(PairingStates = exports.PairingStates || (exports.PairingStates = {}));\n/**\n * @group HAP Accessory Server\n */\nvar HAPMimeTypes;\n(function (HAPMimeTypes) {\n HAPMimeTypes[\"PAIRING_TLV8\"] = \"application/pairing+tlv8\";\n HAPMimeTypes[\"HAP_JSON\"] = \"application/hap+json\";\n HAPMimeTypes[\"IMAGE_JPEG\"] = \"image/jpeg\";\n})(HAPMimeTypes = exports.HAPMimeTypes || (exports.HAPMimeTypes = {}));\n//# sourceMappingURL=internal-types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Accessory = exports.AccessoryEventTypes = exports.MDNSAdvertiser = exports.CharacteristicWarningType = exports.Categories = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar net_1 = tslib_1.__importDefault(require(\"net\"));\nvar Advertiser_1 = require(\"./Advertiser\");\n// noinspection JSDeprecatedSymbols\nvar camera_1 = require(\"./camera\");\nvar Characteristic_1 = require(\"./Characteristic\");\nvar controller_1 = require(\"./controller\");\nvar HAPServer_1 = require(\"./HAPServer\");\nvar AccessoryInfo_1 = require(\"./model/AccessoryInfo\");\nvar ControllerStorage_1 = require(\"./model/ControllerStorage\");\nvar IdentifierCache_1 = require(\"./model/IdentifierCache\");\nvar Service_1 = require(\"./Service\");\nvar clone_1 = require(\"./util/clone\");\nvar request_util_1 = require(\"./util/request-util\");\nvar uuid = tslib_1.__importStar(require(\"./util/uuid\"));\nvar uuid_1 = require(\"./util/uuid\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Accessory\");\nvar MAX_ACCESSORIES = 149; // Maximum number of bridged accessories per bridge.\nvar MAX_SERVICES = 100;\n/**\n * Known category values. Category is a hint to iOS clients about what \"type\" of Accessory this represents, for UI only.\n *\n * @group Accessory\n */\nvar Categories;\n(function (Categories) {\n // noinspection JSUnusedGlobalSymbols\n Categories[Categories[\"OTHER\"] = 1] = \"OTHER\";\n Categories[Categories[\"BRIDGE\"] = 2] = \"BRIDGE\";\n Categories[Categories[\"FAN\"] = 3] = \"FAN\";\n Categories[Categories[\"GARAGE_DOOR_OPENER\"] = 4] = \"GARAGE_DOOR_OPENER\";\n Categories[Categories[\"LIGHTBULB\"] = 5] = \"LIGHTBULB\";\n Categories[Categories[\"DOOR_LOCK\"] = 6] = \"DOOR_LOCK\";\n Categories[Categories[\"OUTLET\"] = 7] = \"OUTLET\";\n Categories[Categories[\"SWITCH\"] = 8] = \"SWITCH\";\n Categories[Categories[\"THERMOSTAT\"] = 9] = \"THERMOSTAT\";\n Categories[Categories[\"SENSOR\"] = 10] = \"SENSOR\";\n Categories[Categories[\"ALARM_SYSTEM\"] = 11] = \"ALARM_SYSTEM\";\n Categories[Categories[\"SECURITY_SYSTEM\"] = 11] = \"SECURITY_SYSTEM\";\n Categories[Categories[\"DOOR\"] = 12] = \"DOOR\";\n Categories[Categories[\"WINDOW\"] = 13] = \"WINDOW\";\n Categories[Categories[\"WINDOW_COVERING\"] = 14] = \"WINDOW_COVERING\";\n Categories[Categories[\"PROGRAMMABLE_SWITCH\"] = 15] = \"PROGRAMMABLE_SWITCH\";\n Categories[Categories[\"RANGE_EXTENDER\"] = 16] = \"RANGE_EXTENDER\";\n Categories[Categories[\"CAMERA\"] = 17] = \"CAMERA\";\n Categories[Categories[\"IP_CAMERA\"] = 17] = \"IP_CAMERA\";\n Categories[Categories[\"VIDEO_DOORBELL\"] = 18] = \"VIDEO_DOORBELL\";\n Categories[Categories[\"AIR_PURIFIER\"] = 19] = \"AIR_PURIFIER\";\n Categories[Categories[\"AIR_HEATER\"] = 20] = \"AIR_HEATER\";\n Categories[Categories[\"AIR_CONDITIONER\"] = 21] = \"AIR_CONDITIONER\";\n Categories[Categories[\"AIR_HUMIDIFIER\"] = 22] = \"AIR_HUMIDIFIER\";\n Categories[Categories[\"AIR_DEHUMIDIFIER\"] = 23] = \"AIR_DEHUMIDIFIER\";\n Categories[Categories[\"APPLE_TV\"] = 24] = \"APPLE_TV\";\n Categories[Categories[\"HOMEPOD\"] = 25] = \"HOMEPOD\";\n Categories[Categories[\"SPEAKER\"] = 26] = \"SPEAKER\";\n Categories[Categories[\"AIRPORT\"] = 27] = \"AIRPORT\";\n Categories[Categories[\"SPRINKLER\"] = 28] = \"SPRINKLER\";\n Categories[Categories[\"FAUCET\"] = 29] = \"FAUCET\";\n Categories[Categories[\"SHOWER_HEAD\"] = 30] = \"SHOWER_HEAD\";\n Categories[Categories[\"TELEVISION\"] = 31] = \"TELEVISION\";\n Categories[Categories[\"TARGET_CONTROLLER\"] = 32] = \"TARGET_CONTROLLER\";\n Categories[Categories[\"ROUTER\"] = 33] = \"ROUTER\";\n Categories[Categories[\"AUDIO_RECEIVER\"] = 34] = \"AUDIO_RECEIVER\";\n Categories[Categories[\"TV_SET_TOP_BOX\"] = 35] = \"TV_SET_TOP_BOX\";\n Categories[Categories[\"TV_STREAMING_STICK\"] = 36] = \"TV_STREAMING_STICK\";\n})(Categories = exports.Categories || (exports.Categories = {}));\n/**\n * @group Accessory\n */\nvar CharacteristicWarningType;\n(function (CharacteristicWarningType) {\n CharacteristicWarningType[\"SLOW_WRITE\"] = \"slow-write\";\n CharacteristicWarningType[\"TIMEOUT_WRITE\"] = \"timeout-write\";\n CharacteristicWarningType[\"SLOW_READ\"] = \"slow-read\";\n CharacteristicWarningType[\"TIMEOUT_READ\"] = \"timeout-read\";\n CharacteristicWarningType[\"WARN_MESSAGE\"] = \"warn-message\";\n CharacteristicWarningType[\"ERROR_MESSAGE\"] = \"error-message\";\n CharacteristicWarningType[\"DEBUG_MESSAGE\"] = \"debug-message\";\n})(CharacteristicWarningType = exports.CharacteristicWarningType || (exports.CharacteristicWarningType = {}));\n/**\n * @group Accessory\n */\nvar MDNSAdvertiser;\n(function (MDNSAdvertiser) {\n /**\n * Use the `@homebridge/ciao` module as advertiser.\n */\n MDNSAdvertiser[\"CIAO\"] = \"ciao\";\n /**\n * Use the `bonjour-hap` module as advertiser.\n */\n MDNSAdvertiser[\"BONJOUR\"] = \"bonjour-hap\";\n /**\n * Use Avahi/D-Bus as advertiser.\n */\n MDNSAdvertiser[\"AVAHI\"] = \"avahi\";\n /**\n * Use systemd-resolved/D-Bus as advertiser.\n *\n * Note: The systemd-resolved D-Bus interface doesn't provide means to detect restarts of the service.\n * Therefore, we can't detect if our advertisement might be lost due to a restart of the systemd-resolved daemon restart.\n * Consequentially, treat this feature as an experimental feature.\n */\n MDNSAdvertiser[\"RESOLVED\"] = \"resolved\";\n})(MDNSAdvertiser = exports.MDNSAdvertiser || (exports.MDNSAdvertiser = {}));\nvar WriteRequestState;\n(function (WriteRequestState) {\n WriteRequestState[WriteRequestState[\"REGULAR_REQUEST\"] = 0] = \"REGULAR_REQUEST\";\n WriteRequestState[WriteRequestState[\"TIMED_WRITE_AUTHENTICATED\"] = 1] = \"TIMED_WRITE_AUTHENTICATED\";\n WriteRequestState[WriteRequestState[\"TIMED_WRITE_REJECTED\"] = 2] = \"TIMED_WRITE_REJECTED\";\n})(WriteRequestState || (WriteRequestState = {}));\n/**\n * @group Accessory\n */\nvar AccessoryEventTypes;\n(function (AccessoryEventTypes) {\n /**\n * Emitted when an iOS device wishes for this Accessory to identify itself. If `paired` is false, then\n * this device is currently browsing for Accessories in the system-provided \"Add Accessory\" screen. If\n * `paired` is true, then this is a device that has already paired with us. Note that if `paired` is true,\n * listening for this event is a shortcut for the underlying mechanism of setting the `Identify` Characteristic:\n * `getService(Service.AccessoryInformation).getCharacteristic(Characteristic.Identify).on('set', ...)`\n * You must call the callback for identification to be successful.\n */\n AccessoryEventTypes[\"IDENTIFY\"] = \"identify\";\n /**\n * This event is emitted once the HAP TCP socket is bound.\n * At this point the mdns advertisement isn't yet available. Use the {@link ADVERTISED} if you require the accessory to be discoverable.\n */\n AccessoryEventTypes[\"LISTENING\"] = \"listening\";\n /**\n * This event is emitted once the mDNS suite has fully advertised the presence of the accessory.\n * This event is guaranteed to be called after {@link LISTENING}.\n */\n AccessoryEventTypes[\"ADVERTISED\"] = \"advertised\";\n AccessoryEventTypes[\"SERVICE_CONFIGURATION_CHANGE\"] = \"service-configurationChange\";\n /**\n * Emitted after a change in the value of one of the provided Service's Characteristics.\n */\n AccessoryEventTypes[\"SERVICE_CHARACTERISTIC_CHANGE\"] = \"service-characteristic-change\";\n AccessoryEventTypes[\"PAIRED\"] = \"paired\";\n AccessoryEventTypes[\"UNPAIRED\"] = \"unpaired\";\n AccessoryEventTypes[\"CHARACTERISTIC_WARNING\"] = \"characteristic-warning\";\n})(AccessoryEventTypes = exports.AccessoryEventTypes || (exports.AccessoryEventTypes = {}));\n/**\n * Accessory is a virtual HomeKit device. It can publish an associated HAP server for iOS devices to communicate\n * with - or it can run behind another \"Bridge\" Accessory server.\n *\n * Bridged Accessories in this implementation must have a UUID that is unique among all other Accessories that\n * are hosted by the Bridge. This UUID must be \"stable\" and unchanging, even when the server is restarted. This\n * is required so that the Bridge can provide consistent \"Accessory IDs\" (aid) and \"Instance IDs\" (iid) for all\n * Accessories, Services, and Characteristics for iOS clients to reference later.\n *\n * @group Accessory\n */\nvar Accessory = /** @class */ (function (_super) {\n tslib_1.__extends(Accessory, _super);\n function Accessory(displayName, UUID) {\n var _this = _super.call(this) || this;\n _this.displayName = displayName;\n _this.UUID = UUID;\n // NOTICE: when adding/changing properties, remember to possibly adjust the serialize/deserialize functions\n _this.aid = null; // assigned by us in assignIDs() or by a Bridge\n _this._isBridge = false; // true if we are a Bridge (creating a new instance of the Bridge subclass sets this to true)\n _this.bridged = false; // true if we are hosted \"behind\" a Bridge Accessory\n _this.bridgedAccessories = []; // If we are a Bridge, these are the Accessories we are bridging\n _this.reachable = true;\n _this.category = 1 /* Categories.OTHER */;\n _this.services = [];\n _this.shouldPurgeUnusedIDs = true; // Purge unused ids by default\n /**\n * Captures if initialization steps inside {@link publish} have been called.\n * This is important when calling {@link publish} multiple times (e.g. after calling {@link unpublish}).\n * @private Private API\n */\n _this.initialized = false;\n _this.controllers = {};\n /**\n * @private Private API.\n */\n _this._setupID = null;\n /**\n * @private Private API.\n */\n _this.controllerStorage = new ControllerStorage_1.ControllerStorage(_this);\n /**\n * This property captures the time when we last served a /accessories request.\n * For multiple bursts of /accessories request we don't want to always contact GET handlers\n */\n _this.lastAccessoriesRequest = 0;\n /**\n * Returns the bridging accessory if this accessory is bridged.\n * Otherwise, returns itself.\n *\n * @returns the primary accessory\n */\n _this.getPrimaryAccessory = function () {\n return _this.bridged ? _this.bridge : _this;\n };\n (0, assert_1.default)(displayName, \"Accessories must be created with a non-empty displayName.\");\n (0, assert_1.default)(UUID, \"Accessories must be created with a valid UUID.\");\n (0, assert_1.default)(uuid.isValid(UUID), \"UUID '\" + UUID + \"' is not a valid UUID. Try using the provided 'generateUUID' function to create a \" +\n \"valid UUID from any arbitrary string, like a serial number.\");\n // create our initial \"Accessory Information\" Service that all Accessories are expected to have\n _this.addService(Service_1.Service.AccessoryInformation)\n .setCharacteristic(Characteristic_1.Characteristic.Name, displayName);\n // sign up for when iOS attempts to \"set\" the `Identify` characteristic - this means a paired device wishes\n // for us to identify ourselves (as opposed to an unpaired device - that case is handled by HAPServer 'identify' event)\n _this.getService(Service_1.Service.AccessoryInformation)\n .getCharacteristic(Characteristic_1.Characteristic.Identify)\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n if (value) {\n var paired = true;\n _this.identificationRequest(paired, callback);\n }\n });\n return _this;\n }\n Accessory.prototype.identificationRequest = function (paired, callback) {\n debug(\"[%s] Identification request\", this.displayName);\n if (this.listeners(\"identify\" /* AccessoryEventTypes.IDENTIFY */).length > 0) {\n // allow implementors to identify this Accessory in whatever way is appropriate, and pass along\n // the standard callback for completion.\n this.emit(\"identify\" /* AccessoryEventTypes.IDENTIFY */, paired, callback);\n }\n else {\n debug(\"[%s] Identification request ignored; no listeners to 'identify' event\", this.displayName);\n callback();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Accessory.prototype.addService = function (serviceParam) {\n var e_1, _a;\n var constructorArgs = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n constructorArgs[_i - 1] = arguments[_i];\n }\n // service might be a constructor like `Service.AccessoryInformation` instead of an instance\n // of Service. Coerce if necessary.\n var service = typeof serviceParam === \"function\"\n ? new serviceParam(constructorArgs[0], constructorArgs[1], constructorArgs[2])\n : serviceParam;\n try {\n // check for UUID+subtype conflict\n for (var _b = tslib_1.__values(this.services), _c = _b.next(); !_c.done; _c = _b.next()) {\n var existing = _c.value;\n if (existing.UUID === service.UUID) {\n // OK we have two Services with the same UUID. Check that each defines a `subtype` property and that each is unique.\n if (!service.subtype) {\n throw new Error(\"Cannot add a Service with the same UUID '\" + existing.UUID +\n \"' as another Service in this Accessory without also defining a unique 'subtype' property.\");\n }\n if (service.subtype === existing.subtype) {\n throw new Error(\"Cannot add a Service with the same UUID '\" + existing.UUID +\n \"' and subtype '\" + existing.subtype + \"' as another Service in this Accessory.\");\n }\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (this.services.length >= MAX_SERVICES) {\n throw new Error(\"Cannot add more than \" + MAX_SERVICES + \" services to a single accessory!\");\n }\n this.services.push(service);\n if (service.isPrimaryService) { // check if a primary service was added\n if (this.primaryService !== undefined) {\n this.primaryService.isPrimaryService = false;\n }\n this.primaryService = service;\n }\n if (!this.bridged) {\n this.enqueueConfigurationUpdate();\n }\n else {\n this.emit(\"service-configurationChange\" /* AccessoryEventTypes.SERVICE_CONFIGURATION_CHANGE */, { service: service });\n }\n this.setupServiceEventHandlers(service);\n return service;\n };\n /**\n * @deprecated use {@link Service.setPrimaryService} directly\n */\n Accessory.prototype.setPrimaryService = function (service) {\n service.setPrimaryService();\n };\n Accessory.prototype.removeService = function (service) {\n var index = this.services.indexOf(service);\n if (index >= 0) {\n this.services.splice(index, 1);\n if (this.primaryService === service) { // check if we are removing out primary service\n this.primaryService = undefined;\n }\n this.removeLinkedService(service); // remove it from linked service entries on the local accessory\n if (!this.bridged) {\n this.enqueueConfigurationUpdate();\n }\n else {\n this.emit(\"service-configurationChange\" /* AccessoryEventTypes.SERVICE_CONFIGURATION_CHANGE */, { service: service });\n }\n service.removeAllListeners();\n }\n };\n Accessory.prototype.removeLinkedService = function (removed) {\n var e_2, _a;\n try {\n for (var _b = tslib_1.__values(this.services), _c = _b.next(); !_c.done; _c = _b.next()) {\n var service = _c.value;\n service.removeLinkedService(removed);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n Accessory.prototype.getService = function (name) {\n var e_3, _a;\n try {\n for (var _b = tslib_1.__values(this.services), _c = _b.next(); !_c.done; _c = _b.next()) {\n var service = _c.value;\n if (typeof name === \"string\" && (service.displayName === name || service.name === name || service.subtype === name)) {\n return service;\n }\n else if (typeof name === \"function\" && ((service instanceof name) || (name.UUID === service.UUID))) {\n return service;\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n return undefined;\n };\n Accessory.prototype.getServiceById = function (uuid, subType) {\n var e_4, _a;\n try {\n for (var _b = tslib_1.__values(this.services), _c = _b.next(); !_c.done; _c = _b.next()) {\n var service = _c.value;\n if (typeof uuid === \"string\" && (service.displayName === uuid || service.name === uuid) && service.subtype === subType) {\n return service;\n }\n else if (typeof uuid === \"function\" && ((service instanceof uuid) || (uuid.UUID === service.UUID)) && service.subtype === subType) {\n return service;\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n return undefined;\n };\n /**\n * @deprecated Not supported anymore\n */\n Accessory.prototype.updateReachability = function (reachable) {\n if (!this.bridged) {\n throw new Error(\"Cannot update reachability on non-bridged accessory!\");\n }\n this.reachable = reachable;\n debug(\"Reachability update is no longer being supported.\");\n };\n Accessory.prototype.addBridgedAccessory = function (accessory, deferUpdate) {\n var _this = this;\n if (deferUpdate === void 0) { deferUpdate = false; }\n if (accessory._isBridge || accessory === this) {\n throw new Error(\"Illegal state: either trying to bridge a bridge or trying to bridge itself!\");\n }\n if (accessory.initialized) {\n throw new Error(\"Tried to bridge an accessory which was already published once!\");\n }\n if (accessory.bridge != null) {\n // this also prevents that we bridge the same accessory twice!\n throw new Error(\"Tried to bridge \" + accessory.displayName + \" while it was already bridged by \" + accessory.bridge.displayName);\n }\n if (this.bridgedAccessories.length >= MAX_ACCESSORIES) {\n throw new Error(\"Cannot Bridge more than \" + MAX_ACCESSORIES + \" Accessories\");\n }\n // listen for changes in ANY characteristics of ANY services on this Accessory\n accessory.on(\"service-characteristic-change\" /* AccessoryEventTypes.SERVICE_CHARACTERISTIC_CHANGE */, function (change) { return _this.handleCharacteristicChangeEvent(accessory, change.service, change); });\n accessory.on(\"service-configurationChange\" /* AccessoryEventTypes.SERVICE_CONFIGURATION_CHANGE */, this.enqueueConfigurationUpdate.bind(this));\n accessory.on(\"characteristic-warning\" /* AccessoryEventTypes.CHARACTERISTIC_WARNING */, this.handleCharacteristicWarning.bind(this));\n accessory.bridged = true;\n accessory.bridge = this;\n this.bridgedAccessories.push(accessory);\n this.controllerStorage.linkAccessory(accessory); // init controllers of bridged accessory\n if (!deferUpdate) {\n this.enqueueConfigurationUpdate();\n }\n return accessory;\n };\n Accessory.prototype.addBridgedAccessories = function (accessories) {\n var e_5, _a;\n try {\n for (var accessories_1 = tslib_1.__values(accessories), accessories_1_1 = accessories_1.next(); !accessories_1_1.done; accessories_1_1 = accessories_1.next()) {\n var accessory = accessories_1_1.value;\n this.addBridgedAccessory(accessory, true);\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (accessories_1_1 && !accessories_1_1.done && (_a = accessories_1.return)) _a.call(accessories_1);\n }\n finally { if (e_5) throw e_5.error; }\n }\n this.enqueueConfigurationUpdate();\n };\n Accessory.prototype.removeBridgedAccessory = function (accessory, deferUpdate) {\n if (deferUpdate === void 0) { deferUpdate = false; }\n // check for UUID conflict\n var accessoryIndex = this.bridgedAccessories.indexOf(accessory);\n if (accessoryIndex === -1) {\n throw new Error(\"Cannot find the bridged Accessory to remove.\");\n }\n this.bridgedAccessories.splice(accessoryIndex, 1);\n accessory.bridged = false;\n accessory.bridge = undefined;\n accessory.removeAllListeners();\n if (!deferUpdate) {\n this.enqueueConfigurationUpdate();\n }\n };\n Accessory.prototype.removeBridgedAccessories = function (accessories) {\n var e_6, _a;\n try {\n for (var accessories_2 = tslib_1.__values(accessories), accessories_2_1 = accessories_2.next(); !accessories_2_1.done; accessories_2_1 = accessories_2.next()) {\n var accessory = accessories_2_1.value;\n this.removeBridgedAccessory(accessory, true);\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (accessories_2_1 && !accessories_2_1.done && (_a = accessories_2.return)) _a.call(accessories_2);\n }\n finally { if (e_6) throw e_6.error; }\n }\n this.enqueueConfigurationUpdate();\n };\n Accessory.prototype.removeAllBridgedAccessories = function () {\n for (var i = this.bridgedAccessories.length - 1; i >= 0; i--) {\n this.removeBridgedAccessory(this.bridgedAccessories[i], true);\n }\n this.enqueueConfigurationUpdate();\n };\n Accessory.prototype.getCharacteristicByIID = function (iid) {\n var e_7, _a;\n try {\n for (var _b = tslib_1.__values(this.services), _c = _b.next(); !_c.done; _c = _b.next()) {\n var service = _c.value;\n var characteristic = service.getCharacteristicByIID(iid);\n if (characteristic) {\n return characteristic;\n }\n }\n }\n catch (e_7_1) { e_7 = { error: e_7_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_7) throw e_7.error; }\n }\n };\n Accessory.prototype.getAccessoryByAID = function (aid) {\n if (this.aid === aid) {\n return this;\n }\n return this.bridgedAccessories.find(function (value) { return value.aid === aid; });\n };\n Accessory.prototype.findCharacteristic = function (aid, iid) {\n var accessory = this.getAccessoryByAID(aid);\n return accessory && accessory.getCharacteristicByIID(iid);\n };\n // noinspection JSDeprecatedSymbols\n /**\n * Method is used to configure an old style CameraSource.\n * The CameraSource API was fully replaced by the new Controller API used by {@link CameraController}.\n * The {@link CameraStreamingDelegate} used by the CameraController is the equivalent to the old CameraSource.\n *\n * The new Controller API is much more refined and robust way of \"grouping\" services together.\n * It especially is intended to fully support serialization/deserialization to/from persistent storage.\n * This feature is also gained when using the old style CameraSource API.\n * The {@link CameraStreamingDelegate} improves on the overall camera API though and provides some reworked\n * type definitions and a refined callback interface to better signal errors to the requesting HomeKit device.\n * It is advised to update to it.\n *\n * Full backwards compatibility is currently maintained. A legacy CameraSource will be wrapped into an Adapter.\n * All legacy StreamControllers in the \"streamControllers\" property will be replaced by CameraRTPManagement instances.\n * Any services in the \"services\" property which are one of the following are ignored:\n * - CameraRTPStreamManagement\n * - CameraOperatingMode\n * - CameraEventRecordingManagement\n *\n * @param cameraSource - The instance of the legacy camera source\n * @deprecated please refer to the new {@link CameraController} API and {@link configureController}\n */\n Accessory.prototype.configureCameraSource = function (cameraSource) {\n var _this = this;\n if (cameraSource.streamControllers.length === 0) {\n throw new Error(\"Malformed legacy CameraSource. Did not expose any StreamControllers!\");\n }\n var options = cameraSource.streamControllers[0].options; // grab options from one of the StreamControllers\n var cameraControllerOptions = {\n cameraStreamCount: cameraSource.streamControllers.length,\n streamingOptions: options,\n delegate: new camera_1.LegacyCameraSourceAdapter(cameraSource),\n };\n var cameraController = new controller_1.CameraController(cameraControllerOptions, true); // create CameraController in legacy mode\n this.configureController(cameraController);\n // we try here to be as good as possibly of keeping current behaviour\n cameraSource.services.forEach(function (service) {\n if (service.UUID === Service_1.Service.CameraRTPStreamManagement.UUID || service.UUID === Service_1.Service.CameraOperatingMode.UUID\n || service.UUID === Service_1.Service.CameraRecordingManagement.UUID) {\n return; // ignore those services, as they get replaced by the RTPStreamManagement\n }\n // all other services get added. We can't really control possibly linking to any of those ignored services\n // so this is really only half-baked stuff.\n _this.addService(service);\n });\n // replace stream controllers; basically only to still support the \"forceStop\" call\n // noinspection JSDeprecatedSymbols\n cameraSource.streamControllers = cameraController.streamManagements;\n return cameraController; // return the reference for the controller (maybe this could be useful?)\n };\n /**\n * This method is used to set up a new Controller for this accessory. See {@link Controller} for a more detailed\n * explanation what a Controller is and what it is capable of.\n *\n * The controller can be passed as an instance of the class or as a constructor (without any necessary parameters)\n * for a new Controller.\n * Only one Controller of a given {@link ControllerIdentifier} can be configured for a given Accessory.\n *\n * When called, it will be checked if there are any services and persistent data the Controller (for the given\n * {@link ControllerIdentifier}) can be restored from. Otherwise, the Controller will be created with new services.\n *\n *\n * @param controllerConstructor - The Controller instance or constructor to the Controller with no required arguments.\n */\n Accessory.prototype.configureController = function (controllerConstructor) {\n var _this = this;\n var controller = typeof controllerConstructor === \"function\"\n ? new controllerConstructor() // any custom constructor arguments should be passed before using .bind(...)\n : controllerConstructor;\n var id = controller.controllerId();\n if (this.controllers[id]) {\n throw new Error(\"A Controller with the type/id '\".concat(id, \"' was already added to the accessory \").concat(this.displayName));\n }\n var savedServiceMap = this.serializedControllers && this.serializedControllers[id];\n var serviceMap;\n if (savedServiceMap) { // we found data to restore from\n var clonedServiceMap = (0, clone_1.clone)(savedServiceMap);\n var updatedServiceMap = controller.initWithServices(savedServiceMap); // init controller with existing services\n serviceMap = updatedServiceMap || savedServiceMap; // initWithServices could return an updated serviceMap, otherwise just use the existing one\n if (updatedServiceMap) { // controller returned a ServiceMap and thus signaled an updated set of services\n // clonedServiceMap is altered by this method, should not be touched again after this call (for the future people)\n this.handleUpdatedControllerServiceMap(clonedServiceMap, updatedServiceMap);\n }\n controller.configureServices(); // let the controller setup all its handlers\n // remove serialized data from our dictionary:\n delete this.serializedControllers[id];\n if (Object.entries(this.serializedControllers).length === 0) {\n this.serializedControllers = undefined;\n }\n }\n else {\n serviceMap = controller.constructServices(); // let the controller create his services\n controller.configureServices(); // let the controller setup all its handlers\n Object.values(serviceMap).forEach(function (service) {\n if (service && !_this.services.includes(service)) {\n _this.addService(service);\n }\n });\n }\n // --- init handlers and setup context ---\n var context = {\n controller: controller,\n serviceMap: serviceMap,\n };\n if ((0, controller_1.isSerializableController)(controller)) {\n this.controllerStorage.trackController(controller);\n }\n this.controllers[id] = context;\n if (controller instanceof controller_1.CameraController) { // save CameraController for Snapshot handling\n this.activeCameraController = controller;\n }\n };\n /**\n * This method will remove a given Controller from this accessory.\n * The controller object will be restored to its initial state.\n * This also means that any event handlers setup for the controller will be removed.\n *\n * @param controller - The controller which should be removed from the accessory.\n */\n Accessory.prototype.removeController = function (controller) {\n var _this = this;\n var id = controller.controllerId();\n var storedController = this.controllers[id];\n if (storedController) {\n if (storedController.controller !== controller) {\n throw new Error(\"[\" + this.displayName + \"] tried removing a controller with the id/type '\" + id +\n \"' though provided controller isn't the same instance that is registered!\");\n }\n if ((0, controller_1.isSerializableController)(controller)) {\n // this will reset the state change delegate before we call handleControllerRemoved()\n this.controllerStorage.untrackController(controller);\n }\n if (controller.handleFactoryReset) {\n controller.handleFactoryReset();\n }\n controller.handleControllerRemoved();\n delete this.controllers[id];\n if (this.activeCameraController === controller) {\n this.activeCameraController = undefined;\n }\n Object.values(storedController.serviceMap).forEach(function (service) {\n if (service) {\n _this.removeService(service);\n }\n });\n }\n if (this.serializedControllers) {\n delete this.serializedControllers[id];\n }\n };\n Accessory.prototype.handleAccessoryUnpairedForControllers = function () {\n var e_8, _a;\n try {\n for (var _b = tslib_1.__values(Object.values(this.controllers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var context = _c.value;\n var controller = context.controller;\n if (controller.handleFactoryReset) { // if the controller implements handleFactoryReset, setup event handlers for this controller\n controller.handleFactoryReset();\n }\n if ((0, controller_1.isSerializableController)(controller)) {\n this.controllerStorage.purgeControllerData(controller);\n }\n }\n }\n catch (e_8_1) { e_8 = { error: e_8_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_8) throw e_8.error; }\n }\n };\n Accessory.prototype.handleUpdatedControllerServiceMap = function (originalServiceMap, updatedServiceMap) {\n var _this = this;\n updatedServiceMap = (0, clone_1.clone)(updatedServiceMap); // clone it so we can alter it\n Object.keys(originalServiceMap).forEach(function (name) {\n var service = originalServiceMap[name];\n var updatedService = updatedServiceMap[name];\n if (service && updatedService) { // we check all names contained in both ServiceMaps for changes\n delete originalServiceMap[name]; // delete from original ServiceMap, so it will only contain deleted services at the end\n delete updatedServiceMap[name]; // delete from updated ServiceMap, so it will only contain added services at the end\n if (service !== updatedService) {\n _this.removeService(service);\n _this.addService(updatedService);\n }\n }\n });\n // now originalServiceMap contains only deleted services and updateServiceMap only added services\n Object.values(originalServiceMap).forEach(function (service) {\n if (service) {\n _this.removeService(service);\n }\n });\n Object.values(updatedServiceMap).forEach(function (service) {\n if (service) {\n _this.addService(service);\n }\n });\n };\n Accessory.prototype.setupURI = function () {\n if (this._setupURI) {\n return this._setupURI;\n }\n (0, assert_1.default)(!!this._accessoryInfo, \"Cannot generate setupURI on an accessory that isn't published yet!\");\n var buffer = Buffer.alloc(8);\n var value_low = parseInt(this._accessoryInfo.pincode.replace(/-/g, \"\"), 10);\n var value_high = this._accessoryInfo.category >> 1;\n value_low |= 1 << 28; // Supports IP;\n buffer.writeUInt32BE(value_low, 4);\n if (this._accessoryInfo.category & 1) {\n buffer[4] = buffer[4] | 1 << 7;\n }\n buffer.writeUInt32BE(value_high, 0);\n var encodedPayload = (buffer.readUInt32BE(4) + (buffer.readUInt32BE(0) * 0x100000000)).toString(36).toUpperCase();\n if (encodedPayload.length !== 9) {\n for (var i = 0; i <= 9 - encodedPayload.length; i++) {\n encodedPayload = \"0\" + encodedPayload;\n }\n }\n this._setupURI = \"X-HM://\" + encodedPayload + this._setupID;\n return this._setupURI;\n };\n /**\n * This method is called right before the accessory is published. It should be used to check for common\n * mistakes in Accessory structured, which may lead to HomeKit rejecting the accessory when pairing.\n * If it is called on a bridge it will call this method for all bridged accessories.\n */\n Accessory.prototype.validateAccessory = function (mainAccessory) {\n var _this = this;\n var service = this.getService(Service_1.Service.AccessoryInformation);\n if (!service) {\n console.log(\"HAP-NodeJS WARNING: The accessory '\" + this.displayName + \"' is getting published without a AccessoryInformation service. \" +\n \"This might prevent the accessory from being added to the Home app or leading to the accessory being unresponsive!\");\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var checkValue = function (name, value) {\n if (!value) {\n console.log(\"HAP-NodeJS WARNING: The accessory '\" + _this.displayName + \"' is getting published with the characteristic '\" + name + \"'\" +\n \" (of the AccessoryInformation service) not having a value set. \" +\n \"This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!\");\n }\n };\n var model = service.getCharacteristic(Characteristic_1.Characteristic.Model).value;\n var serialNumber = service.getCharacteristic(Characteristic_1.Characteristic.SerialNumber).value;\n var firmwareRevision = service.getCharacteristic(Characteristic_1.Characteristic.FirmwareRevision).value;\n var name = service.getCharacteristic(Characteristic_1.Characteristic.Name).value;\n checkValue(\"Model\", model);\n checkValue(\"SerialNumber\", serialNumber);\n checkValue(\"FirmwareRevision\", firmwareRevision);\n checkValue(\"Name\", name);\n }\n if (mainAccessory) {\n // the main accessory which is advertised via bonjour must have a name with length <= 63 (limitation of DNS FQDN names)\n (0, assert_1.default)(Buffer.from(this.displayName, \"utf8\").length <= 63, \"Accessory displayName cannot be longer than 63 bytes!\");\n }\n if (this.bridged) {\n this.bridgedAccessories.forEach(function (accessory) { return accessory.validateAccessory(); });\n }\n };\n /**\n * Assigns aid/iid to ourselves, any Accessories we are bridging, and all associated Services+Characteristics. Uses\n * the provided identifierCache to keep IDs stable.\n * @private Private API\n */\n Accessory.prototype._assignIDs = function (identifierCache) {\n var e_9, _a, e_10, _b;\n // if we are responsible for our own identifierCache, start the expiration process\n // also check weather we want to have an expiration process\n if (this._identifierCache && this.shouldPurgeUnusedIDs) {\n this._identifierCache.startTrackingUsage();\n }\n if (this.bridged) {\n // This Accessory is bridged, so it must have an aid > 1. Use the provided identifierCache to\n // fetch or assign one based on our UUID.\n this.aid = identifierCache.getAID(this.UUID);\n }\n else {\n // Since this Accessory is the server (as opposed to any Accessories that may be bridged behind us),\n // we must have aid = 1\n this.aid = 1;\n }\n try {\n for (var _c = tslib_1.__values(this.services), _d = _c.next(); !_d.done; _d = _c.next()) {\n var service = _d.value;\n if (this._isBridge) {\n service._assignIDs(identifierCache, this.UUID, 2000000000);\n }\n else {\n service._assignIDs(identifierCache, this.UUID);\n }\n }\n }\n catch (e_9_1) { e_9 = { error: e_9_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_9) throw e_9.error; }\n }\n try {\n // now assign IDs for any Accessories we are bridging\n for (var _e = tslib_1.__values(this.bridgedAccessories), _f = _e.next(); !_f.done; _f = _e.next()) {\n var accessory = _f.value;\n accessory._assignIDs(identifierCache);\n }\n }\n catch (e_10_1) { e_10 = { error: e_10_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n }\n finally { if (e_10) throw e_10.error; }\n }\n // expire any now-unused cache keys (for Accessories, Services, or Characteristics\n // that have been removed since the last call to assignIDs())\n if (this._identifierCache) {\n //Check weather we want to purge the unused ids\n if (this.shouldPurgeUnusedIDs) {\n this._identifierCache.stopTrackingUsageAndExpireUnused();\n }\n //Save in case we have new ones\n this._identifierCache.save();\n }\n };\n Accessory.prototype.disableUnusedIDPurge = function () {\n this.shouldPurgeUnusedIDs = false;\n };\n Accessory.prototype.enableUnusedIDPurge = function () {\n this.shouldPurgeUnusedIDs = true;\n };\n /**\n * Manually purge the unused ids if you like, comes handy\n * when you have disabled auto purge, so you can do it manually\n */\n Accessory.prototype.purgeUnusedIDs = function () {\n //Cache the state of the purge mechanism and set it to true\n var oldValue = this.shouldPurgeUnusedIDs;\n this.shouldPurgeUnusedIDs = true;\n //Reassign all ids\n this._assignIDs(this._identifierCache);\n // Revert the purge mechanism state\n this.shouldPurgeUnusedIDs = oldValue;\n };\n /**\n * Returns a JSON representation of this accessory suitable for delivering to HAP clients.\n */\n Accessory.prototype.toHAP = function (connection, contactGetHandlers) {\n if (contactGetHandlers === void 0) { contactGetHandlers = true; }\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var accessory, accessories, _a, _b, _c, _d;\n var _e;\n return tslib_1.__generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n (0, assert_1.default)(this.aid, \"aid cannot be undefined for accessory '\" + this.displayName + \"'\");\n (0, assert_1.default)(this.services.length, \"accessory '\" + this.displayName + \"' does not have any services!\");\n _e = {\n aid: this.aid\n };\n return [4 /*yield*/, Promise.all(this.services.map(function (service) { return service.toHAP(connection, contactGetHandlers); }))];\n case 1:\n accessory = (_e.services = _f.sent(),\n _e);\n accessories = [accessory];\n if (!!this.bridged) return [3 /*break*/, 3];\n _b = (_a = accessories.push).apply;\n _c = [accessories];\n _d = [[]];\n return [4 /*yield*/, Promise.all(this.bridgedAccessories\n .map(function (accessory) { return accessory.toHAP(connection, contactGetHandlers).then(function (value) { return value[0]; }); }))];\n case 2:\n _b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [_f.sent()]), false]))]));\n _f.label = 3;\n case 3: return [2 /*return*/, accessories];\n }\n });\n });\n };\n /**\n * Returns a JSON representation of this accessory without characteristic values.\n */\n Accessory.prototype.internalHAPRepresentation = function (assignIds) {\n var e_11, _a;\n if (assignIds === void 0) { assignIds = true; }\n if (assignIds) {\n this._assignIDs(this._identifierCache); // make sure our aid/iid's are all assigned\n }\n (0, assert_1.default)(this.aid, \"aid cannot be undefined for accessory '\" + this.displayName + \"'\");\n (0, assert_1.default)(this.services.length, \"accessory '\" + this.displayName + \"' does not have any services!\");\n var accessory = {\n aid: this.aid,\n services: this.services.map(function (service) { return service.internalHAPRepresentation(); }),\n };\n var accessories = [accessory];\n if (!this.bridged) {\n try {\n for (var _b = tslib_1.__values(this.bridgedAccessories), _c = _b.next(); !_c.done; _c = _b.next()) {\n var accessory_1 = _c.value;\n accessories.push(accessory_1.internalHAPRepresentation(false)[0]);\n }\n }\n catch (e_11_1) { e_11 = { error: e_11_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_11) throw e_11.error; }\n }\n }\n return accessories;\n };\n /**\n * Publishes this accessory on the local network for iOS clients to communicate with.\n * - `info.username` - formatted as a MAC address, like `CC:22:3D:E3:CE:F6`, of this accessory.\n * Must be globally unique from all Accessories on your local network.\n * - `info.pincode` - the 8-digit pin code for clients to use when pairing this Accessory.\n * Must be formatted as a string like `031-45-154`.\n * - `info.category` - one of the values of the `Accessory.Category` enum, like `Accessory.Category.SWITCH`.\n * This is a hint to iOS clients about what \"type\" of Accessory this represents, so\n * that for instance an appropriate icon can be drawn for the user while adding a\n * new Accessory.\n * @param {{\n * username: string;\n * pincode: string;\n * category: Accessory.Categories;\n * }} info - Required info for publishing.\n * @param {boolean} allowInsecureRequest - Will allow unencrypted and unauthenticated access to the http server\n */\n Accessory.prototype.publish = function (info, allowInsecureRequest) {\n var _a, _b, _c;\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var service, config, parsed, selectedAdvertiser, _d, _e, _f;\n var _this = this;\n return tslib_1.__generator(this, function (_g) {\n switch (_g.label) {\n case 0:\n if (this.bridged) {\n throw new Error(\"Can't publish in accessory which is bridged by another accessory. Bridged by \" + ((_a = this.bridge) === null || _a === void 0 ? void 0 : _a.displayName));\n }\n // noinspection JSDeprecatedSymbols\n if (!info.advertiser && info.useLegacyAdvertiser != null) {\n // noinspection JSDeprecatedSymbols\n info.advertiser = info.useLegacyAdvertiser ? \"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */ : \"ciao\" /* MDNSAdvertiser.CIAO */;\n console.warn(\"DEPRECATED The PublishInfo.useLegacyAdvertiser option has been removed. \" +\n \"Please use the PublishInfo.advertiser property to enable \\\"ciao\\\" (useLegacyAdvertiser=false) \" +\n \"or \\\"bonjour-hap\\\" (useLegacyAdvertiser=true) mdns advertiser libraries!\");\n }\n // noinspection JSDeprecatedSymbols\n if (info.mdns && info.advertiser !== \"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */) {\n console.log(\"DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. \" +\n \"Please move to the new 'bind' option.\");\n }\n service = this.getService(Service_1.Service.ProtocolInformation);\n if (!service) {\n service = this.addService(Service_1.Service.ProtocolInformation); // add the protocol information service to the primary accessory\n }\n service.setCharacteristic(Characteristic_1.Characteristic.Version, Advertiser_1.CiaoAdvertiser.protocolVersionService);\n if (this.lastKnownUsername && this.lastKnownUsername !== info.username) { // username changed since last publish\n Accessory.cleanupAccessoryData(this.lastKnownUsername); // delete old Accessory data\n }\n if (!this.initialized && ((_b = info.addIdentifyingMaterial) !== null && _b !== void 0 ? _b : true)) {\n // adding some identifying material to our displayName if it's our first publish() call\n this.displayName = this.displayName + \" \" + crypto_1.default.createHash(\"sha512\")\n .update(info.username, \"utf8\")\n .digest(\"hex\").slice(0, 4).toUpperCase();\n this.getService(Service_1.Service.AccessoryInformation).updateCharacteristic(Characteristic_1.Characteristic.Name, this.displayName);\n }\n // attempt to load existing AccessoryInfo from disk\n this._accessoryInfo = AccessoryInfo_1.AccessoryInfo.load(info.username);\n // if we don't have one, create a new one.\n if (!this._accessoryInfo) {\n debug(\"[%s] Creating new AccessoryInfo for our HAP server\", this.displayName);\n this._accessoryInfo = AccessoryInfo_1.AccessoryInfo.create(info.username);\n }\n if (info.setupID) {\n this._setupID = info.setupID;\n }\n else if (this._accessoryInfo.setupID === undefined || this._accessoryInfo.setupID === \"\") {\n this._setupID = Accessory._generateSetupID();\n }\n else {\n this._setupID = this._accessoryInfo.setupID;\n }\n this._accessoryInfo.setupID = this._setupID;\n // make sure we have up-to-date values in AccessoryInfo, then save it in case they changed (or if we just created it)\n this._accessoryInfo.displayName = this.displayName;\n this._accessoryInfo.model = this.getService(Service_1.Service.AccessoryInformation).getCharacteristic(Characteristic_1.Characteristic.Model).value;\n this._accessoryInfo.category = info.category || 1 /* Categories.OTHER */;\n this._accessoryInfo.pincode = info.pincode;\n this._accessoryInfo.save();\n // create our IdentifierCache, so we can provide clients with stable aid/iid's\n this._identifierCache = IdentifierCache_1.IdentifierCache.load(info.username);\n // if we don't have one, create a new one.\n if (!this._identifierCache) {\n debug(\"[%s] Creating new IdentifierCache\", this.displayName);\n this._identifierCache = new IdentifierCache_1.IdentifierCache(info.username);\n }\n // If it's bridge and there are no accessories already assigned to the bridge\n // probably purge is not needed since it's going to delete all the ids\n // of accessories that might be added later. Useful when dynamically adding\n // accessories.\n if (this._isBridge && this.bridgedAccessories.length === 0) {\n this.disableUnusedIDPurge();\n this.controllerStorage.purgeUnidentifiedAccessoryData = false;\n }\n if (!this.initialized) { // controller storage is only loaded from disk the first time we publish!\n this.controllerStorage.load(info.username); // initializing controller data\n }\n // assign aid/iid\n this._assignIDs(this._identifierCache);\n config = this.internalHAPRepresentation(false);\n // TODO queue this check until about 5 seconds after startup, allowing some last changes after the publish call\n // without constantly incrementing the current config number\n this._accessoryInfo.checkForCurrentConfigurationNumberIncrement(config, true);\n this.validateAccessory(true);\n parsed = Accessory.parseBindOption(info);\n selectedAdvertiser = (_c = info.advertiser) !== null && _c !== void 0 ? _c : \"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */;\n _e = info.advertiser === \"avahi\" /* MDNSAdvertiser.AVAHI */;\n if (!_e) return [3 /*break*/, 2];\n return [4 /*yield*/, Advertiser_1.AvahiAdvertiser.isAvailable()];\n case 1:\n _e = !(_g.sent());\n _g.label = 2;\n case 2:\n _d = (_e);\n if (_d) return [3 /*break*/, 5];\n _f = info.advertiser === \"resolved\" /* MDNSAdvertiser.RESOLVED */;\n if (!_f) return [3 /*break*/, 4];\n return [4 /*yield*/, Advertiser_1.ResolvedAdvertiser.isAvailable()];\n case 3:\n _f = !(_g.sent());\n _g.label = 4;\n case 4:\n _d = (_f);\n _g.label = 5;\n case 5:\n if (_d) {\n console.error(\"[\".concat(this.displayName, \"] The selected advertiser, \\\"\").concat(info.advertiser, \"\\\", isn't available on this platform. \") +\n \"Reverting to \\\"\".concat(\"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */, \"\\\"\"));\n selectedAdvertiser = \"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */;\n }\n switch (selectedAdvertiser) {\n case \"ciao\" /* MDNSAdvertiser.CIAO */:\n this._advertiser = new Advertiser_1.CiaoAdvertiser(this._accessoryInfo, {\n interface: parsed.advertiserAddress,\n }, {\n restrictedAddresses: parsed.serviceRestrictedAddress,\n disabledIpv6: parsed.serviceDisableIpv6,\n });\n break;\n case \"bonjour-hap\" /* MDNSAdvertiser.BONJOUR */:\n // noinspection JSDeprecatedSymbols\n this._advertiser = new Advertiser_1.BonjourHAPAdvertiser(this._accessoryInfo, info.mdns, {\n restrictedAddresses: parsed.serviceRestrictedAddress,\n disabledIpv6: parsed.serviceDisableIpv6,\n });\n break;\n case \"avahi\" /* MDNSAdvertiser.AVAHI */:\n this._advertiser = new Advertiser_1.AvahiAdvertiser(this._accessoryInfo);\n break;\n case \"resolved\" /* MDNSAdvertiser.RESOLVED */:\n this._advertiser = new Advertiser_1.ResolvedAdvertiser(this._accessoryInfo);\n break;\n default:\n throw new Error(\"Unsupported advertiser setting: '\" + info.advertiser + \"'\");\n }\n this._advertiser.on(\"updated-name\" /* AdvertiserEvent.UPDATED_NAME */, function (name) {\n _this.displayName = name;\n if (_this._accessoryInfo) {\n _this._accessoryInfo.displayName = name;\n _this._accessoryInfo.save();\n }\n // bonjour service name MUST match the name in the accessory information service\n _this.getService(Service_1.Service.AccessoryInformation)\n .updateCharacteristic(Characteristic_1.Characteristic.Name, name);\n });\n // create our HAP server which handles all communication between iOS devices and us\n this._server = new HAPServer_1.HAPServer(this._accessoryInfo);\n this._server.allowInsecureRequest = !!allowInsecureRequest;\n this._server.on(\"listening\" /* HAPServerEventTypes.LISTENING */, this.onListening.bind(this));\n this._server.on(\"identify\" /* HAPServerEventTypes.IDENTIFY */, this.identificationRequest.bind(this, false));\n this._server.on(\"pair\" /* HAPServerEventTypes.PAIR */, this.handleInitialPairSetupFinished.bind(this));\n this._server.on(\"add-pairing\" /* HAPServerEventTypes.ADD_PAIRING */, this.handleAddPairing.bind(this));\n this._server.on(\"remove-pairing\" /* HAPServerEventTypes.REMOVE_PAIRING */, this.handleRemovePairing.bind(this));\n this._server.on(\"list-pairings\" /* HAPServerEventTypes.LIST_PAIRINGS */, this.handleListPairings.bind(this));\n this._server.on(\"accessories\" /* HAPServerEventTypes.ACCESSORIES */, this.handleAccessories.bind(this));\n this._server.on(\"get-characteristics\" /* HAPServerEventTypes.GET_CHARACTERISTICS */, this.handleGetCharacteristics.bind(this));\n this._server.on(\"set-characteristics\" /* HAPServerEventTypes.SET_CHARACTERISTICS */, this.handleSetCharacteristics.bind(this));\n this._server.on(\"connection-closed\" /* HAPServerEventTypes.CONNECTION_CLOSED */, this.handleHAPConnectionClosed.bind(this));\n this._server.on(\"request-resource\" /* HAPServerEventTypes.REQUEST_RESOURCE */, this.handleResource.bind(this));\n this._server.listen(info.port, parsed.serverAddress);\n this.initialized = true;\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Removes this Accessory from the local network\n * Accessory object will no longer valid after invoking this method\n * Trying to invoke publish() on the object will result undefined behavior\n */\n Accessory.prototype.destroy = function () {\n var promise = this.unpublish();\n if (this._accessoryInfo) {\n Accessory.cleanupAccessoryData(this._accessoryInfo.username);\n this._accessoryInfo = undefined;\n this._identifierCache = undefined;\n this.controllerStorage = new ControllerStorage_1.ControllerStorage(this);\n }\n this.removeAllListeners();\n return promise;\n };\n Accessory.prototype.unpublish = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this._server) {\n this._server.destroy();\n this._server = undefined;\n }\n if (!this._advertiser) return [3 /*break*/, 2];\n // noinspection JSIgnoredPromiseFromCall\n return [4 /*yield*/, this._advertiser.destroy()];\n case 1:\n // noinspection JSIgnoredPromiseFromCall\n _a.sent();\n this._advertiser = undefined;\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n Accessory.prototype.enqueueConfigurationUpdate = function () {\n var _this = this;\n if (this.configurationChangeDebounceTimeout) {\n return; // already enqueued\n }\n this.configurationChangeDebounceTimeout = setTimeout(function () {\n var _a;\n _this.configurationChangeDebounceTimeout = undefined;\n if (_this._advertiser && _this._advertiser) {\n // get our accessory information in HAP format and determine if our configuration (that is, our\n // Accessories/Services/Characteristics) has changed since the last time we were published. make\n // sure to omit actual values since these are not part of the \"configuration\".\n var config = _this.internalHAPRepresentation(); // TODO ensure this stuff is ordered\n if ((_a = _this._accessoryInfo) === null || _a === void 0 ? void 0 : _a.checkForCurrentConfigurationNumberIncrement(config)) {\n _this._advertiser.updateAdvertisement();\n }\n }\n }, 1000);\n this.configurationChangeDebounceTimeout.unref();\n // 1s is fine, HomeKit is built that with configuration updates no iid or aid conflicts occur.\n // Thus, the only thing happening when the txt update arrives late is already removed accessories/services\n // not responding or new accessories/services not yet shown\n };\n Accessory.prototype.onListening = function (port, hostname) {\n var _this = this;\n (0, assert_1.default)(this._advertiser, \"Advertiser wasn't created at onListening!\");\n // the HAP server is listening, so we can now start advertising our presence.\n this._advertiser.initPort(port);\n this._advertiser.startAdvertising()\n .then(function () { return _this.emit(\"advertised\" /* AccessoryEventTypes.ADVERTISED */); })\n .catch(function (reason) {\n console.error(\"Could not create mDNS advertisement. The HAP-Server won't be discoverable: \" + reason);\n if (reason.stack) {\n debug(\"Detailed error: \" + reason.stack);\n }\n });\n this.emit(\"listening\" /* AccessoryEventTypes.LISTENING */, port, hostname);\n };\n Accessory.prototype.handleInitialPairSetupFinished = function (username, publicKey, callback) {\n debug(\"[%s] Paired with client %s\", this.displayName, username);\n this._accessoryInfo && this._accessoryInfo.addPairedClient(username, publicKey, 1 /* PermissionTypes.ADMIN */);\n this._accessoryInfo && this._accessoryInfo.save();\n // update our advertisement, so it can pick up on the paired status of AccessoryInfo\n this._advertiser && this._advertiser.updateAdvertisement();\n callback();\n this.emit(\"paired\" /* AccessoryEventTypes.PAIRED */);\n };\n Accessory.prototype.handleAddPairing = function (connection, username, publicKey, permission, callback) {\n if (!this._accessoryInfo) {\n callback(6 /* TLVErrorCode.UNAVAILABLE */);\n return;\n }\n if (!this._accessoryInfo.hasAdminPermissions(connection.username)) {\n callback(2 /* TLVErrorCode.AUTHENTICATION */);\n return;\n }\n var existingKey = this._accessoryInfo.getClientPublicKey(username);\n if (existingKey) {\n if (existingKey.toString() !== publicKey.toString()) {\n callback(1 /* TLVErrorCode.UNKNOWN */);\n return;\n }\n this._accessoryInfo.updatePermission(username, permission);\n }\n else {\n this._accessoryInfo.addPairedClient(username, publicKey, permission);\n }\n this._accessoryInfo.save();\n // there should be no need to update advertisement\n callback(0);\n };\n Accessory.prototype.handleRemovePairing = function (connection, username, callback) {\n var e_12, _a;\n if (!this._accessoryInfo) {\n callback(6 /* TLVErrorCode.UNAVAILABLE */);\n return;\n }\n if (!this._accessoryInfo.hasAdminPermissions(connection.username)) {\n callback(2 /* TLVErrorCode.AUTHENTICATION */);\n return;\n }\n this._accessoryInfo.removePairedClient(connection, username);\n this._accessoryInfo.save();\n callback(0); // first of all ensure the pairing is removed before we advertise availability again\n if (!this._accessoryInfo.paired()) {\n this._advertiser && this._advertiser.updateAdvertisement();\n this.emit(\"unpaired\" /* AccessoryEventTypes.UNPAIRED */);\n this.handleAccessoryUnpairedForControllers();\n try {\n for (var _b = tslib_1.__values(this.bridgedAccessories), _c = _b.next(); !_c.done; _c = _b.next()) {\n var accessory = _c.value;\n accessory.handleAccessoryUnpairedForControllers();\n }\n }\n catch (e_12_1) { e_12 = { error: e_12_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_12) throw e_12.error; }\n }\n }\n };\n Accessory.prototype.handleListPairings = function (connection, callback) {\n if (!this._accessoryInfo) {\n callback(6 /* TLVErrorCode.UNAVAILABLE */);\n return;\n }\n if (!this._accessoryInfo.hasAdminPermissions(connection.username)) {\n callback(2 /* TLVErrorCode.AUTHENTICATION */);\n return;\n }\n callback(0, this._accessoryInfo.listPairings());\n };\n Accessory.prototype.handleAccessories = function (connection, callback) {\n var _this = this;\n this._assignIDs(this._identifierCache); // make sure our aid/iid's are all assigned\n var now = Date.now();\n var contactGetHandlers = now - this.lastAccessoriesRequest > 5000; // we query the latest value if last /accessories was more than 5s ago\n this.lastAccessoriesRequest = now;\n this.toHAP(connection, contactGetHandlers).then(function (value) {\n callback(undefined, {\n accessories: value,\n });\n }, function (reason) {\n console.error(\"[\" + _this.displayName + \"] /accessories request error with: \" + reason.stack);\n callback({ httpCode: 500 /* HAPHTTPCode.INTERNAL_SERVER_ERROR */, status: -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */ });\n });\n };\n Accessory.prototype.handleGetCharacteristics = function (connection, request, callback) {\n var e_13, _a;\n var _this = this;\n var characteristics = [];\n var response = { characteristics: characteristics };\n var missingCharacteristics = new Set(request.ids.map(function (id) { return id.aid + \".\" + id.iid; }));\n if (missingCharacteristics.size !== request.ids.length) {\n // if those sizes differ, we have duplicates and can't properly handle that\n callback({ httpCode: 422 /* HAPHTTPCode.UNPROCESSABLE_ENTITY */, status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ });\n return;\n }\n var timeout = setTimeout(function () {\n var e_14, _a;\n try {\n for (var missingCharacteristics_1 = tslib_1.__values(missingCharacteristics), missingCharacteristics_1_1 = missingCharacteristics_1.next(); !missingCharacteristics_1_1.done; missingCharacteristics_1_1 = missingCharacteristics_1.next()) {\n var id = missingCharacteristics_1_1.value;\n var split = id.split(\".\");\n var aid = parseInt(split[0], 10);\n var iid = parseInt(split[1], 10);\n var accessory = _this.getAccessoryByAID(aid);\n var characteristic = accessory.getCharacteristicByIID(iid);\n _this.sendCharacteristicWarning(characteristic, \"slow-read\" /* CharacteristicWarningType.SLOW_READ */, \"The read handler for the characteristic '\" +\n characteristic.displayName + \"' on the accessory '\" + accessory.displayName + \"' was slow to respond!\");\n }\n }\n catch (e_14_1) { e_14 = { error: e_14_1 }; }\n finally {\n try {\n if (missingCharacteristics_1_1 && !missingCharacteristics_1_1.done && (_a = missingCharacteristics_1.return)) _a.call(missingCharacteristics_1);\n }\n finally { if (e_14) throw e_14.error; }\n }\n // after a total of 10s we do no longer wait for a request to appear and just return status code timeout\n timeout = setTimeout(function () {\n var e_15, _a;\n timeout = undefined;\n try {\n for (var missingCharacteristics_2 = tslib_1.__values(missingCharacteristics), missingCharacteristics_2_1 = missingCharacteristics_2.next(); !missingCharacteristics_2_1.done; missingCharacteristics_2_1 = missingCharacteristics_2.next()) {\n var id = missingCharacteristics_2_1.value;\n var split = id.split(\".\");\n var aid = parseInt(split[0], 10);\n var iid = parseInt(split[1], 10);\n var accessory = _this.getAccessoryByAID(aid);\n var characteristic = accessory.getCharacteristicByIID(iid);\n _this.sendCharacteristicWarning(characteristic, \"timeout-read\" /* CharacteristicWarningType.TIMEOUT_READ */, \"The read handler for the characteristic '\" +\n characteristic.displayName + \"' on the accessory '\" + accessory.displayName + \"' didn't respond at all!. \" +\n \"Please check that you properly call the callback!\");\n characteristics.push({\n aid: aid,\n iid: iid,\n status: -70408 /* HAPStatus.OPERATION_TIMED_OUT */,\n });\n }\n }\n catch (e_15_1) { e_15 = { error: e_15_1 }; }\n finally {\n try {\n if (missingCharacteristics_2_1 && !missingCharacteristics_2_1.done && (_a = missingCharacteristics_2.return)) _a.call(missingCharacteristics_2);\n }\n finally { if (e_15) throw e_15.error; }\n }\n missingCharacteristics.clear();\n callback(undefined, response);\n }, Accessory.TIMEOUT_AFTER_WARNING);\n timeout.unref();\n }, Accessory.TIMEOUT_WARNING);\n timeout.unref();\n var _loop_1 = function (id) {\n var name = id.aid + \".\" + id.iid;\n this_1.handleCharacteristicRead(connection, id, request).then(function (value) {\n return tslib_1.__assign({ aid: id.aid, iid: id.iid }, value);\n }, function (reason) {\n console.error(\"[\".concat(_this.displayName, \"] Read request for characteristic \").concat(name, \" encountered an error: \").concat(reason.stack));\n return {\n aid: id.aid,\n iid: id.iid,\n status: -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */,\n };\n }).then(function (value) {\n if (!timeout) {\n return; // if timeout is undefined, response was already sent out\n }\n missingCharacteristics.delete(name);\n characteristics.push(value);\n if (missingCharacteristics.size === 0) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n callback(undefined, response);\n }\n });\n };\n var this_1 = this;\n try {\n for (var _b = tslib_1.__values(request.ids), _c = _b.next(); !_c.done; _c = _b.next()) {\n var id = _c.value;\n _loop_1(id);\n }\n }\n catch (e_13_1) { e_13 = { error: e_13_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_13) throw e_13.error; }\n }\n };\n Accessory.prototype.handleCharacteristicRead = function (connection, id, request) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var characteristic, verifiable;\n var _this = this;\n return tslib_1.__generator(this, function (_a) {\n characteristic = this.findCharacteristic(id.aid, id.iid);\n if (!characteristic) {\n debug(\"[%s] Could not find a Characteristic with aid of %s and iid of %s\", this.displayName, id.aid, id.iid);\n return [2 /*return*/, { status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }];\n }\n if (!characteristic.props.perms.includes(\"pr\" /* Perms.PAIRED_READ */)) { // check if read is allowed for this characteristic\n debug(\"[%s] Tried reading from characteristic which does not allow reading (aid of %s and iid of %s)\", this.displayName, id.aid, id.iid);\n return [2 /*return*/, { status: -70405 /* HAPStatus.WRITE_ONLY_CHARACTERISTIC */ }];\n }\n if (characteristic.props.adminOnlyAccess && characteristic.props.adminOnlyAccess.includes(0 /* Access.READ */)) {\n verifiable = this._accessoryInfo && connection.username;\n if (!verifiable) {\n debug(\"[%s] Could not verify admin permissions for Characteristic which requires admin permissions for reading (aid of %s and iid of %s)\", this.displayName, id.aid, id.iid);\n }\n if (!verifiable || !this._accessoryInfo.hasAdminPermissions(connection.username)) {\n return [2 /*return*/, { status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }];\n }\n }\n return [2 /*return*/, characteristic.handleGetRequest(connection).then(function (value) {\n value = (0, request_util_1.formatOutgoingCharacteristicValue)(value, characteristic.props);\n debug(\"[%s] Got Characteristic \\\"%s\\\" value: \\\"%s\\\"\", _this.displayName, characteristic.displayName, value);\n var data = {\n value: value == null ? null : value,\n };\n if (request.includeMeta) {\n data.format = characteristic.props.format;\n data.unit = characteristic.props.unit;\n data.minValue = characteristic.props.minValue;\n data.maxValue = characteristic.props.maxValue;\n data.minStep = characteristic.props.minStep;\n data.maxLen = characteristic.props.maxLen || characteristic.props.maxDataLen;\n }\n if (request.includePerms) {\n data.perms = characteristic.props.perms;\n }\n if (request.includeType) {\n data.type = (0, uuid_1.toShortForm)(characteristic.UUID);\n }\n if (request.includeEvent) {\n data.ev = connection.hasEventNotifications(id.aid, id.iid);\n }\n return data;\n }, function (reason) {\n // @ts-expect-error: preserveConstEnums compiler option\n debug(\"[%s] Error getting value for characteristic \\\"%s\\\": %s\", _this.displayName, characteristic.displayName, HAPServer_1.HAPStatus[reason]);\n return { status: reason };\n })];\n });\n });\n };\n Accessory.prototype.handleSetCharacteristics = function (connection, writeRequest, callback) {\n var e_16, _a;\n var _this = this;\n debug(\"[%s] Processing characteristic set: %s\", this.displayName, JSON.stringify(writeRequest));\n var writeState = 0 /* WriteRequestState.REGULAR_REQUEST */;\n if (writeRequest.pid !== undefined) { // check for timed writes\n if (connection.timedWritePid === writeRequest.pid) {\n writeState = 1 /* WriteRequestState.TIMED_WRITE_AUTHENTICATED */;\n clearTimeout(connection.timedWriteTimeout);\n connection.timedWritePid = undefined;\n connection.timedWriteTimeout = undefined;\n debug(\"[%s] Timed write request got acknowledged for pid %d\", this.displayName, writeRequest.pid);\n }\n else {\n writeState = 2 /* WriteRequestState.TIMED_WRITE_REJECTED */;\n debug(\"[%s] TTL for timed write request has probably expired for pid %d\", this.displayName, writeRequest.pid);\n }\n }\n var characteristics = [];\n var response = { characteristics: characteristics };\n var missingCharacteristics = new Set(writeRequest.characteristics\n .map(function (characteristic) { return characteristic.aid + \".\" + characteristic.iid; }));\n if (missingCharacteristics.size !== writeRequest.characteristics.length) {\n // if those sizes differ, we have duplicates and can't properly handle that\n callback({ httpCode: 422 /* HAPHTTPCode.UNPROCESSABLE_ENTITY */, status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ });\n return;\n }\n var timeout = setTimeout(function () {\n var e_17, _a;\n try {\n for (var missingCharacteristics_3 = tslib_1.__values(missingCharacteristics), missingCharacteristics_3_1 = missingCharacteristics_3.next(); !missingCharacteristics_3_1.done; missingCharacteristics_3_1 = missingCharacteristics_3.next()) {\n var id = missingCharacteristics_3_1.value;\n var split = id.split(\".\");\n var aid = parseInt(split[0], 10);\n var iid = parseInt(split[1], 10);\n var accessory = _this.getAccessoryByAID(aid);\n var characteristic = accessory.getCharacteristicByIID(iid);\n _this.sendCharacteristicWarning(characteristic, \"slow-write\" /* CharacteristicWarningType.SLOW_WRITE */, \"The write handler for the characteristic '\" +\n characteristic.displayName + \"' on the accessory '\" + accessory.displayName + \"' was slow to respond!\");\n }\n }\n catch (e_17_1) { e_17 = { error: e_17_1 }; }\n finally {\n try {\n if (missingCharacteristics_3_1 && !missingCharacteristics_3_1.done && (_a = missingCharacteristics_3.return)) _a.call(missingCharacteristics_3);\n }\n finally { if (e_17) throw e_17.error; }\n }\n // after a total of 10s we do no longer wait for a request to appear and just return status code timeout\n timeout = setTimeout(function () {\n var e_18, _a;\n timeout = undefined;\n try {\n for (var missingCharacteristics_4 = tslib_1.__values(missingCharacteristics), missingCharacteristics_4_1 = missingCharacteristics_4.next(); !missingCharacteristics_4_1.done; missingCharacteristics_4_1 = missingCharacteristics_4.next()) {\n var id = missingCharacteristics_4_1.value;\n var split = id.split(\".\");\n var aid = parseInt(split[0], 10);\n var iid = parseInt(split[1], 10);\n var accessory = _this.getAccessoryByAID(aid);\n var characteristic = accessory.getCharacteristicByIID(iid);\n _this.sendCharacteristicWarning(characteristic, \"timeout-write\" /* CharacteristicWarningType.TIMEOUT_WRITE */, \"The write handler for the characteristic '\" +\n characteristic.displayName + \"' on the accessory '\" + accessory.displayName + \"' didn't respond at all!. \" +\n \"Please check that you properly call the callback!\");\n characteristics.push({\n aid: aid,\n iid: iid,\n status: -70408 /* HAPStatus.OPERATION_TIMED_OUT */,\n });\n }\n }\n catch (e_18_1) { e_18 = { error: e_18_1 }; }\n finally {\n try {\n if (missingCharacteristics_4_1 && !missingCharacteristics_4_1.done && (_a = missingCharacteristics_4.return)) _a.call(missingCharacteristics_4);\n }\n finally { if (e_18) throw e_18.error; }\n }\n missingCharacteristics.clear();\n callback(undefined, response);\n }, Accessory.TIMEOUT_AFTER_WARNING);\n timeout.unref();\n }, Accessory.TIMEOUT_WARNING);\n timeout.unref();\n var _loop_2 = function (data) {\n var name = data.aid + \".\" + data.iid;\n this_2.handleCharacteristicWrite(connection, data, writeState).then(function (value) {\n return tslib_1.__assign({ aid: data.aid, iid: data.iid }, value);\n }, function (reason) {\n console.error(\"[\".concat(_this.displayName, \"] Write request for characteristic \").concat(name, \" encountered an error: \").concat(reason.stack));\n return {\n aid: data.aid,\n iid: data.iid,\n status: -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */,\n };\n }).then(function (value) {\n if (!timeout) {\n return; // if timeout is undefined, response was already sent out\n }\n missingCharacteristics.delete(name);\n characteristics.push(value);\n if (missingCharacteristics.size === 0) { // if everything returned send the response\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n callback(undefined, response);\n }\n });\n };\n var this_2 = this;\n try {\n for (var _b = tslib_1.__values(writeRequest.characteristics), _c = _b.next(); !_c.done; _c = _b.next()) {\n var data = _c.value;\n _loop_2(data);\n }\n }\n catch (e_16_1) { e_16 = { error: e_16_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_16) throw e_16.error; }\n }\n };\n Accessory.prototype.handleCharacteristicWrite = function (connection, data, writeState) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var characteristic, verifiable, notificationsEnabled, verifiable, allowWrite;\n var _this = this;\n return tslib_1.__generator(this, function (_a) {\n characteristic = this.findCharacteristic(data.aid, data.iid);\n if (!characteristic) {\n debug(\"[%s] Could not find a Characteristic with aid of %s and iid of %s\", this.displayName, data.aid, data.iid);\n return [2 /*return*/, { status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }];\n }\n if (writeState === 2 /* WriteRequestState.TIMED_WRITE_REJECTED */) {\n return [2 /*return*/, { status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }];\n }\n if (data.ev == null && data.value == null) {\n return [2 /*return*/, { status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }];\n }\n if (data.ev != null) { // register/unregister event notifications\n if (!characteristic.props.perms.includes(\"ev\" /* Perms.NOTIFY */)) { // check if notify is allowed for this characteristic\n debug(\"[%s] Tried %s notifications for Characteristic which does not allow notify (aid of %s and iid of %s)\", this.displayName, data.ev ? \"enabling\" : \"disabling\", data.aid, data.iid);\n return [2 /*return*/, { status: -70406 /* HAPStatus.NOTIFICATION_NOT_SUPPORTED */ }];\n }\n if (characteristic.props.adminOnlyAccess && characteristic.props.adminOnlyAccess.includes(2 /* Access.NOTIFY */)) {\n verifiable = connection.username && this._accessoryInfo;\n if (!verifiable) {\n debug(\"[%s] Could not verify admin permissions for Characteristic which requires admin permissions for notify (aid of %s and iid of %s)\", this.displayName, data.aid, data.iid);\n }\n if (!verifiable || !this._accessoryInfo.hasAdminPermissions(connection.username)) {\n return [2 /*return*/, { status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }];\n }\n }\n notificationsEnabled = connection.hasEventNotifications(data.aid, data.iid);\n if (data.ev && !notificationsEnabled) {\n connection.enableEventNotifications(data.aid, data.iid);\n characteristic.subscribe();\n debug(\"[%s] Registered Characteristic \\\"%s\\\" on \\\"%s\\\" for events\", connection.remoteAddress, characteristic.displayName, this.displayName);\n }\n else if (!data.ev && notificationsEnabled) {\n characteristic.unsubscribe();\n connection.disableEventNotifications(data.aid, data.iid);\n debug(\"[%s] Unregistered Characteristic \\\"%s\\\" on \\\"%s\\\" for events\", connection.remoteAddress, characteristic.displayName, this.displayName);\n }\n // response is returned below in the else block\n }\n if (data.value != null) {\n if (!characteristic.props.perms.includes(\"pw\" /* Perms.PAIRED_WRITE */)) { // check if write is allowed for this characteristic\n debug(\"[%s] Tried writing to Characteristic which does not allow writing (aid of %s and iid of %s)\", this.displayName, data.aid, data.iid);\n return [2 /*return*/, { status: -70404 /* HAPStatus.READ_ONLY_CHARACTERISTIC */ }];\n }\n if (characteristic.props.adminOnlyAccess && characteristic.props.adminOnlyAccess.includes(1 /* Access.WRITE */)) {\n verifiable = connection.username && this._accessoryInfo;\n if (!verifiable) {\n debug(\"[%s] Could not verify admin permissions for Characteristic which requires admin permissions for write (aid of %s and iid of %s)\", this.displayName, data.aid, data.iid);\n }\n if (!verifiable || !this._accessoryInfo.hasAdminPermissions(connection.username)) {\n return [2 /*return*/, { status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }];\n }\n }\n if (characteristic.props.perms.includes(\"aa\" /* Perms.ADDITIONAL_AUTHORIZATION */) && characteristic.additionalAuthorizationHandler) {\n allowWrite = void 0;\n try {\n allowWrite = characteristic.additionalAuthorizationHandler(data.authData);\n }\n catch (error) {\n console.warn(\"[\" + this.displayName + \"] Additional authorization handler has thrown an error when checking authData: \" + error.stack);\n allowWrite = false;\n }\n if (!allowWrite) {\n return [2 /*return*/, { status: -70411 /* HAPStatus.INSUFFICIENT_AUTHORIZATION */ }];\n }\n }\n if (characteristic.props.perms.includes(\"tw\" /* Perms.TIMED_WRITE */) && writeState !== 1 /* WriteRequestState.TIMED_WRITE_AUTHENTICATED */) {\n debug(\"[%s] Tried writing to a timed write only Characteristic without properly preparing (iid of %s and aid of %s)\", this.displayName, data.aid, data.iid);\n return [2 /*return*/, { status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }];\n }\n return [2 /*return*/, characteristic.handleSetRequest(data.value, connection).then(function (value) {\n debug(\"[%s] Setting Characteristic \\\"%s\\\" to value %s\", _this.displayName, characteristic.displayName, data.value);\n return {\n // if write response is requests and value is provided, return that\n value: data.r && value ? (0, request_util_1.formatOutgoingCharacteristicValue)(value, characteristic.props) : undefined,\n status: 0 /* HAPStatus.SUCCESS */,\n };\n }, function (status) {\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n debug(\"[%s] Error setting Characteristic \\\"%s\\\" to value %s: \", _this.displayName, characteristic.displayName, data.value, HAPServer_1.HAPStatus[status]);\n return { status: status };\n })];\n }\n return [2 /*return*/, { status: 0 /* HAPStatus.SUCCESS */ }];\n });\n });\n };\n Accessory.prototype.handleResource = function (data, callback) {\n var _a;\n if (data[\"resource-type\"] === \"image\" /* ResourceRequestType.IMAGE */) {\n var aid = data.aid; // aid is optionally supplied by HomeKit (for example when camera is bridged, multiple cams, etc)\n var accessory = undefined;\n var controller = undefined;\n if (aid) {\n accessory = this.getAccessoryByAID(aid);\n if (accessory && accessory.activeCameraController) {\n controller = accessory.activeCameraController;\n }\n }\n else if (this.activeCameraController) { // aid was not supplied, check if this accessory is a camera\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n accessory = this;\n controller = this.activeCameraController;\n }\n if (!controller) {\n debug(\"[%s] received snapshot request though no camera controller was associated!\");\n callback({ httpCode: 404 /* HAPHTTPCode.NOT_FOUND */, status: -70409 /* HAPStatus.RESOURCE_DOES_NOT_EXIST */ });\n return;\n }\n controller.handleSnapshotRequest(data[\"image-height\"], data[\"image-width\"], accessory === null || accessory === void 0 ? void 0 : accessory.displayName, data.reason)\n .then(function (buffer) {\n callback(undefined, buffer);\n }, function (status) {\n callback({ httpCode: 207 /* HAPHTTPCode.MULTI_STATUS */, status: status });\n });\n return;\n }\n debug(\"[%s] received request for unsupported image type: \" + data[\"resource-type\"], (_a = this._accessoryInfo) === null || _a === void 0 ? void 0 : _a.username);\n callback({ httpCode: 404 /* HAPHTTPCode.NOT_FOUND */, status: -70409 /* HAPStatus.RESOURCE_DOES_NOT_EXIST */ });\n };\n Accessory.prototype.handleHAPConnectionClosed = function (connection) {\n var e_19, _a;\n if (this.activeCameraController) {\n this.activeCameraController.handleCloseConnection(connection.sessionID);\n }\n try {\n for (var _b = tslib_1.__values(connection.getRegisteredEvents()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var event = _c.value;\n var ids = event.split(\".\");\n var aid = parseInt(ids[0], 10);\n var iid = parseInt(ids[1], 10);\n var characteristic = this.findCharacteristic(aid, iid);\n if (characteristic) {\n characteristic.unsubscribe();\n }\n }\n }\n catch (e_19_1) { e_19 = { error: e_19_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_19) throw e_19.error; }\n }\n connection.clearRegisteredEvents();\n };\n Accessory.prototype.handleServiceConfigurationChangeEvent = function (service) {\n if (!service.isPrimaryService && service === this.primaryService) {\n // service changed form primary to non-primary service\n this.primaryService = undefined;\n }\n else if (service.isPrimaryService && service !== this.primaryService) {\n // service changed from non-primary to primary service\n if (this.primaryService !== undefined) {\n this.primaryService.isPrimaryService = false;\n }\n this.primaryService = service;\n }\n if (this.bridged) {\n this.emit(\"service-configurationChange\" /* AccessoryEventTypes.SERVICE_CONFIGURATION_CHANGE */, { service: service });\n }\n else {\n this.enqueueConfigurationUpdate();\n }\n };\n Accessory.prototype.handleCharacteristicChangeEvent = function (accessory, service, change) {\n if (this.bridged) { // forward this to our main accessory\n this.emit(\"service-characteristic-change\" /* AccessoryEventTypes.SERVICE_CHARACTERISTIC_CHANGE */, tslib_1.__assign(tslib_1.__assign({}, change), { service: service }));\n }\n else {\n if (!this._server) {\n return; // we're not running a HAPServer, so there's no one to notify about this event\n }\n if (accessory.aid == null || change.characteristic.iid == null) {\n debug(\"[%s] Muting event notification for %s as ids aren't yet assigned!\", accessory.displayName, change.characteristic.displayName);\n return;\n }\n if (change.context != null && typeof change.context === \"object\" && change.context.omitEventUpdate) {\n debug(\"[%s] Omitting event updates for %s as specified in the context object!\", accessory.displayName, change.characteristic.displayName);\n return;\n }\n if (!(change.reason === \"event\" /* ChangeReason.EVENT */ || change.oldValue !== change.newValue\n || change.characteristic.UUID === Characteristic_1.Characteristic.ProgrammableSwitchEvent.UUID // those specific checks are out of backwards compatibility\n || change.characteristic.UUID === Characteristic_1.Characteristic.ButtonEvent.UUID // new characteristics should use sendEventNotification call\n )) {\n // we only emit a change event if the reason was a call to sendEventNotification, if the value changed\n // as of a write request or a read request or if the change happened on dedicated event characteristics\n // otherwise we ignore this change event (with the return below)\n return;\n }\n var uuid_2 = change.characteristic.UUID;\n var immediateDelivery = uuid_2 === Characteristic_1.Characteristic.ButtonEvent.UUID || uuid_2 === Characteristic_1.Characteristic.ProgrammableSwitchEvent.UUID\n || uuid_2 === Characteristic_1.Characteristic.MotionDetected.UUID || uuid_2 === Characteristic_1.Characteristic.ContactSensorState.UUID;\n var value = (0, request_util_1.formatOutgoingCharacteristicValue)(change.newValue, change.characteristic.props);\n this._server.sendEventNotifications(accessory.aid, change.characteristic.iid, value, change.originator, immediateDelivery);\n }\n };\n Accessory.prototype.sendCharacteristicWarning = function (characteristic, type, message) {\n this.handleCharacteristicWarning({\n characteristic: characteristic,\n type: type,\n message: message,\n originatorChain: [characteristic.displayName],\n stack: new Error().stack,\n });\n };\n Accessory.prototype.handleCharacteristicWarning = function (warning) {\n var _a;\n warning.originatorChain = tslib_1.__spreadArray([this.displayName], tslib_1.__read(warning.originatorChain), false);\n var emitted = this.emit(\"characteristic-warning\" /* AccessoryEventTypes.CHARACTERISTIC_WARNING */, warning);\n if (!emitted) {\n var message = \"[\".concat(warning.originatorChain.join(\"@\"), \"] \").concat(warning.message);\n if (warning.type === \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */\n || warning.type === \"timeout-read\" /* CharacteristicWarningType.TIMEOUT_READ */ || warning.type === \"timeout-write\" /* CharacteristicWarningType.TIMEOUT_WRITE */) {\n console.error(message);\n }\n else {\n console.warn(message);\n }\n debug(\"[%s] Above characteristic warning was thrown at: %s\", this.displayName, (_a = warning.stack) !== null && _a !== void 0 ? _a : \"unknown\");\n }\n };\n Accessory.prototype.setupServiceEventHandlers = function (service) {\n service.on(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */, this.handleServiceConfigurationChangeEvent.bind(this, service));\n service.on(\"characteristic-change\" /* ServiceEventTypes.CHARACTERISTIC_CHANGE */, this.handleCharacteristicChangeEvent.bind(this, this, service));\n service.on(\"characteristic-warning\" /* ServiceEventTypes.CHARACTERISTIC_WARNING */, this.handleCharacteristicWarning.bind(this));\n };\n Accessory.prototype._sideloadServices = function (targetServices) {\n var e_20, _a;\n var _this = this;\n try {\n for (var targetServices_1 = tslib_1.__values(targetServices), targetServices_1_1 = targetServices_1.next(); !targetServices_1_1.done; targetServices_1_1 = targetServices_1.next()) {\n var service = targetServices_1_1.value;\n this.setupServiceEventHandlers(service);\n }\n }\n catch (e_20_1) { e_20 = { error: e_20_1 }; }\n finally {\n try {\n if (targetServices_1_1 && !targetServices_1_1.done && (_a = targetServices_1.return)) _a.call(targetServices_1);\n }\n finally { if (e_20) throw e_20.error; }\n }\n this.services = targetServices.slice();\n // Fix Identify\n this\n .getService(Service_1.Service.AccessoryInformation)\n .getCharacteristic(Characteristic_1.Characteristic.Identify)\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n if (value) {\n var paired = true;\n _this.identificationRequest(paired, callback);\n }\n });\n };\n Accessory._generateSetupID = function () {\n var chars = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var max = chars.length;\n var setupID = \"\";\n for (var i = 0; i < 4; i++) {\n var index = Math.floor(Math.random() * max);\n setupID += chars.charAt(index);\n }\n return setupID;\n };\n // serialization and deserialization functions, mainly designed for homebridge to create a json copy to store on disk\n Accessory.serialize = function (accessory) {\n var json = {\n displayName: accessory.displayName,\n UUID: accessory.UUID,\n lastKnownUsername: accessory._accessoryInfo ? accessory._accessoryInfo.username : undefined,\n category: accessory.category,\n services: [],\n };\n var linkedServices = {};\n var hasLinkedServices = false;\n accessory.services.forEach(function (service) {\n json.services.push(Service_1.Service.serialize(service));\n var linkedServicesPresentation = [];\n service.linkedServices.forEach(function (linkedService) {\n linkedServicesPresentation.push(linkedService.getServiceId());\n });\n if (linkedServicesPresentation.length > 0) {\n linkedServices[service.getServiceId()] = linkedServicesPresentation;\n hasLinkedServices = true;\n }\n });\n if (hasLinkedServices) {\n json.linkedServices = linkedServices;\n }\n var controllers = [];\n // save controllers\n Object.values(accessory.controllers).forEach(function (context) {\n controllers.push({\n type: context.controller.controllerId(),\n services: Accessory.serializeServiceMap(context.serviceMap),\n });\n });\n // also save controller which didn't get initialized (could lead to service duplication if we throw that data away)\n accessory.serializedControllers && Object.entries(accessory.serializedControllers).forEach(function (_a) {\n var _b = tslib_1.__read(_a, 2), id = _b[0], serviceMap = _b[1];\n controllers.push({\n type: id,\n services: Accessory.serializeServiceMap(serviceMap),\n });\n });\n if (controllers.length > 0) {\n json.controllers = controllers;\n }\n return json;\n };\n Accessory.deserialize = function (json) {\n var e_21, _a;\n var accessory = new Accessory(json.displayName, json.UUID);\n accessory.lastKnownUsername = json.lastKnownUsername;\n accessory.category = json.category;\n var services = [];\n var servicesMap = {};\n json.services.forEach(function (serialized) {\n var service = Service_1.Service.deserialize(serialized);\n services.push(service);\n servicesMap[service.getServiceId()] = service;\n });\n if (json.linkedServices) {\n var _loop_3 = function (serviceId, linkedServicesKeys) {\n var primaryService = servicesMap[serviceId];\n if (!primaryService) {\n return \"continue\";\n }\n linkedServicesKeys.forEach(function (linkedServiceKey) {\n var linkedService = servicesMap[linkedServiceKey];\n if (linkedService) {\n primaryService.addLinkedService(linkedService);\n }\n });\n };\n try {\n for (var _b = tslib_1.__values(Object.entries(json.linkedServices)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = tslib_1.__read(_c.value, 2), serviceId = _d[0], linkedServicesKeys = _d[1];\n _loop_3(serviceId, linkedServicesKeys);\n }\n }\n catch (e_21_1) { e_21 = { error: e_21_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_21) throw e_21.error; }\n }\n }\n if (json.controllers) { // just save it for later if it exists {@see configureController}\n accessory.serializedControllers = {};\n json.controllers.forEach(function (serializedController) {\n accessory.serializedControllers[serializedController.type] = Accessory.deserializeServiceMap(serializedController.services, servicesMap);\n });\n }\n accessory._sideloadServices(services);\n return accessory;\n };\n Accessory.cleanupAccessoryData = function (username) {\n IdentifierCache_1.IdentifierCache.remove(username);\n AccessoryInfo_1.AccessoryInfo.remove(username);\n ControllerStorage_1.ControllerStorage.remove(username);\n };\n Accessory.serializeServiceMap = function (serviceMap) {\n var serialized = {};\n Object.entries(serviceMap).forEach(function (_a) {\n var _b = tslib_1.__read(_a, 2), name = _b[0], service = _b[1];\n if (!service) {\n return;\n }\n serialized[name] = service.getServiceId();\n });\n return serialized;\n };\n Accessory.deserializeServiceMap = function (serializedServiceMap, servicesMap) {\n var controllerServiceMap = {};\n Object.entries(serializedServiceMap).forEach(function (_a) {\n var _b = tslib_1.__read(_a, 2), name = _b[0], serviceId = _b[1];\n var service = servicesMap[serviceId];\n if (service) {\n controllerServiceMap[name] = service;\n }\n });\n return controllerServiceMap;\n };\n Accessory.parseBindOption = function (info) {\n var e_22, _a;\n var advertiserAddress = undefined;\n var disableIpv6 = undefined;\n var serverAddress = undefined;\n if (info.bind) {\n var entries = new Set(Array.isArray(info.bind) ? info.bind : [info.bind]);\n if (entries.has(\"::\")) {\n serverAddress = \"::\";\n entries.delete(\"::\");\n if (entries.size) {\n advertiserAddress = Array.from(entries);\n }\n }\n else if (entries.has(\"0.0.0.0\")) {\n disableIpv6 = true;\n serverAddress = \"0.0.0.0\";\n entries.delete(\"0.0.0.0\");\n if (entries.size) {\n advertiserAddress = Array.from(entries);\n }\n }\n else if (entries.size === 1) {\n advertiserAddress = Array.from(entries);\n var entry = entries.values().next().value; // grab the first one\n var version = net_1.default.isIP(entry); // check if ip address was specified or an interface name\n if (version) {\n serverAddress = version === 4 ? \"0.0.0.0\" : \"::\"; // we currently bind to unspecified addresses so config-ui always has a connection via loopback\n }\n else {\n serverAddress = \"::\"; // the interface could have both ipv4 and ipv6 addresses\n }\n }\n else if (entries.size > 1) {\n advertiserAddress = Array.from(entries);\n var bindUnspecifiedIpv6 = false; // we bind on \"::\" if there are interface names, or we detect ipv6 addresses\n try {\n for (var entries_1 = tslib_1.__values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {\n var entry = entries_1_1.value;\n var version = net_1.default.isIP(entry);\n if (version === 0 || version === 6) {\n bindUnspecifiedIpv6 = true;\n break;\n }\n }\n }\n catch (e_22_1) { e_22 = { error: e_22_1 }; }\n finally {\n try {\n if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);\n }\n finally { if (e_22) throw e_22.error; }\n }\n if (bindUnspecifiedIpv6) {\n serverAddress = \"::\";\n }\n else {\n serverAddress = \"0.0.0.0\";\n }\n }\n }\n return {\n advertiserAddress: advertiserAddress,\n serviceRestrictedAddress: advertiserAddress,\n serviceDisableIpv6: disableIpv6,\n serverAddress: serverAddress,\n };\n };\n /**\n * @deprecated Please use the Categories const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n Accessory.Categories = Categories;\n /// Timeout in milliseconds until a characteristic warning is issue\n Accessory.TIMEOUT_WARNING = 3000;\n /// Timeout in milliseconds after `TIMEOUT_WARNING` until the operation on the characteristic is considered timed out.\n Accessory.TIMEOUT_AFTER_WARNING = 6000;\n return Accessory;\n}(events_1.EventEmitter));\nexports.Accessory = Accessory;\n//# sourceMappingURL=Accessory.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.loadDirectory = exports.parseAccessoryJSON = exports.parseServiceJSON = exports.parseCharacteristicJSON = void 0;\nvar tslib_1 = require(\"tslib\");\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar fs_1 = tslib_1.__importDefault(require(\"fs\"));\nvar path_1 = tslib_1.__importDefault(require(\"path\"));\nvar Accessory_1 = require(\"./Accessory\");\nvar Characteristic_1 = require(\"./Characteristic\");\nvar Service_1 = require(\"./Service\");\nvar uuid = tslib_1.__importStar(require(\"./util/uuid\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:AccessoryLoader\");\n/**\n * @group Utils\n * @deprecated Legacy Accessory Loader\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nfunction parseCharacteristicJSON(json) {\n var characteristicUUID = json.cType;\n var characteristic = new Characteristic_1.Characteristic(json.manfDescription || characteristicUUID, characteristicUUID, {\n format: json.format,\n minValue: json.designedMinValue,\n maxValue: json.designedMaxValue,\n minStep: json.designedMinStep,\n unit: json.unit,\n perms: json.perms, // example: [\"pw\",\"pr\",\"ev\"]\n });\n // copy simple properties\n characteristic.value = json.initialValue;\n // @ts-expect-error: monkey-patch legacy \"locals\" property which used to exist.\n characteristic.locals = json.locals;\n var updateFunc = json.onUpdate; // optional function(value)\n var readFunc = json.onRead; // optional function(callback(value))\n var registerFunc = json.onRegister; // optional function\n if (updateFunc) {\n characteristic.on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n updateFunc(value);\n callback && callback();\n });\n }\n if (readFunc) {\n characteristic.on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readFunc(function (value) {\n callback(null, value); // old onRead callbacks don't use Error as first param\n });\n });\n }\n if (registerFunc) {\n registerFunc(characteristic);\n }\n return characteristic;\n}\nexports.parseCharacteristicJSON = parseCharacteristicJSON;\n/**\n * @group Utils\n * @deprecated Legacy Accessory Loader\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\nfunction parseServiceJSON(json) {\n var serviceUUID = json.sType;\n // build characteristics first, so we can extract the Name (if present)\n var characteristics = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json.characteristics.forEach(function (characteristicJSON) {\n var characteristic = parseCharacteristicJSON(characteristicJSON);\n characteristics.push(characteristic);\n });\n var displayName = null;\n // extract the \"Name\" characteristic to use for 'type' discrimination if necessary\n characteristics.forEach(function (characteristic) {\n if (characteristic.UUID === \"00000023-0000-1000-8000-0026BB765291\") { // Characteristic.Name.UUID\n displayName = characteristic.value;\n }\n });\n // Use UUID for \"displayName\" if necessary, as the JSON structures don't have a value for this\n var service = new Service_1.Service(displayName || serviceUUID, serviceUUID, \"\".concat(displayName));\n characteristics.forEach(function (characteristic) {\n if (characteristic.UUID !== \"00000023-0000-1000-8000-0026BB765291\") { // Characteristic.Name.UUID, already present in all Services\n service.addCharacteristic(characteristic);\n }\n });\n return service;\n}\nexports.parseServiceJSON = parseServiceJSON;\n/**\n * Accepts object-literal JSON structures from previous versions of HAP-NodeJS and parses them into\n * newer-style structures of Accessory/Service/Characteristic objects.\n * @group Utils\n * @deprecated Legacy Accessory Loader\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\nfunction parseAccessoryJSON(json) {\n // parse services first so we can extract the accessory name\n var services = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json.services.forEach(function (serviceJSON) {\n var service = parseServiceJSON(serviceJSON);\n services.push(service);\n });\n var displayName = json.displayName;\n services.forEach(function (service) {\n if (service.UUID === \"0000003E-0000-1000-8000-0026BB765291\") { // Service.AccessoryInformation.UUID\n service.characteristics.forEach(function (characteristic) {\n if (characteristic.UUID === \"00000023-0000-1000-8000-0026BB765291\") { // Characteristic.Name.UUID\n displayName = characteristic.value;\n }\n });\n }\n });\n var accessory = new Accessory_1.Accessory(displayName, uuid.generate(displayName));\n // create custom properties for \"username\" and \"pincode\" for Core.js to find later (if using Core.js)\n // @ts-expect-error: Core/BridgeCore API\n accessory.username = json.username;\n // @ts-expect-error: Core/BridgeCore API\n accessory.pincode = json.pincode;\n // clear out the default services\n accessory.services.length = 0;\n // add services\n services.forEach(function (service) {\n accessory.addService(service);\n });\n return accessory;\n}\nexports.parseAccessoryJSON = parseAccessoryJSON;\n/**\n * Loads all accessories from the given folder. Handles object-literal-style accessories, \"accessory factories\",\n * and new-API style modules.\n * @group Utils\n * @deprecated Legacy Accessory Loader\n */\nfunction loadDirectory(dir) {\n // exported accessory objects loaded from this dir\n var accessories = [];\n fs_1.default.readdirSync(dir).forEach(function (file) {\n var suffix = file.split(\"_\").pop();\n // \"Accessories\" are modules that export a single accessory.\n if (suffix === \"accessory.js\" || suffix === \"accessory.ts\") {\n debug(\"Parsing accessory: %s\", file);\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var loadedAccessory = require(path_1.default.join(dir, file)).accessory;\n accessories.push(loadedAccessory);\n }\n else if (suffix === \"accfactory.js\" || suffix === \"accfactory.ts\") { // \"Accessory Factories\" are modules that export an array of accessories.\n debug(\"Parsing accessory factory: %s\", file);\n // should return an array of objects { accessory: accessory-json }\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var loadedAccessories = require(path_1.default.join(dir, file));\n accessories = accessories.concat(loadedAccessories);\n }\n });\n // now we need to coerce all accessory objects into instances of Accessory (some or all of them may\n // be object-literal JSON-style accessories)\n return accessories.map(function (accessory) {\n if (accessory === null || accessory === undefined) { //check if accessory is not empty\n console.log(\"Invalid accessory!\");\n return false;\n }\n else {\n return (accessory instanceof Accessory_1.Accessory) ? accessory : parseAccessoryJSON(accessory);\n }\n }).filter(function (accessory) {\n return !!accessory;\n });\n}\nexports.loadDirectory = loadDirectory;\n//# sourceMappingURL=AccessoryLoader.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResolvedAdvertiser = exports.AvahiAdvertiser = exports.DBusInvokeError = exports.BonjourHAPAdvertiser = exports.CiaoAdvertiser = exports.AdvertiserEvent = exports.PairingFeatureFlag = exports.StatusFlag = void 0;\nvar tslib_1 = require(\"tslib\");\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// \nvar ciao_1 = tslib_1.__importDefault(require(\"@homebridge/ciao\"));\nvar dbus_native_1 = tslib_1.__importDefault(require(\"@homebridge/dbus-native\"));\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar bonjour_hap_1 = tslib_1.__importDefault(require(\"bonjour-hap\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar promise_utils_1 = require(\"./util/promise-utils\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Advertiser\");\n/**\n * This enum lists all bitmasks for all known status flags.\n * When the bit for the given bitmask is set, it represents the state described by the name.\n *\n * @group Advertiser\n */\nvar StatusFlag;\n(function (StatusFlag) {\n StatusFlag[StatusFlag[\"NOT_PAIRED\"] = 1] = \"NOT_PAIRED\";\n StatusFlag[StatusFlag[\"NOT_JOINED_WIFI\"] = 2] = \"NOT_JOINED_WIFI\";\n StatusFlag[StatusFlag[\"PROBLEM_DETECTED\"] = 4] = \"PROBLEM_DETECTED\";\n})(StatusFlag = exports.StatusFlag || (exports.StatusFlag = {}));\n/**\n * This enum lists all bitmasks for all known pairing feature flags.\n * When the bit for the given bitmask is set, it represents the state described by the name.\n *\n * @group Advertiser\n */\nvar PairingFeatureFlag;\n(function (PairingFeatureFlag) {\n PairingFeatureFlag[PairingFeatureFlag[\"SUPPORTS_HARDWARE_AUTHENTICATION\"] = 1] = \"SUPPORTS_HARDWARE_AUTHENTICATION\";\n PairingFeatureFlag[PairingFeatureFlag[\"SUPPORTS_SOFTWARE_AUTHENTICATION\"] = 2] = \"SUPPORTS_SOFTWARE_AUTHENTICATION\";\n})(PairingFeatureFlag = exports.PairingFeatureFlag || (exports.PairingFeatureFlag = {}));\n/**\n * @group Advertiser\n */\nvar AdvertiserEvent;\n(function (AdvertiserEvent) {\n /**\n * Emitted if the underlying mDNS advertisers signals, that the service name\n * was automatically changed due to some naming conflicts on the network.\n */\n AdvertiserEvent[\"UPDATED_NAME\"] = \"updated-name\";\n})(AdvertiserEvent = exports.AdvertiserEvent || (exports.AdvertiserEvent = {}));\n/**\n * Advertiser uses mdns to broadcast the presence of an Accessory to the local network.\n *\n * Note that as of iOS 9, an accessory can only pair with a single client. Instead of pairing your\n * accessories with multiple iOS devices in your home, Apple intends for you to use Home Sharing.\n * To support this requirement, we provide the ability to be \"discoverable\" or not (via a \"service flag\" on the\n * mdns payload).\n *\n * @group Advertiser\n */\nvar CiaoAdvertiser = /** @class */ (function (_super) {\n tslib_1.__extends(CiaoAdvertiser, _super);\n function CiaoAdvertiser(accessoryInfo, responderOptions, serviceOptions) {\n var _this = _super.call(this) || this;\n _this.accessoryInfo = accessoryInfo;\n _this.setupHash = CiaoAdvertiser.computeSetupHash(accessoryInfo);\n _this.responder = ciao_1.default.getResponder(tslib_1.__assign({}, responderOptions));\n _this.advertisedService = _this.responder.createService(tslib_1.__assign({ name: _this.accessoryInfo.displayName, type: \"hap\" /* ServiceType.HAP */, txt: CiaoAdvertiser.createTxt(accessoryInfo, _this.setupHash) }, serviceOptions));\n _this.advertisedService.on(\"name-change\" /* ServiceEvent.NAME_CHANGED */, _this.emit.bind(_this, \"updated-name\" /* AdvertiserEvent.UPDATED_NAME */));\n debug(\"Preparing Advertiser for '\".concat(_this.accessoryInfo.displayName, \"' using ciao backend!\"));\n return _this;\n }\n CiaoAdvertiser.prototype.initPort = function (port) {\n this.advertisedService.updatePort(port);\n };\n CiaoAdvertiser.prototype.startAdvertising = function () {\n debug(\"Starting to advertise '\".concat(this.accessoryInfo.displayName, \"' using ciao backend!\"));\n return this.advertisedService.advertise();\n };\n CiaoAdvertiser.prototype.updateAdvertisement = function (silent) {\n var txt = CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash);\n debug(\"Updating txt record (txt: %o, silent: %d)\", txt, silent);\n this.advertisedService.updateTxt(txt, silent);\n };\n CiaoAdvertiser.prototype.destroy = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0: \n // advertisedService.destroy(); is called implicitly via the shutdown call\n return [4 /*yield*/, this.responder.shutdown()];\n case 1:\n // advertisedService.destroy(); is called implicitly via the shutdown call\n _a.sent();\n this.removeAllListeners();\n return [2 /*return*/];\n }\n });\n });\n };\n CiaoAdvertiser.createTxt = function (accessoryInfo, setupHash) {\n var statusFlags = [];\n if (!accessoryInfo.paired()) {\n statusFlags.push(1 /* StatusFlag.NOT_PAIRED */);\n }\n return {\n \"c#\": accessoryInfo.getConfigVersion(),\n ff: CiaoAdvertiser.ff(),\n id: accessoryInfo.username,\n md: accessoryInfo.model,\n pv: CiaoAdvertiser.protocolVersion,\n \"s#\": 1,\n sf: CiaoAdvertiser.sf.apply(CiaoAdvertiser, tslib_1.__spreadArray([], tslib_1.__read(statusFlags), false)),\n ci: accessoryInfo.category,\n sh: setupHash,\n };\n };\n CiaoAdvertiser.computeSetupHash = function (accessoryInfo) {\n var hash = crypto_1.default.createHash(\"sha512\");\n hash.update(accessoryInfo.setupID + accessoryInfo.username.toUpperCase());\n return hash.digest().slice(0, 4).toString(\"base64\");\n };\n CiaoAdvertiser.ff = function () {\n var flags = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n flags[_i] = arguments[_i];\n }\n var value = 0;\n flags.forEach(function (flag) { return value |= flag; });\n return value;\n };\n CiaoAdvertiser.sf = function () {\n var flags = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n flags[_i] = arguments[_i];\n }\n var value = 0;\n flags.forEach(function (flag) { return value |= flag; });\n return value;\n };\n CiaoAdvertiser.protocolVersion = \"1.1\";\n CiaoAdvertiser.protocolVersionService = \"1.1.0\";\n return CiaoAdvertiser;\n}(events_1.EventEmitter));\nexports.CiaoAdvertiser = CiaoAdvertiser;\n/**\n * Advertiser base on the legacy \"bonjour-hap\" library.\n *\n * @group Advertiser\n */\nvar BonjourHAPAdvertiser = /** @class */ (function (_super) {\n tslib_1.__extends(BonjourHAPAdvertiser, _super);\n function BonjourHAPAdvertiser(accessoryInfo, responderOptions, serviceOptions) {\n var _this = _super.call(this) || this;\n _this.destroyed = false;\n _this.accessoryInfo = accessoryInfo;\n _this.setupHash = CiaoAdvertiser.computeSetupHash(accessoryInfo);\n _this.serviceOptions = serviceOptions;\n _this.bonjour = (0, bonjour_hap_1.default)(responderOptions);\n debug(\"Preparing Advertiser for '\".concat(_this.accessoryInfo.displayName, \"' using bonjour-hap backend!\"));\n return _this;\n }\n BonjourHAPAdvertiser.prototype.initPort = function (port) {\n this.port = port;\n };\n BonjourHAPAdvertiser.prototype.startAdvertising = function () {\n (0, assert_1.default)(!this.destroyed, \"Can't advertise on a destroyed bonjour instance!\");\n if (this.port == null) {\n throw new Error(\"Tried starting bonjour-hap advertisement without initializing port!\");\n }\n debug(\"Starting to advertise '\".concat(this.accessoryInfo.displayName, \"' using bonjour-hap backend!\"));\n if (this.advertisement) {\n this.destroy();\n }\n var hostname = this.accessoryInfo.username.replace(/:/ig, \"_\") + \".local\";\n this.advertisement = this.bonjour.publish(tslib_1.__assign({ name: this.accessoryInfo.displayName, type: \"hap\", port: this.port, txt: CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash), host: hostname, addUnsafeServiceEnumerationRecord: true }, this.serviceOptions));\n return (0, promise_utils_1.PromiseTimeout)(1);\n };\n BonjourHAPAdvertiser.prototype.updateAdvertisement = function (silent) {\n var txt = CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash);\n debug(\"Updating txt record (txt: %o, silent: %d)\", txt, silent);\n if (this.advertisement) {\n this.advertisement.updateTxt(txt, silent);\n }\n };\n BonjourHAPAdvertiser.prototype.destroy = function () {\n var _this = this;\n if (this.advertisement) {\n this.advertisement.stop(function () {\n _this.advertisement.destroy();\n _this.advertisement = undefined;\n _this.bonjour.destroy();\n });\n }\n else {\n this.bonjour.destroy();\n }\n };\n return BonjourHAPAdvertiser;\n}(events_1.EventEmitter));\nexports.BonjourHAPAdvertiser = BonjourHAPAdvertiser;\nfunction messageBusConnectionResult(bus) {\n return new Promise(function (resolve, reject) {\n var errorHandler = function (error) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n bus.connection.removeListener(\"connect\", connectHandler);\n reject(error);\n };\n var connectHandler = function () {\n bus.connection.removeListener(\"error\", errorHandler);\n resolve();\n };\n bus.connection.once(\"connect\", connectHandler);\n bus.connection.once(\"error\", errorHandler);\n });\n}\n/**\n * @group Advertiser\n */\nvar DBusInvokeError = /** @class */ (function (_super) {\n tslib_1.__extends(DBusInvokeError, _super);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function DBusInvokeError(errorObject) {\n var _this = _super.call(this) || this;\n Object.setPrototypeOf(_this, DBusInvokeError.prototype);\n _this.name = \"DBusInvokeError\";\n _this.errorName = errorObject.name;\n if (Array.isArray(errorObject.message) && errorObject.message.length === 1) {\n _this.message = errorObject.message[0];\n }\n else {\n _this.message = errorObject.message.toString();\n }\n return _this;\n }\n return DBusInvokeError;\n}(Error));\nexports.DBusInvokeError = DBusInvokeError;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction dbusInvoke(bus, destination, path, dbusInterface, member, others) {\n return new Promise(function (resolve, reject) {\n var command = tslib_1.__assign({ destination: destination, path: path, interface: dbusInterface, member: member }, (others || {}));\n bus.invoke(command, function (err, result) {\n if (err) {\n reject(new DBusInvokeError(err));\n }\n else {\n resolve(result);\n }\n });\n });\n}\n/**\n * AvahiServerState.\n *\n * Refer to https://github.com/lathiat/avahi/blob/fd482a74625b8db8547b8cfca3ee3d3c6c721423/avahi-common/defs.h#L220-L227.\n *\n * @group Advertiser\n */\nvar AvahiServerState;\n(function (AvahiServerState) {\n // noinspection JSUnusedGlobalSymbols\n AvahiServerState[AvahiServerState[\"INVALID\"] = 0] = \"INVALID\";\n AvahiServerState[AvahiServerState[\"REGISTERING\"] = 1] = \"REGISTERING\";\n AvahiServerState[AvahiServerState[\"RUNNING\"] = 2] = \"RUNNING\";\n AvahiServerState[AvahiServerState[\"COLLISION\"] = 3] = \"COLLISION\";\n AvahiServerState[AvahiServerState[\"FAILURE\"] = 4] = \"FAILURE\";\n})(AvahiServerState || (AvahiServerState = {}));\n/**\n * Advertiser based on the Avahi D-Bus library.\n * For (very crappy) docs on the interface, see the XML files at: https://github.com/lathiat/avahi/tree/master/avahi-daemon.\n *\n * Refer to https://github.com/lathiat/avahi/blob/fd482a74625b8db8547b8cfca3ee3d3c6c721423/avahi-common/defs.h#L120-L155 for a\n * rough API usage guide of Avahi.\n *\n * @group Advertiser\n */\nvar AvahiAdvertiser = /** @class */ (function (_super) {\n tslib_1.__extends(AvahiAdvertiser, _super);\n function AvahiAdvertiser(accessoryInfo) {\n var _this = _super.call(this) || this;\n _this.accessoryInfo = accessoryInfo;\n _this.setupHash = CiaoAdvertiser.computeSetupHash(accessoryInfo);\n debug(\"Preparing Advertiser for '\".concat(_this.accessoryInfo.displayName, \"' using Avahi backend!\"));\n _this.bus = dbus_native_1.default.systemBus();\n _this.stateChangeHandler = _this.handleStateChangedEvent.bind(_this);\n return _this;\n }\n AvahiAdvertiser.prototype.createTxt = function () {\n return Object\n .entries(CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash))\n .map(function (el) { return Buffer.from(el[0] + \"=\" + el[1]); });\n };\n AvahiAdvertiser.prototype.initPort = function (port) {\n this.port = port;\n };\n AvahiAdvertiser.prototype.startAdvertising = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var _a, _b, error_1;\n return tslib_1.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (this.port == null) {\n throw new Error(\"Tried starting Avahi advertisement without initializing port!\");\n }\n if (!this.bus) {\n throw new Error(\"Tried to start Avahi advertisement on a destroyed advertiser!\");\n }\n debug(\"Starting to advertise '\".concat(this.accessoryInfo.displayName, \"' using Avahi backend!\"));\n _a = this;\n return [4 /*yield*/, AvahiAdvertiser.avahiInvoke(this.bus, \"/\", \"Server\", \"EntryGroupNew\")];\n case 1:\n _a.path = (_c.sent());\n return [4 /*yield*/, AvahiAdvertiser.avahiInvoke(this.bus, this.path, \"EntryGroup\", \"AddService\", {\n body: [\n -1,\n -1,\n 0,\n this.accessoryInfo.displayName,\n \"_hap._tcp\",\n \"\",\n \"\",\n this.port,\n this.createTxt(), // txt\n ],\n signature: \"iiussssqaay\",\n })];\n case 2:\n _c.sent();\n return [4 /*yield*/, AvahiAdvertiser.avahiInvoke(this.bus, this.path, \"EntryGroup\", \"Commit\")];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _c.trys.push([4, 7, , 8]);\n if (!!this.avahiServerInterface) return [3 /*break*/, 6];\n _b = this;\n return [4 /*yield*/, AvahiAdvertiser.avahiInterface(this.bus, \"Server\")];\n case 5:\n _b.avahiServerInterface = _c.sent();\n this.avahiServerInterface.on(\"StateChanged\", this.stateChangeHandler);\n _c.label = 6;\n case 6: return [3 /*break*/, 8];\n case 7:\n error_1 = _c.sent();\n // We have some problem on Synology https://github.com/homebridge/HAP-NodeJS/issues/993\n console.warn(\"Failed to create listener for avahi-daemon server state. The system will not be notified about restarts of avahi-daemon \" +\n \"and will therefore stay undiscoverable in those instances. Error message: \" + error_1);\n if (error_1.stack) {\n debug(\"Detailed error: \" + error_1.stack);\n }\n return [3 /*break*/, 8];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Event handler for the `StateChanged` event of the `org.freedesktop.Avahi.Server` DBus interface.\n *\n * This is called once the state of the running avahi-daemon changes its running state.\n * @param state - The state the server changed into {@see AvahiServerState}.\n */\n AvahiAdvertiser.prototype.handleStateChangedEvent = function (state) {\n if (state === 2 /* AvahiServerState.RUNNING */ && this.path) {\n debug(\"Found Avahi daemon to have restarted!\");\n this.startAdvertising()\n .catch(function (reason) { return console.error(\"Could not (re-)create mDNS advertisement. The HAP-Server won't be discoverable: \" + reason); });\n }\n };\n AvahiAdvertiser.prototype.updateAdvertisement = function (silent) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var error_2;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.bus) {\n throw new Error(\"Tried to update Avahi advertisement on a destroyed advertiser!\");\n }\n if (!this.path) {\n debug(\"Tried to update advertisement without a valid `path`!\");\n return [2 /*return*/];\n }\n debug(\"Updating txt record (txt: %o, silent: %d)\", CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash), silent);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, AvahiAdvertiser.avahiInvoke(this.bus, this.path, \"EntryGroup\", \"UpdateServiceTxt\", {\n body: [-1, -1, 0, this.accessoryInfo.displayName, \"_hap._tcp\", \"\", this.createTxt()],\n signature: \"iiusssaay\",\n })];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n console.error(\"Failed to update avahi advertisement: \" + error_2);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n AvahiAdvertiser.prototype.destroy = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var error_3;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.bus) {\n throw new Error(\"Tried to destroy Avahi advertisement on a destroyed advertiser!\");\n }\n if (!this.path) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, AvahiAdvertiser.avahiInvoke(this.bus, this.path, \"EntryGroup\", \"Free\")];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n error_3 = _a.sent();\n // Typically, this fails if e.g. avahi service was stopped in the meantime.\n debug(\"Destroying Avahi advertisement failed: \" + error_3);\n return [3 /*break*/, 4];\n case 4:\n this.path = undefined;\n _a.label = 5;\n case 5:\n if (this.avahiServerInterface) {\n this.avahiServerInterface.removeListener(\"StateChanged\", this.stateChangeHandler);\n this.avahiServerInterface = undefined;\n }\n this.bus.connection.stream.destroy();\n this.bus = undefined;\n return [2 /*return*/];\n }\n });\n });\n };\n AvahiAdvertiser.isAvailable = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var bus, error_4, version, error_5;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n bus = dbus_native_1.default.systemBus();\n _a.label = 1;\n case 1:\n _a.trys.push([1, , 9, 10]);\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, messageBusConnectionResult(bus)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n error_4 = _a.sent();\n debug(\"Avahi/DBus classified unavailable due to missing dbus interface!\");\n return [2 /*return*/, false];\n case 5:\n _a.trys.push([5, 7, , 8]);\n return [4 /*yield*/, this.avahiInvoke(bus, \"/\", \"Server\", \"GetVersionString\")];\n case 6:\n version = _a.sent();\n debug(\"Detected Avahi over DBus interface running version '%s'.\", version);\n return [3 /*break*/, 8];\n case 7:\n error_5 = _a.sent();\n debug(\"Avahi/DBus classified unavailable due to missing avahi interface!\");\n return [2 /*return*/, false];\n case 8: return [2 /*return*/, true];\n case 9:\n bus.connection.stream.destroy();\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n AvahiAdvertiser.avahiInvoke = function (bus, path, dbusInterface, member, others) {\n return dbusInvoke(bus, \"org.freedesktop.Avahi\", path, \"org.freedesktop.Avahi.\".concat(dbusInterface), member, others);\n };\n AvahiAdvertiser.avahiInterface = function (bus, dbusInterface) {\n return new Promise(function (resolve, reject) {\n bus\n .getService(\"org.freedesktop.Avahi\")\n .getInterface(\"/\", \"org.freedesktop.Avahi.\" + dbusInterface, function (error, iface) {\n if (error || !iface) {\n reject(error !== null && error !== void 0 ? error : new Error(\"Interface not present!\"));\n }\n else {\n resolve(iface);\n }\n });\n });\n };\n return AvahiAdvertiser;\n}(events_1.EventEmitter));\nexports.AvahiAdvertiser = AvahiAdvertiser;\nvar RESOLVED_PERMISSIONS_ERRORS = [\n \"org.freedesktop.DBus.Error.AccessDenied\",\n \"org.freedesktop.DBus.Error.AuthFailed\",\n \"org.freedesktop.DBus.Error.InteractiveAuthorizationRequired\",\n];\n/**\n * Advertiser based on the systemd-resolved D-Bus library.\n * For docs on the interface, see: https://www.freedesktop.org/software/systemd/man/org.freedesktop.resolve1.html\n *\n * @group Advertiser\n */\nvar ResolvedAdvertiser = /** @class */ (function (_super) {\n tslib_1.__extends(ResolvedAdvertiser, _super);\n function ResolvedAdvertiser(accessoryInfo) {\n var _this = _super.call(this) || this;\n _this.accessoryInfo = accessoryInfo;\n _this.setupHash = CiaoAdvertiser.computeSetupHash(accessoryInfo);\n _this.bus = dbus_native_1.default.systemBus();\n debug(\"Preparing Advertiser for '\".concat(_this.accessoryInfo.displayName, \"' using systemd-resolved backend!\"));\n return _this;\n }\n ResolvedAdvertiser.prototype.createTxt = function () {\n return Object\n .entries(CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash))\n .map(function (el) { return [el[0].toString(), Buffer.from(el[1].toString())]; });\n };\n ResolvedAdvertiser.prototype.initPort = function (port) {\n this.port = port;\n };\n ResolvedAdvertiser.prototype.startAdvertising = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var _a, error_6;\n return tslib_1.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.port == null) {\n throw new Error(\"Tried starting systemd-resolved advertisement without initializing port!\");\n }\n if (!this.bus) {\n throw new Error(\"Tried to start systemd-resolved advertisement on a destroyed advertiser!\");\n }\n debug(\"Starting to advertise '\".concat(this.accessoryInfo.displayName, \"' using systemd-resolved backend!\"));\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n _a = this;\n return [4 /*yield*/, ResolvedAdvertiser.managerInvoke(this.bus, \"RegisterService\", {\n body: [\n this.accessoryInfo.displayName,\n this.accessoryInfo.displayName,\n \"_hap._tcp\",\n this.port,\n 0,\n 0,\n [this.createTxt()], // txt_datas\n ],\n signature: \"sssqqqaa{say}\",\n })];\n case 2:\n _a.path = _b.sent();\n return [3 /*break*/, 4];\n case 3:\n error_6 = _b.sent();\n if (error_6 instanceof DBusInvokeError) {\n if (RESOLVED_PERMISSIONS_ERRORS.includes(error_6.errorName)) {\n error_6.message = \"Permissions issue. See https://homebridge.io/w/mDNS-Options for more info. \".concat(error_6.message);\n }\n }\n throw error_6;\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n ResolvedAdvertiser.prototype.updateAdvertisement = function (silent) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.bus) {\n throw new Error(\"Tried to update systemd-resolved advertisement on a destroyed advertiser!\");\n }\n debug(\"Updating txt record (txt: %o, silent: %d)\", CiaoAdvertiser.createTxt(this.accessoryInfo, this.setupHash), silent);\n // Currently, systemd-resolved has no way to update an existing record.\n return [4 /*yield*/, this.stopAdvertising()];\n case 1:\n // Currently, systemd-resolved has no way to update an existing record.\n _a.sent();\n return [4 /*yield*/, this.startAdvertising()];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n ResolvedAdvertiser.prototype.stopAdvertising = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var error_7;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.bus) {\n throw new Error(\"Tried to destroy systemd-resolved advertisement on a destroyed advertiser!\");\n }\n if (!this.path) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, ResolvedAdvertiser.managerInvoke(this.bus, \"UnregisterService\", {\n body: [this.path],\n signature: \"o\",\n })];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n error_7 = _a.sent();\n // Typically, this fails if e.g. systemd-resolved service was stopped in the meantime.\n debug(\"Destroying systemd-resolved advertisement failed: \" + error_7);\n return [3 /*break*/, 4];\n case 4:\n this.path = undefined;\n _a.label = 5;\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n ResolvedAdvertiser.prototype.destroy = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.bus) {\n throw new Error(\"Tried to destroy systemd-resolved advertisement on a destroyed advertiser!\");\n }\n return [4 /*yield*/, this.stopAdvertising()];\n case 1:\n _a.sent();\n this.bus.connection.stream.destroy();\n this.bus = undefined;\n return [2 /*return*/];\n }\n });\n });\n };\n ResolvedAdvertiser.isAvailable = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var bus, error_8, error_9, mdnsStatus, error_10;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n bus = dbus_native_1.default.systemBus();\n _a.label = 1;\n case 1:\n _a.trys.push([1, , 12, 13]);\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, messageBusConnectionResult(bus)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n error_8 = _a.sent();\n debug(\"systemd-resolved/DBus classified unavailable due to missing dbus interface!\");\n return [2 /*return*/, false];\n case 5:\n _a.trys.push([5, 7, , 8]);\n // Ensure that systemd-resolved is accessible.\n return [4 /*yield*/, this.managerInvoke(bus, \"ResolveHostname\", {\n body: [0, \"127.0.0.1\", 0, 0],\n signature: \"isit\",\n })];\n case 6:\n // Ensure that systemd-resolved is accessible.\n _a.sent();\n debug(\"Detected systemd-resolved over DBus interface running version.\");\n return [3 /*break*/, 8];\n case 7:\n error_9 = _a.sent();\n debug(\"systemd-resolved/DBus classified unavailable due to missing systemd-resolved interface!\");\n return [2 /*return*/, false];\n case 8:\n _a.trys.push([8, 10, , 11]);\n return [4 /*yield*/, this.resolvedInvoke(bus, \"org.freedesktop.DBus.Properties\", \"Get\", {\n body: [\"org.freedesktop.resolve1.Manager\", \"MulticastDNS\"],\n signature: \"ss\",\n })];\n case 9:\n mdnsStatus = _a.sent();\n if (mdnsStatus[0][0].type !== \"s\") {\n throw new Error(\"Invalid type for MulticastDNS\");\n }\n if (mdnsStatus[1][0] !== \"yes\") {\n debug(\"systemd-resolved/DBus classified unavailable because MulticastDNS is not enabled!\");\n return [2 /*return*/, false];\n }\n return [3 /*break*/, 11];\n case 10:\n error_10 = _a.sent();\n debug(\"systemd-resolved/DBus classified unavailable due to failure checking system status: \" + error_10);\n return [2 /*return*/, false];\n case 11: return [2 /*return*/, true];\n case 12:\n bus.connection.stream.destroy();\n return [7 /*endfinally*/];\n case 13: return [2 /*return*/];\n }\n });\n });\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResolvedAdvertiser.resolvedInvoke = function (bus, dbusInterface, member, others) {\n return dbusInvoke(bus, \"org.freedesktop.resolve1\", \"/org/freedesktop/resolve1\", dbusInterface, member, others);\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResolvedAdvertiser.managerInvoke = function (bus, member, others) {\n return this.resolvedInvoke(bus, \"org.freedesktop.resolve1.Manager\", member, others);\n };\n return ResolvedAdvertiser;\n}(events_1.EventEmitter));\nexports.ResolvedAdvertiser = ResolvedAdvertiser;\n//# sourceMappingURL=Advertiser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Bridge = void 0;\nvar tslib_1 = require(\"tslib\");\nvar Accessory_1 = require(\"./Accessory\");\n/**\n * Bridge is a special type of HomeKit Accessory that hosts other Accessories \"behind\" it. This way you\n * can simply publish() the Bridge (with a single HAPServer on a single port) and all bridged Accessories\n * will be hosted automatically, instead of needed to publish() every single Accessory as a separate server.\n *\n * @group Accessory\n */\nvar Bridge = /** @class */ (function (_super) {\n tslib_1.__extends(Bridge, _super);\n function Bridge(displayName, UUID) {\n var _this = _super.call(this, displayName, UUID) || this;\n _this._isBridge = true;\n return _this;\n }\n return Bridge;\n}(Accessory_1.Accessory));\nexports.Bridge = Bridge;\n//# sourceMappingURL=Bridge.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Characteristic = exports.CharacteristicEventTypes = exports.ChangeReason = exports.Access = exports.Perms = exports.Units = exports.Formats = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar HAPServer_1 = require(\"./HAPServer\");\nvar clone_1 = require(\"./util/clone\");\nvar hapStatusError_1 = require(\"./util/hapStatusError\");\nvar once_1 = require(\"./util/once\");\nvar request_util_1 = require(\"./util/request-util\");\nvar uuid_1 = require(\"./util/uuid\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Characteristic\");\n/**\n * @group Characteristic\n */\nvar Formats;\n(function (Formats) {\n Formats[\"BOOL\"] = \"bool\";\n /**\n * Signed 32-bit integer\n */\n Formats[\"INT\"] = \"int\";\n /**\n * Signed 64-bit floating point\n */\n Formats[\"FLOAT\"] = \"float\";\n /**\n * String encoded in utf8\n */\n Formats[\"STRING\"] = \"string\";\n /**\n * Unsigned 8-bit integer.\n */\n Formats[\"UINT8\"] = \"uint8\";\n /**\n * Unsigned 16-bit integer.\n */\n Formats[\"UINT16\"] = \"uint16\";\n /**\n * Unsigned 32-bit integer.\n */\n Formats[\"UINT32\"] = \"uint32\";\n /**\n * Unsigned 64-bit integer.\n */\n Formats[\"UINT64\"] = \"uint64\";\n /**\n * Data is base64 encoded string.\n */\n Formats[\"DATA\"] = \"data\";\n /**\n * Base64 encoded tlv8 string.\n */\n Formats[\"TLV8\"] = \"tlv8\";\n /**\n * @deprecated Not contained in the HAP spec\n */\n Formats[\"ARRAY\"] = \"array\";\n /**\n * @deprecated Not contained in the HAP spec\n */\n Formats[\"DICTIONARY\"] = \"dict\";\n})(Formats = exports.Formats || (exports.Formats = {}));\n/**\n * @group Characteristic\n */\nvar Units;\n(function (Units) {\n /**\n * Celsius is the only temperature unit in the HomeKit Accessory Protocol.\n * Unit conversion is always done on the client side e.g. on the iPhone in the Home App depending on\n * the configured unit on the device itself.\n */\n Units[\"CELSIUS\"] = \"celsius\";\n Units[\"PERCENTAGE\"] = \"percentage\";\n Units[\"ARC_DEGREE\"] = \"arcdegrees\";\n Units[\"LUX\"] = \"lux\";\n Units[\"SECONDS\"] = \"seconds\";\n})(Units = exports.Units || (exports.Units = {}));\n/**\n * @group Characteristic\n */\nvar Perms;\n(function (Perms) {\n // noinspection JSUnusedGlobalSymbols\n /**\n * @deprecated replaced by {@link PAIRED_READ}. Kept for backwards compatibility.\n */\n Perms[\"READ\"] = \"pr\";\n /**\n * @deprecated replaced by {@link PAIRED_WRITE}. Kept for backwards compatibility.\n */\n Perms[\"WRITE\"] = \"pw\";\n Perms[\"PAIRED_READ\"] = \"pr\";\n Perms[\"PAIRED_WRITE\"] = \"pw\";\n Perms[\"NOTIFY\"] = \"ev\";\n Perms[\"EVENTS\"] = \"ev\";\n Perms[\"ADDITIONAL_AUTHORIZATION\"] = \"aa\";\n Perms[\"TIMED_WRITE\"] = \"tw\";\n Perms[\"HIDDEN\"] = \"hd\";\n Perms[\"WRITE_RESPONSE\"] = \"wr\";\n})(Perms = exports.Perms || (exports.Perms = {}));\n/**\n * Describes the abstract access to a {@link Characteristic}.\n * It abstracts the more granular access described by {@link Perms}.\n *\n * It is used in {@link CharacteristicProps.adminOnlyAccess}.\n *\n * @group Characteristic\n */\nvar Access;\n(function (Access) {\n Access[Access[\"READ\"] = 0] = \"READ\";\n Access[Access[\"WRITE\"] = 1] = \"WRITE\";\n Access[Access[\"NOTIFY\"] = 2] = \"NOTIFY\";\n})(Access = exports.Access || (exports.Access = {}));\n/**\n * @group Characteristic\n */\nvar ChangeReason;\n(function (ChangeReason) {\n /**\n * Reason used when HomeKit writes a value or the API user calls {@link Characteristic.setValue}.\n */\n ChangeReason[\"WRITE\"] = \"write\";\n /**\n * Reason used when the API user calls the method {@link Characteristic.updateValue}.\n */\n ChangeReason[\"UPDATE\"] = \"update\";\n /**\n * Used when HomeKit reads a value or the API user calls the deprecated method `Characteristic.getValue`.\n */\n ChangeReason[\"READ\"] = \"read\";\n /**\n * Used when call to {@link Characteristic.sendEventNotification} was made.\n */\n ChangeReason[\"EVENT\"] = \"event\";\n})(ChangeReason = exports.ChangeReason || (exports.ChangeReason = {}));\n/**\n * @group Characteristic\n */\nvar CharacteristicEventTypes;\n(function (CharacteristicEventTypes) {\n /**\n * This event is thrown when a HomeKit controller wants to read the current value of the characteristic.\n * The event handler should call the supplied callback as fast as possible.\n *\n * HAP-NodeJS will complain about slow running get handlers after 3 seconds and terminate the request after 10 seconds.\n */\n CharacteristicEventTypes[\"GET\"] = \"get\";\n /**\n * This event is thrown when a HomeKit controller wants to write a new value to the characteristic.\n * The event handler should call the supplied callback as fast as possible.\n *\n * HAP-NodeJS will complain about slow running set handlers after 3 seconds and terminate the request after 10 seconds.\n */\n CharacteristicEventTypes[\"SET\"] = \"set\";\n /**\n * Emitted after a new value is set for the characteristic.\n * The new value can be set via a request by a HomeKit controller or via an API call.\n */\n CharacteristicEventTypes[\"CHANGE\"] = \"change\";\n /**\n * @private\n */\n CharacteristicEventTypes[\"SUBSCRIBE\"] = \"subscribe\";\n /**\n * @private\n */\n CharacteristicEventTypes[\"UNSUBSCRIBE\"] = \"unsubscribe\";\n /**\n * @private\n */\n CharacteristicEventTypes[\"CHARACTERISTIC_WARNING\"] = \"characteristic-warning\";\n})(CharacteristicEventTypes = exports.CharacteristicEventTypes || (exports.CharacteristicEventTypes = {}));\n/**\n * @group Characteristic\n */\nvar ValidValuesIterable = /** @class */ (function () {\n function ValidValuesIterable(props) {\n (0, assert_1.default)((0, request_util_1.isNumericFormat)(props.format), \"Cannot instantiate valid values iterable when format is not numeric. Found \" + props.format);\n this.props = props;\n }\n ValidValuesIterable.prototype[Symbol.iterator] = function () {\n var _a, _b, value, e_1_1, min, max, stepValue, i;\n var e_1, _c;\n return tslib_1.__generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n if (!this.props.validValues) return [3 /*break*/, 9];\n _d.label = 1;\n case 1:\n _d.trys.push([1, 6, 7, 8]);\n _a = tslib_1.__values(this.props.validValues), _b = _a.next();\n _d.label = 2;\n case 2:\n if (!!_b.done) return [3 /*break*/, 5];\n value = _b.value;\n return [4 /*yield*/, value];\n case 3:\n _d.sent();\n _d.label = 4;\n case 4:\n _b = _a.next();\n return [3 /*break*/, 2];\n case 5: return [3 /*break*/, 8];\n case 6:\n e_1_1 = _d.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 8];\n case 7:\n try {\n if (_b && !_b.done && (_c = _a.return)) _c.call(_a);\n }\n finally { if (e_1) throw e_1.error; }\n return [7 /*endfinally*/];\n case 8: return [3 /*break*/, 13];\n case 9:\n min = 0;\n max = void 0;\n stepValue = 1;\n if (this.props.validValueRanges) {\n min = this.props.validValueRanges[0];\n max = this.props.validValueRanges[1];\n }\n else if (this.props.minValue != null && this.props.maxValue != null) {\n min = this.props.minValue;\n max = this.props.maxValue;\n if (this.props.minStep != null) {\n stepValue = this.props.minStep;\n }\n }\n else if ((0, request_util_1.isUnsignedNumericFormat)(this.props.format)) {\n max = (0, request_util_1.numericUpperBound)(this.props.format);\n }\n else {\n throw new Error(\"Could not find valid iterator strategy for props: \" + JSON.stringify(this.props));\n }\n i = min;\n _d.label = 10;\n case 10:\n if (!(i <= max)) return [3 /*break*/, 13];\n return [4 /*yield*/, i];\n case 11:\n _d.sent();\n _d.label = 12;\n case 12:\n i += stepValue;\n return [3 /*break*/, 10];\n case 13: return [2 /*return*/];\n }\n });\n };\n return ValidValuesIterable;\n}());\nvar numberPattern = /^-?\\d+$/;\nfunction extractHAPStatusFromError(error) {\n var errorValue = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n if (numberPattern.test(error.message)) {\n var value = parseInt(error.message, 10);\n if ((0, HAPServer_1.IsKnownHAPStatusError)(value)) {\n errorValue = value;\n }\n }\n return errorValue;\n}\nfunction maxWithUndefined(a, b) {\n if (a == null) {\n return b;\n }\n else if (b == null) {\n return a;\n }\n else {\n return Math.max(a, b);\n }\n}\nfunction minWithUndefined(a, b) {\n if (a == null) {\n return b;\n }\n else if (b == null) {\n return a;\n }\n else {\n return Math.min(a, b);\n }\n}\n/**\n * Characteristic represents a particular typed variable that can be assigned to a Service. For instance, a\n * \"Hue\" Characteristic might store a 'float' value of type 'arcdegrees'. You could add the Hue Characteristic\n * to a {@link Service} in order to store that value. A particular Characteristic is distinguished from others by its\n * UUID. HomeKit provides a set of known Characteristic UUIDs defined in HomeKit.ts along with a\n * corresponding concrete subclass.\n *\n * You can also define custom Characteristics by providing your own UUID. Custom Characteristics can be added\n * to any native or custom Services, but Siri will likely not be able to work with these.\n *\n * @group Characteristic\n */\nvar Characteristic = /** @class */ (function (_super) {\n tslib_1.__extends(Characteristic, _super);\n function Characteristic(displayName, UUID, props) {\n var _this = _super.call(this) || this;\n _this.iid = null;\n _this.value = null;\n /**\n * @deprecated replaced by {@link statusCode}\n * @private\n */\n _this.status = null;\n /**\n * @private\n */\n _this.statusCode = 0 /* HAPStatus.SUCCESS */;\n _this.subscriptions = 0;\n _this.displayName = displayName;\n _this.UUID = UUID;\n _this.props = {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */],\n };\n _this.setProps(props || {}); // ensure sanity checks are called\n return _this;\n }\n /**\n * Accepts a function that will be called to retrieve the current value of a Characteristic.\n * The function must return a valid Characteristic value for the Characteristic type.\n * May optionally return a promise.\n *\n * @example\n * ```ts\n * Characteristic.onGet(async () => {\n * return true;\n * });\n * ```\n * @param handler\n */\n Characteristic.prototype.onGet = function (handler) {\n if (typeof handler !== \"function\") {\n this.characteristicWarning(\".onGet handler must be a function\");\n return this;\n }\n this.getHandler = handler;\n return this;\n };\n /**\n * Removes the {@link CharacteristicGetHandler} handler which was configured using {@link onGet}.\n */\n Characteristic.prototype.removeOnGet = function () {\n this.getHandler = undefined;\n return this;\n };\n /**\n * Accepts a function that will be called when setting the value of a Characteristic.\n * If the characteristic supports {@link Perms.WRITE_RESPONSE} and the request requests a write-response value,\n * the returned value will be used.\n * May optionally return a promise.\n *\n * @example\n * ```ts\n * Characteristic.onSet(async (value: CharacteristicValue) => {\n * console.log(value);\n * });\n * ```\n * @param handler\n */\n Characteristic.prototype.onSet = function (handler) {\n if (typeof handler !== \"function\") {\n this.characteristicWarning(\".onSet handler must be a function\");\n return this;\n }\n this.setHandler = handler;\n return this;\n };\n /**\n * Removes the {@link CharacteristicSetHandler} which was configured using {@link onSet}.\n */\n Characteristic.prototype.removeOnSet = function () {\n this.setHandler = undefined;\n return this;\n };\n /**\n * Updates the properties of this characteristic.\n * Properties passed via the parameter will be set. Any parameter set to null will be deleted.\n * See {@link CharacteristicProps}.\n *\n * @param props - Partial properties object with the desired updates.\n */\n Characteristic.prototype.setProps = function (props) {\n (0, assert_1.default)(props, \"props cannot be undefined when setting props\");\n // TODO calling setProps after publish doesn't lead to a increment in the current configuration number\n var formatDidChange = false;\n // for every value \"null\" can be used to reset props, except for required props\n if (props.format) {\n formatDidChange = this.props.format !== props.format;\n this.props.format = props.format;\n }\n if (props.perms) {\n (0, assert_1.default)(props.perms.length > 0, \"characteristic prop perms cannot be empty array\");\n this.props.perms = props.perms;\n }\n if (props.unit !== undefined) {\n this.props.unit = props.unit != null ? props.unit : undefined;\n }\n if (props.description !== undefined) {\n this.props.description = props.description != null ? props.description : undefined;\n }\n // check minValue is valid for the format type\n if (props.minValue !== undefined) {\n if (props.minValue === null) {\n props.minValue = undefined;\n }\n else if (!(0, request_util_1.isNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'minValue' can only be set for characteristics with numeric format, but not for \" + this.props.format, \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.minValue = undefined;\n }\n else if (typeof props.minValue !== \"number\" || !Number.isFinite(props.minValue)) {\n this.characteristicWarning(\"Characteristic Property 'minValue' must be a finite number, received \\\"\".concat(props.minValue, \"\\\" (\").concat(typeof props.minValue, \")\"), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.minValue = undefined;\n }\n else {\n if (props.minValue < (0, request_util_1.numericLowerBound)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'minValue' was set to \" + props.minValue + \", but for numeric format \" +\n this.props.format + \" minimum possible is \" + (0, request_util_1.numericLowerBound)(this.props.format), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.minValue = (0, request_util_1.numericLowerBound)(this.props.format);\n }\n else if (props.minValue > (0, request_util_1.numericUpperBound)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'minValue' was set to \" + props.minValue + \", but for numeric format \" +\n this.props.format + \" maximum possible is \" + (0, request_util_1.numericUpperBound)(this.props.format), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.minValue = (0, request_util_1.numericLowerBound)(this.props.format);\n }\n }\n this.props.minValue = props.minValue;\n }\n // check maxValue is valid for the format type\n if (props.maxValue !== undefined) {\n if (props.maxValue === null) {\n props.maxValue = undefined;\n }\n else if (!(0, request_util_1.isNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'maxValue' can only be set for characteristics with numeric format, but not for \" + this.props.format, \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.maxValue = undefined;\n }\n else if (typeof props.maxValue !== \"number\" || !Number.isFinite(props.maxValue)) {\n this.characteristicWarning(\"Characteristic Property 'maxValue' must be a finite number, received \\\"\".concat(props.maxValue, \"\\\" (\").concat(typeof props.maxValue, \")\"), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.maxValue = undefined;\n }\n else {\n if (props.maxValue > (0, request_util_1.numericUpperBound)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'maxValue' was set to \" + props.maxValue + \", but for numeric format \" +\n this.props.format + \" maximum possible is \" + (0, request_util_1.numericUpperBound)(this.props.format), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.maxValue = (0, request_util_1.numericUpperBound)(this.props.format);\n }\n else if (props.maxValue < (0, request_util_1.numericLowerBound)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property 'maxValue' was set to \" + props.maxValue + \", but for numeric format \" +\n this.props.format + \" minimum possible is \" + (0, request_util_1.numericLowerBound)(this.props.format), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n props.maxValue = (0, request_util_1.numericUpperBound)(this.props.format);\n }\n }\n this.props.maxValue = props.maxValue;\n }\n if (props.minStep !== undefined) {\n if (props.minStep === null) {\n this.props.minStep = undefined;\n }\n else if (!(0, request_util_1.isNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property `minStep` can only be set for characteristics with numeric format, but not for \" + this.props.format, \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n }\n else {\n if (props.minStep < 1 && (0, request_util_1.isIntegerNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property `minStep` was set to a value lower than 1, \" +\n \"this will have no effect on format `\" + this.props.format);\n }\n this.props.minStep = props.minStep;\n }\n }\n if (props.maxLen !== undefined) {\n if (props.maxLen === null) {\n this.props.maxLen = undefined;\n }\n else if (this.props.format !== \"string\" /* Formats.STRING */) {\n this.characteristicWarning(\"Characteristic Property `maxLen` can only be set for characteristics with format `STRING`, but not for \" + this.props.format, \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n }\n else {\n if (props.maxLen > 256) {\n this.characteristicWarning(\"Characteristic Property string `maxLen` cannot be bigger than 256\");\n props.maxLen = 256;\n }\n this.props.maxLen = props.maxLen;\n }\n }\n if (props.maxDataLen !== undefined) {\n if (props.maxDataLen === null) {\n this.props.maxDataLen = undefined;\n }\n else if (this.props.format !== \"data\" /* Formats.DATA */) {\n this.characteristicWarning(\"Characteristic Property `maxDataLen` can only be set for characteristics with format `DATA`, but not for \" + this.props.format, \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n }\n else {\n this.props.maxDataLen = props.maxDataLen;\n }\n }\n if (props.validValues !== undefined) {\n if (props.validValues === null) {\n this.props.validValues = undefined;\n }\n else if (!(0, request_util_1.isNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property `validValues` was supplied for non numeric format \" + this.props.format);\n }\n else {\n (0, assert_1.default)(props.validValues.length, \"characteristic prop validValues cannot be empty array\");\n this.props.validValues = props.validValues;\n }\n }\n if (props.validValueRanges !== undefined) {\n if (props.validValueRanges === null) {\n this.props.validValueRanges = undefined;\n }\n else if (!(0, request_util_1.isNumericFormat)(this.props.format)) {\n this.characteristicWarning(\"Characteristic Property `validValueRanges` was supplied for non numeric format \" + this.props.format);\n }\n else {\n (0, assert_1.default)(props.validValueRanges.length === 2, \"characteristic prop validValueRanges must have a length of 2\");\n this.props.validValueRanges = props.validValueRanges;\n }\n }\n if (props.adminOnlyAccess !== undefined) {\n this.props.adminOnlyAccess = props.adminOnlyAccess != null ? props.adminOnlyAccess : undefined;\n }\n if (this.props.minValue != null && this.props.maxValue != null) { // the eqeq instead of eqeqeq is important here\n if (this.props.minValue > this.props.maxValue) { // see https://github.com/homebridge/HAP-NodeJS/issues/690\n this.props.minValue = undefined;\n this.props.maxValue = undefined;\n throw new Error(\"Error setting CharacteristicsProps for '\" + this.displayName + \"': 'minValue' cannot be greater or equal the 'maxValue'!\");\n }\n }\n if (((0, request_util_1.isNumericFormat)(this.props.format) || this.props.format === \"string\" /* Formats.STRING */)\n && this.value != null\n && !formatDidChange\n && this.statusCode === 0 /* HAPStatus.SUCCESS */\n && this.UUID !== Characteristic.ProgrammableSwitchEvent.UUID) {\n // explaining the if statement above:\n // - We only do a check for numeric and string formats as they are the only ones affected by characteristic property restrictions.\n // - There must be a value to begin with. Otherwise, it should just stay not having a value at all (anything else is guess work).\n // - If the format is changed through `setProps` we rely on the user to supply a valid value after the `setProps` call!\n // - If the characteristic is marked as erroneous the value is not considered valid anyway, and we must not remove the `statusCode`.\n // - Special case for `ProgrammableSwitchEvent` where every change in value is considered an event which would result in ghost button presses\n // validateUserInput when called from setProps is intended to clamp value withing allowed range. It is why warnings should not be displayed.\n var correctedValue = this.validateUserInput(this.value, \"debug-message\" /* CharacteristicWarningType.DEBUG_MESSAGE */);\n if (correctedValue !== this.value) {\n // we don't want to emit a CHANGE event if the value didn't change at all!\n this.updateValue(correctedValue);\n }\n }\n return this;\n };\n /**\n * This method can be used to gain an Iterator to loop over all valid values defined for this characteristic.\n *\n * The range of valid values can be defined using three different ways via the {@link CharacteristicProps} object\n * (set via the {@link setProps} method):\n * * First method is to specifically list every valid value inside {@link CharacteristicProps.validValues}\n * * Second you can specify a range via {@link CharacteristicProps.minValue} and {@link CharacteristicProps.maxValue} (with optionally defining\n * {@link CharacteristicProps.minStep})\n * * And lastly you can specify a range via {@link CharacteristicProps.validValueRanges}\n * * Implicitly a valid value range is predefined for characteristics with Format {@link Formats.UINT8}, {@link Formats.UINT16},\n * {@link Formats.UINT32} and {@link Formats.UINT64}: starting by zero to their respective maximum number\n *\n * The method will automatically detect which type of valid values definition is used and provide\n * the correct Iterator for that case.\n *\n * Note: This method is (obviously) only valid for numeric characteristics.\n *\n * @example\n * ```ts\n * // use the iterator to loop over every valid value...\n * for (const value of characteristic.validValuesIterator()) {\n * // Insert logic to run for every\n * }\n *\n * // ... or collect them in an array for storage or manipulation\n * const validValues = Array.from(characteristic.validValuesIterator());\n * ```\n */\n Characteristic.prototype.validValuesIterator = function () {\n return new ValidValuesIterable(this.props);\n };\n // noinspection JSUnusedGlobalSymbols\n /**\n * This method can be used to set up additional authorization for a characteristic.\n * For one, it adds the {@link Perms.ADDITIONAL_AUTHORIZATION} permission to the characteristic\n * (if it wasn't already) to signal support for additional authorization to HomeKit.\n * Additionally, an {@link AdditionalAuthorizationHandler} is set up which is called\n * before a write request is performed.\n *\n * Additional Authorization Data can be added to SET request via a custom iOS App.\n * Before hap-nodejs executes a write request it will call the {@link AdditionalAuthorizationHandler}\n * with 'authData' supplied in the write request. The 'authData' is a base64 encoded string\n * (or undefined if no authData was supplied).\n * The {@link AdditionalAuthorizationHandler} must then return true or false to indicate if the write request\n * is authorized and should be accepted.\n *\n * @param handler - Handler called to check additional authorization data.\n */\n Characteristic.prototype.setupAdditionalAuthorization = function (handler) {\n if (!this.props.perms.includes(\"aa\" /* Perms.ADDITIONAL_AUTHORIZATION */)) {\n this.props.perms.push(\"aa\" /* Perms.ADDITIONAL_AUTHORIZATION */);\n }\n this.additionalAuthorizationHandler = handler;\n };\n /**\n * Updates the current value of the characteristic.\n *\n * @param callback\n * @param context\n * @private use to return the current value on HAP requests\n *\n * @deprecated\n */\n Characteristic.prototype.getValue = function (callback, context) {\n this.handleGetRequest(undefined, context).then(function (value) {\n if (callback) {\n callback(null, value);\n }\n }, function (reason) {\n if (callback) {\n callback(reason);\n }\n });\n };\n Characteristic.prototype.setValue = function (value, callback, context) {\n if (value instanceof Error) {\n this.statusCode = value instanceof hapStatusError_1.HapStatusError ? value.hapStatus : extractHAPStatusFromError(value);\n // noinspection JSDeprecatedSymbols\n this.status = value;\n if (callback) {\n callback();\n }\n return this;\n }\n if (callback && !context && typeof callback !== \"function\") {\n context = callback;\n callback = undefined;\n }\n try {\n value = this.validateUserInput(value);\n }\n catch (error) {\n this.characteristicWarning((error === null || error === void 0 ? void 0 : error.message) + \"\", \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n if (callback) {\n callback(error);\n }\n return this;\n }\n this.handleSetRequest(value, undefined, context).then(function (value) {\n if (callback) {\n if (value) { // possible write response\n callback(null, value);\n }\n else {\n callback(null);\n }\n }\n }, function (reason) {\n if (callback) {\n callback(reason);\n }\n });\n return this;\n };\n Characteristic.prototype.updateValue = function (value, callback, context) {\n if (value instanceof Error) {\n this.statusCode = value instanceof hapStatusError_1.HapStatusError ? value.hapStatus : extractHAPStatusFromError(value);\n // noinspection JSDeprecatedSymbols\n this.status = value;\n if (callback) {\n callback();\n }\n return this;\n }\n if (callback && !context && typeof callback !== \"function\") {\n context = callback;\n callback = undefined;\n }\n try {\n value = this.validateUserInput(value);\n }\n catch (error) {\n this.characteristicWarning((error === null || error === void 0 ? void 0 : error.message) + \"\", \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n if (callback) {\n callback();\n }\n return this;\n }\n this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n this.status = null;\n var oldValue = this.value;\n this.value = value;\n if (callback) {\n callback();\n }\n this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: undefined, oldValue: oldValue, newValue: value, reason: \"update\" /* ChangeReason.UPDATE */, context: context });\n return this; // for chaining\n };\n /**\n * This method acts similarly to {@link updateValue} by setting the current value of the characteristic\n * without calling any {@link CharacteristicEventTypes.SET} or {@link onSet} handlers.\n * The difference is that this method forces an event notification sent (updateValue only sends one if the value changed).\n * This is especially useful for characteristics like {@link Characteristic.ButtonEvent} or {@link Characteristic.ProgrammableSwitchEvent}.\n *\n * @param value - The new value.\n * @param context - Passed to the {@link CharacteristicEventTypes.CHANGE} event handler.\n */\n Characteristic.prototype.sendEventNotification = function (value, context) {\n this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n this.status = null;\n value = this.validateUserInput(value);\n var oldValue = this.value;\n this.value = value;\n this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: undefined, oldValue: oldValue, newValue: value, reason: \"event\" /* ChangeReason.EVENT */, context: context });\n return this; // for chaining\n };\n /**\n * Called when a HAP requests wants to know the current value of the characteristic.\n *\n * @param connection - The HAP connection from which the request originated from.\n * @param context - Deprecated parameter. There for backwards compatibility.\n * @private Used by the Accessory to load the characteristic value\n */\n Characteristic.prototype.handleGetRequest = function (connection, context) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var value, oldValue, error_1, hapStatusError;\n var _this = this;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.props.perms.includes(\"pr\" /* Perms.PAIRED_READ */)) { // check if we are allowed to read from this characteristic\n throw -70405 /* HAPStatus.WRITE_ONLY_CHARACTERISTIC */;\n }\n if (this.UUID === Characteristic.ProgrammableSwitchEvent.UUID) {\n // special workaround for event only programmable switch event, which must always return null\n return [2 /*return*/, null];\n }\n if (!this.getHandler) return [3 /*break*/, 4];\n if (this.listeners(\"get\" /* CharacteristicEventTypes.GET */).length > 0) {\n this.characteristicWarning(\"Ignoring on('get') handler as onGet handler was defined instead\");\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.getHandler(context, connection)];\n case 2:\n value = _a.sent();\n this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n this.status = null;\n try {\n value = this.validateUserInput(value);\n }\n catch (error) {\n this.characteristicWarning(\"An illegal value was supplied by the read handler for characteristic: \".concat(error === null || error === void 0 ? void 0 : error.message), \"warn-message\" /* CharacteristicWarningType.WARN_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n // noinspection JSDeprecatedSymbols\n this.status = error;\n return [2 /*return*/, Promise.reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */)];\n }\n oldValue = this.value;\n this.value = value;\n if (oldValue !== value) { // emit a change event if necessary\n this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: \"read\" /* ChangeReason.READ */, context: context });\n }\n return [2 /*return*/, value];\n case 3:\n error_1 = _a.sent();\n if (typeof error_1 === \"number\") {\n hapStatusError = new hapStatusError_1.HapStatusError(error_1);\n this.statusCode = hapStatusError.hapStatus;\n // noinspection JSDeprecatedSymbols\n this.status = hapStatusError;\n }\n else if (error_1 instanceof hapStatusError_1.HapStatusError) {\n this.statusCode = error_1.hapStatus;\n // noinspection JSDeprecatedSymbols\n this.status = error_1;\n }\n else {\n this.characteristicWarning(\"Unhandled error thrown inside read handler for characteristic: \".concat(error_1 === null || error_1 === void 0 ? void 0 : error_1.message), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error_1 === null || error_1 === void 0 ? void 0 : error_1.stack);\n this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n // noinspection JSDeprecatedSymbols\n this.status = error_1;\n }\n throw this.statusCode;\n case 4:\n if (this.listeners(\"get\" /* CharacteristicEventTypes.GET */).length === 0) {\n if (this.statusCode) {\n throw this.statusCode;\n }\n try {\n return [2 /*return*/, this.validateUserInput(this.value)];\n }\n catch (error) {\n this.characteristicWarning(\"An illegal value was supplied by setting `value` for characteristic: \".concat(error === null || error === void 0 ? void 0 : error.message), \"warn-message\" /* CharacteristicWarningType.WARN_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n return [2 /*return*/, Promise.reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */)];\n }\n }\n return [2 /*return*/, new Promise(function (resolve, reject) {\n try {\n _this.emit(\"get\" /* CharacteristicEventTypes.GET */, (0, once_1.once)(function (status, value) {\n if (status) {\n if (typeof status === \"number\") {\n var hapStatusError = new hapStatusError_1.HapStatusError(status);\n _this.statusCode = hapStatusError.hapStatus;\n // noinspection JSDeprecatedSymbols\n _this.status = hapStatusError;\n }\n else if (status instanceof hapStatusError_1.HapStatusError) {\n _this.statusCode = status.hapStatus;\n // noinspection JSDeprecatedSymbols\n _this.status = status;\n }\n else {\n debug(\"[%s] Received error from get handler %s\", _this.displayName, status.stack);\n _this.statusCode = extractHAPStatusFromError(status);\n // noinspection JSDeprecatedSymbols\n _this.status = status;\n }\n reject(_this.statusCode);\n return;\n }\n _this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n _this.status = null;\n value = _this.validateUserInput(value);\n var oldValue = _this.value;\n _this.value = value;\n resolve(value);\n if (oldValue !== value) { // emit a change event if necessary\n _this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: \"read\" /* ChangeReason.READ */, context: context });\n }\n }), context, connection);\n }\n catch (error) {\n _this.characteristicWarning(\"Unhandled error thrown inside read handler for characteristic: \".concat(error === null || error === void 0 ? void 0 : error.message), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n _this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n // noinspection JSDeprecatedSymbols\n _this.status = error;\n reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n })];\n }\n });\n });\n };\n /**\n * Called when a HAP requests update the current value of the characteristic.\n *\n * @param value - The updated value\n * @param connection - The connection from which the request originated from\n * @param context - Deprecated parameter. There for backwards compatibility.\n * @returns Promise resolve to void in normal operation. When characteristic supports write-response, HAP\n * requests a write-response and the set handler returns a write-response value, the respective\n * write response value is resolved.\n * @private\n */\n Characteristic.prototype.handleSetRequest = function (value, connection, context) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var oldValue, writeResponse, error_2, hapStatusError;\n var _this = this;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n this.status = null;\n if (connection !== undefined) {\n // if connection is undefined, the set \"request\" comes from the setValue method.\n // for setValue a value of \"null\" is allowed and checked via validateUserInput.\n try {\n value = this.validateClientSuppliedValue(value);\n }\n catch (e) {\n debug(\"[\".concat(this.displayName, \"]\"), e.message);\n return [2 /*return*/, Promise.reject(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */)];\n }\n }\n oldValue = this.value;\n if (!this.setHandler) return [3 /*break*/, 4];\n if (this.listeners(\"set\" /* CharacteristicEventTypes.SET */).length > 0) {\n this.characteristicWarning(\"Ignoring on('set') handler as onSet handler was defined instead\");\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.setHandler(value, context, connection)];\n case 2:\n writeResponse = _a.sent();\n this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n this.status = null;\n if (writeResponse != null && this.props.perms.includes(\"wr\" /* Perms.WRITE_RESPONSE */)) {\n this.value = this.validateUserInput(writeResponse);\n return [2 /*return*/, this.value];\n }\n else {\n if (writeResponse != null) {\n this.characteristicWarning(\"SET handler returned write response value, though the characteristic doesn't support write response\", \"debug-message\" /* CharacteristicWarningType.DEBUG_MESSAGE */);\n }\n this.value = value;\n this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: \"write\" /* ChangeReason.WRITE */, context: context });\n return [2 /*return*/];\n }\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n if (typeof error_2 === \"number\") {\n hapStatusError = new hapStatusError_1.HapStatusError(error_2);\n this.statusCode = hapStatusError.hapStatus;\n // noinspection JSDeprecatedSymbols\n this.status = hapStatusError;\n }\n else if (error_2 instanceof hapStatusError_1.HapStatusError) {\n this.statusCode = error_2.hapStatus;\n // noinspection JSDeprecatedSymbols\n this.status = error_2;\n }\n else {\n this.characteristicWarning(\"Unhandled error thrown inside write handler for characteristic: \".concat(error_2 === null || error_2 === void 0 ? void 0 : error_2.message), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error_2 === null || error_2 === void 0 ? void 0 : error_2.stack);\n this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n // noinspection JSDeprecatedSymbols\n this.status = error_2;\n }\n throw this.statusCode;\n case 4:\n if (this.listeners(\"set\" /* CharacteristicEventTypes.SET */).length === 0) {\n this.value = value;\n this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: \"write\" /* ChangeReason.WRITE */, context: context });\n return [2 /*return*/, Promise.resolve()];\n }\n else {\n return [2 /*return*/, new Promise(function (resolve, reject) {\n try {\n _this.emit(\"set\" /* CharacteristicEventTypes.SET */, value, (0, once_1.once)(function (status, writeResponse) {\n if (status) {\n if (typeof status === \"number\") {\n var hapStatusError = new hapStatusError_1.HapStatusError(status);\n _this.statusCode = hapStatusError.hapStatus;\n // noinspection JSDeprecatedSymbols\n _this.status = hapStatusError;\n }\n else if (status instanceof hapStatusError_1.HapStatusError) {\n _this.statusCode = status.hapStatus;\n // noinspection JSDeprecatedSymbols\n _this.status = status;\n }\n else {\n debug(\"[%s] Received error from set handler %s\", _this.displayName, status.stack);\n _this.statusCode = extractHAPStatusFromError(status);\n // noinspection JSDeprecatedSymbols\n _this.status = status;\n }\n reject(_this.statusCode);\n return;\n }\n _this.statusCode = 0 /* HAPStatus.SUCCESS */;\n // noinspection JSDeprecatedSymbols\n _this.status = null;\n if (writeResponse != null && _this.props.perms.includes(\"wr\" /* Perms.WRITE_RESPONSE */)) {\n // support write response simply by letting the implementor pass the response as second argument to the callback\n _this.value = _this.validateUserInput(writeResponse);\n resolve(_this.value);\n }\n else {\n if (writeResponse != null) {\n _this.characteristicWarning(\"SET handler returned write response value, though the characteristic doesn't support write response\", \"debug-message\" /* CharacteristicWarningType.DEBUG_MESSAGE */);\n }\n _this.value = value;\n resolve();\n _this.emit(\"change\" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: \"write\" /* ChangeReason.WRITE */, context: context });\n }\n }), context, connection);\n }\n catch (error) {\n _this.characteristicWarning(\"Unhandled error thrown inside write handler for characteristic: \".concat(error === null || error === void 0 ? void 0 : error.message), \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);\n _this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n // noinspection JSDeprecatedSymbols\n _this.status = error;\n reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n })];\n }\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Called once a HomeKit controller subscribes to events of this characteristic.\n * @private\n */\n Characteristic.prototype.subscribe = function () {\n if (this.subscriptions === 0) {\n this.emit(\"subscribe\" /* CharacteristicEventTypes.SUBSCRIBE */);\n }\n this.subscriptions++;\n };\n /**\n * Called once a HomeKit controller unsubscribe to events of this characteristic or a HomeKit controller\n * which was subscribed to this characteristic disconnects.\n * @private\n */\n Characteristic.prototype.unsubscribe = function () {\n var wasOne = this.subscriptions === 1;\n this.subscriptions--;\n this.subscriptions = Math.max(this.subscriptions, 0);\n if (wasOne) {\n this.emit(\"unsubscribe\" /* CharacteristicEventTypes.UNSUBSCRIBE */);\n }\n };\n Characteristic.prototype.getDefaultValue = function () {\n var _a;\n // noinspection JSDeprecatedSymbols\n switch (this.props.format) {\n case \"bool\" /* Formats.BOOL */:\n return false;\n case \"string\" /* Formats.STRING */:\n switch (this.UUID) {\n case Characteristic.Manufacturer.UUID:\n return \"Default-Manufacturer\";\n case Characteristic.Model.UUID:\n return \"Default-Model\";\n case Characteristic.SerialNumber.UUID:\n return \"Default-SerialNumber\";\n case Characteristic.FirmwareRevision.UUID:\n return \"0.0.0\";\n default:\n return \"\";\n }\n case \"data\" /* Formats.DATA */:\n return \"\"; // who knows!\n case \"tlv8\" /* Formats.TLV8 */:\n return \"\"; // who knows!\n case \"dict\" /* Formats.DICTIONARY */:\n return {};\n case \"array\" /* Formats.ARRAY */:\n return [];\n case \"int\" /* Formats.INT */:\n case \"float\" /* Formats.FLOAT */:\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */:\n switch (this.UUID) {\n case Characteristic.CurrentTemperature.UUID:\n return 0; // some existing integrations expect this to be 0 by default\n default: {\n if (((_a = this.props.validValues) === null || _a === void 0 ? void 0 : _a.length) && typeof this.props.validValues[0] === \"number\") {\n return this.props.validValues[0];\n }\n if (typeof this.props.minValue === \"number\" && Number.isFinite(this.props.minValue)) {\n return this.props.minValue;\n }\n return 0;\n }\n }\n default:\n return 0;\n }\n };\n /**\n * Checks if the value received from the HAP request is valid.\n * If returned false the received value is not valid and {@link HAPStatus.INVALID_VALUE_IN_REQUEST}\n * must be returned.\n * @param value - Value supplied by the HomeKit controller\n */\n Characteristic.prototype.validateClientSuppliedValue = function (value) {\n if (value == null) {\n throw new Error(\"Client supplied invalid value for \".concat(this.props.format, \": \").concat(value));\n }\n switch (this.props.format) {\n case \"bool\" /* Formats.BOOL */: {\n if (typeof value === \"boolean\") {\n return value;\n }\n if (typeof value === \"number\" && (value === 1 || value === 0)) {\n return Boolean(value);\n }\n throw new Error(\"Client supplied invalid type for \".concat(this.props.format, \": \\\"\").concat(value, \"\\\" (\").concat(typeof value, \")\"));\n }\n case \"int\" /* Formats.INT */:\n case \"float\" /* Formats.FLOAT */:\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */: {\n if (typeof value === \"boolean\") {\n value = value ? 1 : 0;\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(\"Client supplied invalid type for \".concat(this.props.format, \": \\\"\").concat(value, \"\\\" (\").concat(typeof value, \")\"));\n }\n var numericMin = maxWithUndefined(this.props.minValue, (0, request_util_1.numericLowerBound)(this.props.format));\n var numericMax = minWithUndefined(this.props.maxValue, (0, request_util_1.numericUpperBound)(this.props.format));\n if (typeof numericMin === \"number\" && value < numericMin) {\n throw new Error(\"Client supplied value of \".concat(value, \" is less than the minimum allowed value of \").concat(numericMin));\n }\n if (typeof numericMax === \"number\" && value > numericMax) {\n throw new Error(\"Client supplied value of \".concat(value, \" is greater than the maximum allowed value of \").concat(numericMax));\n }\n if (this.props.validValues && !this.props.validValues.includes(value)) {\n throw new Error(\"Client supplied value of \".concat(value, \" is not in \").concat(this.props.validValues.toString()));\n }\n if (this.props.validValueRanges && this.props.validValueRanges.length === 2) {\n if (value < this.props.validValueRanges[0]) {\n throw new Error(\"Client supplied value of \".concat(value, \" is less than the minimum allowed value of \").concat(this.props.validValueRanges[0]));\n }\n if (value > this.props.validValueRanges[1]) {\n throw new Error(\"Client supplied value of \".concat(value, \" is greater than the maximum allowed value of \").concat(this.props.validValueRanges[1]));\n }\n }\n return value;\n }\n case \"string\" /* Formats.STRING */: {\n if (typeof value !== \"string\") {\n throw new Error(\"Client supplied invalid type for \".concat(this.props.format, \": \\\"\").concat(value, \"\\\" (\").concat(typeof value, \")\"));\n }\n var maxLength = this.props.maxLen != null ? this.props.maxLen : 64; // default is 64; max is 256 which is set in setProps\n if (value.length > maxLength) {\n throw new Error(\"Client supplied value length of \".concat(value.length, \" exceeds maximum length allowed of \").concat(maxLength));\n }\n return value;\n }\n case \"data\" /* Formats.DATA */: {\n if (typeof value !== \"string\") {\n throw new Error(\"Client supplied invalid type for \".concat(this.props.format, \": \\\"\").concat(value, \"\\\" (\").concat(typeof value, \")\"));\n }\n // we don't validate base64 here\n var maxLength = this.props.maxDataLen != null ? this.props.maxDataLen : 0x200000; // default is 0x200000\n if (value.length > maxLength) {\n throw new Error(\"Client supplied value length of \".concat(value.length, \" exceeds maximum length allowed of \").concat(maxLength));\n }\n return value;\n }\n case \"tlv8\" /* Formats.TLV8 */:\n if (typeof value !== \"string\") {\n throw new Error(\"Client supplied invalid type for \".concat(this.props.format, \": \\\"\").concat(value, \"\\\" (\").concat(typeof value, \")\"));\n }\n return value;\n }\n return value;\n };\n /**\n * Checks if the value received from the API call is valid.\n * It adjusts the value where it makes sense, prints a warning where values may be rejected with an error\n * in the future and throws an error which can't be converted to a valid value.\n *\n * @param value - The value received from the API call\n * @param warningType - Optionally defines the warning type to use when raising a {@link CharacteristicEventTypes.CHARACTERISTIC_WARNING}.\n */\n Characteristic.prototype.validateUserInput = function (value, warningType) {\n var _a;\n if (warningType === void 0) { warningType = \"warn-message\" /* CharacteristicWarningType.WARN_MESSAGE */; }\n if (value === null) {\n if (this.UUID === Characteristic.Model.UUID || this.UUID === Characteristic.SerialNumber.UUID) { // mirrors the statement in case: Formats.STRING\n this.characteristicWarning(\"characteristic must have a non null value otherwise HomeKit will reject this accessory, ignoring new value\", \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n return this.value; // don't change the value\n }\n if (this.props.format === \"data\" /* Formats.DATA */ || this.props.format === \"tlv8\" /* Formats.TLV8 */) {\n return value; // TLV8 and DATA formats are allowed to have null as a value\n }\n /**\n * A short disclaimer here.\n * null is actually a perfectly valid value for characteristics to have.\n * The Home app will show \"no response\" for some characteristics for which it can't handle null\n * but ultimately its valid and the developers decision what the return.\n * BUT: out of history hap-nodejs did replace null with the last known value and thus\n * homebridge devs started to adopting this method as a way of not changing the value in a GET handler.\n * As an intermediate step we kept the behavior but added a warning printed to the console.\n * In a future update we will do the breaking change of return null below!\n */\n if (this.UUID.endsWith(uuid_1.BASE_UUID)) { // we have an apple defined characteristic (at least assuming nobody else uses the UUID namespace)\n if (this.UUID === Characteristic.ProgrammableSwitchEvent.UUID) {\n return value; // null is allowed as a value for ProgrammableSwitchEvent\n }\n this.characteristicWarning(\"characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics\", warningType);\n // if the value has been set previously, return it now, otherwise continue with validation to have a default value set.\n if (this.value !== null) {\n return this.value;\n }\n }\n else {\n // we currently allow null for any non-custom defined characteristics\n return value;\n }\n }\n switch (this.props.format) {\n case \"bool\" /* Formats.BOOL */: {\n if (typeof value === \"boolean\") {\n return value;\n }\n if (typeof value === \"number\") {\n return value === 1;\n }\n if (typeof value === \"string\") {\n return value === \"1\" || value === \"true\";\n }\n this.characteristicWarning(\"characteristic value expected boolean and received \" + typeof value, warningType);\n return false;\n }\n case \"int\" /* Formats.INT */:\n case \"float\" /* Formats.FLOAT */:\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */: {\n if (typeof value === \"boolean\") {\n value = value ? 1 : 0;\n }\n if (typeof value === \"string\") {\n value = this.props.format === \"float\" /* Formats.FLOAT */ ? parseFloat(value) : parseInt(value, 10);\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n this.characteristicWarning(\"characteristic value expected valid finite number and received \\\"\".concat(value, \"\\\" (\").concat(typeof value, \")\"), warningType);\n value = typeof this.value === \"number\" ? this.value : this.props.minValue || 0;\n }\n var numericMin = maxWithUndefined(this.props.minValue, (0, request_util_1.numericLowerBound)(this.props.format));\n var numericMax = minWithUndefined(this.props.maxValue, (0, request_util_1.numericUpperBound)(this.props.format));\n var stepValue = undefined;\n if (this.props.format === \"float\" /* Formats.FLOAT */) {\n stepValue = this.props.minStep;\n }\n else {\n stepValue = maxWithUndefined(this.props.minStep, 1);\n }\n if (stepValue != null && stepValue > 0) {\n var minValue = this.props.minValue != null ? this.props.minValue : 0;\n value = stepValue * Math.round((value - minValue) / stepValue) + minValue;\n }\n if (numericMin != null && value < numericMin) {\n this.characteristicWarning(\"characteristic was supplied illegal value: number \".concat(value, \" exceeded minimum of \").concat(numericMin), warningType);\n value = numericMin;\n }\n if (numericMax != null && value > numericMax) {\n this.characteristicWarning(\"characteristic was supplied illegal value: number \".concat(value, \" exceeded maximum of \").concat(numericMax), warningType);\n value = numericMax;\n }\n if (this.props.validValues && !this.props.validValues.includes(value)) {\n this.characteristicWarning(\"characteristic value \".concat(value, \" is not contained in valid values array\"), warningType);\n return this.props.validValues.includes(this.value) ? this.value : (this.props.validValues[0] || 0);\n }\n if (this.props.validValueRanges && this.props.validValueRanges.length === 2) {\n if (value < this.props.validValueRanges[0]) {\n this.characteristicWarning(\"characteristic was supplied illegal value: number \".concat(value, \" not contained in valid value range of \").concat(this.props.validValueRanges, \", supplying illegal values will throw errors in the future\"), warningType);\n value = this.props.validValueRanges[0];\n }\n else if (value > this.props.validValueRanges[1]) {\n this.characteristicWarning(\"characteristic was supplied illegal value: number \".concat(value, \" not contained in valid value range of \").concat(this.props.validValueRanges, \", supplying illegal values will throw errors in the future\"), warningType);\n value = this.props.validValueRanges[1];\n }\n }\n return value;\n }\n case \"string\" /* Formats.STRING */: {\n if (typeof value === \"number\") {\n this.characteristicWarning(\"characteristic was supplied illegal value: number instead of string, \" +\n \"supplying illegal values will throw errors in the future\", warningType);\n value = String(value);\n }\n if (typeof value !== \"string\") {\n this.characteristicWarning(\"characteristic value expected string and received \" + (typeof value), warningType);\n value = typeof this.value === \"string\" ? this.value : value + \"\";\n }\n // mirrors the case value = null at the beginning\n if (value.length <= 1 && (this.UUID === Characteristic.Model.UUID || this.UUID === Characteristic.SerialNumber.UUID)) {\n this.characteristicWarning(\"[\".concat(this.displayName, \"] characteristic must have a length of more than 1 character otherwise HomeKit will reject this accessory, ignoring new value\"), warningType);\n return this.value; // just return the current value\n }\n var maxLength = (_a = this.props.maxLen) !== null && _a !== void 0 ? _a : 64; // default is 64 (max is 256 which is set in setProps)\n if (value.length > maxLength) {\n this.characteristicWarning(\"characteristic was supplied illegal value: string '\".concat(value, \"' exceeded max length of \").concat(maxLength), warningType);\n value = value.substring(0, maxLength);\n }\n return value;\n }\n case \"data\" /* Formats.DATA */:\n if (typeof value !== \"string\") {\n throw new Error(\"characteristic with DATA format must have string value\");\n }\n if (this.props.maxDataLen != null && value.length > this.props.maxDataLen) {\n // can't cut it as we would basically set binary rubbish afterwards\n throw new Error(\"characteristic with DATA format exceeds specified maxDataLen\");\n }\n return value;\n case \"tlv8\" /* Formats.TLV8 */:\n if (value === undefined) {\n this.characteristicWarning(\"characteristic was supplied illegal value: undefined\", warningType);\n return this.value;\n }\n return value; // we trust that this is valid tlv8\n }\n // hopefully it shouldn't get to this point\n if (value === undefined) {\n this.characteristicWarning(\"characteristic was supplied illegal value: undefined\", \"error-message\" /* CharacteristicWarningType.ERROR_MESSAGE */);\n return this.value;\n }\n return value;\n };\n /**\n * @private used to assign iid to characteristic\n */\n Characteristic.prototype._assignID = function (identifierCache, accessoryName, serviceUUID, serviceSubtype) {\n // generate our IID based on our UUID\n this.iid = identifierCache.getIID(accessoryName, serviceUUID, serviceSubtype, this.UUID);\n };\n Characteristic.prototype.characteristicWarning = function (message, type, stack) {\n if (type === void 0) { type = \"warn-message\" /* CharacteristicWarningType.WARN_MESSAGE */; }\n if (stack === void 0) { stack = new Error().stack; }\n this.emit(\"characteristic-warning\" /* CharacteristicEventTypes.CHARACTERISTIC_WARNING */, type, message, stack);\n };\n /**\n * @param event\n * @private\n */\n Characteristic.prototype.removeAllListeners = function (event) {\n if (!event) {\n this.removeOnGet();\n this.removeOnSet();\n }\n return _super.prototype.removeAllListeners.call(this, event);\n };\n /**\n * @param characteristic\n * @private\n */\n Characteristic.prototype.replaceBy = function (characteristic) {\n var _this = this;\n this.props = characteristic.props;\n this.updateValue(characteristic.value);\n var getListeners = characteristic.listeners(\"get\" /* CharacteristicEventTypes.GET */);\n if (getListeners.length) {\n // the callback can only be called once, so we remove all old listeners\n this.removeAllListeners(\"get\" /* CharacteristicEventTypes.GET */);\n // @ts-expect-error: force type\n getListeners.forEach(function (listener) { return _this.addListener(\"get\" /* CharacteristicEventTypes.GET */, listener); });\n }\n this.removeOnGet();\n if (characteristic.getHandler) {\n this.onGet(characteristic.getHandler);\n }\n var setListeners = characteristic.listeners(\"set\" /* CharacteristicEventTypes.SET */);\n if (setListeners.length) {\n // the callback can only be called once, so we remove all old listeners\n this.removeAllListeners(\"set\" /* CharacteristicEventTypes.SET */);\n // @ts-expect-error: force type\n setListeners.forEach(function (listener) { return _this.addListener(\"set\" /* CharacteristicEventTypes.SET */, listener); });\n }\n this.removeOnSet();\n if (characteristic.setHandler) {\n this.onSet(characteristic.setHandler);\n }\n };\n /**\n * Returns a JSON representation of this characteristic suitable for delivering to HAP clients.\n * @private used to generate response to /accessories query\n */\n Characteristic.prototype.toHAP = function (connection, contactGetHandlers) {\n if (contactGetHandlers === void 0) { contactGetHandlers = true; }\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var object, value, _a;\n var _this = this;\n return tslib_1.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n object = this.internalHAPRepresentation();\n if (!!this.props.perms.includes(\"pr\" /* Perms.PAIRED_READ */)) return [3 /*break*/, 1];\n object.value = undefined;\n return [3 /*break*/, 6];\n case 1:\n if (!(this.UUID === Characteristic.ProgrammableSwitchEvent.UUID)) return [3 /*break*/, 2];\n // special workaround for event only programmable switch event, which must always return null\n object.value = null;\n return [3 /*break*/, 6];\n case 2:\n if (!contactGetHandlers) return [3 /*break*/, 4];\n return [4 /*yield*/, this.handleGetRequest(connection).catch(function () {\n var value = _this.getDefaultValue();\n debug(\"[%s] Error getting value for characteristic on /accessories request. Returning default value instead: %s\", _this.displayName, \"\".concat(value));\n return value; // use default value\n })];\n case 3:\n _a = _b.sent();\n return [3 /*break*/, 5];\n case 4:\n _a = this.value;\n _b.label = 5;\n case 5:\n value = _a;\n object.value = (0, request_util_1.formatOutgoingCharacteristicValue)(value, this.props);\n _b.label = 6;\n case 6: return [2 /*return*/, object];\n }\n });\n });\n };\n /**\n * Returns a JSON representation of this characteristic without the value.\n * @private used to generate the config hash\n */\n Characteristic.prototype.internalHAPRepresentation = function () {\n (0, assert_1.default)(this.iid, \"iid cannot be undefined for characteristic '\" + this.displayName + \"'\");\n // TODO include the value for characteristics of the AccessoryInformation service\n return {\n type: (0, uuid_1.toShortForm)(this.UUID),\n iid: this.iid,\n value: null,\n perms: this.props.perms,\n description: this.props.description || this.displayName,\n format: this.props.format,\n unit: this.props.unit,\n minValue: this.props.minValue,\n maxValue: this.props.maxValue,\n minStep: this.props.minStep,\n maxLen: this.props.maxLen,\n maxDataLen: this.props.maxDataLen,\n \"valid-values\": this.props.validValues,\n \"valid-values-range\": this.props.validValueRanges,\n };\n };\n /**\n * Serialize characteristic into json string.\n *\n * @param characteristic - Characteristic object.\n * @private used to store characteristic on disk\n */\n Characteristic.serialize = function (characteristic) {\n var constructorName;\n if (characteristic.constructor.name !== \"Characteristic\") {\n constructorName = characteristic.constructor.name;\n }\n return {\n displayName: characteristic.displayName,\n UUID: characteristic.UUID,\n eventOnlyCharacteristic: characteristic.UUID === Characteristic.ProgrammableSwitchEvent.UUID,\n constructorName: constructorName,\n value: characteristic.value,\n props: (0, clone_1.clone)({}, characteristic.props),\n };\n };\n /**\n * Deserialize characteristic from json string.\n *\n * @param json - Json string representing a characteristic.\n * @private used to recreate characteristic from disk\n */\n Characteristic.deserialize = function (json) {\n var characteristic;\n if (json.constructorName && json.constructorName.charAt(0).toUpperCase() === json.constructorName.charAt(0)\n && Characteristic[json.constructorName]) { // MUST start with uppercase character and must exist on Characteristic object\n var constructor = Characteristic[json.constructorName];\n characteristic = new constructor();\n characteristic.displayName = json.displayName;\n characteristic.setProps(json.props);\n }\n else {\n characteristic = new Characteristic(json.displayName, json.UUID, json.props);\n }\n characteristic.value = json.value;\n return characteristic;\n };\n /**\n * @deprecated Please use the Formats const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n Characteristic.Formats = Formats;\n /**\n * @deprecated Please use the Units const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n Characteristic.Units = Units;\n /**\n * @deprecated Please use the Perms const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n Characteristic.Perms = Perms;\n return Characteristic;\n}(events_1.EventEmitter));\nexports.Characteristic = Characteristic;\n// We have a cyclic dependency problem. Within this file we have the definitions of \"./definitions\" as\n// type imports only (in order to define the static properties). Setting those properties is done outside\n// this file, within the definition files. Therefore, we import it at the end of this file. Seems weird, but is important.\nrequire(\"./definitions/CharacteristicDefinitions\");\n//# sourceMappingURL=Characteristic.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HAPServer = exports.HAPServerEventTypes = exports.HAPPairingHTTPCode = exports.HAPHTTPCode = exports.Status = exports.Codes = exports.IsKnownHAPStatusError = exports.HAPStatus = exports.TLVErrorCode = void 0;\nvar tslib_1 = require(\"tslib\");\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar fast_srp_hap_1 = require(\"fast-srp-hap\");\nvar tweetnacl_1 = tslib_1.__importDefault(require(\"tweetnacl\"));\nvar url_1 = require(\"url\");\nvar internal_types_1 = require(\"../internal-types\");\nvar eventedhttp_1 = require(\"./util/eventedhttp\");\nvar hapCrypto = tslib_1.__importStar(require(\"./util/hapCrypto\"));\nvar once_1 = require(\"./util/once\");\nvar tlv = tslib_1.__importStar(require(\"./util/tlv\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:HAPServer\");\n/**\n * TLV error codes for the `TLVValues.ERROR_CODE` field.\n *\n * @group HAP Accessory Server\n */\nvar TLVErrorCode;\n(function (TLVErrorCode) {\n // noinspection JSUnusedGlobalSymbols\n TLVErrorCode[TLVErrorCode[\"UNKNOWN\"] = 1] = \"UNKNOWN\";\n TLVErrorCode[TLVErrorCode[\"INVALID_REQUEST\"] = 2] = \"INVALID_REQUEST\";\n TLVErrorCode[TLVErrorCode[\"AUTHENTICATION\"] = 2] = \"AUTHENTICATION\";\n TLVErrorCode[TLVErrorCode[\"BACKOFF\"] = 3] = \"BACKOFF\";\n TLVErrorCode[TLVErrorCode[\"MAX_PEERS\"] = 4] = \"MAX_PEERS\";\n TLVErrorCode[TLVErrorCode[\"MAX_TRIES\"] = 5] = \"MAX_TRIES\";\n TLVErrorCode[TLVErrorCode[\"UNAVAILABLE\"] = 6] = \"UNAVAILABLE\";\n TLVErrorCode[TLVErrorCode[\"BUSY\"] = 7] = \"BUSY\"; // cannot accept pairing request at this time\n})(TLVErrorCode = exports.TLVErrorCode || (exports.TLVErrorCode = {}));\n/**\n * @group HAP Accessory Server\n */\nvar HAPStatus;\n(function (HAPStatus) {\n // noinspection JSUnusedGlobalSymbols\n /**\n * Success of the request.\n */\n HAPStatus[HAPStatus[\"SUCCESS\"] = 0] = \"SUCCESS\";\n /**\n * The request was rejected due to insufficient privileges.\n */\n HAPStatus[HAPStatus[\"INSUFFICIENT_PRIVILEGES\"] = -70401] = \"INSUFFICIENT_PRIVILEGES\";\n /**\n * Operation failed due to some communication failure with the characteristic.\n */\n HAPStatus[HAPStatus[\"SERVICE_COMMUNICATION_FAILURE\"] = -70402] = \"SERVICE_COMMUNICATION_FAILURE\";\n /**\n * The resource is busy. Try again.\n */\n HAPStatus[HAPStatus[\"RESOURCE_BUSY\"] = -70403] = \"RESOURCE_BUSY\";\n /**\n * Cannot write a read-only characteristic ({@link Perms.PAIRED_WRITE} not defined).\n */\n HAPStatus[HAPStatus[\"READ_ONLY_CHARACTERISTIC\"] = -70404] = \"READ_ONLY_CHARACTERISTIC\";\n /**\n * Cannot read from a write-only characteristic ({@link Perms.PAIRED_READ} not defined).\n */\n HAPStatus[HAPStatus[\"WRITE_ONLY_CHARACTERISTIC\"] = -70405] = \"WRITE_ONLY_CHARACTERISTIC\";\n /**\n * Event notifications are not supported for the requested characteristic ({@link Perms.NOTIFY} not defined).\n */\n HAPStatus[HAPStatus[\"NOTIFICATION_NOT_SUPPORTED\"] = -70406] = \"NOTIFICATION_NOT_SUPPORTED\";\n /**\n * The device is out of resources to process the request.\n */\n HAPStatus[HAPStatus[\"OUT_OF_RESOURCE\"] = -70407] = \"OUT_OF_RESOURCE\";\n /**\n * The operation timed out.\n */\n HAPStatus[HAPStatus[\"OPERATION_TIMED_OUT\"] = -70408] = \"OPERATION_TIMED_OUT\";\n /**\n * The given resource does not exist.\n */\n HAPStatus[HAPStatus[\"RESOURCE_DOES_NOT_EXIST\"] = -70409] = \"RESOURCE_DOES_NOT_EXIST\";\n /**\n * Received an invalid value in the given request for the given characteristic.\n */\n HAPStatus[HAPStatus[\"INVALID_VALUE_IN_REQUEST\"] = -70410] = \"INVALID_VALUE_IN_REQUEST\";\n /**\n * Insufficient authorization.\n */\n HAPStatus[HAPStatus[\"INSUFFICIENT_AUTHORIZATION\"] = -70411] = \"INSUFFICIENT_AUTHORIZATION\";\n /**\n * Operation not allowed in the current state.\n */\n HAPStatus[HAPStatus[\"NOT_ALLOWED_IN_CURRENT_STATE\"] = -70412] = \"NOT_ALLOWED_IN_CURRENT_STATE\";\n // when adding new status codes, remember to update bounds in IsKnownHAPStatusError below\n})(HAPStatus = exports.HAPStatus || (exports.HAPStatus = {}));\n/**\n * Determines if the given status code is a known {@link HAPStatus} error code.\n *\n * @group HAP Accessory Server\n */\nfunction IsKnownHAPStatusError(status) {\n return (\n // Lower bound (most negative error code)\n status >= -70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */ &&\n // Upper bound (negative error code closest to zero)\n status <= -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */);\n}\nexports.IsKnownHAPStatusError = IsKnownHAPStatusError;\n// noinspection JSUnusedGlobalSymbols\n/**\n * @group HAP Accessory Server\n * @deprecated please use {@link TLVErrorCode} as naming is more precise\n */\n// @ts-expect-error (as we use const enums with --preserveConstEnums)\nexports.Codes = TLVErrorCode;\n// noinspection JSUnusedGlobalSymbols\n/**\n * @group HAP Accessory Server\n * @deprecated please use {@link HAPStatus} as naming is more precise\n */\n// @ts-expect-error (as we use const enums with --preserveConstEnums)\nexports.Status = HAPStatus;\n/**\n * Those status codes are the one listed as appropriate for the HAP spec!\n *\n * When the response is a client error 4xx or server error 5xx, the response\n * must include a status {@link HAPStatus} property.\n *\n * When the response is a MULTI_STATUS EVERY entry in the characteristics property MUST include a status property (even success).\n *\n * @group HAP Accessory Server\n */\nvar HAPHTTPCode;\n(function (HAPHTTPCode) {\n // noinspection JSUnusedGlobalSymbols\n HAPHTTPCode[HAPHTTPCode[\"OK\"] = 200] = \"OK\";\n HAPHTTPCode[HAPHTTPCode[\"NO_CONTENT\"] = 204] = \"NO_CONTENT\";\n HAPHTTPCode[HAPHTTPCode[\"MULTI_STATUS\"] = 207] = \"MULTI_STATUS\";\n // client error\n HAPHTTPCode[HAPHTTPCode[\"BAD_REQUEST\"] = 400] = \"BAD_REQUEST\";\n HAPHTTPCode[HAPHTTPCode[\"NOT_FOUND\"] = 404] = \"NOT_FOUND\";\n HAPHTTPCode[HAPHTTPCode[\"UNPROCESSABLE_ENTITY\"] = 422] = \"UNPROCESSABLE_ENTITY\";\n // server error\n HAPHTTPCode[HAPHTTPCode[\"INTERNAL_SERVER_ERROR\"] = 500] = \"INTERNAL_SERVER_ERROR\";\n HAPHTTPCode[HAPHTTPCode[\"SERVICE_UNAVAILABLE\"] = 503] = \"SERVICE_UNAVAILABLE\";\n})(HAPHTTPCode = exports.HAPHTTPCode || (exports.HAPHTTPCode = {}));\n/**\n * When in a request is made to the pairing endpoints, and mime type is 'application/pairing+tlv8'\n * one should use the below status codes.\n *\n * @group HAP Accessory Server\n */\nvar HAPPairingHTTPCode;\n(function (HAPPairingHTTPCode) {\n // noinspection JSUnusedGlobalSymbols\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"OK\"] = 200] = \"OK\";\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"BAD_REQUEST\"] = 400] = \"BAD_REQUEST\";\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"METHOD_NOT_ALLOWED\"] = 405] = \"METHOD_NOT_ALLOWED\";\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"TOO_MANY_REQUESTS\"] = 429] = \"TOO_MANY_REQUESTS\";\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"CONNECTION_AUTHORIZATION_REQUIRED\"] = 470] = \"CONNECTION_AUTHORIZATION_REQUIRED\";\n HAPPairingHTTPCode[HAPPairingHTTPCode[\"INTERNAL_SERVER_ERROR\"] = 500] = \"INTERNAL_SERVER_ERROR\";\n})(HAPPairingHTTPCode = exports.HAPPairingHTTPCode || (exports.HAPPairingHTTPCode = {}));\n/**\n * @group HAP Accessory Server\n */\nvar HAPServerEventTypes;\n(function (HAPServerEventTypes) {\n /**\n * Emitted when the server is fully set up and ready to receive connections.\n */\n HAPServerEventTypes[\"LISTENING\"] = \"listening\";\n /**\n * Emitted when a client wishes for this server to identify itself before pairing. You must call the\n * callback to respond to the client with success.\n */\n HAPServerEventTypes[\"IDENTIFY\"] = \"identify\";\n HAPServerEventTypes[\"ADD_PAIRING\"] = \"add-pairing\";\n HAPServerEventTypes[\"REMOVE_PAIRING\"] = \"remove-pairing\";\n HAPServerEventTypes[\"LIST_PAIRINGS\"] = \"list-pairings\";\n /**\n * This event is emitted when a client completes the \"pairing\" process and exchanges encryption keys.\n * Note that this does not mean the \"Add Accessory\" process in iOS has completed.\n * You must call the callback to complete the process.\n */\n HAPServerEventTypes[\"PAIR\"] = \"pair\";\n /**\n * This event is emitted when a client requests the complete representation of Accessory data for\n * this Accessory (for instance, what services, characteristics, etc. are supported) and any bridged\n * Accessories in the case of a Bridge Accessory. The listener must call the provided callback function\n * when the accessory data is ready. We will automatically JSON.stringify the data.\n */\n HAPServerEventTypes[\"ACCESSORIES\"] = \"accessories\";\n /**\n * This event is emitted when a client wishes to retrieve the current value of one or more characteristics.\n * The listener must call the provided callback function when the values are ready. iOS clients can typically\n * wait up to 10 seconds for this call to return. We will automatically JSON.stringify the data (which must\n * be an array) and wrap it in an object with a top-level \"characteristics\" property.\n */\n HAPServerEventTypes[\"GET_CHARACTERISTICS\"] = \"get-characteristics\";\n /**\n * This event is emitted when a client wishes to set the current value of one or more characteristics and/or\n * subscribe to one or more events. The 'events' param is an initially-empty object, associated with the current\n * connection, on which you may store event registration keys for later processing. The listener must call\n * the provided callback when the request has been processed.\n */\n HAPServerEventTypes[\"SET_CHARACTERISTICS\"] = \"set-characteristics\";\n HAPServerEventTypes[\"REQUEST_RESOURCE\"] = \"request-resource\";\n HAPServerEventTypes[\"CONNECTION_CLOSED\"] = \"connection-closed\";\n})(HAPServerEventTypes = exports.HAPServerEventTypes || (exports.HAPServerEventTypes = {}));\n/**\n * The actual HAP server that iOS devices talk to.\n *\n * Notes\n * -----\n * It turns out that the IP-based version of HomeKit's HAP protocol operates over a sort of pseudo-HTTP.\n * Accessories are meant to host a TCP socket server that initially behaves exactly as an HTTP/1.1 server.\n * So iOS devices will open up a long-lived connection to this server and begin issuing HTTP requests.\n * So far, this conforms with HTTP/1.1 Keepalive. However, after the \"pairing\" process is complete, the\n * connection is expected to be \"upgraded\" to support full-packet encryption of both HTTP headers and data.\n * This encryption is NOT SSL. It is a customized ChaCha20+Poly1305 encryption layer.\n *\n * Additionally, this \"HTTP Server\" supports sending \"event\" responses at any time without warning. The iOS\n * device simply keeps the connection open after it's finished with HTTP request/response traffic, and while\n * the connection is open, the server can elect to issue \"EVENT/1.0 200 OK\" HTTP-style responses. These are\n * typically sent to inform the iOS device of a characteristic change for the accessory (like \"Door was Unlocked\").\n *\n * See {@link EventedHTTPServer} for more detail on the implementation of this protocol.\n *\n * @group HAP Accessory Server\n */\nvar HAPServer = /** @class */ (function (_super) {\n tslib_1.__extends(HAPServer, _super);\n function HAPServer(accessoryInfo) {\n var _this = _super.call(this) || this;\n _this.unsuccessfulPairAttempts = 0; // after 100 unsuccessful attempts the server won't accept any further attempts. Will currently be reset on a reboot\n _this.accessoryInfo = accessoryInfo;\n _this.allowInsecureRequest = false;\n // internal server that does all the actual communication\n _this.httpServer = new eventedhttp_1.EventedHTTPServer();\n _this.httpServer.on(\"listening\" /* EventedHTTPServerEvent.LISTENING */, _this.onListening.bind(_this));\n _this.httpServer.on(\"request\" /* EventedHTTPServerEvent.REQUEST */, _this.handleRequestOnHAPConnection.bind(_this));\n _this.httpServer.on(\"connection-closed\" /* EventedHTTPServerEvent.CONNECTION_CLOSED */, _this.handleConnectionClosed.bind(_this));\n return _this;\n }\n HAPServer.prototype.listen = function (port, host) {\n if (port === void 0) { port = 0; }\n if (host === \"::\") {\n // this will work around \"EAFNOSUPPORT: address family not supported\" errors\n // on systems where IPv6 is not supported/enabled, we just use the node default then by supplying undefined\n host = undefined;\n }\n this.httpServer.listen(port, host);\n };\n HAPServer.prototype.stop = function () {\n this.httpServer.stop();\n };\n HAPServer.prototype.destroy = function () {\n this.stop();\n this.removeAllListeners();\n };\n /**\n * Send an even notification for given characteristic and changed value to all connected clients.\n * If `originator` is specified, the given {@link HAPConnection} will be excluded from the broadcast.\n *\n * @param aid - The accessory id of the updated characteristic.\n * @param iid - The instance id of the updated characteristic.\n * @param value - The newly set value of the characteristic.\n * @param originator - If specified, the connection will not get an event message.\n * @param immediateDelivery - The HAP spec requires some characteristics to be delivery immediately.\n * Namely, for the {@link Characteristic.ButtonEvent} and the {@link Characteristic.ProgrammableSwitchEvent} characteristics.\n */\n HAPServer.prototype.sendEventNotifications = function (aid, iid, value, originator, immediateDelivery) {\n try {\n this.httpServer.broadcastEvent(aid, iid, value, originator, immediateDelivery);\n }\n catch (error) {\n console.warn(\"[\" + this.accessoryInfo.username + \"] Error when sending event notifications: \" + error.message);\n }\n };\n HAPServer.prototype.onListening = function (port, hostname) {\n this.emit(\"listening\" /* HAPServerEventTypes.LISTENING */, port, hostname);\n };\n // Called when an HTTP request was detected.\n HAPServer.prototype.handleRequestOnHAPConnection = function (connection, request, response) {\n var _this = this;\n debug(\"[%s] HAP Request: %s %s\", this.accessoryInfo.username, request.method, request.url);\n var buffers = [];\n request.on(\"data\", function (data) { return buffers.push(data); });\n request.on(\"end\", function () {\n var url = new url_1.URL(request.url, \"http://hap-nodejs.local\"); // parse the url (query strings etc)\n var handler = _this.getHandler(url);\n if (!handler) {\n debug(\"[%s] WARNING: Handler for %s not implemented\", _this.accessoryInfo.username, request.url);\n response.writeHead(404 /* HAPHTTPCode.NOT_FOUND */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70409 /* HAPStatus.RESOURCE_DOES_NOT_EXIST */ }));\n }\n else {\n var data = Buffer.concat(buffers);\n try {\n handler(connection, url, request, data, response);\n }\n catch (error) {\n debug(\"[%s] Error executing route handler: %s\", _this.accessoryInfo.username, error.stack);\n response.writeHead(500 /* HAPHTTPCode.INTERNAL_SERVER_ERROR */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70403 /* HAPStatus.RESOURCE_BUSY */ })); // resource busy try again, does somehow fit?\n }\n }\n });\n };\n HAPServer.prototype.handleConnectionClosed = function (connection) {\n this.emit(\"connection-closed\" /* HAPServerEventTypes.CONNECTION_CLOSED */, connection);\n };\n HAPServer.prototype.getHandler = function (url) {\n switch (url.pathname.toLowerCase()) {\n case \"/identify\":\n return this.handleIdentifyRequest.bind(this);\n case \"/pair-setup\":\n return this.handlePairSetup.bind(this);\n case \"/pair-verify\":\n return this.handlePairVerify.bind(this);\n case \"/pairings\":\n return this.handlePairings.bind(this);\n case \"/accessories\":\n return this.handleAccessories.bind(this);\n case \"/characteristics\":\n return this.handleCharacteristics.bind(this);\n case \"/prepare\":\n return this.handlePrepareWrite.bind(this);\n case \"/resource\":\n return this.handleResource.bind(this);\n default:\n return undefined;\n }\n };\n /**\n * UNPAIRED Accessory identification.\n */\n HAPServer.prototype.handleIdentifyRequest = function (connection, url, request, data, response) {\n var _this = this;\n // POST body is empty\n if (this.accessoryInfo.paired() && !this.allowInsecureRequest) {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n this.emit(\"identify\" /* HAPServerEventTypes.IDENTIFY */, (0, once_1.once)(function (err) {\n if (!err) {\n debug(\"[%s] Identification success\", _this.accessoryInfo.username);\n response.writeHead(204 /* HAPHTTPCode.NO_CONTENT */);\n response.end();\n }\n else {\n debug(\"[%s] Identification error: %s\", _this.accessoryInfo.username, err.message);\n response.writeHead(500 /* HAPHTTPCode.INTERNAL_SERVER_ERROR */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70403 /* HAPStatus.RESOURCE_BUSY */ }));\n }\n }));\n };\n HAPServer.prototype.handlePairSetup = function (connection, url, request, data, response) {\n // Can only be directly paired with one iOS device\n if (!this.allowInsecureRequest && this.accessoryInfo.paired()) {\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, 6 /* TLVErrorCode.UNAVAILABLE */));\n return;\n }\n if (this.unsuccessfulPairAttempts > 100) {\n debug(\"[%s] Reached maximum amount of unsuccessful pair attempts!\", this.accessoryInfo.username);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, 5 /* TLVErrorCode.MAX_TRIES */));\n return;\n }\n var tlvData = tlv.decode(data);\n var sequence = tlvData[6 /* TLVValues.SEQUENCE_NUM */][0]; // value is single byte with sequence number\n if (sequence === 1 /* PairingStates.M1 */) {\n this.handlePairSetupM1(connection, request, response);\n }\n else if (sequence === 3 /* PairingStates.M3 */ && connection._pairSetupState === 2 /* PairingStates.M2 */) {\n this.handlePairSetupM3(connection, request, response, tlvData);\n }\n else if (sequence === 5 /* PairingStates.M5 */ && connection._pairSetupState === 4 /* PairingStates.M4 */) {\n this.handlePairSetupM5(connection, request, response, tlvData);\n }\n else {\n // Invalid state/sequence number\n response.writeHead(400 /* HAPPairingHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, sequence + 1, 7 /* TLVValues.ERROR_CODE */, 1 /* TLVErrorCode.UNKNOWN */));\n return;\n }\n };\n HAPServer.prototype.handlePairSetupM1 = function (connection, request, response) {\n var _this = this;\n debug(\"[%s] Pair step 1/5\", this.accessoryInfo.username);\n var salt = crypto_1.default.randomBytes(16);\n var srpParams = fast_srp_hap_1.SRP.params.hap;\n fast_srp_hap_1.SRP.genKey(32).then(function (key) {\n // create a new SRP server\n var srpServer = new fast_srp_hap_1.SrpServer(srpParams, salt, Buffer.from(\"Pair-Setup\"), Buffer.from(_this.accessoryInfo.pincode), key);\n var srpB = srpServer.computeB();\n // attach it to the current TCP session\n connection.srpServer = srpServer;\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 2 /* PairingStates.M2 */, 2 /* TLVValues.SALT */, salt, 3 /* TLVValues.PUBLIC_KEY */, srpB));\n connection._pairSetupState = 2 /* PairingStates.M2 */;\n }).catch(function (error) {\n debug(\"[%s] Error occurred when generating srp key: %s\", _this.accessoryInfo.username, error.message);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, 1 /* TLVErrorCode.UNKNOWN */));\n return;\n });\n };\n HAPServer.prototype.handlePairSetupM3 = function (connection, request, response, tlvData) {\n debug(\"[%s] Pair step 2/5\", this.accessoryInfo.username);\n var A = tlvData[3 /* TLVValues.PUBLIC_KEY */]; // \"A is a public key that exists only for a single login session.\"\n var M1 = tlvData[4 /* TLVValues.PASSWORD_PROOF */]; // \"M1 is the proof that you actually know your own password.\"\n // pull the SRP server we created in stepOne out of the current session\n var srpServer = connection.srpServer;\n srpServer.setA(A);\n try {\n srpServer.checkM1(M1);\n }\n catch (err) {\n // most likely the client supplied an incorrect pincode.\n this.unsuccessfulPairAttempts++;\n debug(\"[%s] Error while checking pincode: %s\", this.accessoryInfo.username, err.message);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 4 /* PairingStates.M4 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairSetupState = undefined;\n return;\n }\n // \"M2 is the proof that the server actually knows your password.\"\n var M2 = srpServer.computeM2();\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 4 /* PairingStates.M4 */, 4 /* TLVValues.PASSWORD_PROOF */, M2));\n connection._pairSetupState = 4 /* PairingStates.M4 */;\n };\n HAPServer.prototype.handlePairSetupM5 = function (connection, request, response, tlvData) {\n debug(\"[%s] Pair step 3/5\", this.accessoryInfo.username);\n // pull the SRP server we created in stepOne out of the current session\n var srpServer = connection.srpServer;\n var encryptedData = tlvData[5 /* TLVValues.ENCRYPTED_DATA */];\n var messageData = Buffer.alloc(encryptedData.length - 16);\n var authTagData = Buffer.alloc(16);\n encryptedData.copy(messageData, 0, 0, encryptedData.length - 16);\n encryptedData.copy(authTagData, 0, encryptedData.length - 16, encryptedData.length);\n var S_private = srpServer.computeK();\n var encSalt = Buffer.from(\"Pair-Setup-Encrypt-Salt\");\n var encInfo = Buffer.from(\"Pair-Setup-Encrypt-Info\");\n var outputKey = hapCrypto.HKDF(\"sha512\", encSalt, S_private, encInfo, 32);\n var plaintext;\n try {\n plaintext = hapCrypto.chacha20_poly1305_decryptAndVerify(outputKey, Buffer.from(\"PS-Msg05\"), null, messageData, authTagData);\n }\n catch (error) {\n debug(\"[%s] Error while decrypting and verifying M5 subTlv: %s\", this.accessoryInfo.username);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 4 /* PairingStates.M4 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairSetupState = undefined;\n return;\n }\n // decode the client payload and pass it on to the next step\n var M5Packet = tlv.decode(plaintext);\n var clientUsername = M5Packet[1 /* TLVValues.USERNAME */];\n var clientLTPK = M5Packet[3 /* TLVValues.PUBLIC_KEY */];\n var clientProof = M5Packet[10 /* TLVValues.PROOF */];\n this.handlePairSetupM5_2(connection, request, response, clientUsername, clientLTPK, clientProof, outputKey);\n };\n // M5-2\n HAPServer.prototype.handlePairSetupM5_2 = function (connection, request, response, clientUsername, clientLTPK, clientProof, hkdfEncKey) {\n debug(\"[%s] Pair step 4/5\", this.accessoryInfo.username);\n var S_private = connection.srpServer.computeK();\n var controllerSalt = Buffer.from(\"Pair-Setup-Controller-Sign-Salt\");\n var controllerInfo = Buffer.from(\"Pair-Setup-Controller-Sign-Info\");\n var outputKey = hapCrypto.HKDF(\"sha512\", controllerSalt, S_private, controllerInfo, 32);\n var completeData = Buffer.concat([outputKey, clientUsername, clientLTPK]);\n if (!tweetnacl_1.default.sign.detached.verify(completeData, clientProof, clientLTPK)) {\n debug(\"[%s] Invalid signature\", this.accessoryInfo.username);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 6 /* PairingStates.M6 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairSetupState = undefined;\n return;\n }\n this.handlePairSetupM5_3(connection, request, response, clientUsername, clientLTPK, hkdfEncKey);\n };\n // M5 - F + M6\n HAPServer.prototype.handlePairSetupM5_3 = function (connection, request, response, clientUsername, clientLTPK, hkdfEncKey) {\n var _this = this;\n debug(\"[%s] Pair step 5/5\", this.accessoryInfo.username);\n var S_private = connection.srpServer.computeK();\n var accessorySalt = Buffer.from(\"Pair-Setup-Accessory-Sign-Salt\");\n var accessoryInfo = Buffer.from(\"Pair-Setup-Accessory-Sign-Info\");\n var outputKey = hapCrypto.HKDF(\"sha512\", accessorySalt, S_private, accessoryInfo, 32);\n var serverLTPK = this.accessoryInfo.signPk;\n var usernameData = Buffer.from(this.accessoryInfo.username);\n var material = Buffer.concat([outputKey, usernameData, serverLTPK]);\n var privateKey = Buffer.from(this.accessoryInfo.signSk);\n var serverProof = tweetnacl_1.default.sign.detached(material, privateKey);\n var message = tlv.encode(1 /* TLVValues.USERNAME */, usernameData, 3 /* TLVValues.PUBLIC_KEY */, serverLTPK, 10 /* TLVValues.PROOF */, serverProof);\n var encrypted = hapCrypto.chacha20_poly1305_encryptAndSeal(hkdfEncKey, Buffer.from(\"PS-Msg06\"), null, message);\n // finally, notify listeners that we have been paired with a client\n this.emit(\"pair\" /* HAPServerEventTypes.PAIR */, clientUsername.toString(), clientLTPK, (0, once_1.once)(function (err) {\n if (err) {\n debug(\"[%s] Error adding pairing info: %s\", _this.accessoryInfo.username, err.message);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 6 /* PairingStates.M6 */, 7 /* TLVValues.ERROR_CODE */, 1 /* TLVErrorCode.UNKNOWN */));\n connection._pairSetupState = undefined;\n return;\n }\n // send final pairing response to client\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 6 /* PairingStates.M6 */, 5 /* TLVValues.ENCRYPTED_DATA */, Buffer.concat([encrypted.ciphertext, encrypted.authTag])));\n connection._pairSetupState = undefined;\n }));\n };\n HAPServer.prototype.handlePairVerify = function (connection, url, request, data, response) {\n var tlvData = tlv.decode(data);\n var sequence = tlvData[6 /* TLVValues.SEQUENCE_NUM */][0]; // value is single byte with sequence number\n if (sequence === 1 /* PairingStates.M1 */) {\n this.handlePairVerifyM1(connection, request, response, tlvData);\n }\n else if (sequence === 3 /* PairingStates.M3 */ && connection._pairVerifyState === 2 /* PairingStates.M2 */) {\n this.handlePairVerifyM3(connection, request, response, tlvData);\n }\n else {\n // Invalid state/sequence number\n response.writeHead(400 /* HAPPairingHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, sequence + 1, 7 /* TLVValues.ERROR_CODE */, 1 /* TLVErrorCode.UNKNOWN */));\n return;\n }\n };\n HAPServer.prototype.handlePairVerifyM1 = function (connection, request, response, tlvData) {\n debug(\"[%s] Pair verify step 1/2\", this.accessoryInfo.username);\n var clientPublicKey = tlvData[3 /* TLVValues.PUBLIC_KEY */]; // Buffer\n // generate new encryption keys for this session\n var keyPair = hapCrypto.generateCurve25519KeyPair();\n var secretKey = Buffer.from(keyPair.secretKey);\n var publicKey = Buffer.from(keyPair.publicKey);\n var sharedSec = Buffer.from(hapCrypto.generateCurve25519SharedSecKey(secretKey, clientPublicKey));\n var usernameData = Buffer.from(this.accessoryInfo.username);\n var material = Buffer.concat([publicKey, usernameData, clientPublicKey]);\n var privateKey = Buffer.from(this.accessoryInfo.signSk);\n var serverProof = tweetnacl_1.default.sign.detached(material, privateKey);\n var encSalt = Buffer.from(\"Pair-Verify-Encrypt-Salt\");\n var encInfo = Buffer.from(\"Pair-Verify-Encrypt-Info\");\n var outputKey = hapCrypto.HKDF(\"sha512\", encSalt, sharedSec, encInfo, 32).slice(0, 32);\n connection.encryption = new eventedhttp_1.HAPEncryption(clientPublicKey, secretKey, publicKey, sharedSec, outputKey);\n // compose the response data in TLV format\n var message = tlv.encode(1 /* TLVValues.USERNAME */, usernameData, 10 /* TLVValues.PROOF */, serverProof);\n var encrypted = hapCrypto.chacha20_poly1305_encryptAndSeal(outputKey, Buffer.from(\"PV-Msg02\"), null, message);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 2 /* PairingStates.M2 */, 5 /* TLVValues.ENCRYPTED_DATA */, Buffer.concat([encrypted.ciphertext, encrypted.authTag]), 3 /* TLVValues.PUBLIC_KEY */, publicKey));\n connection._pairVerifyState = 2 /* PairingStates.M2 */;\n };\n HAPServer.prototype.handlePairVerifyM3 = function (connection, request, response, objects) {\n debug(\"[%s] Pair verify step 2/2\", this.accessoryInfo.username);\n var encryptedData = objects[5 /* TLVValues.ENCRYPTED_DATA */];\n var messageData = Buffer.alloc(encryptedData.length - 16);\n var authTagData = Buffer.alloc(16);\n encryptedData.copy(messageData, 0, 0, encryptedData.length - 16);\n encryptedData.copy(authTagData, 0, encryptedData.length - 16, encryptedData.length);\n // instance of HAPEncryption (created in handlePairVerifyStepOne)\n var enc = connection.encryption;\n var plaintext;\n try {\n plaintext = hapCrypto.chacha20_poly1305_decryptAndVerify(enc.hkdfPairEncryptionKey, Buffer.from(\"PV-Msg03\"), null, messageData, authTagData);\n }\n catch (error) {\n debug(\"[%s] M3: Failed to decrypt and/or verify\", this.accessoryInfo.username);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 4 /* PairingStates.M4 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairVerifyState = undefined;\n return;\n }\n var decoded = tlv.decode(plaintext);\n var clientUsername = decoded[1 /* TLVValues.USERNAME */];\n var proof = decoded[10 /* TLVValues.PROOF */];\n var material = Buffer.concat([enc.clientPublicKey, clientUsername, enc.publicKey]);\n // since we're paired, we should have the public key stored for this client\n var clientPublicKey = this.accessoryInfo.getClientPublicKey(clientUsername.toString());\n // if we're not actually paired, then there's nothing to verify - this client thinks it's paired with us, but we\n // disagree. Respond with invalid request (seems to match HomeKit Accessory Simulator behavior)\n if (!clientPublicKey) {\n debug(\"[%s] Client %s attempting to verify, but we are not paired; rejecting client\", this.accessoryInfo.username, clientUsername);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 4 /* PairingStates.M4 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairVerifyState = undefined;\n return;\n }\n if (!tweetnacl_1.default.sign.detached.verify(material, proof, clientPublicKey)) {\n debug(\"[%s] Client %s provided an invalid signature\", this.accessoryInfo.username, clientUsername);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 4 /* PairingStates.M4 */, 7 /* TLVValues.ERROR_CODE */, 2 /* TLVErrorCode.AUTHENTICATION */));\n connection._pairVerifyState = undefined;\n return;\n }\n debug(\"[%s] Client %s verification complete\", this.accessoryInfo.username, clientUsername);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.SEQUENCE_NUM */, 4 /* PairingStates.M4 */));\n // now that the client has been verified, we must \"upgrade\" our pseudo-HTTP connection to include\n // TCP-level encryption. We'll do this by adding some more encryption vars to the session, and using them\n // in future calls to onEncrypt, onDecrypt.\n var encSalt = Buffer.from(\"Control-Salt\");\n var infoRead = Buffer.from(\"Control-Read-Encryption-Key\");\n var infoWrite = Buffer.from(\"Control-Write-Encryption-Key\");\n enc.accessoryToControllerKey = hapCrypto.HKDF(\"sha512\", encSalt, enc.sharedSecret, infoRead, 32);\n enc.controllerToAccessoryKey = hapCrypto.HKDF(\"sha512\", encSalt, enc.sharedSecret, infoWrite, 32);\n // Our connection is now completely setup. We now want to subscribe this connection to special\n connection.connectionAuthenticated(clientUsername.toString());\n connection._pairVerifyState = undefined;\n };\n HAPServer.prototype.handlePairings = function (connection, url, request, data, response) {\n var _this = this;\n // Only accept /pairing request if there is a secure session\n if (!this.allowInsecureRequest && !connection.isAuthenticated()) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n var objects = tlv.decode(data);\n var method = objects[0 /* TLVValues.METHOD */][0]; // value is single byte with request type\n var state = objects[6 /* TLVValues.STATE */][0];\n if (state !== 1 /* PairingStates.M1 */) {\n return;\n }\n if (method === 3 /* PairMethods.ADD_PAIRING */) {\n var identifier = objects[1 /* TLVValues.IDENTIFIER */].toString();\n var publicKey = objects[3 /* TLVValues.PUBLIC_KEY */];\n var permissions = objects[11 /* TLVValues.PERMISSIONS */][0];\n this.emit(\"add-pairing\" /* HAPServerEventTypes.ADD_PAIRING */, connection, identifier, publicKey, permissions, (0, once_1.once)(function (error) {\n if (error > 0) {\n debug(\"[%s] Pairings: failed ADD_PAIRING with code %d\", _this.accessoryInfo.username, error);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, error));\n return;\n }\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */));\n debug(\"[%s] Pairings: successfully executed ADD_PAIRING\", _this.accessoryInfo.username);\n }));\n }\n else if (method === 4 /* PairMethods.REMOVE_PAIRING */) {\n var identifier = objects[1 /* TLVValues.IDENTIFIER */].toString();\n this.emit(\"remove-pairing\" /* HAPServerEventTypes.REMOVE_PAIRING */, connection, identifier, (0, once_1.once)(function (error) {\n if (error > 0) {\n debug(\"[%s] Pairings: failed REMOVE_PAIRING with code %d\", _this.accessoryInfo.username, error);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, error));\n return;\n }\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */));\n debug(\"[%s] Pairings: successfully executed REMOVE_PAIRING\", _this.accessoryInfo.username);\n }));\n }\n else if (method === 5 /* PairMethods.LIST_PAIRINGS */) {\n this.emit(\"list-pairings\" /* HAPServerEventTypes.LIST_PAIRINGS */, connection, (0, once_1.once)(function (error, data) {\n if (error > 0) {\n debug(\"[%s] Pairings: failed LIST_PAIRINGS with code %d\", _this.accessoryInfo.username, error);\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" });\n response.end(tlv.encode(6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */, 7 /* TLVValues.ERROR_CODE */, error));\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var tlvList = [];\n data.forEach(function (value, index) {\n if (index > 0) {\n tlvList.push(255 /* TLVValues.SEPARATOR */, Buffer.alloc(0));\n }\n tlvList.push(1 /* TLVValues.IDENTIFIER */, value.username, 3 /* TLVValues.PUBLIC_KEY */, value.publicKey, 11 /* TLVValues.PERMISSIONS */, value.permission);\n });\n var list = tlv.encode.apply(tlv, tslib_1.__spreadArray([6 /* TLVValues.STATE */, 2 /* PairingStates.M2 */], tslib_1.__read(tlvList), false));\n response.writeHead(200 /* HAPPairingHTTPCode.OK */, { \"Content-Type\": \"application/pairing+tlv8\" /* HAPMimeTypes.PAIRING_TLV8 */ });\n response.end(list);\n debug(\"[%s] Pairings: successfully executed LIST_PAIRINGS\", _this.accessoryInfo.username);\n }));\n }\n };\n HAPServer.prototype.handleAccessories = function (connection, url, request, data, response) {\n if (!this.allowInsecureRequest && !connection.isAuthenticated()) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n // call out to listeners to retrieve the latest accessories JSON\n this.emit(\"accessories\" /* HAPServerEventTypes.ACCESSORIES */, connection, (0, once_1.once)(function (error, result) {\n if (error) {\n response.writeHead(error.httpCode, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: error.status }));\n }\n else {\n response.writeHead(200 /* HAPHTTPCode.OK */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify(result));\n }\n }));\n };\n HAPServer.prototype.handleCharacteristics = function (connection, url, request, data, response) {\n var e_1, _a;\n if (!this.allowInsecureRequest && !connection.isAuthenticated()) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n if (request.method === \"GET\") {\n var searchParams = url.searchParams;\n var idParam = searchParams.get(\"id\");\n if (!idParam) {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n return;\n }\n var ids = [];\n try {\n for (var _b = tslib_1.__values(idParam.split(\",\")), _c = _b.next(); !_c.done; _c = _b.next()) { // [\"1.9\",\"2.14\"]\n var entry = _c.value;\n var split = entry.split(\".\"); // [\"1\",\"9\"]\n ids.push({\n aid: parseInt(split[0], 10),\n iid: parseInt(split[1], 10), // (characteristic) instance id\n });\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var readRequest = {\n ids: ids,\n includeMeta: (0, internal_types_1.consideredTrue)(searchParams.get(\"meta\")),\n includePerms: (0, internal_types_1.consideredTrue)(searchParams.get(\"perms\")),\n includeType: (0, internal_types_1.consideredTrue)(searchParams.get(\"type\")),\n includeEvent: (0, internal_types_1.consideredTrue)(searchParams.get(\"ev\")),\n };\n this.emit(\"get-characteristics\" /* HAPServerEventTypes.GET_CHARACTERISTICS */, connection, readRequest, (0, once_1.once)(function (error, readResponse) {\n var e_2, _a, e_3, _b;\n if (error) {\n response.writeHead(error.httpCode, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: error.status }));\n return;\n }\n var characteristics = readResponse.characteristics;\n var errorOccurred = false; // determine if we send a 207 Multi-Status\n try {\n for (var characteristics_1 = tslib_1.__values(characteristics), characteristics_1_1 = characteristics_1.next(); !characteristics_1_1.done; characteristics_1_1 = characteristics_1.next()) {\n var data_1 = characteristics_1_1.value;\n if (data_1.status) {\n errorOccurred = true;\n break;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (characteristics_1_1 && !characteristics_1_1.done && (_a = characteristics_1.return)) _a.call(characteristics_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (errorOccurred) { // on a 207 Multi-Status EVERY characteristic MUST include a status property\n try {\n for (var characteristics_2 = tslib_1.__values(characteristics), characteristics_2_1 = characteristics_2.next(); !characteristics_2_1.done; characteristics_2_1 = characteristics_2.next()) {\n var data_2 = characteristics_2_1.value;\n if (!data_2.status) { // a status is undefined if the request was successful\n data_2.status = 0 /* HAPStatus.SUCCESS */; // a value of zero indicates success\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (characteristics_2_1 && !characteristics_2_1.done && (_b = characteristics_2.return)) _b.call(characteristics_2);\n }\n finally { if (e_3) throw e_3.error; }\n }\n }\n // 207 \"multi-status\" is returned when an error occurs reading a characteristic. otherwise 200 is returned\n response.writeHead(errorOccurred ? 207 /* HAPHTTPCode.MULTI_STATUS */ : 200 /* HAPHTTPCode.OK */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ characteristics: characteristics }));\n }));\n }\n else if (request.method === \"PUT\") {\n if (!connection.isAuthenticated()) {\n if (!request.headers || (request.headers && request.headers.authorization !== this.accessoryInfo.pincode)) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n }\n if (data.length === 0) {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n return;\n }\n var writeRequest = JSON.parse(data.toString(\"utf8\"));\n this.emit(\"set-characteristics\" /* HAPServerEventTypes.SET_CHARACTERISTICS */, connection, writeRequest, (0, once_1.once)(function (error, writeResponse) {\n var e_4, _a;\n if (error) {\n response.writeHead(error.httpCode, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: error.status }));\n return;\n }\n var characteristics = writeResponse.characteristics;\n var multiStatus = false;\n try {\n for (var characteristics_3 = tslib_1.__values(characteristics), characteristics_3_1 = characteristics_3.next(); !characteristics_3_1.done; characteristics_3_1 = characteristics_3.next()) {\n var data_3 = characteristics_3_1.value;\n if (data_3.status || data_3.value !== undefined) {\n // also send multiStatus on write response requests\n multiStatus = true;\n break;\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (characteristics_3_1 && !characteristics_3_1.done && (_a = characteristics_3.return)) _a.call(characteristics_3);\n }\n finally { if (e_4) throw e_4.error; }\n }\n if (multiStatus) {\n // 207 is \"multi-status\" since HomeKit may be setting multiple things and any one can fail independently\n response.writeHead(207 /* HAPHTTPCode.MULTI_STATUS */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ characteristics: characteristics }));\n }\n else {\n // if everything went fine send 204 no content response\n response.writeHead(204 /* HAPHTTPCode.NO_CONTENT */);\n response.end();\n }\n }));\n }\n else {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ }); // method not allowed\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n }\n };\n HAPServer.prototype.handlePrepareWrite = function (connection, url, request, data, response) {\n var _this = this;\n if (!this.allowInsecureRequest && !connection.isAuthenticated()) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n if (request.method === \"PUT\") {\n if (data.length === 0) {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n return;\n }\n var prepareRequest_1 = JSON.parse(data.toString());\n if (prepareRequest_1.pid && prepareRequest_1.ttl) {\n debug(\"[%s] Received prepare write request with pid %d and ttl %d\", this.accessoryInfo.username, prepareRequest_1.pid, prepareRequest_1.ttl);\n if (connection.timedWriteTimeout) { // clear any currently existing timeouts\n clearTimeout(connection.timedWriteTimeout);\n }\n connection.timedWritePid = prepareRequest_1.pid;\n connection.timedWriteTimeout = setTimeout(function () {\n debug(\"[%s] Timed write request timed out for pid %d\", _this.accessoryInfo.username, prepareRequest_1.pid);\n connection.timedWritePid = undefined;\n connection.timedWriteTimeout = undefined;\n }, prepareRequest_1.ttl);\n response.writeHead(200 /* HAPHTTPCode.OK */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: 0 /* HAPStatus.SUCCESS */ }));\n return;\n }\n else {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n }\n }\n else {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n }\n };\n HAPServer.prototype.handleResource = function (connection, url, request, data, response) {\n if (!connection.isAuthenticated()) {\n if (!(this.allowInsecureRequest && request.headers && request.headers.authorization === this.accessoryInfo.pincode)) {\n response.writeHead(470 /* HAPPairingHTTPCode.CONNECTION_AUTHORIZATION_REQUIRED */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */ }));\n return;\n }\n }\n if (request.method === \"POST\") {\n if (data.length === 0) {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n return;\n }\n var resourceRequest = JSON.parse(data.toString());\n // call out to listeners to retrieve the resource, snapshot only right now\n this.emit(\"request-resource\" /* HAPServerEventTypes.REQUEST_RESOURCE */, resourceRequest, (0, once_1.once)(function (error, resource) {\n if (error) {\n response.writeHead(error.httpCode, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ });\n response.end(JSON.stringify({ status: error.status }));\n }\n else {\n response.writeHead(200 /* HAPHTTPCode.OK */, { \"Content-Type\": \"image/jpeg\" /* HAPMimeTypes.IMAGE_JPEG */ });\n response.end(resource);\n }\n }));\n }\n else {\n response.writeHead(400 /* HAPHTTPCode.BAD_REQUEST */, { \"Content-Type\": \"application/hap+json\" /* HAPMimeTypes.HAP_JSON */ }); // method not allowed\n response.end(JSON.stringify({ status: -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */ }));\n }\n };\n return HAPServer;\n}(events_1.EventEmitter));\nexports.HAPServer = HAPServer;\n//# sourceMappingURL=HAPServer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Service = exports.ServiceEventTypes = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar Characteristic_1 = require(\"./Characteristic\");\nvar uuid_1 = require(\"./util/uuid\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Service\");\n/**\n * HAP spec allows a maximum of 100 characteristics per service!\n */\nvar MAX_CHARACTERISTICS = 100;\n/**\n * @group Service\n */\nvar ServiceEventTypes;\n(function (ServiceEventTypes) {\n ServiceEventTypes[\"CHARACTERISTIC_CHANGE\"] = \"characteristic-change\";\n ServiceEventTypes[\"SERVICE_CONFIGURATION_CHANGE\"] = \"service-configurationChange\";\n ServiceEventTypes[\"CHARACTERISTIC_WARNING\"] = \"characteristic-warning\";\n})(ServiceEventTypes = exports.ServiceEventTypes || (exports.ServiceEventTypes = {}));\n/**\n * Service represents a set of grouped values necessary to provide a logical function. For instance, a\n * \"Door Lock Mechanism\" service might contain two values, one for the \"desired lock state\" and one for the\n * \"current lock state\". A particular Service is distinguished from others by its \"type\", which is a UUID.\n * HomeKit provides a set of known Service UUIDs defined in HomeKit.ts along with a corresponding\n * concrete subclass that you can instantiate directly to set up the necessary values. These natively-supported\n * Services are expected to contain a particular set of Characteristics.\n *\n * Unlike Characteristics, where you cannot have two Characteristics with the same UUID in the same Service,\n * you can actually have multiple Services with the same UUID in a single Accessory. For instance, imagine\n * a Garage Door Opener with both a \"security light\" and a \"backlight\" for the display. Each light could be\n * a \"Lightbulb\" Service with the same UUID. To account for this situation, we define an extra \"subtype\"\n * property on Service, that can be a string or other string-convertible object that uniquely identifies the\n * Service among its peers in an Accessory. For instance, you might have `service1.subtype = 'security_light'`\n * for one and `service2.subtype = 'backlight'` for the other.\n *\n * You can also define custom Services by providing your own UUID for the type that you generate yourself.\n * Custom Services can contain an arbitrary set of Characteristics, but Siri will likely not be able to\n * work with these.\n *\n * @group Service\n */\nvar Service = /** @class */ (function (_super) {\n tslib_1.__extends(Service, _super);\n function Service(displayName, UUID, subtype) {\n if (displayName === void 0) { displayName = \"\"; }\n var _this = _super.call(this) || this;\n _this.iid = null; // assigned later by our containing Accessory\n _this.name = null;\n _this.characteristics = [];\n _this.optionalCharacteristics = [];\n /**\n * @private\n */\n _this.isHiddenService = false;\n /**\n * @private\n */\n _this.isPrimaryService = false; // do not write to this directly\n /**\n * @private\n */\n _this.linkedServices = [];\n (0, assert_1.default)(UUID, \"Services must be created with a valid UUID.\");\n _this.displayName = displayName;\n _this.UUID = UUID;\n _this.subtype = subtype;\n // every service has an optional Characteristic.Name property - we'll set it to our displayName\n // if one was given\n // if you don't provide a display name, some HomeKit apps may choose to hide the device.\n if (displayName) {\n // create the characteristic if necessary\n var nameCharacteristic = _this.getCharacteristic(Characteristic_1.Characteristic.Name) ||\n _this.addCharacteristic(Characteristic_1.Characteristic.Name);\n nameCharacteristic.updateValue(displayName);\n }\n return _this;\n }\n /**\n * Returns an id which uniquely identifies a service on the associated accessory.\n * The serviceId is a concatenation of the UUID for the service (defined by HAP) and the subtype (could be empty)\n * which is programmatically defined by the programmer.\n *\n * @returns the serviceId\n */\n Service.prototype.getServiceId = function () {\n return this.UUID + (this.subtype || \"\");\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Service.prototype.addCharacteristic = function (input) {\n // characteristic might be a constructor like `Characteristic.Brightness` instead of an instance of Characteristic. Coerce if necessary.\n var e_1, _a;\n var constructorArgs = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n constructorArgs[_i - 1] = arguments[_i];\n }\n var characteristic = typeof input === \"function\" ? new (input.bind.apply(input, tslib_1.__spreadArray([void 0], tslib_1.__read(constructorArgs), false)))() : input;\n try {\n // check for UUID conflict\n for (var _b = tslib_1.__values(this.characteristics), _c = _b.next(); !_c.done; _c = _b.next()) {\n var existing = _c.value;\n if (existing.UUID === characteristic.UUID) {\n if (characteristic.UUID === \"00000052-0000-1000-8000-0026BB765291\") {\n //This is a special workaround for the Firmware Revision characteristic.\n return existing;\n }\n throw new Error(\"Cannot add a Characteristic with the same UUID as another Characteristic in this Service: \" + existing.UUID);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (this.characteristics.length >= MAX_CHARACTERISTICS) {\n throw new Error(\"Cannot add more than \" + MAX_CHARACTERISTICS + \" characteristics to a single service!\");\n }\n this.setupCharacteristicEventHandlers(characteristic);\n this.characteristics.push(characteristic);\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n return characteristic;\n };\n /**\n * Sets this service as the new primary service.\n * Any currently active primary service will be reset to be not primary.\n * This will happen immediately, if the service was already added to an accessory, or later\n * when the service gets added to an accessory.\n *\n * @param isPrimary - optional boolean (default true) if the service should be the primary service\n */\n Service.prototype.setPrimaryService = function (isPrimary) {\n if (isPrimary === void 0) { isPrimary = true; }\n this.isPrimaryService = isPrimary;\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n };\n /**\n * Marks the service as hidden\n *\n * @param isHidden - optional boolean (default true) if the service should be marked hidden\n */\n Service.prototype.setHiddenService = function (isHidden) {\n if (isHidden === void 0) { isHidden = true; }\n this.isHiddenService = isHidden;\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n };\n /**\n * Adds a new link to the specified service. The service MUST be already added to\n * the SAME accessory.\n *\n * @param service - The service this service should link to\n */\n Service.prototype.addLinkedService = function (service) {\n //TODO: Add a check if the service is on the same accessory.\n if (!this.linkedServices.includes(service)) {\n this.linkedServices.push(service);\n }\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n };\n /**\n * Removes a link to the specified service which was previously added with {@link addLinkedService}\n *\n * @param service - Previously linked service\n */\n Service.prototype.removeLinkedService = function (service) {\n //TODO: Add a check if the service is on the same accessory.\n var index = this.linkedServices.indexOf(service);\n if (index !== -1) {\n this.linkedServices.splice(index, 1);\n }\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n };\n Service.prototype.removeCharacteristic = function (characteristic) {\n var index = this.characteristics.indexOf(characteristic);\n if (index !== -1) {\n this.characteristics.splice(index, 1);\n characteristic.removeAllListeners();\n this.emit(\"service-configurationChange\" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);\n }\n };\n Service.prototype.getCharacteristic = function (name) {\n // returns a characteristic object from the service\n // If Service.prototype.getCharacteristic(Characteristic.Type) does not find the characteristic,\n // but the type is in optionalCharacteristics, it adds the characteristic.type to the service and returns it.\n var e_2, _a, e_3, _b;\n try {\n for (var _c = tslib_1.__values(this.characteristics), _d = _c.next(); !_d.done; _d = _c.next()) {\n var characteristic = _d.value;\n if (typeof name === \"string\" && characteristic.displayName === name) {\n return characteristic;\n }\n else if (typeof name === \"function\" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {\n return characteristic;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (typeof name === \"function\") {\n try {\n for (var _e = tslib_1.__values(this.optionalCharacteristics), _f = _e.next(); !_f.done; _f = _e.next()) {\n var characteristic = _f.value;\n if ((characteristic instanceof name) || (name.UUID === characteristic.UUID)) {\n return this.addCharacteristic(name);\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n }\n finally { if (e_3) throw e_3.error; }\n }\n var instance = this.addCharacteristic(name);\n // Not found in optional Characteristics. Adding anyway, but warning about it if it isn't the Name.\n if (name.UUID !== Characteristic_1.Characteristic.Name.UUID) {\n this.emitCharacteristicWarningEvent(instance, \"warn-message\" /* CharacteristicWarningType.WARN_MESSAGE */, \"Characteristic not in required or optional characteristic section for service \" + this.constructor.name + \". Adding anyway.\");\n }\n return instance;\n }\n };\n Service.prototype.testCharacteristic = function (name) {\n var e_4, _a;\n try {\n // checks for the existence of a characteristic object in the service\n for (var _b = tslib_1.__values(this.characteristics), _c = _b.next(); !_c.done; _c = _b.next()) {\n var characteristic = _c.value;\n if (typeof name === \"string\" && characteristic.displayName === name) {\n return true;\n }\n else if (typeof name === \"function\" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {\n return true;\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n return false;\n };\n Service.prototype.setCharacteristic = function (name, value) {\n // @ts-expect-error: We know that both overloads exists individually. There is just no publicly exposed type for that!\n this.getCharacteristic(name).setValue(value);\n return this; // for chaining\n };\n Service.prototype.updateCharacteristic = function (name, value) {\n this.getCharacteristic(name).updateValue(value);\n return this;\n };\n Service.prototype.addOptionalCharacteristic = function (characteristic) {\n // characteristic might be a constructor like `Characteristic.Brightness` instead of an instance\n // of Characteristic. Coerce if necessary.\n if (typeof characteristic === \"function\") {\n characteristic = new characteristic();\n }\n this.optionalCharacteristics.push(characteristic);\n };\n // noinspection JSUnusedGlobalSymbols\n /**\n * This method was created to copy all characteristics from another service to this.\n * It's only adopting is currently in homebridge to merge the AccessoryInformation service. So some things\n * may be explicitly tailored towards this use case.\n *\n * It will not remove characteristics which are present currently but not added on the other characteristic.\n * It will not replace the characteristic if the value is falsy (except of '0' or 'false')\n * @param service\n * @private used by homebridge\n */\n Service.prototype.replaceCharacteristicsFromService = function (service) {\n var _this = this;\n if (this.UUID !== service.UUID) {\n throw new Error(\"Incompatible services. Tried replacing characteristics of \".concat(this.UUID, \" with characteristics from \").concat(service.UUID));\n }\n var foreignCharacteristics = {}; // index foreign characteristics by UUID\n service.characteristics.forEach(function (characteristic) { return foreignCharacteristics[characteristic.UUID] = characteristic; });\n this.characteristics.forEach(function (characteristic) {\n var foreignCharacteristic = foreignCharacteristics[characteristic.UUID];\n if (foreignCharacteristic) {\n delete foreignCharacteristics[characteristic.UUID];\n if (!foreignCharacteristic.value && foreignCharacteristic.value !== 0 && foreignCharacteristic.value !== false) {\n return; // ignore falsy values except if it's the number zero or literally false\n }\n characteristic.replaceBy(foreignCharacteristic);\n }\n });\n // add all additional characteristics which where not present already\n Object.values(foreignCharacteristics).forEach(function (characteristic) { return _this.addCharacteristic(characteristic); });\n };\n /**\n * @private\n */\n Service.prototype.getCharacteristicByIID = function (iid) {\n var e_5, _a;\n try {\n for (var _b = tslib_1.__values(this.characteristics), _c = _b.next(); !_c.done; _c = _b.next()) {\n var characteristic = _c.value;\n if (characteristic.iid === iid) {\n return characteristic;\n }\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_5) throw e_5.error; }\n }\n };\n /**\n * @private\n */\n Service.prototype._assignIDs = function (identifierCache, accessoryName, baseIID) {\n var e_6, _a;\n if (baseIID === void 0) { baseIID = 0; }\n // the Accessory Information service must have a (reserved by IdentifierCache) ID of 1\n if (this.UUID === \"0000003E-0000-1000-8000-0026BB765291\") {\n this.iid = 1;\n }\n else {\n // assign our own ID based on our UUID\n this.iid = baseIID + identifierCache.getIID(accessoryName, this.UUID, this.subtype);\n }\n try {\n // assign IIDs to our Characteristics\n for (var _b = tslib_1.__values(this.characteristics), _c = _b.next(); !_c.done; _c = _b.next()) {\n var characteristic = _c.value;\n characteristic._assignID(identifierCache, accessoryName, this.UUID, this.subtype);\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_6) throw e_6.error; }\n }\n };\n /**\n * Returns a JSON representation of this service suitable for delivering to HAP clients.\n * @private used to generate response to /accessories query\n */\n Service.prototype.toHAP = function (connection, contactGetHandlers) {\n var _this = this;\n if (contactGetHandlers === void 0) { contactGetHandlers = true; }\n return new Promise(function (resolve) {\n var e_7, _a, e_8, _b;\n (0, assert_1.default)(_this.iid, \"iid cannot be undefined for service '\" + _this.displayName + \"'\");\n (0, assert_1.default)(_this.characteristics.length, \"service '\" + _this.displayName + \"' does not have any characteristics!\");\n var service = {\n type: (0, uuid_1.toShortForm)(_this.UUID),\n iid: _this.iid,\n characteristics: [],\n hidden: _this.isHiddenService ? true : undefined,\n primary: _this.isPrimaryService ? true : undefined,\n };\n if (_this.linkedServices.length) {\n service.linked = [];\n try {\n for (var _c = tslib_1.__values(_this.linkedServices), _d = _c.next(); !_d.done; _d = _c.next()) {\n var linked = _d.value;\n if (!linked.iid) {\n // we got a linked service which is not added to the accessory\n // as it doesn't \"exists\" we just ignore it.\n // we have some (at least one) plugins on homebridge which link to the AccessoryInformation service.\n // homebridge always creates its own AccessoryInformation service and ignores the user supplied one\n // thus the link is automatically broken.\n debug(\"iid of linked service '\".concat(linked.displayName, \"' \").concat(linked.UUID, \" is undefined on service '\").concat(_this.displayName, \"'\"));\n continue;\n }\n service.linked.push(linked.iid);\n }\n }\n catch (e_7_1) { e_7 = { error: e_7_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_7) throw e_7.error; }\n }\n }\n var missingCharacteristics = new Set();\n var timeout = setTimeout(function () {\n var e_9, _a;\n try {\n for (var missingCharacteristics_1 = tslib_1.__values(missingCharacteristics), missingCharacteristics_1_1 = missingCharacteristics_1.next(); !missingCharacteristics_1_1.done; missingCharacteristics_1_1 = missingCharacteristics_1.next()) {\n var characteristic = missingCharacteristics_1_1.value;\n _this.emitCharacteristicWarningEvent(characteristic, \"slow-read\" /* CharacteristicWarningType.SLOW_READ */, \"The read handler for the characteristic '\".concat(characteristic.displayName, \"' was slow to respond!\"));\n }\n }\n catch (e_9_1) { e_9 = { error: e_9_1 }; }\n finally {\n try {\n if (missingCharacteristics_1_1 && !missingCharacteristics_1_1.done && (_a = missingCharacteristics_1.return)) _a.call(missingCharacteristics_1);\n }\n finally { if (e_9) throw e_9.error; }\n }\n timeout = setTimeout(function () {\n var e_10, _a;\n timeout = undefined;\n try {\n for (var missingCharacteristics_2 = tslib_1.__values(missingCharacteristics), missingCharacteristics_2_1 = missingCharacteristics_2.next(); !missingCharacteristics_2_1.done; missingCharacteristics_2_1 = missingCharacteristics_2.next()) {\n var characteristic = missingCharacteristics_2_1.value;\n _this.emitCharacteristicWarningEvent(characteristic, \"timeout-read\" /* CharacteristicWarningType.TIMEOUT_READ */, \"The read handler for the characteristic '\" + (characteristic === null || characteristic === void 0 ? void 0 : characteristic.displayName) +\n \"' didn't respond at all!. Please check that you properly call the callback!\");\n service.characteristics.push(characteristic.internalHAPRepresentation()); // value is set to null\n }\n }\n catch (e_10_1) { e_10 = { error: e_10_1 }; }\n finally {\n try {\n if (missingCharacteristics_2_1 && !missingCharacteristics_2_1.done && (_a = missingCharacteristics_2.return)) _a.call(missingCharacteristics_2);\n }\n finally { if (e_10) throw e_10.error; }\n }\n missingCharacteristics.clear();\n resolve(service);\n }, 6000);\n }, 3000);\n var _loop_1 = function (characteristic) {\n missingCharacteristics.add(characteristic);\n characteristic.toHAP(connection, contactGetHandlers).then(function (value) {\n if (!timeout) {\n return; // if timeout is undefined, response was already sent out\n }\n missingCharacteristics.delete(characteristic);\n service.characteristics.push(value);\n if (missingCharacteristics.size === 0) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n resolve(service);\n }\n });\n };\n try {\n for (var _e = tslib_1.__values(_this.characteristics), _f = _e.next(); !_f.done; _f = _e.next()) {\n var characteristic = _f.value;\n _loop_1(characteristic);\n }\n }\n catch (e_8_1) { e_8 = { error: e_8_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n }\n finally { if (e_8) throw e_8.error; }\n }\n });\n };\n /**\n * Returns a JSON representation of this service without characteristic values.\n * @private used to generate the config hash\n */\n Service.prototype.internalHAPRepresentation = function () {\n var e_11, _a;\n (0, assert_1.default)(this.iid, \"iid cannot be undefined for service '\" + this.displayName + \"'\");\n (0, assert_1.default)(this.characteristics.length, \"service '\" + this.displayName + \"' does not have any characteristics!\");\n var service = {\n type: (0, uuid_1.toShortForm)(this.UUID),\n iid: this.iid,\n characteristics: this.characteristics.map(function (characteristic) { return characteristic.internalHAPRepresentation(); }),\n hidden: this.isHiddenService ? true : undefined,\n primary: this.isPrimaryService ? true : undefined,\n };\n if (this.linkedServices.length) {\n service.linked = [];\n try {\n for (var _b = tslib_1.__values(this.linkedServices), _c = _b.next(); !_c.done; _c = _b.next()) {\n var linked = _c.value;\n if (!linked.iid) {\n // we got a linked service which is not added to the accessory\n // as it doesn't \"exists\" we just ignore it.\n // we have some (at least one) plugins on homebridge which link to the AccessoryInformation service.\n // homebridge always creates its own AccessoryInformation service and ignores the user supplied one\n // thus the link is automatically broken.\n debug(\"iid of linked service '\".concat(linked.displayName, \"' \").concat(linked.UUID, \" is undefined on service '\").concat(this.displayName, \"'\"));\n continue;\n }\n service.linked.push(linked.iid);\n }\n }\n catch (e_11_1) { e_11 = { error: e_11_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_11) throw e_11.error; }\n }\n }\n return service;\n };\n /**\n * @private\n */\n Service.prototype.setupCharacteristicEventHandlers = function (characteristic) {\n var _this = this;\n // listen for changes in characteristics and bubble them up\n characteristic.on(\"change\" /* CharacteristicEventTypes.CHANGE */, function (change) {\n _this.emit(\"characteristic-change\" /* ServiceEventTypes.CHARACTERISTIC_CHANGE */, tslib_1.__assign(tslib_1.__assign({}, change), { characteristic: characteristic }));\n });\n characteristic.on(\"characteristic-warning\" /* CharacteristicEventTypes.CHARACTERISTIC_WARNING */, this.emitCharacteristicWarningEvent.bind(this, characteristic));\n };\n /**\n * @private\n */\n Service.prototype.emitCharacteristicWarningEvent = function (characteristic, type, message, stack) {\n this.emit(\"characteristic-warning\" /* ServiceEventTypes.CHARACTERISTIC_WARNING */, {\n characteristic: characteristic,\n type: type,\n message: message,\n originatorChain: [this.displayName, characteristic.displayName],\n stack: stack,\n });\n };\n /**\n * @private\n */\n Service.prototype._sideloadCharacteristics = function (targetCharacteristics) {\n var e_12, _a;\n try {\n for (var targetCharacteristics_1 = tslib_1.__values(targetCharacteristics), targetCharacteristics_1_1 = targetCharacteristics_1.next(); !targetCharacteristics_1_1.done; targetCharacteristics_1_1 = targetCharacteristics_1.next()) {\n var target = targetCharacteristics_1_1.value;\n this.setupCharacteristicEventHandlers(target);\n }\n }\n catch (e_12_1) { e_12 = { error: e_12_1 }; }\n finally {\n try {\n if (targetCharacteristics_1_1 && !targetCharacteristics_1_1.done && (_a = targetCharacteristics_1.return)) _a.call(targetCharacteristics_1);\n }\n finally { if (e_12) throw e_12.error; }\n }\n this.characteristics = targetCharacteristics.slice();\n };\n /**\n * @private\n */\n Service.serialize = function (service) {\n var constructorName;\n if (service.constructor.name !== \"Service\") {\n constructorName = service.constructor.name;\n }\n return {\n displayName: service.displayName,\n UUID: service.UUID,\n subtype: service.subtype,\n constructorName: constructorName,\n hiddenService: service.isHiddenService,\n primaryService: service.isPrimaryService,\n characteristics: service.characteristics.map(function (characteristic) { return Characteristic_1.Characteristic.serialize(characteristic); }),\n optionalCharacteristics: service.optionalCharacteristics.map(function (characteristic) { return Characteristic_1.Characteristic.serialize(characteristic); }),\n };\n };\n /**\n * @private\n */\n Service.deserialize = function (json) {\n var service;\n if (json.constructorName && json.constructorName.charAt(0).toUpperCase() === json.constructorName.charAt(0)\n && Service[json.constructorName]) { // MUST start with uppercase character and must exist on Service object\n var constructor = Service[json.constructorName];\n service = new constructor(json.displayName, json.subtype);\n }\n else {\n service = new Service(json.displayName, json.UUID, json.subtype);\n }\n service.isHiddenService = !!json.hiddenService;\n service.isPrimaryService = !!json.primaryService;\n var characteristics = json.characteristics.map(function (serialized) { return Characteristic_1.Characteristic.deserialize(serialized); });\n service._sideloadCharacteristics(characteristics);\n if (json.optionalCharacteristics) {\n service.optionalCharacteristics = json.optionalCharacteristics.map(function (serialized) { return Characteristic_1.Characteristic.deserialize(serialized); });\n }\n return service;\n };\n return Service;\n}(events_1.EventEmitter));\nexports.Service = Service;\n// We have a cyclic dependency problem. Within this file we have the definitions of \"./definitions\" as\n// type imports only (in order to define the static properties). Setting those properties is done outside\n// this file, within the definition files. Therefore, we import it at the end of this file. Seems weird, but is important.\nrequire(\"./definitions/ServiceDefinitions\");\n//# sourceMappingURL=Service.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LegacyCameraSourceAdapter = void 0;\n/**\n * @group Camera\n */\n// noinspection JSDeprecatedSymbols\nvar LegacyCameraSourceAdapter = /** @class */ (function () {\n function LegacyCameraSourceAdapter(cameraSource) {\n this.cameraSource = cameraSource;\n }\n LegacyCameraSourceAdapter.prototype.handleSnapshotRequest = function (request, callback) {\n this.cameraSource.handleSnapshotRequest(request, function (error, buffer) {\n callback(error ? error : undefined, buffer);\n });\n };\n LegacyCameraSourceAdapter.prototype.prepareStream = function (request, callback) {\n this.cameraSource.prepareStream(request, function (response) {\n callback(undefined, response);\n });\n };\n LegacyCameraSourceAdapter.prototype.handleStreamRequest = function (request, callback) {\n // @ts-expect-error: compatible types\n this.cameraSource.handleStreamRequest(request);\n callback();\n };\n LegacyCameraSourceAdapter.prototype.forwardCloseConnection = function (sessionID) {\n // In the legacy type CameraSource API it was required that the plugin dev would forward this call to the\n // handleCloseConnection of the \"StreamController\". This is not needed anymore and is automatically handled\n // by HAP-NodeJS. However, devs could possibly define other stuff in there so we still forward this call.\n this.cameraSource.handleCloseConnection(sessionID);\n };\n return LegacyCameraSourceAdapter;\n}());\nexports.LegacyCameraSourceAdapter = LegacyCameraSourceAdapter;\n//# sourceMappingURL=Camera.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\nvar dgram_1 = tslib_1.__importDefault(require(\"dgram\"));\n/**\n * RTPProxy to proxy unencrypted RTP and RTCP\n *\n * At early days of HomeKit camera support, HomeKit allowed for unencrypted RTP stream.\n * The proxy was created to deal with RTCP and SSRC related stuff from external streams back in that days.\n * Later HomeKit removed support for unencrypted stream so it’s mostly no longer useful anymore, only really for testing\n * with a custom HAP controller.\n * @group Camera\n */\nvar RTPProxy = /** @class */ (function () {\n function RTPProxy(options) {\n this.options = options;\n this.startingPort = 10000;\n this.type = options.isIPV6 ? \"udp6\" : \"udp4\";\n this.startingPort = 10000;\n this.outgoingAddress = options.outgoingAddress;\n this.outgoingPort = options.outgoingPort;\n this.incomingPayloadType = 0;\n this.outgoingSSRC = options.outgoingSSRC;\n this.disabled = options.disabled;\n this.incomingSSRC = null;\n this.outgoingPayloadType = null;\n }\n RTPProxy.prototype.setup = function () {\n var _this = this;\n return this.createSocketPair(this.type)\n .then(function (sockets) {\n _this.incomingRTPSocket = sockets[0];\n _this.incomingRTCPSocket = sockets[1];\n return _this.createSocket(_this.type);\n }).then(function (socket) {\n _this.outgoingSocket = socket;\n _this.onBound();\n });\n };\n RTPProxy.prototype.destroy = function () {\n if (this.incomingRTPSocket) {\n this.incomingRTPSocket.close();\n }\n if (this.incomingRTCPSocket) {\n this.incomingRTCPSocket.close();\n }\n if (this.outgoingSocket) {\n this.outgoingSocket.close();\n }\n };\n RTPProxy.prototype.incomingRTPPort = function () {\n var address = this.incomingRTPSocket.address();\n if (typeof address !== \"string\") {\n return address.port;\n }\n throw new Error(\"Unsupported socket!\");\n };\n RTPProxy.prototype.incomingRTCPPort = function () {\n var address = this.incomingRTCPSocket.address();\n if (typeof address !== \"string\") {\n return address.port;\n }\n throw new Error(\"Unsupported socket!\");\n };\n RTPProxy.prototype.outgoingLocalPort = function () {\n var address = this.outgoingSocket.address();\n if (typeof address !== \"string\") {\n return address.port;\n }\n throw new Error(\"Unsupported socket!\");\n };\n RTPProxy.prototype.setServerAddress = function (address) {\n this.serverAddress = address;\n };\n RTPProxy.prototype.setServerRTPPort = function (port) {\n this.serverRTPPort = port;\n };\n RTPProxy.prototype.setServerRTCPPort = function (port) {\n this.serverRTCPPort = port;\n };\n RTPProxy.prototype.setIncomingPayloadType = function (pt) {\n this.incomingPayloadType = pt;\n };\n RTPProxy.prototype.setOutgoingPayloadType = function (pt) {\n this.outgoingPayloadType = pt;\n };\n RTPProxy.prototype.sendOut = function (msg) {\n // Just drop it if we're not setup yet, I guess.\n if (!this.outgoingAddress || !this.outgoingPort) {\n return;\n }\n this.outgoingSocket.send(msg, this.outgoingPort, this.outgoingAddress);\n };\n RTPProxy.prototype.sendBack = function (msg) {\n // Just drop it if we're not setup yet, I guess.\n if (!this.serverAddress || !this.serverRTCPPort) {\n return;\n }\n this.outgoingSocket.send(msg, this.serverRTCPPort, this.serverAddress);\n };\n RTPProxy.prototype.onBound = function () {\n var _this = this;\n if (this.disabled) {\n return;\n }\n this.incomingRTPSocket.on(\"message\", function (msg) {\n _this.rtpMessage(msg);\n });\n this.incomingRTCPSocket.on(\"message\", function (msg) {\n _this.rtcpMessage(msg);\n });\n this.outgoingSocket.on(\"message\", function (msg) {\n _this.rtcpReply(msg);\n });\n };\n RTPProxy.prototype.rtpMessage = function (msg) {\n if (msg.length < 12) {\n // Not a proper RTP packet. Just forward it.\n this.sendOut(msg);\n return;\n }\n var mpt = msg.readUInt8(1);\n var pt = mpt & 0x7F;\n if (pt === this.incomingPayloadType) {\n mpt = (mpt & 0x80) | this.outgoingPayloadType;\n msg.writeUInt8(mpt, 1);\n }\n if (this.incomingSSRC === null) {\n this.incomingSSRC = msg.readUInt32BE(4);\n }\n msg.writeUInt32BE(this.outgoingSSRC, 8);\n this.sendOut(msg);\n };\n RTPProxy.prototype.processRTCPMessage = function (msg, transform) {\n var rtcpPackets = [];\n var offset = 0;\n while ((offset + 4) <= msg.length) {\n var pt = msg.readUInt8(offset + 1);\n var len = msg.readUInt16BE(offset + 2) * 4;\n if ((offset + 4 + len) > msg.length) {\n break;\n }\n var packet = msg.slice(offset, offset + 4 + len);\n packet = transform(pt, packet);\n if (packet) {\n rtcpPackets.push(packet);\n }\n offset += 4 + len;\n }\n if (rtcpPackets.length > 0) {\n return Buffer.concat(rtcpPackets);\n }\n return null;\n };\n RTPProxy.prototype.rtcpMessage = function (msg) {\n var _this = this;\n var processed = this.processRTCPMessage(msg, function (pt, packet) {\n if (pt !== 200 || packet.length < 8) {\n return packet;\n }\n if (_this.incomingSSRC === null) {\n _this.incomingSSRC = packet.readUInt32BE(4);\n }\n packet.writeUInt32BE(_this.outgoingSSRC, 4);\n return packet;\n });\n if (processed) {\n this.sendOut(processed);\n }\n };\n RTPProxy.prototype.rtcpReply = function (msg) {\n var _this = this;\n var processed = this.processRTCPMessage(msg, function (pt, packet) {\n if (pt !== 201 || packet.length < 12) {\n return packet;\n }\n // Assume source 1 is the one we want to edit.\n packet.writeUInt32BE(_this.incomingSSRC, 8);\n return packet;\n });\n if (processed) {\n this.sendOut(processed);\n }\n };\n RTPProxy.prototype.createSocket = function (type) {\n var _this = this;\n return new Promise(function (resolve) {\n var retry = function () {\n var socket = dgram_1.default.createSocket(type);\n var bindErrorHandler = function () {\n if (_this.startingPort === 65535) {\n _this.startingPort = 10000;\n }\n else {\n ++_this.startingPort;\n }\n socket.close();\n retry();\n };\n socket.once(\"error\", bindErrorHandler);\n socket.on(\"listening\", function () {\n resolve(socket);\n });\n socket.bind(_this.startingPort);\n };\n retry();\n });\n };\n RTPProxy.prototype.createSocketPair = function (type) {\n var _this = this;\n return new Promise(function (resolve) {\n var retry = function () {\n var socket1 = dgram_1.default.createSocket(type);\n var socket2 = dgram_1.default.createSocket(type);\n var state = { socket1: 0, socket2: 0 };\n var recheck = function () {\n if (state.socket1 === 0 || state.socket2 === 0) {\n return;\n }\n if (state.socket1 === 2 && state.socket2 === 2) {\n resolve([socket1, socket2]);\n return;\n }\n if (_this.startingPort === 65534) {\n _this.startingPort = 10000;\n }\n else {\n ++_this.startingPort;\n }\n socket1.close();\n socket2.close();\n retry();\n };\n socket1.once(\"error\", function () {\n state.socket1 = 1;\n recheck();\n });\n socket2.once(\"error\", function () {\n state.socket2 = 1;\n recheck();\n });\n socket1.once(\"listening\", function () {\n state.socket1 = 2;\n recheck();\n });\n socket2.once(\"listening\", function () {\n state.socket2 = 2;\n recheck();\n });\n socket1.bind(_this.startingPort);\n socket2.bind(_this.startingPort + 1);\n };\n retry();\n });\n };\n return RTPProxy;\n}());\nexports.default = RTPProxy;\n//# sourceMappingURL=RTPProxy.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StreamController = exports.RTPStreamManagement = exports.StreamRequestTypes = exports.AudioStreamingSamplerate = exports.AudioStreamingCodecType = exports.SRTPCryptoSuites = exports.AudioSamplerate = exports.AudioBitrate = exports.VideoCodecPacketizationMode = exports.H264Level = exports.H264Profile = exports.VideoCodecType = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar net_1 = tslib_1.__importDefault(require(\"net\"));\nvar Characteristic_1 = require(\"../Characteristic\");\nvar controller_1 = require(\"../controller\");\nvar Service_1 = require(\"../Service\");\nvar hapStatusError_1 = require(\"../util/hapStatusError\");\nvar once_1 = require(\"../util/once\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar uuid = tslib_1.__importStar(require(\"../util/uuid\"));\n// noinspection JSDeprecatedSymbols\nvar Camera_1 = require(\"./Camera\");\nvar RTPProxy_1 = tslib_1.__importDefault(require(\"./RTPProxy\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Camera:RTPStreamManagement\");\n// ---------------------------------- TLV DEFINITIONS START ----------------------------------\nvar StreamingStatusTypes;\n(function (StreamingStatusTypes) {\n StreamingStatusTypes[StreamingStatusTypes[\"STATUS\"] = 1] = \"STATUS\";\n})(StreamingStatusTypes || (StreamingStatusTypes = {}));\nvar StreamingStatus;\n(function (StreamingStatus) {\n StreamingStatus[StreamingStatus[\"AVAILABLE\"] = 0] = \"AVAILABLE\";\n StreamingStatus[StreamingStatus[\"IN_USE\"] = 1] = \"IN_USE\";\n StreamingStatus[StreamingStatus[\"UNAVAILABLE\"] = 2] = \"UNAVAILABLE\";\n})(StreamingStatus || (StreamingStatus = {}));\n// ----------\nvar SupportedVideoStreamConfigurationTypes;\n(function (SupportedVideoStreamConfigurationTypes) {\n SupportedVideoStreamConfigurationTypes[SupportedVideoStreamConfigurationTypes[\"VIDEO_CODEC_CONFIGURATION\"] = 1] = \"VIDEO_CODEC_CONFIGURATION\";\n})(SupportedVideoStreamConfigurationTypes || (SupportedVideoStreamConfigurationTypes = {}));\nvar VideoCodecConfigurationTypes;\n(function (VideoCodecConfigurationTypes) {\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"ATTRIBUTES\"] = 3] = \"ATTRIBUTES\";\n})(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));\nvar VideoCodecParametersTypes;\n(function (VideoCodecParametersTypes) {\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"PROFILE_ID\"] = 1] = \"PROFILE_ID\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"LEVEL\"] = 2] = \"LEVEL\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"PACKETIZATION_MODE\"] = 3] = \"PACKETIZATION_MODE\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"CVO_ENABLED\"] = 4] = \"CVO_ENABLED\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"CVO_ID\"] = 5] = \"CVO_ID\";\n})(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));\nvar VideoAttributesTypes;\n(function (VideoAttributesTypes) {\n VideoAttributesTypes[VideoAttributesTypes[\"IMAGE_WIDTH\"] = 1] = \"IMAGE_WIDTH\";\n VideoAttributesTypes[VideoAttributesTypes[\"IMAGE_HEIGHT\"] = 2] = \"IMAGE_HEIGHT\";\n VideoAttributesTypes[VideoAttributesTypes[\"FRAME_RATE\"] = 3] = \"FRAME_RATE\";\n})(VideoAttributesTypes || (VideoAttributesTypes = {}));\n/**\n * @group Camera\n */\nvar VideoCodecType;\n(function (VideoCodecType) {\n VideoCodecType[VideoCodecType[\"H264\"] = 0] = \"H264\";\n // while the namespace is already reserved for H265 it isn't currently supported.\n // H265 = 0x01,\n})(VideoCodecType = exports.VideoCodecType || (exports.VideoCodecType = {}));\n/**\n * @group Camera\n */\nvar H264Profile;\n(function (H264Profile) {\n H264Profile[H264Profile[\"BASELINE\"] = 0] = \"BASELINE\";\n H264Profile[H264Profile[\"MAIN\"] = 1] = \"MAIN\";\n H264Profile[H264Profile[\"HIGH\"] = 2] = \"HIGH\";\n})(H264Profile = exports.H264Profile || (exports.H264Profile = {}));\n/**\n * @group Camera\n */\nvar H264Level;\n(function (H264Level) {\n H264Level[H264Level[\"LEVEL3_1\"] = 0] = \"LEVEL3_1\";\n H264Level[H264Level[\"LEVEL3_2\"] = 1] = \"LEVEL3_2\";\n H264Level[H264Level[\"LEVEL4_0\"] = 2] = \"LEVEL4_0\";\n})(H264Level = exports.H264Level || (exports.H264Level = {}));\n/**\n * @group Camera\n */\nvar VideoCodecPacketizationMode;\n(function (VideoCodecPacketizationMode) {\n VideoCodecPacketizationMode[VideoCodecPacketizationMode[\"NON_INTERLEAVED\"] = 0] = \"NON_INTERLEAVED\";\n})(VideoCodecPacketizationMode = exports.VideoCodecPacketizationMode || (exports.VideoCodecPacketizationMode = {}));\nvar VideoCodecCVO;\n(function (VideoCodecCVO) {\n VideoCodecCVO[VideoCodecCVO[\"UNSUPPORTED\"] = 0] = \"UNSUPPORTED\";\n VideoCodecCVO[VideoCodecCVO[\"SUPPORTED\"] = 1] = \"SUPPORTED\";\n})(VideoCodecCVO || (VideoCodecCVO = {}));\n// ----------\nvar SupportedAudioStreamConfigurationTypes;\n(function (SupportedAudioStreamConfigurationTypes) {\n SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes[\"AUDIO_CODEC_CONFIGURATION\"] = 1] = \"AUDIO_CODEC_CONFIGURATION\";\n SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes[\"COMFORT_NOISE_SUPPORT\"] = 2] = \"COMFORT_NOISE_SUPPORT\";\n})(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));\nvar AudioCodecConfigurationTypes;\n(function (AudioCodecConfigurationTypes) {\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));\nvar AudioCodecTypes;\n(function (AudioCodecTypes) {\n AudioCodecTypes[AudioCodecTypes[\"PCMU\"] = 0] = \"PCMU\";\n AudioCodecTypes[AudioCodecTypes[\"PCMA\"] = 1] = \"PCMA\";\n AudioCodecTypes[AudioCodecTypes[\"AAC_ELD\"] = 2] = \"AAC_ELD\";\n AudioCodecTypes[AudioCodecTypes[\"OPUS\"] = 3] = \"OPUS\";\n AudioCodecTypes[AudioCodecTypes[\"MSBC\"] = 4] = \"MSBC\";\n AudioCodecTypes[AudioCodecTypes[\"AMR\"] = 5] = \"AMR\";\n AudioCodecTypes[AudioCodecTypes[\"AMR_WB\"] = 6] = \"AMR_WB\";\n})(AudioCodecTypes || (AudioCodecTypes = {}));\nvar AudioCodecParametersTypes;\n(function (AudioCodecParametersTypes) {\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"CHANNEL\"] = 1] = \"CHANNEL\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"BIT_RATE\"] = 2] = \"BIT_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"SAMPLE_RATE\"] = 3] = \"SAMPLE_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"PACKET_TIME\"] = 4] = \"PACKET_TIME\"; // only present in selected audio codec parameters tlv\n})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));\n/**\n * @group Camera\n */\nvar AudioBitrate;\n(function (AudioBitrate) {\n AudioBitrate[AudioBitrate[\"VARIABLE\"] = 0] = \"VARIABLE\";\n AudioBitrate[AudioBitrate[\"CONSTANT\"] = 1] = \"CONSTANT\";\n})(AudioBitrate = exports.AudioBitrate || (exports.AudioBitrate = {}));\n/**\n * @group Camera\n */\nvar AudioSamplerate;\n(function (AudioSamplerate) {\n AudioSamplerate[AudioSamplerate[\"KHZ_8\"] = 0] = \"KHZ_8\";\n AudioSamplerate[AudioSamplerate[\"KHZ_16\"] = 1] = \"KHZ_16\";\n AudioSamplerate[AudioSamplerate[\"KHZ_24\"] = 2] = \"KHZ_24\";\n // 3, 4, 5 are theoretically defined, but no idea to what kHz value they correspond to\n // probably KHZ_32, KHZ_44_1, KHZ_48 (as supported by Secure Video recordings)\n})(AudioSamplerate = exports.AudioSamplerate || (exports.AudioSamplerate = {}));\n// ----------\nvar SupportedRTPConfigurationTypes;\n(function (SupportedRTPConfigurationTypes) {\n SupportedRTPConfigurationTypes[SupportedRTPConfigurationTypes[\"SRTP_CRYPTO_SUITE\"] = 2] = \"SRTP_CRYPTO_SUITE\";\n})(SupportedRTPConfigurationTypes || (SupportedRTPConfigurationTypes = {}));\n/**\n * @group Camera\n */\nvar SRTPCryptoSuites;\n(function (SRTPCryptoSuites) {\n SRTPCryptoSuites[SRTPCryptoSuites[\"AES_CM_128_HMAC_SHA1_80\"] = 0] = \"AES_CM_128_HMAC_SHA1_80\";\n SRTPCryptoSuites[SRTPCryptoSuites[\"AES_CM_256_HMAC_SHA1_80\"] = 1] = \"AES_CM_256_HMAC_SHA1_80\";\n SRTPCryptoSuites[SRTPCryptoSuites[\"NONE\"] = 2] = \"NONE\";\n})(SRTPCryptoSuites = exports.SRTPCryptoSuites || (exports.SRTPCryptoSuites = {}));\n// ----------\nvar SetupEndpointsTypes;\n(function (SetupEndpointsTypes) {\n SetupEndpointsTypes[SetupEndpointsTypes[\"SESSION_ID\"] = 1] = \"SESSION_ID\";\n SetupEndpointsTypes[SetupEndpointsTypes[\"CONTROLLER_ADDRESS\"] = 3] = \"CONTROLLER_ADDRESS\";\n SetupEndpointsTypes[SetupEndpointsTypes[\"VIDEO_SRTP_PARAMETERS\"] = 4] = \"VIDEO_SRTP_PARAMETERS\";\n SetupEndpointsTypes[SetupEndpointsTypes[\"AUDIO_SRTP_PARAMETERS\"] = 5] = \"AUDIO_SRTP_PARAMETERS\";\n})(SetupEndpointsTypes || (SetupEndpointsTypes = {}));\nvar AddressTypes;\n(function (AddressTypes) {\n AddressTypes[AddressTypes[\"ADDRESS_VERSION\"] = 1] = \"ADDRESS_VERSION\";\n AddressTypes[AddressTypes[\"ADDRESS\"] = 2] = \"ADDRESS\";\n AddressTypes[AddressTypes[\"VIDEO_RTP_PORT\"] = 3] = \"VIDEO_RTP_PORT\";\n AddressTypes[AddressTypes[\"AUDIO_RTP_PORT\"] = 4] = \"AUDIO_RTP_PORT\";\n})(AddressTypes || (AddressTypes = {}));\nvar IPAddressVersion;\n(function (IPAddressVersion) {\n IPAddressVersion[IPAddressVersion[\"IPV4\"] = 0] = \"IPV4\";\n IPAddressVersion[IPAddressVersion[\"IPV6\"] = 1] = \"IPV6\";\n})(IPAddressVersion || (IPAddressVersion = {}));\nvar SRTPParametersTypes;\n(function (SRTPParametersTypes) {\n SRTPParametersTypes[SRTPParametersTypes[\"SRTP_CRYPTO_SUITE\"] = 1] = \"SRTP_CRYPTO_SUITE\";\n SRTPParametersTypes[SRTPParametersTypes[\"MASTER_KEY\"] = 2] = \"MASTER_KEY\";\n SRTPParametersTypes[SRTPParametersTypes[\"MASTER_SALT\"] = 3] = \"MASTER_SALT\"; // 14 bytes\n})(SRTPParametersTypes || (SRTPParametersTypes = {}));\nvar SetupEndpointsResponseTypes;\n(function (SetupEndpointsResponseTypes) {\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"SESSION_ID\"] = 1] = \"SESSION_ID\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"STATUS\"] = 2] = \"STATUS\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"ACCESSORY_ADDRESS\"] = 3] = \"ACCESSORY_ADDRESS\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"VIDEO_SRTP_PARAMETERS\"] = 4] = \"VIDEO_SRTP_PARAMETERS\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"AUDIO_SRTP_PARAMETERS\"] = 5] = \"AUDIO_SRTP_PARAMETERS\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"VIDEO_SSRC\"] = 6] = \"VIDEO_SSRC\";\n SetupEndpointsResponseTypes[SetupEndpointsResponseTypes[\"AUDIO_SSRC\"] = 7] = \"AUDIO_SSRC\";\n})(SetupEndpointsResponseTypes || (SetupEndpointsResponseTypes = {}));\nvar SetupEndpointsStatus;\n(function (SetupEndpointsStatus) {\n SetupEndpointsStatus[SetupEndpointsStatus[\"SUCCESS\"] = 0] = \"SUCCESS\";\n SetupEndpointsStatus[SetupEndpointsStatus[\"BUSY\"] = 1] = \"BUSY\";\n SetupEndpointsStatus[SetupEndpointsStatus[\"ERROR\"] = 2] = \"ERROR\";\n})(SetupEndpointsStatus || (SetupEndpointsStatus = {}));\n// ----------\nvar SelectedRTPStreamConfigurationTypes;\n(function (SelectedRTPStreamConfigurationTypes) {\n SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes[\"SESSION_CONTROL\"] = 1] = \"SESSION_CONTROL\";\n SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes[\"SELECTED_VIDEO_PARAMETERS\"] = 2] = \"SELECTED_VIDEO_PARAMETERS\";\n SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes[\"SELECTED_AUDIO_PARAMETERS\"] = 3] = \"SELECTED_AUDIO_PARAMETERS\";\n})(SelectedRTPStreamConfigurationTypes || (SelectedRTPStreamConfigurationTypes = {}));\nvar SessionControlTypes;\n(function (SessionControlTypes) {\n SessionControlTypes[SessionControlTypes[\"SESSION_IDENTIFIER\"] = 1] = \"SESSION_IDENTIFIER\";\n SessionControlTypes[SessionControlTypes[\"COMMAND\"] = 2] = \"COMMAND\";\n})(SessionControlTypes || (SessionControlTypes = {}));\nvar SessionControlCommand;\n(function (SessionControlCommand) {\n SessionControlCommand[SessionControlCommand[\"END_SESSION\"] = 0] = \"END_SESSION\";\n SessionControlCommand[SessionControlCommand[\"START_SESSION\"] = 1] = \"START_SESSION\";\n SessionControlCommand[SessionControlCommand[\"SUSPEND_SESSION\"] = 2] = \"SUSPEND_SESSION\";\n SessionControlCommand[SessionControlCommand[\"RESUME_SESSION\"] = 3] = \"RESUME_SESSION\";\n SessionControlCommand[SessionControlCommand[\"RECONFIGURE_SESSION\"] = 4] = \"RECONFIGURE_SESSION\";\n})(SessionControlCommand || (SessionControlCommand = {}));\nvar SelectedVideoParametersTypes;\n(function (SelectedVideoParametersTypes) {\n SelectedVideoParametersTypes[SelectedVideoParametersTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n SelectedVideoParametersTypes[SelectedVideoParametersTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n SelectedVideoParametersTypes[SelectedVideoParametersTypes[\"ATTRIBUTES\"] = 3] = \"ATTRIBUTES\";\n SelectedVideoParametersTypes[SelectedVideoParametersTypes[\"RTP_PARAMETERS\"] = 4] = \"RTP_PARAMETERS\";\n})(SelectedVideoParametersTypes || (SelectedVideoParametersTypes = {}));\nvar VideoRTPParametersTypes;\n(function (VideoRTPParametersTypes) {\n VideoRTPParametersTypes[VideoRTPParametersTypes[\"PAYLOAD_TYPE\"] = 1] = \"PAYLOAD_TYPE\";\n VideoRTPParametersTypes[VideoRTPParametersTypes[\"SYNCHRONIZATION_SOURCE\"] = 2] = \"SYNCHRONIZATION_SOURCE\";\n VideoRTPParametersTypes[VideoRTPParametersTypes[\"MAX_BIT_RATE\"] = 3] = \"MAX_BIT_RATE\";\n VideoRTPParametersTypes[VideoRTPParametersTypes[\"MIN_RTCP_INTERVAL\"] = 4] = \"MIN_RTCP_INTERVAL\";\n VideoRTPParametersTypes[VideoRTPParametersTypes[\"MAX_MTU\"] = 5] = \"MAX_MTU\";\n})(VideoRTPParametersTypes || (VideoRTPParametersTypes = {}));\nvar SelectedAudioParametersTypes;\n(function (SelectedAudioParametersTypes) {\n SelectedAudioParametersTypes[SelectedAudioParametersTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n SelectedAudioParametersTypes[SelectedAudioParametersTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n SelectedAudioParametersTypes[SelectedAudioParametersTypes[\"RTP_PARAMETERS\"] = 3] = \"RTP_PARAMETERS\";\n SelectedAudioParametersTypes[SelectedAudioParametersTypes[\"COMFORT_NOISE\"] = 4] = \"COMFORT_NOISE\";\n})(SelectedAudioParametersTypes || (SelectedAudioParametersTypes = {}));\nvar AudioRTPParametersTypes;\n(function (AudioRTPParametersTypes) {\n AudioRTPParametersTypes[AudioRTPParametersTypes[\"PAYLOAD_TYPE\"] = 1] = \"PAYLOAD_TYPE\";\n AudioRTPParametersTypes[AudioRTPParametersTypes[\"SYNCHRONIZATION_SOURCE\"] = 2] = \"SYNCHRONIZATION_SOURCE\";\n AudioRTPParametersTypes[AudioRTPParametersTypes[\"MAX_BIT_RATE\"] = 3] = \"MAX_BIT_RATE\";\n AudioRTPParametersTypes[AudioRTPParametersTypes[\"MIN_RTCP_INTERVAL\"] = 4] = \"MIN_RTCP_INTERVAL\";\n AudioRTPParametersTypes[AudioRTPParametersTypes[\"COMFORT_NOISE_PAYLOAD_TYPE\"] = 6] = \"COMFORT_NOISE_PAYLOAD_TYPE\";\n})(AudioRTPParametersTypes || (AudioRTPParametersTypes = {}));\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isLegacySRTPOptions(options) {\n return \"srtp\" in options;\n}\n/**\n * @group Camera\n */\nvar AudioStreamingCodecType;\n(function (AudioStreamingCodecType) {\n AudioStreamingCodecType[\"PCMU\"] = \"PCMU\";\n AudioStreamingCodecType[\"PCMA\"] = \"PCMA\";\n AudioStreamingCodecType[\"AAC_ELD\"] = \"AAC-eld\";\n AudioStreamingCodecType[\"OPUS\"] = \"OPUS\";\n AudioStreamingCodecType[\"MSBC\"] = \"mSBC\";\n AudioStreamingCodecType[\"AMR\"] = \"AMR\";\n AudioStreamingCodecType[\"AMR_WB\"] = \"AMR-WB\";\n})(AudioStreamingCodecType = exports.AudioStreamingCodecType || (exports.AudioStreamingCodecType = {}));\n/**\n * @group Camera\n */\nvar AudioStreamingSamplerate;\n(function (AudioStreamingSamplerate) {\n AudioStreamingSamplerate[AudioStreamingSamplerate[\"KHZ_8\"] = 8] = \"KHZ_8\";\n AudioStreamingSamplerate[AudioStreamingSamplerate[\"KHZ_16\"] = 16] = \"KHZ_16\";\n AudioStreamingSamplerate[AudioStreamingSamplerate[\"KHZ_24\"] = 24] = \"KHZ_24\";\n})(AudioStreamingSamplerate = exports.AudioStreamingSamplerate || (exports.AudioStreamingSamplerate = {}));\n/**\n * @group Camera\n */\nvar StreamRequestTypes;\n(function (StreamRequestTypes) {\n StreamRequestTypes[\"RECONFIGURE\"] = \"reconfigure\";\n StreamRequestTypes[\"START\"] = \"start\";\n StreamRequestTypes[\"STOP\"] = \"stop\";\n})(StreamRequestTypes = exports.StreamRequestTypes || (exports.StreamRequestTypes = {}));\n/**\n * @group Camera\n */\nvar RTPStreamManagement = /** @class */ (function () {\n function RTPStreamManagement(id, options, delegate, service, disabledThroughOperatingMode) {\n this.videoOnly = false;\n this.sessionIdentifier = undefined;\n /**\n * @private private API\n */\n this.streamStatus = 0 /* StreamingStatus.AVAILABLE */; // use _updateStreamStatus to update this property\n this.selectedConfiguration = \"\"; // base64 representation of the currently selected configuration\n this.setupEndpointsResponse = \"\"; // response of the SetupEndpoints Characteristic\n this.id = id;\n this.delegate = delegate;\n this.requireProxy = options.proxy || false;\n this.disableAudioProxy = options.disable_audio_proxy || false;\n if (isLegacySRTPOptions(options)) {\n this.supportedCryptoSuites = [options.srtp ? 0 /* SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */ : 2 /* SRTPCryptoSuites.NONE */];\n }\n else {\n this.supportedCryptoSuites = options.supportedCryptoSuites;\n }\n if (this.supportedCryptoSuites.length === 0) {\n this.supportedCryptoSuites.push(2 /* SRTPCryptoSuites.NONE */);\n }\n if (!options.video) {\n throw new Error(\"Video parameters cannot be undefined in options\");\n }\n this.supportedRTPConfiguration = RTPStreamManagement._supportedRTPConfiguration(this.supportedCryptoSuites);\n this.supportedVideoStreamConfiguration = RTPStreamManagement._supportedVideoStreamConfiguration(options.video);\n this.supportedAudioStreamConfiguration = this._supportedAudioStreamConfiguration(options.audio);\n this.activeConnectionClosedListener = this._handleStopStream.bind(this);\n this.service = service || this.constructService(id);\n this.setupServiceHandlers();\n this.resetSetupEndpointsResponse();\n this.resetSelectedStreamConfiguration();\n this.disabledThroughOperatingMode = disabledThroughOperatingMode;\n }\n RTPStreamManagement.prototype.forceStop = function () {\n this.handleSessionClosed();\n };\n RTPStreamManagement.prototype.getService = function () {\n return this.service;\n };\n // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols\n /**\n * @deprecated\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n RTPStreamManagement.prototype.handleCloseConnection = function (connectionID) {\n // This method is only here for legacy compatibility. It used to be called by legacy style CameraSource\n // implementations to signal that the associated HAP connection was closed.\n // This is now handled automatically. Thus, we don't need to do anything anymore.\n };\n RTPStreamManagement.prototype.handleFactoryReset = function () {\n this.resetSelectedStreamConfiguration();\n this.resetSetupEndpointsResponse();\n this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, true);\n // on a factory reset the assumption is that all connections were already terminated and thus \"handleStopStream\" was already called\n };\n RTPStreamManagement.prototype.destroy = function () {\n if (this.activeConnection) {\n this._handleStopStream();\n }\n };\n RTPStreamManagement.prototype.constructService = function (id) {\n var managementService = new Service_1.Service.CameraRTPStreamManagement(\"\", id.toString());\n // this service is required only when recording is enabled. We don't really have access to this info here,\n // so we just add the characteristic. Doesn't really hurt.\n managementService.setCharacteristic(Characteristic_1.Characteristic.Active, true);\n return managementService;\n };\n RTPStreamManagement.prototype.setupServiceHandlers = function () {\n var _this = this;\n if (!this.service.testCharacteristic(Characteristic_1.Characteristic.Active)) {\n // the active characteristic might not be present on some older configurations.\n this.service.setCharacteristic(Characteristic_1.Characteristic.Active, true);\n }\n this.service.getCharacteristic(Characteristic_1.Characteristic.Active)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function () { var _a; return (_a = _this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(_this); })\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n // ensure that configurations are up-to-date and reflected in the characteristic values\n this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);\n this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);\n this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);\n this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */); // reset streaming status to available\n this.service.setCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default\n this.service.getCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n if (_this.streamingIsDisabled()) {\n callback(null, tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString(\"base64\"));\n return;\n }\n callback(null, _this.selectedConfiguration);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, this._handleSelectedStreamConfigurationWrite.bind(this));\n this.service.getCharacteristic(Characteristic_1.Characteristic.SetupEndpoints)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n if (_this.streamingIsDisabled()) {\n callback(null, tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString(\"base64\"));\n return;\n }\n callback(null, _this.setupEndpointsResponse);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback, context, connection) {\n if (!connection) {\n debug(\"Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!\");\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n _this.handleSetupEndpoints(value, callback, connection);\n });\n };\n RTPStreamManagement.prototype.handleSessionClosed = function () {\n this.resetSelectedStreamConfiguration();\n this.resetSetupEndpointsResponse();\n if (this.activeConnection) {\n this.activeConnection.removeListener(\"closed\" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);\n this.activeConnection = undefined;\n }\n this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */);\n this.sessionIdentifier = undefined;\n // noinspection JSDeprecatedSymbols\n this.connectionID = undefined;\n this.ipVersion = undefined;\n if (this.videoProxy) {\n this.videoProxy.destroy();\n this.videoProxy = undefined;\n }\n if (this.audioProxy) {\n this.audioProxy.destroy();\n this.audioProxy = undefined;\n }\n };\n RTPStreamManagement.prototype.streamingIsDisabled = function (callback) {\n var _a;\n if (!this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value) {\n callback && callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));\n return true;\n }\n if ((_a = this.disabledThroughOperatingMode) === null || _a === void 0 ? void 0 : _a.call(this)) {\n callback && callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));\n return true;\n }\n return false;\n };\n RTPStreamManagement.prototype._handleSelectedStreamConfigurationWrite = function (value, callback) {\n var _this = this;\n if (this.streamingIsDisabled(callback)) {\n return;\n }\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n var sessionControl = tlv.decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);\n var sessionIdentifier = uuid.unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);\n var requestType = sessionControl[2 /* SessionControlTypes.COMMAND */][0];\n if (sessionIdentifier !== this.sessionIdentifier) {\n debug(\"Received unknown session Identifier with request to \".concat(SessionControlCommand[requestType]));\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n this.selectedConfiguration = value;\n // intercept the callback chain to check if an error occurred.\n var streamCallback = function (error, writeResponse) {\n callback(error, writeResponse); // does not support writeResponse, but how knows what comes in the future.\n if (error) {\n _this.handleSessionClosed();\n }\n };\n switch (requestType) {\n case SessionControlCommand.START_SESSION: {\n var selectedVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);\n var selectedAudioParameters = tlv.decode(objects[3 /* SelectedRTPStreamConfigurationTypes.SELECTED_AUDIO_PARAMETERS */]);\n this._handleStartStream(selectedVideoParameters, selectedAudioParameters, streamCallback);\n break;\n }\n case SessionControlCommand.RECONFIGURE_SESSION: {\n var reconfiguredVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);\n this.handleReconfigureStream(reconfiguredVideoParameters, streamCallback);\n break;\n }\n case SessionControlCommand.END_SESSION:\n this._handleStopStream(streamCallback);\n break;\n case SessionControlCommand.RESUME_SESSION:\n case SessionControlCommand.SUSPEND_SESSION:\n default:\n debug(\"Unhandled request type \".concat(SessionControlCommand[requestType]));\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n };\n RTPStreamManagement.prototype._handleStartStream = function (videoConfiguration, audioConfiguration, callback) {\n // selected video configuration\n // noinspection JSUnusedLocalSymbols\n var videoCodec = videoConfiguration[1 /* SelectedVideoParametersTypes.CODEC_TYPE */]; // always 0x00 for h264\n var videoParametersTLV = videoConfiguration[2 /* SelectedVideoParametersTypes.CODEC_PARAMETERS */];\n var videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];\n var videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];\n // video parameters\n var videoParameters = tlv.decode(videoParametersTLV);\n var h264Profile = videoParameters[1 /* VideoCodecParametersTypes.PROFILE_ID */][0];\n var h264Level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];\n var packetizationMode = videoParameters[3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */][0];\n var cvoEnabled = videoParameters[4 /* VideoCodecParametersTypes.CVO_ENABLED */];\n var cvoId = undefined;\n if (cvoEnabled && cvoEnabled[0] === 1 /* VideoCodecCVO.SUPPORTED */) {\n cvoId = videoParameters[5 /* VideoCodecParametersTypes.CVO_ID */].readUInt8(0);\n }\n // video attributes\n var videoAttributes = tlv.decode(videoAttributesTLV);\n var width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);\n var height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);\n var frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);\n // video rtp parameters\n var videoRTPParameters = tlv.decode(videoRTPParametersTLV);\n var videoPayloadType = videoRTPParameters[1 /* VideoRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 99\n var videoSSRC = videoRTPParameters[2 /* VideoRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);\n var videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);\n var videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);\n var maxMTU = this.ipVersion === \"ipv6\" ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes\n if (videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */]) {\n maxMTU = videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */].readUInt16LE(0);\n }\n // selected audio configuration\n var audioCodec = audioConfiguration[1 /* SelectedAudioParametersTypes.CODEC_TYPE */][0];\n var audioParametersTLV = audioConfiguration[2 /* SelectedAudioParametersTypes.CODEC_PARAMETERS */];\n var audioRTPParametersTLV = audioConfiguration[3 /* SelectedAudioParametersTypes.RTP_PARAMETERS */];\n var comfortNoise = !!audioConfiguration[4 /* SelectedAudioParametersTypes.COMFORT_NOISE */].readUInt8(0);\n // audio parameters\n var audioParameters = tlv.decode(audioParametersTLV);\n var channels = audioParameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];\n var audioBitrate = audioParameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];\n var samplerate = audioParameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];\n var rtpPacketTime = audioParameters[4 /* AudioCodecParametersTypes.PACKET_TIME */].readUInt8(0);\n // audio rtp parameters\n var audioRTPParameters = tlv.decode(audioRTPParametersTLV);\n var audioPayloadType = audioRTPParameters[1 /* AudioRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 110\n var audioSSRC = audioRTPParameters[2 /* AudioRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);\n var audioMaximumBitrate = audioRTPParameters[3 /* AudioRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);\n var audioRTCPInterval = audioRTPParameters[4 /* AudioRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);\n var comfortNoisePayloadType = audioRTPParameters[6 /* AudioRTPParametersTypes.COMFORT_NOISE_PAYLOAD_TYPE */].readUInt8(0); // 13\n if (this.requireProxy) {\n this.videoProxy.setOutgoingPayloadType(videoPayloadType);\n if (!this.disableAudioProxy) {\n this.audioProxy.setOutgoingPayloadType(audioPayloadType);\n }\n }\n var videoInfo = {\n codec: videoCodec.readUInt8(0),\n profile: h264Profile,\n level: h264Level,\n packetizationMode: packetizationMode,\n cvoId: cvoId,\n width: width,\n height: height,\n fps: frameRate,\n pt: videoPayloadType,\n ssrc: videoSSRC,\n max_bit_rate: videoMaximumBitrate,\n rtcp_interval: videoRTCPInterval,\n mtu: maxMTU,\n };\n var audioCodecName;\n var samplerateNum;\n switch (audioCodec) {\n case 0 /* AudioCodecTypes.PCMU */:\n audioCodecName = \"PCMU\" /* AudioStreamingCodecType.PCMU */;\n break;\n case 1 /* AudioCodecTypes.PCMA */:\n audioCodecName = \"PCMA\" /* AudioStreamingCodecType.PCMA */;\n break;\n case 2 /* AudioCodecTypes.AAC_ELD */:\n audioCodecName = \"AAC-eld\" /* AudioStreamingCodecType.AAC_ELD */;\n break;\n case 3 /* AudioCodecTypes.OPUS */:\n audioCodecName = \"OPUS\" /* AudioStreamingCodecType.OPUS */;\n break;\n case 4 /* AudioCodecTypes.MSBC */:\n audioCodecName = \"mSBC\" /* AudioStreamingCodecType.MSBC */;\n break;\n case 5 /* AudioCodecTypes.AMR */:\n audioCodecName = \"AMR\" /* AudioStreamingCodecType.AMR */;\n break;\n case 6 /* AudioCodecTypes.AMR_WB */:\n audioCodecName = \"AMR-WB\" /* AudioStreamingCodecType.AMR_WB */;\n break;\n default:\n throw new Error(\"Encountered unknown selected audio codec \".concat(audioCodec));\n }\n switch (samplerate) {\n case 0 /* AudioSamplerate.KHZ_8 */:\n samplerateNum = 8;\n break;\n case 1 /* AudioSamplerate.KHZ_16 */:\n samplerateNum = 16;\n break;\n case 2 /* AudioSamplerate.KHZ_24 */:\n samplerateNum = 24;\n break;\n default:\n throw new Error(\"Encountered unknown selected audio samplerate \".concat(samplerate));\n }\n var audioInfo = {\n codec: audioCodecName,\n channel: channels,\n bit_rate: audioBitrate,\n sample_rate: samplerateNum,\n packet_time: rtpPacketTime,\n pt: audioPayloadType,\n ssrc: audioSSRC,\n max_bit_rate: audioMaximumBitrate,\n rtcp_interval: audioRTCPInterval,\n comfort_pt: comfortNoisePayloadType,\n comfortNoiseEnabled: comfortNoise,\n };\n var request = {\n sessionID: this.sessionIdentifier,\n type: \"start\" /* StreamRequestTypes.START */,\n video: videoInfo,\n audio: audioInfo,\n };\n this.delegate.handleStreamRequest(request, function (error) { return callback(error); });\n };\n RTPStreamManagement.prototype.handleReconfigureStream = function (videoConfiguration, callback) {\n // selected video configuration\n var videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];\n var videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];\n // video attributes\n var videoAttributes = tlv.decode(videoAttributesTLV);\n var width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);\n var height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);\n var frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);\n // video rtp parameters\n var videoRTPParameters = tlv.decode(videoRTPParametersTLV);\n var videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);\n // seems to be always zero, use default of 0.5\n var videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0) || 0.5;\n var reconfiguredVideoInfo = {\n width: width,\n height: height,\n fps: frameRate,\n max_bit_rate: videoMaximumBitrate,\n rtcp_interval: videoRTCPInterval,\n };\n var request = {\n sessionID: this.sessionIdentifier,\n type: \"reconfigure\" /* StreamRequestTypes.RECONFIGURE */,\n video: reconfiguredVideoInfo,\n };\n this.delegate.handleStreamRequest(request, function (error) { return callback(error); });\n };\n RTPStreamManagement.prototype._handleStopStream = function (callback) {\n var request = {\n sessionID: this.sessionIdentifier,\n type: \"stop\" /* StreamRequestTypes.STOP */,\n };\n this.handleSessionClosed();\n this.delegate.handleStreamRequest(request, function (error) { return callback ? callback(error) : undefined; });\n };\n RTPStreamManagement.prototype.handleSetupEndpoints = function (value, callback, connection) {\n var _this = this;\n if (this.streamingIsDisabled(callback)) {\n return;\n }\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n var sessionIdentifier = uuid.unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);\n if (this.streamStatus !== 0 /* StreamingStatus.AVAILABLE */) {\n this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString(\"base64\");\n callback();\n return;\n }\n (0, assert_1.default)(this.activeConnection == null, \"Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!\");\n this.activeConnection = connection;\n this.activeConnection.on(\"closed\" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);\n // noinspection JSDeprecatedSymbols\n this.connectionID = connection.sessionID;\n this.sessionIdentifier = sessionIdentifier;\n this._updateStreamStatus(1 /* StreamingStatus.IN_USE */);\n // Address\n var targetAddressPayload = objects[3 /* SetupEndpointsTypes.CONTROLLER_ADDRESS */];\n var processedAddressInfo = tlv.decode(targetAddressPayload);\n var addressVersion = processedAddressInfo[1 /* AddressTypes.ADDRESS_VERSION */][0];\n var controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString(\"utf8\");\n var targetVideoPort = processedAddressInfo[3 /* AddressTypes.VIDEO_RTP_PORT */].readUInt16LE(0);\n var targetAudioPort = processedAddressInfo[4 /* AddressTypes.AUDIO_RTP_PORT */].readUInt16LE(0);\n // Video SRTP Params\n var videoSRTPPayload = objects[4 /* SetupEndpointsTypes.VIDEO_SRTP_PARAMETERS */];\n var processedVideoInfo = tlv.decode(videoSRTPPayload);\n var videoCryptoSuite = processedVideoInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];\n var videoMasterKey = processedVideoInfo[2 /* SRTPParametersTypes.MASTER_KEY */];\n var videoMasterSalt = processedVideoInfo[3 /* SRTPParametersTypes.MASTER_SALT */];\n // Audio SRTP Params\n var audioSRTPPayload = objects[5 /* SetupEndpointsTypes.AUDIO_SRTP_PARAMETERS */];\n var processedAudioInfo = tlv.decode(audioSRTPPayload);\n var audioCryptoSuite = processedAudioInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];\n var audioMasterKey = processedAudioInfo[2 /* SRTPParametersTypes.MASTER_KEY */];\n var audioMasterSalt = processedAudioInfo[3 /* SRTPParametersTypes.MASTER_SALT */];\n debug(\"Session: \", sessionIdentifier, \"\\nControllerAddress: \", controllerAddress, \"\\nVideoPort: \", targetVideoPort, \"\\nAudioPort: \", targetAudioPort, \"\\nVideo Crypto: \", videoCryptoSuite, \"\\nVideo Master Key: \", videoMasterKey, \"\\nVideo Master Salt: \", videoMasterSalt, \"\\nAudio Crypto: \", audioCryptoSuite, \"\\nAudio Master Key: \", audioMasterKey, \"\\nAudio Master Salt: \", audioMasterSalt);\n var prepareRequest = {\n sessionID: sessionIdentifier,\n sourceAddress: connection.localAddress,\n targetAddress: controllerAddress,\n addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? \"ipv6\" : \"ipv4\",\n video: {\n port: targetVideoPort,\n srtpCryptoSuite: videoCryptoSuite,\n srtp_key: videoMasterKey,\n srtp_salt: videoMasterSalt,\n },\n audio: {\n port: targetAudioPort,\n srtpCryptoSuite: audioCryptoSuite,\n srtp_key: audioMasterKey,\n srtp_salt: audioMasterSalt,\n },\n };\n var promises = [];\n if (this.requireProxy) {\n prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? \"ipv6\" : \"ipv4\"); // ip versions must be the same\n this.videoProxy = new RTPProxy_1.default({\n outgoingAddress: controllerAddress,\n outgoingPort: targetVideoPort,\n outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0),\n disabled: false,\n });\n promises.push(this.videoProxy.setup().then(function () {\n prepareRequest.video.proxy_rtp = _this.videoProxy.incomingRTPPort();\n prepareRequest.video.proxy_rtcp = _this.videoProxy.incomingRTCPPort();\n }));\n if (!this.disableAudioProxy) {\n this.audioProxy = new RTPProxy_1.default({\n outgoingAddress: controllerAddress,\n outgoingPort: targetAudioPort,\n outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0),\n disabled: this.videoOnly,\n });\n promises.push(this.audioProxy.setup().then(function () {\n prepareRequest.audio.proxy_rtp = _this.audioProxy.incomingRTPPort();\n prepareRequest.audio.proxy_rtcp = _this.audioProxy.incomingRTCPPort();\n }));\n }\n }\n Promise.all(promises).then(function () {\n _this.delegate.prepareStream(prepareRequest, (0, once_1.once)(function (error, response) {\n if (error || !response) {\n debug(\"PrepareStream request encountered an error: \".concat(error ? error.message : undefined));\n _this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString(\"base64\");\n _this.handleSessionClosed();\n callback(error);\n }\n else {\n _this.generateSetupEndpointResponse(connection, sessionIdentifier, prepareRequest, response, callback);\n }\n }));\n });\n };\n RTPStreamManagement.prototype.generateSetupEndpointResponse = function (connection, identifier, request, response, callback) {\n var address;\n var addressVersion = request.addressVersion;\n var videoPort;\n var audioPort;\n var videoCryptoSuite;\n var videoSRTPKey;\n var videoSRTPSalt;\n var audioCryptoSuite;\n var audioSRTPKey;\n var audioSRTPSalt;\n var videoSSRC;\n var audioSSRC;\n if (!this.videoOnly && !response.audio) {\n throw new Error(\"Audio was enabled but not supplied in PrepareStreamResponse!\");\n }\n // Provide default values if audio was not supplied\n var audio = response.audio || {\n port: request.audio.port,\n ssrc: controller_1.CameraController.generateSynchronisationSource(),\n srtp_key: request.audio.srtp_key,\n srtp_salt: request.audio.srtp_salt,\n };\n if (!this.requireProxy) {\n var videoInfo = response.video;\n var audioInfo = audio;\n if (response.addressOverride) {\n addressVersion = net_1.default.isIPv4(response.addressOverride) ? \"ipv4\" : \"ipv6\";\n address = response.addressOverride;\n }\n else {\n address = connection.getLocalAddress(addressVersion);\n }\n if (request.addressVersion !== addressVersion) {\n throw new Error(\"Incoming and outgoing ip address versions must match! Expected \".concat(request.addressVersion, \" but got \").concat(addressVersion));\n }\n videoPort = videoInfo.port;\n audioPort = audioInfo.port;\n if (request.video.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */\n && (videoInfo.srtp_key === undefined || videoInfo.srtp_salt === undefined)) {\n throw new Error(\"SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!\");\n }\n if (request.audio.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */\n && (audioInfo.srtp_key === undefined || audioInfo.srtp_salt === undefined)) {\n throw new Error(\"SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!\");\n }\n videoCryptoSuite = request.video.srtpCryptoSuite;\n videoSRTPKey = videoInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE\n videoSRTPSalt = videoInfo.srtp_salt || Buffer.alloc(0);\n audioCryptoSuite = request.audio.srtpCryptoSuite;\n audioSRTPKey = audioInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE\n audioSRTPSalt = audioInfo.srtp_salt || Buffer.alloc(0);\n videoSSRC = videoInfo.ssrc;\n audioSSRC = audioInfo.ssrc;\n }\n else {\n var videoInfo = response.video;\n address = connection.getLocalAddress(request.addressVersion);\n videoCryptoSuite = 2 /* SRTPCryptoSuites.NONE */;\n videoSRTPKey = Buffer.alloc(0);\n videoSRTPSalt = Buffer.alloc(0);\n audioCryptoSuite = 2 /* SRTPCryptoSuites.NONE */;\n audioSRTPKey = Buffer.alloc(0);\n audioSRTPSalt = Buffer.alloc(0);\n this.videoProxy.setIncomingPayloadType(videoInfo.proxy_pt);\n this.videoProxy.setServerAddress(videoInfo.proxy_server_address);\n this.videoProxy.setServerRTPPort(videoInfo.proxy_server_rtp);\n this.videoProxy.setServerRTCPPort(videoInfo.proxy_server_rtcp);\n videoPort = this.videoProxy.outgoingLocalPort();\n videoSSRC = this.videoProxy.outgoingSSRC;\n if (!this.disableAudioProxy) {\n var audioInfo = response.audio;\n this.audioProxy.setIncomingPayloadType(audioInfo.proxy_pt);\n this.audioProxy.setServerAddress(audioInfo.proxy_server_address);\n this.audioProxy.setServerRTPPort(audioInfo.proxy_server_rtp);\n this.audioProxy.setServerRTCPPort(audioInfo.proxy_server_rtcp);\n audioPort = this.audioProxy.outgoingLocalPort();\n audioSSRC = this.audioProxy.outgoingSSRC;\n }\n else {\n var audioInfo = response.audio;\n audioPort = audioInfo.port;\n audioSSRC = audioInfo.ssrc;\n }\n }\n this.ipVersion = addressVersion; // we need to save this in order to calculate some default mtu values later\n var accessoryAddress = tlv.encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === \"ipv4\" ? 0 /* IPAddressVersion.IPV4 */ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, tlv.writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, tlv.writeUInt16(audioPort));\n var videoSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);\n var audioSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);\n this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(identifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 0 /* SetupEndpointsStatus.SUCCESS */, 3 /* SetupEndpointsResponseTypes.ACCESSORY_ADDRESS */, accessoryAddress, 4 /* SetupEndpointsResponseTypes.VIDEO_SRTP_PARAMETERS */, videoSRTPParameters, 5 /* SetupEndpointsResponseTypes.AUDIO_SRTP_PARAMETERS */, audioSRTPParameters, 6 /* SetupEndpointsResponseTypes.VIDEO_SSRC */, tlv.writeUInt32(videoSSRC), 7 /* SetupEndpointsResponseTypes.AUDIO_SSRC */, tlv.writeUInt32(audioSSRC)).toString(\"base64\");\n callback();\n };\n RTPStreamManagement.prototype._updateStreamStatus = function (status) {\n this.streamStatus = status;\n this.service.updateCharacteristic(Characteristic_1.Characteristic.StreamingStatus, tlv.encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString(\"base64\"));\n };\n RTPStreamManagement._supportedRTPConfiguration = function (supportedCryptoSuites) {\n if (supportedCryptoSuites.length === 1 && supportedCryptoSuites[0] === 2 /* SRTPCryptoSuites.NONE */) {\n debug(\"Client claims it doesn't support SRTP. The stream may stops working with future iOS releases.\");\n }\n return tlv.encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString(\"base64\");\n };\n RTPStreamManagement._supportedVideoStreamConfiguration = function (videoOptions) {\n if (!videoOptions.codec) {\n throw new Error(\"Video codec cannot be undefined\");\n }\n if (!videoOptions.resolutions) {\n throw new Error(\"Video resolutions cannot be undefined\");\n }\n var codecParameters = tlv.encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.codec.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.codec.levels, 3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */, 0 /* VideoCodecPacketizationMode.NON_INTERLEAVED */);\n if (videoOptions.cvoId != null) {\n codecParameters = Buffer.concat([\n codecParameters,\n tlv.encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),\n ]);\n }\n var videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(function (resolution) {\n if (resolution.length !== 3) {\n throw new Error(\"Unexpected video resolution\");\n }\n var width = Buffer.alloc(2);\n var height = Buffer.alloc(2);\n var frameRate = Buffer.alloc(1);\n width.writeUInt16LE(resolution[0], 0);\n height.writeUInt16LE(resolution[1], 0);\n frameRate.writeUInt8(resolution[2], 0);\n return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);\n }));\n return tlv.encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString(\"base64\");\n };\n RTPStreamManagement.prototype.checkForLegacyAudioCodecRepresentation = function (codecs) {\n var codecMap = {};\n codecs.slice().forEach(function (codec) {\n var previous = codecMap[codec.type];\n if (previous) {\n if (typeof previous.samplerate === \"number\") {\n previous.samplerate = [previous.samplerate];\n }\n previous.samplerate = previous.samplerate.concat(codec.samplerate);\n var index = codecs.indexOf(codec);\n if (index >= 0) {\n codecs.splice(index, 1);\n }\n }\n else {\n codecMap[codec.type] = codec;\n }\n });\n };\n RTPStreamManagement.prototype._supportedAudioStreamConfiguration = function (audioOptions) {\n // Only AAC-ELD and OPUS are accepted by iOS currently, and we need to give it something it will accept\n // for it to start the video stream.\n var comfortNoise = audioOptions && !!audioOptions.comfort_noise;\n var supportedCodecs = (audioOptions && audioOptions.codecs) || [];\n this.checkForLegacyAudioCodecRepresentation(supportedCodecs);\n if (supportedCodecs.length === 0) { // Fake a Codec if we haven't got anything\n debug(\"Client doesn't support any audio codec that HomeKit supports.\");\n this.videoOnly = true;\n supportedCodecs.push({\n type: \"OPUS\" /* AudioStreamingCodecType.OPUS */,\n samplerate: [16 /* AudioStreamingSamplerate.KHZ_16 */, 24 /* AudioStreamingSamplerate.KHZ_24 */], // 16 and 24 must be supported\n });\n }\n var codecConfigurations = supportedCodecs.map(function (codec) {\n var type;\n switch (codec.type) {\n case \"OPUS\" /* AudioStreamingCodecType.OPUS */:\n type = 3 /* AudioCodecTypes.OPUS */;\n break;\n case \"AAC-eld\" /* AudioStreamingCodecType.AAC_ELD */:\n type = 2 /* AudioCodecTypes.AAC_ELD */;\n break;\n case \"PCMA\" /* AudioStreamingCodecType.PCMA */:\n type = 1 /* AudioCodecTypes.PCMA */;\n break;\n case \"PCMU\" /* AudioStreamingCodecType.PCMU */:\n type = 0 /* AudioCodecTypes.PCMU */;\n break;\n case \"mSBC\" /* AudioStreamingCodecType.MSBC */:\n type = 4 /* AudioCodecTypes.MSBC */;\n break;\n case \"AMR\" /* AudioStreamingCodecType.AMR */:\n type = 5 /* AudioCodecTypes.AMR */;\n break;\n case \"AMR-WB\" /* AudioStreamingCodecType.AMR_WB */:\n type = 6 /* AudioCodecTypes.AMR_WB */;\n break;\n default:\n throw new Error(\"Unsupported codec: \" + codec.type);\n }\n var providedSamplerates = (typeof codec.samplerate === \"number\" ? [codec.samplerate] : codec.samplerate).map(function (rate) {\n var samplerate;\n switch (rate) {\n case 8 /* AudioStreamingSamplerate.KHZ_8 */:\n samplerate = 0 /* AudioSamplerate.KHZ_8 */;\n break;\n case 16 /* AudioStreamingSamplerate.KHZ_16 */:\n samplerate = 1 /* AudioSamplerate.KHZ_16 */;\n break;\n case 24 /* AudioStreamingSamplerate.KHZ_24 */:\n samplerate = 2 /* AudioSamplerate.KHZ_24 */;\n break;\n default:\n console.log(\"Unsupported sample rate: \", codec.samplerate);\n samplerate = -1;\n }\n return samplerate;\n }).filter(function (rate) { return rate !== -1; });\n if (providedSamplerates.length === 0) {\n throw new Error(\"Audio samplerate cannot be empty!\");\n }\n var audioParameters = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrate || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);\n return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);\n });\n return tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString(\"base64\");\n };\n RTPStreamManagement.prototype.resetSetupEndpointsResponse = function () {\n this.setupEndpointsResponse = tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString(\"base64\");\n this.service.updateCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse);\n };\n RTPStreamManagement.prototype.resetSelectedStreamConfiguration = function () {\n this.selectedConfiguration = tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString(\"base64\");\n this.service.updateCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);\n };\n /**\n * @private\n */\n RTPStreamManagement.prototype.serialize = function () {\n var characteristicValue = this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value;\n if (characteristicValue === true) {\n return undefined;\n }\n return {\n id: this.id,\n active: !!characteristicValue,\n };\n };\n /**\n * @private\n */\n RTPStreamManagement.prototype.deserialize = function (serialized) {\n (0, assert_1.default)(serialized.id === this.id, \"Tried to initialize RTPStreamManagement \".concat(this.id, \" with data from management with id \").concat(serialized.id, \"!\"));\n this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, serialized.active);\n };\n /**\n * @private\n */\n RTPStreamManagement.prototype.setupStateChangeDelegate = function (delegate) {\n this.stateChangeDelegate = delegate;\n };\n /**\n * @deprecated Please use the SRTPCryptoSuites const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n RTPStreamManagement.SRTPCryptoSuites = SRTPCryptoSuites;\n /**\n * @deprecated Please use the H264Profile const enum above.\n */\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n RTPStreamManagement.VideoCodecParamProfileIDTypes = H264Profile;\n /**\n * @deprecated won't be updated anymore. Please use the H264Level const enum above.\n */\n RTPStreamManagement.VideoCodecParamLevelTypes = Object.freeze({ TYPE3_1: 0, TYPE3_2: 1, TYPE4_0: 2 });\n return RTPStreamManagement;\n}());\nexports.RTPStreamManagement = RTPStreamManagement;\n/**\n * @group Camera\n * @deprecated - only there for backwards compatibility, please use {@link RTPStreamManagement} directly\n */\nvar StreamController = /** @class */ (function (_super) {\n tslib_1.__extends(StreamController, _super);\n // noinspection JSDeprecatedSymbols\n function StreamController(id, options, delegate, service) {\n var _this = _super.call(this, id, options, new Camera_1.LegacyCameraSourceAdapter(delegate), service) || this;\n _this.options = options;\n return _this;\n }\n return StreamController;\n}(RTPStreamManagement));\nexports.StreamController = StreamController;\n//# sourceMappingURL=RTPStreamManagement.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RecordingManagement = exports.PacketDataType = exports.AudioRecordingSamplerate = exports.AudioRecordingCodecType = exports.MediaContainerType = exports.EventTriggerOption = void 0;\nvar tslib_1 = require(\"tslib\");\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar datastream_1 = require(\"../datastream\");\nvar Service_1 = require(\"../Service\");\nvar hapStatusError_1 = require(\"../util/hapStatusError\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Camera:RecordingManagement\");\n/**\n * Describes the Event trigger.\n *\n * @group Camera\n */\nvar EventTriggerOption;\n(function (EventTriggerOption) {\n /**\n * The Motion trigger. If enabled motion should trigger the start of a recording.\n */\n EventTriggerOption[EventTriggerOption[\"MOTION\"] = 1] = \"MOTION\";\n /**\n * The Doorbell trigger. If enabled a doorbell button press should trigger the start of a recording.\n *\n * Note: While the doorbell is defined by the HomeKit specification and HAP-NodeJS supports (and the\n * {@link RecordingManagement} advertises support for it), HomeKit HomeHubs will (as of now, iOS 15-16)\n * never enable Doorbell triggers. Seemingly this is currently unsupported by Apple.\n * See https://github.com/homebridge/HAP-NodeJS/issues/976#issuecomment-1280301989.\n */\n EventTriggerOption[EventTriggerOption[\"DOORBELL\"] = 2] = \"DOORBELL\";\n})(EventTriggerOption = exports.EventTriggerOption || (exports.EventTriggerOption = {}));\n/**\n * @group Camera\n */\nvar MediaContainerType;\n(function (MediaContainerType) {\n MediaContainerType[MediaContainerType[\"FRAGMENTED_MP4\"] = 0] = \"FRAGMENTED_MP4\";\n})(MediaContainerType = exports.MediaContainerType || (exports.MediaContainerType = {}));\nvar VideoCodecConfigurationTypes;\n(function (VideoCodecConfigurationTypes) {\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n VideoCodecConfigurationTypes[VideoCodecConfigurationTypes[\"ATTRIBUTES\"] = 3] = \"ATTRIBUTES\";\n})(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));\nvar VideoCodecParametersTypes;\n(function (VideoCodecParametersTypes) {\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"PROFILE_ID\"] = 1] = \"PROFILE_ID\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"LEVEL\"] = 2] = \"LEVEL\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"BITRATE\"] = 3] = \"BITRATE\";\n VideoCodecParametersTypes[VideoCodecParametersTypes[\"IFRAME_INTERVAL\"] = 4] = \"IFRAME_INTERVAL\";\n})(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));\nvar VideoAttributesTypes;\n(function (VideoAttributesTypes) {\n VideoAttributesTypes[VideoAttributesTypes[\"IMAGE_WIDTH\"] = 1] = \"IMAGE_WIDTH\";\n VideoAttributesTypes[VideoAttributesTypes[\"IMAGE_HEIGHT\"] = 2] = \"IMAGE_HEIGHT\";\n VideoAttributesTypes[VideoAttributesTypes[\"FRAME_RATE\"] = 3] = \"FRAME_RATE\";\n})(VideoAttributesTypes || (VideoAttributesTypes = {}));\nvar SelectedCameraRecordingConfigurationTypes;\n(function (SelectedCameraRecordingConfigurationTypes) {\n SelectedCameraRecordingConfigurationTypes[SelectedCameraRecordingConfigurationTypes[\"SELECTED_RECORDING_CONFIGURATION\"] = 1] = \"SELECTED_RECORDING_CONFIGURATION\";\n SelectedCameraRecordingConfigurationTypes[SelectedCameraRecordingConfigurationTypes[\"SELECTED_VIDEO_CONFIGURATION\"] = 2] = \"SELECTED_VIDEO_CONFIGURATION\";\n SelectedCameraRecordingConfigurationTypes[SelectedCameraRecordingConfigurationTypes[\"SELECTED_AUDIO_CONFIGURATION\"] = 3] = \"SELECTED_AUDIO_CONFIGURATION\";\n})(SelectedCameraRecordingConfigurationTypes || (SelectedCameraRecordingConfigurationTypes = {}));\n/**\n * @group Camera\n */\nvar AudioRecordingCodecType;\n(function (AudioRecordingCodecType) {\n AudioRecordingCodecType[AudioRecordingCodecType[\"AAC_LC\"] = 0] = \"AAC_LC\";\n AudioRecordingCodecType[AudioRecordingCodecType[\"AAC_ELD\"] = 1] = \"AAC_ELD\";\n})(AudioRecordingCodecType = exports.AudioRecordingCodecType || (exports.AudioRecordingCodecType = {}));\n/**\n * @group Camera\n */\nvar AudioRecordingSamplerate;\n(function (AudioRecordingSamplerate) {\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_8\"] = 0] = \"KHZ_8\";\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_16\"] = 1] = \"KHZ_16\";\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_24\"] = 2] = \"KHZ_24\";\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_32\"] = 3] = \"KHZ_32\";\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_44_1\"] = 4] = \"KHZ_44_1\";\n AudioRecordingSamplerate[AudioRecordingSamplerate[\"KHZ_48\"] = 5] = \"KHZ_48\";\n})(AudioRecordingSamplerate = exports.AudioRecordingSamplerate || (exports.AudioRecordingSamplerate = {}));\nvar SupportedVideoRecordingConfigurationTypes;\n(function (SupportedVideoRecordingConfigurationTypes) {\n SupportedVideoRecordingConfigurationTypes[SupportedVideoRecordingConfigurationTypes[\"VIDEO_CODEC_CONFIGURATION\"] = 1] = \"VIDEO_CODEC_CONFIGURATION\";\n})(SupportedVideoRecordingConfigurationTypes || (SupportedVideoRecordingConfigurationTypes = {}));\nvar SupportedCameraRecordingConfigurationTypes;\n(function (SupportedCameraRecordingConfigurationTypes) {\n SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes[\"PREBUFFER_LENGTH\"] = 1] = \"PREBUFFER_LENGTH\";\n SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes[\"EVENT_TRIGGER_OPTIONS\"] = 2] = \"EVENT_TRIGGER_OPTIONS\";\n SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes[\"MEDIA_CONTAINER_CONFIGURATIONS\"] = 3] = \"MEDIA_CONTAINER_CONFIGURATIONS\";\n})(SupportedCameraRecordingConfigurationTypes || (SupportedCameraRecordingConfigurationTypes = {}));\nvar MediaContainerConfigurationTypes;\n(function (MediaContainerConfigurationTypes) {\n MediaContainerConfigurationTypes[MediaContainerConfigurationTypes[\"MEDIA_CONTAINER_TYPE\"] = 1] = \"MEDIA_CONTAINER_TYPE\";\n MediaContainerConfigurationTypes[MediaContainerConfigurationTypes[\"MEDIA_CONTAINER_PARAMETERS\"] = 2] = \"MEDIA_CONTAINER_PARAMETERS\";\n})(MediaContainerConfigurationTypes || (MediaContainerConfigurationTypes = {}));\nvar MediaContainerParameterTypes;\n(function (MediaContainerParameterTypes) {\n MediaContainerParameterTypes[MediaContainerParameterTypes[\"FRAGMENT_LENGTH\"] = 1] = \"FRAGMENT_LENGTH\";\n})(MediaContainerParameterTypes || (MediaContainerParameterTypes = {}));\nvar AudioCodecParametersTypes;\n(function (AudioCodecParametersTypes) {\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"CHANNEL\"] = 1] = \"CHANNEL\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"BIT_RATE\"] = 2] = \"BIT_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"SAMPLE_RATE\"] = 3] = \"SAMPLE_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"MAX_AUDIO_BITRATE\"] = 4] = \"MAX_AUDIO_BITRATE\"; // only present in selected audio codec parameters tlv\n})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));\nvar AudioCodecConfigurationTypes;\n(function (AudioCodecConfigurationTypes) {\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));\nvar SupportedAudioRecordingConfigurationTypes;\n(function (SupportedAudioRecordingConfigurationTypes) {\n SupportedAudioRecordingConfigurationTypes[SupportedAudioRecordingConfigurationTypes[\"AUDIO_CODEC_CONFIGURATION\"] = 1] = \"AUDIO_CODEC_CONFIGURATION\";\n})(SupportedAudioRecordingConfigurationTypes || (SupportedAudioRecordingConfigurationTypes = {}));\n/**\n * @group Camera\n */\nvar PacketDataType;\n(function (PacketDataType) {\n /**\n * mp4 moov box\n */\n PacketDataType[\"MEDIA_INITIALIZATION\"] = \"mediaInitialization\";\n /**\n * mp4 moof + mdat boxes\n */\n PacketDataType[\"MEDIA_FRAGMENT\"] = \"mediaFragment\";\n})(PacketDataType = exports.PacketDataType || (exports.PacketDataType = {}));\n/**\n * @group Camera\n */\nvar RecordingManagement = /** @class */ (function () {\n function RecordingManagement(options, delegate, eventTriggerOptions, services) {\n var e_1, _a;\n /**\n * Array of sensor services (e.g. {@link Service.MotionSensor} or {@link Service.OccupancySensor}).\n * Any service in this array owns a {@link Characteristic.StatusActive} characteristic.\n * The value of the {@link Characteristic.HomeKitCameraActive} is mirrored towards the {@link Characteristic.StatusActive} characteristic.\n * The array is initialized my the caller shortly after calling the constructor.\n */\n this.sensorServices = [];\n /**\n * Defines if recording is enabled for this recording management.\n */\n this.recordingActive = false;\n this.options = options;\n this.delegate = delegate;\n var recordingServices = services || this.constructService();\n this.recordingManagementService = recordingServices.recordingManagement;\n this.operatingModeService = recordingServices.operatingMode;\n this.dataStreamManagement = recordingServices.dataStreamManagement;\n this.eventTriggerOptions = 0;\n try {\n for (var eventTriggerOptions_1 = tslib_1.__values(eventTriggerOptions), eventTriggerOptions_1_1 = eventTriggerOptions_1.next(); !eventTriggerOptions_1_1.done; eventTriggerOptions_1_1 = eventTriggerOptions_1.next()) {\n var option = eventTriggerOptions_1_1.value;\n this.eventTriggerOptions |= option; // OR\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (eventTriggerOptions_1_1 && !eventTriggerOptions_1_1.done && (_a = eventTriggerOptions_1.return)) _a.call(eventTriggerOptions_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.supportedCameraRecordingConfiguration = this._supportedCameraRecordingConfiguration(options);\n this.supportedVideoRecordingConfiguration = this._supportedVideoRecordingConfiguration(options.video);\n this.supportedAudioRecordingConfiguration = this._supportedAudioStreamConfiguration(options.audio);\n this.setupServiceHandlers();\n }\n RecordingManagement.prototype.constructService = function () {\n var recordingManagement = new Service_1.Service.CameraRecordingManagement(\"\", \"\");\n recordingManagement.setCharacteristic(Characteristic_1.Characteristic.Active, false);\n recordingManagement.setCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive, false);\n var operatingMode = new Service_1.Service.CameraOperatingMode(\"\", \"\");\n operatingMode.setCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive, true);\n operatingMode.setCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive, true);\n operatingMode.setCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive, true);\n var dataStreamManagement = new datastream_1.DataStreamManagement();\n recordingManagement.addLinkedService(dataStreamManagement.getService());\n return {\n recordingManagement: recordingManagement,\n operatingMode: operatingMode,\n dataStreamManagement: dataStreamManagement,\n };\n };\n RecordingManagement.prototype.setupServiceHandlers = function () {\n var _this = this;\n // update the current configuration values to the current state.\n this.recordingManagementService.setCharacteristic(Characteristic_1.Characteristic.SupportedCameraRecordingConfiguration, this.supportedCameraRecordingConfiguration);\n this.recordingManagementService.setCharacteristic(Characteristic_1.Characteristic.SupportedVideoRecordingConfiguration, this.supportedVideoRecordingConfiguration);\n this.recordingManagementService.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioRecordingConfiguration, this.supportedAudioRecordingConfiguration);\n this.recordingManagementService.getCharacteristic(Characteristic_1.Characteristic.SelectedCameraRecordingConfiguration)\n .onGet(this.handleSelectedCameraRecordingConfigurationRead.bind(this))\n .onSet(this.handleSelectedCameraRecordingConfigurationWrite.bind(this))\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n this.recordingManagementService.getCharacteristic(Characteristic_1.Characteristic.Active)\n .onSet(function (value) {\n if (!!value === _this.recordingActive) {\n return; // skip delegate call if state didn't change!\n }\n _this.recordingActive = !!value;\n _this.delegate.updateRecordingActive(_this.recordingActive);\n })\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function () { var _a; return (_a = _this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(_this); })\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n this.recordingManagementService.getCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function () { var _a; return (_a = _this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(_this); });\n this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function (change) {\n var e_2, _a;\n var _b;\n try {\n for (var _c = tslib_1.__values(_this.sensorServices), _d = _c.next(); !_d.done; _d = _c.next()) {\n var service = _d.value;\n service.setCharacteristic(Characteristic_1.Characteristic.StatusActive, !!change.newValue);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (!change.newValue && _this.recordingStream) {\n _this.recordingStream.close(1 /* HDSProtocolSpecificErrorReason.NOT_ALLOWED */);\n }\n (_b = _this.stateChangeDelegate) === null || _b === void 0 ? void 0 : _b.call(_this);\n })\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function () { var _a; return (_a = _this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(_this); })\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, function () { var _a; return (_a = _this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(_this); })\n .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });\n this.dataStreamManagement\n .onRequestMessage(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, this.handleDataSendOpen.bind(this));\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RecordingManagement.prototype.handleDataSendOpen = function (connection, id, message) {\n var _this = this;\n // for message fields see https://github.com/Supereg/secure-video-specification#41-start\n var streamId = message.streamId;\n var type = message.type;\n var target = message.target;\n var reason = message.reason;\n if (target !== \"controller\" || type !== \"ipcamera.recording\") {\n debug(\"[HDS %s] Received data send with unexpected target: %s or type: %d. Rejecting...\", connection.remoteAddress, target, type);\n connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, id, datastream_1.HDSStatus.PROTOCOL_SPECIFIC_ERROR, {\n status: 5 /* HDSProtocolSpecificErrorReason.UNEXPECTED_FAILURE */,\n });\n return;\n }\n if (!this.recordingActive) {\n connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, id, datastream_1.HDSStatus.PROTOCOL_SPECIFIC_ERROR, {\n status: 1 /* HDSProtocolSpecificErrorReason.NOT_ALLOWED */,\n });\n return;\n }\n if (!this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive).value) {\n connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, id, datastream_1.HDSStatus.PROTOCOL_SPECIFIC_ERROR, {\n status: 1 /* HDSProtocolSpecificErrorReason.NOT_ALLOWED */,\n });\n return;\n }\n if (this.recordingStream) {\n debug(\"[HDS %s] Rejecting DATA_SEND OPEN as another stream (%s) is already recording with streamId %d!\", connection.remoteAddress, this.recordingStream.connection.remoteAddress, this.recordingStream.streamId);\n // there is already a recording stream running.\n connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, id, datastream_1.HDSStatus.PROTOCOL_SPECIFIC_ERROR, {\n status: 2 /* HDSProtocolSpecificErrorReason.BUSY */,\n });\n return;\n }\n if (!this.selectedConfiguration) {\n connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, id, datastream_1.HDSStatus.PROTOCOL_SPECIFIC_ERROR, {\n status: 9 /* HDSProtocolSpecificErrorReason.INVALID_CONFIGURATION */,\n });\n return;\n }\n debug(\"[HDS %s] HDS DATA_SEND Open with reason '%s'.\", connection.remoteAddress, reason);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.recordingStream = new CameraRecordingStream(connection, this.delegate, id, streamId);\n this.recordingStream.on(\"closed\" /* CameraRecordingStreamEvents.CLOSED */, function () {\n debug(\"[HDS %s] Removing active recoding session from recording management!\");\n _this.recordingStream = undefined;\n });\n this.recordingStream.startStreaming();\n };\n RecordingManagement.prototype.handleSelectedCameraRecordingConfigurationRead = function () {\n if (!this.selectedConfiguration) {\n throw new hapStatusError_1.HapStatusError(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n return this.selectedConfiguration.base64;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RecordingManagement.prototype.handleSelectedCameraRecordingConfigurationWrite = function (value) {\n var _a, _b;\n var configuration = this.parseSelectedConfiguration(value);\n var changed = ((_a = this.selectedConfiguration) === null || _a === void 0 ? void 0 : _a.base64) !== value;\n this.selectedConfiguration = {\n parsed: configuration,\n base64: value,\n };\n if (changed) {\n this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed);\n // notify controller storage about updated values!\n (_b = this.stateChangeDelegate) === null || _b === void 0 ? void 0 : _b.call(this);\n }\n };\n RecordingManagement.prototype.parseSelectedConfiguration = function (value) {\n var decoded = tlv.decode(Buffer.from(value, \"base64\"));\n var recording = tlv.decode(decoded[1 /* SelectedCameraRecordingConfigurationTypes.SELECTED_RECORDING_CONFIGURATION */]);\n var video = tlv.decode(decoded[2 /* SelectedCameraRecordingConfigurationTypes.SELECTED_VIDEO_CONFIGURATION */]);\n var audio = tlv.decode(decoded[3 /* SelectedCameraRecordingConfigurationTypes.SELECTED_AUDIO_CONFIGURATION */]);\n var prebufferLength = recording[1 /* SupportedCameraRecordingConfigurationTypes.PREBUFFER_LENGTH */].readInt32LE(0);\n var eventTriggerOptions = recording[2 /* SupportedCameraRecordingConfigurationTypes.EVENT_TRIGGER_OPTIONS */].readInt32LE(0);\n var mediaContainerConfiguration = tlv.decode(recording[3 /* SupportedCameraRecordingConfigurationTypes.MEDIA_CONTAINER_CONFIGURATIONS */]);\n var containerType = mediaContainerConfiguration[1 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_TYPE */][0];\n var mediaContainerParameters = tlv.decode(mediaContainerConfiguration[2 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_PARAMETERS */]);\n var fragmentLength = mediaContainerParameters[1 /* MediaContainerParameterTypes.FRAGMENT_LENGTH */].readInt32LE(0);\n var videoCodec = video[1 /* VideoCodecConfigurationTypes.CODEC_TYPE */][0];\n var videoParameters = tlv.decode(video[2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */]);\n var videoAttributes = tlv.decode(video[3 /* VideoCodecConfigurationTypes.ATTRIBUTES */]);\n var profile = videoParameters[1 /* VideoCodecParametersTypes.PROFILE_ID */][0];\n var level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];\n var videoBitrate = videoParameters[3 /* VideoCodecParametersTypes.BITRATE */].readInt32LE(0);\n var iFrameInterval = videoParameters[4 /* VideoCodecParametersTypes.IFRAME_INTERVAL */].readInt32LE(0);\n var width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readInt16LE(0);\n var height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readInt16LE(0);\n var framerate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */][0];\n var audioCodec = audio[1 /* AudioCodecConfigurationTypes.CODEC_TYPE */][0];\n var audioParameters = tlv.decode(audio[2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */]);\n var audioChannels = audioParameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];\n var samplerate = audioParameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];\n var audioBitrateMode = audioParameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];\n var audioBitrate = audioParameters[4 /* AudioCodecParametersTypes.MAX_AUDIO_BITRATE */].readUInt32LE(0);\n var typedEventTriggers = [];\n var bit_index = 0;\n while (eventTriggerOptions > 0) {\n if (eventTriggerOptions & 0x01) { // of the lowest bit is set add the next event trigger option\n typedEventTriggers.push(1 << bit_index);\n }\n eventTriggerOptions = eventTriggerOptions >> 1; // shift to right till we reach zero.\n bit_index += 1; // count our current bit index\n }\n return {\n prebufferLength: prebufferLength,\n eventTriggerTypes: typedEventTriggers,\n mediaContainerConfiguration: {\n type: containerType,\n fragmentLength: fragmentLength,\n },\n videoCodec: {\n type: videoCodec,\n parameters: {\n profile: profile,\n level: level,\n bitRate: videoBitrate,\n iFrameInterval: iFrameInterval,\n },\n resolution: [width, height, framerate],\n },\n audioCodec: {\n audioChannels: audioChannels,\n type: audioCodec,\n samplerate: samplerate,\n bitrateMode: audioBitrateMode,\n bitrate: audioBitrate,\n },\n };\n };\n RecordingManagement.prototype._supportedCameraRecordingConfiguration = function (options) {\n var mediaContainers = Array.isArray(options.mediaContainerConfiguration)\n ? options.mediaContainerConfiguration\n : [options.mediaContainerConfiguration];\n var prebufferLength = Buffer.alloc(4);\n var eventTriggerOptions = Buffer.alloc(8);\n prebufferLength.writeInt32LE(options.prebufferLength, 0);\n eventTriggerOptions.writeInt32LE(this.eventTriggerOptions, 0);\n return tlv.encode(1 /* SupportedCameraRecordingConfigurationTypes.PREBUFFER_LENGTH */, prebufferLength, 2 /* SupportedCameraRecordingConfigurationTypes.EVENT_TRIGGER_OPTIONS */, eventTriggerOptions, 3 /* SupportedCameraRecordingConfigurationTypes.MEDIA_CONTAINER_CONFIGURATIONS */, mediaContainers.map(function (config) {\n var fragmentLength = Buffer.alloc(4);\n fragmentLength.writeInt32LE(config.fragmentLength, 0);\n return tlv.encode(1 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_TYPE */, config.type, 2 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_PARAMETERS */, tlv.encode(1 /* MediaContainerParameterTypes.FRAGMENT_LENGTH */, fragmentLength));\n })).toString(\"base64\");\n };\n RecordingManagement.prototype._supportedVideoRecordingConfiguration = function (videoOptions) {\n if (!videoOptions.parameters) {\n throw new Error(\"Video parameters cannot be undefined\");\n }\n if (!videoOptions.resolutions) {\n throw new Error(\"Video resolutions cannot be undefined\");\n }\n var codecParameters = tlv.encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.parameters.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.parameters.levels);\n var videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, videoOptions.type, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(function (resolution) {\n if (resolution.length !== 3) {\n throw new Error(\"Unexpected video resolution\");\n }\n var width = Buffer.alloc(2);\n var height = Buffer.alloc(2);\n var frameRate = Buffer.alloc(1);\n width.writeUInt16LE(resolution[0], 0);\n height.writeUInt16LE(resolution[1], 0);\n frameRate.writeUInt8(resolution[2], 0);\n return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);\n }));\n return tlv.encode(1 /* SupportedVideoRecordingConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString(\"base64\");\n };\n RecordingManagement.prototype._supportedAudioStreamConfiguration = function (audioOptions) {\n var audioCodecs = Array.isArray(audioOptions.codecs)\n ? audioOptions.codecs\n : [audioOptions.codecs];\n if (audioCodecs.length === 0) {\n throw Error(\"CameraRecordingOptions.audio: At least one audio codec configuration must be specified!\");\n }\n var codecConfigurations = audioCodecs.map(function (codec) {\n var providedSamplerates = Array.isArray(codec.samplerate)\n ? codec.samplerate\n : [codec.samplerate];\n if (providedSamplerates.length === 0) {\n throw new Error(\"CameraRecordingOptions.audio.codecs: Audio samplerate cannot be empty!\");\n }\n var audioParameters = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrateMode || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);\n return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, codec.type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);\n });\n return tlv.encode(1 /* SupportedAudioRecordingConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations).toString(\"base64\");\n };\n RecordingManagement.prototype.computeConfigurationHash = function (algorithm) {\n if (algorithm === void 0) { algorithm = \"sha256\"; }\n var configurationHash = crypto_1.default.createHash(algorithm);\n configurationHash.update(this.supportedCameraRecordingConfiguration);\n configurationHash.update(this.supportedVideoRecordingConfiguration);\n configurationHash.update(this.supportedAudioRecordingConfiguration);\n return configurationHash.digest().toString(\"hex\");\n };\n /**\n * @private\n */\n RecordingManagement.prototype.serialize = function () {\n var _a;\n return {\n configurationHash: {\n algorithm: \"sha256\",\n hash: this.computeConfigurationHash(\"sha256\"),\n },\n selectedConfiguration: (_a = this.selectedConfiguration) === null || _a === void 0 ? void 0 : _a.base64,\n recordingActive: this.recordingActive,\n recordingAudioActive: !!this.recordingManagementService.getCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive).value,\n eventSnapshotsActive: !!this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive).value,\n homeKitCameraActive: !!this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive).value,\n periodicSnapshotsActive: !!this.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive).value,\n };\n };\n /**\n * @private\n */\n RecordingManagement.prototype.deserialize = function (serialized) {\n var e_3, _a;\n var _b;\n var changedState = false;\n // we only restore the `selectedConfiguration` if our supported configuration hasn't changed.\n var currentConfigurationHash = this.computeConfigurationHash(serialized.configurationHash.algorithm);\n if (serialized.selectedConfiguration) {\n if (currentConfigurationHash === serialized.configurationHash.hash) {\n this.selectedConfiguration = {\n base64: serialized.selectedConfiguration,\n parsed: this.parseSelectedConfiguration(serialized.selectedConfiguration),\n };\n }\n else {\n changedState = true;\n }\n }\n this.recordingActive = serialized.recordingActive;\n this.recordingManagementService.updateCharacteristic(Characteristic_1.Characteristic.Active, serialized.recordingActive);\n this.recordingManagementService.updateCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive, serialized.recordingAudioActive);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive, serialized.eventSnapshotsActive);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive, serialized.periodicSnapshotsActive);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive, serialized.homeKitCameraActive);\n try {\n for (var _c = tslib_1.__values(this.sensorServices), _d = _c.next(); !_d.done; _d = _c.next()) {\n var service = _d.value;\n service.setCharacteristic(Characteristic_1.Characteristic.StatusActive, serialized.homeKitCameraActive);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_3) throw e_3.error; }\n }\n try {\n if (this.selectedConfiguration) {\n this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed);\n }\n if (serialized.recordingActive) {\n this.delegate.updateRecordingActive(serialized.recordingActive);\n }\n }\n catch (error) {\n console.error(\"Failed to properly initialize CameraRecordingDelegate from persistent storage: \" + error.stack);\n }\n if (changedState) {\n (_b = this.stateChangeDelegate) === null || _b === void 0 ? void 0 : _b.call(this);\n }\n };\n /**\n * @private\n */\n RecordingManagement.prototype.setupStateChangeDelegate = function (delegate) {\n this.stateChangeDelegate = delegate;\n };\n RecordingManagement.prototype.destroy = function () {\n this.dataStreamManagement.destroy();\n };\n RecordingManagement.prototype.handleFactoryReset = function () {\n var e_4, _a;\n this.selectedConfiguration = undefined;\n this.recordingManagementService.updateCharacteristic(Characteristic_1.Characteristic.Active, false);\n this.recordingManagementService.updateCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive, false);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive, true);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive, true);\n this.operatingModeService.updateCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive, true);\n try {\n for (var _b = tslib_1.__values(this.sensorServices), _c = _b.next(); !_c.done; _c = _b.next()) {\n var service = _c.value;\n service.setCharacteristic(Characteristic_1.Characteristic.StatusActive, true);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n try {\n // notifying the delegate about the updated state\n this.delegate.updateRecordingActive(false);\n this.delegate.updateRecordingConfiguration(undefined);\n }\n catch (error) {\n console.error(\"CameraRecordingDelegate failed to update state after handleFactoryReset: \" + error.stack);\n }\n };\n return RecordingManagement;\n}());\nexports.RecordingManagement = RecordingManagement;\n/**\n * @group Camera\n */\nvar CameraRecordingStreamEvents;\n(function (CameraRecordingStreamEvents) {\n /**\n * This event is fired when the recording stream is closed.\n * Either due to a normal exit (e.g. the HomeKit Controller acknowledging the stream)\n * or due to an erroneous exit (e.g. HDS connection getting closed).\n */\n CameraRecordingStreamEvents[\"CLOSED\"] = \"closed\";\n})(CameraRecordingStreamEvents || (CameraRecordingStreamEvents = {}));\n/**\n * A `CameraRecordingStream` represents an ongoing stream request for a HomeKit Secure Video recording.\n * A single camera can only support one ongoing recording at a time.\n *\n * @group Camera\n */\nvar CameraRecordingStream = /** @class */ (function (_super) {\n tslib_1.__extends(CameraRecordingStream, _super);\n function CameraRecordingStream(connection, delegate, requestId, streamId) {\n var _a;\n var _this = _super.call(this) || this;\n _this.closed = false;\n _this.eventHandler = (_a = {},\n _a[\"close\" /* Topics.CLOSE */] = _this.handleDataSendClose.bind(_this),\n _a[\"ack\" /* Topics.ACK */] = _this.handleDataSendAck.bind(_this),\n _a);\n _this.requestHandler = undefined;\n _this.connection = connection;\n _this.delegate = delegate;\n _this.hdsRequestId = requestId;\n _this.streamId = streamId;\n _this.connection.on(\"closed\" /* DataStreamConnectionEvent.CLOSED */, _this.closeListener = _this.handleDataStreamConnectionClosed.bind(_this));\n _this.connection.addProtocolHandler(\"dataSend\" /* Protocols.DATA_SEND */, _this);\n return _this;\n }\n CameraRecordingStream.prototype.startStreaming = function () {\n // noinspection JSIgnoredPromiseFromCall\n this._startStreaming();\n };\n CameraRecordingStream.prototype._startStreaming = function () {\n var _a, e_5, _b, _c;\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var maxChunk, initialization, dataSequenceNumber, lastFragmentWasMarkedLast, _d, _e, _f, packet, fragment, offset, dataChunkSequenceNumber, data, event, e_5_1, error_1, closeReason;\n return tslib_1.__generator(this, function (_g) {\n switch (_g.label) {\n case 0:\n debug(\"[HDS %s] Sending DATA_SEND OPEN response for streamId %d\", this.connection.remoteAddress, this.streamId);\n this.connection.sendResponse(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, this.hdsRequestId, datastream_1.HDSStatus.SUCCESS, {\n status: datastream_1.HDSStatus.SUCCESS,\n });\n maxChunk = 0x40000;\n initialization = true;\n dataSequenceNumber = 1;\n lastFragmentWasMarkedLast = false;\n _g.label = 1;\n case 1:\n _g.trys.push([1, 14, 15, 16]);\n this.generator = this.delegate.handleRecordingStreamRequest(this.streamId);\n _g.label = 2;\n case 2:\n _g.trys.push([2, 7, 8, 13]);\n _d = true, _e = tslib_1.__asyncValues(this.generator);\n _g.label = 3;\n case 3: return [4 /*yield*/, _e.next()];\n case 4:\n if (!(_f = _g.sent(), _a = _f.done, !_a)) return [3 /*break*/, 6];\n _c = _f.value;\n _d = false;\n try {\n packet = _c;\n if (this.closed) {\n console.error(\"[HDS \".concat(this.connection.remoteAddress, \"] Delegate yielded fragment after stream \").concat(this.streamId, \" was already closed!\"));\n return [3 /*break*/, 6];\n }\n if (lastFragmentWasMarkedLast) {\n console.error(\"[HDS \".concat(this.connection.remoteAddress, \"] Delegate yielded fragment for stream \").concat(this.streamId, \" after already signaling end of stream!\"));\n return [3 /*break*/, 6];\n }\n fragment = packet.data;\n offset = 0;\n dataChunkSequenceNumber = 1;\n while (offset < fragment.length) {\n data = fragment.slice(offset, offset + maxChunk);\n offset += data.length;\n event = {\n streamId: this.streamId,\n packets: [{\n data: data,\n metadata: {\n dataType: initialization ? \"mediaInitialization\" /* PacketDataType.MEDIA_INITIALIZATION */ : \"mediaFragment\" /* PacketDataType.MEDIA_FRAGMENT */,\n dataSequenceNumber: dataSequenceNumber,\n dataChunkSequenceNumber: dataChunkSequenceNumber,\n isLastDataChunk: offset >= fragment.length,\n dataTotalSize: dataChunkSequenceNumber === 1 ? fragment.length : undefined,\n },\n }],\n endOfStream: offset >= fragment.length ? Boolean(packet.isLast).valueOf() : undefined,\n };\n debug(\"[HDS %s] Sending DATA_SEND DATA for stream %d with metadata: %o and length %d; EoS: %s\", this.connection.remoteAddress, this.streamId, event.packets[0].metadata, data.length, event.endOfStream);\n this.connection.sendEvent(\"dataSend\" /* Protocols.DATA_SEND */, \"data\" /* Topics.DATA */, event);\n dataChunkSequenceNumber++;\n initialization = false;\n }\n lastFragmentWasMarkedLast = packet.isLast;\n if (packet.isLast) {\n return [3 /*break*/, 6];\n }\n dataSequenceNumber++;\n }\n finally {\n _d = true;\n }\n _g.label = 5;\n case 5: return [3 /*break*/, 3];\n case 6: return [3 /*break*/, 13];\n case 7:\n e_5_1 = _g.sent();\n e_5 = { error: e_5_1 };\n return [3 /*break*/, 13];\n case 8:\n _g.trys.push([8, , 11, 12]);\n if (!(!_d && !_a && (_b = _e.return))) return [3 /*break*/, 10];\n return [4 /*yield*/, _b.call(_e)];\n case 9:\n _g.sent();\n _g.label = 10;\n case 10: return [3 /*break*/, 12];\n case 11:\n if (e_5) throw e_5.error;\n return [7 /*endfinally*/];\n case 12: return [7 /*endfinally*/];\n case 13:\n if (!lastFragmentWasMarkedLast && !this.closed) {\n // Delegate violates the contract. Exited normally on a non-closed stream without properly setting `isLast`.\n console.warn(\"[HDS \".concat(this.connection.remoteAddress, \"] Delegate finished streaming for \").concat(this.streamId, \" without setting RecordingPacket.isLast. Can't notify Controller about endOfStream!\"));\n }\n return [3 /*break*/, 16];\n case 14:\n error_1 = _g.sent();\n if (this.closed) {\n console.warn(\"[HDS \".concat(this.connection.remoteAddress, \"] Encountered unexpected error on already closed recording stream \").concat(this.streamId, \": \").concat(error_1.stack));\n }\n else {\n closeReason = 5 /* HDSProtocolSpecificErrorReason.UNEXPECTED_FAILURE */;\n if (error_1 instanceof datastream_1.HDSProtocolError) {\n closeReason = error_1.reason;\n debug(\"[HDS %s] Delegate signaled to close the recording stream %d.\", this.connection.remoteAddress, this.streamId);\n }\n else if (error_1 instanceof datastream_1.HDSConnectionError && error_1.type === 2 /* HDSConnectionErrorType.CLOSED_SOCKET */) {\n // we are probably on a shutdown or just late. Connection is dead. End the stream!\n debug(\"[HDS %s] Exited recording stream due to closed HDS socket: stream id %d.\", this.connection.remoteAddress, this.streamId);\n return [2 /*return*/]; // execute finally and then exit (we want to skip the `sendEvent` below)\n }\n else {\n console.error(\"[HDS \".concat(this.connection.remoteAddress, \"] Encountered unexpected error for recording stream \").concat(this.streamId, \": \").concat(error_1.stack));\n }\n // call close to go through standard close routine!\n this.close(closeReason);\n }\n return [2 /*return*/];\n case 15:\n this.generator = undefined;\n if (this.generatorTimeout) {\n clearTimeout(this.generatorTimeout);\n }\n if (!this.closed) {\n // e.g. when returning with `endOfStream` we rely on the HomeHub to send an ACK event to close the recording.\n // With this timer we ensure that the HomeHub has the chance to close the stream gracefully but at the same time\n // ensure that if something fails the recording stream is freed nonetheless.\n this.kickOffCloseTimeout();\n }\n return [7 /*endfinally*/];\n case 16:\n if (initialization) { // we never actually sent anything out there!\n console.warn(\"[HDS \".concat(this.connection.remoteAddress, \"] Delegate finished recording stream \").concat(this.streamId, \" without sending anything out. Controller will CANCEL.\"));\n }\n debug(\"[HDS %s] Finished DATA_SEND transmission for stream %d!\", this.connection.remoteAddress, this.streamId);\n return [2 /*return*/];\n }\n });\n });\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n CameraRecordingStream.prototype.handleDataSendAck = function (message) {\n var _this = this;\n var streamId = message.streamId;\n var endOfStream = message.endOfStream;\n // The HomeKit Controller will send a DATA_SEND ACK if we set the `endOfStream` flag in the last packet\n // of our DATA_SEND DATA packet.\n // To my testing the session is then considered complete and the HomeKit controller will close the HDS Connection after 5 seconds.\n debug(\"[HDS %s] Received DATA_SEND ACK packet for streamId %s. Acknowledged %s.\", this.connection.remoteAddress, streamId, endOfStream);\n this.handleClosed(function () { var _a, _b; return (_b = (_a = _this.delegate).acknowledgeStream) === null || _b === void 0 ? void 0 : _b.call(_a, _this.streamId); });\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n CameraRecordingStream.prototype.handleDataSendClose = function (message) {\n var _this = this;\n // see https://github.com/Supereg/secure-video-specification#43-close\n var streamId = message.streamId;\n var reason = message.reason;\n if (streamId !== this.streamId) {\n return;\n }\n debug(\"[HDS %s] Received DATA_SEND CLOSE for streamId %d with reason %s\", \n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n this.connection.remoteAddress, streamId, datastream_1.HDSProtocolSpecificErrorReason[reason]);\n this.handleClosed(function () { return _this.delegate.closeRecordingStream(streamId, reason); });\n };\n CameraRecordingStream.prototype.handleDataStreamConnectionClosed = function () {\n var _this = this;\n debug(\"[HDS %s] The HDS connection of the stream %d closed.\", this.connection.remoteAddress, this.streamId);\n this.handleClosed(function () { return _this.delegate.closeRecordingStream(_this.streamId, undefined); });\n };\n CameraRecordingStream.prototype.handleClosed = function (closure) {\n var _this = this;\n this.closed = true;\n if (this.closingTimeout) {\n clearTimeout(this.closingTimeout);\n this.closingTimeout = undefined;\n }\n this.connection.removeProtocolHandler(\"dataSend\" /* Protocols.DATA_SEND */, this);\n this.connection.removeListener(\"closed\" /* DataStreamConnectionEvent.CLOSED */, this.closeListener);\n if (this.generator) {\n // when this variable is defined, the generator hasn't returned yet.\n // we start a timeout to uncover potential programming mistakes where we await forever and can't free resources.\n this.generatorTimeout = setTimeout(function () {\n console.error(\"[HDS %s] Recording download stream %d is still awaiting generator although stream was closed 10s ago! \" +\n \"This is a programming mistake by the camera implementation which prevents freeing up resources.\", _this.connection.remoteAddress, _this.streamId);\n }, 10000);\n }\n try {\n closure();\n }\n catch (error) {\n console.error(\"[HDS \".concat(this.connection.remoteAddress, \"] CameraRecordingDelegated failed to handle closing the stream \").concat(this.streamId, \": \").concat(error.stack));\n }\n this.emit(\"closed\" /* CameraRecordingStreamEvents.CLOSED */);\n };\n /**\n * This method can be used to close a recording session from the outside.\n * @param reason - The reason to close the stream with.\n */\n CameraRecordingStream.prototype.close = function (reason) {\n var _this = this;\n if (this.closed) {\n return;\n }\n debug(\"[HDS %s] Recording stream %d was closed manually with reason %s.\", \n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n this.connection.remoteAddress, this.streamId, reason ? datastream_1.HDSProtocolSpecificErrorReason[reason] : \"CLOSED\");\n // the `isConsideredClosed` check just ensures that the won't ever throw here and that `handledClosed` is always executed.\n if (!this.connection.isConsideredClosed()) {\n this.connection.sendEvent(\"dataSend\" /* Protocols.DATA_SEND */, \"close\" /* Topics.CLOSE */, {\n streamId: this.streamId,\n reason: reason,\n });\n }\n this.handleClosed(function () { return _this.delegate.closeRecordingStream(_this.streamId, reason); });\n };\n CameraRecordingStream.prototype.kickOffCloseTimeout = function () {\n var _this = this;\n if (this.closingTimeout) {\n clearTimeout(this.closingTimeout);\n }\n this.closingTimeout = setTimeout(function () {\n if (_this.closed) {\n return;\n }\n debug(\"[HDS %s] Recording stream %d took longer than expected to fully close. Force closing now!\", _this.connection.remoteAddress, _this.streamId);\n _this.close(3 /* HDSProtocolSpecificErrorReason.CANCELLED */);\n }, 12000);\n };\n return CameraRecordingStream;\n}(events_1.EventEmitter));\n//# sourceMappingURL=RecordingManagement.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./Camera\"), exports);\ntslib_1.__exportStar(require(\"./RTPProxy\"), exports);\ntslib_1.__exportStar(require(\"./RTPStreamManagement\"), exports);\ntslib_1.__exportStar(require(\"./RecordingManagement\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AdaptiveLightingController = exports.AdaptiveLightingControllerEvents = exports.AdaptiveLightingControllerMode = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar color_utils_1 = require(\"../util/color-utils\");\nvar hapStatusError_1 = require(\"../util/hapStatusError\");\nvar time_1 = require(\"../util/time\");\nvar uuid = tslib_1.__importStar(require(\"../util/uuid\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Controller:TransitionControl\");\nvar SupportedCharacteristicValueTransitionConfigurationsTypes;\n(function (SupportedCharacteristicValueTransitionConfigurationsTypes) {\n SupportedCharacteristicValueTransitionConfigurationsTypes[SupportedCharacteristicValueTransitionConfigurationsTypes[\"SUPPORTED_TRANSITION_CONFIGURATION\"] = 1] = \"SUPPORTED_TRANSITION_CONFIGURATION\";\n})(SupportedCharacteristicValueTransitionConfigurationsTypes || (SupportedCharacteristicValueTransitionConfigurationsTypes = {}));\nvar SupportedValueTransitionConfigurationTypes;\n(function (SupportedValueTransitionConfigurationTypes) {\n SupportedValueTransitionConfigurationTypes[SupportedValueTransitionConfigurationTypes[\"CHARACTERISTIC_IID\"] = 1] = \"CHARACTERISTIC_IID\";\n SupportedValueTransitionConfigurationTypes[SupportedValueTransitionConfigurationTypes[\"TRANSITION_TYPE\"] = 2] = \"TRANSITION_TYPE\";\n})(SupportedValueTransitionConfigurationTypes || (SupportedValueTransitionConfigurationTypes = {}));\nvar TransitionType;\n(function (TransitionType) {\n TransitionType[TransitionType[\"BRIGHTNESS\"] = 1] = \"BRIGHTNESS\";\n TransitionType[TransitionType[\"COLOR_TEMPERATURE\"] = 2] = \"COLOR_TEMPERATURE\";\n})(TransitionType || (TransitionType = {}));\nvar TransitionControlTypes;\n(function (TransitionControlTypes) {\n TransitionControlTypes[TransitionControlTypes[\"READ_CURRENT_VALUE_TRANSITION_CONFIGURATION\"] = 1] = \"READ_CURRENT_VALUE_TRANSITION_CONFIGURATION\";\n TransitionControlTypes[TransitionControlTypes[\"UPDATE_VALUE_TRANSITION_CONFIGURATION\"] = 2] = \"UPDATE_VALUE_TRANSITION_CONFIGURATION\";\n})(TransitionControlTypes || (TransitionControlTypes = {}));\nvar ReadValueTransitionConfiguration;\n(function (ReadValueTransitionConfiguration) {\n ReadValueTransitionConfiguration[ReadValueTransitionConfiguration[\"CHARACTERISTIC_IID\"] = 1] = \"CHARACTERISTIC_IID\";\n})(ReadValueTransitionConfiguration || (ReadValueTransitionConfiguration = {}));\nvar UpdateValueTransitionConfigurationsTypes;\n(function (UpdateValueTransitionConfigurationsTypes) {\n UpdateValueTransitionConfigurationsTypes[UpdateValueTransitionConfigurationsTypes[\"VALUE_TRANSITION_CONFIGURATION\"] = 1] = \"VALUE_TRANSITION_CONFIGURATION\";\n})(UpdateValueTransitionConfigurationsTypes || (UpdateValueTransitionConfigurationsTypes = {}));\nvar ValueTransitionConfigurationTypes;\n(function (ValueTransitionConfigurationTypes) {\n // noinspection JSUnusedGlobalSymbols\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"CHARACTERISTIC_IID\"] = 1] = \"CHARACTERISTIC_IID\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"TRANSITION_PARAMETERS\"] = 2] = \"TRANSITION_PARAMETERS\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"UNKNOWN_3\"] = 3] = \"UNKNOWN_3\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"UNKNOWN_4\"] = 4] = \"UNKNOWN_4\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"TRANSITION_CURVE_CONFIGURATION\"] = 5] = \"TRANSITION_CURVE_CONFIGURATION\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"UPDATE_INTERVAL\"] = 6] = \"UPDATE_INTERVAL\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"UNKNOWN_7\"] = 7] = \"UNKNOWN_7\";\n ValueTransitionConfigurationTypes[ValueTransitionConfigurationTypes[\"NOTIFY_INTERVAL_THRESHOLD\"] = 8] = \"NOTIFY_INTERVAL_THRESHOLD\";\n})(ValueTransitionConfigurationTypes || (ValueTransitionConfigurationTypes = {}));\nvar ValueTransitionParametersTypes;\n(function (ValueTransitionParametersTypes) {\n ValueTransitionParametersTypes[ValueTransitionParametersTypes[\"TRANSITION_ID\"] = 1] = \"TRANSITION_ID\";\n ValueTransitionParametersTypes[ValueTransitionParametersTypes[\"START_TIME\"] = 2] = \"START_TIME\";\n ValueTransitionParametersTypes[ValueTransitionParametersTypes[\"UNKNOWN_3\"] = 3] = \"UNKNOWN_3\";\n})(ValueTransitionParametersTypes || (ValueTransitionParametersTypes = {}));\nvar TransitionCurveConfigurationTypes;\n(function (TransitionCurveConfigurationTypes) {\n TransitionCurveConfigurationTypes[TransitionCurveConfigurationTypes[\"TRANSITION_ENTRY\"] = 1] = \"TRANSITION_ENTRY\";\n TransitionCurveConfigurationTypes[TransitionCurveConfigurationTypes[\"ADJUSTMENT_CHARACTERISTIC_IID\"] = 2] = \"ADJUSTMENT_CHARACTERISTIC_IID\";\n TransitionCurveConfigurationTypes[TransitionCurveConfigurationTypes[\"ADJUSTMENT_MULTIPLIER_RANGE\"] = 3] = \"ADJUSTMENT_MULTIPLIER_RANGE\";\n})(TransitionCurveConfigurationTypes || (TransitionCurveConfigurationTypes = {}));\nvar TransitionEntryTypes;\n(function (TransitionEntryTypes) {\n TransitionEntryTypes[TransitionEntryTypes[\"ADJUSTMENT_FACTOR\"] = 1] = \"ADJUSTMENT_FACTOR\";\n TransitionEntryTypes[TransitionEntryTypes[\"VALUE\"] = 2] = \"VALUE\";\n TransitionEntryTypes[TransitionEntryTypes[\"TRANSITION_OFFSET\"] = 3] = \"TRANSITION_OFFSET\";\n TransitionEntryTypes[TransitionEntryTypes[\"DURATION\"] = 4] = \"DURATION\";\n})(TransitionEntryTypes || (TransitionEntryTypes = {}));\nvar TransitionAdjustmentMultiplierRange;\n(function (TransitionAdjustmentMultiplierRange) {\n TransitionAdjustmentMultiplierRange[TransitionAdjustmentMultiplierRange[\"MINIMUM_ADJUSTMENT_MULTIPLIER\"] = 1] = \"MINIMUM_ADJUSTMENT_MULTIPLIER\";\n TransitionAdjustmentMultiplierRange[TransitionAdjustmentMultiplierRange[\"MAXIMUM_ADJUSTMENT_MULTIPLIER\"] = 2] = \"MAXIMUM_ADJUSTMENT_MULTIPLIER\";\n})(TransitionAdjustmentMultiplierRange || (TransitionAdjustmentMultiplierRange = {}));\nvar ValueTransitionConfigurationResponseTypes;\n(function (ValueTransitionConfigurationResponseTypes) {\n ValueTransitionConfigurationResponseTypes[ValueTransitionConfigurationResponseTypes[\"VALUE_CONFIGURATION_STATUS\"] = 1] = \"VALUE_CONFIGURATION_STATUS\";\n})(ValueTransitionConfigurationResponseTypes || (ValueTransitionConfigurationResponseTypes = {}));\nvar ValueTransitionConfigurationStatusTypes;\n(function (ValueTransitionConfigurationStatusTypes) {\n ValueTransitionConfigurationStatusTypes[ValueTransitionConfigurationStatusTypes[\"CHARACTERISTIC_IID\"] = 1] = \"CHARACTERISTIC_IID\";\n ValueTransitionConfigurationStatusTypes[ValueTransitionConfigurationStatusTypes[\"TRANSITION_PARAMETERS\"] = 2] = \"TRANSITION_PARAMETERS\";\n ValueTransitionConfigurationStatusTypes[ValueTransitionConfigurationStatusTypes[\"TIME_SINCE_START\"] = 3] = \"TIME_SINCE_START\";\n})(ValueTransitionConfigurationStatusTypes || (ValueTransitionConfigurationStatusTypes = {}));\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isAdaptiveLightingContext(context) {\n return context && \"controller\" in context;\n}\n/**\n * Defines in which mode the {@link AdaptiveLightingController} will operate in.\n * @group Adaptive Lighting\n */\nvar AdaptiveLightingControllerMode;\n(function (AdaptiveLightingControllerMode) {\n /**\n * In automatic mode pretty much everything from setup to transition scheduling is done by the controller.\n */\n AdaptiveLightingControllerMode[AdaptiveLightingControllerMode[\"AUTOMATIC\"] = 1] = \"AUTOMATIC\";\n /**\n * In manual mode setup is done by the controller but the actual transition must be done by the user.\n * This is useful for lights which natively support transitions.\n */\n AdaptiveLightingControllerMode[AdaptiveLightingControllerMode[\"MANUAL\"] = 2] = \"MANUAL\";\n})(AdaptiveLightingControllerMode = exports.AdaptiveLightingControllerMode || (exports.AdaptiveLightingControllerMode = {}));\n/**\n * @group Adaptive Lighting\n */\nvar AdaptiveLightingControllerEvents;\n(function (AdaptiveLightingControllerEvents) {\n /**\n * This event is called once a HomeKit controller enables Adaptive Lighting\n * or a HomeHub sends a updated transition schedule for the next 24 hours.\n * This is also called on startup when AdaptiveLighting was previously enabled.\n */\n AdaptiveLightingControllerEvents[\"UPDATE\"] = \"update\";\n /**\n * In yet unknown circumstances HomeKit may also send a dedicated disable command\n * via the control point characteristic. You may want to handle that in manual mode as well.\n * The current transition will still be associated with the controller object when this event is called.\n */\n AdaptiveLightingControllerEvents[\"DISABLED\"] = \"disable\";\n})(AdaptiveLightingControllerEvents = exports.AdaptiveLightingControllerEvents || (exports.AdaptiveLightingControllerEvents = {}));\n/**\n * This class allows adding Adaptive Lighting support to Lightbulb services.\n * The Lightbulb service MUST have the {@link Characteristic.ColorTemperature} characteristic AND\n * the {@link Characteristic.Brightness} characteristic added.\n * The light may also expose {@link Characteristic.Hue} and {@link Characteristic.Saturation} characteristics\n * (though additional work is required to keep them in sync with the color temperature characteristic. see below)\n *\n * How Adaptive Lighting works:\n * When enabling AdaptiveLighting the iDevice will send a transition schedule for the next 24 hours.\n * This schedule will be renewed all 24 hours by a HomeHub in your home\n * (updating the schedule according to your current day/night situation).\n * Once enabled the lightbulb will execute the provided transitions. The color temperature value set is always\n * dependent on the current brightness value. Meaning brighter light will be colder and darker light will be warmer.\n * HomeKit considers Adaptive Lighting to be disabled as soon a write happens to either the\n * Hue/Saturation or the ColorTemperature characteristics.\n * The AdaptiveLighting state must persist across reboots.\n *\n * The AdaptiveLightingController can be operated in two modes: {@link AdaptiveLightingControllerMode.AUTOMATIC} and\n * {@link AdaptiveLightingControllerMode.MANUAL} with AUTOMATIC being the default.\n * The goal would be that the color transition is done DIRECTLY on the light itself, thus not creating any\n * additional/heavy traffic on the network.\n * So if your light hardware/API supports transitions please go the extra mile and use MANUAL mode.\n *\n *\n *\n * Below is an overview what you need to or consider when enabling AdaptiveLighting (categorized by mode).\n * The {@link AdaptiveLightingControllerMode} can be defined with the second constructor argument.\n *\n * AUTOMATIC (Default mode):\n *\n * This is the easiest mode to setup and needs less to no work form your side for AdaptiveLighting to work.\n * The AdaptiveLightingController will go through setup procedure with HomeKit and automatically update\n * the color temperature characteristic base on the current transition schedule.\n * It is also adjusting the color temperature when a write to the brightness characteristic happens.\n * Additionally, it will also handle turning off AdaptiveLighting, when it detects a write happening to the\n * ColorTemperature, Hue or Saturation characteristic (though it can only detect writes coming from HomeKit and\n * can't detect changes done to the physical devices directly! See below).\n *\n * So what do you need to consider in automatic mode:\n * - Brightness and ColorTemperature characteristics MUST be set up. Hue and Saturation may be added for color support.\n * - Color temperature will be updated all 60 seconds by calling the SET handler of the ColorTemperature characteristic.\n * So every transition behaves like a regular write to the ColorTemperature characteristic.\n * - Every transition step is dependent on the current brightness value. Try to keep the internal cache updated\n * as the controller won't call the GET handler every 60 seconds.\n * (The cached brightness value is updated on SET/GET operations or by manually calling {@link Characteristic.updateValue}\n * on the brightness characteristic).\n * - Detecting changes on the lightbulb side:\n * Any manual change to ColorTemperature or Hue/Saturation is considered as a signal to turn AdaptiveLighting off.\n * In order to notify the AdaptiveLightingController of such an event happening OUTSIDE of HomeKit\n * you must call {@link disableAdaptiveLighting} manually!\n * - Be aware that even when the light is turned off the transition will continue to call the SET handler\n * of the ColorTemperature characteristic.\n * - When using Hue/Saturation:\n * When using Hue/Saturation in combination with the ColorTemperature characteristic you need to update the\n * respective other in a particular way depending on if being in \"color mode\" or \"color temperature mode\".\n * When a write happens to Hue/Saturation characteristic in is advised to set the internal value of the\n * ColorTemperature to the minimal (NOT RAISING an event).\n * When a write happens to the ColorTemperature characteristic just MUST convert to a proper representation\n * in hue and saturation values, with RAISING an event.\n * As noted above you MUST NOT call the {@link Characteristic.setValue} method for this, as this will be considered\n * a write to the characteristic and will turn off AdaptiveLighting. Instead, you should use\n * {@link Characteristic.updateValue} for this.\n * You can and SHOULD use the supplied utility method {@link ColorUtils.colorTemperatureToHueAndSaturation}\n * for converting mired to hue and saturation values.\n *\n *\n * MANUAL mode:\n *\n * Manual mode is recommended for any accessories which support transitions natively on the devices end.\n * Like for example ZigBee lights which support sending transitions directly to the lightbulb which\n * then get executed ON the lightbulb itself reducing unnecessary network traffic.\n * Here is a quick overview what you have to consider to successfully implement AdaptiveLighting support.\n * The AdaptiveLightingController will also in manual mode do all the setup procedure.\n * It will also save the transition schedule to disk to keep AdaptiveLighting enabled across reboots.\n * The \"only\" thing you have to do yourself is handling the actual transitions, check that event notifications\n * are only sent in the defined interval threshold, adjust the color temperature when brightness is changed\n * and signal that Adaptive Lighting should be disabled if ColorTemperature, Hue or Saturation is changed manually.\n *\n * First step is to setup up an event handler for the {@link AdaptiveLightingControllerEvents.UPDATE}, which is called\n * when AdaptiveLighting is enabled, the HomeHub updates the schedule for the next 24 hours or AdaptiveLighting\n * is restored from disk on startup.\n * In the event handler you can get the current schedule via {@link AdaptiveLightingController.getAdaptiveLightingTransitionCurve},\n * retrieve current intervals like {@link AdaptiveLightingController.getAdaptiveLightingUpdateInterval} or\n * {@link AdaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold} and get the date in epoch millis\n * when the current transition curve started using {@link AdaptiveLightingController.getAdaptiveLightingStartTimeOfTransition}.\n * Additionally {@link AdaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange} can be used\n * to get the valid range for the brightness value to calculate the brightness adjustment factor.\n * The method {@link AdaptiveLightingController.isAdaptiveLightingActive} can be used to check if AdaptiveLighting is enabled.\n * Besides, actually running the transition (see {@link AdaptiveLightingTransitionCurveEntry}) you must correctly update\n * the color temperature when the brightness of the lightbulb changes (see {@link AdaptiveLightingTransitionCurveEntry.brightnessAdjustmentFactor}),\n * and signal when AdaptiveLighting got disabled by calling {@link AdaptiveLightingController.disableAdaptiveLighting}\n * when ColorTemperature, Hue or Saturation where changed manually.\n * Lastly you should set up a event handler for the {@link AdaptiveLightingControllerEvents.DISABLED} event.\n * In yet unknown circumstances HomeKit may also send a dedicated disable command via the control point characteristic.\n * Be prepared to handle that.\n *\n * @group Adaptive Lighting\n */\nvar AdaptiveLightingController = /** @class */ (function (_super) {\n tslib_1.__extends(AdaptiveLightingController, _super);\n /**\n * Creates a new instance of the AdaptiveLightingController.\n * Refer to the {@link AdaptiveLightingController} documentation on how to use it.\n *\n * @param service - The lightbulb to which Adaptive Lighting support should be added.\n * @param options - Optional options to define the operating mode (automatic vs manual).\n */\n function AdaptiveLightingController(service, options) {\n var _this = this;\n var _a, _b;\n _this = _super.call(this) || this;\n _this.didRunFirstInitializationStep = false;\n _this.lastEventNotificationSent = 0;\n _this.lastNotifiedTemperatureValue = 0;\n _this.lastNotifiedSaturationValue = 0;\n _this.lastNotifiedHueValue = 0;\n _this.lightbulb = service;\n _this.mode = (_a = options === null || options === void 0 ? void 0 : options.controllerMode) !== null && _a !== void 0 ? _a : 1 /* AdaptiveLightingControllerMode.AUTOMATIC */;\n _this.customTemperatureAdjustment = (_b = options === null || options === void 0 ? void 0 : options.customTemperatureAdjustment) !== null && _b !== void 0 ? _b : 0;\n (0, assert_1.default)(_this.lightbulb.testCharacteristic(Characteristic_1.Characteristic.ColorTemperature), \"Lightbulb must have the ColorTemperature characteristic added!\");\n (0, assert_1.default)(_this.lightbulb.testCharacteristic(Characteristic_1.Characteristic.Brightness), \"Lightbulb must have the Brightness characteristic added!\");\n _this.adjustmentFactorChangedListener = _this.handleAdjustmentFactorChanged.bind(_this);\n _this.characteristicManualWrittenChangeListener = _this.handleCharacteristicManualWritten.bind(_this);\n return _this;\n }\n /**\n * @private\n */\n AdaptiveLightingController.prototype.controllerId = function () {\n return \"characteristic-transition\" /* DefaultControllerType.CHARACTERISTIC_TRANSITION */ + \"-\" + this.lightbulb.getServiceId();\n };\n // ----------- PUBLIC API START -----------\n /**\n * Returns if a Adaptive Lighting transition is currently active.\n */\n AdaptiveLightingController.prototype.isAdaptiveLightingActive = function () {\n return !!this.activeTransition;\n };\n /**\n * This method can be called to manually disable the current active Adaptive Lighting transition.\n * When using {@link AdaptiveLightingControllerMode.AUTOMATIC} you won't need to call this method.\n * In {@link AdaptiveLightingControllerMode.MANUAL} you must call this method when Adaptive Lighting should be disabled.\n * This is the case when the user manually changes the value of Hue, Saturation or ColorTemperature characteristics\n * (or if any of those values is changed by physical interaction with the lightbulb).\n */\n AdaptiveLightingController.prototype.disableAdaptiveLighting = function () {\n var _a;\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = undefined;\n }\n if (this.activeTransition) {\n this.colorTemperatureCharacteristic.removeListener(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n this.brightnessCharacteristic.removeListener(\"change\" /* CharacteristicEventTypes.CHANGE */, this.adjustmentFactorChangedListener);\n if (this.hueCharacteristic) {\n this.hueCharacteristic.removeListener(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n }\n if (this.saturationCharacteristic) {\n this.saturationCharacteristic.removeListener(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n }\n this.activeTransition = undefined;\n (_a = this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n this.colorTemperatureCharacteristic = undefined;\n this.brightnessCharacteristic = undefined;\n this.hueCharacteristic = undefined;\n this.saturationCharacteristic = undefined;\n this.lastTransitionPointInfo = undefined;\n this.lastEventNotificationSent = 0;\n this.lastNotifiedTemperatureValue = 0;\n this.lastNotifiedSaturationValue = 0;\n this.lastNotifiedHueValue = 0;\n this.didRunFirstInitializationStep = false;\n this.activeTransitionCount.sendEventNotification(0);\n debug(\"[%s] Disabling adaptive lighting\", this.lightbulb.displayName);\n };\n /**\n * Returns the time where the current transition curve was started in epoch time millis.\n * A transition curves is active for 24 hours typically and is renewed every 24 hours by a HomeHub.\n * Additionally see {@link getAdaptiveLightingTimeOffset}.\n */\n AdaptiveLightingController.prototype.getAdaptiveLightingStartTimeOfTransition = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.transitionStartMillis;\n };\n /**\n * It is not necessarily given, that we have the same time (or rather the correct time) as the HomeKit controller\n * who set up the transition schedule.\n * Thus we record the delta between our current time and the the time send with the setup request.\n * timeOffset is defined as Date.now() - getAdaptiveLightingStartTimeOfTransition();.\n * So in the case were we actually have a correct local time, it most likely will be positive (due to network latency).\n * But of course it can also be negative.\n */\n AdaptiveLightingController.prototype.getAdaptiveLightingTimeOffset = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.timeMillisOffset;\n };\n AdaptiveLightingController.prototype.getAdaptiveLightingTransitionCurve = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.transitionCurve;\n };\n AdaptiveLightingController.prototype.getAdaptiveLightingBrightnessMultiplierRange = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.brightnessAdjustmentRange;\n };\n /**\n * This method returns the interval (in milliseconds) in which the light should update its internal color temperature\n * (aka changes it physical color).\n * A lightbulb should ideally change this also when turned of in oder to have a smooth transition when turning the light on.\n *\n * Typically this evaluates to 60000 milliseconds (60 seconds).\n */\n AdaptiveLightingController.prototype.getAdaptiveLightingUpdateInterval = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.updateInterval;\n };\n /**\n * Returns the minimum interval threshold (in milliseconds) a accessory may notify HomeKit controllers about a new\n * color temperature value via event notifications (what happens when you call {@link Characteristic.updateValue}).\n * Meaning the accessory should only send event notifications to subscribed HomeKit controllers at the specified interval.\n *\n * Typically this evaluates to 600000 milliseconds (10 minutes).\n */\n AdaptiveLightingController.prototype.getAdaptiveLightingNotifyIntervalThreshold = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n return this.activeTransition.notifyIntervalThreshold;\n };\n // ----------- PUBLIC API END -----------\n AdaptiveLightingController.prototype.handleActiveTransitionUpdated = function (calledFromDeserializer) {\n var _a;\n if (calledFromDeserializer === void 0) { calledFromDeserializer = false; }\n if (!calledFromDeserializer) {\n this.activeTransitionCount.sendEventNotification(1);\n }\n else {\n this.activeTransitionCount.value = 1;\n }\n if (this.mode === 1 /* AdaptiveLightingControllerMode.AUTOMATIC */) {\n this.scheduleNextUpdate();\n }\n else if (this.mode === 2 /* AdaptiveLightingControllerMode.MANUAL */) {\n this.emit(\"update\" /* AdaptiveLightingControllerEvents.UPDATE */);\n }\n else {\n throw new Error(\"Unsupported adaptive lighting controller mode: \" + this.mode);\n }\n if (!calledFromDeserializer) {\n (_a = this.stateChangeDelegate) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n };\n AdaptiveLightingController.prototype.handleAdaptiveLightingEnabled = function () {\n if (!this.activeTransition) {\n throw new Error(\"There is no active transition!\");\n }\n this.colorTemperatureCharacteristic = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.ColorTemperature);\n this.brightnessCharacteristic = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.Brightness);\n this.colorTemperatureCharacteristic.on(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n this.brightnessCharacteristic.on(\"change\" /* CharacteristicEventTypes.CHANGE */, this.adjustmentFactorChangedListener);\n if (this.lightbulb.testCharacteristic(Characteristic_1.Characteristic.Hue)) {\n this.hueCharacteristic = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.Hue)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n }\n if (this.lightbulb.testCharacteristic(Characteristic_1.Characteristic.Saturation)) {\n this.saturationCharacteristic = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.Saturation)\n .on(\"change\" /* CharacteristicEventTypes.CHANGE */, this.characteristicManualWrittenChangeListener);\n }\n };\n AdaptiveLightingController.prototype.handleAdaptiveLightingDisabled = function () {\n if (this.mode === 2 /* AdaptiveLightingControllerMode.MANUAL */ && this.activeTransition) { // only emit the event if a transition is actually enabled\n this.emit(\"disable\" /* AdaptiveLightingControllerEvents.DISABLED */);\n }\n this.disableAdaptiveLighting();\n };\n AdaptiveLightingController.prototype.handleAdjustmentFactorChanged = function (change) {\n var _this = this;\n if (change.newValue === change.oldValue) {\n return;\n }\n // consider the following scenario:\n // a HomeKit controller queries the light (meaning e.g. Brightness, Hue and Saturation characteristics).\n // As of the implementation of the light the brightness characteristic get handler returns first\n // (and returns a value different than the cached value).\n // This change handler gets called and we will update the color temperature accordingly\n // (which also adjusts the internal cached values for Hue and Saturation).\n // After some short time the Hue or Saturation get handler return with the last known value to the plugin.\n // As those values now differ from the cached values (we already updated) we get a call to handleCharacteristicManualWritten\n // which again disables adaptive lighting.\n if (change.reason === \"read\" /* ChangeReason.READ */) {\n // if the reason is a read request, we expect that Hue/Saturation are also read\n // thus we postpone our update to ColorTemperature a bit.\n // It doesn't ensure that those race conditions do not happen anymore, but with a 1s delay it reduces the possibility by a bit\n setTimeout(function () {\n if (!_this.activeTransition) {\n return; // was disabled in the mean time\n }\n _this.scheduleNextUpdate(true);\n }, 1000).unref();\n }\n else {\n this.scheduleNextUpdate(true); // run a dry scheduleNextUpdate to adjust the colorTemperature using the new brightness value\n }\n };\n /**\n * This method is called when a change happens to the Hue/Saturation or ColorTemperature characteristic.\n * When such a write happens (caused by the user changing the color/temperature) Adaptive Lighting must be disabled.\n *\n * @param change\n */\n AdaptiveLightingController.prototype.handleCharacteristicManualWritten = function (change) {\n if (change.reason === \"write\" /* ChangeReason.WRITE */ && !(isAdaptiveLightingContext(change.context) && change.context.controller === this)) {\n // we ignore write request which are the result of calls made to updateValue or sendEventNotification\n // or the result of a changed value returned by a read handler\n // or the change was done by the controller itself\n debug(\"[%s] Received a manual write to an characteristic (newValue: %d, oldValue: %d, reason: %s). Thus disabling adaptive lighting!\", this.lightbulb.displayName, change.newValue, change.oldValue, change.reason);\n this.disableAdaptiveLighting();\n }\n };\n /**\n * Retrieve the {@link AdaptiveLightingTransitionPoint} for the current timestamp.\n * Returns undefined if the current transition schedule reached its end.\n */\n AdaptiveLightingController.prototype.getCurrentAdaptiveLightingTransitionPoint = function () {\n var _a, _b, _c, _d, _e;\n if (!this.activeTransition) {\n throw new Error(\"Cannot calculate current transition point if no transition is active!\");\n }\n // adjustedNow is the now() date corrected to the time of the initiating controller\n var adjustedNow = Date.now() - this.activeTransition.timeMillisOffset;\n // \"offset\" since the start of the transition schedule\n var offset = adjustedNow - this.activeTransition.transitionStartMillis;\n var i = (_b = (_a = this.lastTransitionPointInfo) === null || _a === void 0 ? void 0 : _a.curveIndex) !== null && _b !== void 0 ? _b : 0;\n var lowerBoundTimeOffset = (_d = (_c = this.lastTransitionPointInfo) === null || _c === void 0 ? void 0 : _c.lowerBoundTimeOffset) !== null && _d !== void 0 ? _d : 0; // time offset to the lowerBound transition entry\n var lowerBound = undefined;\n var upperBound = undefined;\n for (; i + 1 < this.activeTransition.transitionCurve.length; i++) {\n var lowerBound0 = this.activeTransition.transitionCurve[i];\n var upperBound0 = this.activeTransition.transitionCurve[i + 1];\n var lowerBoundDuration = (_e = lowerBound0.duration) !== null && _e !== void 0 ? _e : 0;\n lowerBoundTimeOffset += lowerBound0.transitionTime;\n if (offset >= lowerBoundTimeOffset) {\n if (offset <= lowerBoundTimeOffset + lowerBoundDuration + upperBound0.transitionTime) {\n lowerBound = lowerBound0;\n upperBound = upperBound0;\n break;\n }\n }\n else if (this.lastTransitionPointInfo) {\n // if we reached here the entry in the transitionCurve we are searching for is somewhere before current i.\n // This can only happen when we have a faulty lastTransitionPointInfo (otherwise we would start from i=0).\n // Thus we try again by searching from i=0\n this.lastTransitionPointInfo = undefined;\n return this.getCurrentAdaptiveLightingTransitionPoint();\n }\n lowerBoundTimeOffset += lowerBoundDuration;\n }\n if (!lowerBound || !upperBound) {\n this.lastTransitionPointInfo = undefined;\n return undefined;\n }\n this.lastTransitionPointInfo = {\n curveIndex: i,\n // we need to subtract lowerBound.transitionTime. When we start the loop above\n // with a saved transition point, we will always add lowerBound.transitionTime as first step.\n // Otherwise our calculations are simply wrong.\n lowerBoundTimeOffset: lowerBoundTimeOffset - lowerBound.transitionTime,\n };\n return {\n lowerBoundTimeOffset: lowerBoundTimeOffset,\n transitionOffset: offset - lowerBoundTimeOffset,\n lowerBound: lowerBound,\n upperBound: upperBound,\n };\n };\n AdaptiveLightingController.prototype.scheduleNextUpdate = function (dryRun) {\n var _this = this;\n var _a, _b, _c, _d, _e;\n if (dryRun === void 0) { dryRun = false; }\n if (!this.activeTransition) {\n throw new Error(\"tried scheduling transition when no transition was active!\");\n }\n if (!dryRun) {\n this.updateTimeout = undefined;\n }\n if (!this.didRunFirstInitializationStep) {\n this.didRunFirstInitializationStep = true;\n this.handleAdaptiveLightingEnabled();\n }\n var transitionPoint = this.getCurrentAdaptiveLightingTransitionPoint();\n if (!transitionPoint) {\n debug(\"[%s] Reached end of transition curve!\", this.lightbulb.displayName);\n if (!dryRun) {\n // the transition schedule is only for 24 hours, we reached the end?\n this.disableAdaptiveLighting();\n }\n return;\n }\n var lowerBound = transitionPoint.lowerBound;\n var upperBound = transitionPoint.upperBound;\n var interpolatedTemperature;\n var interpolatedAdjustmentFactor;\n if (lowerBound.duration && transitionPoint.transitionOffset <= lowerBound.duration) {\n interpolatedTemperature = lowerBound.temperature;\n interpolatedAdjustmentFactor = lowerBound.brightnessAdjustmentFactor;\n }\n else {\n var timePercentage = (transitionPoint.transitionOffset - ((_a = lowerBound.duration) !== null && _a !== void 0 ? _a : 0)) / upperBound.transitionTime;\n interpolatedTemperature = lowerBound.temperature + (upperBound.temperature - lowerBound.temperature) * timePercentage;\n interpolatedAdjustmentFactor = lowerBound.brightnessAdjustmentFactor\n + (upperBound.brightnessAdjustmentFactor - lowerBound.brightnessAdjustmentFactor) * timePercentage;\n }\n var adjustmentMultiplier = Math.max(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue, Math.min(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue, this.brightnessCharacteristic.value));\n var temperature = Math.round(interpolatedTemperature + interpolatedAdjustmentFactor * adjustmentMultiplier);\n // apply any manually applied temperature adjustments\n temperature += this.customTemperatureAdjustment;\n var min = (_c = (_b = this.colorTemperatureCharacteristic) === null || _b === void 0 ? void 0 : _b.props.minValue) !== null && _c !== void 0 ? _c : 140;\n var max = (_e = (_d = this.colorTemperatureCharacteristic) === null || _d === void 0 ? void 0 : _d.props.maxValue) !== null && _e !== void 0 ? _e : 500;\n temperature = Math.max(min, Math.min(max, temperature));\n var color = color_utils_1.ColorUtils.colorTemperatureToHueAndSaturation(temperature);\n debug(\"[%s] Next temperature value is %d (for brightness %d adj: %s)\", this.lightbulb.displayName, temperature, adjustmentMultiplier, this.customTemperatureAdjustment);\n var context = {\n controller: this,\n omitEventUpdate: true,\n };\n /*\n * We set saturation and hue values BEFORE we call the ColorTemperature SET handler (via setValue).\n * First thought was so the API user could get the values in the SET handler of the color temperature characteristic.\n * Do this is probably not really elegant cause this would only work when Adaptive Lighting is turned on\n * an the accessory MUST in any case update the Hue/Saturation values on a ColorTemperature write\n * (obviously only if Hue/Saturation characteristics are added to the service).\n *\n * The clever thing about this though is that, that it prevents notifications from being sent for Hue and Saturation\n * outside the specified notifyIntervalThreshold (see below where notifications are manually sent).\n * As the dev will or must call something like updateValue to propagate the updated hue and saturation values\n * to all HomeKit clients (so that the color is reflected in the UI), HAP-NodeJS won't send notifications\n * as the values are the same.\n * This of course only works if the plugin uses the exact same algorithm of \"converting\" the color temperature\n * value to the hue and saturation representation.\n */\n if (this.saturationCharacteristic) {\n this.saturationCharacteristic.value = color.saturation;\n }\n if (this.hueCharacteristic) {\n this.hueCharacteristic.value = color.hue;\n }\n this.colorTemperatureCharacteristic.handleSetRequest(temperature, undefined, context).catch(function (reason) {\n debug(\"[%s] Failed to next adaptive lighting transition point: %d\", _this.lightbulb.displayName, reason);\n });\n if (!this.activeTransition) {\n console.warn(\"[\" + this.lightbulb.displayName + \"] Adaptive Lighting was probably disable my mistake by some call in \" +\n \"the SET handler of the ColorTemperature characteristic! \" +\n \"Please check that you don't call setValue/setCharacteristic on the Hue, Saturation or ColorTemperature characteristic!\");\n return;\n }\n var now = Date.now();\n if (!dryRun && now - this.lastEventNotificationSent >= this.activeTransition.notifyIntervalThreshold) {\n debug(\"[%s] Sending event notifications for current transition!\", this.lightbulb.displayName);\n this.lastEventNotificationSent = now;\n var eventContext = {\n controller: this,\n };\n if (this.lastNotifiedTemperatureValue !== temperature) {\n this.colorTemperatureCharacteristic.sendEventNotification(temperature, eventContext);\n this.lastNotifiedTemperatureValue = temperature;\n }\n if (this.saturationCharacteristic && this.lastNotifiedSaturationValue !== color.saturation) {\n this.saturationCharacteristic.sendEventNotification(color.saturation, eventContext);\n this.lastNotifiedSaturationValue = color.saturation;\n }\n if (this.hueCharacteristic && this.lastNotifiedHueValue !== color.hue) {\n this.hueCharacteristic.sendEventNotification(color.hue, eventContext);\n this.lastNotifiedHueValue = color.hue;\n }\n }\n if (!dryRun) {\n this.updateTimeout = setTimeout(this.scheduleNextUpdate.bind(this), this.activeTransition.updateInterval);\n }\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.constructServices = function () {\n return {};\n };\n /**\n * @private\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n AdaptiveLightingController.prototype.initWithServices = function (serviceMap) {\n // do nothing\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.configureServices = function () {\n var _this = this;\n this.supportedTransitionConfiguration = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.SupportedCharacteristicValueTransitionConfiguration);\n this.transitionControl = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.CharacteristicValueTransitionControl)\n .updateValue(\"\");\n this.activeTransitionCount = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.CharacteristicValueActiveTransitionCount)\n .updateValue(0);\n this.supportedTransitionConfiguration\n .onGet(this.handleSupportedTransitionConfigurationRead.bind(this));\n this.transitionControl\n .onGet(function () {\n return _this.buildTransitionControlResponseBuffer().toString(\"base64\");\n })\n .onSet(function (value) {\n try {\n return _this.handleTransitionControlWrite(value);\n }\n catch (error) {\n console.warn(\"[%s] DEBUG: '\".concat(value, \"'\"));\n console.warn(\"[%s] Encountered error on CharacteristicValueTransitionControl characteristic: \" + error.stack);\n _this.disableAdaptiveLighting();\n throw new hapStatusError_1.HapStatusError(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n });\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.handleControllerRemoved = function () {\n this.lightbulb.removeCharacteristic(this.supportedTransitionConfiguration);\n this.lightbulb.removeCharacteristic(this.transitionControl);\n this.lightbulb.removeCharacteristic(this.activeTransitionCount);\n this.supportedTransitionConfiguration = undefined;\n this.transitionControl = undefined;\n this.activeTransitionCount = undefined;\n this.removeAllListeners();\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.handleFactoryReset = function () {\n this.handleAdaptiveLightingDisabled();\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.serialize = function () {\n if (!this.activeTransition) {\n return undefined;\n }\n return {\n activeTransition: this.activeTransition,\n };\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.deserialize = function (serialized) {\n this.activeTransition = serialized.activeTransition;\n // Data migrations from beta builds\n if (!this.activeTransition.transitionId) {\n // @ts-expect-error: data migration from beta builds\n this.activeTransition.transitionId = this.activeTransition.id1;\n // @ts-expect-error: data migration from beta builds\n delete this.activeTransition.id1;\n }\n if (!this.activeTransition.timeMillisOffset) { // compatibility to data produced by early betas\n this.activeTransition.timeMillisOffset = 0;\n }\n this.handleActiveTransitionUpdated(true);\n };\n /**\n * @private\n */\n AdaptiveLightingController.prototype.setupStateChangeDelegate = function (delegate) {\n this.stateChangeDelegate = delegate;\n };\n AdaptiveLightingController.prototype.handleSupportedTransitionConfigurationRead = function () {\n var brightnessIID = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.Brightness).iid;\n var temperatureIID = this.lightbulb.getCharacteristic(Characteristic_1.Characteristic.ColorTemperature).iid;\n (0, assert_1.default)(brightnessIID, \"iid for brightness characteristic is undefined\");\n (0, assert_1.default)(temperatureIID, \"iid for temperature characteristic is undefined\");\n return tlv.encode(1 /* SupportedCharacteristicValueTransitionConfigurationsTypes.SUPPORTED_TRANSITION_CONFIGURATION */, [\n tlv.encode(1 /* SupportedValueTransitionConfigurationTypes.CHARACTERISTIC_IID */, tlv.writeVariableUIntLE(brightnessIID), 2 /* SupportedValueTransitionConfigurationTypes.TRANSITION_TYPE */, 1 /* TransitionType.BRIGHTNESS */),\n tlv.encode(1 /* SupportedValueTransitionConfigurationTypes.CHARACTERISTIC_IID */, tlv.writeVariableUIntLE(temperatureIID), 2 /* SupportedValueTransitionConfigurationTypes.TRANSITION_TYPE */, 2 /* TransitionType.COLOR_TEMPERATURE */),\n ]).toString(\"base64\");\n };\n AdaptiveLightingController.prototype.buildTransitionControlResponseBuffer = function (time) {\n if (!this.activeTransition) {\n return Buffer.alloc(0);\n }\n var active = this.activeTransition;\n var timeSinceStart = time !== null && time !== void 0 ? time : (Date.now() - active.timeMillisOffset - active.transitionStartMillis);\n var timeSinceStartBuffer = tlv.writeVariableUIntLE(timeSinceStart);\n var parameters = tlv.encode(1 /* ValueTransitionParametersTypes.TRANSITION_ID */, uuid.write(active.transitionId), 2 /* ValueTransitionParametersTypes.START_TIME */, Buffer.from(active.transitionStartBuffer, \"hex\"));\n if (active.id3) {\n parameters = Buffer.concat([\n parameters,\n tlv.encode(3 /* ValueTransitionParametersTypes.UNKNOWN_3 */, Buffer.from(active.id3, \"hex\")),\n ]);\n }\n var status = tlv.encode(1 /* ValueTransitionConfigurationStatusTypes.CHARACTERISTIC_IID */, tlv.writeVariableUIntLE(active.iid), 2 /* ValueTransitionConfigurationStatusTypes.TRANSITION_PARAMETERS */, parameters, 3 /* ValueTransitionConfigurationStatusTypes.TIME_SINCE_START */, timeSinceStartBuffer);\n return tlv.encode(1 /* ValueTransitionConfigurationResponseTypes.VALUE_CONFIGURATION_STATUS */, status);\n };\n AdaptiveLightingController.prototype.handleTransitionControlWrite = function (value) {\n if (typeof value !== \"string\") {\n throw new hapStatusError_1.HapStatusError(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n }\n var tlvData = tlv.decode(Buffer.from(value, \"base64\"));\n var responseBuffers = [];\n var readTransition = tlvData[1 /* TransitionControlTypes.READ_CURRENT_VALUE_TRANSITION_CONFIGURATION */];\n if (readTransition) {\n var readTransitionResponse = this.handleTransitionControlReadTransition(readTransition);\n if (readTransitionResponse) {\n responseBuffers.push(readTransitionResponse);\n }\n }\n var updateTransition = tlvData[2 /* TransitionControlTypes.UPDATE_VALUE_TRANSITION_CONFIGURATION */];\n if (updateTransition) {\n var updateTransitionResponse = this.handleTransitionControlUpdateTransition(updateTransition);\n if (updateTransitionResponse) {\n responseBuffers.push(updateTransitionResponse);\n }\n }\n return Buffer.concat(responseBuffers).toString(\"base64\");\n };\n AdaptiveLightingController.prototype.handleTransitionControlReadTransition = function (buffer) {\n var readTransition = tlv.decode(buffer);\n var iid = tlv.readVariableUIntLE(readTransition[1 /* ReadValueTransitionConfiguration.CHARACTERISTIC_IID */]);\n if (this.activeTransition) {\n if (this.activeTransition.iid !== iid) {\n console.warn(\"[\" + this.lightbulb.displayName + \"] iid of current adaptive lighting transition (\" + this.activeTransition.iid\n + \") doesn't match the requested one \" + iid);\n throw new hapStatusError_1.HapStatusError(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n }\n var parameters = tlv.encode(1 /* ValueTransitionParametersTypes.TRANSITION_ID */, uuid.write(this.activeTransition.transitionId), 2 /* ValueTransitionParametersTypes.START_TIME */, Buffer.from(this.activeTransition.transitionStartBuffer, \"hex\"));\n if (this.activeTransition.id3) {\n parameters = Buffer.concat([\n parameters,\n tlv.encode(3 /* ValueTransitionParametersTypes.UNKNOWN_3 */, Buffer.from(this.activeTransition.id3, \"hex\")),\n ]);\n }\n return tlv.encode(1 /* TransitionControlTypes.READ_CURRENT_VALUE_TRANSITION_CONFIGURATION */, tlv.encode(1 /* ValueTransitionConfigurationTypes.CHARACTERISTIC_IID */, tlv.writeVariableUIntLE(this.activeTransition.iid), 2 /* ValueTransitionConfigurationTypes.TRANSITION_PARAMETERS */, parameters, 3 /* ValueTransitionConfigurationTypes.UNKNOWN_3 */, 1, 5 /* ValueTransitionConfigurationTypes.TRANSITION_CURVE_CONFIGURATION */, tlv.encode(1 /* TransitionCurveConfigurationTypes.TRANSITION_ENTRY */, this.activeTransition.transitionCurve.map(function (entry, index, array) {\n var _a, _b;\n var duration = (_b = (_a = array[index - 1]) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0; // we store stuff differently :sweat_smile:\n return tlv.encode(1 /* TransitionEntryTypes.ADJUSTMENT_FACTOR */, tlv.writeFloat32LE(entry.brightnessAdjustmentFactor), 2 /* TransitionEntryTypes.VALUE */, tlv.writeFloat32LE(entry.temperature), 3 /* TransitionEntryTypes.TRANSITION_OFFSET */, tlv.writeVariableUIntLE(entry.transitionTime), 4 /* TransitionEntryTypes.DURATION */, tlv.writeVariableUIntLE(duration));\n }), 2 /* TransitionCurveConfigurationTypes.ADJUSTMENT_CHARACTERISTIC_IID */, tlv.writeVariableUIntLE(this.activeTransition.brightnessCharacteristicIID), 3 /* TransitionCurveConfigurationTypes.ADJUSTMENT_MULTIPLIER_RANGE */, tlv.encode(1 /* TransitionAdjustmentMultiplierRange.MINIMUM_ADJUSTMENT_MULTIPLIER */, tlv.writeUInt32(this.activeTransition.brightnessAdjustmentRange.minBrightnessValue), 2 /* TransitionAdjustmentMultiplierRange.MAXIMUM_ADJUSTMENT_MULTIPLIER */, tlv.writeUInt32(this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue))), 6 /* ValueTransitionConfigurationTypes.UPDATE_INTERVAL */, tlv.writeVariableUIntLE(this.activeTransition.updateInterval), 8 /* ValueTransitionConfigurationTypes.NOTIFY_INTERVAL_THRESHOLD */, tlv.writeVariableUIntLE(this.activeTransition.notifyIntervalThreshold)));\n }\n else {\n return undefined; // returns empty string\n }\n };\n AdaptiveLightingController.prototype.handleTransitionControlUpdateTransition = function (buffer) {\n var e_1, _a;\n var _b, _c;\n var updateTransition = tlv.decode(buffer);\n var transitionConfiguration = tlv.decode(updateTransition[1 /* UpdateValueTransitionConfigurationsTypes.VALUE_TRANSITION_CONFIGURATION */]);\n var iid = tlv.readVariableUIntLE(transitionConfiguration[1 /* ValueTransitionConfigurationTypes.CHARACTERISTIC_IID */]);\n if (!this.lightbulb.getCharacteristicByIID(iid)) {\n throw new hapStatusError_1.HapStatusError(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n }\n var param3 = (_b = transitionConfiguration[3 /* ValueTransitionConfigurationTypes.UNKNOWN_3 */]) === null || _b === void 0 ? void 0 : _b.readUInt8(0); // when present it is always 1\n if (!param3) { // if HomeKit just sends the iid, we consider that as \"disable adaptive lighting\" (assumption)\n this.handleAdaptiveLightingDisabled();\n return tlv.encode(2 /* TransitionControlTypes.UPDATE_VALUE_TRANSITION_CONFIGURATION */, Buffer.alloc(0));\n }\n var parametersTLV = tlv.decode(transitionConfiguration[2 /* ValueTransitionConfigurationTypes.TRANSITION_PARAMETERS */]);\n var curveConfiguration = tlv.decodeWithLists(transitionConfiguration[5 /* ValueTransitionConfigurationTypes.TRANSITION_CURVE_CONFIGURATION */]);\n var updateInterval = (_c = transitionConfiguration[6 /* ValueTransitionConfigurationTypes.UPDATE_INTERVAL */]) === null || _c === void 0 ? void 0 : _c.readUInt16LE(0);\n var notifyIntervalThreshold = transitionConfiguration[8 /* ValueTransitionConfigurationTypes.NOTIFY_INTERVAL_THRESHOLD */].readUInt32LE(0);\n var transitionId = parametersTLV[1 /* ValueTransitionParametersTypes.TRANSITION_ID */];\n var startTime = parametersTLV[2 /* ValueTransitionParametersTypes.START_TIME */];\n var id3 = parametersTLV[3 /* ValueTransitionParametersTypes.UNKNOWN_3 */]; // this may be undefined\n var startTimeMillis = (0, time_1.epochMillisFromMillisSince2001_01_01Buffer)(startTime);\n var timeMillisOffset = Date.now() - startTimeMillis;\n var transitionCurve = [];\n var previous = undefined;\n var transitions = curveConfiguration[1 /* TransitionCurveConfigurationTypes.TRANSITION_ENTRY */];\n try {\n for (var transitions_1 = tslib_1.__values(transitions), transitions_1_1 = transitions_1.next(); !transitions_1_1.done; transitions_1_1 = transitions_1.next()) {\n var entry = transitions_1_1.value;\n var tlvEntry = tlv.decode(entry);\n var adjustmentFactor = tlvEntry[1 /* TransitionEntryTypes.ADJUSTMENT_FACTOR */].readFloatLE(0);\n var value = tlvEntry[2 /* TransitionEntryTypes.VALUE */].readFloatLE(0);\n var transitionOffset = tlv.readVariableUIntLE(tlvEntry[3 /* TransitionEntryTypes.TRANSITION_OFFSET */]);\n var duration = tlvEntry[4 /* TransitionEntryTypes.DURATION */] ? tlv.readVariableUIntLE(tlvEntry[4 /* TransitionEntryTypes.DURATION */]) : undefined;\n if (previous) {\n previous.duration = duration;\n }\n previous = {\n temperature: value,\n brightnessAdjustmentFactor: adjustmentFactor,\n transitionTime: transitionOffset,\n };\n transitionCurve.push(previous);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (transitions_1_1 && !transitions_1_1.done && (_a = transitions_1.return)) _a.call(transitions_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var adjustmentIID = tlv.readVariableUIntLE(curveConfiguration[2 /* TransitionCurveConfigurationTypes.ADJUSTMENT_CHARACTERISTIC_IID */]);\n var adjustmentMultiplierRange = tlv.decode(curveConfiguration[3 /* TransitionCurveConfigurationTypes.ADJUSTMENT_MULTIPLIER_RANGE */]);\n var minAdjustmentMultiplier = adjustmentMultiplierRange[1 /* TransitionAdjustmentMultiplierRange.MINIMUM_ADJUSTMENT_MULTIPLIER */].readUInt32LE(0);\n var maxAdjustmentMultiplier = adjustmentMultiplierRange[2 /* TransitionAdjustmentMultiplierRange.MAXIMUM_ADJUSTMENT_MULTIPLIER */].readUInt32LE(0);\n this.activeTransition = {\n iid: iid,\n transitionStartMillis: startTimeMillis,\n timeMillisOffset: timeMillisOffset,\n transitionId: uuid.unparse(transitionId),\n transitionStartBuffer: startTime.toString(\"hex\"),\n id3: id3 === null || id3 === void 0 ? void 0 : id3.toString(\"hex\"),\n brightnessCharacteristicIID: adjustmentIID,\n brightnessAdjustmentRange: {\n minBrightnessValue: minAdjustmentMultiplier,\n maxBrightnessValue: maxAdjustmentMultiplier,\n },\n transitionCurve: transitionCurve,\n updateInterval: updateInterval !== null && updateInterval !== void 0 ? updateInterval : 60000,\n notifyIntervalThreshold: notifyIntervalThreshold,\n };\n if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = undefined;\n debug(\"[%s] Adaptive lighting was renewed.\", this.lightbulb.displayName);\n }\n else {\n debug(\"[%s] Adaptive lighting was enabled.\", this.lightbulb.displayName);\n }\n this.handleActiveTransitionUpdated();\n return tlv.encode(2 /* TransitionControlTypes.UPDATE_VALUE_TRANSITION_CONFIGURATION */, this.buildTransitionControlResponseBuffer(0));\n };\n return AdaptiveLightingController;\n}(events_1.EventEmitter));\nexports.AdaptiveLightingController = AdaptiveLightingController;\n//# sourceMappingURL=AdaptiveLightingController.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CameraController = exports.CameraControllerEvents = exports.ResourceRequestReason = void 0;\nvar tslib_1 = require(\"tslib\");\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar camera_1 = require(\"../camera\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar datastream_1 = require(\"../datastream\");\nvar Service_1 = require(\"../Service\");\nvar hapStatusError_1 = require(\"../util/hapStatusError\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Camera:Controller\");\n/**\n * @group Camera\n */\nvar ResourceRequestReason;\n(function (ResourceRequestReason) {\n /**\n * The reason describes periodic resource requests.\n * In the example of camera image snapshots those are the typical preview images every 10 seconds.\n */\n ResourceRequestReason[ResourceRequestReason[\"PERIODIC\"] = 0] = \"PERIODIC\";\n /**\n * The resource request is the result of some event.\n * In the example of camera image snapshots, requests are made due to e.g. a motion event or similar.\n */\n ResourceRequestReason[ResourceRequestReason[\"EVENT\"] = 1] = \"EVENT\";\n})(ResourceRequestReason = exports.ResourceRequestReason || (exports.ResourceRequestReason = {}));\n/**\n * @group Camera\n */\nvar CameraControllerEvents;\n(function (CameraControllerEvents) {\n /**\n * Emitted when the mute state or the volume changed. The Apple Home App typically does not set those values\n * except the mute state. When you adjust the volume in the Camera view it will reset the muted state if it was set previously.\n * The value of volume has nothing to do with the volume slider in the Camera view of the Home app.\n */\n CameraControllerEvents[\"MICROPHONE_PROPERTIES_CHANGED\"] = \"microphone-change\";\n /**\n * Emitted when the mute state or the volume changed. The Apple Home App typically does not set those values\n * except the mute state. When you unmute the device microphone it will reset the mute state if it was set previously.\n */\n CameraControllerEvents[\"SPEAKER_PROPERTIES_CHANGED\"] = \"speaker-change\";\n})(CameraControllerEvents = exports.CameraControllerEvents || (exports.CameraControllerEvents = {}));\n/**\n * Everything needed to expose a HomeKit Camera.\n *\n * @group Camera\n */\nvar CameraController = /** @class */ (function (_super) {\n tslib_1.__extends(CameraController, _super);\n function CameraController(options, legacyMode) {\n if (legacyMode === void 0) { legacyMode = false; }\n var _this = _super.call(this) || this;\n _this.legacyMode = false;\n /**\n * @private\n */\n _this.streamManagements = [];\n _this.microphoneMuted = false;\n _this.microphoneVolume = 100;\n _this.speakerMuted = false;\n _this.speakerVolume = 100;\n _this.motionServiceExternallySupplied = false;\n _this.occupancyServiceExternallySupplied = false;\n _this.streamCount = Math.max(1, options.cameraStreamCount || 1);\n _this.delegate = options.delegate;\n _this.streamingOptions = options.streamingOptions;\n _this.recording = options.recording;\n _this.sensorOptions = options.sensors;\n _this.legacyMode = legacyMode; // legacy mode will prevent from Microphone and Speaker services to get created to avoid collisions\n return _this;\n }\n /**\n * @private\n */\n CameraController.prototype.controllerId = function () {\n return \"camera\" /* DefaultControllerType.CAMERA */;\n };\n // ----------------------------------- STREAM API ------------------------------------\n /**\n * Call this method if you want to forcefully suspend an ongoing streaming session.\n * This would be adequate if the rtp server or media encoding encountered an unexpected error.\n *\n * @param sessionId - id of the current ongoing streaming session\n */\n CameraController.prototype.forceStopStreamingSession = function (sessionId) {\n this.streamManagements.forEach(function (management) {\n if (management.sessionIdentifier === sessionId) {\n management.forceStop();\n }\n });\n };\n CameraController.generateSynchronisationSource = function () {\n var ssrc = crypto_1.default.randomBytes(4); // range [-2.14748e+09 - 2.14748e+09]\n ssrc[0] = 0;\n return ssrc.readInt32BE(0);\n };\n // ----------------------------- MICROPHONE/SPEAKER API ------------------------------\n CameraController.prototype.setMicrophoneMuted = function (muted) {\n if (muted === void 0) { muted = true; }\n if (!this.microphoneService) {\n return;\n }\n this.microphoneMuted = muted;\n this.microphoneService.updateCharacteristic(Characteristic_1.Characteristic.Mute, muted);\n };\n CameraController.prototype.setMicrophoneVolume = function (volume) {\n if (!this.microphoneService) {\n return;\n }\n this.microphoneVolume = volume;\n this.microphoneService.updateCharacteristic(Characteristic_1.Characteristic.Volume, volume);\n };\n CameraController.prototype.setSpeakerMuted = function (muted) {\n if (muted === void 0) { muted = true; }\n if (!this.speakerService) {\n return;\n }\n this.speakerMuted = muted;\n this.speakerService.updateCharacteristic(Characteristic_1.Characteristic.Mute, muted);\n };\n CameraController.prototype.setSpeakerVolume = function (volume) {\n if (!this.speakerService) {\n return;\n }\n this.speakerVolume = volume;\n this.speakerService.updateCharacteristic(Characteristic_1.Characteristic.Volume, volume);\n };\n CameraController.prototype.emitMicrophoneChange = function () {\n this.emit(\"microphone-change\" /* CameraControllerEvents.MICROPHONE_PROPERTIES_CHANGED */, this.microphoneMuted, this.microphoneVolume);\n };\n CameraController.prototype.emitSpeakerChange = function () {\n this.emit(\"speaker-change\" /* CameraControllerEvents.SPEAKER_PROPERTIES_CHANGED */, this.speakerMuted, this.speakerVolume);\n };\n // -----------------------------------------------------------------------------------\n /**\n * @private\n */\n CameraController.prototype.constructServices = function () {\n var _a, _b, _c, _d;\n for (var i = 0; i < this.streamCount; i++) {\n var rtp = new camera_1.RTPStreamManagement(i, this.streamingOptions, this.delegate, undefined, this.rtpStreamManagementDisabledThroughOperatingMode.bind(this));\n this.streamManagements.push(rtp);\n }\n if (!this.legacyMode && this.streamingOptions.audio) {\n // In theory the Microphone Service is a necessity. In practice, it's not. lol.\n // So we just add it if the user wants to support audio\n this.microphoneService = new Service_1.Service.Microphone(\"\", \"\");\n this.microphoneService.setCharacteristic(Characteristic_1.Characteristic.Volume, this.microphoneVolume);\n if (this.streamingOptions.audio.twoWayAudio) {\n this.speakerService = new Service_1.Service.Speaker(\"\", \"\");\n this.speakerService.setCharacteristic(Characteristic_1.Characteristic.Volume, this.speakerVolume);\n }\n }\n if (this.recording) {\n this.recordingManagement = new camera_1.RecordingManagement(this.recording.options, this.recording.delegate, this.retrieveEventTriggerOptions());\n }\n if ((_a = this.sensorOptions) === null || _a === void 0 ? void 0 : _a.motion) {\n if (typeof this.sensorOptions.motion === \"boolean\") {\n this.motionService = new Service_1.Service.MotionSensor(\"\", \"\");\n }\n else {\n this.motionService = this.sensorOptions.motion;\n this.motionServiceExternallySupplied = true;\n }\n this.motionService.setCharacteristic(Characteristic_1.Characteristic.StatusActive, true);\n (_b = this.recordingManagement) === null || _b === void 0 ? void 0 : _b.recordingManagementService.addLinkedService(this.motionService);\n }\n if ((_c = this.sensorOptions) === null || _c === void 0 ? void 0 : _c.occupancy) {\n if (typeof this.sensorOptions.occupancy === \"boolean\") {\n this.occupancyService = new Service_1.Service.OccupancySensor(\"\", \"\");\n }\n else {\n this.occupancyService = this.sensorOptions.occupancy;\n this.occupancyServiceExternallySupplied = true;\n }\n this.occupancyService.setCharacteristic(Characteristic_1.Characteristic.StatusActive, true);\n (_d = this.recordingManagement) === null || _d === void 0 ? void 0 : _d.recordingManagementService.addLinkedService(this.occupancyService);\n }\n var serviceMap = {\n microphone: this.microphoneService,\n speaker: this.speakerService,\n motionService: !this.motionServiceExternallySupplied ? this.motionService : undefined,\n occupancyService: !this.occupancyServiceExternallySupplied ? this.occupancyService : undefined,\n };\n if (this.recordingManagement) {\n serviceMap.cameraEventRecordingManagement = this.recordingManagement.recordingManagementService;\n serviceMap.cameraOperatingMode = this.recordingManagement.operatingModeService;\n serviceMap.dataStreamTransportManagement = this.recordingManagement.dataStreamManagement.getService();\n }\n this.streamManagements.forEach(function (management, index) {\n serviceMap[CameraController.STREAM_MANAGEMENT + index] = management.getService();\n });\n this.recording = undefined;\n this.sensorOptions = undefined;\n return serviceMap;\n };\n /**\n * @private\n */\n CameraController.prototype.initWithServices = function (serviceMap) {\n var result = this._initWithServices(serviceMap);\n if (result.updated) { // serviceMap must only be returned if anything actually changed\n return result.serviceMap;\n }\n };\n CameraController.prototype._initWithServices = function (serviceMap) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var modifiedServiceMap = false;\n // eslint-disable-next-line no-constant-condition\n for (var i = 0; true; i++) {\n var streamManagementService = serviceMap[CameraController.STREAM_MANAGEMENT + i];\n if (i < this.streamCount) {\n var operatingModeClosure = this.rtpStreamManagementDisabledThroughOperatingMode.bind(this);\n if (streamManagementService) { // normal init\n this.streamManagements.push(new camera_1.RTPStreamManagement(i, this.streamingOptions, this.delegate, streamManagementService, operatingModeClosure));\n }\n else { // stream count got bigger, we need to create a new service\n var management = new camera_1.RTPStreamManagement(i, this.streamingOptions, this.delegate, undefined, operatingModeClosure);\n this.streamManagements.push(management);\n serviceMap[CameraController.STREAM_MANAGEMENT + i] = management.getService();\n modifiedServiceMap = true;\n }\n }\n else {\n if (streamManagementService) { // stream count got reduced, we need to remove old service\n delete serviceMap[CameraController.STREAM_MANAGEMENT + i];\n modifiedServiceMap = true;\n }\n else {\n break; // we finished counting, and we got no saved service; we are finished\n }\n }\n }\n // MICROPHONE\n if (!this.legacyMode && this.streamingOptions.audio) { // microphone should be present\n if (serviceMap.microphone) {\n this.microphoneService = serviceMap.microphone;\n }\n else {\n // microphone wasn't created yet => create a new one\n this.microphoneService = new Service_1.Service.Microphone(\"\", \"\");\n this.microphoneService.setCharacteristic(Characteristic_1.Characteristic.Volume, this.microphoneVolume);\n serviceMap.microphone = this.microphoneService;\n modifiedServiceMap = true;\n }\n }\n else if (serviceMap.microphone) { // microphone service supplied, though settings seemed to have changed\n // we need to remove it\n delete serviceMap.microphone;\n modifiedServiceMap = true;\n }\n // SPEAKER\n if (!this.legacyMode && ((_a = this.streamingOptions.audio) === null || _a === void 0 ? void 0 : _a.twoWayAudio)) { // speaker should be present\n if (serviceMap.speaker) {\n this.speakerService = serviceMap.speaker;\n }\n else {\n // speaker wasn't created yet => create a new one\n this.speakerService = new Service_1.Service.Speaker(\"\", \"\");\n this.speakerService.setCharacteristic(Characteristic_1.Characteristic.Volume, this.speakerVolume);\n serviceMap.speaker = this.speakerService;\n modifiedServiceMap = true;\n }\n }\n else if (serviceMap.speaker) { // speaker service supplied, though settings seemed to have changed\n // we need to remove it\n delete serviceMap.speaker;\n modifiedServiceMap = true;\n }\n // RECORDING\n if (this.recording) {\n var eventTriggers = this.retrieveEventTriggerOptions();\n // RECORDING MANAGEMENT\n if (serviceMap.cameraEventRecordingManagement && serviceMap.cameraOperatingMode && serviceMap.dataStreamTransportManagement) {\n this.recordingManagement = new camera_1.RecordingManagement(this.recording.options, this.recording.delegate, eventTriggers, {\n recordingManagement: serviceMap.cameraEventRecordingManagement,\n operatingMode: serviceMap.cameraOperatingMode,\n dataStreamManagement: new datastream_1.DataStreamManagement(serviceMap.dataStreamTransportManagement),\n });\n }\n else {\n this.recordingManagement = new camera_1.RecordingManagement(this.recording.options, this.recording.delegate, eventTriggers);\n serviceMap.cameraEventRecordingManagement = this.recordingManagement.recordingManagementService;\n serviceMap.cameraOperatingMode = this.recordingManagement.operatingModeService;\n serviceMap.dataStreamTransportManagement = this.recordingManagement.dataStreamManagement.getService();\n modifiedServiceMap = true;\n }\n }\n else {\n if (serviceMap.cameraEventRecordingManagement) {\n delete serviceMap.cameraEventRecordingManagement;\n modifiedServiceMap = true;\n }\n if (serviceMap.cameraOperatingMode) {\n delete serviceMap.cameraOperatingMode;\n modifiedServiceMap = true;\n }\n if (serviceMap.dataStreamTransportManagement) {\n delete serviceMap.dataStreamTransportManagement;\n modifiedServiceMap = true;\n }\n }\n // MOTION SENSOR\n if ((_b = this.sensorOptions) === null || _b === void 0 ? void 0 : _b.motion) {\n if (typeof this.sensorOptions.motion === \"boolean\") {\n if (serviceMap.motionService) {\n this.motionService = serviceMap.motionService;\n }\n else {\n // it could be the case that we previously had a manually supplied motion service\n // at this point we can't remove the iid from the list of linked services from the recording management!\n this.motionService = new Service_1.Service.MotionSensor(\"\", \"\");\n }\n }\n else {\n this.motionService = this.sensorOptions.motion;\n this.motionServiceExternallySupplied = true;\n if (serviceMap.motionService) { // motion service previously supplied as bool option\n (_c = this.recordingManagement) === null || _c === void 0 ? void 0 : _c.recordingManagementService.removeLinkedService(serviceMap.motionService);\n delete serviceMap.motionService;\n modifiedServiceMap = true;\n }\n }\n this.motionService.setCharacteristic(Characteristic_1.Characteristic.StatusActive, true);\n (_d = this.recordingManagement) === null || _d === void 0 ? void 0 : _d.recordingManagementService.addLinkedService(this.motionService);\n }\n else {\n if (serviceMap.motionService) {\n (_e = this.recordingManagement) === null || _e === void 0 ? void 0 : _e.recordingManagementService.removeLinkedService(serviceMap.motionService);\n delete serviceMap.motionService;\n modifiedServiceMap = true;\n }\n }\n // OCCUPANCY SENSOR\n if ((_f = this.sensorOptions) === null || _f === void 0 ? void 0 : _f.occupancy) {\n if (typeof this.sensorOptions.occupancy === \"boolean\") {\n if (serviceMap.occupancyService) {\n this.occupancyService = serviceMap.occupancyService;\n }\n else {\n // it could be the case that we previously had a manually supplied occupancy service\n // at this point we can't remove the iid from the list of linked services from the recording management!\n this.occupancyService = new Service_1.Service.OccupancySensor(\"\", \"\");\n }\n }\n else {\n this.occupancyService = this.sensorOptions.occupancy;\n this.occupancyServiceExternallySupplied = true;\n if (serviceMap.occupancyService) { // occupancy service previously supplied as bool option\n (_g = this.recordingManagement) === null || _g === void 0 ? void 0 : _g.recordingManagementService.removeLinkedService(serviceMap.occupancyService);\n delete serviceMap.occupancyService;\n modifiedServiceMap = true;\n }\n }\n this.occupancyService.setCharacteristic(Characteristic_1.Characteristic.StatusActive, true);\n (_h = this.recordingManagement) === null || _h === void 0 ? void 0 : _h.recordingManagementService.addLinkedService(this.occupancyService);\n }\n else {\n if (serviceMap.occupancyService) {\n (_j = this.recordingManagement) === null || _j === void 0 ? void 0 : _j.recordingManagementService.removeLinkedService(serviceMap.occupancyService);\n delete serviceMap.occupancyService;\n modifiedServiceMap = true;\n }\n }\n if (this.migrateFromDoorbell(serviceMap)) {\n modifiedServiceMap = true;\n }\n this.recording = undefined;\n this.sensorOptions = undefined;\n return {\n serviceMap: serviceMap,\n updated: modifiedServiceMap,\n };\n };\n // overwritten in DoorbellController (to avoid cyclic dependencies, I hate typescript for that)\n CameraController.prototype.migrateFromDoorbell = function (serviceMap) {\n if (serviceMap.doorbell) { // See NOTICE in DoorbellController\n delete serviceMap.doorbell;\n return true;\n }\n return false;\n };\n CameraController.prototype.retrieveEventTriggerOptions = function () {\n var e_1, _a;\n var _b;\n if (!this.recording) {\n return new Set();\n }\n var triggerOptions = new Set();\n if (this.recording.options.overrideEventTriggerOptions) {\n try {\n for (var _c = tslib_1.__values(this.recording.options.overrideEventTriggerOptions), _d = _c.next(); !_d.done; _d = _c.next()) {\n var option = _d.value;\n triggerOptions.add(option);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n if ((_b = this.sensorOptions) === null || _b === void 0 ? void 0 : _b.motion) {\n triggerOptions.add(1 /* EventTriggerOption.MOTION */);\n }\n // this method is overwritten by the `DoorbellController` to automatically configure EventTriggerOption.DOORBELL\n return triggerOptions;\n };\n /**\n * @private\n */\n CameraController.prototype.configureServices = function () {\n var _this = this;\n var _a, _b;\n if (this.microphoneService) {\n this.microphoneService.getCharacteristic(Characteristic_1.Characteristic.Mute)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.microphoneMuted);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n _this.microphoneMuted = value;\n callback();\n _this.emitMicrophoneChange();\n });\n this.microphoneService.getCharacteristic(Characteristic_1.Characteristic.Volume)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.microphoneVolume);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n _this.microphoneVolume = value;\n callback();\n _this.emitMicrophoneChange();\n });\n }\n if (this.speakerService) {\n this.speakerService.getCharacteristic(Characteristic_1.Characteristic.Mute)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.speakerMuted);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n _this.speakerMuted = value;\n callback();\n _this.emitSpeakerChange();\n });\n this.speakerService.getCharacteristic(Characteristic_1.Characteristic.Volume)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.speakerVolume);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback) {\n _this.speakerVolume = value;\n callback();\n _this.emitSpeakerChange();\n });\n }\n // make the sensor services available to the RecordingManagement.\n if (this.motionService) {\n (_a = this.recordingManagement) === null || _a === void 0 ? void 0 : _a.sensorServices.push(this.motionService);\n }\n if (this.occupancyService) {\n (_b = this.recordingManagement) === null || _b === void 0 ? void 0 : _b.sensorServices.push(this.occupancyService);\n }\n };\n CameraController.prototype.rtpStreamManagementDisabledThroughOperatingMode = function () {\n return this.recordingManagement\n ? !this.recordingManagement.operatingModeService.getCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive).value\n : false;\n };\n /**\n * @private\n */\n CameraController.prototype.handleControllerRemoved = function () {\n var e_2, _a;\n var _b;\n this.handleFactoryReset();\n try {\n for (var _c = tslib_1.__values(this.streamManagements), _d = _c.next(); !_d.done; _d = _c.next()) {\n var management = _d.value;\n management.destroy();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_2) throw e_2.error; }\n }\n this.streamManagements.splice(0, this.streamManagements.length);\n this.microphoneService = undefined;\n this.speakerService = undefined;\n (_b = this.recordingManagement) === null || _b === void 0 ? void 0 : _b.destroy();\n this.recordingManagement = undefined;\n this.removeAllListeners();\n };\n /**\n * @private\n */\n CameraController.prototype.handleFactoryReset = function () {\n var _a;\n this.streamManagements.forEach(function (management) { return management.handleFactoryReset(); });\n (_a = this.recordingManagement) === null || _a === void 0 ? void 0 : _a.handleFactoryReset();\n this.microphoneMuted = false;\n this.microphoneVolume = 100;\n this.speakerMuted = false;\n this.speakerVolume = 100;\n };\n /**\n * @private\n */\n CameraController.prototype.serialize = function () {\n var e_3, _a;\n var _b;\n var streamManagementStates = [];\n try {\n for (var _c = tslib_1.__values(this.streamManagements), _d = _c.next(); !_d.done; _d = _c.next()) {\n var management = _d.value;\n var serializedState = management.serialize();\n if (serializedState) {\n streamManagementStates.push(serializedState);\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_3) throw e_3.error; }\n }\n return {\n streamManagements: streamManagementStates,\n recordingManagement: (_b = this.recordingManagement) === null || _b === void 0 ? void 0 : _b.serialize(),\n };\n };\n /**\n * @private\n */\n CameraController.prototype.deserialize = function (serialized) {\n var e_4, _a, e_5, _b;\n var _c;\n try {\n for (var _d = tslib_1.__values(serialized.streamManagements), _e = _d.next(); !_e.done; _e = _d.next()) {\n var streamManagementState = _e.value;\n var streamManagement = this.streamManagements[streamManagementState.id];\n if (streamManagement) {\n streamManagement.deserialize(streamManagementState);\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n }\n finally { if (e_4) throw e_4.error; }\n }\n if (serialized.recordingManagement) {\n if (this.recordingManagement) {\n this.recordingManagement.deserialize(serialized.recordingManagement);\n }\n else {\n try {\n // Active characteristic cannot be controlled if removing HSV, ensure they are all active!\n for (var _f = tslib_1.__values(this.streamManagements), _g = _f.next(); !_g.done; _g = _f.next()) {\n var streamManagement = _g.value;\n streamManagement.service.updateCharacteristic(Characteristic_1.Characteristic.Active, true);\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_g && !_g.done && (_b = _f.return)) _b.call(_f);\n }\n finally { if (e_5) throw e_5.error; }\n }\n (_c = this.stateChangeDelegate) === null || _c === void 0 ? void 0 : _c.call(this);\n }\n }\n };\n /**\n * @private\n */\n CameraController.prototype.setupStateChangeDelegate = function (delegate) {\n var e_6, _a;\n var _b;\n this.stateChangeDelegate = delegate;\n try {\n for (var _c = tslib_1.__values(this.streamManagements), _d = _c.next(); !_d.done; _d = _c.next()) {\n var streamManagement = _d.value;\n streamManagement.setupStateChangeDelegate(delegate);\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_6) throw e_6.error; }\n }\n (_b = this.recordingManagement) === null || _b === void 0 ? void 0 : _b.setupStateChangeDelegate(delegate);\n };\n /**\n * @private\n */\n CameraController.prototype.handleSnapshotRequest = function (height, width, accessoryName, reason) {\n var _this = this;\n // first step is to verify that the reason is applicable to our current policy\n var streamingDisabled = this.streamManagements\n .map(function (management) { return !management.getService().getCharacteristic(Characteristic_1.Characteristic.Active).value; })\n .reduce(function (previousValue, currentValue) { return previousValue && currentValue; });\n if (streamingDisabled) {\n debug(\"[%s] Rejecting snapshot as streaming is disabled.\", accessoryName);\n return Promise.reject(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */);\n }\n if (this.recordingManagement) {\n var operatingModeService = this.recordingManagement.operatingModeService;\n if (!operatingModeService.getCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive).value) {\n debug(\"[%s] Rejecting snapshot as HomeKit camera is disabled.\", accessoryName);\n return Promise.reject(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */);\n }\n var eventSnapshotsActive = operatingModeService\n .getCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive)\n .value;\n if (!eventSnapshotsActive) {\n if (reason == null) {\n debug(\"[%s] Rejecting snapshot as reason is required due to disabled event snapshots.\", accessoryName);\n return Promise.reject(-70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */);\n }\n else if (reason === 1 /* ResourceRequestReason.EVENT */) {\n debug(\"[%s] Rejecting snapshot as even snapshots are disabled.\", accessoryName);\n return Promise.reject(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */);\n }\n }\n var periodicSnapshotsActive = operatingModeService\n .getCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive)\n .value;\n if (!periodicSnapshotsActive) {\n if (reason == null) {\n debug(\"[%s] Rejecting snapshot as reason is required due to disabled periodic snapshots.\", accessoryName);\n return Promise.reject(-70401 /* HAPStatus.INSUFFICIENT_PRIVILEGES */);\n }\n else if (reason === 0 /* ResourceRequestReason.PERIODIC */) {\n debug(\"[%s] Rejecting snapshot as periodic snapshots are disabled.\", accessoryName);\n return Promise.reject(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */);\n }\n }\n }\n // now do the actual snapshot request.\n return new Promise(function (resolve, reject) {\n // TODO test and make timeouts configurable!\n var timeout = setTimeout(function () {\n console.warn(\"[\".concat(accessoryName, \"] The image snapshot handler for the given accessory is slow to respond! See https://homebridge.io/w/JtMGR for more info.\"));\n timeout = setTimeout(function () {\n timeout = undefined;\n console.warn(\"[\".concat(accessoryName, \"] The image snapshot handler for the given accessory didn't respond at all! See https://homebridge.io/w/JtMGR for more info.\"));\n reject(-70408 /* HAPStatus.OPERATION_TIMED_OUT */);\n }, 17000);\n timeout.unref();\n }, 5000);\n timeout.unref();\n try {\n _this.delegate.handleSnapshotRequest({\n height: height,\n width: width,\n reason: reason,\n }, function (error, buffer) {\n if (!timeout) {\n return;\n }\n else {\n clearTimeout(timeout);\n timeout = undefined;\n }\n if (error) {\n if (typeof error === \"number\") {\n reject(error);\n }\n else {\n debug(\"[%s] Error getting snapshot: %s\", accessoryName, error.stack);\n reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n return;\n }\n if (!buffer || buffer.length === 0) {\n console.warn(\"[\".concat(accessoryName, \"] Snapshot request handler provided empty image buffer!\"));\n reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n else {\n resolve(buffer);\n }\n });\n }\n catch (error) {\n if (!timeout) {\n return;\n }\n else {\n clearTimeout(timeout);\n timeout = undefined;\n }\n console.warn(\"[\".concat(accessoryName, \"] Unhandled error thrown inside snapshot request handler: \").concat(error.stack));\n reject(error instanceof hapStatusError_1.HapStatusError ? error.hapStatus : -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);\n }\n });\n };\n /**\n * @private\n */\n CameraController.prototype.handleCloseConnection = function (sessionID) {\n if (this.delegate instanceof camera_1.LegacyCameraSourceAdapter) {\n this.delegate.forwardCloseConnection(sessionID);\n }\n };\n CameraController.STREAM_MANAGEMENT = \"streamManagement\"; // key to index all RTPStreamManagement services\n return CameraController;\n}(events_1.EventEmitter));\nexports.CameraController = CameraController;\n//# sourceMappingURL=CameraController.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSerializableController = exports.DefaultControllerType = void 0;\n/**\n * @group Controller API\n */\nvar DefaultControllerType;\n(function (DefaultControllerType) {\n DefaultControllerType[\"CAMERA\"] = \"camera\";\n DefaultControllerType[\"REMOTE\"] = \"remote\";\n DefaultControllerType[\"TV\"] = \"tv\";\n DefaultControllerType[\"ROUTER\"] = \"router\";\n DefaultControllerType[\"LOCK\"] = \"lock\";\n DefaultControllerType[\"CHARACTERISTIC_TRANSITION\"] = \"characteristic-transition\";\n})(DefaultControllerType = exports.DefaultControllerType || (exports.DefaultControllerType = {}));\n/**\n * @param controller\n * @group Controller API\n */\nfunction isSerializableController(controller) {\n return \"serialize\" in controller && \"deserialize\" in controller && \"setupStateChangeDelegate\" in controller;\n}\nexports.isSerializableController = isSerializableController;\n//# sourceMappingURL=Controller.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DoorbellController = void 0;\nvar tslib_1 = require(\"tslib\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar Service_1 = require(\"../Service\");\nvar CameraController_1 = require(\"./CameraController\");\n/**\n * The `DoorbellController` to efficiently manage doorbell implementations with HAP-NodeJS.\n *\n * NOTICE: We subclass from the {@link CameraController} here and deliberately do not introduce/set an\n * own/custom ControllerType for Doorbells, as Cameras and Doorbells are pretty much the same thing\n * and would collide otherwise.\n * As the possibility exists, both the CameraController and DoorbellController are written to support migration\n * from one to another. Meaning a serialized CameraController can be initialized as a DoorbellController\n * (on startup in {@link initWithServices}) and vice versa.\n *\n * @group Doorbell\n */\nvar DoorbellController = /** @class */ (function (_super) {\n tslib_1.__extends(DoorbellController, _super);\n /**\n * Initializes a new `DoorbellController`.\n * @param options - The {@link CameraControllerOptions} and optional {@link DoorbellOptions}.\n */\n function DoorbellController(options) {\n var _this = _super.call(this, options) || this;\n _this.doorbellServiceExternallySupplied = false;\n _this.doorbellOptions = {\n name: options.name,\n externalDoorbellService: options.externalDoorbellService,\n };\n return _this;\n }\n /**\n * Call this method to signal a doorbell button press.\n */\n DoorbellController.prototype.ringDoorbell = function () {\n this.doorbellService.updateCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchEvent, Characteristic_1.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);\n };\n DoorbellController.prototype.constructServices = function () {\n var _a, _b, _c;\n if ((_a = this.doorbellOptions) === null || _a === void 0 ? void 0 : _a.externalDoorbellService) {\n this.doorbellService = this.doorbellOptions.externalDoorbellService;\n this.doorbellServiceExternallySupplied = true;\n }\n else {\n this.doorbellService = new Service_1.Service.Doorbell((_c = (_b = this.doorbellOptions) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : \"\", \"\");\n }\n this.doorbellService.setPrimaryService();\n var serviceMap = _super.prototype.constructServices.call(this);\n if (!this.doorbellServiceExternallySupplied) {\n serviceMap.doorbell = this.doorbellService;\n }\n return serviceMap;\n };\n DoorbellController.prototype.initWithServices = function (serviceMap) {\n var _a, _b, _c;\n var result = _super.prototype._initWithServices.call(this, serviceMap);\n if ((_a = this.doorbellOptions) === null || _a === void 0 ? void 0 : _a.externalDoorbellService) {\n this.doorbellService = this.doorbellOptions.externalDoorbellService;\n this.doorbellServiceExternallySupplied = true;\n if (result.serviceMap.doorbell) {\n delete result.serviceMap.doorbell;\n result.updated = true;\n }\n }\n else {\n this.doorbellService = result.serviceMap.doorbell;\n if (!this.doorbellService) { // see NOTICE above\n this.doorbellService = new Service_1.Service.Doorbell((_c = (_b = this.doorbellOptions) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : \"\", \"\");\n result.serviceMap.doorbell = this.doorbellService;\n result.updated = true;\n }\n }\n this.doorbellService.setPrimaryService();\n if (result.updated) {\n return result.serviceMap;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n DoorbellController.prototype.migrateFromDoorbell = function (serviceMap) {\n return false;\n };\n DoorbellController.prototype.retrieveEventTriggerOptions = function () {\n var result = _super.prototype.retrieveEventTriggerOptions.call(this);\n result.add(2 /* EventTriggerOption.DOORBELL */);\n return result;\n };\n DoorbellController.prototype.handleControllerRemoved = function () {\n _super.prototype.handleControllerRemoved.call(this);\n this.doorbellService = undefined;\n };\n DoorbellController.prototype.configureServices = function () {\n _super.prototype.configureServices.call(this);\n this.doorbellService.getCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchEvent)\n .onGet(function () { return null; }); // a value of null represent nothing is pressed\n this.doorbellOptions = undefined;\n };\n return DoorbellController;\n}(CameraController_1.CameraController));\nexports.DoorbellController = DoorbellController;\n//# sourceMappingURL=DoorbellController.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SiriAudioSession = exports.SiriAudioSessionEvents = exports.HomeKitRemoteController = exports.RemoteController = exports.RemoteControllerEvents = exports.TargetUpdates = exports.AudioCodecTypes = exports.ButtonState = exports.TargetCategory = exports.ButtonType = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar datastream_1 = require(\"../datastream\");\nvar Service_1 = require(\"../Service\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:Remote:Controller\");\nvar TargetControlCommands;\n(function (TargetControlCommands) {\n TargetControlCommands[TargetControlCommands[\"MAXIMUM_TARGETS\"] = 1] = \"MAXIMUM_TARGETS\";\n TargetControlCommands[TargetControlCommands[\"TICKS_PER_SECOND\"] = 2] = \"TICKS_PER_SECOND\";\n TargetControlCommands[TargetControlCommands[\"SUPPORTED_BUTTON_CONFIGURATION\"] = 3] = \"SUPPORTED_BUTTON_CONFIGURATION\";\n TargetControlCommands[TargetControlCommands[\"TYPE\"] = 4] = \"TYPE\";\n})(TargetControlCommands || (TargetControlCommands = {}));\nvar SupportedButtonConfigurationTypes;\n(function (SupportedButtonConfigurationTypes) {\n SupportedButtonConfigurationTypes[SupportedButtonConfigurationTypes[\"BUTTON_ID\"] = 1] = \"BUTTON_ID\";\n SupportedButtonConfigurationTypes[SupportedButtonConfigurationTypes[\"BUTTON_TYPE\"] = 2] = \"BUTTON_TYPE\";\n})(SupportedButtonConfigurationTypes || (SupportedButtonConfigurationTypes = {}));\n/**\n * @group Apple TV Remote\n */\nvar ButtonType;\n(function (ButtonType) {\n // noinspection JSUnusedGlobalSymbols\n ButtonType[ButtonType[\"UNDEFINED\"] = 0] = \"UNDEFINED\";\n ButtonType[ButtonType[\"MENU\"] = 1] = \"MENU\";\n ButtonType[ButtonType[\"PLAY_PAUSE\"] = 2] = \"PLAY_PAUSE\";\n ButtonType[ButtonType[\"TV_HOME\"] = 3] = \"TV_HOME\";\n ButtonType[ButtonType[\"SELECT\"] = 4] = \"SELECT\";\n ButtonType[ButtonType[\"ARROW_UP\"] = 5] = \"ARROW_UP\";\n ButtonType[ButtonType[\"ARROW_RIGHT\"] = 6] = \"ARROW_RIGHT\";\n ButtonType[ButtonType[\"ARROW_DOWN\"] = 7] = \"ARROW_DOWN\";\n ButtonType[ButtonType[\"ARROW_LEFT\"] = 8] = \"ARROW_LEFT\";\n ButtonType[ButtonType[\"VOLUME_UP\"] = 9] = \"VOLUME_UP\";\n ButtonType[ButtonType[\"VOLUME_DOWN\"] = 10] = \"VOLUME_DOWN\";\n ButtonType[ButtonType[\"SIRI\"] = 11] = \"SIRI\";\n ButtonType[ButtonType[\"POWER\"] = 12] = \"POWER\";\n ButtonType[ButtonType[\"GENERIC\"] = 13] = \"GENERIC\";\n})(ButtonType = exports.ButtonType || (exports.ButtonType = {}));\nvar TargetControlList;\n(function (TargetControlList) {\n TargetControlList[TargetControlList[\"OPERATION\"] = 1] = \"OPERATION\";\n TargetControlList[TargetControlList[\"TARGET_CONFIGURATION\"] = 2] = \"TARGET_CONFIGURATION\";\n})(TargetControlList || (TargetControlList = {}));\nvar Operation;\n(function (Operation) {\n // noinspection JSUnusedGlobalSymbols\n Operation[Operation[\"UNDEFINED\"] = 0] = \"UNDEFINED\";\n Operation[Operation[\"LIST\"] = 1] = \"LIST\";\n Operation[Operation[\"ADD\"] = 2] = \"ADD\";\n Operation[Operation[\"REMOVE\"] = 3] = \"REMOVE\";\n Operation[Operation[\"RESET\"] = 4] = \"RESET\";\n Operation[Operation[\"UPDATE\"] = 5] = \"UPDATE\";\n})(Operation || (Operation = {}));\nvar TargetConfigurationTypes;\n(function (TargetConfigurationTypes) {\n TargetConfigurationTypes[TargetConfigurationTypes[\"TARGET_IDENTIFIER\"] = 1] = \"TARGET_IDENTIFIER\";\n TargetConfigurationTypes[TargetConfigurationTypes[\"TARGET_NAME\"] = 2] = \"TARGET_NAME\";\n TargetConfigurationTypes[TargetConfigurationTypes[\"TARGET_CATEGORY\"] = 3] = \"TARGET_CATEGORY\";\n TargetConfigurationTypes[TargetConfigurationTypes[\"BUTTON_CONFIGURATION\"] = 4] = \"BUTTON_CONFIGURATION\";\n})(TargetConfigurationTypes || (TargetConfigurationTypes = {}));\n/**\n * @group Apple TV Remote\n */\nvar TargetCategory;\n(function (TargetCategory) {\n // noinspection JSUnusedGlobalSymbols\n TargetCategory[TargetCategory[\"UNDEFINED\"] = 0] = \"UNDEFINED\";\n TargetCategory[TargetCategory[\"APPLE_TV\"] = 24] = \"APPLE_TV\";\n})(TargetCategory = exports.TargetCategory || (exports.TargetCategory = {}));\nvar ButtonConfigurationTypes;\n(function (ButtonConfigurationTypes) {\n ButtonConfigurationTypes[ButtonConfigurationTypes[\"BUTTON_ID\"] = 1] = \"BUTTON_ID\";\n ButtonConfigurationTypes[ButtonConfigurationTypes[\"BUTTON_TYPE\"] = 2] = \"BUTTON_TYPE\";\n ButtonConfigurationTypes[ButtonConfigurationTypes[\"BUTTON_NAME\"] = 3] = \"BUTTON_NAME\";\n})(ButtonConfigurationTypes || (ButtonConfigurationTypes = {}));\nvar ButtonEvent;\n(function (ButtonEvent) {\n ButtonEvent[ButtonEvent[\"BUTTON_ID\"] = 1] = \"BUTTON_ID\";\n ButtonEvent[ButtonEvent[\"BUTTON_STATE\"] = 2] = \"BUTTON_STATE\";\n ButtonEvent[ButtonEvent[\"TIMESTAMP\"] = 3] = \"TIMESTAMP\";\n ButtonEvent[ButtonEvent[\"ACTIVE_IDENTIFIER\"] = 4] = \"ACTIVE_IDENTIFIER\";\n})(ButtonEvent || (ButtonEvent = {}));\n/**\n * @group Apple TV Remote\n */\nvar ButtonState;\n(function (ButtonState) {\n ButtonState[ButtonState[\"UP\"] = 0] = \"UP\";\n ButtonState[ButtonState[\"DOWN\"] = 1] = \"DOWN\";\n})(ButtonState = exports.ButtonState || (exports.ButtonState = {}));\nvar SelectedAudioInputStreamConfigurationTypes;\n(function (SelectedAudioInputStreamConfigurationTypes) {\n SelectedAudioInputStreamConfigurationTypes[SelectedAudioInputStreamConfigurationTypes[\"SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION\"] = 1] = \"SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION\";\n})(SelectedAudioInputStreamConfigurationTypes || (SelectedAudioInputStreamConfigurationTypes = {}));\n// ----------\nvar SupportedAudioStreamConfigurationTypes;\n(function (SupportedAudioStreamConfigurationTypes) {\n // noinspection JSUnusedGlobalSymbols\n SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes[\"AUDIO_CODEC_CONFIGURATION\"] = 1] = \"AUDIO_CODEC_CONFIGURATION\";\n SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes[\"COMFORT_NOISE_SUPPORT\"] = 2] = \"COMFORT_NOISE_SUPPORT\";\n})(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));\nvar AudioCodecConfigurationTypes;\n(function (AudioCodecConfigurationTypes) {\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_TYPE\"] = 1] = \"CODEC_TYPE\";\n AudioCodecConfigurationTypes[AudioCodecConfigurationTypes[\"CODEC_PARAMETERS\"] = 2] = \"CODEC_PARAMETERS\";\n})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));\n/**\n * @group Camera\n */\nvar AudioCodecTypes;\n(function (AudioCodecTypes) {\n // noinspection JSUnusedGlobalSymbols\n AudioCodecTypes[AudioCodecTypes[\"PCMU\"] = 0] = \"PCMU\";\n AudioCodecTypes[AudioCodecTypes[\"PCMA\"] = 1] = \"PCMA\";\n AudioCodecTypes[AudioCodecTypes[\"AAC_ELD\"] = 2] = \"AAC_ELD\";\n AudioCodecTypes[AudioCodecTypes[\"OPUS\"] = 3] = \"OPUS\";\n AudioCodecTypes[AudioCodecTypes[\"MSBC\"] = 4] = \"MSBC\";\n AudioCodecTypes[AudioCodecTypes[\"AMR\"] = 5] = \"AMR\";\n AudioCodecTypes[AudioCodecTypes[\"AMR_WB\"] = 6] = \"AMR_WB\";\n})(AudioCodecTypes = exports.AudioCodecTypes || (exports.AudioCodecTypes = {}));\nvar AudioCodecParametersTypes;\n(function (AudioCodecParametersTypes) {\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"CHANNEL\"] = 1] = \"CHANNEL\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"BIT_RATE\"] = 2] = \"BIT_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"SAMPLE_RATE\"] = 3] = \"SAMPLE_RATE\";\n AudioCodecParametersTypes[AudioCodecParametersTypes[\"PACKET_TIME\"] = 4] = \"PACKET_TIME\"; // only present in selected audio codec parameters tlv\n})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));\nvar SiriAudioSessionState;\n(function (SiriAudioSessionState) {\n SiriAudioSessionState[SiriAudioSessionState[\"STARTING\"] = 0] = \"STARTING\";\n SiriAudioSessionState[SiriAudioSessionState[\"SENDING\"] = 1] = \"SENDING\";\n SiriAudioSessionState[SiriAudioSessionState[\"CLOSING\"] = 2] = \"CLOSING\";\n SiriAudioSessionState[SiriAudioSessionState[\"CLOSED\"] = 3] = \"CLOSED\";\n})(SiriAudioSessionState || (SiriAudioSessionState = {}));\n/**\n * @group Apple TV Remote\n */\nvar TargetUpdates;\n(function (TargetUpdates) {\n TargetUpdates[TargetUpdates[\"NAME\"] = 0] = \"NAME\";\n TargetUpdates[TargetUpdates[\"CATEGORY\"] = 1] = \"CATEGORY\";\n TargetUpdates[TargetUpdates[\"UPDATED_BUTTONS\"] = 2] = \"UPDATED_BUTTONS\";\n TargetUpdates[TargetUpdates[\"REMOVED_BUTTONS\"] = 3] = \"REMOVED_BUTTONS\";\n})(TargetUpdates = exports.TargetUpdates || (exports.TargetUpdates = {}));\n/**\n * @group Apple TV Remote\n */\nvar RemoteControllerEvents;\n(function (RemoteControllerEvents) {\n /**\n * This event is emitted when the active state of the remote has changed.\n * active = true indicates that there is currently an Apple TV listening of button presses and audio streams.\n */\n RemoteControllerEvents[\"ACTIVE_CHANGE\"] = \"active-change\";\n /**\n * This event is emitted when the currently selected target has changed.\n * Possible reasons for a changed active identifier: manual change via api call, first target configuration\n * gets added, active target gets removed, accessory gets unpaired, reset request was sent.\n * An activeIdentifier of 0 indicates that no target is selected.\n */\n RemoteControllerEvents[\"ACTIVE_IDENTIFIER_CHANGE\"] = \"active-identifier-change\";\n /**\n * This event is emitted when a new target configuration is received. As we currently do not persistently store\n * configured targets, this will be called at every startup for every Apple TV configured in the home.\n */\n RemoteControllerEvents[\"TARGET_ADDED\"] = \"target-add\";\n /**\n * This event is emitted when an existing target was updated.\n * The 'updates' array indicates what exactly was changed for the target.\n */\n RemoteControllerEvents[\"TARGET_UPDATED\"] = \"target-update\";\n /**\n * This event is emitted when an existing configuration for a target was removed.\n */\n RemoteControllerEvents[\"TARGET_REMOVED\"] = \"target-remove\";\n /**\n * This event is emitted when a reset of the target configuration is requested.\n * With this event every configuration made should be reset. This event is also called\n * when the accessory gets unpaired.\n */\n RemoteControllerEvents[\"TARGETS_RESET\"] = \"targets-reset\";\n})(RemoteControllerEvents = exports.RemoteControllerEvents || (exports.RemoteControllerEvents = {}));\n/**\n * Handles everything needed to implement a fully working HomeKit remote controller.\n *\n * @group Apple TV Remote\n */\nvar RemoteController = /** @class */ (function (_super) {\n tslib_1.__extends(RemoteController, _super);\n /**\n * Creates a new RemoteController.\n * If siri voice input is supported the constructor to an SiriAudioStreamProducer needs to be supplied.\n * Otherwise, a remote without voice support will be created.\n *\n * For every audio session a new SiriAudioStreamProducer will be constructed.\n *\n * @param audioProducerConstructor - constructor for a SiriAudioStreamProducer\n * @param producerOptions - if supplied this argument will be supplied as third argument of the SiriAudioStreamProducer\n * constructor. This should be used to supply configurations to the stream producer.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\n function RemoteController(audioProducerConstructor, producerOptions) {\n var _this = _super.call(this) || this;\n _this.buttons = {}; // internal mapping of buttonId to buttonType for supported buttons\n _this.targetConfigurations = new Map();\n _this.targetConfigurationsString = \"\";\n _this.lastButtonEvent = \"\";\n _this.activeIdentifier = 0; // id of 0 means no device selected\n _this.dataStreamConnections = new Map(); // maps targetIdentifiers to active data stream connections\n _this.audioSupported = audioProducerConstructor !== undefined;\n _this.audioProducerConstructor = audioProducerConstructor;\n _this.audioProducerOptions = producerOptions;\n var configuration = _this.constructSupportedConfiguration();\n _this.supportedConfiguration = _this.buildTargetControlSupportedConfigurationTLV(configuration);\n var audioConfiguration = _this.constructSupportedAudioConfiguration();\n _this.supportedAudioConfiguration = RemoteController.buildSupportedAudioConfigurationTLV(audioConfiguration);\n _this.selectedAudioConfiguration = {\n codecType: 3 /* AudioCodecTypes.OPUS */,\n parameters: {\n channels: 1,\n bitrate: 0 /* AudioBitrate.VARIABLE */,\n samplerate: 1 /* AudioSamplerate.KHZ_16 */,\n rtpTime: 20,\n },\n };\n _this.selectedAudioConfigurationString = RemoteController.buildSelectedAudioConfigurationTLV({\n audioCodecConfiguration: _this.selectedAudioConfiguration,\n });\n return _this;\n }\n /**\n * @private\n */\n RemoteController.prototype.controllerId = function () {\n return \"remote\" /* DefaultControllerType.REMOTE */;\n };\n /**\n * Set a new target as active target. A value of 0 indicates that no target is selected currently.\n *\n * @param activeIdentifier - target identifier\n */\n RemoteController.prototype.setActiveIdentifier = function (activeIdentifier) {\n var _this = this;\n if (activeIdentifier === this.activeIdentifier) {\n return;\n }\n if (activeIdentifier !== 0 && !this.targetConfigurations.has(activeIdentifier)) {\n throw Error(\"Tried setting unconfigured targetIdentifier to active\");\n }\n debug(\"%d is now the active target\", activeIdentifier);\n this.activeIdentifier = activeIdentifier;\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier).updateValue(activeIdentifier);\n if (this.activeAudioSession) {\n this.handleSiriAudioStop();\n }\n setTimeout(function () { return _this.emit(\"active-identifier-change\" /* RemoteControllerEvents.ACTIVE_IDENTIFIER_CHANGE */, activeIdentifier); }, 0);\n this.setInactive();\n };\n /**\n * @returns if the current target is active, meaning the active device is listening for button events or audio sessions\n */\n RemoteController.prototype.isActive = function () {\n return !!this.activeConnection;\n };\n /**\n * Checks if the supplied targetIdentifier is configured.\n *\n * @param targetIdentifier - The target identifier.\n */\n RemoteController.prototype.isConfigured = function (targetIdentifier) {\n return this.targetConfigurations.has(targetIdentifier);\n };\n /**\n * Returns the targetIdentifier for a give device name\n *\n * @param name - The name of the device.\n * @returns The targetIdentifier of the device or undefined if not existent.\n */\n RemoteController.prototype.getTargetIdentifierByName = function (name) {\n var e_1, _a;\n try {\n for (var _b = tslib_1.__values(Object.entries(this.targetConfigurations)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = tslib_1.__read(_c.value, 2), activeIdentifier = _d[0], configuration = _d[1];\n if (configuration.targetName === name) {\n return parseInt(activeIdentifier, 10);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return undefined;\n };\n /**\n * Sends a button event to press the supplied button.\n *\n * @param button - button to be pressed\n */\n RemoteController.prototype.pushButton = function (button) {\n this.sendButtonEvent(button, 1 /* ButtonState.DOWN */);\n };\n /**\n * Sends a button event that the supplied button was released.\n *\n * @param button - button which was released\n */\n RemoteController.prototype.releaseButton = function (button) {\n this.sendButtonEvent(button, 0 /* ButtonState.UP */);\n };\n /**\n * Presses a supplied button for a given time.\n *\n * @param button - button to be pressed and released\n * @param time - time in milliseconds (defaults to 200ms)\n */\n RemoteController.prototype.pushAndReleaseButton = function (button, time) {\n var _this = this;\n if (time === void 0) { time = 200; }\n this.pushButton(button);\n setTimeout(function () { return _this.releaseButton(button); }, time);\n };\n /**\n * This method adds and configures the remote services for a give accessory.\n *\n * @param accessory - the give accessory this remote should be added to\n * @deprecated - use {@link Accessory.configureController} instead\n */\n RemoteController.prototype.addServicesToAccessory = function (accessory) {\n accessory.configureController(this);\n };\n // ---------------------------------- CONFIGURATION ----------------------------------\n // override methods if you would like to change anything (but should not be necessary most likely)\n RemoteController.prototype.constructSupportedConfiguration = function () {\n var _this = this;\n var configuration = {\n maximumTargets: 10,\n ticksPerSecond: 1000,\n supportedButtonConfiguration: [],\n hardwareImplemented: this.audioSupported, // siri is only allowed for hardware implemented remotes\n };\n var supportedButtons = [\n 1 /* ButtonType.MENU */, 2 /* ButtonType.PLAY_PAUSE */, 3 /* ButtonType.TV_HOME */, 4 /* ButtonType.SELECT */,\n 5 /* ButtonType.ARROW_UP */, 6 /* ButtonType.ARROW_RIGHT */, 7 /* ButtonType.ARROW_DOWN */, 8 /* ButtonType.ARROW_LEFT */,\n 9 /* ButtonType.VOLUME_UP */, 10 /* ButtonType.VOLUME_DOWN */, 12 /* ButtonType.POWER */, 13 /* ButtonType.GENERIC */,\n ];\n if (this.audioSupported) { // add siri button if this remote supports it\n supportedButtons.push(11 /* ButtonType.SIRI */);\n }\n supportedButtons.forEach(function (button) {\n var buttonConfiguration = {\n buttonID: 100 + button,\n buttonType: button,\n };\n configuration.supportedButtonConfiguration.push(buttonConfiguration);\n _this.buttons[button] = buttonConfiguration.buttonID; // also saving mapping of type to id locally\n });\n return configuration;\n };\n RemoteController.prototype.constructSupportedAudioConfiguration = function () {\n // the following parameters are expected from HomeKit for a remote\n return {\n audioCodecConfiguration: {\n codecType: 3 /* AudioCodecTypes.OPUS */,\n parameters: {\n channels: 1,\n bitrate: 0 /* AudioBitrate.VARIABLE */,\n samplerate: 1 /* AudioSamplerate.KHZ_16 */,\n },\n },\n };\n };\n // --------------------------------- TARGET CONTROL ----------------------------------\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RemoteController.prototype.handleTargetControlWrite = function (value, callback) {\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n var operation = objects[1 /* TargetControlList.OPERATION */][0];\n var targetConfiguration = undefined;\n if (objects[2 /* TargetControlList.TARGET_CONFIGURATION */]) { // if target configuration was sent, parse it\n targetConfiguration = this.parseTargetConfigurationTLV(objects[2 /* TargetControlList.TARGET_CONFIGURATION */]);\n }\n debug(\"Received TargetControl write operation %s\", Operation[operation]);\n var handler;\n switch (operation) {\n case Operation.ADD:\n handler = this.handleAddTarget.bind(this);\n break;\n case Operation.UPDATE:\n handler = this.handleUpdateTarget.bind(this);\n break;\n case Operation.REMOVE:\n handler = this.handleRemoveTarget.bind(this);\n break;\n case Operation.RESET:\n handler = this.handleResetTargets.bind(this);\n break;\n case Operation.LIST:\n handler = this.handleListTargets.bind(this);\n break;\n default:\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */, undefined);\n return;\n }\n var status = handler(targetConfiguration);\n if (status === 0 /* HAPStatus.SUCCESS */) {\n callback(undefined, this.targetConfigurationsString); // passing value for write response\n if (operation === Operation.ADD && this.activeIdentifier === 0) {\n this.setActiveIdentifier(targetConfiguration.targetIdentifier);\n }\n }\n else {\n callback(new Error(status + \"\"));\n }\n };\n RemoteController.prototype.handleAddTarget = function (targetConfiguration) {\n var _this = this;\n if (!targetConfiguration) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n this.targetConfigurations.set(targetConfiguration.targetIdentifier, targetConfiguration);\n debug(\"Configured new target '\" + targetConfiguration.targetName + \"' with targetIdentifier '\" + targetConfiguration.targetIdentifier + \"'\");\n setTimeout(function () { return _this.emit(\"target-add\" /* RemoteControllerEvents.TARGET_ADDED */, targetConfiguration); }, 0);\n this.updatedTargetConfiguration(); // set response\n return 0 /* HAPStatus.SUCCESS */;\n };\n RemoteController.prototype.handleUpdateTarget = function (targetConfiguration) {\n var e_2, _a;\n var _this = this;\n if (!targetConfiguration) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n var updates = [];\n var configuredTarget = this.targetConfigurations.get(targetConfiguration.targetIdentifier);\n if (!configuredTarget) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n if (targetConfiguration.targetName) {\n debug(\"Target name was updated '%s' => '%s' (%d)\", configuredTarget.targetName, targetConfiguration.targetName, configuredTarget.targetIdentifier);\n configuredTarget.targetName = targetConfiguration.targetName;\n updates.push(0 /* TargetUpdates.NAME */);\n }\n if (targetConfiguration.targetCategory) {\n debug(\"Target category was updated '%d' => '%d' for target '%s' (%d)\", configuredTarget.targetCategory, targetConfiguration.targetCategory, configuredTarget.targetName, configuredTarget.targetIdentifier);\n configuredTarget.targetCategory = targetConfiguration.targetCategory;\n updates.push(1 /* TargetUpdates.CATEGORY */);\n }\n if (targetConfiguration.buttonConfiguration) {\n debug(\"%d button configurations were updated for target '%s' (%d)\", Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);\n try {\n for (var _b = tslib_1.__values(Object.values(targetConfiguration.buttonConfiguration)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var configuration = _c.value;\n var savedConfiguration = configuredTarget.buttonConfiguration[configuration.buttonID];\n savedConfiguration.buttonType = configuration.buttonType;\n savedConfiguration.buttonName = configuration.buttonName;\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n updates.push(2 /* TargetUpdates.UPDATED_BUTTONS */);\n }\n setTimeout(function () { return _this.emit(\"target-update\" /* RemoteControllerEvents.TARGET_UPDATED */, targetConfiguration, updates); }, 0);\n this.updatedTargetConfiguration(); // set response\n return 0 /* HAPStatus.SUCCESS */;\n };\n RemoteController.prototype.handleRemoveTarget = function (targetConfiguration) {\n var _this = this;\n if (!targetConfiguration) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n var configuredTarget = this.targetConfigurations.get(targetConfiguration.targetIdentifier);\n if (!configuredTarget) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n if (targetConfiguration.buttonConfiguration) {\n for (var key in targetConfiguration.buttonConfiguration) {\n if (Object.prototype.hasOwnProperty.call(targetConfiguration.buttonConfiguration, key)) {\n delete configuredTarget.buttonConfiguration[key];\n }\n }\n debug(\"Removed %d button configurations of target '%s' (%d)\", Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);\n setTimeout(function () { return _this.emit(\"target-update\" /* RemoteControllerEvents.TARGET_UPDATED */, configuredTarget, [3 /* TargetUpdates.REMOVED_BUTTONS */]); }, 0);\n }\n else {\n this.targetConfigurations.delete(targetConfiguration.targetIdentifier);\n debug(\"Target '%s' (%d) was removed\", configuredTarget.targetName, configuredTarget.targetIdentifier);\n setTimeout(function () { return _this.emit(\"target-remove\" /* RemoteControllerEvents.TARGET_REMOVED */, targetConfiguration.targetIdentifier); }, 0);\n var keys = Object.keys(this.targetConfigurations);\n this.setActiveIdentifier(keys.length === 0 ? 0 : parseInt(keys[0], 10)); // switch to next available remote\n }\n this.updatedTargetConfiguration(); // set response\n return 0 /* HAPStatus.SUCCESS */;\n };\n RemoteController.prototype.handleResetTargets = function (targetConfiguration) {\n var _this = this;\n if (targetConfiguration) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n debug(\"Resetting all target configurations\");\n this.targetConfigurations = new Map();\n this.updatedTargetConfiguration(); // set response\n setTimeout(function () { return _this.emit(\"targets-reset\" /* RemoteControllerEvents.TARGETS_RESET */); }, 0);\n this.setActiveIdentifier(0); // resetting active identifier (also sets active to false)\n return 0 /* HAPStatus.SUCCESS */;\n };\n RemoteController.prototype.handleListTargets = function (targetConfiguration) {\n if (targetConfiguration) {\n return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;\n }\n // this.targetConfigurationsString is updated after each change, so we basically don't need to do anything here\n debug(\"Returning \" + Object.keys(this.targetConfigurations).length + \" target configurations\");\n return 0 /* HAPStatus.SUCCESS */;\n };\n RemoteController.prototype.handleActiveWrite = function (value, callback, connection) {\n if (this.activeIdentifier === 0) {\n debug(\"Tried to change active state. There is no active target set though\");\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n if (this.activeConnection) {\n this.activeConnection.removeListener(\"closed\" /* HAPConnectionEvent.CLOSED */, this.activeConnectionDisconnectListener);\n this.activeConnection = undefined;\n this.activeConnectionDisconnectListener = undefined;\n }\n this.activeConnection = value ? connection : undefined;\n if (this.activeConnection) { // register listener when hap connection disconnects\n this.activeConnectionDisconnectListener = this.handleActiveSessionDisconnected.bind(this, this.activeConnection);\n this.activeConnection.on(\"closed\" /* HAPConnectionEvent.CLOSED */, this.activeConnectionDisconnectListener);\n }\n var activeTarget = this.targetConfigurations.get(this.activeIdentifier);\n if (!activeTarget) {\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n debug(\"Remote with activeTarget '%s' (%d) was set to %s\", activeTarget.targetName, this.activeIdentifier, value ? \"ACTIVE\" : \"INACTIVE\");\n callback();\n this.emit(\"active-change\" /* RemoteControllerEvents.ACTIVE_CHANGE */, value);\n };\n RemoteController.prototype.setInactive = function () {\n var _this = this;\n if (this.activeConnection === undefined) {\n return;\n }\n this.activeConnection.removeListener(\"closed\" /* HAPConnectionEvent.CLOSED */, this.activeConnectionDisconnectListener);\n this.activeConnection = undefined;\n this.activeConnectionDisconnectListener = undefined;\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.Active).updateValue(false);\n debug(\"Remote was set to INACTIVE\");\n setTimeout(function () { return _this.emit(\"active-change\" /* RemoteControllerEvents.ACTIVE_CHANGE */, false); }, 0);\n };\n RemoteController.prototype.handleActiveSessionDisconnected = function (connection) {\n if (connection !== this.activeConnection) {\n return;\n }\n debug(\"Active hap session disconnected!\");\n this.setInactive();\n };\n RemoteController.prototype.sendButtonEvent = function (button, buttonState) {\n var buttonID = this.buttons[button];\n if (buttonID === undefined || buttonID === 0) {\n throw new Error(\"Tried sending button event for unsupported button (\" + button + \")\");\n }\n if (this.activeIdentifier === 0) { // cannot press button if no device is selected\n throw new Error(\"Tried sending button event although no target was selected\");\n }\n if (!this.isActive()) { // cannot press button if device is not active (aka no Apple TV is listening)\n throw new Error(\"Tried sending button event although target was not marked as active\");\n }\n if (button === 11 /* ButtonType.SIRI */ && this.audioSupported) {\n if (buttonState === 1 /* ButtonState.DOWN */) { // start streaming session\n this.handleSiriAudioStart();\n }\n else if (buttonState === 0 /* ButtonState.UP */) { // stop streaming session\n this.handleSiriAudioStop();\n }\n return;\n }\n var buttonIdTlv = tlv.encode(1 /* ButtonEvent.BUTTON_ID */, buttonID);\n var buttonStateTlv = tlv.encode(2 /* ButtonEvent.BUTTON_STATE */, buttonState);\n var timestampTlv = tlv.encode(3 /* ButtonEvent.TIMESTAMP */, tlv.writeVariableUIntLE(new Date().getTime()));\n var activeIdentifierTlv = tlv.encode(4 /* ButtonEvent.ACTIVE_IDENTIFIER */, tlv.writeUInt32(this.activeIdentifier));\n this.lastButtonEvent = Buffer.concat([\n buttonIdTlv, buttonStateTlv, timestampTlv, activeIdentifierTlv,\n ]).toString(\"base64\");\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ButtonEvent).sendEventNotification(this.lastButtonEvent);\n };\n RemoteController.prototype.parseTargetConfigurationTLV = function (data) {\n var configTLV = tlv.decode(data);\n var identifier = tlv.readUInt32(configTLV[1 /* TargetConfigurationTypes.TARGET_IDENTIFIER */]);\n var name = undefined;\n if (configTLV[2 /* TargetConfigurationTypes.TARGET_NAME */]) {\n name = configTLV[2 /* TargetConfigurationTypes.TARGET_NAME */].toString();\n }\n var category = undefined;\n if (configTLV[3 /* TargetConfigurationTypes.TARGET_CATEGORY */]) {\n category = tlv.readUInt16(configTLV[3 /* TargetConfigurationTypes.TARGET_CATEGORY */]);\n }\n var buttonConfiguration = {};\n if (configTLV[4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */]) {\n var buttonConfigurationTLV = tlv.decodeList(configTLV[4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */], 1 /* ButtonConfigurationTypes.BUTTON_ID */);\n buttonConfigurationTLV.forEach(function (entry) {\n var buttonId = entry[1 /* ButtonConfigurationTypes.BUTTON_ID */][0];\n var buttonType = tlv.readUInt16(entry[2 /* ButtonConfigurationTypes.BUTTON_TYPE */]);\n var buttonName;\n if (entry[3 /* ButtonConfigurationTypes.BUTTON_NAME */]) {\n buttonName = entry[3 /* ButtonConfigurationTypes.BUTTON_NAME */].toString();\n }\n else {\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n buttonName = ButtonType[buttonType];\n }\n buttonConfiguration[buttonId] = {\n buttonID: buttonId,\n buttonType: buttonType,\n buttonName: buttonName,\n };\n });\n }\n return {\n targetIdentifier: identifier,\n targetName: name,\n targetCategory: category,\n buttonConfiguration: buttonConfiguration,\n };\n };\n RemoteController.prototype.updatedTargetConfiguration = function () {\n var e_3, _a, e_4, _b;\n var _c;\n var bufferList = [];\n try {\n for (var _d = tslib_1.__values(Object.values(this.targetConfigurations)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var configuration = _e.value;\n var targetIdentifier = tlv.encode(1 /* TargetConfigurationTypes.TARGET_IDENTIFIER */, tlv.writeUInt32(configuration.targetIdentifier));\n var targetName = tlv.encode(2 /* TargetConfigurationTypes.TARGET_NAME */, configuration.targetName);\n var targetCategory = tlv.encode(3 /* TargetConfigurationTypes.TARGET_CATEGORY */, tlv.writeUInt16(configuration.targetCategory));\n var buttonConfigurationBuffers = [];\n try {\n for (var _f = (e_4 = void 0, tslib_1.__values(configuration.buttonConfiguration.values())), _g = _f.next(); !_g.done; _g = _f.next()) {\n var value = _g.value;\n var tlvBuffer = tlv.encode(1 /* ButtonConfigurationTypes.BUTTON_ID */, value.buttonID, 2 /* ButtonConfigurationTypes.BUTTON_TYPE */, tlv.writeUInt16(value.buttonType));\n if (value.buttonName) {\n tlvBuffer = Buffer.concat([\n tlvBuffer,\n tlv.encode(3 /* ButtonConfigurationTypes.BUTTON_NAME */, value.buttonName),\n ]);\n }\n buttonConfigurationBuffers.push(tlvBuffer);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_g && !_g.done && (_b = _f.return)) _b.call(_f);\n }\n finally { if (e_4) throw e_4.error; }\n }\n var buttonConfiguration = tlv.encode(4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */, Buffer.concat(buttonConfigurationBuffers));\n var targetConfiguration = Buffer.concat([targetIdentifier, targetName, targetCategory, buttonConfiguration]);\n bufferList.push(tlv.encode(2 /* TargetControlList.TARGET_CONFIGURATION */, targetConfiguration));\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n }\n finally { if (e_3) throw e_3.error; }\n }\n this.targetConfigurationsString = Buffer.concat(bufferList).toString(\"base64\");\n (_c = this.stateChangeDelegate) === null || _c === void 0 ? void 0 : _c.call(this);\n };\n RemoteController.prototype.buildTargetControlSupportedConfigurationTLV = function (configuration) {\n var maximumTargets = tlv.encode(1 /* TargetControlCommands.MAXIMUM_TARGETS */, configuration.maximumTargets);\n var ticksPerSecond = tlv.encode(2 /* TargetControlCommands.TICKS_PER_SECOND */, tlv.writeVariableUIntLE(configuration.ticksPerSecond));\n var supportedButtonConfigurationBuffers = [];\n configuration.supportedButtonConfiguration.forEach(function (value) {\n var tlvBuffer = tlv.encode(1 /* SupportedButtonConfigurationTypes.BUTTON_ID */, value.buttonID, 2 /* SupportedButtonConfigurationTypes.BUTTON_TYPE */, tlv.writeUInt16(value.buttonType));\n supportedButtonConfigurationBuffers.push(tlvBuffer);\n });\n var supportedButtonConfiguration = tlv.encode(3 /* TargetControlCommands.SUPPORTED_BUTTON_CONFIGURATION */, Buffer.concat(supportedButtonConfigurationBuffers));\n var type = tlv.encode(4 /* TargetControlCommands.TYPE */, configuration.hardwareImplemented ? 1 : 0);\n return Buffer.concat([maximumTargets, ticksPerSecond, supportedButtonConfiguration, type]).toString(\"base64\");\n };\n // --------------------------------- SIRI/DATA STREAM --------------------------------\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RemoteController.prototype.handleTargetControlWhoAmI = function (connection, message) {\n var targetIdentifier = message.identifier;\n this.dataStreamConnections.set(targetIdentifier, connection);\n debug(\"Discovered HDS connection for targetIdentifier %s\", targetIdentifier);\n connection.addProtocolHandler(\"dataSend\" /* Protocols.DATA_SEND */, this);\n };\n RemoteController.prototype.handleSiriAudioStart = function () {\n if (!this.audioSupported) {\n throw new Error(\"Cannot start siri stream on remote where siri is not supported\");\n }\n if (!this.isActive()) {\n debug(\"Tried opening Siri audio stream, however no controller is connected!\");\n return;\n }\n if (this.activeAudioSession && (!this.activeAudioSession.isClosing() || this.nextAudioSession)) {\n // there is already a session running, which is not in closing state and/or there is even already a\n // nextAudioSession running. ignoring start request\n debug(\"Tried opening Siri audio stream, however there is already one in progress\");\n return;\n }\n var connection = this.dataStreamConnections.get(this.activeIdentifier); // get connection for current target\n if (connection === undefined) { // target seems not connected, ignore it\n debug(\"Tried opening Siri audio stream however target is not connected via HDS\");\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n var audioSession = new SiriAudioSession(connection, this.selectedAudioConfiguration, this.audioProducerConstructor, this.audioProducerOptions);\n if (!this.activeAudioSession) {\n this.activeAudioSession = audioSession;\n }\n else {\n // we checked above that this only happens if the activeAudioSession is in closing state,\n // so no collision with the input device can happen\n this.nextAudioSession = audioSession;\n }\n audioSession.on(\"close\" /* SiriAudioSessionEvents.CLOSE */, this.handleSiriAudioSessionClosed.bind(this, audioSession));\n audioSession.start();\n };\n RemoteController.prototype.handleSiriAudioStop = function () {\n if (this.activeAudioSession) {\n if (!this.activeAudioSession.isClosing()) {\n this.activeAudioSession.stop();\n return;\n }\n else if (this.nextAudioSession && !this.nextAudioSession.isClosing()) {\n this.nextAudioSession.stop();\n return;\n }\n }\n debug(\"handleSiriAudioStop called although no audio session was started\");\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RemoteController.prototype.handleDataSendAckEvent = function (message) {\n var streamId = message.streamId;\n var endOfStream = message.endOfStream;\n if (this.activeAudioSession && this.activeAudioSession.streamId === streamId) {\n this.activeAudioSession.handleDataSendAckEvent(endOfStream);\n }\n else if (this.nextAudioSession && this.nextAudioSession.streamId === streamId) {\n this.nextAudioSession.handleDataSendAckEvent(endOfStream);\n }\n else {\n debug(\"Received dataSend acknowledgment event for unknown streamId '%s'\", streamId);\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RemoteController.prototype.handleDataSendCloseEvent = function (message) {\n var streamId = message.streamId;\n var reason = message.reason;\n if (this.activeAudioSession && this.activeAudioSession.streamId === streamId) {\n this.activeAudioSession.handleDataSendCloseEvent(reason);\n }\n else if (this.nextAudioSession && this.nextAudioSession.streamId === streamId) {\n this.nextAudioSession.handleDataSendCloseEvent(reason);\n }\n else {\n debug(\"Received dataSend close event for unknown streamId '%s'\", streamId);\n }\n };\n RemoteController.prototype.handleSiriAudioSessionClosed = function (session) {\n if (session === this.activeAudioSession) {\n this.activeAudioSession = this.nextAudioSession;\n this.nextAudioSession = undefined;\n }\n else if (session === this.nextAudioSession) {\n this.nextAudioSession = undefined;\n }\n };\n RemoteController.prototype.handleDataStreamConnectionClosed = function (connection) {\n var e_5, _a;\n try {\n for (var _b = tslib_1.__values(this.dataStreamConnections), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = tslib_1.__read(_c.value, 2), targetIdentifier = _d[0], connection0 = _d[1];\n if (connection === connection0) {\n debug(\"HDS connection disconnected for targetIdentifier %s\", targetIdentifier);\n this.dataStreamConnections.delete(targetIdentifier);\n break;\n }\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_5) throw e_5.error; }\n }\n };\n // ------------------------------- AUDIO CONFIGURATION -------------------------------\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RemoteController.prototype.handleSelectedAudioConfigurationWrite = function (value, callback) {\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n var selectedAudioStreamConfiguration = tlv.decode(objects[1 /* SelectedAudioInputStreamConfigurationTypes.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION */]);\n var codec = selectedAudioStreamConfiguration[1 /* AudioCodecConfigurationTypes.CODEC_TYPE */][0];\n var parameters = tlv.decode(selectedAudioStreamConfiguration[2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */]);\n var channels = parameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];\n var bitrate = parameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];\n var samplerate = parameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];\n this.selectedAudioConfiguration = {\n codecType: codec,\n parameters: {\n channels: channels,\n bitrate: bitrate,\n samplerate: samplerate,\n rtpTime: 20,\n },\n };\n this.selectedAudioConfigurationString = RemoteController.buildSelectedAudioConfigurationTLV({\n audioCodecConfiguration: this.selectedAudioConfiguration,\n });\n callback();\n };\n RemoteController.buildSupportedAudioConfigurationTLV = function (configuration) {\n var codecConfigurationTLV = RemoteController.buildCodecConfigurationTLV(configuration.audioCodecConfiguration);\n var supportedAudioStreamConfiguration = tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurationTLV);\n return supportedAudioStreamConfiguration.toString(\"base64\");\n };\n RemoteController.buildSelectedAudioConfigurationTLV = function (configuration) {\n var codecConfigurationTLV = RemoteController.buildCodecConfigurationTLV(configuration.audioCodecConfiguration);\n var supportedAudioStreamConfiguration = tlv.encode(1 /* SelectedAudioInputStreamConfigurationTypes.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION */, codecConfigurationTLV);\n return supportedAudioStreamConfiguration.toString(\"base64\");\n };\n RemoteController.buildCodecConfigurationTLV = function (codecConfiguration) {\n var parameters = codecConfiguration.parameters;\n var parametersTLV = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, parameters.channels, 2 /* AudioCodecParametersTypes.BIT_RATE */, parameters.bitrate, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, parameters.samplerate);\n if (parameters.rtpTime) {\n parametersTLV = Buffer.concat([\n parametersTLV,\n tlv.encode(4 /* AudioCodecParametersTypes.PACKET_TIME */, parameters.rtpTime),\n ]);\n }\n return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, codecConfiguration.codecType, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, parametersTLV);\n };\n // -----------------------------------------------------------------------------------\n /**\n * @private\n */\n RemoteController.prototype.constructServices = function () {\n var _a;\n this.targetControlManagementService = new Service_1.Service.TargetControlManagement(\"\", \"\");\n this.targetControlManagementService.setCharacteristic(Characteristic_1.Characteristic.TargetControlSupportedConfiguration, this.supportedConfiguration);\n this.targetControlManagementService.setCharacteristic(Characteristic_1.Characteristic.TargetControlList, this.targetConfigurationsString);\n this.targetControlManagementService.setPrimaryService();\n // you can also expose multiple TargetControl services to control multiple apple tvs simultaneously.\n // should we extend this class to support multiple TargetControl services or should users just create a second accessory?\n this.targetControlService = new Service_1.Service.TargetControl(\"\", \"\");\n this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier, 0);\n this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.Active, false);\n this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.ButtonEvent, this.lastButtonEvent);\n if (this.audioSupported) {\n this.siriService = new Service_1.Service.Siri(\"\", \"\");\n this.siriService.setCharacteristic(Characteristic_1.Characteristic.SiriInputType, Characteristic_1.Characteristic.SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV);\n this.audioStreamManagementService = new Service_1.Service.AudioStreamManagement(\"\", \"\");\n this.audioStreamManagementService.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioConfiguration);\n this.audioStreamManagementService.setCharacteristic(Characteristic_1.Characteristic.SelectedAudioStreamConfiguration, this.selectedAudioConfigurationString);\n this.dataStreamManagement = new datastream_1.DataStreamManagement();\n this.siriService.addLinkedService(this.dataStreamManagement.getService());\n this.siriService.addLinkedService(this.audioStreamManagementService);\n }\n return {\n targetControlManagement: this.targetControlManagementService,\n targetControl: this.targetControlService,\n siri: this.siriService,\n audioStreamManagement: this.audioStreamManagementService,\n dataStreamTransportManagement: (_a = this.dataStreamManagement) === null || _a === void 0 ? void 0 : _a.getService(),\n };\n };\n /**\n * @private\n */\n RemoteController.prototype.initWithServices = function (serviceMap) {\n this.targetControlManagementService = serviceMap.targetControlManagement;\n this.targetControlService = serviceMap.targetControl;\n this.siriService = serviceMap.siri;\n this.audioStreamManagementService = serviceMap.audioStreamManagement;\n this.dataStreamManagement = new datastream_1.DataStreamManagement(serviceMap.dataStreamTransportManagement);\n };\n /**\n * @private\n */\n RemoteController.prototype.configureServices = function () {\n var _a;\n var _this = this;\n if (!this.targetControlManagementService || !this.targetControlService) {\n throw new Error(\"Unexpected state: Services not configured!\"); // playing it save\n }\n this.targetControlManagementService.getCharacteristic(Characteristic_1.Characteristic.TargetControlList)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(null, _this.targetConfigurationsString);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, this.handleTargetControlWrite.bind(this));\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.activeIdentifier);\n });\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.Active)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.isActive());\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback, context, connection) {\n if (!connection) {\n debug(\"Set event handler for Remote.Active cannot be called from plugin. Connection undefined!\");\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n _this.handleActiveWrite(value, callback, connection);\n });\n this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ButtonEvent)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(undefined, _this.lastButtonEvent);\n });\n if (this.audioSupported) {\n this.audioStreamManagementService.getCharacteristic(Characteristic_1.Characteristic.SelectedAudioStreamConfiguration)\n .on(\"get\" /* CharacteristicEventTypes.GET */, function (callback) {\n callback(null, _this.selectedAudioConfigurationString);\n })\n .on(\"set\" /* CharacteristicEventTypes.SET */, this.handleSelectedAudioConfigurationWrite.bind(this))\n .updateValue(this.selectedAudioConfigurationString);\n this.dataStreamManagement\n .onEventMessage(\"targetControl\" /* Protocols.TARGET_CONTROL */, \"whoami\" /* Topics.WHOAMI */, this.handleTargetControlWhoAmI.bind(this))\n .onServerEvent(\"connection-closed\" /* DataStreamServerEvent.CONNECTION_CLOSED */, this.handleDataStreamConnectionClosed.bind(this));\n this.eventHandler = (_a = {},\n _a[\"ack\" /* Topics.ACK */] = this.handleDataSendAckEvent.bind(this),\n _a[\"close\" /* Topics.CLOSE */] = this.handleDataSendCloseEvent.bind(this),\n _a);\n }\n };\n /**\n * @private\n */\n RemoteController.prototype.handleControllerRemoved = function () {\n var _a;\n this.targetControlManagementService = undefined;\n this.targetControlService = undefined;\n this.siriService = undefined;\n this.audioStreamManagementService = undefined;\n this.eventHandler = undefined;\n this.requestHandler = undefined;\n (_a = this.dataStreamManagement) === null || _a === void 0 ? void 0 : _a.destroy();\n this.dataStreamManagement = undefined;\n // the call to dataStreamManagement.destroy will close any open data stream connection\n // which will result in a call to this.handleDataStreamConnectionClosed, cleaning up this.dataStreamConnections.\n // It will also result in a call to SiriAudioSession.handleDataStreamConnectionClosed (if there are any open session)\n // which again results in a call to this.handleSiriAudioSessionClosed,cleaning up this.activeAudioSession and this.nextAudioSession.\n };\n /**\n * @private\n */\n RemoteController.prototype.handleFactoryReset = function () {\n debug(\"Running factory reset. Resetting targets...\");\n this.handleResetTargets(undefined);\n this.lastButtonEvent = \"\";\n };\n /**\n * @private\n */\n RemoteController.prototype.serialize = function () {\n if (!this.activeIdentifier && Object.keys(this.targetConfigurations).length === 0) {\n return undefined;\n }\n return {\n activeIdentifier: this.activeIdentifier,\n targetConfigurations: tslib_1.__spreadArray([], tslib_1.__read(this.targetConfigurations), false).reduce(function (obj, _a) {\n var _b = tslib_1.__read(_a, 2), key = _b[0], value = _b[1];\n obj[key] = value;\n return obj;\n }, {}),\n };\n };\n /**\n * @private\n */\n RemoteController.prototype.deserialize = function (serialized) {\n this.activeIdentifier = serialized.activeIdentifier;\n this.targetConfigurations = Object.entries(serialized.targetConfigurations).reduce(function (map, _a) {\n var _b = tslib_1.__read(_a, 2), key = _b[0], value = _b[1];\n var identifier = parseInt(key, 10);\n map.set(identifier, value);\n return map;\n }, new Map());\n this.updatedTargetConfiguration();\n };\n /**\n * @private\n */\n RemoteController.prototype.setupStateChangeDelegate = function (delegate) {\n this.stateChangeDelegate = delegate;\n };\n return RemoteController;\n}(events_1.EventEmitter));\nexports.RemoteController = RemoteController;\n// noinspection JSUnusedGlobalSymbols\n/**\n * @deprecated - only there for backwards compatibility, please use {@link RemoteController} directly\n * @group Apple TV Remote\n */\nvar HomeKitRemoteController = /** @class */ (function (_super) {\n tslib_1.__extends(HomeKitRemoteController, _super);\n function HomeKitRemoteController() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return HomeKitRemoteController;\n}(RemoteController)); // backwards compatibility\nexports.HomeKitRemoteController = HomeKitRemoteController;\n/**\n * @group Apple TV Remote\n */\nvar SiriAudioSessionEvents;\n(function (SiriAudioSessionEvents) {\n SiriAudioSessionEvents[\"CLOSE\"] = \"close\";\n})(SiriAudioSessionEvents = exports.SiriAudioSessionEvents || (exports.SiriAudioSessionEvents = {}));\n/**\n * Represents an ongoing audio transmission\n * @group Apple TV Remote\n */\nvar SiriAudioSession = /** @class */ (function (_super) {\n tslib_1.__extends(SiriAudioSession, _super);\n function SiriAudioSession(connection, selectedAudioConfiguration, producerConstructor, \n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\n producerOptions) {\n var _this = _super.call(this) || this;\n _this.producerRunning = false; // indicates if the producer is running\n /**\n * @private file private API\n */\n _this.state = 0 /* SiriAudioSessionState.STARTING */;\n _this.endOfStream = false;\n _this.audioFrameQueue = [];\n _this.maxQueueSize = 1024;\n _this.sequenceNumber = 0;\n _this.connection = connection;\n _this.selectedAudioConfiguration = selectedAudioConfiguration;\n _this.producer = new producerConstructor(_this.handleSiriAudioFrame.bind(_this), _this.handleProducerError.bind(_this), producerOptions);\n _this.connection.on(\"closed\" /* DataStreamConnectionEvent.CLOSED */, _this.closeListener = _this.handleDataStreamConnectionClosed.bind(_this));\n return _this;\n }\n /**\n * Called when siri button is pressed\n */\n SiriAudioSession.prototype.start = function () {\n var _this = this;\n debug(\"Sending request to start siri audio stream\");\n // opening dataSend\n this.connection.sendRequest(\"dataSend\" /* Protocols.DATA_SEND */, \"open\" /* Topics.OPEN */, {\n target: \"controller\",\n type: \"audio.siri\",\n }, function (error, status, message) {\n if (_this.state === 3 /* SiriAudioSessionState.CLOSED */) {\n debug(\"Ignoring dataSend open response as the session is already closed\");\n return;\n }\n assert_1.default.strictEqual(_this.state, 0 /* SiriAudioSessionState.STARTING */);\n _this.state = 1 /* SiriAudioSessionState.SENDING */;\n if (error || status) {\n if (error) { // errors get produced by hap-nodejs\n debug(\"Error occurred trying to start siri audio stream: %s\", error.message);\n }\n else if (status) { // status codes are those returned by the hds response\n debug(\"Controller responded with non-zero status code: %s\", datastream_1.HDSStatus[status]);\n }\n _this.closed();\n }\n else {\n _this.streamId = message.streamId;\n if (!_this.producerRunning) { // audio producer errored in the meantime\n _this.sendDataSendCloseEvent(3 /* HDSProtocolSpecificErrorReason.CANCELLED */);\n }\n else {\n debug(\"Successfully setup siri audio stream with streamId %d\", _this.streamId);\n }\n }\n });\n this.startAudioProducer(); // start audio producer and queue frames in the meantime\n };\n /**\n * @returns if the audio session is closing\n */\n SiriAudioSession.prototype.isClosing = function () {\n return this.state >= 2 /* SiriAudioSessionState.CLOSING */;\n };\n /**\n * Called when siri button is released (or active identifier is changed to another device)\n */\n SiriAudioSession.prototype.stop = function () {\n (0, assert_1.default)(this.state <= 1 /* SiriAudioSessionState.SENDING */, \"state was higher than SENDING\");\n debug(\"Stopping siri audio stream with streamId %d\", this.streamId);\n this.endOfStream = true; // mark as endOfStream\n this.stopAudioProducer();\n if (this.state === 1 /* SiriAudioSessionState.SENDING */) {\n this.handleSiriAudioFrame(undefined); // send out last few audio frames with endOfStream property set\n this.state = 2 /* SiriAudioSessionState.CLOSING */; // we are waiting for an acknowledgment (triggered by endOfStream property)\n }\n else { // if state is not SENDING (aka state is STARTING) the callback for DATA_SEND OPEN did not yet return (or never will)\n this.closed();\n }\n };\n SiriAudioSession.prototype.startAudioProducer = function () {\n var _this = this;\n this.producer.startAudioProduction(this.selectedAudioConfiguration);\n this.producerRunning = true;\n this.producerTimer = setTimeout(function () {\n debug(\"Didn't receive any frames from audio producer for stream with streamId %s. Canceling the stream now.\", _this.streamId);\n _this.producerTimer = undefined;\n _this.handleProducerError(3 /* HDSProtocolSpecificErrorReason.CANCELLED */);\n }, 3000);\n this.producerTimer.unref();\n };\n SiriAudioSession.prototype.stopAudioProducer = function () {\n this.producer.stopAudioProduction();\n this.producerRunning = false;\n if (this.producerTimer) {\n clearTimeout(this.producerTimer);\n this.producerTimer = undefined;\n }\n };\n SiriAudioSession.prototype.handleSiriAudioFrame = function (frame) {\n var _this = this;\n if (this.state >= 2 /* SiriAudioSessionState.CLOSING */) {\n return;\n }\n if (this.producerTimer) { // if producerTimer is defined, then this is the first frame we are receiving\n clearTimeout(this.producerTimer);\n this.producerTimer = undefined;\n }\n if (frame && this.audioFrameQueue.length < this.maxQueueSize) { // add frame to queue whilst it is not full\n this.audioFrameQueue.push(frame);\n }\n if (this.state !== 1 /* SiriAudioSessionState.SENDING */) { // dataSend isn't open yet\n return;\n }\n var queued;\n var _loop_1 = function () {\n var packets = [];\n queued.forEach(function (frame) {\n var packetData = {\n data: frame.data,\n metadata: {\n rms: new datastream_1.Float32(frame.rms),\n sequenceNumber: new datastream_1.Int64(_this.sequenceNumber++),\n },\n };\n packets.push(packetData);\n });\n var message = {\n packets: packets,\n streamId: new datastream_1.Int64(this_1.streamId),\n endOfStream: this_1.endOfStream,\n };\n try {\n this_1.connection.sendEvent(\"dataSend\" /* Protocols.DATA_SEND */, \"data\" /* Topics.DATA */, message);\n }\n catch (error) {\n debug(\"Error occurred when trying to send audio frame of hds connection: %s\", error.message);\n this_1.stopAudioProducer();\n this_1.closed();\n }\n if (this_1.endOfStream) {\n return \"break\";\n }\n };\n var this_1 = this;\n while ((queued = this.popSome()) !== null) {\n var state_1 = _loop_1();\n if (state_1 === \"break\")\n break;\n }\n };\n SiriAudioSession.prototype.handleProducerError = function (error) {\n if (this.state >= 2 /* SiriAudioSessionState.CLOSING */) {\n return;\n }\n this.stopAudioProducer(); // ensure backend is closed\n if (this.state === 1 /* SiriAudioSessionState.SENDING */) { // if state is less than sending dataSend isn't open (yet)\n this.sendDataSendCloseEvent(error); // cancel submission\n }\n };\n SiriAudioSession.prototype.handleDataSendAckEvent = function (endOfStream) {\n assert_1.default.strictEqual(endOfStream, true);\n debug(\"Received acknowledgment for siri audio stream with streamId %s, closing it now\", this.streamId);\n this.sendDataSendCloseEvent(0 /* HDSProtocolSpecificErrorReason.NORMAL */);\n };\n SiriAudioSession.prototype.handleDataSendCloseEvent = function (reason) {\n // @ts-expect-error: forceConsistentCasingInFileNames compiler option\n debug(\"Received close event from controller with reason %s for stream with streamId %s\", datastream_1.HDSProtocolSpecificErrorReason[reason], this.streamId);\n if (this.state <= 1 /* SiriAudioSessionState.SENDING */) {\n this.stopAudioProducer();\n }\n this.closed();\n };\n SiriAudioSession.prototype.sendDataSendCloseEvent = function (reason) {\n (0, assert_1.default)(this.state >= 1 /* SiriAudioSessionState.SENDING */, \"state was less than SENDING\");\n (0, assert_1.default)(this.state <= 2 /* SiriAudioSessionState.CLOSING */, \"state was higher than CLOSING\");\n this.connection.sendEvent(\"dataSend\" /* Protocols.DATA_SEND */, \"close\" /* Topics.CLOSE */, {\n streamId: new datastream_1.Int64(this.streamId),\n reason: new datastream_1.Int64(reason),\n });\n this.closed();\n };\n SiriAudioSession.prototype.handleDataStreamConnectionClosed = function () {\n debug(\"Closing audio session with streamId %d\", this.streamId);\n if (this.state <= 1 /* SiriAudioSessionState.SENDING */) {\n this.stopAudioProducer();\n }\n this.closed();\n };\n SiriAudioSession.prototype.closed = function () {\n var lastState = this.state;\n this.state = 3 /* SiriAudioSessionState.CLOSED */;\n if (lastState !== 3 /* SiriAudioSessionState.CLOSED */) {\n this.emit(\"close\" /* SiriAudioSessionEvents.CLOSE */);\n this.connection.removeListener(\"closed\" /* DataStreamConnectionEvent.CLOSED */, this.closeListener);\n }\n this.removeAllListeners();\n };\n SiriAudioSession.prototype.popSome = function () {\n if (this.audioFrameQueue.length < 5 && !this.endOfStream) {\n return null;\n }\n var size = Math.min(this.audioFrameQueue.length, 5); // 5 frames per hap packet seems fine\n var result = [];\n for (var i = 0; i < size; i++) {\n var element = this.audioFrameQueue.shift(); // removes first element\n result.push(element);\n }\n return result;\n };\n return SiriAudioSession;\n}(events_1.EventEmitter));\nexports.SiriAudioSession = SiriAudioSession;\n//# sourceMappingURL=RemoteController.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./Controller\"), exports);\ntslib_1.__exportStar(require(\"./AdaptiveLightingController\"), exports);\ntslib_1.__exportStar(require(\"./RemoteController\"), exports);\ntslib_1.__exportStar(require(\"./CameraController\"), exports);\ntslib_1.__exportStar(require(\"./DoorbellController\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DataStreamManagement = exports.DataStreamStatus = void 0;\nvar tslib_1 = require(\"tslib\");\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar Characteristic_1 = require(\"../Characteristic\");\nvar Service_1 = require(\"../Service\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar DataStreamServer_1 = require(\"./DataStreamServer\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:DataStream:Management\");\nvar TransferTransportConfigurationTypes;\n(function (TransferTransportConfigurationTypes) {\n TransferTransportConfigurationTypes[TransferTransportConfigurationTypes[\"TRANSFER_TRANSPORT_CONFIGURATION\"] = 1] = \"TRANSFER_TRANSPORT_CONFIGURATION\";\n})(TransferTransportConfigurationTypes || (TransferTransportConfigurationTypes = {}));\nvar TransportTypeTypes;\n(function (TransportTypeTypes) {\n TransportTypeTypes[TransportTypeTypes[\"TRANSPORT_TYPE\"] = 1] = \"TRANSPORT_TYPE\";\n})(TransportTypeTypes || (TransportTypeTypes = {}));\nvar SetupDataStreamSessionTypes;\n(function (SetupDataStreamSessionTypes) {\n SetupDataStreamSessionTypes[SetupDataStreamSessionTypes[\"SESSION_COMMAND_TYPE\"] = 1] = \"SESSION_COMMAND_TYPE\";\n SetupDataStreamSessionTypes[SetupDataStreamSessionTypes[\"TRANSPORT_TYPE\"] = 2] = \"TRANSPORT_TYPE\";\n SetupDataStreamSessionTypes[SetupDataStreamSessionTypes[\"CONTROLLER_KEY_SALT\"] = 3] = \"CONTROLLER_KEY_SALT\";\n})(SetupDataStreamSessionTypes || (SetupDataStreamSessionTypes = {}));\nvar SetupDataStreamWriteResponseTypes;\n(function (SetupDataStreamWriteResponseTypes) {\n SetupDataStreamWriteResponseTypes[SetupDataStreamWriteResponseTypes[\"STATUS\"] = 1] = \"STATUS\";\n SetupDataStreamWriteResponseTypes[SetupDataStreamWriteResponseTypes[\"TRANSPORT_TYPE_SESSION_PARAMETERS\"] = 2] = \"TRANSPORT_TYPE_SESSION_PARAMETERS\";\n SetupDataStreamWriteResponseTypes[SetupDataStreamWriteResponseTypes[\"ACCESSORY_KEY_SALT\"] = 3] = \"ACCESSORY_KEY_SALT\";\n})(SetupDataStreamWriteResponseTypes || (SetupDataStreamWriteResponseTypes = {}));\nvar TransportSessionConfiguration;\n(function (TransportSessionConfiguration) {\n TransportSessionConfiguration[TransportSessionConfiguration[\"TCP_LISTENING_PORT\"] = 1] = \"TCP_LISTENING_PORT\";\n})(TransportSessionConfiguration || (TransportSessionConfiguration = {}));\nvar TransportType;\n(function (TransportType) {\n TransportType[TransportType[\"HOMEKIT_DATA_STREAM\"] = 0] = \"HOMEKIT_DATA_STREAM\";\n})(TransportType || (TransportType = {}));\nvar SessionCommandType;\n(function (SessionCommandType) {\n SessionCommandType[SessionCommandType[\"START_SESSION\"] = 0] = \"START_SESSION\";\n})(SessionCommandType || (SessionCommandType = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamStatus;\n(function (DataStreamStatus) {\n DataStreamStatus[DataStreamStatus[\"SUCCESS\"] = 0] = \"SUCCESS\";\n DataStreamStatus[DataStreamStatus[\"GENERIC_ERROR\"] = 1] = \"GENERIC_ERROR\";\n DataStreamStatus[DataStreamStatus[\"BUSY\"] = 2] = \"BUSY\";\n})(DataStreamStatus = exports.DataStreamStatus || (exports.DataStreamStatus = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamManagement = /** @class */ (function () {\n function DataStreamManagement(service) {\n // one server per accessory is probably the best practice\n this.dataStreamServer = new DataStreamServer_1.DataStreamServer(); // TODO how to handle Remote+future HKSV controller at the same time?\n this.lastSetupDataStreamTransportResponse = \"\"; // stripped. excludes ACCESSORY_KEY_SALT\n var supportedConfiguration = [TransportType.HOMEKIT_DATA_STREAM];\n this.supportedDataStreamTransportConfiguration = this.buildSupportedDataStreamTransportConfigurationTLV(supportedConfiguration);\n this.dataStreamTransportManagementService = service || this.constructService();\n this.setupServiceHandlers();\n }\n DataStreamManagement.prototype.destroy = function () {\n this.dataStreamServer.destroy(); // removes ALL listeners\n this.dataStreamTransportManagementService.getCharacteristic(Characteristic_1.Characteristic.SetupDataStreamTransport)\n .removeOnGet()\n .removeAllListeners(\"set\" /* CharacteristicEventTypes.SET */);\n this.lastSetupDataStreamTransportResponse = \"\";\n };\n /**\n * @returns the DataStreamTransportManagement service\n */\n DataStreamManagement.prototype.getService = function () {\n return this.dataStreamTransportManagementService;\n };\n /**\n * Registers a new event handler to handle incoming event messages.\n * The handler is only called for a connection if for the give protocol no ProtocolHandler\n * was registered on the connection level.\n *\n * @param protocol - name of the protocol to register the handler for\n * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - function to be called for every occurring event\n */\n DataStreamManagement.prototype.onEventMessage = function (protocol, event, handler) {\n this.dataStreamServer.onEventMessage(protocol, event, handler);\n return this;\n };\n /**\n * Removes a registered event handler.\n *\n * @param protocol - name of the protocol to unregister the handler for\n * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - registered event handler\n */\n DataStreamManagement.prototype.removeEventHandler = function (protocol, event, handler) {\n this.dataStreamServer.removeEventHandler(protocol, event, handler);\n return this;\n };\n /**\n * Registers a new request handler to handle incoming request messages.\n * The handler is only called for a connection if for the give protocol no ProtocolHandler\n * was registered on the connection level.\n *\n * @param protocol - name of the protocol to register the handler for\n * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - function to be called for every occurring request\n */\n DataStreamManagement.prototype.onRequestMessage = function (protocol, request, handler) {\n this.dataStreamServer.onRequestMessage(protocol, request, handler);\n return this;\n };\n /**\n * Removes a registered request handler.\n *\n * @param protocol - name of the protocol to unregister the handler for\n * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - registered request handler\n */\n DataStreamManagement.prototype.removeRequestHandler = function (protocol, request, handler) {\n this.dataStreamServer.removeRequestHandler(protocol, request, handler);\n return this;\n };\n /**\n * Forwards any event listener for an DataStreamServer event to the DataStreamServer instance\n *\n * @param event - the event to register for\n * @param listener - the event handler\n */\n DataStreamManagement.prototype.onServerEvent = function (event, listener) {\n // @ts-expect-error: event type\n this.dataStreamServer.on(event, listener);\n return this;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamManagement.prototype.handleSetupDataStreamTransportWrite = function (value, callback, connection) {\n var _this = this;\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n var sessionCommandType = objects[1 /* SetupDataStreamSessionTypes.SESSION_COMMAND_TYPE */][0];\n var transportType = objects[2 /* SetupDataStreamSessionTypes.TRANSPORT_TYPE */][0];\n var controllerKeySalt = objects[3 /* SetupDataStreamSessionTypes.CONTROLLER_KEY_SALT */];\n debug(\"Received setup write with command %s and transport type %s\", SessionCommandType[sessionCommandType], TransportType[transportType]);\n if (sessionCommandType === SessionCommandType.START_SESSION) {\n if (transportType !== TransportType.HOMEKIT_DATA_STREAM || controllerKeySalt.length !== 32) {\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n this.dataStreamServer.prepareSession(connection, controllerKeySalt, function (error, preparedSession) {\n if (error || !preparedSession) {\n callback(error !== null && error !== void 0 ? error : new Error(\"PreparedSession was undefined!\"));\n return;\n }\n var listeningPort = tlv.encode(1 /* TransportSessionConfiguration.TCP_LISTENING_PORT */, tlv.writeUInt16(preparedSession.port));\n var response = Buffer.concat([\n tlv.encode(1 /* SetupDataStreamWriteResponseTypes.STATUS */, 0 /* DataStreamStatus.SUCCESS */),\n tlv.encode(2 /* SetupDataStreamWriteResponseTypes.TRANSPORT_TYPE_SESSION_PARAMETERS */, listeningPort),\n ]);\n _this.lastSetupDataStreamTransportResponse = response.toString(\"base64\"); // save last response without accessory key salt\n response = Buffer.concat([\n response,\n tlv.encode(3 /* SetupDataStreamWriteResponseTypes.ACCESSORY_KEY_SALT */, preparedSession.accessoryKeySalt),\n ]);\n callback(null, response.toString(\"base64\"));\n });\n }\n else {\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n };\n DataStreamManagement.prototype.buildSupportedDataStreamTransportConfigurationTLV = function (supportedConfiguration) {\n var buffers = [];\n supportedConfiguration.forEach(function (type) {\n var transportType = tlv.encode(1 /* TransportTypeTypes.TRANSPORT_TYPE */, type);\n var transferTransportConfiguration = tlv.encode(1 /* TransferTransportConfigurationTypes.TRANSFER_TRANSPORT_CONFIGURATION */, transportType);\n buffers.push(transferTransportConfiguration);\n });\n return Buffer.concat(buffers).toString(\"base64\");\n };\n DataStreamManagement.prototype.constructService = function () {\n var dataStreamTransportManagement = new Service_1.Service.DataStreamTransportManagement(\"\", \"\");\n dataStreamTransportManagement.setCharacteristic(Characteristic_1.Characteristic.SupportedDataStreamTransportConfiguration, this.supportedDataStreamTransportConfiguration);\n dataStreamTransportManagement.setCharacteristic(Characteristic_1.Characteristic.Version, DataStreamServer_1.DataStreamServer.version);\n return dataStreamTransportManagement;\n };\n DataStreamManagement.prototype.setupServiceHandlers = function () {\n var _this = this;\n this.dataStreamTransportManagementService.getCharacteristic(Characteristic_1.Characteristic.SetupDataStreamTransport)\n .onGet(function () { return _this.lastSetupDataStreamTransportResponse; })\n .on(\"set\" /* CharacteristicEventTypes.SET */, function (value, callback, context, connection) {\n if (!connection) {\n debug(\"Set event handler for SetupDataStreamTransport cannot be called from plugin! Connection undefined!\");\n callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);\n return;\n }\n _this.handleSetupDataStreamTransportWrite(value, callback, connection);\n })\n .updateValue(this.lastSetupDataStreamTransportResponse);\n };\n return DataStreamManagement;\n}());\nexports.DataStreamManagement = DataStreamManagement;\n//# sourceMappingURL=DataStreamManagement.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DataStreamWriter = exports.DataStreamReader = exports.DataStreamParser = exports.DataFormatTags = exports.UUID = exports.SecondsSince2001 = exports.Float64 = exports.Float32 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.ValueWrapper = void 0;\nvar tslib_1 = require(\"tslib\");\nvar uuid = tslib_1.__importStar(require(\"../util/uuid\"));\nvar hapCrypto = tslib_1.__importStar(require(\"../util/hapCrypto\"));\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\n// welcome to hell :)\n// in this file lies madness and frustration. and It's not only about HDS. Also, JavaScript is hell\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:DataStream:Parser\");\nvar Magics = /** @class */ (function () {\n function Magics() {\n }\n Magics.TERMINATOR = { type: \"terminator\" };\n return Magics;\n}());\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar ValueWrapper = /** @class */ (function () {\n function ValueWrapper(value) {\n this.value = value;\n }\n ValueWrapper.prototype.equals = function (obj) {\n return this.constructor.name === obj.constructor.name && obj.value === this.value;\n };\n return ValueWrapper;\n}());\nexports.ValueWrapper = ValueWrapper;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Int8 = /** @class */ (function (_super) {\n tslib_1.__extends(Int8, _super);\n function Int8() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Int8;\n}(ValueWrapper));\nexports.Int8 = Int8;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Int16 = /** @class */ (function (_super) {\n tslib_1.__extends(Int16, _super);\n function Int16() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Int16;\n}(ValueWrapper));\nexports.Int16 = Int16;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Int32 = /** @class */ (function (_super) {\n tslib_1.__extends(Int32, _super);\n function Int32() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Int32;\n}(ValueWrapper));\nexports.Int32 = Int32;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Int64 = /** @class */ (function (_super) {\n tslib_1.__extends(Int64, _super);\n function Int64() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Int64;\n}(ValueWrapper));\nexports.Int64 = Int64;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Float32 = /** @class */ (function (_super) {\n tslib_1.__extends(Float32, _super);\n function Float32() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Float32;\n}(ValueWrapper));\nexports.Float32 = Float32;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Float64 = /** @class */ (function (_super) {\n tslib_1.__extends(Float64, _super);\n function Float64() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Float64;\n}(ValueWrapper));\nexports.Float64 = Float64;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar SecondsSince2001 = /** @class */ (function (_super) {\n tslib_1.__extends(SecondsSince2001, _super);\n function SecondsSince2001() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return SecondsSince2001;\n}(ValueWrapper));\nexports.SecondsSince2001 = SecondsSince2001;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar UUID = /** @class */ (function (_super) {\n tslib_1.__extends(UUID, _super);\n function UUID(value) {\n (0, assert_1.default)(uuid.isValid(value), \"invalid uuid format\");\n return _super.call(this, value) || this;\n }\n return UUID;\n}(ValueWrapper));\nexports.UUID = UUID;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataFormatTags;\n(function (DataFormatTags) {\n DataFormatTags[DataFormatTags[\"INVALID\"] = 0] = \"INVALID\";\n DataFormatTags[DataFormatTags[\"TRUE\"] = 1] = \"TRUE\";\n DataFormatTags[DataFormatTags[\"FALSE\"] = 2] = \"FALSE\";\n DataFormatTags[DataFormatTags[\"TERMINATOR\"] = 3] = \"TERMINATOR\";\n DataFormatTags[DataFormatTags[\"NULL\"] = 4] = \"NULL\";\n DataFormatTags[DataFormatTags[\"UUID\"] = 5] = \"UUID\";\n DataFormatTags[DataFormatTags[\"DATE\"] = 6] = \"DATE\";\n DataFormatTags[DataFormatTags[\"INTEGER_MINUS_ONE\"] = 7] = \"INTEGER_MINUS_ONE\";\n DataFormatTags[DataFormatTags[\"INTEGER_RANGE_START_0\"] = 8] = \"INTEGER_RANGE_START_0\";\n DataFormatTags[DataFormatTags[\"INTEGER_RANGE_STOP_39\"] = 46] = \"INTEGER_RANGE_STOP_39\";\n DataFormatTags[DataFormatTags[\"INT8\"] = 48] = \"INT8\";\n DataFormatTags[DataFormatTags[\"INT16LE\"] = 49] = \"INT16LE\";\n DataFormatTags[DataFormatTags[\"INT32LE\"] = 50] = \"INT32LE\";\n DataFormatTags[DataFormatTags[\"INT64LE\"] = 51] = \"INT64LE\";\n DataFormatTags[DataFormatTags[\"FLOAT32LE\"] = 53] = \"FLOAT32LE\";\n DataFormatTags[DataFormatTags[\"FLOAT64LE\"] = 54] = \"FLOAT64LE\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH_START\"] = 64] = \"UTF8_LENGTH_START\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH_STOP\"] = 96] = \"UTF8_LENGTH_STOP\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH8\"] = 97] = \"UTF8_LENGTH8\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH16LE\"] = 98] = \"UTF8_LENGTH16LE\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH32LE\"] = 99] = \"UTF8_LENGTH32LE\";\n DataFormatTags[DataFormatTags[\"UTF8_LENGTH64LE\"] = 100] = \"UTF8_LENGTH64LE\";\n DataFormatTags[DataFormatTags[\"UTF8_NULL_TERMINATED\"] = 111] = \"UTF8_NULL_TERMINATED\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH_START\"] = 112] = \"DATA_LENGTH_START\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH_STOP\"] = 144] = \"DATA_LENGTH_STOP\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH8\"] = 145] = \"DATA_LENGTH8\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH16LE\"] = 146] = \"DATA_LENGTH16LE\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH32LE\"] = 147] = \"DATA_LENGTH32LE\";\n DataFormatTags[DataFormatTags[\"DATA_LENGTH64LE\"] = 148] = \"DATA_LENGTH64LE\";\n DataFormatTags[DataFormatTags[\"DATA_TERMINATED\"] = 159] = \"DATA_TERMINATED\";\n DataFormatTags[DataFormatTags[\"COMPRESSION_START\"] = 160] = \"COMPRESSION_START\";\n DataFormatTags[DataFormatTags[\"COMPRESSION_STOP\"] = 207] = \"COMPRESSION_STOP\";\n DataFormatTags[DataFormatTags[\"ARRAY_LENGTH_START\"] = 208] = \"ARRAY_LENGTH_START\";\n DataFormatTags[DataFormatTags[\"ARRAY_LENGTH_STOP\"] = 222] = \"ARRAY_LENGTH_STOP\";\n DataFormatTags[DataFormatTags[\"ARRAY_TERMINATED\"] = 223] = \"ARRAY_TERMINATED\";\n DataFormatTags[DataFormatTags[\"DICTIONARY_LENGTH_START\"] = 224] = \"DICTIONARY_LENGTH_START\";\n DataFormatTags[DataFormatTags[\"DICTIONARY_LENGTH_STOP\"] = 238] = \"DICTIONARY_LENGTH_STOP\";\n DataFormatTags[DataFormatTags[\"DICTIONARY_TERMINATED\"] = 239] = \"DICTIONARY_TERMINATED\";\n})(DataFormatTags = exports.DataFormatTags || (exports.DataFormatTags = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamParser = /** @class */ (function () {\n function DataStreamParser() {\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamParser.decode = function (buffer) {\n var tag = buffer.readTag();\n if (tag === 0 /* DataFormatTags.INVALID */) {\n throw new Error(\"HDSDecoder: zero tag detected on index \" + buffer.readerIndex);\n }\n else if (tag === 1 /* DataFormatTags.TRUE */) {\n return buffer.readTrue();\n }\n else if (tag === 2 /* DataFormatTags.FALSE */) {\n return buffer.readFalse();\n }\n else if (tag === 3 /* DataFormatTags.TERMINATOR */) {\n return Magics.TERMINATOR;\n }\n else if (tag === 4 /* DataFormatTags.NULL */) {\n return null;\n }\n else if (tag === 5 /* DataFormatTags.UUID */) {\n return buffer.readUUID();\n }\n else if (tag === 6 /* DataFormatTags.DATE */) {\n return buffer.readSecondsSince2001_01_01();\n }\n else if (tag === 7 /* DataFormatTags.INTEGER_MINUS_ONE */) {\n return buffer.readNegOne();\n }\n else if (tag >= 8 /* DataFormatTags.INTEGER_RANGE_START_0 */ && tag <= 46 /* DataFormatTags.INTEGER_RANGE_STOP_39 */) {\n return buffer.readIntRange(tag); // integer values from 0-39\n }\n else if (tag === 48 /* DataFormatTags.INT8 */) {\n return buffer.readInt8();\n }\n else if (tag === 49 /* DataFormatTags.INT16LE */) {\n return buffer.readInt16LE();\n }\n else if (tag === 50 /* DataFormatTags.INT32LE */) {\n return buffer.readInt32LE();\n }\n else if (tag === 51 /* DataFormatTags.INT64LE */) {\n return buffer.readInt64LE();\n }\n else if (tag === 53 /* DataFormatTags.FLOAT32LE */) {\n return buffer.readFloat32LE();\n }\n else if (tag === 54 /* DataFormatTags.FLOAT64LE */) {\n return buffer.readFloat64LE();\n }\n else if (tag >= 64 /* DataFormatTags.UTF8_LENGTH_START */ && tag <= 96 /* DataFormatTags.UTF8_LENGTH_STOP */) {\n var length = tag - 64 /* DataFormatTags.UTF8_LENGTH_START */;\n return buffer.readUTF8(length);\n }\n else if (tag === 97 /* DataFormatTags.UTF8_LENGTH8 */) {\n return buffer.readUTF8_Length8();\n }\n else if (tag === 98 /* DataFormatTags.UTF8_LENGTH16LE */) {\n return buffer.readUTF8_Length16LE();\n }\n else if (tag === 99 /* DataFormatTags.UTF8_LENGTH32LE */) {\n return buffer.readUTF8_Length32LE();\n }\n else if (tag === 100 /* DataFormatTags.UTF8_LENGTH64LE */) {\n return buffer.readUTF8_Length64LE();\n }\n else if (tag === 111 /* DataFormatTags.UTF8_NULL_TERMINATED */) {\n return buffer.readUTF8_NULL_terminated();\n }\n else if (tag >= 112 /* DataFormatTags.DATA_LENGTH_START */ && tag <= 144 /* DataFormatTags.DATA_LENGTH_STOP */) {\n var length = tag - 112 /* DataFormatTags.DATA_LENGTH_START */;\n buffer.readData(length);\n }\n else if (tag === 145 /* DataFormatTags.DATA_LENGTH8 */) {\n return buffer.readData_Length8();\n }\n else if (tag === 146 /* DataFormatTags.DATA_LENGTH16LE */) {\n return buffer.readData_Length16LE();\n }\n else if (tag === 147 /* DataFormatTags.DATA_LENGTH32LE */) {\n return buffer.readData_Length32LE();\n }\n else if (tag === 148 /* DataFormatTags.DATA_LENGTH64LE */) {\n return buffer.readData_Length64LE();\n }\n else if (tag === 159 /* DataFormatTags.DATA_TERMINATED */) {\n return buffer.readData_terminated();\n }\n else if (tag >= 160 /* DataFormatTags.COMPRESSION_START */ && tag <= 207 /* DataFormatTags.COMPRESSION_STOP */) {\n var index = tag - 160 /* DataFormatTags.COMPRESSION_START */;\n return buffer.decompressData(index);\n }\n else if (tag >= 208 /* DataFormatTags.ARRAY_LENGTH_START */ && tag <= 222 /* DataFormatTags.ARRAY_LENGTH_STOP */) {\n var length = tag - 208 /* DataFormatTags.ARRAY_LENGTH_START */;\n var array = [];\n for (var i = 0; i < length; i++) {\n array.push(this.decode(buffer));\n }\n return array;\n }\n else if (tag === 223 /* DataFormatTags.ARRAY_TERMINATED */) {\n var array = [];\n var element = void 0;\n while ((element = this.decode(buffer)) !== Magics.TERMINATOR) {\n array.push(element);\n }\n return array;\n }\n else if (tag >= 224 /* DataFormatTags.DICTIONARY_LENGTH_START */ && tag <= 238 /* DataFormatTags.DICTIONARY_LENGTH_STOP */) {\n var length = tag - 224 /* DataFormatTags.DICTIONARY_LENGTH_START */;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var dictionary = {};\n for (var i = 0; i < length; i++) {\n var key = this.decode(buffer);\n dictionary[key] = this.decode(buffer);\n }\n return dictionary;\n }\n else if (tag === 239 /* DataFormatTags.DICTIONARY_TERMINATED */) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var dictionary = {};\n var key = void 0;\n while ((key = this.decode(buffer)) !== Magics.TERMINATOR) {\n dictionary[key] = this.decode(buffer); // decode value\n }\n return dictionary;\n }\n else {\n throw new Error(\"HDSDecoder: encountered unknown tag on index \" + buffer.readerIndex + \": \" + tag.toString(16));\n }\n };\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\n DataStreamParser.encode = function (data, buffer) {\n var _this = this;\n if (data === undefined) {\n throw new Error(\"HDSEncoder: cannot encode undefined\");\n }\n if (data === null) {\n buffer.writeTag(4 /* DataFormatTags.NULL */);\n return;\n }\n switch (typeof data) {\n case \"boolean\":\n if (data) {\n buffer.writeTrue();\n }\n else {\n buffer.writeFalse();\n }\n break;\n case \"number\":\n if (Number.isInteger(data)) {\n buffer.writeNumber(data);\n }\n else {\n buffer.writeFloat64LE(new Float64(data));\n }\n break;\n case \"string\":\n buffer.writeUTF8(data);\n break;\n case \"object\":\n if (Array.isArray(data)) {\n var length = data.length;\n if (length <= 12) {\n buffer.writeTag(208 /* DataFormatTags.ARRAY_LENGTH_START */ + length);\n }\n else {\n buffer.writeTag(223 /* DataFormatTags.ARRAY_TERMINATED */);\n }\n data.forEach(function (element) {\n _this.encode(element, buffer);\n });\n if (length > 12) {\n buffer.writeTag(3 /* DataFormatTags.TERMINATOR */);\n }\n }\n else if (data instanceof ValueWrapper) {\n if (data instanceof Int8) {\n buffer.writeInt8(data);\n }\n else if (data instanceof Int16) {\n buffer.writeInt16LE(data);\n }\n else if (data instanceof Int32) {\n buffer.writeInt32LE(data);\n }\n else if (data instanceof Int64) {\n buffer.writeInt64LE(data);\n }\n else if (data instanceof Float32) {\n buffer.writeFloat32LE(data);\n }\n else if (data instanceof Float64) {\n buffer.writeFloat64LE(data);\n }\n else if (data instanceof SecondsSince2001) {\n buffer.writeSecondsSince2001_01_01(data);\n }\n else if (data instanceof UUID) {\n buffer.writeUUID(data.value);\n }\n else {\n throw new Error(\"Unknown wrapped object 'ValueWrapper' of class \" + data.constructor.name);\n }\n }\n else if (data instanceof Buffer) {\n buffer.writeData(data);\n }\n else { // object is treated as dictionary\n var entries = Object.entries(data)\n .filter(function (entry) { return entry[1] !== undefined; }); // explicitly setting undefined will result in an entry here\n if (entries.length <= 14) {\n buffer.writeTag(224 /* DataFormatTags.DICTIONARY_LENGTH_START */ + entries.length);\n }\n else {\n buffer.writeTag(239 /* DataFormatTags.DICTIONARY_TERMINATED */);\n }\n entries.forEach(function (entry) {\n _this.encode(entry[0], buffer); // encode key\n _this.encode(entry[1], buffer); // encode value\n });\n if (entries.length > 14) {\n buffer.writeTag(3 /* DataFormatTags.TERMINATOR */);\n }\n }\n break;\n default:\n throw new Error(\"HDSEncoder: no idea how to encode value of type '\" + (typeof data) + \"': \" + data);\n }\n };\n return DataStreamParser;\n}());\nexports.DataStreamParser = DataStreamParser;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamReader = /** @class */ (function () {\n function DataStreamReader(data) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.trackedCompressedData = [];\n this.data = data;\n this.readerIndex = 0;\n }\n DataStreamReader.prototype.finished = function () {\n if (this.readerIndex < this.data.length) {\n var remainingHex = this.data.slice(this.readerIndex, this.data.length).toString(\"hex\");\n debug(\"WARNING Finished reading HDS stream, but there are still %d bytes remaining () %s\", this.data.length - this.readerIndex, remainingHex);\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamReader.prototype.decompressData = function (index) {\n if (index >= this.trackedCompressedData.length) {\n throw new Error(\"HDSDecoder: Tried decompression of data for an index out of range (index \" + index +\n \" and got \" + this.trackedCompressedData.length + \" elements)\");\n }\n return this.trackedCompressedData[index];\n };\n DataStreamReader.prototype.trackData = function (data) {\n this.trackedCompressedData.push(data);\n return data;\n };\n DataStreamReader.prototype.ensureLength = function (bytes) {\n if (this.readerIndex + bytes > this.data.length) {\n var remaining = this.data.length - this.readerIndex;\n throw new Error(\"HDSDecoder: End of data stream. Tried reading \" + bytes + \" bytes however got only \" + remaining + \" remaining!\");\n }\n };\n DataStreamReader.prototype.readTag = function () {\n this.ensureLength(1);\n return this.data.readUInt8(this.readerIndex++);\n };\n DataStreamReader.prototype.readTrue = function () {\n return this.trackData(true); // do those tag encoded values get cached?\n };\n DataStreamReader.prototype.readFalse = function () {\n return this.trackData(false);\n };\n DataStreamReader.prototype.readNegOne = function () {\n return this.trackData(-1);\n };\n DataStreamReader.prototype.readIntRange = function (tag) {\n return this.trackData(tag - 8 /* DataFormatTags.INTEGER_RANGE_START_0 */); // integer values from 0-39\n };\n DataStreamReader.prototype.readInt8 = function () {\n this.ensureLength(1);\n return this.trackData(this.data.readInt8(this.readerIndex++));\n };\n DataStreamReader.prototype.readInt16LE = function () {\n this.ensureLength(2);\n var value = this.data.readInt16LE(this.readerIndex);\n this.readerIndex += 2;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readInt32LE = function () {\n this.ensureLength(4);\n var value = this.data.readInt32LE(this.readerIndex);\n this.readerIndex += 4;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readInt64LE = function () {\n this.ensureLength(8);\n var low = this.data.readInt32LE(this.readerIndex);\n var value = this.data.readInt32LE(this.readerIndex + 4) * 0x100000000 + low;\n if (low < 0) {\n value += 0x100000000;\n }\n this.readerIndex += 8;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readFloat32LE = function () {\n this.ensureLength(4);\n var value = this.data.readFloatLE(this.readerIndex);\n this.readerIndex += 4;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readFloat64LE = function () {\n this.ensureLength(8);\n var value = this.data.readDoubleLE(this.readerIndex);\n return this.trackData(value);\n };\n DataStreamReader.prototype.readLength8 = function () {\n this.ensureLength(1);\n return this.data.readUInt8(this.readerIndex++);\n };\n DataStreamReader.prototype.readLength16LE = function () {\n this.ensureLength(2);\n var value = this.data.readUInt16LE(this.readerIndex);\n this.readerIndex += 2;\n return value;\n };\n DataStreamReader.prototype.readLength32LE = function () {\n this.ensureLength(4);\n var value = this.data.readUInt32LE(this.readerIndex);\n this.readerIndex += 4;\n return value;\n };\n DataStreamReader.prototype.readLength64LE = function () {\n this.ensureLength(8);\n var low = this.data.readUInt32LE(this.readerIndex);\n var value = this.data.readUInt32LE(this.readerIndex + 4) * 0x100000000 + low;\n this.readerIndex += 8;\n return value;\n };\n DataStreamReader.prototype.readUTF8 = function (length) {\n this.ensureLength(length);\n var value = this.data.toString(\"utf8\", this.readerIndex, this.readerIndex + length);\n this.readerIndex += length;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readUTF8_Length8 = function () {\n var length = this.readLength8();\n return this.readUTF8(length);\n };\n DataStreamReader.prototype.readUTF8_Length16LE = function () {\n var length = this.readLength16LE();\n return this.readUTF8(length);\n };\n DataStreamReader.prototype.readUTF8_Length32LE = function () {\n var length = this.readLength32LE();\n return this.readUTF8(length);\n };\n DataStreamReader.prototype.readUTF8_Length64LE = function () {\n var length = this.readLength64LE();\n return this.readUTF8(length);\n };\n DataStreamReader.prototype.readUTF8_NULL_terminated = function () {\n var offset = this.readerIndex;\n var nextByte;\n for (;;) {\n nextByte = this.data[offset];\n if (nextByte === undefined) {\n throw new Error(\"HDSDecoder: Reached end of data stream while reading NUL terminated string!\");\n }\n else if (nextByte === 0) {\n break;\n }\n else {\n offset++;\n }\n }\n var value = this.data.toString(\"utf8\", this.readerIndex, offset);\n this.readerIndex = offset + 1;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readData = function (length) {\n this.ensureLength(length);\n var value = this.data.slice(this.readerIndex, this.readerIndex + length);\n this.readerIndex += length;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readData_Length8 = function () {\n var length = this.readLength8();\n return this.readData(length);\n };\n DataStreamReader.prototype.readData_Length16LE = function () {\n var length = this.readLength16LE();\n return this.readData(length);\n };\n DataStreamReader.prototype.readData_Length32LE = function () {\n var length = this.readLength32LE();\n return this.readData(length);\n };\n DataStreamReader.prototype.readData_Length64LE = function () {\n var length = this.readLength64LE();\n return this.readData(length);\n };\n DataStreamReader.prototype.readData_terminated = function () {\n var offset = this.readerIndex;\n var nextByte;\n for (;;) {\n nextByte = this.data[offset];\n if (nextByte === undefined) {\n throw new Error(\"HDSDecoder: Reached end of data stream while reading terminated data!\");\n }\n else if (nextByte === 3 /* DataFormatTags.TERMINATOR */) {\n break;\n }\n else {\n offset++;\n }\n }\n var value = this.data.slice(this.readerIndex, offset);\n this.readerIndex = offset + 1;\n return this.trackData(value);\n };\n DataStreamReader.prototype.readSecondsSince2001_01_01 = function () {\n // second since 2001-01-01 00:00:00\n return this.readFloat64LE();\n };\n DataStreamReader.prototype.readUUID = function () {\n this.ensureLength(16);\n var value = uuid.unparse(this.data, this.readerIndex);\n this.readerIndex += 16;\n return this.trackData(value);\n };\n return DataStreamReader;\n}());\nexports.DataStreamReader = DataStreamReader;\nvar WrittenDataList = /** @class */ (function () {\n function WrittenDataList() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.writtenData = [];\n }\n WrittenDataList.prototype.push = function (data) {\n this.writtenData.push(data);\n };\n WrittenDataList.prototype.indexOf = function (data) {\n for (var i = 0; i < this.writtenData.length; i++) {\n var data0 = this.writtenData[i];\n if (data === data0) {\n return i;\n }\n if (data instanceof ValueWrapper && data0 instanceof ValueWrapper) {\n if (data.equals(data0)) {\n return i;\n }\n }\n }\n return -1;\n };\n return WrittenDataList;\n}());\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamWriter = /** @class */ (function () {\n function DataStreamWriter() {\n this.writtenData = new WrittenDataList();\n this.data = Buffer.alloc(DataStreamWriter.chunkSize);\n this.writerIndex = 0;\n }\n DataStreamWriter.prototype.length = function () {\n return this.writerIndex; // since writerIndex points to the next FREE index it also represents the length\n };\n DataStreamWriter.prototype.getData = function () {\n return this.data.slice(0, this.writerIndex);\n };\n DataStreamWriter.prototype.ensureLength = function (bytes) {\n var neededBytes = (this.writerIndex + bytes) - this.data.length;\n if (neededBytes > 0) {\n var chunks = Math.ceil(neededBytes / DataStreamWriter.chunkSize);\n // don't know if it's best for performance to immediately concatenate the buffers. That way it's\n // the easiest way to handle writing though.\n this.data = Buffer.concat([this.data, Buffer.alloc(chunks * DataStreamWriter.chunkSize)]);\n }\n };\n DataStreamWriter.prototype.compressDataIfPossible = function (data) {\n var index = this.writtenData.indexOf(data);\n if (index < 0) {\n // data is not present yet\n this.writtenData.push(data);\n return false;\n }\n else if (index <= 207 /* DataFormatTags.COMPRESSION_STOP */ - 160 /* DataFormatTags.COMPRESSION_START */) {\n // data was already written and the index is in the applicable range => shorten the payload\n this.writeTag(160 /* DataFormatTags.COMPRESSION_START */ + index);\n return true;\n }\n return false;\n };\n DataStreamWriter.prototype.writeTag = function (tag) {\n this.ensureLength(1);\n this.data.writeUInt8(tag, this.writerIndex++);\n };\n DataStreamWriter.prototype.writeTrue = function () {\n this.writeTag(1 /* DataFormatTags.TRUE */);\n };\n DataStreamWriter.prototype.writeFalse = function () {\n this.writeTag(2 /* DataFormatTags.FALSE */);\n };\n DataStreamWriter.prototype.writeNumber = function (number) {\n if (number === -1) {\n this.writeTag(7 /* DataFormatTags.INTEGER_MINUS_ONE */);\n }\n else if (number >= 0 && number <= 39) {\n this.writeTag(8 /* DataFormatTags.INTEGER_RANGE_START_0 */ + number);\n }\n else if (number >= -128 && number <= 127) {\n this.writeInt8(new Int8(number));\n }\n else if (number >= -32768 && number <= 32767) {\n this.writeInt16LE(new Int16(number));\n }\n else if (number >= -2147483648 && number <= -2147483648) {\n this.writeInt32LE(new Int32(number));\n }\n else if (number >= Number.MIN_SAFE_INTEGER && number <= Number.MAX_SAFE_INTEGER) { // use correct uin64 restriction when we convert to bigint\n this.writeInt64LE(new Int64(number));\n }\n else {\n throw new Error(\"Tried writing unrepresentable number (\" + number + \")\");\n }\n };\n DataStreamWriter.prototype.writeInt8 = function (int8) {\n if (this.compressDataIfPossible(int8)) {\n return;\n }\n this.ensureLength(2);\n this.writeTag(48 /* DataFormatTags.INT8 */);\n this.data.writeInt8(int8.value, this.writerIndex++);\n };\n DataStreamWriter.prototype.writeInt16LE = function (int16) {\n if (this.compressDataIfPossible(int16)) {\n return;\n }\n this.ensureLength(3);\n this.writeTag(49 /* DataFormatTags.INT16LE */);\n this.data.writeInt16LE(int16.value, this.writerIndex);\n this.writerIndex += 2;\n };\n DataStreamWriter.prototype.writeInt32LE = function (int32) {\n if (this.compressDataIfPossible(int32)) {\n return;\n }\n this.ensureLength(5);\n this.writeTag(50 /* DataFormatTags.INT32LE */);\n this.data.writeInt32LE(int32.value, this.writerIndex);\n this.writerIndex += 4;\n };\n DataStreamWriter.prototype.writeInt64LE = function (int64) {\n if (this.compressDataIfPossible(int64)) {\n return;\n }\n this.ensureLength(9);\n this.writeTag(51 /* DataFormatTags.INT64LE */);\n this.data.writeUInt32LE(int64.value, this.writerIndex); // TODO correctly implement int64; currently it's basically an int32\n this.data.writeUInt32LE(0, this.writerIndex + 4);\n this.writerIndex += 8;\n };\n DataStreamWriter.prototype.writeFloat32LE = function (float32) {\n if (this.compressDataIfPossible(float32)) {\n return;\n }\n this.ensureLength(5);\n this.writeTag(53 /* DataFormatTags.FLOAT32LE */);\n this.data.writeFloatLE(float32.value, this.writerIndex);\n this.writerIndex += 4;\n };\n DataStreamWriter.prototype.writeFloat64LE = function (float64) {\n if (this.compressDataIfPossible(float64)) {\n return;\n }\n this.ensureLength(9);\n this.writeTag(54 /* DataFormatTags.FLOAT64LE */);\n this.data.writeDoubleLE(float64.value, this.writerIndex);\n this.writerIndex += 8;\n };\n DataStreamWriter.prototype.writeLength8 = function (length) {\n this.ensureLength(1);\n this.data.writeUInt8(length, this.writerIndex++);\n };\n DataStreamWriter.prototype.writeLength16LE = function (length) {\n this.ensureLength(2);\n this.data.writeUInt16LE(length, this.writerIndex);\n this.writerIndex += 2;\n };\n DataStreamWriter.prototype.writeLength32LE = function (length) {\n this.ensureLength(4);\n this.data.writeUInt32LE(length, this.writerIndex);\n this.writerIndex += 4;\n };\n DataStreamWriter.prototype.writeLength64LE = function (length) {\n this.ensureLength(8);\n hapCrypto.writeUInt64LE(length, this.data, this.writerIndex);\n this.writerIndex += 8;\n };\n DataStreamWriter.prototype.writeUTF8 = function (utf8) {\n if (this.compressDataIfPossible(utf8)) {\n return;\n }\n var length = Buffer.byteLength(utf8);\n if (length <= 32) {\n this.ensureLength(1 + length);\n this.writeTag(64 /* DataFormatTags.UTF8_LENGTH_START */ + utf8.length);\n this._writeUTF8(utf8);\n }\n else if (length <= 255) {\n this.writeUTF8_Length8(utf8);\n }\n else if (length <= 65535) {\n this.writeUTF8_Length16LE(utf8);\n }\n else if (length <= 4294967295) {\n this.writeUTF8_Length32LE(utf8);\n }\n else if (length <= Number.MAX_SAFE_INTEGER) { // use correct uin64 restriction when we convert to bigint\n this.writeUTF8_Length64LE(utf8);\n }\n else {\n this.writeUTF8_NULL_terminated(utf8);\n }\n };\n DataStreamWriter.prototype._writeUTF8 = function (utf8) {\n var byteLength = Buffer.byteLength(utf8);\n this.ensureLength(byteLength);\n this.data.write(utf8, this.writerIndex, undefined, \"utf8\");\n this.writerIndex += byteLength;\n };\n DataStreamWriter.prototype.writeUTF8_Length8 = function (utf8) {\n var length = Buffer.byteLength(utf8);\n this.ensureLength(2 + length);\n this.writeTag(97 /* DataFormatTags.UTF8_LENGTH8 */);\n this.writeLength8(length);\n this._writeUTF8(utf8);\n };\n DataStreamWriter.prototype.writeUTF8_Length16LE = function (utf8) {\n var length = Buffer.byteLength(utf8);\n this.ensureLength(3 + length);\n this.writeTag(98 /* DataFormatTags.UTF8_LENGTH16LE */);\n this.writeLength16LE(length);\n this._writeUTF8(utf8);\n };\n DataStreamWriter.prototype.writeUTF8_Length32LE = function (utf8) {\n var length = Buffer.byteLength(utf8);\n this.ensureLength(5 + length);\n this.writeTag(99 /* DataFormatTags.UTF8_LENGTH32LE */);\n this.writeLength32LE(length);\n this._writeUTF8(utf8);\n };\n DataStreamWriter.prototype.writeUTF8_Length64LE = function (utf8) {\n var length = Buffer.byteLength(utf8);\n this.ensureLength(9 + length);\n this.writeTag(100 /* DataFormatTags.UTF8_LENGTH64LE */);\n this.writeLength64LE(length);\n this._writeUTF8(utf8);\n };\n DataStreamWriter.prototype.writeUTF8_NULL_terminated = function (utf8) {\n this.ensureLength(1 + Buffer.byteLength(utf8) + 1);\n this.writeTag(111 /* DataFormatTags.UTF8_NULL_TERMINATED */);\n this._writeUTF8(utf8);\n this.data.writeUInt8(0, this.writerIndex++);\n };\n DataStreamWriter.prototype.writeData = function (data) {\n if (this.compressDataIfPossible(data)) {\n return;\n }\n if (data.length <= 32) {\n this.writeTag(112 /* DataFormatTags.DATA_LENGTH_START */ + data.length);\n this._writeData(data);\n }\n else if (data.length <= 255) {\n this.writeData_Length8(data);\n }\n else if (data.length <= 65535) {\n this.writeData_Length16LE(data);\n }\n else if (data.length <= 4294967295) {\n this.writeData_Length32LE(data);\n }\n else if (data.length <= Number.MAX_SAFE_INTEGER) {\n this.writeData_Length64LE(data);\n }\n else {\n this.writeData_terminated(data);\n }\n };\n DataStreamWriter.prototype._writeData = function (data) {\n this.ensureLength(data.length);\n for (var i = 0; i < data.length; i++) {\n this.data[this.writerIndex++] = data[i];\n }\n };\n DataStreamWriter.prototype.writeData_Length8 = function (data) {\n this.ensureLength(2 + data.length);\n this.writeTag(145 /* DataFormatTags.DATA_LENGTH8 */);\n this.writeLength8(data.length);\n this._writeData(data);\n };\n DataStreamWriter.prototype.writeData_Length16LE = function (data) {\n this.ensureLength(3 + data.length);\n this.writeTag(146 /* DataFormatTags.DATA_LENGTH16LE */);\n this.writeLength16LE(data.length);\n this._writeData(data);\n };\n DataStreamWriter.prototype.writeData_Length32LE = function (data) {\n this.ensureLength(5 + data.length);\n this.writeTag(147 /* DataFormatTags.DATA_LENGTH32LE */);\n this.writeLength32LE(data.length);\n this._writeData(data);\n };\n DataStreamWriter.prototype.writeData_Length64LE = function (data) {\n this.ensureLength(9 + data.length);\n this.writeTag(148 /* DataFormatTags.DATA_LENGTH64LE */);\n this.writeLength64LE(data.length);\n this._writeData(data);\n };\n DataStreamWriter.prototype.writeData_terminated = function (data) {\n this.ensureLength(1 + data.length + 1);\n this.writeTag(159 /* DataFormatTags.DATA_TERMINATED */);\n this._writeData(data);\n this.writeTag(3 /* DataFormatTags.TERMINATOR */);\n };\n DataStreamWriter.prototype.writeSecondsSince2001_01_01 = function (seconds) {\n if (this.compressDataIfPossible(seconds)) {\n return;\n }\n this.ensureLength(9);\n this.writeTag(6 /* DataFormatTags.DATE */);\n this.data.writeDoubleLE(seconds.value, this.writerIndex);\n this.writerIndex += 8;\n };\n DataStreamWriter.prototype.writeUUID = function (uuid_string) {\n (0, assert_1.default)(uuid.isValid(uuid_string), \"supplied uuid is invalid\");\n if (this.compressDataIfPossible(new UUID(uuid_string))) {\n return;\n }\n this.ensureLength(17);\n this.writeTag(5 /* DataFormatTags.UUID */);\n uuid.write(uuid_string, this.data, this.writerIndex);\n this.writerIndex += 16;\n };\n DataStreamWriter.chunkSize = 128; // seems to be a good default\n return DataStreamWriter;\n}());\nexports.DataStreamWriter = DataStreamWriter;\n//# sourceMappingURL=DataStreamParser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DataStreamConnection = exports.HDSConnectionError = exports.HDSConnectionErrorType = exports.DataStreamConnectionEvent = exports.DataStreamServer = exports.DataStreamServerEvent = exports.MessageType = exports.HDSProtocolError = exports.HDSProtocolSpecificErrorReason = exports.HDSStatus = exports.Topics = exports.Protocols = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar net_1 = tslib_1.__importDefault(require(\"net\"));\nvar hapCrypto = tslib_1.__importStar(require(\"../util/hapCrypto\"));\nvar DataStreamParser_1 = require(\"./DataStreamParser\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:DataStream:Server\");\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Protocols;\n(function (Protocols) {\n Protocols[\"CONTROL\"] = \"control\";\n Protocols[\"TARGET_CONTROL\"] = \"targetControl\";\n Protocols[\"DATA_SEND\"] = \"dataSend\";\n})(Protocols = exports.Protocols || (exports.Protocols = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar Topics;\n(function (Topics) {\n // control\n Topics[\"HELLO\"] = \"hello\";\n // targetControl\n Topics[\"WHOAMI\"] = \"whoami\";\n // dataSend\n Topics[\"OPEN\"] = \"open\";\n Topics[\"DATA\"] = \"data\";\n Topics[\"ACK\"] = \"ack\";\n Topics[\"CLOSE\"] = \"close\";\n})(Topics = exports.Topics || (exports.Topics = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar HDSStatus;\n(function (HDSStatus) {\n // noinspection JSUnusedGlobalSymbols\n HDSStatus[HDSStatus[\"SUCCESS\"] = 0] = \"SUCCESS\";\n HDSStatus[HDSStatus[\"OUT_OF_MEMORY\"] = 1] = \"OUT_OF_MEMORY\";\n HDSStatus[HDSStatus[\"TIMEOUT\"] = 2] = \"TIMEOUT\";\n HDSStatus[HDSStatus[\"HEADER_ERROR\"] = 3] = \"HEADER_ERROR\";\n HDSStatus[HDSStatus[\"PAYLOAD_ERROR\"] = 4] = \"PAYLOAD_ERROR\";\n HDSStatus[HDSStatus[\"MISSING_PROTOCOL\"] = 5] = \"MISSING_PROTOCOL\";\n HDSStatus[HDSStatus[\"PROTOCOL_SPECIFIC_ERROR\"] = 6] = \"PROTOCOL_SPECIFIC_ERROR\";\n})(HDSStatus = exports.HDSStatus || (exports.HDSStatus = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar HDSProtocolSpecificErrorReason;\n(function (HDSProtocolSpecificErrorReason) {\n // noinspection JSUnusedGlobalSymbols\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"NORMAL\"] = 0] = \"NORMAL\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"NOT_ALLOWED\"] = 1] = \"NOT_ALLOWED\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"BUSY\"] = 2] = \"BUSY\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"CANCELLED\"] = 3] = \"CANCELLED\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"UNSUPPORTED\"] = 4] = \"UNSUPPORTED\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"UNEXPECTED_FAILURE\"] = 5] = \"UNEXPECTED_FAILURE\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"TIMEOUT\"] = 6] = \"TIMEOUT\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"BAD_DATA\"] = 7] = \"BAD_DATA\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"PROTOCOL_ERROR\"] = 8] = \"PROTOCOL_ERROR\";\n HDSProtocolSpecificErrorReason[HDSProtocolSpecificErrorReason[\"INVALID_CONFIGURATION\"] = 9] = \"INVALID_CONFIGURATION\";\n})(HDSProtocolSpecificErrorReason = exports.HDSProtocolSpecificErrorReason || (exports.HDSProtocolSpecificErrorReason = {}));\n/**\n * An error indicating a protocol level HDS error.\n * E.g. it may be used to encode a {@link HDSStatus.PROTOCOL_SPECIFIC_ERROR} in the {@link Protocols.DATA_SEND} protocol.\n * @group HomeKit Data Streams (HDS)\n */\nvar HDSProtocolError = /** @class */ (function (_super) {\n tslib_1.__extends(HDSProtocolError, _super);\n /**\n * Initializes a new `HDSProtocolError`\n * @param reason - The {@link HDSProtocolSpecificErrorReason}.\n * Values MUST NOT be {@link HDSProtocolSpecificErrorReason.NORMAL}.\n */\n function HDSProtocolError(reason) {\n var _this = _super.call(this, \"HDSProtocolError: \" + reason) || this;\n (0, assert_1.default)(reason !== 0 /* HDSProtocolSpecificErrorReason.NORMAL */, \"Cannot initialize a HDSProtocolError with NORMAL!\");\n _this.reason = reason;\n return _this;\n }\n return HDSProtocolError;\n}(Error));\nexports.HDSProtocolError = HDSProtocolError;\nvar ServerState;\n(function (ServerState) {\n ServerState[ServerState[\"UNINITIALIZED\"] = 0] = \"UNINITIALIZED\";\n ServerState[ServerState[\"BINDING\"] = 1] = \"BINDING\";\n ServerState[ServerState[\"LISTENING\"] = 2] = \"LISTENING\";\n ServerState[ServerState[\"CLOSING\"] = 3] = \"CLOSING\";\n})(ServerState || (ServerState = {}));\nvar ConnectionState;\n(function (ConnectionState) {\n ConnectionState[ConnectionState[\"UNIDENTIFIED\"] = 0] = \"UNIDENTIFIED\";\n ConnectionState[ConnectionState[\"EXPECTING_HELLO\"] = 1] = \"EXPECTING_HELLO\";\n ConnectionState[ConnectionState[\"READY\"] = 2] = \"READY\";\n ConnectionState[ConnectionState[\"CLOSING\"] = 3] = \"CLOSING\";\n ConnectionState[ConnectionState[\"CLOSED\"] = 4] = \"CLOSED\";\n})(ConnectionState || (ConnectionState = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar MessageType;\n(function (MessageType) {\n MessageType[MessageType[\"EVENT\"] = 1] = \"EVENT\";\n MessageType[MessageType[\"REQUEST\"] = 2] = \"REQUEST\";\n MessageType[MessageType[\"RESPONSE\"] = 3] = \"RESPONSE\";\n})(MessageType = exports.MessageType || (exports.MessageType = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamServerEvent;\n(function (DataStreamServerEvent) {\n /**\n * This event is emitted when a new client socket is received. At this point we have no idea to what\n * hap session this connection will be matched.\n */\n DataStreamServerEvent[\"CONNECTION_OPENED\"] = \"connection-opened\";\n /**\n * This event is emitted when the socket of a connection gets closed.\n */\n DataStreamServerEvent[\"CONNECTION_CLOSED\"] = \"connection-closed\";\n})(DataStreamServerEvent = exports.DataStreamServerEvent || (exports.DataStreamServerEvent = {}));\n/**\n * DataStreamServer which listens for incoming tcp connections and handles identification of new connections\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamServer = /** @class */ (function (_super) {\n tslib_1.__extends(DataStreamServer, _super);\n function DataStreamServer() {\n var _this = _super.call(this) || this;\n _this.state = 0 /* ServerState.UNINITIALIZED */;\n _this.preparedSessions = [];\n _this.connections = [];\n _this.removeListenersOnceClosed = false;\n _this.internalEventEmitter = new events_1.EventEmitter(); // used for message event and message request handlers\n return _this;\n }\n /**\n * Registers a new event handler to handle incoming event messages.\n * The handler is only called for a connection if for the give protocol no ProtocolHandler\n * was registered on the connection level.\n *\n * @param protocol - name of the protocol to register the handler for\n * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - function to be called for every occurring event\n */\n DataStreamServer.prototype.onEventMessage = function (protocol, event, handler) {\n this.internalEventEmitter.on(protocol + \"-e-\" + event, handler);\n return this;\n };\n /**\n * Removes a registered event handler.\n *\n * @param protocol - name of the protocol to unregister the handler for\n * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - registered event handler\n */\n DataStreamServer.prototype.removeEventHandler = function (protocol, event, handler) {\n this.internalEventEmitter.removeListener(protocol + \"-e-\" + event, handler);\n return this;\n };\n /**\n * Registers a new request handler to handle incoming request messages.\n * The handler is only called for a connection if for the give protocol no ProtocolHandler\n * was registered on the connection level.\n *\n * @param protocol - name of the protocol to register the handler for\n * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - function to be called for every occurring request\n */\n DataStreamServer.prototype.onRequestMessage = function (protocol, request, handler) {\n this.internalEventEmitter.on(protocol + \"-r-\" + request, handler);\n return this;\n };\n /**\n * Removes a registered request handler.\n *\n * @param protocol - name of the protocol to unregister the handler for\n * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)\n * @param handler - registered request handler\n */\n DataStreamServer.prototype.removeRequestHandler = function (protocol, request, handler) {\n this.internalEventEmitter.removeListener(protocol + \"-r-\" + request, handler);\n return this;\n };\n DataStreamServer.prototype.prepareSession = function (connection, controllerKeySalt, callback) {\n var _this = this;\n debug(\"Preparing for incoming HDS connection from %s\", connection.sessionID);\n var accessoryKeySalt = crypto_1.default.randomBytes(32);\n var salt = Buffer.concat([controllerKeySalt, accessoryKeySalt]);\n var accessoryToControllerEncryptionKey = hapCrypto.HKDF(\"sha512\", salt, connection.encryption.sharedSecret, DataStreamServer.accessoryToControllerInfo, 32);\n var controllerToAccessoryEncryptionKey = hapCrypto.HKDF(\"sha512\", salt, connection.encryption.sharedSecret, DataStreamServer.controllerToAccessoryInfo, 32);\n var preparedSession = {\n connection: connection,\n accessoryToControllerEncryptionKey: accessoryToControllerEncryptionKey,\n controllerToAccessoryEncryptionKey: controllerToAccessoryEncryptionKey,\n accessoryKeySalt: accessoryKeySalt,\n connectTimeout: setTimeout(function () { return _this.timeoutPreparedSession(preparedSession); }, 10000),\n };\n preparedSession.connectTimeout.unref();\n this.preparedSessions.push(preparedSession);\n this.checkTCPServerEstablished(preparedSession, function (error) {\n if (error) {\n callback(error);\n }\n else {\n callback(undefined, preparedSession);\n }\n });\n };\n DataStreamServer.prototype.timeoutPreparedSession = function (preparedSession) {\n debug(\"Prepared HDS session timed out out since no connection was opened for 10 seconds (%s)\", preparedSession.connection.sessionID);\n var index = this.preparedSessions.indexOf(preparedSession);\n if (index >= 0) {\n this.preparedSessions.splice(index, 1);\n }\n this.checkCloseable();\n };\n DataStreamServer.prototype.checkTCPServerEstablished = function (preparedSession, callback) {\n var _this = this;\n switch (this.state) {\n case 0 /* ServerState.UNINITIALIZED */:\n debug(\"Starting up TCP server.\");\n this.tcpServer = net_1.default.createServer();\n this.tcpServer.once(\"listening\", this.listening.bind(this, preparedSession, callback));\n this.tcpServer.on(\"connection\", this.onConnection.bind(this));\n this.tcpServer.on(\"close\", this.closed.bind(this));\n this.tcpServer.listen();\n this.state = 1 /* ServerState.BINDING */;\n break;\n case 1 /* ServerState.BINDING */:\n debug(\"TCP server already running. Waiting for it to bind.\");\n this.tcpServer.once(\"listening\", this.listening.bind(this, preparedSession, callback));\n break;\n case 2 /* ServerState.LISTENING */:\n debug(\"Instructing client to connect to already running TCP server\");\n preparedSession.port = this.tcpPort;\n callback();\n break;\n case 3 /* ServerState.CLOSING */:\n debug(\"TCP socket is currently closing. Trying again when server is fully closed and opening a new one then.\");\n this.tcpServer.once(\"close\", function () { return setTimeout(function () { return _this.checkTCPServerEstablished(preparedSession, callback); }, 10); });\n break;\n }\n };\n DataStreamServer.prototype.listening = function (preparedSession, callback) {\n this.state = 2 /* ServerState.LISTENING */;\n var address = this.tcpServer.address();\n if (address && typeof address !== \"string\") { // address is only typeof string when listening to a pipe or unix socket\n this.tcpPort = address.port;\n preparedSession.port = address.port;\n debug(\"TCP server is now listening for new data stream connections on port %s\", address.port);\n callback();\n }\n };\n DataStreamServer.prototype.onConnection = function (socket) {\n debug(\"[%s] New DataStream connection was established\", socket.remoteAddress);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n var connection = new DataStreamConnection(socket);\n connection.on(\"identification\" /* DataStreamConnectionEvent.IDENTIFICATION */, this.handleSessionIdentification.bind(this, connection));\n connection.on(\"handle-message-globally\" /* DataStreamConnectionEvent.HANDLE_MESSAGE_GLOBALLY */, this.handleMessageGlobally.bind(this, connection));\n connection.on(\"closed\" /* DataStreamConnectionEvent.CLOSED */, this.connectionClosed.bind(this, connection));\n this.connections.push(connection);\n this.emit(\"connection-opened\" /* DataStreamServerEvent.CONNECTION_OPENED */, connection);\n };\n DataStreamServer.prototype.handleSessionIdentification = function (connection, firstFrame, callback) {\n var identifiedSession = undefined;\n for (var i = 0; i < this.preparedSessions.length; i++) {\n var preparedSession = this.preparedSessions[i];\n // if we successfully decrypt the first frame with this key we know to which session this connection belongs\n if (connection.decryptHDSFrame(firstFrame, preparedSession.controllerToAccessoryEncryptionKey)) {\n identifiedSession = preparedSession;\n break;\n }\n }\n callback(identifiedSession);\n if (identifiedSession) {\n debug(\"[%s] Connection was successfully identified (linked with sessionId: %s)\", connection.remoteAddress, identifiedSession.connection.sessionID);\n var index = this.preparedSessions.indexOf(identifiedSession);\n if (index >= 0) {\n this.preparedSessions.splice(index, 1);\n }\n clearTimeout(identifiedSession.connectTimeout);\n identifiedSession.connectTimeout = undefined;\n // we have currently no experience with data stream connections, maybe it would be good to index active connections\n // by their hap sessionId in order to clear out old but still open connections when the controller opens a new one\n // on the other hand the keepAlive should handle that also :thinking:\n }\n else { // we looped through all session and didn't find anything\n debug(\"[%s] Could not identify connection. Terminating.\", connection.remoteAddress);\n connection.close(); // disconnecting since first message was not a valid hello\n }\n };\n DataStreamServer.prototype.handleMessageGlobally = function (connection, message) {\n var _a;\n assert_1.default.notStrictEqual(message.type, 3 /* MessageType.RESPONSE */); // responses can't physically get here\n var separator = \"\";\n var args = [];\n if (message.type === 1 /* MessageType.EVENT */) {\n separator = \"-e-\";\n }\n else if (message.type === 2 /* MessageType.REQUEST */) {\n separator = \"-r-\";\n args.push(message.id);\n }\n args.push(message.message);\n var hadListeners;\n try {\n hadListeners = (_a = this.internalEventEmitter).emit.apply(_a, tslib_1.__spreadArray([message.protocol + separator + message.topic, connection], tslib_1.__read(args), false));\n }\n catch (error) {\n hadListeners = true;\n debug(\"[%s] Error occurred while dispatching handler for HDS message: %o\", connection.remoteAddress, message);\n debug(error.stack);\n }\n if (!hadListeners) {\n debug(\"[%s] WARNING no handler was found for message: %o\", connection.remoteAddress, message);\n }\n };\n DataStreamServer.prototype.connectionClosed = function (connection) {\n debug(\"[%s] DataStream connection closed\", connection.remoteAddress);\n this.connections.splice(this.connections.indexOf(connection), 1);\n this.emit(\"connection-closed\" /* DataStreamServerEvent.CONNECTION_CLOSED */, connection);\n this.checkCloseable();\n if (this.state === 3 /* ServerState.CLOSING */ && this.removeListenersOnceClosed && this.connections.length === 0) {\n this.removeAllListeners(); // see this.destroy()\n }\n };\n DataStreamServer.prototype.checkCloseable = function () {\n if (this.connections.length === 0 && this.preparedSessions.length === 0 && this.state < 3 /* ServerState.CLOSING */) {\n debug(\"Last connection disconnected. Closing the server now.\");\n this.state = 3 /* ServerState.CLOSING */;\n this.tcpServer.close();\n }\n };\n /**\n * This method will fully stop the DataStreamServer\n */\n DataStreamServer.prototype.destroy = function () {\n var e_1, _a;\n if (this.state > 0 /* ServerState.UNINITIALIZED */ && this.state < 3 /* ServerState.CLOSING */) {\n this.tcpServer.close();\n try {\n for (var _b = tslib_1.__values(this.connections), _c = _b.next(); !_c.done; _c = _b.next()) {\n var connection = _c.value;\n connection.close();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n this.state = 3 /* ServerState.CLOSING */;\n this.removeListenersOnceClosed = true;\n this.internalEventEmitter.removeAllListeners();\n };\n DataStreamServer.prototype.closed = function () {\n this.tcpServer = undefined;\n this.tcpPort = undefined;\n this.state = 0 /* ServerState.UNINITIALIZED */;\n };\n DataStreamServer.version = \"1.0\";\n DataStreamServer.accessoryToControllerInfo = Buffer.from(\"HDS-Read-Encryption-Key\");\n DataStreamServer.controllerToAccessoryInfo = Buffer.from(\"HDS-Write-Encryption-Key\");\n return DataStreamServer;\n}(events_1.EventEmitter));\nexports.DataStreamServer = DataStreamServer;\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamConnectionEvent;\n(function (DataStreamConnectionEvent) {\n /**\n * This event is emitted when the first HDSFrame is received from a new connection.\n * The connection expects the handler to identify the connection by trying to match the decryption keys.\n * If identification was successful the PreparedDataStreamSession should be supplied to the callback,\n * otherwise undefined should be supplied.\n */\n DataStreamConnectionEvent[\"IDENTIFICATION\"] = \"identification\";\n /**\n * This event is emitted when no handler could be found for the given protocol of an event or request message.\n */\n DataStreamConnectionEvent[\"HANDLE_MESSAGE_GLOBALLY\"] = \"handle-message-globally\";\n /**\n * This event is emitted when the socket of the connection was closed.\n */\n DataStreamConnectionEvent[\"CLOSED\"] = \"closed\";\n})(DataStreamConnectionEvent = exports.DataStreamConnectionEvent || (exports.DataStreamConnectionEvent = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar HDSConnectionErrorType;\n(function (HDSConnectionErrorType) {\n HDSConnectionErrorType[HDSConnectionErrorType[\"ILLEGAL_STATE\"] = 1] = \"ILLEGAL_STATE\";\n HDSConnectionErrorType[HDSConnectionErrorType[\"CLOSED_SOCKET\"] = 2] = \"CLOSED_SOCKET\";\n HDSConnectionErrorType[HDSConnectionErrorType[\"MAX_PAYLOAD_LENGTH\"] = 3] = \"MAX_PAYLOAD_LENGTH\";\n})(HDSConnectionErrorType = exports.HDSConnectionErrorType || (exports.HDSConnectionErrorType = {}));\n/**\n * @group HomeKit Data Streams (HDS)\n */\nvar HDSConnectionError = /** @class */ (function (_super) {\n tslib_1.__extends(HDSConnectionError, _super);\n function HDSConnectionError(message, type) {\n var _this = _super.call(this, message) || this;\n _this.type = type;\n return _this;\n }\n return HDSConnectionError;\n}(Error));\nexports.HDSConnectionError = HDSConnectionError;\n/**\n * DataStream connection which holds any necessary state information, encryption and decryption keys, manages\n * protocol handlers and also handles sending and receiving of data stream frames.\n *\n * @group HomeKit Data Streams (HDS)\n */\nvar DataStreamConnection = /** @class */ (function (_super) {\n tslib_1.__extends(DataStreamConnection, _super);\n function DataStreamConnection(socket) {\n var _a;\n var _this = _super.call(this) || this;\n /*\n Since our DataStream server does only listen on one port and this port is supplied to every client\n which wants to connect, we do not really know which client is who when we receive a tcp connection.\n Thus, we find the correct PreparedDataStreamSession object by testing the encryption keys of all available\n prepared sessions. Then we can reference this hds connection with the correct hap connection and mark it as identified.\n */\n _this.state = 0 /* ConnectionState.UNIDENTIFIED */;\n _this.protocolHandlers = {}; // used to store protocolHandlers identified by their protocol name\n _this.responseHandlers = {}; // used to store responseHandlers indexed by their respective requestId\n _this.responseTimers = {}; // used to store response timeouts indexed by their respective requestId\n _this.socket = socket;\n _this.remoteAddress = socket.remoteAddress;\n _this.socket.setNoDelay(true); // disable Nagle algorithm\n _this.socket.setKeepAlive(true);\n _this.accessoryToControllerNonce = 0;\n _this.accessoryToControllerNonceBuffer = Buffer.alloc(8);\n _this.controllerToAccessoryNonce = 0;\n _this.controllerToAccessoryNonceBuffer = Buffer.alloc(8);\n _this.hapConnectionClosedListener = _this.onHAPSessionClosed.bind(_this);\n _this.addProtocolHandler(\"control\" /* Protocols.CONTROL */, {\n requestHandler: (_a = {},\n _a[\"hello\" /* Topics.HELLO */] = _this.handleHello.bind(_this),\n _a),\n });\n _this.helloTimer = setTimeout(function () {\n debug(\"[%s] Hello message did not arrive in time. Killing the connection\", _this.remoteAddress);\n _this.close();\n }, 10000);\n _this.socket.on(\"data\", _this.onSocketData.bind(_this));\n _this.socket.on(\"error\", _this.onSocketError.bind(_this));\n _this.socket.on(\"close\", _this.onSocketClose.bind(_this));\n // this is to mitigate the event emitter \"memory leak warning\".\n // e.g. with HSV there might be multiple cameras subscribing to the CLOSE event. one subscription for\n // every active recording stream on a camera. The default limit of 10 might be easily reached.\n // Setting a high limit isn't the prefect solution, but will avoid false positives but ensures that\n // a warning is still be printed if running long enough.\n _this.setMaxListeners(100);\n return _this;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamConnection.prototype.handleHello = function (id, message) {\n // that hello is indeed the _first_ message received is verified in onSocketData(...)\n debug(\"[%s] Received hello message from client: %o\", this.remoteAddress, message);\n clearTimeout(this.helloTimer);\n this.helloTimer = undefined;\n this.state = 2 /* ConnectionState.READY */;\n this.sendResponse(\"control\" /* Protocols.CONTROL */, \"hello\" /* Topics.HELLO */, id);\n };\n /**\n * Registers a new protocol handler to handle incoming messages.\n * The same protocol cannot be registered multiple times.\n *\n * @param protocol - name of the protocol to register the handler for\n * @param protocolHandler - object to be registered as protocol handler\n */\n DataStreamConnection.prototype.addProtocolHandler = function (protocol, protocolHandler) {\n if (this.protocolHandlers[protocol] !== undefined) {\n return false;\n }\n this.protocolHandlers[protocol] = protocolHandler;\n return true;\n };\n /**\n * Removes a protocol handler if it is registered.\n *\n * @param protocol - name of the protocol to unregister the handler for\n * @param protocolHandler - object which will be unregistered\n */\n DataStreamConnection.prototype.removeProtocolHandler = function (protocol, protocolHandler) {\n var current = this.protocolHandlers[protocol];\n if (current === protocolHandler) {\n delete this.protocolHandlers[protocol];\n }\n };\n /**\n * Sends a new event message to the connected client.\n *\n * @param protocol - name of the protocol\n * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)\n * @param message - message dictionary which gets sent along the event\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamConnection.prototype.sendEvent = function (protocol, event, message) {\n if (message === void 0) { message = {}; }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var header = {};\n header.protocol = protocol;\n header.event = event;\n this.sendHDSFrame(header, message);\n };\n /**\n * Sends a new request message to the connected client.\n *\n * @param protocol - name of the protocol\n * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)\n * @param message - message dictionary which gets sent along the request\n * @param callback - handler which gets supplied with an error object if the response didn't\n * arrive in time or the status and the message dictionary from the response\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamConnection.prototype.sendRequest = function (protocol, request, message, callback) {\n var _this = this;\n if (message === void 0) { message = {}; }\n var requestId;\n do { // generate unused requestId\n // currently writing int64 to data stream is not really supported, so 32-bit int will be the max\n requestId = Math.floor(Math.random() * 4294967295);\n } while (this.responseHandlers[requestId] !== undefined);\n this.responseHandlers[requestId] = callback;\n this.responseTimers[requestId] = setTimeout(function () {\n // we did not receive a response => close socket\n _this.close();\n var handler = _this.responseHandlers[requestId];\n delete _this.responseHandlers[requestId];\n delete _this.responseTimers[requestId];\n // handler should be able to clean up their stuff\n handler(new Error(\"timeout\"), undefined, {});\n }, 10000); // 10s timer\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var header = {};\n header.protocol = protocol;\n header.request = request;\n header.id = new DataStreamParser_1.Int64(requestId);\n this.sendHDSFrame(header, message);\n };\n /**\n * Send a new response message to a received request message to the client.\n *\n * @param protocol - name of the protocol\n * @param response - name of the response (also referred to as topic. See {@link Topics} for some known ones)\n * @param id - id from the request, to associate the response to the request\n * @param status - status indication if the request was successful. A status of zero indicates success.\n * @param message - message dictionary which gets sent along the response\n */\n DataStreamConnection.prototype.sendResponse = function (protocol, response, id, status, \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message) {\n if (status === void 0) { status = HDSStatus.SUCCESS; }\n if (message === void 0) { message = {}; }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var header = {};\n header.protocol = protocol;\n header.response = response;\n header.id = new DataStreamParser_1.Int64(id);\n header.status = new DataStreamParser_1.Int64(status);\n this.sendHDSFrame(header, message);\n };\n DataStreamConnection.prototype.onSocketData = function (data) {\n var _this = this;\n if (this.state >= 3 /* ConnectionState.CLOSING */) {\n return;\n }\n var frameIndex = 0;\n var frames = this.decodeHDSFrames(data);\n if (frames.length === 0) { // not enough data\n return;\n }\n if (this.state === 0 /* ConnectionState.UNIDENTIFIED */) {\n // at the beginning we are only interested in trying to decrypt the first frame in order to test decryption keys\n var firstFrame = frames[frameIndex++];\n this.emit(\"identification\" /* DataStreamConnectionEvent.IDENTIFICATION */, firstFrame, function (identifiedSession) {\n if (identifiedSession) {\n // horray, we found our connection\n _this.connection = identifiedSession.connection;\n _this.accessoryToControllerEncryptionKey = identifiedSession.accessoryToControllerEncryptionKey;\n _this.controllerToAccessoryEncryptionKey = identifiedSession.controllerToAccessoryEncryptionKey;\n _this.state = 1 /* ConnectionState.EXPECTING_HELLO */;\n // below listener is removed in .close()\n _this.connection.setMaxListeners(_this.connection.getMaxListeners() + 1);\n _this.connection.on(\"closed\" /* HAPConnectionEvent.CLOSED */, _this.hapConnectionClosedListener); // register close listener\n debug(\"[%s] Registering CLOSED handler to HAP connection. Connection currently has %d close handlers!\", _this.remoteAddress, _this.connection.listeners(\"closed\" /* HAPConnectionEvent.CLOSED */).length);\n }\n });\n if (this.state === 0 /* ConnectionState.UNIDENTIFIED */) {\n // did not find a prepared connection, server already closed this connection; nothing to do here\n return;\n }\n }\n for (; frameIndex < frames.length; frameIndex++) { // decrypt all remaining frames\n if (!this.decryptHDSFrame(frames[frameIndex])) {\n debug(\"[%s] HDS frame decryption or authentication failed. Connection will be terminated!\", this.remoteAddress);\n this.close();\n return;\n }\n }\n var messages = this.decodePayloads(frames); // decode contents of payload\n if (this.state === 1 /* ConnectionState.EXPECTING_HELLO */) {\n var firstMessage = messages[0];\n if (firstMessage.protocol !== \"control\" /* Protocols.CONTROL */ || firstMessage.type !== 2 /* MessageType.REQUEST */ || firstMessage.topic !== \"hello\" /* Topics.HELLO */) {\n // first message is not the expected hello request\n debug(\"[%s] First message received was not the expected hello message. Instead got: %o\", this.remoteAddress, firstMessage);\n this.close();\n return;\n }\n }\n messages.forEach(function (message) {\n if (message.type === 3 /* MessageType.RESPONSE */) {\n // protocol and topic are currently not tested here; just assumed they are correct;\n // probably they are as the requestId is unique per connection no matter what protocol is used\n var responseHandler = _this.responseHandlers[message.id];\n var responseTimer = _this.responseTimers[message.id];\n if (responseTimer) {\n clearTimeout(responseTimer);\n delete _this.responseTimers[message.id];\n }\n if (!responseHandler) {\n // we got a response to a request we did not send; we ignore it for now, since nobody will be hurt\n debug(\"WARNING we received a response to a request we have not sent: %o\", message);\n return;\n }\n try {\n responseHandler(undefined, message.status, message.message);\n }\n catch (error) {\n debug(\"[%s] Error occurred while dispatching response handler for HDS message: %o\", _this.remoteAddress, message);\n debug(error.stack);\n }\n delete _this.responseHandlers[message.id];\n }\n else {\n var handler = _this.protocolHandlers[message.protocol];\n if (handler === undefined) {\n // send message to the server to check if there are some global handlers for it\n _this.emit(\"handle-message-globally\" /* DataStreamConnectionEvent.HANDLE_MESSAGE_GLOBALLY */, message);\n return;\n }\n if (message.type === 1 /* MessageType.EVENT */) {\n var eventHandler = void 0;\n if (!handler.eventHandler || !(eventHandler = handler.eventHandler[message.topic])) {\n debug(\"[%s] WARNING no event handler was found for message: %o\", _this.remoteAddress, message);\n return;\n }\n try {\n eventHandler(message.message);\n }\n catch (error) {\n debug(\"[%s] Error occurred while dispatching event handler for HDS message: %o\", _this.remoteAddress, message);\n debug(error.stack);\n }\n }\n else if (message.type === 2 /* MessageType.REQUEST */) {\n var requestHandler = void 0;\n if (!handler.requestHandler || !(requestHandler = handler.requestHandler[message.topic])) {\n debug(\"[%s] WARNING no request handler was found for message: %o\", _this.remoteAddress, message);\n return;\n }\n try {\n requestHandler(message.id, message.message);\n }\n catch (error) {\n debug(\"[%s] Error occurred while dispatching request handler for HDS message: %o\", _this.remoteAddress, message);\n debug(error.stack);\n }\n }\n else {\n debug(\"[%s] Encountered unknown message type with id %d\", _this.remoteAddress, message.type);\n }\n }\n });\n };\n DataStreamConnection.prototype.decodeHDSFrames = function (data) {\n if (this.frameBuffer !== undefined) {\n data = Buffer.concat([this.frameBuffer, data]);\n this.frameBuffer = undefined;\n }\n var totalBufferLength = data.length;\n var frames = [];\n for (var frameBegin = 0; frameBegin < totalBufferLength;) {\n if (frameBegin + 4 > totalBufferLength) {\n // we don't have enough data in the buffer for the next header\n this.frameBuffer = data.slice(frameBegin);\n break;\n }\n var payloadType = data.readUInt8(frameBegin); // type defining structure of payload; 8-bit; currently expected to be 1\n var payloadLength = data.readUIntBE(frameBegin + 1, 3); // read 24-bit big-endian uint length field\n if (payloadLength > DataStreamConnection.MAX_PAYLOAD_LENGTH) {\n debug(\"[%s] Connection send payload with size bigger than the maximum allow for data stream\", this.remoteAddress);\n this.close();\n return [];\n }\n var remainingBufferLength = totalBufferLength - frameBegin - 4; // subtract 4 for payloadType (1-byte) and payloadLength (3-byte)\n // check if the data from this frame is already there (payload + 16-byte authTag)\n if (payloadLength + 16 > remainingBufferLength) {\n // Frame is fragmented, so we wait until we receive more\n this.frameBuffer = data.slice(frameBegin);\n break;\n }\n var payloadBegin = frameBegin + 4;\n var authTagBegin = payloadBegin + payloadLength;\n var header = data.slice(frameBegin, payloadBegin); // header is also authenticated using authTag\n var cipheredPayload = data.slice(payloadBegin, authTagBegin);\n var plaintextPayload = Buffer.alloc(payloadLength);\n var authTag = data.slice(authTagBegin, authTagBegin + 16);\n frameBegin = authTagBegin + 16; // move to next frame\n if (payloadType === 1) {\n var hdsFrame = {\n header: header,\n cipheredPayload: cipheredPayload,\n authTag: authTag,\n };\n frames.push(hdsFrame);\n }\n else {\n debug(\"[%s] Encountered unknown payload type %d for payload: %s\", this.remoteAddress, plaintextPayload.toString(\"hex\"));\n }\n }\n return frames;\n };\n /**\n * @private file-private API\n */\n DataStreamConnection.prototype.decryptHDSFrame = function (frame, keyOverwrite) {\n hapCrypto.writeUInt64LE(this.controllerToAccessoryNonce, this.controllerToAccessoryNonceBuffer, 0); // update nonce buffer\n var key = keyOverwrite || this.controllerToAccessoryEncryptionKey;\n try {\n frame.plaintextPayload = hapCrypto.chacha20_poly1305_decryptAndVerify(key, this.controllerToAccessoryNonceBuffer, frame.header, frame.cipheredPayload, frame.authTag);\n this.controllerToAccessoryNonce++; // we had a successful encryption, increment the nonce\n return true;\n }\n catch (error) {\n // frame decryption or authentication failed. Could happen when our guess for a PreparedDataStreamSession is wrong\n return false;\n }\n };\n DataStreamConnection.prototype.decodePayloads = function (frames) {\n var _this = this;\n var messages = [];\n frames.forEach(function (frame) {\n var payload = frame.plaintextPayload;\n if (!payload) {\n throw new HDSConnectionError(\"Reached illegal state. Encountered HDSFrame with wasn't decrypted yet!\", 1 /* HDSConnectionErrorType.ILLEGAL_STATE */);\n }\n var headerLength = payload.readUInt8(0);\n var messageLength = payload.length - headerLength - 1;\n var headerBegin = 1;\n var messageBegin = headerBegin + headerLength;\n var headerPayload = new DataStreamParser_1.DataStreamReader(payload.slice(headerBegin, headerBegin + headerLength));\n var messagePayload = new DataStreamParser_1.DataStreamReader(payload.slice(messageBegin, messageBegin + messageLength));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var headerDictionary;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var messageDictionary;\n try {\n headerDictionary = DataStreamParser_1.DataStreamParser.decode(headerPayload);\n headerPayload.finished();\n }\n catch (error) {\n debug(\"[%s] Failed to decode header payload: %s\", _this.remoteAddress, error.message);\n return;\n }\n try {\n messageDictionary = DataStreamParser_1.DataStreamParser.decode(messagePayload);\n messagePayload.finished();\n }\n catch (error) {\n debug(\"[%s] Failed to decode message payload: %s (header: %o)\", _this.remoteAddress, error.message, headerDictionary);\n return;\n }\n var type;\n var protocol = headerDictionary.protocol;\n var topic;\n var id = undefined;\n var status = undefined;\n if (headerDictionary.event !== undefined) {\n type = 1 /* MessageType.EVENT */;\n topic = headerDictionary.event;\n }\n else if (headerDictionary.request !== undefined) {\n type = 2 /* MessageType.REQUEST */;\n topic = headerDictionary.request;\n id = headerDictionary.id;\n }\n else if (headerDictionary.response !== undefined) {\n type = 3 /* MessageType.RESPONSE */;\n topic = headerDictionary.response;\n id = headerDictionary.id;\n status = headerDictionary.status;\n }\n else {\n debug(\"[%s] Encountered unknown payload header format: %o (message: %o)\", _this.remoteAddress, headerDictionary, messageDictionary);\n return;\n }\n var message = {\n type: type,\n protocol: protocol,\n topic: topic,\n id: id,\n status: status,\n message: messageDictionary,\n };\n messages.push(message);\n });\n return messages;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DataStreamConnection.prototype.sendHDSFrame = function (header, message) {\n if (this.state >= 3 /* ConnectionState.CLOSING */) {\n throw new HDSConnectionError(\"Cannot send message on closing/closed socket!\", 2 /* HDSConnectionErrorType.CLOSED_SOCKET */);\n }\n var headerWriter = new DataStreamParser_1.DataStreamWriter();\n var messageWriter = new DataStreamParser_1.DataStreamWriter();\n DataStreamParser_1.DataStreamParser.encode(header, headerWriter);\n DataStreamParser_1.DataStreamParser.encode(message, messageWriter);\n var payloadHeaderBuffer = Buffer.alloc(1);\n payloadHeaderBuffer.writeUInt8(headerWriter.length(), 0);\n var payloadBuffer = Buffer.concat([payloadHeaderBuffer, headerWriter.getData(), messageWriter.getData()]);\n if (payloadBuffer.length > DataStreamConnection.MAX_PAYLOAD_LENGTH) {\n throw new HDSConnectionError(\"Tried sending payload with length larger than the maximum allowed for data stream\", 3 /* HDSConnectionErrorType.MAX_PAYLOAD_LENGTH */);\n }\n var frameTypeBuffer = Buffer.alloc(1);\n frameTypeBuffer.writeUInt8(1, 0);\n var frameLengthBuffer = Buffer.alloc(4);\n frameLengthBuffer.writeUInt32BE(payloadBuffer.length, 0);\n frameLengthBuffer = frameLengthBuffer.slice(1, 4); // a bit hacky but the only real way to write 24-bit int in node\n var frameHeader = Buffer.concat([frameTypeBuffer, frameLengthBuffer]);\n hapCrypto.writeUInt64LE(this.accessoryToControllerNonce++, this.accessoryToControllerNonceBuffer);\n var encrypted = hapCrypto.chacha20_poly1305_encryptAndSeal(this.accessoryToControllerEncryptionKey, this.accessoryToControllerNonceBuffer, frameHeader, payloadBuffer);\n this.socket.write(Buffer.concat([frameHeader, encrypted.ciphertext, encrypted.authTag]));\n /* Useful for debugging outgoing packages and detecting encoding errors\n console.log(\"SENT DATA: \" + payloadBuffer.toString(\"hex\"));\n const frame: HDSFrame = {\n header: frameHeader,\n plaintextPayload: payloadBuffer,\n cipheredPayload: cipheredPayload,\n authTag: authTag,\n };\n const sentMessage = this.decodePayloads([frame])[0];\n console.log(\"Sent message: \" + JSON.stringify(sentMessage, null, 4));\n //*/\n };\n DataStreamConnection.prototype.close = function () {\n if (this.state >= 3 /* ConnectionState.CLOSING */) {\n return; // connection is already closing/closed\n }\n this.state = 3 /* ConnectionState.CLOSING */;\n this.socket.end();\n };\n DataStreamConnection.prototype.isConsideredClosed = function () {\n return this.state >= 3 /* ConnectionState.CLOSING */;\n };\n DataStreamConnection.prototype.onHAPSessionClosed = function () {\n // If the hap connection is closed it is probably also a good idea to close the data stream connection\n debug(\"[%s] HAP connection disconnected. Also closing DataStream connection now.\", this.remoteAddress);\n this.close();\n };\n DataStreamConnection.prototype.onSocketError = function (error) {\n debug(\"[%s] Encountered socket error: %s\", this.remoteAddress, error.message);\n // onSocketClose will be called next\n };\n DataStreamConnection.prototype.onSocketClose = function () {\n var _a, _b;\n // this instance is now considered completely dead\n this.state = 4 /* ConnectionState.CLOSED */;\n this.emit(\"closed\" /* DataStreamConnectionEvent.CLOSED */);\n (_a = this.connection) === null || _a === void 0 ? void 0 : _a.removeListener(\"closed\" /* HAPConnectionEvent.CLOSED */, this.hapConnectionClosedListener);\n (_b = this.connection) === null || _b === void 0 ? void 0 : _b.setMaxListeners(this.connection.getMaxListeners() - 1);\n this.removeAllListeners();\n };\n DataStreamConnection.MAX_PAYLOAD_LENGTH = 1048575;\n return DataStreamConnection;\n}(events_1.EventEmitter));\nexports.DataStreamConnection = DataStreamConnection;\n//# sourceMappingURL=DataStreamServer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./DataStreamManagement\"), exports);\ntslib_1.__exportStar(require(\"./DataStreamServer\"), exports);\ntslib_1.__exportStar(require(\"./DataStreamParser\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\n// THIS FILE IS AUTO-GENERATED - DO NOT MODIFY\n// V=880\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CurrentMediaState = exports.CurrentHumidifierDehumidifierState = exports.CurrentHorizontalTiltAngle = exports.CurrentHeatingCoolingState = exports.CurrentHeaterCoolerState = exports.CurrentFanState = exports.CurrentDoorState = exports.CurrentAmbientLightLevel = exports.CurrentAirPurifierState = exports.CryptoHash = exports.CoolingThresholdTemperature = exports.ContactSensorState = exports.ConfiguredName = exports.ConfigureBridgedAccessoryStatus = exports.ConfigureBridgedAccessory = exports.ConfigurationState = exports.ColorTemperature = exports.ClosedCaptions = exports.ChargingState = exports.CharacteristicValueTransitionControl = exports.CharacteristicValueActiveTransitionCount = exports.CCASignalDetectThreshold = exports.CCAEnergyDetectThreshold = exports.Category = exports.CarbonMonoxidePeakLevel = exports.CarbonMonoxideLevel = exports.CarbonMonoxideDetected = exports.CarbonDioxidePeakLevel = exports.CarbonDioxideLevel = exports.CarbonDioxideDetected = exports.CameraOperatingModeIndicator = exports.ButtonEvent = exports.Brightness = exports.BatteryLevel = exports.AudioFeedback = exports.AssetUpdateReadiness = exports.AppMatchingIdentifier = exports.AirQuality = exports.AirPlayEnable = exports.AirParticulateSize = exports.AirParticulateDensity = exports.AdministratorOnlyAccess = exports.ActivityInterval = exports.ActiveIdentifier = exports.Active = exports.AccessoryIdentifier = exports.AccessoryFlags = exports.AccessControlLevel = exports.AccessCodeSupportedConfiguration = exports.AccessCodeControlPoint = void 0;\nexports.Logs = exports.LockTargetState = exports.LockPhysicalControls = exports.LockManagementAutoSecurityTimeout = exports.LockLastKnownAction = exports.LockCurrentState = exports.LockControlPoint = exports.ListPairings = exports.LinkQuality = exports.LeakDetected = exports.IsConfigured = exports.InUse = exports.InputSourceType = exports.InputDeviceType = exports.ImageRotation = exports.ImageMirroring = exports.Identify = exports.Identifier = exports.Hue = exports.HomeKitCameraActive = exports.HoldPosition = exports.HeatingThresholdTemperature = exports.HeartBeat = exports.HardwareRevision = exports.HardwareFinish = exports.FirmwareUpdateStatus = exports.FirmwareUpdateReadiness = exports.FirmwareRevision = exports.FilterLifeLevel = exports.FilterChangeIndication = exports.EventTransmissionCounters = exports.EventSnapshotsActive = exports.EventRetransmissionMaximum = exports.DisplayOrder = exports.DiscoveredBridgedAccessories = exports.DiscoverBridgedAccessories = exports.DigitalZoom = exports.DiagonalFieldOfView = exports.DayoftheWeek = exports.DataStreamHAPTransportInterrupt = exports.DataStreamHAPTransport = exports.CurrentVisibilityState = exports.CurrentVerticalTiltAngle = exports.CurrentTransport = exports.CurrentTime = exports.CurrentTiltAngle = exports.CurrentTemperature = exports.CurrentSlatState = exports.CurrentRelativeHumidity = exports.CurrentPosition = void 0;\nexports.RelayState = exports.RelayEnabled = exports.RelayControlPoint = exports.RelativeHumidityHumidifierThreshold = exports.RelativeHumidityDehumidifierThreshold = exports.RecordingAudioActive = exports.ReceiverSensitivity = exports.ReceivedSignalStrengthIndication = exports.Reachable = exports.ProgramMode = exports.ProgrammableSwitchOutputState = exports.ProgrammableSwitchEvent = exports.ProductData = exports.PowerModeSelection = exports.PositionState = exports.PM2_5Density = exports.PM10Density = exports.Ping = exports.PictureMode = exports.PeriodicSnapshotsActive = exports.PasswordSetting = exports.PairVerify = exports.PairSetup = exports.PairingFeatures = exports.OzoneDensity = exports.OutletInUse = exports.OpticalZoom = exports.OperatingStateResponse = exports.On = exports.OccupancyDetected = exports.ObstructionDetected = exports.NitrogenDioxideDensity = exports.NightVision = exports.NFCAccessSupportedConfiguration = exports.NFCAccessControlPoint = exports.NetworkClientStatusControl = exports.NetworkClientProfileControl = exports.NetworkAccessViolationControl = exports.Name = exports.Mute = exports.MultifunctionButton = exports.MotionDetected = exports.Model = exports.MetricsBufferFullState = exports.MaximumTransmitPower = exports.Manufacturer = exports.ManuallyDisabled = exports.ManagedNetworkEnable = exports.MACTransmissionCounters = exports.MACRetransmissionMaximum = void 0;\nexports.SupportedDiagnosticsModes = exports.SupportedDataStreamTransportConfiguration = exports.SupportedCharacteristicValueTransitionConfiguration = exports.SupportedCameraRecordingConfiguration = exports.SupportedAudioStreamConfiguration = exports.SupportedAudioRecordingConfiguration = exports.SupportedAssetTypes = exports.SulphurDioxideDensity = exports.StreamingStatus = exports.StatusTampered = exports.StatusLowBattery = exports.StatusJammed = exports.StatusFault = exports.StatusActive = exports.StagedFirmwareVersion = exports.SoftwareRevision = exports.SmokeDetected = exports.SleepInterval = exports.SleepDiscoveryMode = exports.SlatType = exports.SiriTouchToUse = exports.SiriListening = exports.SiriLightOnUse = exports.SiriInputType = exports.SiriEngineVersion = exports.SiriEndpointSessionStatus = exports.SiriEnable = exports.SignalToNoiseRatio = exports.SetupTransferTransport = exports.SetupEndpoints = exports.SetupDataStreamTransport = exports.SetDuration = exports.ServiceLabelNamespace = exports.ServiceLabelIndex = exports.SerialNumber = exports.SelectedSleepConfiguration = exports.SelectedRTPStreamConfiguration = exports.SelectedDiagnosticsModes = exports.SelectedCameraRecordingConfiguration = exports.SelectedAudioStreamConfiguration = exports.SecuritySystemTargetState = exports.SecuritySystemCurrentState = exports.SecuritySystemAlarmType = exports.Saturation = exports.RouterStatus = exports.RotationSpeed = exports.RotationDirection = exports.ResetFilterIndication = exports.RemoteKey = exports.RemainingDuration = void 0;\nexports.WakeConfiguration = exports.VolumeSelector = exports.VolumeControlType = exports.Volume = exports.VOCDensity = exports.VideoAnalysisActive = exports.Version = exports.ValveType = exports.TunneledAccessoryStateNumber = exports.TunneledAccessoryConnected = exports.TunneledAccessoryAdvertising = exports.TunnelConnectionTimeout = exports.TransmitPower = exports.Token = exports.TimeUpdate = exports.ThreadStatus = exports.ThreadOpenThreadVersion = exports.ThreadNodeCapabilities = exports.ThreadControlPoint = exports.ThirdPartyCameraActive = exports.TemperatureDisplayUnits = exports.TargetVisibilityState = exports.TargetVerticalTiltAngle = exports.TargetTiltAngle = exports.TargetTemperature = exports.TargetSlatState = exports.TargetRelativeHumidity = exports.TargetPosition = exports.TargetMediaState = exports.TargetHumidifierDehumidifierState = exports.TargetHorizontalTiltAngle = exports.TargetHeatingCoolingState = exports.TargetHeaterCoolerState = exports.TargetFanState = exports.TargetDoorState = exports.TargetControlSupportedConfiguration = exports.TargetControlList = exports.TargetAirQuality = exports.TargetAirPurifierState = exports.TapType = exports.SwingMode = exports.SupportedVideoStreamConfiguration = exports.SupportedVideoRecordingConfiguration = exports.SupportedTransferTransportConfiguration = exports.SupportedSleepConfiguration = exports.SupportedRTPConfiguration = exports.SupportedRouterConfiguration = exports.SupportedMetrics = exports.SupportedFirmwareUpdateConfiguration = exports.SupportedDiagnosticsSnapshot = void 0;\nexports.WiFiSatelliteStatus = exports.WiFiConfigurationControl = exports.WiFiCapabilities = exports.WaterLevel = exports.WANStatusList = exports.WANConfigurationList = void 0;\nvar tslib_1 = require(\"tslib\");\nvar Characteristic_1 = require(\"../Characteristic\");\n/**\n * Characteristic \"Access Code Control Point\"\n * @since iOS 15\n */\nvar AccessCodeControlPoint = /** @class */ (function (_super) {\n tslib_1.__extends(AccessCodeControlPoint, _super);\n function AccessCodeControlPoint() {\n var _this = _super.call(this, \"Access Code Control Point\", AccessCodeControlPoint.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AccessCodeControlPoint.UUID = \"00000262-0000-1000-8000-0026BB765291\";\n return AccessCodeControlPoint;\n}(Characteristic_1.Characteristic));\nexports.AccessCodeControlPoint = AccessCodeControlPoint;\nCharacteristic_1.Characteristic.AccessCodeControlPoint = AccessCodeControlPoint;\n/**\n * Characteristic \"Access Code Supported Configuration\"\n * @since iOS 15\n */\nvar AccessCodeSupportedConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(AccessCodeSupportedConfiguration, _super);\n function AccessCodeSupportedConfiguration() {\n var _this = _super.call(this, \"Access Code Supported Configuration\", AccessCodeSupportedConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AccessCodeSupportedConfiguration.UUID = \"00000261-0000-1000-8000-0026BB765291\";\n return AccessCodeSupportedConfiguration;\n}(Characteristic_1.Characteristic));\nexports.AccessCodeSupportedConfiguration = AccessCodeSupportedConfiguration;\nCharacteristic_1.Characteristic.AccessCodeSupportedConfiguration = AccessCodeSupportedConfiguration;\n/**\n * Characteristic \"Access Control Level\"\n */\nvar AccessControlLevel = /** @class */ (function (_super) {\n tslib_1.__extends(AccessControlLevel, _super);\n function AccessControlLevel() {\n var _this = _super.call(this, \"Access Control Level\", AccessControlLevel.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AccessControlLevel.UUID = \"000000E5-0000-1000-8000-0026BB765291\";\n return AccessControlLevel;\n}(Characteristic_1.Characteristic));\nexports.AccessControlLevel = AccessControlLevel;\nCharacteristic_1.Characteristic.AccessControlLevel = AccessControlLevel;\n/**\n * Characteristic \"Accessory Flags\"\n */\nvar AccessoryFlags = /** @class */ (function (_super) {\n tslib_1.__extends(AccessoryFlags, _super);\n function AccessoryFlags() {\n var _this = _super.call(this, \"Accessory Flags\", AccessoryFlags.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AccessoryFlags.UUID = \"000000A6-0000-1000-8000-0026BB765291\";\n AccessoryFlags.REQUIRES_ADDITIONAL_SETUP_BIT_MASK = 1;\n return AccessoryFlags;\n}(Characteristic_1.Characteristic));\nexports.AccessoryFlags = AccessoryFlags;\nCharacteristic_1.Characteristic.AccessoryFlags = AccessoryFlags;\n/**\n * Characteristic \"Accessory Identifier\"\n */\nvar AccessoryIdentifier = /** @class */ (function (_super) {\n tslib_1.__extends(AccessoryIdentifier, _super);\n function AccessoryIdentifier() {\n var _this = _super.call(this, \"Accessory Identifier\", AccessoryIdentifier.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AccessoryIdentifier.UUID = \"00000057-0000-1000-8000-0026BB765291\";\n return AccessoryIdentifier;\n}(Characteristic_1.Characteristic));\nexports.AccessoryIdentifier = AccessoryIdentifier;\nCharacteristic_1.Characteristic.AccessoryIdentifier = AccessoryIdentifier;\n/**\n * Characteristic \"Active\"\n */\nvar Active = /** @class */ (function (_super) {\n tslib_1.__extends(Active, _super);\n function Active() {\n var _this = _super.call(this, \"Active\", Active.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Active.UUID = \"000000B0-0000-1000-8000-0026BB765291\";\n Active.INACTIVE = 0;\n Active.ACTIVE = 1;\n return Active;\n}(Characteristic_1.Characteristic));\nexports.Active = Active;\nCharacteristic_1.Characteristic.Active = Active;\n/**\n * Characteristic \"Active Identifier\"\n */\nvar ActiveIdentifier = /** @class */ (function (_super) {\n tslib_1.__extends(ActiveIdentifier, _super);\n function ActiveIdentifier() {\n var _this = _super.call(this, \"Active Identifier\", ActiveIdentifier.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ActiveIdentifier.UUID = \"000000E7-0000-1000-8000-0026BB765291\";\n return ActiveIdentifier;\n}(Characteristic_1.Characteristic));\nexports.ActiveIdentifier = ActiveIdentifier;\nCharacteristic_1.Characteristic.ActiveIdentifier = ActiveIdentifier;\n/**\n * Characteristic \"Activity Interval\"\n * @since iOS 14\n */\nvar ActivityInterval = /** @class */ (function (_super) {\n tslib_1.__extends(ActivityInterval, _super);\n function ActivityInterval() {\n var _this = _super.call(this, \"Activity Interval\", ActivityInterval.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ActivityInterval.UUID = \"0000023B-0000-1000-8000-0026BB765291\";\n return ActivityInterval;\n}(Characteristic_1.Characteristic));\nexports.ActivityInterval = ActivityInterval;\nCharacteristic_1.Characteristic.ActivityInterval = ActivityInterval;\n/**\n * Characteristic \"Administrator Only Access\"\n */\nvar AdministratorOnlyAccess = /** @class */ (function (_super) {\n tslib_1.__extends(AdministratorOnlyAccess, _super);\n function AdministratorOnlyAccess() {\n var _this = _super.call(this, \"Administrator Only Access\", AdministratorOnlyAccess.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AdministratorOnlyAccess.UUID = \"00000001-0000-1000-8000-0026BB765291\";\n return AdministratorOnlyAccess;\n}(Characteristic_1.Characteristic));\nexports.AdministratorOnlyAccess = AdministratorOnlyAccess;\nCharacteristic_1.Characteristic.AdministratorOnlyAccess = AdministratorOnlyAccess;\n/**\n * Characteristic \"Air Particulate Density\"\n */\nvar AirParticulateDensity = /** @class */ (function (_super) {\n tslib_1.__extends(AirParticulateDensity, _super);\n function AirParticulateDensity() {\n var _this = _super.call(this, \"Air Particulate Density\", AirParticulateDensity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AirParticulateDensity.UUID = \"00000064-0000-1000-8000-0026BB765291\";\n return AirParticulateDensity;\n}(Characteristic_1.Characteristic));\nexports.AirParticulateDensity = AirParticulateDensity;\nCharacteristic_1.Characteristic.AirParticulateDensity = AirParticulateDensity;\n/**\n * Characteristic \"Air Particulate Size\"\n */\nvar AirParticulateSize = /** @class */ (function (_super) {\n tslib_1.__extends(AirParticulateSize, _super);\n function AirParticulateSize() {\n var _this = _super.call(this, \"Air Particulate Size\", AirParticulateSize.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AirParticulateSize.UUID = \"00000065-0000-1000-8000-0026BB765291\";\n AirParticulateSize._2_5_M = 0;\n AirParticulateSize._10_M = 1;\n return AirParticulateSize;\n}(Characteristic_1.Characteristic));\nexports.AirParticulateSize = AirParticulateSize;\nCharacteristic_1.Characteristic.AirParticulateSize = AirParticulateSize;\n/**\n * Characteristic \"AirPlay Enable\"\n */\nvar AirPlayEnable = /** @class */ (function (_super) {\n tslib_1.__extends(AirPlayEnable, _super);\n function AirPlayEnable() {\n var _this = _super.call(this, \"AirPlay Enable\", AirPlayEnable.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AirPlayEnable.UUID = \"0000025B-0000-1000-8000-0026BB765291\";\n return AirPlayEnable;\n}(Characteristic_1.Characteristic));\nexports.AirPlayEnable = AirPlayEnable;\nCharacteristic_1.Characteristic.AirPlayEnable = AirPlayEnable;\n/**\n * Characteristic \"Air Quality\"\n */\nvar AirQuality = /** @class */ (function (_super) {\n tslib_1.__extends(AirQuality, _super);\n function AirQuality() {\n var _this = _super.call(this, \"Air Quality\", AirQuality.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 5,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AirQuality.UUID = \"00000095-0000-1000-8000-0026BB765291\";\n AirQuality.UNKNOWN = 0;\n AirQuality.EXCELLENT = 1;\n AirQuality.GOOD = 2;\n AirQuality.FAIR = 3;\n AirQuality.INFERIOR = 4;\n AirQuality.POOR = 5;\n return AirQuality;\n}(Characteristic_1.Characteristic));\nexports.AirQuality = AirQuality;\nCharacteristic_1.Characteristic.AirQuality = AirQuality;\n/**\n * Characteristic \"App Matching Identifier\"\n */\nvar AppMatchingIdentifier = /** @class */ (function (_super) {\n tslib_1.__extends(AppMatchingIdentifier, _super);\n function AppMatchingIdentifier() {\n var _this = _super.call(this, \"App Matching Identifier\", AppMatchingIdentifier.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AppMatchingIdentifier.UUID = \"000000A4-0000-1000-8000-0026BB765291\";\n return AppMatchingIdentifier;\n}(Characteristic_1.Characteristic));\nexports.AppMatchingIdentifier = AppMatchingIdentifier;\nCharacteristic_1.Characteristic.AppMatchingIdentifier = AppMatchingIdentifier;\n/**\n * Characteristic \"Asset Update Readiness\"\n */\nvar AssetUpdateReadiness = /** @class */ (function (_super) {\n tslib_1.__extends(AssetUpdateReadiness, _super);\n function AssetUpdateReadiness() {\n var _this = _super.call(this, \"Asset Update Readiness\", AssetUpdateReadiness.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AssetUpdateReadiness.UUID = \"00000269-0000-1000-8000-0026BB765291\";\n return AssetUpdateReadiness;\n}(Characteristic_1.Characteristic));\nexports.AssetUpdateReadiness = AssetUpdateReadiness;\nCharacteristic_1.Characteristic.AssetUpdateReadiness = AssetUpdateReadiness;\n/**\n * Characteristic \"Audio Feedback\"\n */\nvar AudioFeedback = /** @class */ (function (_super) {\n tslib_1.__extends(AudioFeedback, _super);\n function AudioFeedback() {\n var _this = _super.call(this, \"Audio Feedback\", AudioFeedback.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n AudioFeedback.UUID = \"00000005-0000-1000-8000-0026BB765291\";\n return AudioFeedback;\n}(Characteristic_1.Characteristic));\nexports.AudioFeedback = AudioFeedback;\nCharacteristic_1.Characteristic.AudioFeedback = AudioFeedback;\n/**\n * Characteristic \"Battery Level\"\n */\nvar BatteryLevel = /** @class */ (function (_super) {\n tslib_1.__extends(BatteryLevel, _super);\n function BatteryLevel() {\n var _this = _super.call(this, \"Battery Level\", BatteryLevel.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n BatteryLevel.UUID = \"00000068-0000-1000-8000-0026BB765291\";\n return BatteryLevel;\n}(Characteristic_1.Characteristic));\nexports.BatteryLevel = BatteryLevel;\nCharacteristic_1.Characteristic.BatteryLevel = BatteryLevel;\n/**\n * Characteristic \"Brightness\"\n */\nvar Brightness = /** @class */ (function (_super) {\n tslib_1.__extends(Brightness, _super);\n function Brightness() {\n var _this = _super.call(this, \"Brightness\", Brightness.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Brightness.UUID = \"00000008-0000-1000-8000-0026BB765291\";\n return Brightness;\n}(Characteristic_1.Characteristic));\nexports.Brightness = Brightness;\nCharacteristic_1.Characteristic.Brightness = Brightness;\n/**\n * Characteristic \"Button Event\"\n */\nvar ButtonEvent = /** @class */ (function (_super) {\n tslib_1.__extends(ButtonEvent, _super);\n function ButtonEvent() {\n var _this = _super.call(this, \"Button Event\", ButtonEvent.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n adminOnlyAccess: [2 /* Access.NOTIFY */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ButtonEvent.UUID = \"00000126-0000-1000-8000-0026BB765291\";\n return ButtonEvent;\n}(Characteristic_1.Characteristic));\nexports.ButtonEvent = ButtonEvent;\nCharacteristic_1.Characteristic.ButtonEvent = ButtonEvent;\n/**\n * Characteristic \"Camera Operating Mode Indicator\"\n */\nvar CameraOperatingModeIndicator = /** @class */ (function (_super) {\n tslib_1.__extends(CameraOperatingModeIndicator, _super);\n function CameraOperatingModeIndicator() {\n var _this = _super.call(this, \"Camera Operating Mode Indicator\", CameraOperatingModeIndicator.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */],\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CameraOperatingModeIndicator.UUID = \"0000021D-0000-1000-8000-0026BB765291\";\n CameraOperatingModeIndicator.DISABLE = 0;\n CameraOperatingModeIndicator.ENABLE = 1;\n return CameraOperatingModeIndicator;\n}(Characteristic_1.Characteristic));\nexports.CameraOperatingModeIndicator = CameraOperatingModeIndicator;\nCharacteristic_1.Characteristic.CameraOperatingModeIndicator = CameraOperatingModeIndicator;\n/**\n * Characteristic \"Carbon Dioxide Detected\"\n */\nvar CarbonDioxideDetected = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonDioxideDetected, _super);\n function CarbonDioxideDetected() {\n var _this = _super.call(this, \"Carbon Dioxide Detected\", CarbonDioxideDetected.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonDioxideDetected.UUID = \"00000092-0000-1000-8000-0026BB765291\";\n CarbonDioxideDetected.CO2_LEVELS_NORMAL = 0;\n CarbonDioxideDetected.CO2_LEVELS_ABNORMAL = 1;\n return CarbonDioxideDetected;\n}(Characteristic_1.Characteristic));\nexports.CarbonDioxideDetected = CarbonDioxideDetected;\nCharacteristic_1.Characteristic.CarbonDioxideDetected = CarbonDioxideDetected;\n/**\n * Characteristic \"Carbon Dioxide Level\"\n */\nvar CarbonDioxideLevel = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonDioxideLevel, _super);\n function CarbonDioxideLevel() {\n var _this = _super.call(this, \"Carbon Dioxide Level\", CarbonDioxideLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 100000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonDioxideLevel.UUID = \"00000093-0000-1000-8000-0026BB765291\";\n return CarbonDioxideLevel;\n}(Characteristic_1.Characteristic));\nexports.CarbonDioxideLevel = CarbonDioxideLevel;\nCharacteristic_1.Characteristic.CarbonDioxideLevel = CarbonDioxideLevel;\n/**\n * Characteristic \"Carbon Dioxide Peak Level\"\n */\nvar CarbonDioxidePeakLevel = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonDioxidePeakLevel, _super);\n function CarbonDioxidePeakLevel() {\n var _this = _super.call(this, \"Carbon Dioxide Peak Level\", CarbonDioxidePeakLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 100000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonDioxidePeakLevel.UUID = \"00000094-0000-1000-8000-0026BB765291\";\n return CarbonDioxidePeakLevel;\n}(Characteristic_1.Characteristic));\nexports.CarbonDioxidePeakLevel = CarbonDioxidePeakLevel;\nCharacteristic_1.Characteristic.CarbonDioxidePeakLevel = CarbonDioxidePeakLevel;\n/**\n * Characteristic \"Carbon Monoxide Detected\"\n */\nvar CarbonMonoxideDetected = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonMonoxideDetected, _super);\n function CarbonMonoxideDetected() {\n var _this = _super.call(this, \"Carbon Monoxide Detected\", CarbonMonoxideDetected.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonMonoxideDetected.UUID = \"00000069-0000-1000-8000-0026BB765291\";\n CarbonMonoxideDetected.CO_LEVELS_NORMAL = 0;\n CarbonMonoxideDetected.CO_LEVELS_ABNORMAL = 1;\n return CarbonMonoxideDetected;\n}(Characteristic_1.Characteristic));\nexports.CarbonMonoxideDetected = CarbonMonoxideDetected;\nCharacteristic_1.Characteristic.CarbonMonoxideDetected = CarbonMonoxideDetected;\n/**\n * Characteristic \"Carbon Monoxide Level\"\n */\nvar CarbonMonoxideLevel = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonMonoxideLevel, _super);\n function CarbonMonoxideLevel() {\n var _this = _super.call(this, \"Carbon Monoxide Level\", CarbonMonoxideLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonMonoxideLevel.UUID = \"00000090-0000-1000-8000-0026BB765291\";\n return CarbonMonoxideLevel;\n}(Characteristic_1.Characteristic));\nexports.CarbonMonoxideLevel = CarbonMonoxideLevel;\nCharacteristic_1.Characteristic.CarbonMonoxideLevel = CarbonMonoxideLevel;\n/**\n * Characteristic \"Carbon Monoxide Peak Level\"\n */\nvar CarbonMonoxidePeakLevel = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonMonoxidePeakLevel, _super);\n function CarbonMonoxidePeakLevel() {\n var _this = _super.call(this, \"Carbon Monoxide Peak Level\", CarbonMonoxidePeakLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CarbonMonoxidePeakLevel.UUID = \"00000091-0000-1000-8000-0026BB765291\";\n return CarbonMonoxidePeakLevel;\n}(Characteristic_1.Characteristic));\nexports.CarbonMonoxidePeakLevel = CarbonMonoxidePeakLevel;\nCharacteristic_1.Characteristic.CarbonMonoxidePeakLevel = CarbonMonoxidePeakLevel;\n/**\n * Characteristic \"Category\"\n * @deprecated Removed and not used anymore\n */\nvar Category = /** @class */ (function (_super) {\n tslib_1.__extends(Category, _super);\n function Category() {\n var _this = _super.call(this, \"Category\", Category.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 1,\n maxValue: 16,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Category.UUID = \"000000A3-0000-1000-8000-0026BB765291\";\n return Category;\n}(Characteristic_1.Characteristic));\nexports.Category = Category;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.Category = Category;\n/**\n * Characteristic \"CCA Energy Detect Threshold\"\n * @since iOS 14\n */\nvar CCAEnergyDetectThreshold = /** @class */ (function (_super) {\n tslib_1.__extends(CCAEnergyDetectThreshold, _super);\n function CCAEnergyDetectThreshold() {\n var _this = _super.call(this, \"CCA Energy Detect Threshold\", CCAEnergyDetectThreshold.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CCAEnergyDetectThreshold.UUID = \"00000246-0000-1000-8000-0026BB765291\";\n return CCAEnergyDetectThreshold;\n}(Characteristic_1.Characteristic));\nexports.CCAEnergyDetectThreshold = CCAEnergyDetectThreshold;\nCharacteristic_1.Characteristic.CCAEnergyDetectThreshold = CCAEnergyDetectThreshold;\n/**\n * Characteristic \"CCA Signal Detect Threshold\"\n * @since iOS 14\n */\nvar CCASignalDetectThreshold = /** @class */ (function (_super) {\n tslib_1.__extends(CCASignalDetectThreshold, _super);\n function CCASignalDetectThreshold() {\n var _this = _super.call(this, \"CCA Signal Detect Threshold\", CCASignalDetectThreshold.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CCASignalDetectThreshold.UUID = \"00000245-0000-1000-8000-0026BB765291\";\n return CCASignalDetectThreshold;\n}(Characteristic_1.Characteristic));\nexports.CCASignalDetectThreshold = CCASignalDetectThreshold;\nCharacteristic_1.Characteristic.CCASignalDetectThreshold = CCASignalDetectThreshold;\n/**\n * Characteristic \"Characteristic Value Active Transition Count\"\n * @since iOS 14\n */\nvar CharacteristicValueActiveTransitionCount = /** @class */ (function (_super) {\n tslib_1.__extends(CharacteristicValueActiveTransitionCount, _super);\n function CharacteristicValueActiveTransitionCount() {\n var _this = _super.call(this, \"Characteristic Value Active Transition Count\", CharacteristicValueActiveTransitionCount.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CharacteristicValueActiveTransitionCount.UUID = \"0000024B-0000-1000-8000-0026BB765291\";\n return CharacteristicValueActiveTransitionCount;\n}(Characteristic_1.Characteristic));\nexports.CharacteristicValueActiveTransitionCount = CharacteristicValueActiveTransitionCount;\nCharacteristic_1.Characteristic.CharacteristicValueActiveTransitionCount = CharacteristicValueActiveTransitionCount;\n/**\n * Characteristic \"Characteristic Value Transition Control\"\n * @since iOS 14\n */\nvar CharacteristicValueTransitionControl = /** @class */ (function (_super) {\n tslib_1.__extends(CharacteristicValueTransitionControl, _super);\n function CharacteristicValueTransitionControl() {\n var _this = _super.call(this, \"Characteristic Value Transition Control\", CharacteristicValueTransitionControl.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CharacteristicValueTransitionControl.UUID = \"00000143-0000-1000-8000-0026BB765291\";\n return CharacteristicValueTransitionControl;\n}(Characteristic_1.Characteristic));\nexports.CharacteristicValueTransitionControl = CharacteristicValueTransitionControl;\nCharacteristic_1.Characteristic.CharacteristicValueTransitionControl = CharacteristicValueTransitionControl;\n/**\n * Characteristic \"Charging State\"\n */\nvar ChargingState = /** @class */ (function (_super) {\n tslib_1.__extends(ChargingState, _super);\n function ChargingState() {\n var _this = _super.call(this, \"Charging State\", ChargingState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ChargingState.UUID = \"0000008F-0000-1000-8000-0026BB765291\";\n ChargingState.NOT_CHARGING = 0;\n ChargingState.CHARGING = 1;\n ChargingState.NOT_CHARGEABLE = 2;\n return ChargingState;\n}(Characteristic_1.Characteristic));\nexports.ChargingState = ChargingState;\nCharacteristic_1.Characteristic.ChargingState = ChargingState;\n/**\n * Characteristic \"Closed Captions\"\n */\nvar ClosedCaptions = /** @class */ (function (_super) {\n tslib_1.__extends(ClosedCaptions, _super);\n function ClosedCaptions() {\n var _this = _super.call(this, \"Closed Captions\", ClosedCaptions.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ClosedCaptions.UUID = \"000000DD-0000-1000-8000-0026BB765291\";\n ClosedCaptions.DISABLED = 0;\n ClosedCaptions.ENABLED = 1;\n return ClosedCaptions;\n}(Characteristic_1.Characteristic));\nexports.ClosedCaptions = ClosedCaptions;\nCharacteristic_1.Characteristic.ClosedCaptions = ClosedCaptions;\n/**\n * Characteristic \"Color Temperature\"\n */\nvar ColorTemperature = /** @class */ (function (_super) {\n tslib_1.__extends(ColorTemperature, _super);\n function ColorTemperature() {\n var _this = _super.call(this, \"Color Temperature\", ColorTemperature.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 140,\n maxValue: 500,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ColorTemperature.UUID = \"000000CE-0000-1000-8000-0026BB765291\";\n return ColorTemperature;\n}(Characteristic_1.Characteristic));\nexports.ColorTemperature = ColorTemperature;\nCharacteristic_1.Characteristic.ColorTemperature = ColorTemperature;\n/**\n * Characteristic \"Configuration State\"\n * @since iOS 15\n */\nvar ConfigurationState = /** @class */ (function (_super) {\n tslib_1.__extends(ConfigurationState, _super);\n function ConfigurationState() {\n var _this = _super.call(this, \"Configuration State\", ConfigurationState.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ConfigurationState.UUID = \"00000263-0000-1000-8000-0026BB765291\";\n return ConfigurationState;\n}(Characteristic_1.Characteristic));\nexports.ConfigurationState = ConfigurationState;\nCharacteristic_1.Characteristic.ConfigurationState = ConfigurationState;\n/**\n * Characteristic \"Configure Bridged Accessory\"\n * @deprecated Removed and not used anymore\n */\nvar ConfigureBridgedAccessory = /** @class */ (function (_super) {\n tslib_1.__extends(ConfigureBridgedAccessory, _super);\n function ConfigureBridgedAccessory() {\n var _this = _super.call(this, \"Configure Bridged Accessory\", ConfigureBridgedAccessory.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ConfigureBridgedAccessory.UUID = \"000000A0-0000-1000-8000-0026BB765291\";\n return ConfigureBridgedAccessory;\n}(Characteristic_1.Characteristic));\nexports.ConfigureBridgedAccessory = ConfigureBridgedAccessory;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.ConfigureBridgedAccessory = ConfigureBridgedAccessory;\n/**\n * Characteristic \"Configure Bridged Accessory Status\"\n * @deprecated Removed and not used anymore\n */\nvar ConfigureBridgedAccessoryStatus = /** @class */ (function (_super) {\n tslib_1.__extends(ConfigureBridgedAccessoryStatus, _super);\n function ConfigureBridgedAccessoryStatus() {\n var _this = _super.call(this, \"Configure Bridged Accessory Status\", ConfigureBridgedAccessoryStatus.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ConfigureBridgedAccessoryStatus.UUID = \"0000009D-0000-1000-8000-0026BB765291\";\n return ConfigureBridgedAccessoryStatus;\n}(Characteristic_1.Characteristic));\nexports.ConfigureBridgedAccessoryStatus = ConfigureBridgedAccessoryStatus;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.ConfigureBridgedAccessoryStatus = ConfigureBridgedAccessoryStatus;\n/**\n * Characteristic \"Configured Name\"\n */\nvar ConfiguredName = /** @class */ (function (_super) {\n tslib_1.__extends(ConfiguredName, _super);\n function ConfiguredName() {\n var _this = _super.call(this, \"Configured Name\", ConfiguredName.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ConfiguredName.UUID = \"000000E3-0000-1000-8000-0026BB765291\";\n return ConfiguredName;\n}(Characteristic_1.Characteristic));\nexports.ConfiguredName = ConfiguredName;\nCharacteristic_1.Characteristic.ConfiguredName = ConfiguredName;\n/**\n * Characteristic \"Contact Sensor State\"\n */\nvar ContactSensorState = /** @class */ (function (_super) {\n tslib_1.__extends(ContactSensorState, _super);\n function ContactSensorState() {\n var _this = _super.call(this, \"Contact Sensor State\", ContactSensorState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ContactSensorState.UUID = \"0000006A-0000-1000-8000-0026BB765291\";\n ContactSensorState.CONTACT_DETECTED = 0;\n ContactSensorState.CONTACT_NOT_DETECTED = 1;\n return ContactSensorState;\n}(Characteristic_1.Characteristic));\nexports.ContactSensorState = ContactSensorState;\nCharacteristic_1.Characteristic.ContactSensorState = ContactSensorState;\n/**\n * Characteristic \"Cooling Threshold Temperature\"\n */\nvar CoolingThresholdTemperature = /** @class */ (function (_super) {\n tslib_1.__extends(CoolingThresholdTemperature, _super);\n function CoolingThresholdTemperature() {\n var _this = _super.call(this, \"Cooling Threshold Temperature\", CoolingThresholdTemperature.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"celsius\" /* Units.CELSIUS */,\n minValue: 10,\n maxValue: 35,\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CoolingThresholdTemperature.UUID = \"0000000D-0000-1000-8000-0026BB765291\";\n return CoolingThresholdTemperature;\n}(Characteristic_1.Characteristic));\nexports.CoolingThresholdTemperature = CoolingThresholdTemperature;\nCharacteristic_1.Characteristic.CoolingThresholdTemperature = CoolingThresholdTemperature;\n/**\n * Characteristic \"Crypto Hash\"\n */\nvar CryptoHash = /** @class */ (function (_super) {\n tslib_1.__extends(CryptoHash, _super);\n function CryptoHash() {\n var _this = _super.call(this, \"Crypto Hash\", CryptoHash.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CryptoHash.UUID = \"00000250-0000-1000-8000-0026BB765291\";\n return CryptoHash;\n}(Characteristic_1.Characteristic));\nexports.CryptoHash = CryptoHash;\nCharacteristic_1.Characteristic.CryptoHash = CryptoHash;\n/**\n * Characteristic \"Current Air Purifier State\"\n */\nvar CurrentAirPurifierState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentAirPurifierState, _super);\n function CurrentAirPurifierState() {\n var _this = _super.call(this, \"Current Air Purifier State\", CurrentAirPurifierState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentAirPurifierState.UUID = \"000000A9-0000-1000-8000-0026BB765291\";\n CurrentAirPurifierState.INACTIVE = 0;\n CurrentAirPurifierState.IDLE = 1;\n CurrentAirPurifierState.PURIFYING_AIR = 2;\n return CurrentAirPurifierState;\n}(Characteristic_1.Characteristic));\nexports.CurrentAirPurifierState = CurrentAirPurifierState;\nCharacteristic_1.Characteristic.CurrentAirPurifierState = CurrentAirPurifierState;\n/**\n * Characteristic \"Current Ambient Light Level\"\n */\nvar CurrentAmbientLightLevel = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentAmbientLightLevel, _super);\n function CurrentAmbientLightLevel() {\n var _this = _super.call(this, \"Current Ambient Light Level\", CurrentAmbientLightLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"lux\" /* Units.LUX */,\n minValue: 0.0001,\n maxValue: 100000,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentAmbientLightLevel.UUID = \"0000006B-0000-1000-8000-0026BB765291\";\n return CurrentAmbientLightLevel;\n}(Characteristic_1.Characteristic));\nexports.CurrentAmbientLightLevel = CurrentAmbientLightLevel;\nCharacteristic_1.Characteristic.CurrentAmbientLightLevel = CurrentAmbientLightLevel;\n/**\n * Characteristic \"Current Door State\"\n */\nvar CurrentDoorState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentDoorState, _super);\n function CurrentDoorState() {\n var _this = _super.call(this, \"Current Door State\", CurrentDoorState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 4,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentDoorState.UUID = \"0000000E-0000-1000-8000-0026BB765291\";\n CurrentDoorState.OPEN = 0;\n CurrentDoorState.CLOSED = 1;\n CurrentDoorState.OPENING = 2;\n CurrentDoorState.CLOSING = 3;\n CurrentDoorState.STOPPED = 4;\n return CurrentDoorState;\n}(Characteristic_1.Characteristic));\nexports.CurrentDoorState = CurrentDoorState;\nCharacteristic_1.Characteristic.CurrentDoorState = CurrentDoorState;\n/**\n * Characteristic \"Current Fan State\"\n */\nvar CurrentFanState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentFanState, _super);\n function CurrentFanState() {\n var _this = _super.call(this, \"Current Fan State\", CurrentFanState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentFanState.UUID = \"000000AF-0000-1000-8000-0026BB765291\";\n CurrentFanState.INACTIVE = 0;\n CurrentFanState.IDLE = 1;\n CurrentFanState.BLOWING_AIR = 2;\n return CurrentFanState;\n}(Characteristic_1.Characteristic));\nexports.CurrentFanState = CurrentFanState;\nCharacteristic_1.Characteristic.CurrentFanState = CurrentFanState;\n/**\n * Characteristic \"Current Heater-Cooler State\"\n */\nvar CurrentHeaterCoolerState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentHeaterCoolerState, _super);\n function CurrentHeaterCoolerState() {\n var _this = _super.call(this, \"Current Heater-Cooler State\", CurrentHeaterCoolerState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentHeaterCoolerState.UUID = \"000000B1-0000-1000-8000-0026BB765291\";\n CurrentHeaterCoolerState.INACTIVE = 0;\n CurrentHeaterCoolerState.IDLE = 1;\n CurrentHeaterCoolerState.HEATING = 2;\n CurrentHeaterCoolerState.COOLING = 3;\n return CurrentHeaterCoolerState;\n}(Characteristic_1.Characteristic));\nexports.CurrentHeaterCoolerState = CurrentHeaterCoolerState;\nCharacteristic_1.Characteristic.CurrentHeaterCoolerState = CurrentHeaterCoolerState;\n/**\n * Characteristic \"Current Heating Cooling State\"\n */\nvar CurrentHeatingCoolingState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentHeatingCoolingState, _super);\n function CurrentHeatingCoolingState() {\n var _this = _super.call(this, \"Current Heating Cooling State\", CurrentHeatingCoolingState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentHeatingCoolingState.UUID = \"0000000F-0000-1000-8000-0026BB765291\";\n CurrentHeatingCoolingState.OFF = 0;\n CurrentHeatingCoolingState.HEAT = 1;\n CurrentHeatingCoolingState.COOL = 2;\n return CurrentHeatingCoolingState;\n}(Characteristic_1.Characteristic));\nexports.CurrentHeatingCoolingState = CurrentHeatingCoolingState;\nCharacteristic_1.Characteristic.CurrentHeatingCoolingState = CurrentHeatingCoolingState;\n/**\n * Characteristic \"Current Horizontal Tilt Angle\"\n */\nvar CurrentHorizontalTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentHorizontalTiltAngle, _super);\n function CurrentHorizontalTiltAngle() {\n var _this = _super.call(this, \"Current Horizontal Tilt Angle\", CurrentHorizontalTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentHorizontalTiltAngle.UUID = \"0000006C-0000-1000-8000-0026BB765291\";\n return CurrentHorizontalTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.CurrentHorizontalTiltAngle = CurrentHorizontalTiltAngle;\nCharacteristic_1.Characteristic.CurrentHorizontalTiltAngle = CurrentHorizontalTiltAngle;\n/**\n * Characteristic \"Current Humidifier-Dehumidifier State\"\n */\nvar CurrentHumidifierDehumidifierState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentHumidifierDehumidifierState, _super);\n function CurrentHumidifierDehumidifierState() {\n var _this = _super.call(this, \"Current Humidifier-Dehumidifier State\", CurrentHumidifierDehumidifierState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentHumidifierDehumidifierState.UUID = \"000000B3-0000-1000-8000-0026BB765291\";\n CurrentHumidifierDehumidifierState.INACTIVE = 0;\n CurrentHumidifierDehumidifierState.IDLE = 1;\n CurrentHumidifierDehumidifierState.HUMIDIFYING = 2;\n CurrentHumidifierDehumidifierState.DEHUMIDIFYING = 3;\n return CurrentHumidifierDehumidifierState;\n}(Characteristic_1.Characteristic));\nexports.CurrentHumidifierDehumidifierState = CurrentHumidifierDehumidifierState;\nCharacteristic_1.Characteristic.CurrentHumidifierDehumidifierState = CurrentHumidifierDehumidifierState;\n/**\n * Characteristic \"Current Media State\"\n */\nvar CurrentMediaState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentMediaState, _super);\n function CurrentMediaState() {\n var _this = _super.call(this, \"Current Media State\", CurrentMediaState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 5,\n minStep: 1,\n validValues: [0, 1, 2, 4, 5],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentMediaState.UUID = \"000000E0-0000-1000-8000-0026BB765291\";\n CurrentMediaState.PLAY = 0;\n CurrentMediaState.PAUSE = 1;\n CurrentMediaState.STOP = 2;\n CurrentMediaState.LOADING = 4;\n CurrentMediaState.INTERRUPTED = 5;\n return CurrentMediaState;\n}(Characteristic_1.Characteristic));\nexports.CurrentMediaState = CurrentMediaState;\nCharacteristic_1.Characteristic.CurrentMediaState = CurrentMediaState;\n/**\n * Characteristic \"Current Position\"\n */\nvar CurrentPosition = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentPosition, _super);\n function CurrentPosition() {\n var _this = _super.call(this, \"Current Position\", CurrentPosition.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentPosition.UUID = \"0000006D-0000-1000-8000-0026BB765291\";\n return CurrentPosition;\n}(Characteristic_1.Characteristic));\nexports.CurrentPosition = CurrentPosition;\nCharacteristic_1.Characteristic.CurrentPosition = CurrentPosition;\n/**\n * Characteristic \"Current Relative Humidity\"\n */\nvar CurrentRelativeHumidity = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentRelativeHumidity, _super);\n function CurrentRelativeHumidity() {\n var _this = _super.call(this, \"Current Relative Humidity\", CurrentRelativeHumidity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentRelativeHumidity.UUID = \"00000010-0000-1000-8000-0026BB765291\";\n return CurrentRelativeHumidity;\n}(Characteristic_1.Characteristic));\nexports.CurrentRelativeHumidity = CurrentRelativeHumidity;\nCharacteristic_1.Characteristic.CurrentRelativeHumidity = CurrentRelativeHumidity;\n/**\n * Characteristic \"Current Slat State\"\n */\nvar CurrentSlatState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentSlatState, _super);\n function CurrentSlatState() {\n var _this = _super.call(this, \"Current Slat State\", CurrentSlatState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentSlatState.UUID = \"000000AA-0000-1000-8000-0026BB765291\";\n CurrentSlatState.FIXED = 0;\n CurrentSlatState.JAMMED = 1;\n CurrentSlatState.SWINGING = 2;\n return CurrentSlatState;\n}(Characteristic_1.Characteristic));\nexports.CurrentSlatState = CurrentSlatState;\nCharacteristic_1.Characteristic.CurrentSlatState = CurrentSlatState;\n/**\n * Characteristic \"Current Temperature\"\n */\nvar CurrentTemperature = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentTemperature, _super);\n function CurrentTemperature() {\n var _this = _super.call(this, \"Current Temperature\", CurrentTemperature.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"celsius\" /* Units.CELSIUS */,\n minValue: -270,\n maxValue: 100,\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentTemperature.UUID = \"00000011-0000-1000-8000-0026BB765291\";\n return CurrentTemperature;\n}(Characteristic_1.Characteristic));\nexports.CurrentTemperature = CurrentTemperature;\nCharacteristic_1.Characteristic.CurrentTemperature = CurrentTemperature;\n/**\n * Characteristic \"Current Tilt Angle\"\n */\nvar CurrentTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentTiltAngle, _super);\n function CurrentTiltAngle() {\n var _this = _super.call(this, \"Current Tilt Angle\", CurrentTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentTiltAngle.UUID = \"000000C1-0000-1000-8000-0026BB765291\";\n return CurrentTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.CurrentTiltAngle = CurrentTiltAngle;\nCharacteristic_1.Characteristic.CurrentTiltAngle = CurrentTiltAngle;\n/**\n * Characteristic \"Current Time\"\n * @deprecated Removed and not used anymore\n */\nvar CurrentTime = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentTime, _super);\n function CurrentTime() {\n var _this = _super.call(this, \"Current Time\", CurrentTime.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentTime.UUID = \"0000009B-0000-1000-8000-0026BB765291\";\n return CurrentTime;\n}(Characteristic_1.Characteristic));\nexports.CurrentTime = CurrentTime;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.CurrentTime = CurrentTime;\n/**\n * Characteristic \"Current Transport\"\n * @since iOS 14\n */\nvar CurrentTransport = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentTransport, _super);\n function CurrentTransport() {\n var _this = _super.call(this, \"Current Transport\", CurrentTransport.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentTransport.UUID = \"0000022B-0000-1000-8000-0026BB765291\";\n return CurrentTransport;\n}(Characteristic_1.Characteristic));\nexports.CurrentTransport = CurrentTransport;\nCharacteristic_1.Characteristic.CurrentTransport = CurrentTransport;\n/**\n * Characteristic \"Current Vertical Tilt Angle\"\n */\nvar CurrentVerticalTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentVerticalTiltAngle, _super);\n function CurrentVerticalTiltAngle() {\n var _this = _super.call(this, \"Current Vertical Tilt Angle\", CurrentVerticalTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentVerticalTiltAngle.UUID = \"0000006E-0000-1000-8000-0026BB765291\";\n return CurrentVerticalTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.CurrentVerticalTiltAngle = CurrentVerticalTiltAngle;\nCharacteristic_1.Characteristic.CurrentVerticalTiltAngle = CurrentVerticalTiltAngle;\n/**\n * Characteristic \"Current Visibility State\"\n */\nvar CurrentVisibilityState = /** @class */ (function (_super) {\n tslib_1.__extends(CurrentVisibilityState, _super);\n function CurrentVisibilityState() {\n var _this = _super.call(this, \"Current Visibility State\", CurrentVisibilityState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n CurrentVisibilityState.UUID = \"00000135-0000-1000-8000-0026BB765291\";\n CurrentVisibilityState.SHOWN = 0;\n CurrentVisibilityState.HIDDEN = 1;\n return CurrentVisibilityState;\n}(Characteristic_1.Characteristic));\nexports.CurrentVisibilityState = CurrentVisibilityState;\nCharacteristic_1.Characteristic.CurrentVisibilityState = CurrentVisibilityState;\n/**\n * Characteristic \"Data Stream HAP Transport\"\n * @since iOS 14\n */\nvar DataStreamHAPTransport = /** @class */ (function (_super) {\n tslib_1.__extends(DataStreamHAPTransport, _super);\n function DataStreamHAPTransport() {\n var _this = _super.call(this, \"Data Stream HAP Transport\", DataStreamHAPTransport.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DataStreamHAPTransport.UUID = \"00000138-0000-1000-8000-0026BB765291\";\n return DataStreamHAPTransport;\n}(Characteristic_1.Characteristic));\nexports.DataStreamHAPTransport = DataStreamHAPTransport;\nCharacteristic_1.Characteristic.DataStreamHAPTransport = DataStreamHAPTransport;\n/**\n * Characteristic \"Data Stream HAP Transport Interrupt\"\n * @since iOS 14\n */\nvar DataStreamHAPTransportInterrupt = /** @class */ (function (_super) {\n tslib_1.__extends(DataStreamHAPTransportInterrupt, _super);\n function DataStreamHAPTransportInterrupt() {\n var _this = _super.call(this, \"Data Stream HAP Transport Interrupt\", DataStreamHAPTransportInterrupt.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DataStreamHAPTransportInterrupt.UUID = \"00000139-0000-1000-8000-0026BB765291\";\n return DataStreamHAPTransportInterrupt;\n}(Characteristic_1.Characteristic));\nexports.DataStreamHAPTransportInterrupt = DataStreamHAPTransportInterrupt;\nCharacteristic_1.Characteristic.DataStreamHAPTransportInterrupt = DataStreamHAPTransportInterrupt;\n/**\n * Characteristic \"Day of the Week\"\n * @deprecated Removed and not used anymore\n */\nvar DayoftheWeek = /** @class */ (function (_super) {\n tslib_1.__extends(DayoftheWeek, _super);\n function DayoftheWeek() {\n var _this = _super.call(this, \"Day of the Week\", DayoftheWeek.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 1,\n maxValue: 7,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DayoftheWeek.UUID = \"00000098-0000-1000-8000-0026BB765291\";\n return DayoftheWeek;\n}(Characteristic_1.Characteristic));\nexports.DayoftheWeek = DayoftheWeek;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.DayoftheWeek = DayoftheWeek;\n/**\n * Characteristic \"Diagonal Field Of View\"\n * @since iOS 13.2\n */\nvar DiagonalFieldOfView = /** @class */ (function (_super) {\n tslib_1.__extends(DiagonalFieldOfView, _super);\n function DiagonalFieldOfView() {\n var _this = _super.call(this, \"Diagonal Field Of View\", DiagonalFieldOfView.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: 0,\n maxValue: 360,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DiagonalFieldOfView.UUID = \"00000224-0000-1000-8000-0026BB765291\";\n return DiagonalFieldOfView;\n}(Characteristic_1.Characteristic));\nexports.DiagonalFieldOfView = DiagonalFieldOfView;\nCharacteristic_1.Characteristic.DiagonalFieldOfView = DiagonalFieldOfView;\n/**\n * Characteristic \"Digital Zoom\"\n */\nvar DigitalZoom = /** @class */ (function (_super) {\n tslib_1.__extends(DigitalZoom, _super);\n function DigitalZoom() {\n var _this = _super.call(this, \"Digital Zoom\", DigitalZoom.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DigitalZoom.UUID = \"0000011D-0000-1000-8000-0026BB765291\";\n return DigitalZoom;\n}(Characteristic_1.Characteristic));\nexports.DigitalZoom = DigitalZoom;\nCharacteristic_1.Characteristic.DigitalZoom = DigitalZoom;\n/**\n * Characteristic \"Discover Bridged Accessories\"\n * @deprecated Removed and not used anymore\n */\nvar DiscoverBridgedAccessories = /** @class */ (function (_super) {\n tslib_1.__extends(DiscoverBridgedAccessories, _super);\n function DiscoverBridgedAccessories() {\n var _this = _super.call(this, \"Discover Bridged Accessories\", DiscoverBridgedAccessories.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DiscoverBridgedAccessories.UUID = \"0000009E-0000-1000-8000-0026BB765291\";\n return DiscoverBridgedAccessories;\n}(Characteristic_1.Characteristic));\nexports.DiscoverBridgedAccessories = DiscoverBridgedAccessories;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.DiscoverBridgedAccessories = DiscoverBridgedAccessories;\n/**\n * Characteristic \"Discovered Bridged Accessories\"\n * @deprecated Removed and not used anymore\n */\nvar DiscoveredBridgedAccessories = /** @class */ (function (_super) {\n tslib_1.__extends(DiscoveredBridgedAccessories, _super);\n function DiscoveredBridgedAccessories() {\n var _this = _super.call(this, \"Discovered Bridged Accessories\", DiscoveredBridgedAccessories.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DiscoveredBridgedAccessories.UUID = \"0000009F-0000-1000-8000-0026BB765291\";\n return DiscoveredBridgedAccessories;\n}(Characteristic_1.Characteristic));\nexports.DiscoveredBridgedAccessories = DiscoveredBridgedAccessories;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.DiscoveredBridgedAccessories = DiscoveredBridgedAccessories;\n/**\n * Characteristic \"Display Order\"\n */\nvar DisplayOrder = /** @class */ (function (_super) {\n tslib_1.__extends(DisplayOrder, _super);\n function DisplayOrder() {\n var _this = _super.call(this, \"Display Order\", DisplayOrder.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n DisplayOrder.UUID = \"00000136-0000-1000-8000-0026BB765291\";\n return DisplayOrder;\n}(Characteristic_1.Characteristic));\nexports.DisplayOrder = DisplayOrder;\nCharacteristic_1.Characteristic.DisplayOrder = DisplayOrder;\n/**\n * Characteristic \"Event Retransmission Maximum\"\n * @since iOS 14\n */\nvar EventRetransmissionMaximum = /** @class */ (function (_super) {\n tslib_1.__extends(EventRetransmissionMaximum, _super);\n function EventRetransmissionMaximum() {\n var _this = _super.call(this, \"Event Retransmission Maximum\", EventRetransmissionMaximum.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n EventRetransmissionMaximum.UUID = \"0000023D-0000-1000-8000-0026BB765291\";\n return EventRetransmissionMaximum;\n}(Characteristic_1.Characteristic));\nexports.EventRetransmissionMaximum = EventRetransmissionMaximum;\nCharacteristic_1.Characteristic.EventRetransmissionMaximum = EventRetransmissionMaximum;\n/**\n * Characteristic \"Event Snapshots Active\"\n */\nvar EventSnapshotsActive = /** @class */ (function (_super) {\n tslib_1.__extends(EventSnapshotsActive, _super);\n function EventSnapshotsActive() {\n var _this = _super.call(this, \"Event Snapshots Active\", EventSnapshotsActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n EventSnapshotsActive.UUID = \"00000223-0000-1000-8000-0026BB765291\";\n EventSnapshotsActive.DISABLE = 0;\n EventSnapshotsActive.ENABLE = 1;\n return EventSnapshotsActive;\n}(Characteristic_1.Characteristic));\nexports.EventSnapshotsActive = EventSnapshotsActive;\nCharacteristic_1.Characteristic.EventSnapshotsActive = EventSnapshotsActive;\n/**\n * Characteristic \"Event Transmission Counters\"\n * @since iOS 14\n */\nvar EventTransmissionCounters = /** @class */ (function (_super) {\n tslib_1.__extends(EventTransmissionCounters, _super);\n function EventTransmissionCounters() {\n var _this = _super.call(this, \"Event Transmission Counters\", EventTransmissionCounters.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n EventTransmissionCounters.UUID = \"0000023E-0000-1000-8000-0026BB765291\";\n return EventTransmissionCounters;\n}(Characteristic_1.Characteristic));\nexports.EventTransmissionCounters = EventTransmissionCounters;\nCharacteristic_1.Characteristic.EventTransmissionCounters = EventTransmissionCounters;\n/**\n * Characteristic \"Filter Change Indication\"\n */\nvar FilterChangeIndication = /** @class */ (function (_super) {\n tslib_1.__extends(FilterChangeIndication, _super);\n function FilterChangeIndication() {\n var _this = _super.call(this, \"Filter Change Indication\", FilterChangeIndication.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n FilterChangeIndication.UUID = \"000000AC-0000-1000-8000-0026BB765291\";\n FilterChangeIndication.FILTER_OK = 0;\n FilterChangeIndication.CHANGE_FILTER = 1;\n return FilterChangeIndication;\n}(Characteristic_1.Characteristic));\nexports.FilterChangeIndication = FilterChangeIndication;\nCharacteristic_1.Characteristic.FilterChangeIndication = FilterChangeIndication;\n/**\n * Characteristic \"Filter Life Level\"\n */\nvar FilterLifeLevel = /** @class */ (function (_super) {\n tslib_1.__extends(FilterLifeLevel, _super);\n function FilterLifeLevel() {\n var _this = _super.call(this, \"Filter Life Level\", FilterLifeLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n FilterLifeLevel.UUID = \"000000AB-0000-1000-8000-0026BB765291\";\n return FilterLifeLevel;\n}(Characteristic_1.Characteristic));\nexports.FilterLifeLevel = FilterLifeLevel;\nCharacteristic_1.Characteristic.FilterLifeLevel = FilterLifeLevel;\n/**\n * Characteristic \"Firmware Revision\"\n */\nvar FirmwareRevision = /** @class */ (function (_super) {\n tslib_1.__extends(FirmwareRevision, _super);\n function FirmwareRevision() {\n var _this = _super.call(this, \"Firmware Revision\", FirmwareRevision.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n FirmwareRevision.UUID = \"00000052-0000-1000-8000-0026BB765291\";\n return FirmwareRevision;\n}(Characteristic_1.Characteristic));\nexports.FirmwareRevision = FirmwareRevision;\nCharacteristic_1.Characteristic.FirmwareRevision = FirmwareRevision;\n/**\n * Characteristic \"Firmware Update Readiness\"\n */\nvar FirmwareUpdateReadiness = /** @class */ (function (_super) {\n tslib_1.__extends(FirmwareUpdateReadiness, _super);\n function FirmwareUpdateReadiness() {\n var _this = _super.call(this, \"Firmware Update Readiness\", FirmwareUpdateReadiness.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n FirmwareUpdateReadiness.UUID = \"00000234-0000-1000-8000-0026BB765291\";\n return FirmwareUpdateReadiness;\n}(Characteristic_1.Characteristic));\nexports.FirmwareUpdateReadiness = FirmwareUpdateReadiness;\nCharacteristic_1.Characteristic.FirmwareUpdateReadiness = FirmwareUpdateReadiness;\n/**\n * Characteristic \"Firmware Update Status\"\n */\nvar FirmwareUpdateStatus = /** @class */ (function (_super) {\n tslib_1.__extends(FirmwareUpdateStatus, _super);\n function FirmwareUpdateStatus() {\n var _this = _super.call(this, \"Firmware Update Status\", FirmwareUpdateStatus.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n FirmwareUpdateStatus.UUID = \"00000235-0000-1000-8000-0026BB765291\";\n return FirmwareUpdateStatus;\n}(Characteristic_1.Characteristic));\nexports.FirmwareUpdateStatus = FirmwareUpdateStatus;\nCharacteristic_1.Characteristic.FirmwareUpdateStatus = FirmwareUpdateStatus;\n/**\n * Characteristic \"Hardware Finish\"\n * @since iOS 15\n */\nvar HardwareFinish = /** @class */ (function (_super) {\n tslib_1.__extends(HardwareFinish, _super);\n function HardwareFinish() {\n var _this = _super.call(this, \"Hardware Finish\", HardwareFinish.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HardwareFinish.UUID = \"0000026C-0000-1000-8000-0026BB765291\";\n return HardwareFinish;\n}(Characteristic_1.Characteristic));\nexports.HardwareFinish = HardwareFinish;\nCharacteristic_1.Characteristic.HardwareFinish = HardwareFinish;\n/**\n * Characteristic \"Hardware Revision\"\n */\nvar HardwareRevision = /** @class */ (function (_super) {\n tslib_1.__extends(HardwareRevision, _super);\n function HardwareRevision() {\n var _this = _super.call(this, \"Hardware Revision\", HardwareRevision.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HardwareRevision.UUID = \"00000053-0000-1000-8000-0026BB765291\";\n return HardwareRevision;\n}(Characteristic_1.Characteristic));\nexports.HardwareRevision = HardwareRevision;\nCharacteristic_1.Characteristic.HardwareRevision = HardwareRevision;\n/**\n * Characteristic \"Heart Beat\"\n * @since iOS 14\n */\nvar HeartBeat = /** @class */ (function (_super) {\n tslib_1.__extends(HeartBeat, _super);\n function HeartBeat() {\n var _this = _super.call(this, \"Heart Beat\", HeartBeat.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HeartBeat.UUID = \"0000024A-0000-1000-8000-0026BB765291\";\n return HeartBeat;\n}(Characteristic_1.Characteristic));\nexports.HeartBeat = HeartBeat;\nCharacteristic_1.Characteristic.HeartBeat = HeartBeat;\n/**\n * Characteristic \"Heating Threshold Temperature\"\n */\nvar HeatingThresholdTemperature = /** @class */ (function (_super) {\n tslib_1.__extends(HeatingThresholdTemperature, _super);\n function HeatingThresholdTemperature() {\n var _this = _super.call(this, \"Heating Threshold Temperature\", HeatingThresholdTemperature.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"celsius\" /* Units.CELSIUS */,\n minValue: 0,\n maxValue: 25,\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HeatingThresholdTemperature.UUID = \"00000012-0000-1000-8000-0026BB765291\";\n return HeatingThresholdTemperature;\n}(Characteristic_1.Characteristic));\nexports.HeatingThresholdTemperature = HeatingThresholdTemperature;\nCharacteristic_1.Characteristic.HeatingThresholdTemperature = HeatingThresholdTemperature;\n/**\n * Characteristic \"Hold Position\"\n */\nvar HoldPosition = /** @class */ (function (_super) {\n tslib_1.__extends(HoldPosition, _super);\n function HoldPosition() {\n var _this = _super.call(this, \"Hold Position\", HoldPosition.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HoldPosition.UUID = \"0000006F-0000-1000-8000-0026BB765291\";\n return HoldPosition;\n}(Characteristic_1.Characteristic));\nexports.HoldPosition = HoldPosition;\nCharacteristic_1.Characteristic.HoldPosition = HoldPosition;\n/**\n * Characteristic \"HomeKit Camera Active\"\n */\nvar HomeKitCameraActive = /** @class */ (function (_super) {\n tslib_1.__extends(HomeKitCameraActive, _super);\n function HomeKitCameraActive() {\n var _this = _super.call(this, \"HomeKit Camera Active\", HomeKitCameraActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n HomeKitCameraActive.UUID = \"0000021B-0000-1000-8000-0026BB765291\";\n HomeKitCameraActive.OFF = 0;\n HomeKitCameraActive.ON = 1;\n return HomeKitCameraActive;\n}(Characteristic_1.Characteristic));\nexports.HomeKitCameraActive = HomeKitCameraActive;\nCharacteristic_1.Characteristic.HomeKitCameraActive = HomeKitCameraActive;\n/**\n * Characteristic \"Hue\"\n */\nvar Hue = /** @class */ (function (_super) {\n tslib_1.__extends(Hue, _super);\n function Hue() {\n var _this = _super.call(this, \"Hue\", Hue.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: 0,\n maxValue: 360,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Hue.UUID = \"00000013-0000-1000-8000-0026BB765291\";\n return Hue;\n}(Characteristic_1.Characteristic));\nexports.Hue = Hue;\nCharacteristic_1.Characteristic.Hue = Hue;\n/**\n * Characteristic \"Identifier\"\n */\nvar Identifier = /** @class */ (function (_super) {\n tslib_1.__extends(Identifier, _super);\n function Identifier() {\n var _this = _super.call(this, \"Identifier\", Identifier.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Identifier.UUID = \"000000E6-0000-1000-8000-0026BB765291\";\n return Identifier;\n}(Characteristic_1.Characteristic));\nexports.Identifier = Identifier;\nCharacteristic_1.Characteristic.Identifier = Identifier;\n/**\n * Characteristic \"Identify\"\n */\nvar Identify = /** @class */ (function (_super) {\n tslib_1.__extends(Identify, _super);\n function Identify() {\n var _this = _super.call(this, \"Identify\", Identify.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Identify.UUID = \"00000014-0000-1000-8000-0026BB765291\";\n return Identify;\n}(Characteristic_1.Characteristic));\nexports.Identify = Identify;\nCharacteristic_1.Characteristic.Identify = Identify;\n/**\n * Characteristic \"Image Mirroring\"\n */\nvar ImageMirroring = /** @class */ (function (_super) {\n tslib_1.__extends(ImageMirroring, _super);\n function ImageMirroring() {\n var _this = _super.call(this, \"Image Mirroring\", ImageMirroring.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ImageMirroring.UUID = \"0000011F-0000-1000-8000-0026BB765291\";\n return ImageMirroring;\n}(Characteristic_1.Characteristic));\nexports.ImageMirroring = ImageMirroring;\nCharacteristic_1.Characteristic.ImageMirroring = ImageMirroring;\n/**\n * Characteristic \"Image Rotation\"\n */\nvar ImageRotation = /** @class */ (function (_super) {\n tslib_1.__extends(ImageRotation, _super);\n function ImageRotation() {\n var _this = _super.call(this, \"Image Rotation\", ImageRotation.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: 0,\n maxValue: 360,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ImageRotation.UUID = \"0000011E-0000-1000-8000-0026BB765291\";\n return ImageRotation;\n}(Characteristic_1.Characteristic));\nexports.ImageRotation = ImageRotation;\nCharacteristic_1.Characteristic.ImageRotation = ImageRotation;\n/**\n * Characteristic \"Input Device Type\"\n */\nvar InputDeviceType = /** @class */ (function (_super) {\n tslib_1.__extends(InputDeviceType, _super);\n function InputDeviceType() {\n var _this = _super.call(this, \"Input Device Type\", InputDeviceType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 6,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5, 6],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n InputDeviceType.UUID = \"000000DC-0000-1000-8000-0026BB765291\";\n InputDeviceType.OTHER = 0;\n InputDeviceType.TV = 1;\n InputDeviceType.RECORDING = 2;\n InputDeviceType.TUNER = 3;\n InputDeviceType.PLAYBACK = 4;\n InputDeviceType.AUDIO_SYSTEM = 5;\n return InputDeviceType;\n}(Characteristic_1.Characteristic));\nexports.InputDeviceType = InputDeviceType;\nCharacteristic_1.Characteristic.InputDeviceType = InputDeviceType;\n/**\n * Characteristic \"Input Source Type\"\n */\nvar InputSourceType = /** @class */ (function (_super) {\n tslib_1.__extends(InputSourceType, _super);\n function InputSourceType() {\n var _this = _super.call(this, \"Input Source Type\", InputSourceType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 10,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n InputSourceType.UUID = \"000000DB-0000-1000-8000-0026BB765291\";\n InputSourceType.OTHER = 0;\n InputSourceType.HOME_SCREEN = 1;\n InputSourceType.TUNER = 2;\n InputSourceType.HDMI = 3;\n InputSourceType.COMPOSITE_VIDEO = 4;\n InputSourceType.S_VIDEO = 5;\n InputSourceType.COMPONENT_VIDEO = 6;\n InputSourceType.DVI = 7;\n InputSourceType.AIRPLAY = 8;\n InputSourceType.USB = 9;\n InputSourceType.APPLICATION = 10;\n return InputSourceType;\n}(Characteristic_1.Characteristic));\nexports.InputSourceType = InputSourceType;\nCharacteristic_1.Characteristic.InputSourceType = InputSourceType;\n/**\n * Characteristic \"In Use\"\n */\nvar InUse = /** @class */ (function (_super) {\n tslib_1.__extends(InUse, _super);\n function InUse() {\n var _this = _super.call(this, \"In Use\", InUse.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n InUse.UUID = \"000000D2-0000-1000-8000-0026BB765291\";\n InUse.NOT_IN_USE = 0;\n InUse.IN_USE = 1;\n return InUse;\n}(Characteristic_1.Characteristic));\nexports.InUse = InUse;\nCharacteristic_1.Characteristic.InUse = InUse;\n/**\n * Characteristic \"Is Configured\"\n */\nvar IsConfigured = /** @class */ (function (_super) {\n tslib_1.__extends(IsConfigured, _super);\n function IsConfigured() {\n var _this = _super.call(this, \"Is Configured\", IsConfigured.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n IsConfigured.UUID = \"000000D6-0000-1000-8000-0026BB765291\";\n IsConfigured.NOT_CONFIGURED = 0;\n IsConfigured.CONFIGURED = 1;\n return IsConfigured;\n}(Characteristic_1.Characteristic));\nexports.IsConfigured = IsConfigured;\nCharacteristic_1.Characteristic.IsConfigured = IsConfigured;\n/**\n * Characteristic \"Leak Detected\"\n */\nvar LeakDetected = /** @class */ (function (_super) {\n tslib_1.__extends(LeakDetected, _super);\n function LeakDetected() {\n var _this = _super.call(this, \"Leak Detected\", LeakDetected.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LeakDetected.UUID = \"00000070-0000-1000-8000-0026BB765291\";\n LeakDetected.LEAK_NOT_DETECTED = 0;\n LeakDetected.LEAK_DETECTED = 1;\n return LeakDetected;\n}(Characteristic_1.Characteristic));\nexports.LeakDetected = LeakDetected;\nCharacteristic_1.Characteristic.LeakDetected = LeakDetected;\n/**\n * Characteristic \"Link Quality\"\n * @deprecated Removed and not used anymore\n */\nvar LinkQuality = /** @class */ (function (_super) {\n tslib_1.__extends(LinkQuality, _super);\n function LinkQuality() {\n var _this = _super.call(this, \"Link Quality\", LinkQuality.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 1,\n maxValue: 4,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LinkQuality.UUID = \"0000009C-0000-1000-8000-0026BB765291\";\n return LinkQuality;\n}(Characteristic_1.Characteristic));\nexports.LinkQuality = LinkQuality;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.LinkQuality = LinkQuality;\n/**\n * Characteristic \"List Pairings\"\n */\nvar ListPairings = /** @class */ (function (_super) {\n tslib_1.__extends(ListPairings, _super);\n function ListPairings() {\n var _this = _super.call(this, \"List Pairings\", ListPairings.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ListPairings.UUID = \"00000050-0000-1000-8000-0026BB765291\";\n return ListPairings;\n}(Characteristic_1.Characteristic));\nexports.ListPairings = ListPairings;\nCharacteristic_1.Characteristic.ListPairings = ListPairings;\n/**\n * Characteristic \"Lock Control Point\"\n */\nvar LockControlPoint = /** @class */ (function (_super) {\n tslib_1.__extends(LockControlPoint, _super);\n function LockControlPoint() {\n var _this = _super.call(this, \"Lock Control Point\", LockControlPoint.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockControlPoint.UUID = \"00000019-0000-1000-8000-0026BB765291\";\n return LockControlPoint;\n}(Characteristic_1.Characteristic));\nexports.LockControlPoint = LockControlPoint;\nCharacteristic_1.Characteristic.LockControlPoint = LockControlPoint;\n/**\n * Characteristic \"Lock Current State\"\n */\nvar LockCurrentState = /** @class */ (function (_super) {\n tslib_1.__extends(LockCurrentState, _super);\n function LockCurrentState() {\n var _this = _super.call(this, \"Lock Current State\", LockCurrentState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockCurrentState.UUID = \"0000001D-0000-1000-8000-0026BB765291\";\n LockCurrentState.UNSECURED = 0;\n LockCurrentState.SECURED = 1;\n LockCurrentState.JAMMED = 2;\n LockCurrentState.UNKNOWN = 3;\n return LockCurrentState;\n}(Characteristic_1.Characteristic));\nexports.LockCurrentState = LockCurrentState;\nCharacteristic_1.Characteristic.LockCurrentState = LockCurrentState;\n/**\n * Characteristic \"Lock Last Known Action\"\n */\nvar LockLastKnownAction = /** @class */ (function (_super) {\n tslib_1.__extends(LockLastKnownAction, _super);\n function LockLastKnownAction() {\n var _this = _super.call(this, \"Lock Last Known Action\", LockLastKnownAction.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 10,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockLastKnownAction.UUID = \"0000001C-0000-1000-8000-0026BB765291\";\n LockLastKnownAction.SECURED_PHYSICALLY_INTERIOR = 0;\n LockLastKnownAction.UNSECURED_PHYSICALLY_INTERIOR = 1;\n LockLastKnownAction.SECURED_PHYSICALLY_EXTERIOR = 2;\n LockLastKnownAction.UNSECURED_PHYSICALLY_EXTERIOR = 3;\n LockLastKnownAction.SECURED_BY_KEYPAD = 4;\n LockLastKnownAction.UNSECURED_BY_KEYPAD = 5;\n LockLastKnownAction.SECURED_REMOTELY = 6;\n LockLastKnownAction.UNSECURED_REMOTELY = 7;\n LockLastKnownAction.SECURED_BY_AUTO_SECURE_TIMEOUT = 8;\n LockLastKnownAction.SECURED_PHYSICALLY = 9;\n LockLastKnownAction.UNSECURED_PHYSICALLY = 10;\n return LockLastKnownAction;\n}(Characteristic_1.Characteristic));\nexports.LockLastKnownAction = LockLastKnownAction;\nCharacteristic_1.Characteristic.LockLastKnownAction = LockLastKnownAction;\n/**\n * Characteristic \"Lock Management Auto Security Timeout\"\n */\nvar LockManagementAutoSecurityTimeout = /** @class */ (function (_super) {\n tslib_1.__extends(LockManagementAutoSecurityTimeout, _super);\n function LockManagementAutoSecurityTimeout() {\n var _this = _super.call(this, \"Lock Management Auto Security Timeout\", LockManagementAutoSecurityTimeout.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"seconds\" /* Units.SECONDS */,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockManagementAutoSecurityTimeout.UUID = \"0000001A-0000-1000-8000-0026BB765291\";\n return LockManagementAutoSecurityTimeout;\n}(Characteristic_1.Characteristic));\nexports.LockManagementAutoSecurityTimeout = LockManagementAutoSecurityTimeout;\nCharacteristic_1.Characteristic.LockManagementAutoSecurityTimeout = LockManagementAutoSecurityTimeout;\n/**\n * Characteristic \"Lock Physical Controls\"\n */\nvar LockPhysicalControls = /** @class */ (function (_super) {\n tslib_1.__extends(LockPhysicalControls, _super);\n function LockPhysicalControls() {\n var _this = _super.call(this, \"Lock Physical Controls\", LockPhysicalControls.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockPhysicalControls.UUID = \"000000A7-0000-1000-8000-0026BB765291\";\n LockPhysicalControls.CONTROL_LOCK_DISABLED = 0;\n LockPhysicalControls.CONTROL_LOCK_ENABLED = 1;\n return LockPhysicalControls;\n}(Characteristic_1.Characteristic));\nexports.LockPhysicalControls = LockPhysicalControls;\nCharacteristic_1.Characteristic.LockPhysicalControls = LockPhysicalControls;\n/**\n * Characteristic \"Lock Target State\"\n */\nvar LockTargetState = /** @class */ (function (_super) {\n tslib_1.__extends(LockTargetState, _super);\n function LockTargetState() {\n var _this = _super.call(this, \"Lock Target State\", LockTargetState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n LockTargetState.UUID = \"0000001E-0000-1000-8000-0026BB765291\";\n LockTargetState.UNSECURED = 0;\n LockTargetState.SECURED = 1;\n return LockTargetState;\n}(Characteristic_1.Characteristic));\nexports.LockTargetState = LockTargetState;\nCharacteristic_1.Characteristic.LockTargetState = LockTargetState;\n/**\n * Characteristic \"Logs\"\n */\nvar Logs = /** @class */ (function (_super) {\n tslib_1.__extends(Logs, _super);\n function Logs() {\n var _this = _super.call(this, \"Logs\", Logs.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Logs.UUID = \"0000001F-0000-1000-8000-0026BB765291\";\n return Logs;\n}(Characteristic_1.Characteristic));\nexports.Logs = Logs;\nCharacteristic_1.Characteristic.Logs = Logs;\n/**\n * Characteristic \"MAC Retransmission Maximum\"\n * @since iOS 14\n */\nvar MACRetransmissionMaximum = /** @class */ (function (_super) {\n tslib_1.__extends(MACRetransmissionMaximum, _super);\n function MACRetransmissionMaximum() {\n var _this = _super.call(this, \"MAC Retransmission Maximum\", MACRetransmissionMaximum.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MACRetransmissionMaximum.UUID = \"00000247-0000-1000-8000-0026BB765291\";\n return MACRetransmissionMaximum;\n}(Characteristic_1.Characteristic));\nexports.MACRetransmissionMaximum = MACRetransmissionMaximum;\nCharacteristic_1.Characteristic.MACRetransmissionMaximum = MACRetransmissionMaximum;\n/**\n * Characteristic \"MAC Transmission Counters\"\n */\nvar MACTransmissionCounters = /** @class */ (function (_super) {\n tslib_1.__extends(MACTransmissionCounters, _super);\n function MACTransmissionCounters() {\n var _this = _super.call(this, \"MAC Transmission Counters\", MACTransmissionCounters.UUID, {\n format: \"data\" /* Formats.DATA */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MACTransmissionCounters.UUID = \"00000248-0000-1000-8000-0026BB765291\";\n return MACTransmissionCounters;\n}(Characteristic_1.Characteristic));\nexports.MACTransmissionCounters = MACTransmissionCounters;\nCharacteristic_1.Characteristic.MACTransmissionCounters = MACTransmissionCounters;\n/**\n * Characteristic \"Managed Network Enable\"\n */\nvar ManagedNetworkEnable = /** @class */ (function (_super) {\n tslib_1.__extends(ManagedNetworkEnable, _super);\n function ManagedNetworkEnable() {\n var _this = _super.call(this, \"Managed Network Enable\", ManagedNetworkEnable.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */],\n minValue: 0,\n maxValue: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ManagedNetworkEnable.UUID = \"00000215-0000-1000-8000-0026BB765291\";\n ManagedNetworkEnable.DISABLED = 0;\n ManagedNetworkEnable.ENABLED = 1;\n return ManagedNetworkEnable;\n}(Characteristic_1.Characteristic));\nexports.ManagedNetworkEnable = ManagedNetworkEnable;\nCharacteristic_1.Characteristic.ManagedNetworkEnable = ManagedNetworkEnable;\n/**\n * Characteristic \"Manually Disabled\"\n */\nvar ManuallyDisabled = /** @class */ (function (_super) {\n tslib_1.__extends(ManuallyDisabled, _super);\n function ManuallyDisabled() {\n var _this = _super.call(this, \"Manually Disabled\", ManuallyDisabled.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ManuallyDisabled.UUID = \"00000227-0000-1000-8000-0026BB765291\";\n ManuallyDisabled.ENABLED = 0;\n ManuallyDisabled.DISABLED = 1;\n return ManuallyDisabled;\n}(Characteristic_1.Characteristic));\nexports.ManuallyDisabled = ManuallyDisabled;\nCharacteristic_1.Characteristic.ManuallyDisabled = ManuallyDisabled;\n/**\n * Characteristic \"Manufacturer\"\n */\nvar Manufacturer = /** @class */ (function (_super) {\n tslib_1.__extends(Manufacturer, _super);\n function Manufacturer() {\n var _this = _super.call(this, \"Manufacturer\", Manufacturer.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n maxLen: 64,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Manufacturer.UUID = \"00000020-0000-1000-8000-0026BB765291\";\n return Manufacturer;\n}(Characteristic_1.Characteristic));\nexports.Manufacturer = Manufacturer;\nCharacteristic_1.Characteristic.Manufacturer = Manufacturer;\n/**\n * Characteristic \"Maximum Transmit Power\"\n * @since iOS 14\n */\nvar MaximumTransmitPower = /** @class */ (function (_super) {\n tslib_1.__extends(MaximumTransmitPower, _super);\n function MaximumTransmitPower() {\n var _this = _super.call(this, \"Maximum Transmit Power\", MaximumTransmitPower.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MaximumTransmitPower.UUID = \"00000243-0000-1000-8000-0026BB765291\";\n return MaximumTransmitPower;\n}(Characteristic_1.Characteristic));\nexports.MaximumTransmitPower = MaximumTransmitPower;\nCharacteristic_1.Characteristic.MaximumTransmitPower = MaximumTransmitPower;\n/**\n * Characteristic \"Metrics Buffer Full State\"\n */\nvar MetricsBufferFullState = /** @class */ (function (_super) {\n tslib_1.__extends(MetricsBufferFullState, _super);\n function MetricsBufferFullState() {\n var _this = _super.call(this, \"Metrics Buffer Full State\", MetricsBufferFullState.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MetricsBufferFullState.UUID = \"00000272-0000-1000-8000-0026BB765291\";\n return MetricsBufferFullState;\n}(Characteristic_1.Characteristic));\nexports.MetricsBufferFullState = MetricsBufferFullState;\nCharacteristic_1.Characteristic.MetricsBufferFullState = MetricsBufferFullState;\n/**\n * Characteristic \"Model\"\n */\nvar Model = /** @class */ (function (_super) {\n tslib_1.__extends(Model, _super);\n function Model() {\n var _this = _super.call(this, \"Model\", Model.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n maxLen: 64,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Model.UUID = \"00000021-0000-1000-8000-0026BB765291\";\n return Model;\n}(Characteristic_1.Characteristic));\nexports.Model = Model;\nCharacteristic_1.Characteristic.Model = Model;\n/**\n * Characteristic \"Motion Detected\"\n */\nvar MotionDetected = /** @class */ (function (_super) {\n tslib_1.__extends(MotionDetected, _super);\n function MotionDetected() {\n var _this = _super.call(this, \"Motion Detected\", MotionDetected.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MotionDetected.UUID = \"00000022-0000-1000-8000-0026BB765291\";\n return MotionDetected;\n}(Characteristic_1.Characteristic));\nexports.MotionDetected = MotionDetected;\nCharacteristic_1.Characteristic.MotionDetected = MotionDetected;\n/**\n * Characteristic \"Multifunction Button\"\n */\nvar MultifunctionButton = /** @class */ (function (_super) {\n tslib_1.__extends(MultifunctionButton, _super);\n function MultifunctionButton() {\n var _this = _super.call(this, \"Multifunction Button\", MultifunctionButton.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n MultifunctionButton.UUID = \"0000026B-0000-1000-8000-0026BB765291\";\n return MultifunctionButton;\n}(Characteristic_1.Characteristic));\nexports.MultifunctionButton = MultifunctionButton;\nCharacteristic_1.Characteristic.MultifunctionButton = MultifunctionButton;\n/**\n * Characteristic \"Mute\"\n */\nvar Mute = /** @class */ (function (_super) {\n tslib_1.__extends(Mute, _super);\n function Mute() {\n var _this = _super.call(this, \"Mute\", Mute.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Mute.UUID = \"0000011A-0000-1000-8000-0026BB765291\";\n return Mute;\n}(Characteristic_1.Characteristic));\nexports.Mute = Mute;\nCharacteristic_1.Characteristic.Mute = Mute;\n/**\n * Characteristic \"Name\"\n */\nvar Name = /** @class */ (function (_super) {\n tslib_1.__extends(Name, _super);\n function Name() {\n var _this = _super.call(this, \"Name\", Name.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n maxLen: 64,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Name.UUID = \"00000023-0000-1000-8000-0026BB765291\";\n return Name;\n}(Characteristic_1.Characteristic));\nexports.Name = Name;\nCharacteristic_1.Characteristic.Name = Name;\n/**\n * Characteristic \"Network Access Violation Control\"\n */\nvar NetworkAccessViolationControl = /** @class */ (function (_super) {\n tslib_1.__extends(NetworkAccessViolationControl, _super);\n function NetworkAccessViolationControl() {\n var _this = _super.call(this, \"Network Access Violation Control\", NetworkAccessViolationControl.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NetworkAccessViolationControl.UUID = \"0000021F-0000-1000-8000-0026BB765291\";\n return NetworkAccessViolationControl;\n}(Characteristic_1.Characteristic));\nexports.NetworkAccessViolationControl = NetworkAccessViolationControl;\nCharacteristic_1.Characteristic.NetworkAccessViolationControl = NetworkAccessViolationControl;\n/**\n * Characteristic \"Network Client Profile Control\"\n */\nvar NetworkClientProfileControl = /** @class */ (function (_super) {\n tslib_1.__extends(NetworkClientProfileControl, _super);\n function NetworkClientProfileControl() {\n var _this = _super.call(this, \"Network Client Profile Control\", NetworkClientProfileControl.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NetworkClientProfileControl.UUID = \"0000020C-0000-1000-8000-0026BB765291\";\n return NetworkClientProfileControl;\n}(Characteristic_1.Characteristic));\nexports.NetworkClientProfileControl = NetworkClientProfileControl;\nCharacteristic_1.Characteristic.NetworkClientProfileControl = NetworkClientProfileControl;\n/**\n * Characteristic \"Network Client Status Control\"\n */\nvar NetworkClientStatusControl = /** @class */ (function (_super) {\n tslib_1.__extends(NetworkClientStatusControl, _super);\n function NetworkClientStatusControl() {\n var _this = _super.call(this, \"Network Client Status Control\", NetworkClientStatusControl.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NetworkClientStatusControl.UUID = \"0000020D-0000-1000-8000-0026BB765291\";\n return NetworkClientStatusControl;\n}(Characteristic_1.Characteristic));\nexports.NetworkClientStatusControl = NetworkClientStatusControl;\nCharacteristic_1.Characteristic.NetworkClientStatusControl = NetworkClientStatusControl;\n/**\n * Characteristic \"NFC Access Control Point\"\n * @since iOS 15\n */\nvar NFCAccessControlPoint = /** @class */ (function (_super) {\n tslib_1.__extends(NFCAccessControlPoint, _super);\n function NFCAccessControlPoint() {\n var _this = _super.call(this, \"NFC Access Control Point\", NFCAccessControlPoint.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NFCAccessControlPoint.UUID = \"00000264-0000-1000-8000-0026BB765291\";\n return NFCAccessControlPoint;\n}(Characteristic_1.Characteristic));\nexports.NFCAccessControlPoint = NFCAccessControlPoint;\nCharacteristic_1.Characteristic.NFCAccessControlPoint = NFCAccessControlPoint;\n/**\n * Characteristic \"NFC Access Supported Configuration\"\n * @since iOS 15\n */\nvar NFCAccessSupportedConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(NFCAccessSupportedConfiguration, _super);\n function NFCAccessSupportedConfiguration() {\n var _this = _super.call(this, \"NFC Access Supported Configuration\", NFCAccessSupportedConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NFCAccessSupportedConfiguration.UUID = \"00000265-0000-1000-8000-0026BB765291\";\n return NFCAccessSupportedConfiguration;\n}(Characteristic_1.Characteristic));\nexports.NFCAccessSupportedConfiguration = NFCAccessSupportedConfiguration;\nCharacteristic_1.Characteristic.NFCAccessSupportedConfiguration = NFCAccessSupportedConfiguration;\n/**\n * Characteristic \"Night Vision\"\n */\nvar NightVision = /** @class */ (function (_super) {\n tslib_1.__extends(NightVision, _super);\n function NightVision() {\n var _this = _super.call(this, \"Night Vision\", NightVision.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NightVision.UUID = \"0000011B-0000-1000-8000-0026BB765291\";\n return NightVision;\n}(Characteristic_1.Characteristic));\nexports.NightVision = NightVision;\nCharacteristic_1.Characteristic.NightVision = NightVision;\n/**\n * Characteristic \"Nitrogen Dioxide Density\"\n */\nvar NitrogenDioxideDensity = /** @class */ (function (_super) {\n tslib_1.__extends(NitrogenDioxideDensity, _super);\n function NitrogenDioxideDensity() {\n var _this = _super.call(this, \"Nitrogen Dioxide Density\", NitrogenDioxideDensity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n NitrogenDioxideDensity.UUID = \"000000C4-0000-1000-8000-0026BB765291\";\n return NitrogenDioxideDensity;\n}(Characteristic_1.Characteristic));\nexports.NitrogenDioxideDensity = NitrogenDioxideDensity;\nCharacteristic_1.Characteristic.NitrogenDioxideDensity = NitrogenDioxideDensity;\n/**\n * Characteristic \"Obstruction Detected\"\n */\nvar ObstructionDetected = /** @class */ (function (_super) {\n tslib_1.__extends(ObstructionDetected, _super);\n function ObstructionDetected() {\n var _this = _super.call(this, \"Obstruction Detected\", ObstructionDetected.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ObstructionDetected.UUID = \"00000024-0000-1000-8000-0026BB765291\";\n return ObstructionDetected;\n}(Characteristic_1.Characteristic));\nexports.ObstructionDetected = ObstructionDetected;\nCharacteristic_1.Characteristic.ObstructionDetected = ObstructionDetected;\n/**\n * Characteristic \"Occupancy Detected\"\n */\nvar OccupancyDetected = /** @class */ (function (_super) {\n tslib_1.__extends(OccupancyDetected, _super);\n function OccupancyDetected() {\n var _this = _super.call(this, \"Occupancy Detected\", OccupancyDetected.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n OccupancyDetected.UUID = \"00000071-0000-1000-8000-0026BB765291\";\n OccupancyDetected.OCCUPANCY_NOT_DETECTED = 0;\n OccupancyDetected.OCCUPANCY_DETECTED = 1;\n return OccupancyDetected;\n}(Characteristic_1.Characteristic));\nexports.OccupancyDetected = OccupancyDetected;\nCharacteristic_1.Characteristic.OccupancyDetected = OccupancyDetected;\n/**\n * Characteristic \"On\"\n */\nvar On = /** @class */ (function (_super) {\n tslib_1.__extends(On, _super);\n function On() {\n var _this = _super.call(this, \"On\", On.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n On.UUID = \"00000025-0000-1000-8000-0026BB765291\";\n return On;\n}(Characteristic_1.Characteristic));\nexports.On = On;\nCharacteristic_1.Characteristic.On = On;\n/**\n * Characteristic \"Operating State Response\"\n * @since iOS 14\n */\nvar OperatingStateResponse = /** @class */ (function (_super) {\n tslib_1.__extends(OperatingStateResponse, _super);\n function OperatingStateResponse() {\n var _this = _super.call(this, \"Operating State Response\", OperatingStateResponse.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n OperatingStateResponse.UUID = \"00000232-0000-1000-8000-0026BB765291\";\n return OperatingStateResponse;\n}(Characteristic_1.Characteristic));\nexports.OperatingStateResponse = OperatingStateResponse;\nCharacteristic_1.Characteristic.OperatingStateResponse = OperatingStateResponse;\n/**\n * Characteristic \"Optical Zoom\"\n */\nvar OpticalZoom = /** @class */ (function (_super) {\n tslib_1.__extends(OpticalZoom, _super);\n function OpticalZoom() {\n var _this = _super.call(this, \"Optical Zoom\", OpticalZoom.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n OpticalZoom.UUID = \"0000011C-0000-1000-8000-0026BB765291\";\n return OpticalZoom;\n}(Characteristic_1.Characteristic));\nexports.OpticalZoom = OpticalZoom;\nCharacteristic_1.Characteristic.OpticalZoom = OpticalZoom;\n/**\n * Characteristic \"Outlet In Use\"\n */\nvar OutletInUse = /** @class */ (function (_super) {\n tslib_1.__extends(OutletInUse, _super);\n function OutletInUse() {\n var _this = _super.call(this, \"Outlet In Use\", OutletInUse.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n OutletInUse.UUID = \"00000026-0000-1000-8000-0026BB765291\";\n return OutletInUse;\n}(Characteristic_1.Characteristic));\nexports.OutletInUse = OutletInUse;\nCharacteristic_1.Characteristic.OutletInUse = OutletInUse;\n/**\n * Characteristic \"Ozone Density\"\n */\nvar OzoneDensity = /** @class */ (function (_super) {\n tslib_1.__extends(OzoneDensity, _super);\n function OzoneDensity() {\n var _this = _super.call(this, \"Ozone Density\", OzoneDensity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n OzoneDensity.UUID = \"000000C3-0000-1000-8000-0026BB765291\";\n return OzoneDensity;\n}(Characteristic_1.Characteristic));\nexports.OzoneDensity = OzoneDensity;\nCharacteristic_1.Characteristic.OzoneDensity = OzoneDensity;\n/**\n * Characteristic \"Pairing Features\"\n */\nvar PairingFeatures = /** @class */ (function (_super) {\n tslib_1.__extends(PairingFeatures, _super);\n function PairingFeatures() {\n var _this = _super.call(this, \"Pairing Features\", PairingFeatures.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PairingFeatures.UUID = \"0000004F-0000-1000-8000-0026BB765291\";\n return PairingFeatures;\n}(Characteristic_1.Characteristic));\nexports.PairingFeatures = PairingFeatures;\nCharacteristic_1.Characteristic.PairingFeatures = PairingFeatures;\n/**\n * Characteristic \"Pair Setup\"\n */\nvar PairSetup = /** @class */ (function (_super) {\n tslib_1.__extends(PairSetup, _super);\n function PairSetup() {\n var _this = _super.call(this, \"Pair Setup\", PairSetup.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PairSetup.UUID = \"0000004C-0000-1000-8000-0026BB765291\";\n return PairSetup;\n}(Characteristic_1.Characteristic));\nexports.PairSetup = PairSetup;\nCharacteristic_1.Characteristic.PairSetup = PairSetup;\n/**\n * Characteristic \"Pair Verify\"\n */\nvar PairVerify = /** @class */ (function (_super) {\n tslib_1.__extends(PairVerify, _super);\n function PairVerify() {\n var _this = _super.call(this, \"Pair Verify\", PairVerify.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PairVerify.UUID = \"0000004E-0000-1000-8000-0026BB765291\";\n return PairVerify;\n}(Characteristic_1.Characteristic));\nexports.PairVerify = PairVerify;\nCharacteristic_1.Characteristic.PairVerify = PairVerify;\n/**\n * Characteristic \"Password Setting\"\n */\nvar PasswordSetting = /** @class */ (function (_super) {\n tslib_1.__extends(PasswordSetting, _super);\n function PasswordSetting() {\n var _this = _super.call(this, \"Password Setting\", PasswordSetting.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PasswordSetting.UUID = \"000000E4-0000-1000-8000-0026BB765291\";\n return PasswordSetting;\n}(Characteristic_1.Characteristic));\nexports.PasswordSetting = PasswordSetting;\nCharacteristic_1.Characteristic.PasswordSetting = PasswordSetting;\n/**\n * Characteristic \"Periodic Snapshots Active\"\n */\nvar PeriodicSnapshotsActive = /** @class */ (function (_super) {\n tslib_1.__extends(PeriodicSnapshotsActive, _super);\n function PeriodicSnapshotsActive() {\n var _this = _super.call(this, \"Periodic Snapshots Active\", PeriodicSnapshotsActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PeriodicSnapshotsActive.UUID = \"00000225-0000-1000-8000-0026BB765291\";\n PeriodicSnapshotsActive.DISABLE = 0;\n PeriodicSnapshotsActive.ENABLE = 1;\n return PeriodicSnapshotsActive;\n}(Characteristic_1.Characteristic));\nexports.PeriodicSnapshotsActive = PeriodicSnapshotsActive;\nCharacteristic_1.Characteristic.PeriodicSnapshotsActive = PeriodicSnapshotsActive;\n/**\n * Characteristic \"Picture Mode\"\n */\nvar PictureMode = /** @class */ (function (_super) {\n tslib_1.__extends(PictureMode, _super);\n function PictureMode() {\n var _this = _super.call(this, \"Picture Mode\", PictureMode.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 13,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PictureMode.UUID = \"000000E2-0000-1000-8000-0026BB765291\";\n PictureMode.OTHER = 0;\n PictureMode.STANDARD = 1;\n PictureMode.CALIBRATED = 2;\n PictureMode.CALIBRATED_DARK = 3;\n PictureMode.VIVID = 4;\n PictureMode.GAME = 5;\n PictureMode.COMPUTER = 6;\n PictureMode.CUSTOM = 7;\n return PictureMode;\n}(Characteristic_1.Characteristic));\nexports.PictureMode = PictureMode;\nCharacteristic_1.Characteristic.PictureMode = PictureMode;\n/**\n * Characteristic \"Ping\"\n * @since iOS 14\n */\nvar Ping = /** @class */ (function (_super) {\n tslib_1.__extends(Ping, _super);\n function Ping() {\n var _this = _super.call(this, \"Ping\", Ping.UUID, {\n format: \"data\" /* Formats.DATA */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Ping.UUID = \"0000023C-0000-1000-8000-0026BB765291\";\n return Ping;\n}(Characteristic_1.Characteristic));\nexports.Ping = Ping;\nCharacteristic_1.Characteristic.Ping = Ping;\n/**\n * Characteristic \"PM10 Density\"\n */\nvar PM10Density = /** @class */ (function (_super) {\n tslib_1.__extends(PM10Density, _super);\n function PM10Density() {\n var _this = _super.call(this, \"PM10 Density\", PM10Density.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PM10Density.UUID = \"000000C7-0000-1000-8000-0026BB765291\";\n return PM10Density;\n}(Characteristic_1.Characteristic));\nexports.PM10Density = PM10Density;\nCharacteristic_1.Characteristic.PM10Density = PM10Density;\n/**\n * Characteristic \"PM2.5 Density\"\n */\nvar PM2_5Density = /** @class */ (function (_super) {\n tslib_1.__extends(PM2_5Density, _super);\n function PM2_5Density() {\n var _this = _super.call(this, \"PM2.5 Density\", PM2_5Density.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PM2_5Density.UUID = \"000000C6-0000-1000-8000-0026BB765291\";\n return PM2_5Density;\n}(Characteristic_1.Characteristic));\nexports.PM2_5Density = PM2_5Density;\nCharacteristic_1.Characteristic.PM2_5Density = PM2_5Density;\n/**\n * Characteristic \"Position State\"\n */\nvar PositionState = /** @class */ (function (_super) {\n tslib_1.__extends(PositionState, _super);\n function PositionState() {\n var _this = _super.call(this, \"Position State\", PositionState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PositionState.UUID = \"00000072-0000-1000-8000-0026BB765291\";\n PositionState.DECREASING = 0;\n PositionState.INCREASING = 1;\n PositionState.STOPPED = 2;\n return PositionState;\n}(Characteristic_1.Characteristic));\nexports.PositionState = PositionState;\nCharacteristic_1.Characteristic.PositionState = PositionState;\n/**\n * Characteristic \"Power Mode Selection\"\n */\nvar PowerModeSelection = /** @class */ (function (_super) {\n tslib_1.__extends(PowerModeSelection, _super);\n function PowerModeSelection() {\n var _this = _super.call(this, \"Power Mode Selection\", PowerModeSelection.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n PowerModeSelection.UUID = \"000000DF-0000-1000-8000-0026BB765291\";\n PowerModeSelection.SHOW = 0;\n PowerModeSelection.HIDE = 1;\n return PowerModeSelection;\n}(Characteristic_1.Characteristic));\nexports.PowerModeSelection = PowerModeSelection;\nCharacteristic_1.Characteristic.PowerModeSelection = PowerModeSelection;\n/**\n * Characteristic \"Product Data\"\n */\nvar ProductData = /** @class */ (function (_super) {\n tslib_1.__extends(ProductData, _super);\n function ProductData() {\n var _this = _super.call(this, \"Product Data\", ProductData.UUID, {\n format: \"data\" /* Formats.DATA */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ProductData.UUID = \"00000220-0000-1000-8000-0026BB765291\";\n return ProductData;\n}(Characteristic_1.Characteristic));\nexports.ProductData = ProductData;\nCharacteristic_1.Characteristic.ProductData = ProductData;\n/**\n * Characteristic \"Programmable Switch Event\"\n */\nvar ProgrammableSwitchEvent = /** @class */ (function (_super) {\n tslib_1.__extends(ProgrammableSwitchEvent, _super);\n function ProgrammableSwitchEvent() {\n var _this = _super.call(this, \"Programmable Switch Event\", ProgrammableSwitchEvent.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ProgrammableSwitchEvent.UUID = \"00000073-0000-1000-8000-0026BB765291\";\n ProgrammableSwitchEvent.SINGLE_PRESS = 0;\n ProgrammableSwitchEvent.DOUBLE_PRESS = 1;\n ProgrammableSwitchEvent.LONG_PRESS = 2;\n return ProgrammableSwitchEvent;\n}(Characteristic_1.Characteristic));\nexports.ProgrammableSwitchEvent = ProgrammableSwitchEvent;\nCharacteristic_1.Characteristic.ProgrammableSwitchEvent = ProgrammableSwitchEvent;\n/**\n * Characteristic \"Programmable Switch Output State\"\n */\nvar ProgrammableSwitchOutputState = /** @class */ (function (_super) {\n tslib_1.__extends(ProgrammableSwitchOutputState, _super);\n function ProgrammableSwitchOutputState() {\n var _this = _super.call(this, \"Programmable Switch Output State\", ProgrammableSwitchOutputState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ProgrammableSwitchOutputState.UUID = \"00000074-0000-1000-8000-0026BB765291\";\n return ProgrammableSwitchOutputState;\n}(Characteristic_1.Characteristic));\nexports.ProgrammableSwitchOutputState = ProgrammableSwitchOutputState;\nCharacteristic_1.Characteristic.ProgrammableSwitchOutputState = ProgrammableSwitchOutputState;\n/**\n * Characteristic \"Program Mode\"\n */\nvar ProgramMode = /** @class */ (function (_super) {\n tslib_1.__extends(ProgramMode, _super);\n function ProgramMode() {\n var _this = _super.call(this, \"Program Mode\", ProgramMode.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ProgramMode.UUID = \"000000D1-0000-1000-8000-0026BB765291\";\n ProgramMode.NO_PROGRAM_SCHEDULED = 0;\n ProgramMode.PROGRAM_SCHEDULED = 1;\n ProgramMode.PROGRAM_SCHEDULED_MANUAL_MODE_ = 2;\n return ProgramMode;\n}(Characteristic_1.Characteristic));\nexports.ProgramMode = ProgramMode;\nCharacteristic_1.Characteristic.ProgramMode = ProgramMode;\n/**\n * Characteristic \"Reachable\"\n * @deprecated Removed and not used anymore\n */\nvar Reachable = /** @class */ (function (_super) {\n tslib_1.__extends(Reachable, _super);\n function Reachable() {\n var _this = _super.call(this, \"Reachable\", Reachable.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Reachable.UUID = \"00000063-0000-1000-8000-0026BB765291\";\n return Reachable;\n}(Characteristic_1.Characteristic));\nexports.Reachable = Reachable;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.Reachable = Reachable;\n/**\n * Characteristic \"Received Signal Strength Indication\"\n * @since iOS 14\n */\nvar ReceivedSignalStrengthIndication = /** @class */ (function (_super) {\n tslib_1.__extends(ReceivedSignalStrengthIndication, _super);\n function ReceivedSignalStrengthIndication() {\n var _this = _super.call(this, \"Received Signal Strength Indication\", ReceivedSignalStrengthIndication.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ReceivedSignalStrengthIndication.UUID = \"0000023F-0000-1000-8000-0026BB765291\";\n return ReceivedSignalStrengthIndication;\n}(Characteristic_1.Characteristic));\nexports.ReceivedSignalStrengthIndication = ReceivedSignalStrengthIndication;\nCharacteristic_1.Characteristic.ReceivedSignalStrengthIndication = ReceivedSignalStrengthIndication;\n/**\n * Characteristic \"Receiver Sensitivity\"\n * @since iOS 14\n */\nvar ReceiverSensitivity = /** @class */ (function (_super) {\n tslib_1.__extends(ReceiverSensitivity, _super);\n function ReceiverSensitivity() {\n var _this = _super.call(this, \"Receiver Sensitivity\", ReceiverSensitivity.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ReceiverSensitivity.UUID = \"00000244-0000-1000-8000-0026BB765291\";\n return ReceiverSensitivity;\n}(Characteristic_1.Characteristic));\nexports.ReceiverSensitivity = ReceiverSensitivity;\nCharacteristic_1.Characteristic.ReceiverSensitivity = ReceiverSensitivity;\n/**\n * Characteristic \"Recording Audio Active\"\n */\nvar RecordingAudioActive = /** @class */ (function (_super) {\n tslib_1.__extends(RecordingAudioActive, _super);\n function RecordingAudioActive() {\n var _this = _super.call(this, \"Recording Audio Active\", RecordingAudioActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */],\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RecordingAudioActive.UUID = \"00000226-0000-1000-8000-0026BB765291\";\n RecordingAudioActive.DISABLE = 0;\n RecordingAudioActive.ENABLE = 1;\n return RecordingAudioActive;\n}(Characteristic_1.Characteristic));\nexports.RecordingAudioActive = RecordingAudioActive;\nCharacteristic_1.Characteristic.RecordingAudioActive = RecordingAudioActive;\n/**\n * Characteristic \"Relative Humidity Dehumidifier Threshold\"\n */\nvar RelativeHumidityDehumidifierThreshold = /** @class */ (function (_super) {\n tslib_1.__extends(RelativeHumidityDehumidifierThreshold, _super);\n function RelativeHumidityDehumidifierThreshold() {\n var _this = _super.call(this, \"Relative Humidity Dehumidifier Threshold\", RelativeHumidityDehumidifierThreshold.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RelativeHumidityDehumidifierThreshold.UUID = \"000000C9-0000-1000-8000-0026BB765291\";\n return RelativeHumidityDehumidifierThreshold;\n}(Characteristic_1.Characteristic));\nexports.RelativeHumidityDehumidifierThreshold = RelativeHumidityDehumidifierThreshold;\nCharacteristic_1.Characteristic.RelativeHumidityDehumidifierThreshold = RelativeHumidityDehumidifierThreshold;\n/**\n * Characteristic \"Relative Humidity Humidifier Threshold\"\n */\nvar RelativeHumidityHumidifierThreshold = /** @class */ (function (_super) {\n tslib_1.__extends(RelativeHumidityHumidifierThreshold, _super);\n function RelativeHumidityHumidifierThreshold() {\n var _this = _super.call(this, \"Relative Humidity Humidifier Threshold\", RelativeHumidityHumidifierThreshold.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RelativeHumidityHumidifierThreshold.UUID = \"000000CA-0000-1000-8000-0026BB765291\";\n return RelativeHumidityHumidifierThreshold;\n}(Characteristic_1.Characteristic));\nexports.RelativeHumidityHumidifierThreshold = RelativeHumidityHumidifierThreshold;\nCharacteristic_1.Characteristic.RelativeHumidityHumidifierThreshold = RelativeHumidityHumidifierThreshold;\n/**\n * Characteristic \"Relay Control Point\"\n */\nvar RelayControlPoint = /** @class */ (function (_super) {\n tslib_1.__extends(RelayControlPoint, _super);\n function RelayControlPoint() {\n var _this = _super.call(this, \"Relay Control Point\", RelayControlPoint.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RelayControlPoint.UUID = \"0000005E-0000-1000-8000-0026BB765291\";\n return RelayControlPoint;\n}(Characteristic_1.Characteristic));\nexports.RelayControlPoint = RelayControlPoint;\nCharacteristic_1.Characteristic.RelayControlPoint = RelayControlPoint;\n/**\n * Characteristic \"Relay Enabled\"\n */\nvar RelayEnabled = /** @class */ (function (_super) {\n tslib_1.__extends(RelayEnabled, _super);\n function RelayEnabled() {\n var _this = _super.call(this, \"Relay Enabled\", RelayEnabled.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RelayEnabled.UUID = \"0000005B-0000-1000-8000-0026BB765291\";\n return RelayEnabled;\n}(Characteristic_1.Characteristic));\nexports.RelayEnabled = RelayEnabled;\nCharacteristic_1.Characteristic.RelayEnabled = RelayEnabled;\n/**\n * Characteristic \"Relay State\"\n */\nvar RelayState = /** @class */ (function (_super) {\n tslib_1.__extends(RelayState, _super);\n function RelayState() {\n var _this = _super.call(this, \"Relay State\", RelayState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 5,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RelayState.UUID = \"0000005C-0000-1000-8000-0026BB765291\";\n return RelayState;\n}(Characteristic_1.Characteristic));\nexports.RelayState = RelayState;\nCharacteristic_1.Characteristic.RelayState = RelayState;\n/**\n * Characteristic \"Remaining Duration\"\n */\nvar RemainingDuration = /** @class */ (function (_super) {\n tslib_1.__extends(RemainingDuration, _super);\n function RemainingDuration() {\n var _this = _super.call(this, \"Remaining Duration\", RemainingDuration.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"seconds\" /* Units.SECONDS */,\n minValue: 0,\n maxValue: 3600,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RemainingDuration.UUID = \"000000D4-0000-1000-8000-0026BB765291\";\n return RemainingDuration;\n}(Characteristic_1.Characteristic));\nexports.RemainingDuration = RemainingDuration;\nCharacteristic_1.Characteristic.RemainingDuration = RemainingDuration;\n/**\n * Characteristic \"Remote Key\"\n */\nvar RemoteKey = /** @class */ (function (_super) {\n tslib_1.__extends(RemoteKey, _super);\n function RemoteKey() {\n var _this = _super.call(this, \"Remote Key\", RemoteKey.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 16,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RemoteKey.UUID = \"000000E1-0000-1000-8000-0026BB765291\";\n RemoteKey.REWIND = 0;\n RemoteKey.FAST_FORWARD = 1;\n RemoteKey.NEXT_TRACK = 2;\n RemoteKey.PREVIOUS_TRACK = 3;\n RemoteKey.ARROW_UP = 4;\n RemoteKey.ARROW_DOWN = 5;\n RemoteKey.ARROW_LEFT = 6;\n RemoteKey.ARROW_RIGHT = 7;\n RemoteKey.SELECT = 8;\n RemoteKey.BACK = 9;\n RemoteKey.EXIT = 10;\n RemoteKey.PLAY_PAUSE = 11;\n RemoteKey.INFORMATION = 15;\n return RemoteKey;\n}(Characteristic_1.Characteristic));\nexports.RemoteKey = RemoteKey;\nCharacteristic_1.Characteristic.RemoteKey = RemoteKey;\n/**\n * Characteristic \"Reset Filter Indication\"\n */\nvar ResetFilterIndication = /** @class */ (function (_super) {\n tslib_1.__extends(ResetFilterIndication, _super);\n function ResetFilterIndication() {\n var _this = _super.call(this, \"Reset Filter Indication\", ResetFilterIndication.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 1,\n maxValue: 1,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ResetFilterIndication.UUID = \"000000AD-0000-1000-8000-0026BB765291\";\n return ResetFilterIndication;\n}(Characteristic_1.Characteristic));\nexports.ResetFilterIndication = ResetFilterIndication;\nCharacteristic_1.Characteristic.ResetFilterIndication = ResetFilterIndication;\n/**\n * Characteristic \"Rotation Direction\"\n */\nvar RotationDirection = /** @class */ (function (_super) {\n tslib_1.__extends(RotationDirection, _super);\n function RotationDirection() {\n var _this = _super.call(this, \"Rotation Direction\", RotationDirection.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RotationDirection.UUID = \"00000028-0000-1000-8000-0026BB765291\";\n RotationDirection.CLOCKWISE = 0;\n RotationDirection.COUNTER_CLOCKWISE = 1;\n return RotationDirection;\n}(Characteristic_1.Characteristic));\nexports.RotationDirection = RotationDirection;\nCharacteristic_1.Characteristic.RotationDirection = RotationDirection;\n/**\n * Characteristic \"Rotation Speed\"\n */\nvar RotationSpeed = /** @class */ (function (_super) {\n tslib_1.__extends(RotationSpeed, _super);\n function RotationSpeed() {\n var _this = _super.call(this, \"Rotation Speed\", RotationSpeed.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RotationSpeed.UUID = \"00000029-0000-1000-8000-0026BB765291\";\n return RotationSpeed;\n}(Characteristic_1.Characteristic));\nexports.RotationSpeed = RotationSpeed;\nCharacteristic_1.Characteristic.RotationSpeed = RotationSpeed;\n/**\n * Characteristic \"Router Status\"\n */\nvar RouterStatus = /** @class */ (function (_super) {\n tslib_1.__extends(RouterStatus, _super);\n function RouterStatus() {\n var _this = _super.call(this, \"Router Status\", RouterStatus.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n RouterStatus.UUID = \"0000020E-0000-1000-8000-0026BB765291\";\n RouterStatus.READY = 0;\n RouterStatus.NOT_READY = 1;\n return RouterStatus;\n}(Characteristic_1.Characteristic));\nexports.RouterStatus = RouterStatus;\nCharacteristic_1.Characteristic.RouterStatus = RouterStatus;\n/**\n * Characteristic \"Saturation\"\n */\nvar Saturation = /** @class */ (function (_super) {\n tslib_1.__extends(Saturation, _super);\n function Saturation() {\n var _this = _super.call(this, \"Saturation\", Saturation.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Saturation.UUID = \"0000002F-0000-1000-8000-0026BB765291\";\n return Saturation;\n}(Characteristic_1.Characteristic));\nexports.Saturation = Saturation;\nCharacteristic_1.Characteristic.Saturation = Saturation;\n/**\n * Characteristic \"Security System Alarm Type\"\n */\nvar SecuritySystemAlarmType = /** @class */ (function (_super) {\n tslib_1.__extends(SecuritySystemAlarmType, _super);\n function SecuritySystemAlarmType() {\n var _this = _super.call(this, \"Security System Alarm Type\", SecuritySystemAlarmType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SecuritySystemAlarmType.UUID = \"0000008E-0000-1000-8000-0026BB765291\";\n return SecuritySystemAlarmType;\n}(Characteristic_1.Characteristic));\nexports.SecuritySystemAlarmType = SecuritySystemAlarmType;\nCharacteristic_1.Characteristic.SecuritySystemAlarmType = SecuritySystemAlarmType;\n/**\n * Characteristic \"Security System Current State\"\n */\nvar SecuritySystemCurrentState = /** @class */ (function (_super) {\n tslib_1.__extends(SecuritySystemCurrentState, _super);\n function SecuritySystemCurrentState() {\n var _this = _super.call(this, \"Security System Current State\", SecuritySystemCurrentState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 4,\n minStep: 1,\n validValues: [0, 1, 2, 3, 4],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SecuritySystemCurrentState.UUID = \"00000066-0000-1000-8000-0026BB765291\";\n SecuritySystemCurrentState.STAY_ARM = 0;\n SecuritySystemCurrentState.AWAY_ARM = 1;\n SecuritySystemCurrentState.NIGHT_ARM = 2;\n SecuritySystemCurrentState.DISARMED = 3;\n SecuritySystemCurrentState.ALARM_TRIGGERED = 4;\n return SecuritySystemCurrentState;\n}(Characteristic_1.Characteristic));\nexports.SecuritySystemCurrentState = SecuritySystemCurrentState;\nCharacteristic_1.Characteristic.SecuritySystemCurrentState = SecuritySystemCurrentState;\n/**\n * Characteristic \"Security System Target State\"\n */\nvar SecuritySystemTargetState = /** @class */ (function (_super) {\n tslib_1.__extends(SecuritySystemTargetState, _super);\n function SecuritySystemTargetState() {\n var _this = _super.call(this, \"Security System Target State\", SecuritySystemTargetState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SecuritySystemTargetState.UUID = \"00000067-0000-1000-8000-0026BB765291\";\n SecuritySystemTargetState.STAY_ARM = 0;\n SecuritySystemTargetState.AWAY_ARM = 1;\n SecuritySystemTargetState.NIGHT_ARM = 2;\n SecuritySystemTargetState.DISARM = 3;\n return SecuritySystemTargetState;\n}(Characteristic_1.Characteristic));\nexports.SecuritySystemTargetState = SecuritySystemTargetState;\nCharacteristic_1.Characteristic.SecuritySystemTargetState = SecuritySystemTargetState;\n/**\n * Characteristic \"Selected Audio Stream Configuration\"\n */\nvar SelectedAudioStreamConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SelectedAudioStreamConfiguration, _super);\n function SelectedAudioStreamConfiguration() {\n var _this = _super.call(this, \"Selected Audio Stream Configuration\", SelectedAudioStreamConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SelectedAudioStreamConfiguration.UUID = \"00000128-0000-1000-8000-0026BB765291\";\n return SelectedAudioStreamConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SelectedAudioStreamConfiguration = SelectedAudioStreamConfiguration;\nCharacteristic_1.Characteristic.SelectedAudioStreamConfiguration = SelectedAudioStreamConfiguration;\n/**\n * Characteristic \"Selected Camera Recording Configuration\"\n */\nvar SelectedCameraRecordingConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SelectedCameraRecordingConfiguration, _super);\n function SelectedCameraRecordingConfiguration() {\n var _this = _super.call(this, \"Selected Camera Recording Configuration\", SelectedCameraRecordingConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SelectedCameraRecordingConfiguration.UUID = \"00000209-0000-1000-8000-0026BB765291\";\n return SelectedCameraRecordingConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SelectedCameraRecordingConfiguration = SelectedCameraRecordingConfiguration;\nCharacteristic_1.Characteristic.SelectedCameraRecordingConfiguration = SelectedCameraRecordingConfiguration;\n/**\n * Characteristic \"Selected Diagnostics Modes\"\n */\nvar SelectedDiagnosticsModes = /** @class */ (function (_super) {\n tslib_1.__extends(SelectedDiagnosticsModes, _super);\n function SelectedDiagnosticsModes() {\n var _this = _super.call(this, \"Selected Diagnostics Modes\", SelectedDiagnosticsModes.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SelectedDiagnosticsModes.UUID = \"0000024D-0000-1000-8000-0026BB765291\";\n return SelectedDiagnosticsModes;\n}(Characteristic_1.Characteristic));\nexports.SelectedDiagnosticsModes = SelectedDiagnosticsModes;\nCharacteristic_1.Characteristic.SelectedDiagnosticsModes = SelectedDiagnosticsModes;\n/**\n * Characteristic \"Selected RTP Stream Configuration\"\n */\nvar SelectedRTPStreamConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SelectedRTPStreamConfiguration, _super);\n function SelectedRTPStreamConfiguration() {\n var _this = _super.call(this, \"Selected RTP Stream Configuration\", SelectedRTPStreamConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SelectedRTPStreamConfiguration.UUID = \"00000117-0000-1000-8000-0026BB765291\";\n return SelectedRTPStreamConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SelectedRTPStreamConfiguration = SelectedRTPStreamConfiguration;\nCharacteristic_1.Characteristic.SelectedRTPStreamConfiguration = SelectedRTPStreamConfiguration;\n/**\n * Characteristic \"Selected Sleep Configuration\"\n */\nvar SelectedSleepConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SelectedSleepConfiguration, _super);\n function SelectedSleepConfiguration() {\n var _this = _super.call(this, \"Selected Sleep Configuration\", SelectedSleepConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SelectedSleepConfiguration.UUID = \"00000252-0000-1000-8000-0026BB765291\";\n return SelectedSleepConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SelectedSleepConfiguration = SelectedSleepConfiguration;\nCharacteristic_1.Characteristic.SelectedSleepConfiguration = SelectedSleepConfiguration;\n/**\n * Characteristic \"Serial Number\"\n */\nvar SerialNumber = /** @class */ (function (_super) {\n tslib_1.__extends(SerialNumber, _super);\n function SerialNumber() {\n var _this = _super.call(this, \"Serial Number\", SerialNumber.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n maxLen: 64,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SerialNumber.UUID = \"00000030-0000-1000-8000-0026BB765291\";\n return SerialNumber;\n}(Characteristic_1.Characteristic));\nexports.SerialNumber = SerialNumber;\nCharacteristic_1.Characteristic.SerialNumber = SerialNumber;\n/**\n * Characteristic \"Service Label Index\"\n */\nvar ServiceLabelIndex = /** @class */ (function (_super) {\n tslib_1.__extends(ServiceLabelIndex, _super);\n function ServiceLabelIndex() {\n var _this = _super.call(this, \"Service Label Index\", ServiceLabelIndex.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n minValue: 1,\n maxValue: 255,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ServiceLabelIndex.UUID = \"000000CB-0000-1000-8000-0026BB765291\";\n return ServiceLabelIndex;\n}(Characteristic_1.Characteristic));\nexports.ServiceLabelIndex = ServiceLabelIndex;\nCharacteristic_1.Characteristic.ServiceLabelIndex = ServiceLabelIndex;\n/**\n * Characteristic \"Service Label Namespace\"\n */\nvar ServiceLabelNamespace = /** @class */ (function (_super) {\n tslib_1.__extends(ServiceLabelNamespace, _super);\n function ServiceLabelNamespace() {\n var _this = _super.call(this, \"Service Label Namespace\", ServiceLabelNamespace.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ServiceLabelNamespace.UUID = \"000000CD-0000-1000-8000-0026BB765291\";\n ServiceLabelNamespace.DOTS = 0;\n ServiceLabelNamespace.ARABIC_NUMERALS = 1;\n return ServiceLabelNamespace;\n}(Characteristic_1.Characteristic));\nexports.ServiceLabelNamespace = ServiceLabelNamespace;\nCharacteristic_1.Characteristic.ServiceLabelNamespace = ServiceLabelNamespace;\n/**\n * Characteristic \"Set Duration\"\n */\nvar SetDuration = /** @class */ (function (_super) {\n tslib_1.__extends(SetDuration, _super);\n function SetDuration() {\n var _this = _super.call(this, \"Set Duration\", SetDuration.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"seconds\" /* Units.SECONDS */,\n minValue: 0,\n maxValue: 3600,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SetDuration.UUID = \"000000D3-0000-1000-8000-0026BB765291\";\n return SetDuration;\n}(Characteristic_1.Characteristic));\nexports.SetDuration = SetDuration;\nCharacteristic_1.Characteristic.SetDuration = SetDuration;\n/**\n * Characteristic \"Setup Data Stream Transport\"\n */\nvar SetupDataStreamTransport = /** @class */ (function (_super) {\n tslib_1.__extends(SetupDataStreamTransport, _super);\n function SetupDataStreamTransport() {\n var _this = _super.call(this, \"Setup Data Stream Transport\", SetupDataStreamTransport.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SetupDataStreamTransport.UUID = \"00000131-0000-1000-8000-0026BB765291\";\n return SetupDataStreamTransport;\n}(Characteristic_1.Characteristic));\nexports.SetupDataStreamTransport = SetupDataStreamTransport;\nCharacteristic_1.Characteristic.SetupDataStreamTransport = SetupDataStreamTransport;\n/**\n * Characteristic \"Setup Endpoints\"\n */\nvar SetupEndpoints = /** @class */ (function (_super) {\n tslib_1.__extends(SetupEndpoints, _super);\n function SetupEndpoints() {\n var _this = _super.call(this, \"Setup Endpoints\", SetupEndpoints.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SetupEndpoints.UUID = \"00000118-0000-1000-8000-0026BB765291\";\n return SetupEndpoints;\n}(Characteristic_1.Characteristic));\nexports.SetupEndpoints = SetupEndpoints;\nCharacteristic_1.Characteristic.SetupEndpoints = SetupEndpoints;\n/**\n * Characteristic \"Setup Transfer Transport\"\n * @since iOS 13.4\n */\nvar SetupTransferTransport = /** @class */ (function (_super) {\n tslib_1.__extends(SetupTransferTransport, _super);\n function SetupTransferTransport() {\n var _this = _super.call(this, \"Setup Transfer Transport\", SetupTransferTransport.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SetupTransferTransport.UUID = \"00000201-0000-1000-8000-0026BB765291\";\n return SetupTransferTransport;\n}(Characteristic_1.Characteristic));\nexports.SetupTransferTransport = SetupTransferTransport;\nCharacteristic_1.Characteristic.SetupTransferTransport = SetupTransferTransport;\n/**\n * Characteristic \"Signal To Noise Ratio\"\n * @since iOS 14\n */\nvar SignalToNoiseRatio = /** @class */ (function (_super) {\n tslib_1.__extends(SignalToNoiseRatio, _super);\n function SignalToNoiseRatio() {\n var _this = _super.call(this, \"Signal To Noise Ratio\", SignalToNoiseRatio.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SignalToNoiseRatio.UUID = \"00000241-0000-1000-8000-0026BB765291\";\n return SignalToNoiseRatio;\n}(Characteristic_1.Characteristic));\nexports.SignalToNoiseRatio = SignalToNoiseRatio;\nCharacteristic_1.Characteristic.SignalToNoiseRatio = SignalToNoiseRatio;\n/**\n * Characteristic \"Siri Enable\"\n */\nvar SiriEnable = /** @class */ (function (_super) {\n tslib_1.__extends(SiriEnable, _super);\n function SiriEnable() {\n var _this = _super.call(this, \"Siri Enable\", SiriEnable.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriEnable.UUID = \"00000255-0000-1000-8000-0026BB765291\";\n return SiriEnable;\n}(Characteristic_1.Characteristic));\nexports.SiriEnable = SiriEnable;\nCharacteristic_1.Characteristic.SiriEnable = SiriEnable;\n/**\n * Characteristic \"Siri Endpoint Session Status\"\n */\nvar SiriEndpointSessionStatus = /** @class */ (function (_super) {\n tslib_1.__extends(SiriEndpointSessionStatus, _super);\n function SiriEndpointSessionStatus() {\n var _this = _super.call(this, \"Siri Endpoint Session Status\", SiriEndpointSessionStatus.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriEndpointSessionStatus.UUID = \"00000254-0000-1000-8000-0026BB765291\";\n return SiriEndpointSessionStatus;\n}(Characteristic_1.Characteristic));\nexports.SiriEndpointSessionStatus = SiriEndpointSessionStatus;\nCharacteristic_1.Characteristic.SiriEndpointSessionStatus = SiriEndpointSessionStatus;\n/**\n * Characteristic \"Siri Engine Version\"\n */\nvar SiriEngineVersion = /** @class */ (function (_super) {\n tslib_1.__extends(SiriEngineVersion, _super);\n function SiriEngineVersion() {\n var _this = _super.call(this, \"Siri Engine Version\", SiriEngineVersion.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriEngineVersion.UUID = \"0000025A-0000-1000-8000-0026BB765291\";\n return SiriEngineVersion;\n}(Characteristic_1.Characteristic));\nexports.SiriEngineVersion = SiriEngineVersion;\nCharacteristic_1.Characteristic.SiriEngineVersion = SiriEngineVersion;\n/**\n * Characteristic \"Siri Input Type\"\n */\nvar SiriInputType = /** @class */ (function (_super) {\n tslib_1.__extends(SiriInputType, _super);\n function SiriInputType() {\n var _this = _super.call(this, \"Siri Input Type\", SiriInputType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 0,\n validValues: [0],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriInputType.UUID = \"00000132-0000-1000-8000-0026BB765291\";\n SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV = 0;\n return SiriInputType;\n}(Characteristic_1.Characteristic));\nexports.SiriInputType = SiriInputType;\nCharacteristic_1.Characteristic.SiriInputType = SiriInputType;\n/**\n * Characteristic \"Siri Light On Use\"\n */\nvar SiriLightOnUse = /** @class */ (function (_super) {\n tslib_1.__extends(SiriLightOnUse, _super);\n function SiriLightOnUse() {\n var _this = _super.call(this, \"Siri Light On Use\", SiriLightOnUse.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriLightOnUse.UUID = \"00000258-0000-1000-8000-0026BB765291\";\n return SiriLightOnUse;\n}(Characteristic_1.Characteristic));\nexports.SiriLightOnUse = SiriLightOnUse;\nCharacteristic_1.Characteristic.SiriLightOnUse = SiriLightOnUse;\n/**\n * Characteristic \"Siri Listening\"\n */\nvar SiriListening = /** @class */ (function (_super) {\n tslib_1.__extends(SiriListening, _super);\n function SiriListening() {\n var _this = _super.call(this, \"Siri Listening\", SiriListening.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriListening.UUID = \"00000256-0000-1000-8000-0026BB765291\";\n return SiriListening;\n}(Characteristic_1.Characteristic));\nexports.SiriListening = SiriListening;\nCharacteristic_1.Characteristic.SiriListening = SiriListening;\n/**\n * Characteristic \"Siri Touch To Use\"\n */\nvar SiriTouchToUse = /** @class */ (function (_super) {\n tslib_1.__extends(SiriTouchToUse, _super);\n function SiriTouchToUse() {\n var _this = _super.call(this, \"Siri Touch To Use\", SiriTouchToUse.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SiriTouchToUse.UUID = \"00000257-0000-1000-8000-0026BB765291\";\n return SiriTouchToUse;\n}(Characteristic_1.Characteristic));\nexports.SiriTouchToUse = SiriTouchToUse;\nCharacteristic_1.Characteristic.SiriTouchToUse = SiriTouchToUse;\n/**\n * Characteristic \"Slat Type\"\n */\nvar SlatType = /** @class */ (function (_super) {\n tslib_1.__extends(SlatType, _super);\n function SlatType() {\n var _this = _super.call(this, \"Slat Type\", SlatType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SlatType.UUID = \"000000C0-0000-1000-8000-0026BB765291\";\n SlatType.HORIZONTAL = 0;\n SlatType.VERTICAL = 1;\n return SlatType;\n}(Characteristic_1.Characteristic));\nexports.SlatType = SlatType;\nCharacteristic_1.Characteristic.SlatType = SlatType;\n/**\n * Characteristic \"Sleep Discovery Mode\"\n */\nvar SleepDiscoveryMode = /** @class */ (function (_super) {\n tslib_1.__extends(SleepDiscoveryMode, _super);\n function SleepDiscoveryMode() {\n var _this = _super.call(this, \"Sleep Discovery Mode\", SleepDiscoveryMode.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SleepDiscoveryMode.UUID = \"000000E8-0000-1000-8000-0026BB765291\";\n SleepDiscoveryMode.NOT_DISCOVERABLE = 0;\n SleepDiscoveryMode.ALWAYS_DISCOVERABLE = 1;\n return SleepDiscoveryMode;\n}(Characteristic_1.Characteristic));\nexports.SleepDiscoveryMode = SleepDiscoveryMode;\nCharacteristic_1.Characteristic.SleepDiscoveryMode = SleepDiscoveryMode;\n/**\n * Characteristic \"Sleep Interval\"\n * @since iOS 14\n */\nvar SleepInterval = /** @class */ (function (_super) {\n tslib_1.__extends(SleepInterval, _super);\n function SleepInterval() {\n var _this = _super.call(this, \"Sleep Interval\", SleepInterval.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SleepInterval.UUID = \"0000023A-0000-1000-8000-0026BB765291\";\n return SleepInterval;\n}(Characteristic_1.Characteristic));\nexports.SleepInterval = SleepInterval;\nCharacteristic_1.Characteristic.SleepInterval = SleepInterval;\n/**\n * Characteristic \"Smoke Detected\"\n */\nvar SmokeDetected = /** @class */ (function (_super) {\n tslib_1.__extends(SmokeDetected, _super);\n function SmokeDetected() {\n var _this = _super.call(this, \"Smoke Detected\", SmokeDetected.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SmokeDetected.UUID = \"00000076-0000-1000-8000-0026BB765291\";\n SmokeDetected.SMOKE_NOT_DETECTED = 0;\n SmokeDetected.SMOKE_DETECTED = 1;\n return SmokeDetected;\n}(Characteristic_1.Characteristic));\nexports.SmokeDetected = SmokeDetected;\nCharacteristic_1.Characteristic.SmokeDetected = SmokeDetected;\n/**\n * Characteristic \"Software Revision\"\n */\nvar SoftwareRevision = /** @class */ (function (_super) {\n tslib_1.__extends(SoftwareRevision, _super);\n function SoftwareRevision() {\n var _this = _super.call(this, \"Software Revision\", SoftwareRevision.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SoftwareRevision.UUID = \"00000054-0000-1000-8000-0026BB765291\";\n return SoftwareRevision;\n}(Characteristic_1.Characteristic));\nexports.SoftwareRevision = SoftwareRevision;\nCharacteristic_1.Characteristic.SoftwareRevision = SoftwareRevision;\n/**\n * Characteristic \"Staged Firmware Version\"\n */\nvar StagedFirmwareVersion = /** @class */ (function (_super) {\n tslib_1.__extends(StagedFirmwareVersion, _super);\n function StagedFirmwareVersion() {\n var _this = _super.call(this, \"Staged Firmware Version\", StagedFirmwareVersion.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StagedFirmwareVersion.UUID = \"00000249-0000-1000-8000-0026BB765291\";\n return StagedFirmwareVersion;\n}(Characteristic_1.Characteristic));\nexports.StagedFirmwareVersion = StagedFirmwareVersion;\nCharacteristic_1.Characteristic.StagedFirmwareVersion = StagedFirmwareVersion;\n/**\n * Characteristic \"Status Active\"\n */\nvar StatusActive = /** @class */ (function (_super) {\n tslib_1.__extends(StatusActive, _super);\n function StatusActive() {\n var _this = _super.call(this, \"Status Active\", StatusActive.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StatusActive.UUID = \"00000075-0000-1000-8000-0026BB765291\";\n return StatusActive;\n}(Characteristic_1.Characteristic));\nexports.StatusActive = StatusActive;\nCharacteristic_1.Characteristic.StatusActive = StatusActive;\n/**\n * Characteristic \"Status Fault\"\n */\nvar StatusFault = /** @class */ (function (_super) {\n tslib_1.__extends(StatusFault, _super);\n function StatusFault() {\n var _this = _super.call(this, \"Status Fault\", StatusFault.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StatusFault.UUID = \"00000077-0000-1000-8000-0026BB765291\";\n StatusFault.NO_FAULT = 0;\n StatusFault.GENERAL_FAULT = 1;\n return StatusFault;\n}(Characteristic_1.Characteristic));\nexports.StatusFault = StatusFault;\nCharacteristic_1.Characteristic.StatusFault = StatusFault;\n/**\n * Characteristic \"Status Jammed\"\n */\nvar StatusJammed = /** @class */ (function (_super) {\n tslib_1.__extends(StatusJammed, _super);\n function StatusJammed() {\n var _this = _super.call(this, \"Status Jammed\", StatusJammed.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StatusJammed.UUID = \"00000078-0000-1000-8000-0026BB765291\";\n StatusJammed.NOT_JAMMED = 0;\n StatusJammed.JAMMED = 1;\n return StatusJammed;\n}(Characteristic_1.Characteristic));\nexports.StatusJammed = StatusJammed;\nCharacteristic_1.Characteristic.StatusJammed = StatusJammed;\n/**\n * Characteristic \"Status Low Battery\"\n */\nvar StatusLowBattery = /** @class */ (function (_super) {\n tslib_1.__extends(StatusLowBattery, _super);\n function StatusLowBattery() {\n var _this = _super.call(this, \"Status Low Battery\", StatusLowBattery.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StatusLowBattery.UUID = \"00000079-0000-1000-8000-0026BB765291\";\n StatusLowBattery.BATTERY_LEVEL_NORMAL = 0;\n StatusLowBattery.BATTERY_LEVEL_LOW = 1;\n return StatusLowBattery;\n}(Characteristic_1.Characteristic));\nexports.StatusLowBattery = StatusLowBattery;\nCharacteristic_1.Characteristic.StatusLowBattery = StatusLowBattery;\n/**\n * Characteristic \"Status Tampered\"\n */\nvar StatusTampered = /** @class */ (function (_super) {\n tslib_1.__extends(StatusTampered, _super);\n function StatusTampered() {\n var _this = _super.call(this, \"Status Tampered\", StatusTampered.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StatusTampered.UUID = \"0000007A-0000-1000-8000-0026BB765291\";\n StatusTampered.NOT_TAMPERED = 0;\n StatusTampered.TAMPERED = 1;\n return StatusTampered;\n}(Characteristic_1.Characteristic));\nexports.StatusTampered = StatusTampered;\nCharacteristic_1.Characteristic.StatusTampered = StatusTampered;\n/**\n * Characteristic \"Streaming Status\"\n */\nvar StreamingStatus = /** @class */ (function (_super) {\n tslib_1.__extends(StreamingStatus, _super);\n function StreamingStatus() {\n var _this = _super.call(this, \"Streaming Status\", StreamingStatus.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n StreamingStatus.UUID = \"00000120-0000-1000-8000-0026BB765291\";\n return StreamingStatus;\n}(Characteristic_1.Characteristic));\nexports.StreamingStatus = StreamingStatus;\nCharacteristic_1.Characteristic.StreamingStatus = StreamingStatus;\n/**\n * Characteristic \"Sulphur Dioxide Density\"\n */\nvar SulphurDioxideDensity = /** @class */ (function (_super) {\n tslib_1.__extends(SulphurDioxideDensity, _super);\n function SulphurDioxideDensity() {\n var _this = _super.call(this, \"Sulphur Dioxide Density\", SulphurDioxideDensity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SulphurDioxideDensity.UUID = \"000000C5-0000-1000-8000-0026BB765291\";\n return SulphurDioxideDensity;\n}(Characteristic_1.Characteristic));\nexports.SulphurDioxideDensity = SulphurDioxideDensity;\nCharacteristic_1.Characteristic.SulphurDioxideDensity = SulphurDioxideDensity;\n/**\n * Characteristic \"Supported Asset Types\"\n */\nvar SupportedAssetTypes = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedAssetTypes, _super);\n function SupportedAssetTypes() {\n var _this = _super.call(this, \"Supported Asset Types\", SupportedAssetTypes.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedAssetTypes.UUID = \"00000268-0000-1000-8000-0026BB765291\";\n return SupportedAssetTypes;\n}(Characteristic_1.Characteristic));\nexports.SupportedAssetTypes = SupportedAssetTypes;\nCharacteristic_1.Characteristic.SupportedAssetTypes = SupportedAssetTypes;\n/**\n * Characteristic \"Supported Audio Recording Configuration\"\n */\nvar SupportedAudioRecordingConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedAudioRecordingConfiguration, _super);\n function SupportedAudioRecordingConfiguration() {\n var _this = _super.call(this, \"Supported Audio Recording Configuration\", SupportedAudioRecordingConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedAudioRecordingConfiguration.UUID = \"00000207-0000-1000-8000-0026BB765291\";\n return SupportedAudioRecordingConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedAudioRecordingConfiguration = SupportedAudioRecordingConfiguration;\nCharacteristic_1.Characteristic.SupportedAudioRecordingConfiguration = SupportedAudioRecordingConfiguration;\n/**\n * Characteristic \"Supported Audio Stream Configuration\"\n */\nvar SupportedAudioStreamConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedAudioStreamConfiguration, _super);\n function SupportedAudioStreamConfiguration() {\n var _this = _super.call(this, \"Supported Audio Stream Configuration\", SupportedAudioStreamConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedAudioStreamConfiguration.UUID = \"00000115-0000-1000-8000-0026BB765291\";\n return SupportedAudioStreamConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedAudioStreamConfiguration = SupportedAudioStreamConfiguration;\nCharacteristic_1.Characteristic.SupportedAudioStreamConfiguration = SupportedAudioStreamConfiguration;\n/**\n * Characteristic \"Supported Camera Recording Configuration\"\n */\nvar SupportedCameraRecordingConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedCameraRecordingConfiguration, _super);\n function SupportedCameraRecordingConfiguration() {\n var _this = _super.call(this, \"Supported Camera Recording Configuration\", SupportedCameraRecordingConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedCameraRecordingConfiguration.UUID = \"00000205-0000-1000-8000-0026BB765291\";\n return SupportedCameraRecordingConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedCameraRecordingConfiguration = SupportedCameraRecordingConfiguration;\nCharacteristic_1.Characteristic.SupportedCameraRecordingConfiguration = SupportedCameraRecordingConfiguration;\n/**\n * Characteristic \"Supported Characteristic Value Transition Configuration\"\n * @since iOS 14\n */\nvar SupportedCharacteristicValueTransitionConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedCharacteristicValueTransitionConfiguration, _super);\n function SupportedCharacteristicValueTransitionConfiguration() {\n var _this = _super.call(this, \"Supported Characteristic Value Transition Configuration\", SupportedCharacteristicValueTransitionConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedCharacteristicValueTransitionConfiguration.UUID = \"00000144-0000-1000-8000-0026BB765291\";\n return SupportedCharacteristicValueTransitionConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedCharacteristicValueTransitionConfiguration = SupportedCharacteristicValueTransitionConfiguration;\nCharacteristic_1.Characteristic.SupportedCharacteristicValueTransitionConfiguration = SupportedCharacteristicValueTransitionConfiguration;\n/**\n * Characteristic \"Supported Data Stream Transport Configuration\"\n */\nvar SupportedDataStreamTransportConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedDataStreamTransportConfiguration, _super);\n function SupportedDataStreamTransportConfiguration() {\n var _this = _super.call(this, \"Supported Data Stream Transport Configuration\", SupportedDataStreamTransportConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedDataStreamTransportConfiguration.UUID = \"00000130-0000-1000-8000-0026BB765291\";\n return SupportedDataStreamTransportConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedDataStreamTransportConfiguration = SupportedDataStreamTransportConfiguration;\nCharacteristic_1.Characteristic.SupportedDataStreamTransportConfiguration = SupportedDataStreamTransportConfiguration;\n/**\n * Characteristic \"Supported Diagnostics Modes\"\n */\nvar SupportedDiagnosticsModes = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedDiagnosticsModes, _super);\n function SupportedDiagnosticsModes() {\n var _this = _super.call(this, \"Supported Diagnostics Modes\", SupportedDiagnosticsModes.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedDiagnosticsModes.UUID = \"0000024C-0000-1000-8000-0026BB765291\";\n return SupportedDiagnosticsModes;\n}(Characteristic_1.Characteristic));\nexports.SupportedDiagnosticsModes = SupportedDiagnosticsModes;\nCharacteristic_1.Characteristic.SupportedDiagnosticsModes = SupportedDiagnosticsModes;\n/**\n * Characteristic \"Supported Diagnostics Snapshot\"\n * @since iOS 14\n */\nvar SupportedDiagnosticsSnapshot = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedDiagnosticsSnapshot, _super);\n function SupportedDiagnosticsSnapshot() {\n var _this = _super.call(this, \"Supported Diagnostics Snapshot\", SupportedDiagnosticsSnapshot.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedDiagnosticsSnapshot.UUID = \"00000238-0000-1000-8000-0026BB765291\";\n return SupportedDiagnosticsSnapshot;\n}(Characteristic_1.Characteristic));\nexports.SupportedDiagnosticsSnapshot = SupportedDiagnosticsSnapshot;\nCharacteristic_1.Characteristic.SupportedDiagnosticsSnapshot = SupportedDiagnosticsSnapshot;\n/**\n * Characteristic \"Supported Firmware Update Configuration\"\n */\nvar SupportedFirmwareUpdateConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedFirmwareUpdateConfiguration, _super);\n function SupportedFirmwareUpdateConfiguration() {\n var _this = _super.call(this, \"Supported Firmware Update Configuration\", SupportedFirmwareUpdateConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedFirmwareUpdateConfiguration.UUID = \"00000233-0000-1000-8000-0026BB765291\";\n return SupportedFirmwareUpdateConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedFirmwareUpdateConfiguration = SupportedFirmwareUpdateConfiguration;\nCharacteristic_1.Characteristic.SupportedFirmwareUpdateConfiguration = SupportedFirmwareUpdateConfiguration;\n/**\n * Characteristic \"Supported Metrics\"\n */\nvar SupportedMetrics = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedMetrics, _super);\n function SupportedMetrics() {\n var _this = _super.call(this, \"Supported Metrics\", SupportedMetrics.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedMetrics.UUID = \"00000271-0000-1000-8000-0026BB765291\";\n return SupportedMetrics;\n}(Characteristic_1.Characteristic));\nexports.SupportedMetrics = SupportedMetrics;\nCharacteristic_1.Characteristic.SupportedMetrics = SupportedMetrics;\n/**\n * Characteristic \"Supported Router Configuration\"\n */\nvar SupportedRouterConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedRouterConfiguration, _super);\n function SupportedRouterConfiguration() {\n var _this = _super.call(this, \"Supported Router Configuration\", SupportedRouterConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedRouterConfiguration.UUID = \"00000210-0000-1000-8000-0026BB765291\";\n return SupportedRouterConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedRouterConfiguration = SupportedRouterConfiguration;\nCharacteristic_1.Characteristic.SupportedRouterConfiguration = SupportedRouterConfiguration;\n/**\n * Characteristic \"Supported RTP Configuration\"\n */\nvar SupportedRTPConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedRTPConfiguration, _super);\n function SupportedRTPConfiguration() {\n var _this = _super.call(this, \"Supported RTP Configuration\", SupportedRTPConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedRTPConfiguration.UUID = \"00000116-0000-1000-8000-0026BB765291\";\n return SupportedRTPConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedRTPConfiguration = SupportedRTPConfiguration;\nCharacteristic_1.Characteristic.SupportedRTPConfiguration = SupportedRTPConfiguration;\n/**\n * Characteristic \"Supported Sleep Configuration\"\n */\nvar SupportedSleepConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedSleepConfiguration, _super);\n function SupportedSleepConfiguration() {\n var _this = _super.call(this, \"Supported Sleep Configuration\", SupportedSleepConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedSleepConfiguration.UUID = \"00000251-0000-1000-8000-0026BB765291\";\n return SupportedSleepConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedSleepConfiguration = SupportedSleepConfiguration;\nCharacteristic_1.Characteristic.SupportedSleepConfiguration = SupportedSleepConfiguration;\n/**\n * Characteristic \"Supported Transfer Transport Configuration\"\n * @since iOS 13.4\n */\nvar SupportedTransferTransportConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedTransferTransportConfiguration, _super);\n function SupportedTransferTransportConfiguration() {\n var _this = _super.call(this, \"Supported Transfer Transport Configuration\", SupportedTransferTransportConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedTransferTransportConfiguration.UUID = \"00000202-0000-1000-8000-0026BB765291\";\n return SupportedTransferTransportConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedTransferTransportConfiguration = SupportedTransferTransportConfiguration;\nCharacteristic_1.Characteristic.SupportedTransferTransportConfiguration = SupportedTransferTransportConfiguration;\n/**\n * Characteristic \"Supported Video Recording Configuration\"\n */\nvar SupportedVideoRecordingConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedVideoRecordingConfiguration, _super);\n function SupportedVideoRecordingConfiguration() {\n var _this = _super.call(this, \"Supported Video Recording Configuration\", SupportedVideoRecordingConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedVideoRecordingConfiguration.UUID = \"00000206-0000-1000-8000-0026BB765291\";\n return SupportedVideoRecordingConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedVideoRecordingConfiguration = SupportedVideoRecordingConfiguration;\nCharacteristic_1.Characteristic.SupportedVideoRecordingConfiguration = SupportedVideoRecordingConfiguration;\n/**\n * Characteristic \"Supported Video Stream Configuration\"\n */\nvar SupportedVideoStreamConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(SupportedVideoStreamConfiguration, _super);\n function SupportedVideoStreamConfiguration() {\n var _this = _super.call(this, \"Supported Video Stream Configuration\", SupportedVideoStreamConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SupportedVideoStreamConfiguration.UUID = \"00000114-0000-1000-8000-0026BB765291\";\n return SupportedVideoStreamConfiguration;\n}(Characteristic_1.Characteristic));\nexports.SupportedVideoStreamConfiguration = SupportedVideoStreamConfiguration;\nCharacteristic_1.Characteristic.SupportedVideoStreamConfiguration = SupportedVideoStreamConfiguration;\n/**\n * Characteristic \"Swing Mode\"\n */\nvar SwingMode = /** @class */ (function (_super) {\n tslib_1.__extends(SwingMode, _super);\n function SwingMode() {\n var _this = _super.call(this, \"Swing Mode\", SwingMode.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n SwingMode.UUID = \"000000B6-0000-1000-8000-0026BB765291\";\n SwingMode.SWING_DISABLED = 0;\n SwingMode.SWING_ENABLED = 1;\n return SwingMode;\n}(Characteristic_1.Characteristic));\nexports.SwingMode = SwingMode;\nCharacteristic_1.Characteristic.SwingMode = SwingMode;\n/**\n * Characteristic \"Tap Type\"\n */\nvar TapType = /** @class */ (function (_super) {\n tslib_1.__extends(TapType, _super);\n function TapType() {\n var _this = _super.call(this, \"Tap Type\", TapType.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TapType.UUID = \"0000022F-0000-1000-8000-0026BB765291\";\n return TapType;\n}(Characteristic_1.Characteristic));\nexports.TapType = TapType;\nCharacteristic_1.Characteristic.TapType = TapType;\n/**\n * Characteristic \"Target Air Purifier State\"\n */\nvar TargetAirPurifierState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetAirPurifierState, _super);\n function TargetAirPurifierState() {\n var _this = _super.call(this, \"Target Air Purifier State\", TargetAirPurifierState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetAirPurifierState.UUID = \"000000A8-0000-1000-8000-0026BB765291\";\n TargetAirPurifierState.MANUAL = 0;\n TargetAirPurifierState.AUTO = 1;\n return TargetAirPurifierState;\n}(Characteristic_1.Characteristic));\nexports.TargetAirPurifierState = TargetAirPurifierState;\nCharacteristic_1.Characteristic.TargetAirPurifierState = TargetAirPurifierState;\n/**\n * Characteristic \"Target Air Quality\"\n * @deprecated Removed and not used anymore\n */\nvar TargetAirQuality = /** @class */ (function (_super) {\n tslib_1.__extends(TargetAirQuality, _super);\n function TargetAirQuality() {\n var _this = _super.call(this, \"Target Air Quality\", TargetAirQuality.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 2,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetAirQuality.UUID = \"000000AE-0000-1000-8000-0026BB765291\";\n TargetAirQuality.EXCELLENT = 0;\n TargetAirQuality.GOOD = 1;\n TargetAirQuality.FAIR = 2;\n return TargetAirQuality;\n}(Characteristic_1.Characteristic));\nexports.TargetAirQuality = TargetAirQuality;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.TargetAirQuality = TargetAirQuality;\n/**\n * Characteristic \"Target Control List\"\n */\nvar TargetControlList = /** @class */ (function (_super) {\n tslib_1.__extends(TargetControlList, _super);\n function TargetControlList() {\n var _this = _super.call(this, \"Target Control List\", TargetControlList.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n adminOnlyAccess: [0 /* Access.READ */, 1 /* Access.WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetControlList.UUID = \"00000124-0000-1000-8000-0026BB765291\";\n return TargetControlList;\n}(Characteristic_1.Characteristic));\nexports.TargetControlList = TargetControlList;\nCharacteristic_1.Characteristic.TargetControlList = TargetControlList;\n/**\n * Characteristic \"Target Control Supported Configuration\"\n */\nvar TargetControlSupportedConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(TargetControlSupportedConfiguration, _super);\n function TargetControlSupportedConfiguration() {\n var _this = _super.call(this, \"Target Control Supported Configuration\", TargetControlSupportedConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetControlSupportedConfiguration.UUID = \"00000123-0000-1000-8000-0026BB765291\";\n return TargetControlSupportedConfiguration;\n}(Characteristic_1.Characteristic));\nexports.TargetControlSupportedConfiguration = TargetControlSupportedConfiguration;\nCharacteristic_1.Characteristic.TargetControlSupportedConfiguration = TargetControlSupportedConfiguration;\n/**\n * Characteristic \"Target Door State\"\n */\nvar TargetDoorState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetDoorState, _super);\n function TargetDoorState() {\n var _this = _super.call(this, \"Target Door State\", TargetDoorState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetDoorState.UUID = \"00000032-0000-1000-8000-0026BB765291\";\n TargetDoorState.OPEN = 0;\n TargetDoorState.CLOSED = 1;\n return TargetDoorState;\n}(Characteristic_1.Characteristic));\nexports.TargetDoorState = TargetDoorState;\nCharacteristic_1.Characteristic.TargetDoorState = TargetDoorState;\n/**\n * Characteristic \"Target Fan State\"\n */\nvar TargetFanState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetFanState, _super);\n function TargetFanState() {\n var _this = _super.call(this, \"Target Fan State\", TargetFanState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetFanState.UUID = \"000000BF-0000-1000-8000-0026BB765291\";\n TargetFanState.MANUAL = 0;\n TargetFanState.AUTO = 1;\n return TargetFanState;\n}(Characteristic_1.Characteristic));\nexports.TargetFanState = TargetFanState;\nCharacteristic_1.Characteristic.TargetFanState = TargetFanState;\n/**\n * Characteristic \"Target Heater-Cooler State\"\n */\nvar TargetHeaterCoolerState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetHeaterCoolerState, _super);\n function TargetHeaterCoolerState() {\n var _this = _super.call(this, \"Target Heater-Cooler State\", TargetHeaterCoolerState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetHeaterCoolerState.UUID = \"000000B2-0000-1000-8000-0026BB765291\";\n TargetHeaterCoolerState.AUTO = 0;\n TargetHeaterCoolerState.HEAT = 1;\n TargetHeaterCoolerState.COOL = 2;\n return TargetHeaterCoolerState;\n}(Characteristic_1.Characteristic));\nexports.TargetHeaterCoolerState = TargetHeaterCoolerState;\nCharacteristic_1.Characteristic.TargetHeaterCoolerState = TargetHeaterCoolerState;\n/**\n * Characteristic \"Target Heating Cooling State\"\n */\nvar TargetHeatingCoolingState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetHeatingCoolingState, _super);\n function TargetHeatingCoolingState() {\n var _this = _super.call(this, \"Target Heating Cooling State\", TargetHeatingCoolingState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetHeatingCoolingState.UUID = \"00000033-0000-1000-8000-0026BB765291\";\n TargetHeatingCoolingState.OFF = 0;\n TargetHeatingCoolingState.HEAT = 1;\n TargetHeatingCoolingState.COOL = 2;\n TargetHeatingCoolingState.AUTO = 3;\n return TargetHeatingCoolingState;\n}(Characteristic_1.Characteristic));\nexports.TargetHeatingCoolingState = TargetHeatingCoolingState;\nCharacteristic_1.Characteristic.TargetHeatingCoolingState = TargetHeatingCoolingState;\n/**\n * Characteristic \"Target Horizontal Tilt Angle\"\n */\nvar TargetHorizontalTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(TargetHorizontalTiltAngle, _super);\n function TargetHorizontalTiltAngle() {\n var _this = _super.call(this, \"Target Horizontal Tilt Angle\", TargetHorizontalTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetHorizontalTiltAngle.UUID = \"0000007B-0000-1000-8000-0026BB765291\";\n return TargetHorizontalTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.TargetHorizontalTiltAngle = TargetHorizontalTiltAngle;\nCharacteristic_1.Characteristic.TargetHorizontalTiltAngle = TargetHorizontalTiltAngle;\n/**\n * Characteristic \"Target Humidifier-Dehumidifier State\"\n */\nvar TargetHumidifierDehumidifierState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetHumidifierDehumidifierState, _super);\n function TargetHumidifierDehumidifierState() {\n var _this = _super.call(this, \"Target Humidifier-Dehumidifier State\", TargetHumidifierDehumidifierState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetHumidifierDehumidifierState.UUID = \"000000B4-0000-1000-8000-0026BB765291\";\n /**\n * @deprecated Removed in iOS 11. Use {@link HUMIDIFIER_OR_DEHUMIDIFIER} instead.\n */\n TargetHumidifierDehumidifierState.AUTO = 0;\n TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER = 0;\n TargetHumidifierDehumidifierState.HUMIDIFIER = 1;\n TargetHumidifierDehumidifierState.DEHUMIDIFIER = 2;\n return TargetHumidifierDehumidifierState;\n}(Characteristic_1.Characteristic));\nexports.TargetHumidifierDehumidifierState = TargetHumidifierDehumidifierState;\nCharacteristic_1.Characteristic.TargetHumidifierDehumidifierState = TargetHumidifierDehumidifierState;\n/**\n * Characteristic \"Target Media State\"\n */\nvar TargetMediaState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetMediaState, _super);\n function TargetMediaState() {\n var _this = _super.call(this, \"Target Media State\", TargetMediaState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 2,\n minStep: 1,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetMediaState.UUID = \"00000137-0000-1000-8000-0026BB765291\";\n TargetMediaState.PLAY = 0;\n TargetMediaState.PAUSE = 1;\n TargetMediaState.STOP = 2;\n return TargetMediaState;\n}(Characteristic_1.Characteristic));\nexports.TargetMediaState = TargetMediaState;\nCharacteristic_1.Characteristic.TargetMediaState = TargetMediaState;\n/**\n * Characteristic \"Target Position\"\n */\nvar TargetPosition = /** @class */ (function (_super) {\n tslib_1.__extends(TargetPosition, _super);\n function TargetPosition() {\n var _this = _super.call(this, \"Target Position\", TargetPosition.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetPosition.UUID = \"0000007C-0000-1000-8000-0026BB765291\";\n return TargetPosition;\n}(Characteristic_1.Characteristic));\nexports.TargetPosition = TargetPosition;\nCharacteristic_1.Characteristic.TargetPosition = TargetPosition;\n/**\n * Characteristic \"Target Relative Humidity\"\n */\nvar TargetRelativeHumidity = /** @class */ (function (_super) {\n tslib_1.__extends(TargetRelativeHumidity, _super);\n function TargetRelativeHumidity() {\n var _this = _super.call(this, \"Target Relative Humidity\", TargetRelativeHumidity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetRelativeHumidity.UUID = \"00000034-0000-1000-8000-0026BB765291\";\n return TargetRelativeHumidity;\n}(Characteristic_1.Characteristic));\nexports.TargetRelativeHumidity = TargetRelativeHumidity;\nCharacteristic_1.Characteristic.TargetRelativeHumidity = TargetRelativeHumidity;\n/**\n * Characteristic \"Target Slat State\"\n * @deprecated Removed and not used anymore\n */\nvar TargetSlatState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetSlatState, _super);\n function TargetSlatState() {\n var _this = _super.call(this, \"Target Slat State\", TargetSlatState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetSlatState.UUID = \"000000BE-0000-1000-8000-0026BB765291\";\n TargetSlatState.MANUAL = 0;\n TargetSlatState.AUTO = 1;\n return TargetSlatState;\n}(Characteristic_1.Characteristic));\nexports.TargetSlatState = TargetSlatState;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.TargetSlatState = TargetSlatState;\n/**\n * Characteristic \"Target Temperature\"\n */\nvar TargetTemperature = /** @class */ (function (_super) {\n tslib_1.__extends(TargetTemperature, _super);\n function TargetTemperature() {\n var _this = _super.call(this, \"Target Temperature\", TargetTemperature.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"celsius\" /* Units.CELSIUS */,\n minValue: 10,\n maxValue: 38,\n minStep: 0.1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetTemperature.UUID = \"00000035-0000-1000-8000-0026BB765291\";\n return TargetTemperature;\n}(Characteristic_1.Characteristic));\nexports.TargetTemperature = TargetTemperature;\nCharacteristic_1.Characteristic.TargetTemperature = TargetTemperature;\n/**\n * Characteristic \"Target Tilt Angle\"\n */\nvar TargetTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(TargetTiltAngle, _super);\n function TargetTiltAngle() {\n var _this = _super.call(this, \"Target Tilt Angle\", TargetTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetTiltAngle.UUID = \"000000C2-0000-1000-8000-0026BB765291\";\n return TargetTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.TargetTiltAngle = TargetTiltAngle;\nCharacteristic_1.Characteristic.TargetTiltAngle = TargetTiltAngle;\n/**\n * Characteristic \"Target Vertical Tilt Angle\"\n */\nvar TargetVerticalTiltAngle = /** @class */ (function (_super) {\n tslib_1.__extends(TargetVerticalTiltAngle, _super);\n function TargetVerticalTiltAngle() {\n var _this = _super.call(this, \"Target Vertical Tilt Angle\", TargetVerticalTiltAngle.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"arcdegrees\" /* Units.ARC_DEGREE */,\n minValue: -90,\n maxValue: 90,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetVerticalTiltAngle.UUID = \"0000007D-0000-1000-8000-0026BB765291\";\n return TargetVerticalTiltAngle;\n}(Characteristic_1.Characteristic));\nexports.TargetVerticalTiltAngle = TargetVerticalTiltAngle;\nCharacteristic_1.Characteristic.TargetVerticalTiltAngle = TargetVerticalTiltAngle;\n/**\n * Characteristic \"Target Visibility State\"\n */\nvar TargetVisibilityState = /** @class */ (function (_super) {\n tslib_1.__extends(TargetVisibilityState, _super);\n function TargetVisibilityState() {\n var _this = _super.call(this, \"Target Visibility State\", TargetVisibilityState.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TargetVisibilityState.UUID = \"00000134-0000-1000-8000-0026BB765291\";\n TargetVisibilityState.SHOWN = 0;\n TargetVisibilityState.HIDDEN = 1;\n return TargetVisibilityState;\n}(Characteristic_1.Characteristic));\nexports.TargetVisibilityState = TargetVisibilityState;\nCharacteristic_1.Characteristic.TargetVisibilityState = TargetVisibilityState;\n/**\n * Characteristic \"Temperature Display Units\"\n */\nvar TemperatureDisplayUnits = /** @class */ (function (_super) {\n tslib_1.__extends(TemperatureDisplayUnits, _super);\n function TemperatureDisplayUnits() {\n var _this = _super.call(this, \"Temperature Display Units\", TemperatureDisplayUnits.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TemperatureDisplayUnits.UUID = \"00000036-0000-1000-8000-0026BB765291\";\n TemperatureDisplayUnits.CELSIUS = 0;\n TemperatureDisplayUnits.FAHRENHEIT = 1;\n return TemperatureDisplayUnits;\n}(Characteristic_1.Characteristic));\nexports.TemperatureDisplayUnits = TemperatureDisplayUnits;\nCharacteristic_1.Characteristic.TemperatureDisplayUnits = TemperatureDisplayUnits;\n/**\n * Characteristic \"Third Party Camera Active\"\n */\nvar ThirdPartyCameraActive = /** @class */ (function (_super) {\n tslib_1.__extends(ThirdPartyCameraActive, _super);\n function ThirdPartyCameraActive() {\n var _this = _super.call(this, \"Third Party Camera Active\", ThirdPartyCameraActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ThirdPartyCameraActive.UUID = \"0000021C-0000-1000-8000-0026BB765291\";\n ThirdPartyCameraActive.OFF = 0;\n ThirdPartyCameraActive.ON = 1;\n return ThirdPartyCameraActive;\n}(Characteristic_1.Characteristic));\nexports.ThirdPartyCameraActive = ThirdPartyCameraActive;\nCharacteristic_1.Characteristic.ThirdPartyCameraActive = ThirdPartyCameraActive;\n/**\n * Characteristic \"Thread Control Point\"\n */\nvar ThreadControlPoint = /** @class */ (function (_super) {\n tslib_1.__extends(ThreadControlPoint, _super);\n function ThreadControlPoint() {\n var _this = _super.call(this, \"Thread Control Point\", ThreadControlPoint.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ThreadControlPoint.UUID = \"00000704-0000-1000-8000-0026BB765291\";\n return ThreadControlPoint;\n}(Characteristic_1.Characteristic));\nexports.ThreadControlPoint = ThreadControlPoint;\nCharacteristic_1.Characteristic.ThreadControlPoint = ThreadControlPoint;\n/**\n * Characteristic \"Thread Node Capabilities\"\n */\nvar ThreadNodeCapabilities = /** @class */ (function (_super) {\n tslib_1.__extends(ThreadNodeCapabilities, _super);\n function ThreadNodeCapabilities() {\n var _this = _super.call(this, \"Thread Node Capabilities\", ThreadNodeCapabilities.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 31,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ThreadNodeCapabilities.UUID = \"00000702-0000-1000-8000-0026BB765291\";\n return ThreadNodeCapabilities;\n}(Characteristic_1.Characteristic));\nexports.ThreadNodeCapabilities = ThreadNodeCapabilities;\nCharacteristic_1.Characteristic.ThreadNodeCapabilities = ThreadNodeCapabilities;\n/**\n * Characteristic \"Thread OpenThread Version\"\n */\nvar ThreadOpenThreadVersion = /** @class */ (function (_super) {\n tslib_1.__extends(ThreadOpenThreadVersion, _super);\n function ThreadOpenThreadVersion() {\n var _this = _super.call(this, \"Thread OpenThread Version\", ThreadOpenThreadVersion.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ThreadOpenThreadVersion.UUID = \"00000706-0000-1000-8000-0026BB765291\";\n return ThreadOpenThreadVersion;\n}(Characteristic_1.Characteristic));\nexports.ThreadOpenThreadVersion = ThreadOpenThreadVersion;\nCharacteristic_1.Characteristic.ThreadOpenThreadVersion = ThreadOpenThreadVersion;\n/**\n * Characteristic \"Thread Status\"\n */\nvar ThreadStatus = /** @class */ (function (_super) {\n tslib_1.__extends(ThreadStatus, _super);\n function ThreadStatus() {\n var _this = _super.call(this, \"Thread Status\", ThreadStatus.UUID, {\n format: \"uint16\" /* Formats.UINT16 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 6,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ThreadStatus.UUID = \"00000703-0000-1000-8000-0026BB765291\";\n return ThreadStatus;\n}(Characteristic_1.Characteristic));\nexports.ThreadStatus = ThreadStatus;\nCharacteristic_1.Characteristic.ThreadStatus = ThreadStatus;\n/**\n * Characteristic \"Time Update\"\n * @deprecated Removed and not used anymore\n */\nvar TimeUpdate = /** @class */ (function (_super) {\n tslib_1.__extends(TimeUpdate, _super);\n function TimeUpdate() {\n var _this = _super.call(this, \"Time Update\", TimeUpdate.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TimeUpdate.UUID = \"0000009A-0000-1000-8000-0026BB765291\";\n return TimeUpdate;\n}(Characteristic_1.Characteristic));\nexports.TimeUpdate = TimeUpdate;\n// noinspection JSDeprecatedSymbols\nCharacteristic_1.Characteristic.TimeUpdate = TimeUpdate;\n/**\n * Characteristic \"Token\"\n */\nvar Token = /** @class */ (function (_super) {\n tslib_1.__extends(Token, _super);\n function Token() {\n var _this = _super.call(this, \"Token\", Token.UUID, {\n format: \"data\" /* Formats.DATA */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Token.UUID = \"00000231-0000-1000-8000-0026BB765291\";\n return Token;\n}(Characteristic_1.Characteristic));\nexports.Token = Token;\nCharacteristic_1.Characteristic.Token = Token;\n/**\n * Characteristic \"Transmit Power\"\n * @since iOS 14\n */\nvar TransmitPower = /** @class */ (function (_super) {\n tslib_1.__extends(TransmitPower, _super);\n function TransmitPower() {\n var _this = _super.call(this, \"Transmit Power\", TransmitPower.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TransmitPower.UUID = \"00000242-0000-1000-8000-0026BB765291\";\n return TransmitPower;\n}(Characteristic_1.Characteristic));\nexports.TransmitPower = TransmitPower;\nCharacteristic_1.Characteristic.TransmitPower = TransmitPower;\n/**\n * Characteristic \"Tunnel Connection Timeout\"\n */\nvar TunnelConnectionTimeout = /** @class */ (function (_super) {\n tslib_1.__extends(TunnelConnectionTimeout, _super);\n function TunnelConnectionTimeout() {\n var _this = _super.call(this, \"Tunnel Connection Timeout\", TunnelConnectionTimeout.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TunnelConnectionTimeout.UUID = \"00000061-0000-1000-8000-0026BB765291\";\n return TunnelConnectionTimeout;\n}(Characteristic_1.Characteristic));\nexports.TunnelConnectionTimeout = TunnelConnectionTimeout;\nCharacteristic_1.Characteristic.TunnelConnectionTimeout = TunnelConnectionTimeout;\n/**\n * Characteristic \"Tunneled Accessory Advertising\"\n */\nvar TunneledAccessoryAdvertising = /** @class */ (function (_super) {\n tslib_1.__extends(TunneledAccessoryAdvertising, _super);\n function TunneledAccessoryAdvertising() {\n var _this = _super.call(this, \"Tunneled Accessory Advertising\", TunneledAccessoryAdvertising.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TunneledAccessoryAdvertising.UUID = \"00000060-0000-1000-8000-0026BB765291\";\n return TunneledAccessoryAdvertising;\n}(Characteristic_1.Characteristic));\nexports.TunneledAccessoryAdvertising = TunneledAccessoryAdvertising;\nCharacteristic_1.Characteristic.TunneledAccessoryAdvertising = TunneledAccessoryAdvertising;\n/**\n * Characteristic \"Tunneled Accessory Connected\"\n */\nvar TunneledAccessoryConnected = /** @class */ (function (_super) {\n tslib_1.__extends(TunneledAccessoryConnected, _super);\n function TunneledAccessoryConnected() {\n var _this = _super.call(this, \"Tunneled Accessory Connected\", TunneledAccessoryConnected.UUID, {\n format: \"bool\" /* Formats.BOOL */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TunneledAccessoryConnected.UUID = \"00000059-0000-1000-8000-0026BB765291\";\n return TunneledAccessoryConnected;\n}(Characteristic_1.Characteristic));\nexports.TunneledAccessoryConnected = TunneledAccessoryConnected;\nCharacteristic_1.Characteristic.TunneledAccessoryConnected = TunneledAccessoryConnected;\n/**\n * Characteristic \"Tunneled Accessory State Number\"\n */\nvar TunneledAccessoryStateNumber = /** @class */ (function (_super) {\n tslib_1.__extends(TunneledAccessoryStateNumber, _super);\n function TunneledAccessoryStateNumber() {\n var _this = _super.call(this, \"Tunneled Accessory State Number\", TunneledAccessoryStateNumber.UUID, {\n format: \"int\" /* Formats.INT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n TunneledAccessoryStateNumber.UUID = \"00000058-0000-1000-8000-0026BB765291\";\n return TunneledAccessoryStateNumber;\n}(Characteristic_1.Characteristic));\nexports.TunneledAccessoryStateNumber = TunneledAccessoryStateNumber;\nCharacteristic_1.Characteristic.TunneledAccessoryStateNumber = TunneledAccessoryStateNumber;\n/**\n * Characteristic \"Valve Type\"\n */\nvar ValveType = /** @class */ (function (_super) {\n tslib_1.__extends(ValveType, _super);\n function ValveType() {\n var _this = _super.call(this, \"Valve Type\", ValveType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n ValveType.UUID = \"000000D5-0000-1000-8000-0026BB765291\";\n ValveType.GENERIC_VALVE = 0;\n ValveType.IRRIGATION = 1;\n ValveType.SHOWER_HEAD = 2;\n ValveType.WATER_FAUCET = 3;\n return ValveType;\n}(Characteristic_1.Characteristic));\nexports.ValveType = ValveType;\nCharacteristic_1.Characteristic.ValveType = ValveType;\n/**\n * Characteristic \"Version\"\n */\nvar Version = /** @class */ (function (_super) {\n tslib_1.__extends(Version, _super);\n function Version() {\n var _this = _super.call(this, \"Version\", Version.UUID, {\n format: \"string\" /* Formats.STRING */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n maxLen: 64,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Version.UUID = \"00000037-0000-1000-8000-0026BB765291\";\n return Version;\n}(Characteristic_1.Characteristic));\nexports.Version = Version;\nCharacteristic_1.Characteristic.Version = Version;\n/**\n * Characteristic \"Video Analysis Active\"\n * @since iOS 14\n */\nvar VideoAnalysisActive = /** @class */ (function (_super) {\n tslib_1.__extends(VideoAnalysisActive, _super);\n function VideoAnalysisActive() {\n var _this = _super.call(this, \"Video Analysis Active\", VideoAnalysisActive.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n VideoAnalysisActive.UUID = \"00000229-0000-1000-8000-0026BB765291\";\n return VideoAnalysisActive;\n}(Characteristic_1.Characteristic));\nexports.VideoAnalysisActive = VideoAnalysisActive;\nCharacteristic_1.Characteristic.VideoAnalysisActive = VideoAnalysisActive;\n/**\n * Characteristic \"VOC Density\"\n */\nvar VOCDensity = /** @class */ (function (_super) {\n tslib_1.__extends(VOCDensity, _super);\n function VOCDensity() {\n var _this = _super.call(this, \"VOC Density\", VOCDensity.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 1000,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n VOCDensity.UUID = \"000000C8-0000-1000-8000-0026BB765291\";\n return VOCDensity;\n}(Characteristic_1.Characteristic));\nexports.VOCDensity = VOCDensity;\nCharacteristic_1.Characteristic.VOCDensity = VOCDensity;\n/**\n * Characteristic \"Volume\"\n */\nvar Volume = /** @class */ (function (_super) {\n tslib_1.__extends(Volume, _super);\n function Volume() {\n var _this = _super.call(this, \"Volume\", Volume.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n Volume.UUID = \"00000119-0000-1000-8000-0026BB765291\";\n return Volume;\n}(Characteristic_1.Characteristic));\nexports.Volume = Volume;\nCharacteristic_1.Characteristic.Volume = Volume;\n/**\n * Characteristic \"Volume Control Type\"\n */\nvar VolumeControlType = /** @class */ (function (_super) {\n tslib_1.__extends(VolumeControlType, _super);\n function VolumeControlType() {\n var _this = _super.call(this, \"Volume Control Type\", VolumeControlType.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 3,\n minStep: 1,\n validValues: [0, 1, 2, 3],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n VolumeControlType.UUID = \"000000E9-0000-1000-8000-0026BB765291\";\n VolumeControlType.NONE = 0;\n VolumeControlType.RELATIVE = 1;\n VolumeControlType.RELATIVE_WITH_CURRENT = 2;\n VolumeControlType.ABSOLUTE = 3;\n return VolumeControlType;\n}(Characteristic_1.Characteristic));\nexports.VolumeControlType = VolumeControlType;\nCharacteristic_1.Characteristic.VolumeControlType = VolumeControlType;\n/**\n * Characteristic \"Volume Selector\"\n */\nvar VolumeSelector = /** @class */ (function (_super) {\n tslib_1.__extends(VolumeSelector, _super);\n function VolumeSelector() {\n var _this = _super.call(this, \"Volume Selector\", VolumeSelector.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"pw\" /* Perms.PAIRED_WRITE */],\n minValue: 0,\n maxValue: 1,\n minStep: 1,\n validValues: [0, 1],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n VolumeSelector.UUID = \"000000EA-0000-1000-8000-0026BB765291\";\n VolumeSelector.INCREMENT = 0;\n VolumeSelector.DECREMENT = 1;\n return VolumeSelector;\n}(Characteristic_1.Characteristic));\nexports.VolumeSelector = VolumeSelector;\nCharacteristic_1.Characteristic.VolumeSelector = VolumeSelector;\n/**\n * Characteristic \"Wake Configuration\"\n * @since iOS 13.4\n */\nvar WakeConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(WakeConfiguration, _super);\n function WakeConfiguration() {\n var _this = _super.call(this, \"Wake Configuration\", WakeConfiguration.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WakeConfiguration.UUID = \"00000222-0000-1000-8000-0026BB765291\";\n return WakeConfiguration;\n}(Characteristic_1.Characteristic));\nexports.WakeConfiguration = WakeConfiguration;\nCharacteristic_1.Characteristic.WakeConfiguration = WakeConfiguration;\n/**\n * Characteristic \"WAN Configuration List\"\n */\nvar WANConfigurationList = /** @class */ (function (_super) {\n tslib_1.__extends(WANConfigurationList, _super);\n function WANConfigurationList() {\n var _this = _super.call(this, \"WAN Configuration List\", WANConfigurationList.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WANConfigurationList.UUID = \"00000211-0000-1000-8000-0026BB765291\";\n return WANConfigurationList;\n}(Characteristic_1.Characteristic));\nexports.WANConfigurationList = WANConfigurationList;\nCharacteristic_1.Characteristic.WANConfigurationList = WANConfigurationList;\n/**\n * Characteristic \"WAN Status List\"\n */\nvar WANStatusList = /** @class */ (function (_super) {\n tslib_1.__extends(WANStatusList, _super);\n function WANStatusList() {\n var _this = _super.call(this, \"WAN Status List\", WANStatusList.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WANStatusList.UUID = \"00000212-0000-1000-8000-0026BB765291\";\n return WANStatusList;\n}(Characteristic_1.Characteristic));\nexports.WANStatusList = WANStatusList;\nCharacteristic_1.Characteristic.WANStatusList = WANStatusList;\n/**\n * Characteristic \"Water Level\"\n */\nvar WaterLevel = /** @class */ (function (_super) {\n tslib_1.__extends(WaterLevel, _super);\n function WaterLevel() {\n var _this = _super.call(this, \"Water Level\", WaterLevel.UUID, {\n format: \"float\" /* Formats.FLOAT */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n unit: \"percentage\" /* Units.PERCENTAGE */,\n minValue: 0,\n maxValue: 100,\n minStep: 1,\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WaterLevel.UUID = \"000000B5-0000-1000-8000-0026BB765291\";\n return WaterLevel;\n}(Characteristic_1.Characteristic));\nexports.WaterLevel = WaterLevel;\nCharacteristic_1.Characteristic.WaterLevel = WaterLevel;\n/**\n * Characteristic \"Wi-Fi Capabilities\"\n * @since iOS 14\n */\nvar WiFiCapabilities = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiCapabilities, _super);\n function WiFiCapabilities() {\n var _this = _super.call(this, \"Wi-Fi Capabilities\", WiFiCapabilities.UUID, {\n format: \"uint32\" /* Formats.UINT32 */,\n perms: [\"pr\" /* Perms.PAIRED_READ */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WiFiCapabilities.UUID = \"0000022C-0000-1000-8000-0026BB765291\";\n return WiFiCapabilities;\n}(Characteristic_1.Characteristic));\nexports.WiFiCapabilities = WiFiCapabilities;\nCharacteristic_1.Characteristic.WiFiCapabilities = WiFiCapabilities;\n/**\n * Characteristic \"Wi-Fi Configuration Control\"\n * @since iOS 14\n */\nvar WiFiConfigurationControl = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiConfigurationControl, _super);\n function WiFiConfigurationControl() {\n var _this = _super.call(this, \"Wi-Fi Configuration Control\", WiFiConfigurationControl.UUID, {\n format: \"tlv8\" /* Formats.TLV8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */, \"pw\" /* Perms.PAIRED_WRITE */, \"tw\" /* Perms.TIMED_WRITE */, \"wr\" /* Perms.WRITE_RESPONSE */],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WiFiConfigurationControl.UUID = \"0000022D-0000-1000-8000-0026BB765291\";\n return WiFiConfigurationControl;\n}(Characteristic_1.Characteristic));\nexports.WiFiConfigurationControl = WiFiConfigurationControl;\nCharacteristic_1.Characteristic.WiFiConfigurationControl = WiFiConfigurationControl;\n/**\n * Characteristic \"Wi-Fi Satellite Status\"\n */\nvar WiFiSatelliteStatus = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiSatelliteStatus, _super);\n function WiFiSatelliteStatus() {\n var _this = _super.call(this, \"Wi-Fi Satellite Status\", WiFiSatelliteStatus.UUID, {\n format: \"uint8\" /* Formats.UINT8 */,\n perms: [\"ev\" /* Perms.NOTIFY */, \"pr\" /* Perms.PAIRED_READ */],\n minValue: 0,\n maxValue: 2,\n validValues: [0, 1, 2],\n }) || this;\n _this.value = _this.getDefaultValue();\n return _this;\n }\n WiFiSatelliteStatus.UUID = \"0000021E-0000-1000-8000-0026BB765291\";\n WiFiSatelliteStatus.UNKNOWN = 0;\n WiFiSatelliteStatus.CONNECTED = 1;\n WiFiSatelliteStatus.NOT_CONNECTED = 2;\n return WiFiSatelliteStatus;\n}(Characteristic_1.Characteristic));\nexports.WiFiSatelliteStatus = WiFiSatelliteStatus;\nCharacteristic_1.Characteristic.WiFiSatelliteStatus = WiFiSatelliteStatus;\n//# sourceMappingURL=CharacteristicDefinitions.js.map","\"use strict\";\n// THIS FILE IS AUTO-GENERATED - DO NOT MODIFY\n// V=880\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SecuritySystem = exports.ProtocolInformation = exports.PowerManagement = exports.Pairing = exports.Outlet = exports.OccupancySensor = exports.NFCAccess = exports.MotionSensor = exports.Microphone = exports.LockMechanism = exports.LockManagement = exports.LightSensor = exports.Lightbulb = exports.LeakSensor = exports.IrrigationSystem = exports.InputSource = exports.HumiditySensor = exports.HumidifierDehumidifier = exports.HeaterCooler = exports.GarageDoorOpener = exports.FirmwareUpdate = exports.FilterMaintenance = exports.Faucet = exports.Fanv2 = exports.Fan = exports.Doorbell = exports.Door = exports.Diagnostics = exports.DataStreamTransportManagement = exports.ContactSensor = exports.CloudRelay = exports.CarbonMonoxideSensor = exports.CarbonDioxideSensor = exports.CameraRTPStreamManagement = exports.CameraRecordingManagement = exports.CameraOperatingMode = exports.CameraControl = exports.BridgingState = exports.BridgeConfiguration = exports.Battery = exports.AudioStreamManagement = exports.Assistant = exports.AssetUpdate = exports.AirQualitySensor = exports.AirPurifier = exports.AccessoryRuntimeInformation = exports.AccessoryMetrics = exports.AccessoryInformation = exports.AccessControl = exports.AccessCode = void 0;\nexports.WindowCovering = exports.Window = exports.WiFiTransport = exports.WiFiSatellite = exports.WiFiRouter = exports.Valve = exports.Tunnel = exports.TransferTransportManagement = exports.TimeInformation = exports.ThreadTransport = exports.Thermostat = exports.TemperatureSensor = exports.TelevisionSpeaker = exports.Television = exports.TargetControlManagement = exports.TargetControl = exports.TapManagement = exports.Switch = exports.StatelessProgrammableSwitch = exports.StatefulProgrammableSwitch = exports.Speaker = exports.SmokeSensor = exports.SmartSpeaker = exports.Slats = exports.SiriEndpoint = exports.Siri = exports.ServiceLabel = void 0;\nvar tslib_1 = require(\"tslib\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar Service_1 = require(\"../Service\");\n/**\n * Service \"Access Code\"\n * @since iOS 15\n */\nvar AccessCode = /** @class */ (function (_super) {\n tslib_1.__extends(AccessCode, _super);\n function AccessCode(displayName, subtype) {\n var _this = _super.call(this, displayName, AccessCode.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.AccessCodeControlPoint);\n _this.addCharacteristic(Characteristic_1.Characteristic.AccessCodeSupportedConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfigurationState);\n return _this;\n }\n AccessCode.UUID = \"00000260-0000-1000-8000-0026BB765291\";\n return AccessCode;\n}(Service_1.Service));\nexports.AccessCode = AccessCode;\nService_1.Service.AccessCode = AccessCode;\n/**\n * Service \"Access Control\"\n */\nvar AccessControl = /** @class */ (function (_super) {\n tslib_1.__extends(AccessControl, _super);\n function AccessControl(displayName, subtype) {\n var _this = _super.call(this, displayName, AccessControl.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.AccessControlLevel);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PasswordSetting);\n return _this;\n }\n AccessControl.UUID = \"000000DA-0000-1000-8000-0026BB765291\";\n return AccessControl;\n}(Service_1.Service));\nexports.AccessControl = AccessControl;\nService_1.Service.AccessControl = AccessControl;\n/**\n * Service \"Accessory Information\"\n */\nvar AccessoryInformation = /** @class */ (function (_super) {\n tslib_1.__extends(AccessoryInformation, _super);\n function AccessoryInformation(displayName, subtype) {\n var _this = _super.call(this, displayName, AccessoryInformation.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Identify);\n _this.addCharacteristic(Characteristic_1.Characteristic.Manufacturer);\n _this.addCharacteristic(Characteristic_1.Characteristic.Model);\n if (!_this.testCharacteristic(Characteristic_1.Characteristic.Name)) { // workaround for Name characteristic collision in constructor\n _this.addCharacteristic(Characteristic_1.Characteristic.Name).updateValue(\"Unnamed Service\");\n }\n _this.addCharacteristic(Characteristic_1.Characteristic.SerialNumber);\n _this.addCharacteristic(Characteristic_1.Characteristic.FirmwareRevision);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.AccessoryFlags);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.AppMatchingIdentifier);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ConfiguredName);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HardwareFinish);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HardwareRevision);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ProductData);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SoftwareRevision);\n return _this;\n }\n AccessoryInformation.UUID = \"0000003E-0000-1000-8000-0026BB765291\";\n return AccessoryInformation;\n}(Service_1.Service));\nexports.AccessoryInformation = AccessoryInformation;\nService_1.Service.AccessoryInformation = AccessoryInformation;\n/**\n * Service \"Accessory Metrics\"\n */\nvar AccessoryMetrics = /** @class */ (function (_super) {\n tslib_1.__extends(AccessoryMetrics, _super);\n function AccessoryMetrics(displayName, subtype) {\n var _this = _super.call(this, displayName, AccessoryMetrics.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.MetricsBufferFullState);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedMetrics);\n return _this;\n }\n AccessoryMetrics.UUID = \"00000270-0000-1000-8000-0026BB765291\";\n return AccessoryMetrics;\n}(Service_1.Service));\nexports.AccessoryMetrics = AccessoryMetrics;\nService_1.Service.AccessoryMetrics = AccessoryMetrics;\n/**\n * Service \"Accessory Runtime Information\"\n */\nvar AccessoryRuntimeInformation = /** @class */ (function (_super) {\n tslib_1.__extends(AccessoryRuntimeInformation, _super);\n function AccessoryRuntimeInformation(displayName, subtype) {\n var _this = _super.call(this, displayName, AccessoryRuntimeInformation.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Ping);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ActivityInterval);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HeartBeat);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SleepInterval);\n return _this;\n }\n AccessoryRuntimeInformation.UUID = \"00000239-0000-1000-8000-0026BB765291\";\n return AccessoryRuntimeInformation;\n}(Service_1.Service));\nexports.AccessoryRuntimeInformation = AccessoryRuntimeInformation;\nService_1.Service.AccessoryRuntimeInformation = AccessoryRuntimeInformation;\n/**\n * Service \"Air Purifier\"\n */\nvar AirPurifier = /** @class */ (function (_super) {\n tslib_1.__extends(AirPurifier, _super);\n function AirPurifier(displayName, subtype) {\n var _this = _super.call(this, displayName, AirPurifier.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentAirPurifierState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetAirPurifierState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockPhysicalControls);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationSpeed);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SwingMode);\n return _this;\n }\n AirPurifier.UUID = \"000000BB-0000-1000-8000-0026BB765291\";\n return AirPurifier;\n}(Service_1.Service));\nexports.AirPurifier = AirPurifier;\nService_1.Service.AirPurifier = AirPurifier;\n/**\n * Service \"Air Quality Sensor\"\n */\nvar AirQualitySensor = /** @class */ (function (_super) {\n tslib_1.__extends(AirQualitySensor, _super);\n function AirQualitySensor(displayName, subtype) {\n var _this = _super.call(this, displayName, AirQualitySensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.AirQuality);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.NitrogenDioxideDensity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.OzoneDensity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PM10Density);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PM2_5Density);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SulphurDioxideDensity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.VOCDensity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n AirQualitySensor.UUID = \"0000008D-0000-1000-8000-0026BB765291\";\n return AirQualitySensor;\n}(Service_1.Service));\nexports.AirQualitySensor = AirQualitySensor;\nService_1.Service.AirQualitySensor = AirQualitySensor;\n/**\n * Service \"Asset Update\"\n */\nvar AssetUpdate = /** @class */ (function (_super) {\n tslib_1.__extends(AssetUpdate, _super);\n function AssetUpdate(displayName, subtype) {\n var _this = _super.call(this, displayName, AssetUpdate.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.AssetUpdateReadiness);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedAssetTypes);\n return _this;\n }\n AssetUpdate.UUID = \"00000267-0000-1000-8000-0026BB765291\";\n return AssetUpdate;\n}(Service_1.Service));\nexports.AssetUpdate = AssetUpdate;\nService_1.Service.AssetUpdate = AssetUpdate;\n/**\n * Service \"Assistant\"\n */\nvar Assistant = /** @class */ (function (_super) {\n tslib_1.__extends(Assistant, _super);\n function Assistant(displayName, subtype) {\n var _this = _super.call(this, displayName, Assistant.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.Identifier);\n if (!_this.testCharacteristic(Characteristic_1.Characteristic.Name)) { // workaround for Name characteristic collision in constructor\n _this.addCharacteristic(Characteristic_1.Characteristic.Name).updateValue(\"Unnamed Service\");\n }\n return _this;\n }\n Assistant.UUID = \"0000026A-0000-1000-8000-0026BB765291\";\n return Assistant;\n}(Service_1.Service));\nexports.Assistant = Assistant;\nService_1.Service.Assistant = Assistant;\n/**\n * Service \"Audio Stream Management\"\n */\nvar AudioStreamManagement = /** @class */ (function (_super) {\n tslib_1.__extends(AudioStreamManagement, _super);\n function AudioStreamManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, AudioStreamManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SelectedAudioStreamConfiguration);\n return _this;\n }\n AudioStreamManagement.UUID = \"00000127-0000-1000-8000-0026BB765291\";\n return AudioStreamManagement;\n}(Service_1.Service));\nexports.AudioStreamManagement = AudioStreamManagement;\nService_1.Service.AudioStreamManagement = AudioStreamManagement;\n/**\n * Service \"Battery\"\n */\nvar Battery = /** @class */ (function (_super) {\n tslib_1.__extends(Battery, _super);\n function Battery(displayName, subtype) {\n var _this = _super.call(this, displayName, Battery.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.BatteryLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ChargingState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n Battery.UUID = \"00000096-0000-1000-8000-0026BB765291\";\n return Battery;\n}(Service_1.Service));\nexports.Battery = Battery;\n// noinspection JSDeprecatedSymbols\nService_1.Service.BatteryService = Battery;\nService_1.Service.Battery = Battery;\n/**\n * Service \"Bridge Configuration\"\n * @deprecated Removed and not used anymore\n */\nvar BridgeConfiguration = /** @class */ (function (_super) {\n tslib_1.__extends(BridgeConfiguration, _super);\n function BridgeConfiguration(displayName, subtype) {\n var _this = _super.call(this, displayName, BridgeConfiguration.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfigureBridgedAccessoryStatus);\n _this.addCharacteristic(Characteristic_1.Characteristic.DiscoverBridgedAccessories);\n _this.addCharacteristic(Characteristic_1.Characteristic.DiscoveredBridgedAccessories);\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfigureBridgedAccessory);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n BridgeConfiguration.UUID = \"000000A1-0000-1000-8000-0026BB765291\";\n return BridgeConfiguration;\n}(Service_1.Service));\nexports.BridgeConfiguration = BridgeConfiguration;\n// noinspection JSDeprecatedSymbols\nService_1.Service.BridgeConfiguration = BridgeConfiguration;\n/**\n * Service \"Bridging State\"\n * @deprecated Removed and not used anymore\n */\nvar BridgingState = /** @class */ (function (_super) {\n tslib_1.__extends(BridgingState, _super);\n function BridgingState(displayName, subtype) {\n var _this = _super.call(this, displayName, BridgingState.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Reachable);\n _this.addCharacteristic(Characteristic_1.Characteristic.LinkQuality);\n _this.addCharacteristic(Characteristic_1.Characteristic.AccessoryIdentifier);\n _this.addCharacteristic(Characteristic_1.Characteristic.Category);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n BridgingState.UUID = \"00000062-0000-1000-8000-0026BB765291\";\n return BridgingState;\n}(Service_1.Service));\nexports.BridgingState = BridgingState;\n// noinspection JSDeprecatedSymbols\nService_1.Service.BridgingState = BridgingState;\n/**\n * Service \"Camera Control\"\n * @deprecated This service has no usage anymore and will be ignored by iOS\n */\nvar CameraControl = /** @class */ (function (_super) {\n tslib_1.__extends(CameraControl, _super);\n function CameraControl(displayName, subtype) {\n var _this = _super.call(this, displayName, CameraControl.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.On);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentHorizontalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentVerticalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetHorizontalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetVerticalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.NightVision);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.OpticalZoom);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.DigitalZoom);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ImageRotation);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ImageMirroring);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n CameraControl.UUID = \"00000111-0000-1000-8000-0026BB765291\";\n return CameraControl;\n}(Service_1.Service));\nexports.CameraControl = CameraControl;\n// noinspection JSDeprecatedSymbols\nService_1.Service.CameraControl = CameraControl;\n/**\n * Service \"Camera Operating Mode\"\n */\nvar CameraOperatingMode = /** @class */ (function (_super) {\n tslib_1.__extends(CameraOperatingMode, _super);\n function CameraOperatingMode(displayName, subtype) {\n var _this = _super.call(this, displayName, CameraOperatingMode.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.EventSnapshotsActive);\n _this.addCharacteristic(Characteristic_1.Characteristic.HomeKitCameraActive);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CameraOperatingModeIndicator);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ManuallyDisabled);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.NightVision);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PeriodicSnapshotsActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ThirdPartyCameraActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.DiagonalFieldOfView);\n return _this;\n }\n CameraOperatingMode.UUID = \"0000021A-0000-1000-8000-0026BB765291\";\n return CameraOperatingMode;\n}(Service_1.Service));\nexports.CameraOperatingMode = CameraOperatingMode;\nService_1.Service.CameraOperatingMode = CameraOperatingMode;\n/**\n * Service \"Camera Recording Management\"\n */\nvar CameraRecordingManagement = /** @class */ (function (_super) {\n tslib_1.__extends(CameraRecordingManagement, _super);\n function CameraRecordingManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, CameraRecordingManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.SelectedCameraRecordingConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedAudioRecordingConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedCameraRecordingConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedVideoRecordingConfiguration);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RecordingAudioActive);\n return _this;\n }\n CameraRecordingManagement.UUID = \"00000204-0000-1000-8000-0026BB765291\";\n return CameraRecordingManagement;\n}(Service_1.Service));\nexports.CameraRecordingManagement = CameraRecordingManagement;\n// noinspection JSDeprecatedSymbols\nService_1.Service.CameraEventRecordingManagement = CameraRecordingManagement;\nService_1.Service.CameraRecordingManagement = CameraRecordingManagement;\n/**\n * Service \"Camera RTP Stream Management\"\n */\nvar CameraRTPStreamManagement = /** @class */ (function (_super) {\n tslib_1.__extends(CameraRTPStreamManagement, _super);\n function CameraRTPStreamManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, CameraRTPStreamManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SetupEndpoints);\n _this.addCharacteristic(Characteristic_1.Characteristic.StreamingStatus);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedRTPConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedVideoStreamConfiguration);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Active);\n return _this;\n }\n CameraRTPStreamManagement.UUID = \"00000110-0000-1000-8000-0026BB765291\";\n return CameraRTPStreamManagement;\n}(Service_1.Service));\nexports.CameraRTPStreamManagement = CameraRTPStreamManagement;\nService_1.Service.CameraRTPStreamManagement = CameraRTPStreamManagement;\n/**\n * Service \"Carbon Dioxide Sensor\"\n */\nvar CarbonDioxideSensor = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonDioxideSensor, _super);\n function CarbonDioxideSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, CarbonDioxideSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CarbonDioxideDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CarbonDioxideLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CarbonDioxidePeakLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n CarbonDioxideSensor.UUID = \"00000097-0000-1000-8000-0026BB765291\";\n return CarbonDioxideSensor;\n}(Service_1.Service));\nexports.CarbonDioxideSensor = CarbonDioxideSensor;\nService_1.Service.CarbonDioxideSensor = CarbonDioxideSensor;\n/**\n * Service \"Carbon Monoxide Sensor\"\n */\nvar CarbonMonoxideSensor = /** @class */ (function (_super) {\n tslib_1.__extends(CarbonMonoxideSensor, _super);\n function CarbonMonoxideSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, CarbonMonoxideSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CarbonMonoxideDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CarbonMonoxideLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CarbonMonoxidePeakLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n CarbonMonoxideSensor.UUID = \"0000007F-0000-1000-8000-0026BB765291\";\n return CarbonMonoxideSensor;\n}(Service_1.Service));\nexports.CarbonMonoxideSensor = CarbonMonoxideSensor;\nService_1.Service.CarbonMonoxideSensor = CarbonMonoxideSensor;\n/**\n * Service \"Cloud Relay\"\n */\nvar CloudRelay = /** @class */ (function (_super) {\n tslib_1.__extends(CloudRelay, _super);\n function CloudRelay(displayName, subtype) {\n var _this = _super.call(this, displayName, CloudRelay.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.RelayControlPoint);\n _this.addCharacteristic(Characteristic_1.Characteristic.RelayState);\n _this.addCharacteristic(Characteristic_1.Characteristic.RelayEnabled);\n return _this;\n }\n CloudRelay.UUID = \"0000005A-0000-1000-8000-0026BB765291\";\n return CloudRelay;\n}(Service_1.Service));\nexports.CloudRelay = CloudRelay;\n// noinspection JSDeprecatedSymbols\nService_1.Service.Relay = CloudRelay;\nService_1.Service.CloudRelay = CloudRelay;\n/**\n * Service \"Contact Sensor\"\n */\nvar ContactSensor = /** @class */ (function (_super) {\n tslib_1.__extends(ContactSensor, _super);\n function ContactSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, ContactSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ContactSensorState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n ContactSensor.UUID = \"00000080-0000-1000-8000-0026BB765291\";\n return ContactSensor;\n}(Service_1.Service));\nexports.ContactSensor = ContactSensor;\nService_1.Service.ContactSensor = ContactSensor;\n/**\n * Service \"Data Stream Transport Management\"\n */\nvar DataStreamTransportManagement = /** @class */ (function (_super) {\n tslib_1.__extends(DataStreamTransportManagement, _super);\n function DataStreamTransportManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, DataStreamTransportManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SetupDataStreamTransport);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedDataStreamTransportConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.Version);\n return _this;\n }\n DataStreamTransportManagement.UUID = \"00000129-0000-1000-8000-0026BB765291\";\n return DataStreamTransportManagement;\n}(Service_1.Service));\nexports.DataStreamTransportManagement = DataStreamTransportManagement;\nService_1.Service.DataStreamTransportManagement = DataStreamTransportManagement;\n/**\n * Service \"Diagnostics\"\n */\nvar Diagnostics = /** @class */ (function (_super) {\n tslib_1.__extends(Diagnostics, _super);\n function Diagnostics(displayName, subtype) {\n var _this = _super.call(this, displayName, Diagnostics.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedDiagnosticsSnapshot);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SelectedDiagnosticsModes);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SupportedDiagnosticsModes);\n return _this;\n }\n Diagnostics.UUID = \"00000237-0000-1000-8000-0026BB765291\";\n return Diagnostics;\n}(Service_1.Service));\nexports.Diagnostics = Diagnostics;\nService_1.Service.Diagnostics = Diagnostics;\n/**\n * Service \"Door\"\n */\nvar Door = /** @class */ (function (_super) {\n tslib_1.__extends(Door, _super);\n function Door(displayName, subtype) {\n var _this = _super.call(this, displayName, Door.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentPosition);\n _this.addCharacteristic(Characteristic_1.Characteristic.PositionState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetPosition);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ObstructionDetected);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HoldPosition);\n return _this;\n }\n Door.UUID = \"00000081-0000-1000-8000-0026BB765291\";\n return Door;\n}(Service_1.Service));\nexports.Door = Door;\nService_1.Service.Door = Door;\n/**\n * Service \"Doorbell\"\n */\nvar Doorbell = /** @class */ (function (_super) {\n tslib_1.__extends(Doorbell, _super);\n function Doorbell(displayName, subtype) {\n var _this = _super.call(this, displayName, Doorbell.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchEvent);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Brightness);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Mute);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.OperatingStateResponse);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Volume);\n return _this;\n }\n Doorbell.UUID = \"00000121-0000-1000-8000-0026BB765291\";\n return Doorbell;\n}(Service_1.Service));\nexports.Doorbell = Doorbell;\nService_1.Service.Doorbell = Doorbell;\n/**\n * Service \"Fan\"\n */\nvar Fan = /** @class */ (function (_super) {\n tslib_1.__extends(Fan, _super);\n function Fan(displayName, subtype) {\n var _this = _super.call(this, displayName, Fan.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.On);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationDirection);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationSpeed);\n return _this;\n }\n Fan.UUID = \"00000040-0000-1000-8000-0026BB765291\";\n return Fan;\n}(Service_1.Service));\nexports.Fan = Fan;\nService_1.Service.Fan = Fan;\n/**\n * Service \"Fanv2\"\n */\nvar Fanv2 = /** @class */ (function (_super) {\n tslib_1.__extends(Fanv2, _super);\n function Fanv2(displayName, subtype) {\n var _this = _super.call(this, displayName, Fanv2.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentFanState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetFanState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockPhysicalControls);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationDirection);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationSpeed);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SwingMode);\n return _this;\n }\n Fanv2.UUID = \"000000B7-0000-1000-8000-0026BB765291\";\n return Fanv2;\n}(Service_1.Service));\nexports.Fanv2 = Fanv2;\nService_1.Service.Fanv2 = Fanv2;\n/**\n * Service \"Faucet\"\n */\nvar Faucet = /** @class */ (function (_super) {\n tslib_1.__extends(Faucet, _super);\n function Faucet(displayName, subtype) {\n var _this = _super.call(this, displayName, Faucet.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n return _this;\n }\n Faucet.UUID = \"000000D7-0000-1000-8000-0026BB765291\";\n return Faucet;\n}(Service_1.Service));\nexports.Faucet = Faucet;\nService_1.Service.Faucet = Faucet;\n/**\n * Service \"Filter Maintenance\"\n */\nvar FilterMaintenance = /** @class */ (function (_super) {\n tslib_1.__extends(FilterMaintenance, _super);\n function FilterMaintenance(displayName, subtype) {\n var _this = _super.call(this, displayName, FilterMaintenance.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.FilterChangeIndication);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.FilterLifeLevel);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ResetFilterIndication);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n FilterMaintenance.UUID = \"000000BA-0000-1000-8000-0026BB765291\";\n return FilterMaintenance;\n}(Service_1.Service));\nexports.FilterMaintenance = FilterMaintenance;\nService_1.Service.FilterMaintenance = FilterMaintenance;\n/**\n * Service \"Firmware Update\"\n */\nvar FirmwareUpdate = /** @class */ (function (_super) {\n tslib_1.__extends(FirmwareUpdate, _super);\n function FirmwareUpdate(displayName, subtype) {\n var _this = _super.call(this, displayName, FirmwareUpdate.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.FirmwareUpdateReadiness);\n _this.addCharacteristic(Characteristic_1.Characteristic.FirmwareUpdateStatus);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StagedFirmwareVersion);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SupportedFirmwareUpdateConfiguration);\n return _this;\n }\n FirmwareUpdate.UUID = \"00000236-0000-1000-8000-0026BB765291\";\n return FirmwareUpdate;\n}(Service_1.Service));\nexports.FirmwareUpdate = FirmwareUpdate;\nService_1.Service.FirmwareUpdate = FirmwareUpdate;\n/**\n * Service \"Garage Door Opener\"\n */\nvar GarageDoorOpener = /** @class */ (function (_super) {\n tslib_1.__extends(GarageDoorOpener, _super);\n function GarageDoorOpener(displayName, subtype) {\n var _this = _super.call(this, displayName, GarageDoorOpener.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentDoorState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetDoorState);\n _this.addCharacteristic(Characteristic_1.Characteristic.ObstructionDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockCurrentState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockTargetState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n GarageDoorOpener.UUID = \"00000041-0000-1000-8000-0026BB765291\";\n return GarageDoorOpener;\n}(Service_1.Service));\nexports.GarageDoorOpener = GarageDoorOpener;\nService_1.Service.GarageDoorOpener = GarageDoorOpener;\n/**\n * Service \"Heater-Cooler\"\n */\nvar HeaterCooler = /** @class */ (function (_super) {\n tslib_1.__extends(HeaterCooler, _super);\n function HeaterCooler(displayName, subtype) {\n var _this = _super.call(this, displayName, HeaterCooler.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentHeaterCoolerState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetHeaterCoolerState);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTemperature);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockPhysicalControls);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationSpeed);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SwingMode);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CoolingThresholdTemperature);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HeatingThresholdTemperature);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TemperatureDisplayUnits);\n return _this;\n }\n HeaterCooler.UUID = \"000000BC-0000-1000-8000-0026BB765291\";\n return HeaterCooler;\n}(Service_1.Service));\nexports.HeaterCooler = HeaterCooler;\nService_1.Service.HeaterCooler = HeaterCooler;\n/**\n * Service \"Humidifier-Dehumidifier\"\n */\nvar HumidifierDehumidifier = /** @class */ (function (_super) {\n tslib_1.__extends(HumidifierDehumidifier, _super);\n function HumidifierDehumidifier(displayName, subtype) {\n var _this = _super.call(this, displayName, HumidifierDehumidifier.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentHumidifierDehumidifierState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetHumidifierDehumidifierState);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentRelativeHumidity);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockPhysicalControls);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RelativeHumidityDehumidifierThreshold);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RelativeHumidityHumidifierThreshold);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RotationSpeed);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SwingMode);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.WaterLevel);\n return _this;\n }\n HumidifierDehumidifier.UUID = \"000000BD-0000-1000-8000-0026BB765291\";\n return HumidifierDehumidifier;\n}(Service_1.Service));\nexports.HumidifierDehumidifier = HumidifierDehumidifier;\nService_1.Service.HumidifierDehumidifier = HumidifierDehumidifier;\n/**\n * Service \"Humidity Sensor\"\n */\nvar HumiditySensor = /** @class */ (function (_super) {\n tslib_1.__extends(HumiditySensor, _super);\n function HumiditySensor(displayName, subtype) {\n var _this = _super.call(this, displayName, HumiditySensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentRelativeHumidity);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n HumiditySensor.UUID = \"00000082-0000-1000-8000-0026BB765291\";\n return HumiditySensor;\n}(Service_1.Service));\nexports.HumiditySensor = HumiditySensor;\nService_1.Service.HumiditySensor = HumiditySensor;\n/**\n * Service \"Input Source\"\n */\nvar InputSource = /** @class */ (function (_super) {\n tslib_1.__extends(InputSource, _super);\n function InputSource(displayName, subtype) {\n var _this = _super.call(this, displayName, InputSource.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfiguredName);\n _this.addCharacteristic(Characteristic_1.Characteristic.InputSourceType);\n _this.addCharacteristic(Characteristic_1.Characteristic.IsConfigured);\n if (!_this.testCharacteristic(Characteristic_1.Characteristic.Name)) { // workaround for Name characteristic collision in constructor\n _this.addCharacteristic(Characteristic_1.Characteristic.Name).updateValue(\"Unnamed Service\");\n }\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentVisibilityState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Identifier);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.InputDeviceType);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetVisibilityState);\n return _this;\n }\n InputSource.UUID = \"000000D9-0000-1000-8000-0026BB765291\";\n return InputSource;\n}(Service_1.Service));\nexports.InputSource = InputSource;\nService_1.Service.InputSource = InputSource;\n/**\n * Service \"Irrigation-System\"\n */\nvar IrrigationSystem = /** @class */ (function (_super) {\n tslib_1.__extends(IrrigationSystem, _super);\n function IrrigationSystem(displayName, subtype) {\n var _this = _super.call(this, displayName, IrrigationSystem.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.ProgramMode);\n _this.addCharacteristic(Characteristic_1.Characteristic.InUse);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RemainingDuration);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n return _this;\n }\n IrrigationSystem.UUID = \"000000CF-0000-1000-8000-0026BB765291\";\n return IrrigationSystem;\n}(Service_1.Service));\nexports.IrrigationSystem = IrrigationSystem;\nService_1.Service.IrrigationSystem = IrrigationSystem;\n/**\n * Service \"Leak Sensor\"\n */\nvar LeakSensor = /** @class */ (function (_super) {\n tslib_1.__extends(LeakSensor, _super);\n function LeakSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, LeakSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.LeakDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n LeakSensor.UUID = \"00000083-0000-1000-8000-0026BB765291\";\n return LeakSensor;\n}(Service_1.Service));\nexports.LeakSensor = LeakSensor;\nService_1.Service.LeakSensor = LeakSensor;\n/**\n * Service \"Lightbulb\"\n */\nvar Lightbulb = /** @class */ (function (_super) {\n tslib_1.__extends(Lightbulb, _super);\n function Lightbulb(displayName, subtype) {\n var _this = _super.call(this, displayName, Lightbulb.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.On);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Brightness);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CharacteristicValueActiveTransitionCount);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CharacteristicValueTransitionControl);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ColorTemperature);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Hue);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Saturation);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SupportedCharacteristicValueTransitionConfiguration);\n return _this;\n }\n Lightbulb.UUID = \"00000043-0000-1000-8000-0026BB765291\";\n return Lightbulb;\n}(Service_1.Service));\nexports.Lightbulb = Lightbulb;\nService_1.Service.Lightbulb = Lightbulb;\n/**\n * Service \"Light Sensor\"\n */\nvar LightSensor = /** @class */ (function (_super) {\n tslib_1.__extends(LightSensor, _super);\n function LightSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, LightSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentAmbientLightLevel);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n LightSensor.UUID = \"00000084-0000-1000-8000-0026BB765291\";\n return LightSensor;\n}(Service_1.Service));\nexports.LightSensor = LightSensor;\nService_1.Service.LightSensor = LightSensor;\n/**\n * Service \"Lock Management\"\n */\nvar LockManagement = /** @class */ (function (_super) {\n tslib_1.__extends(LockManagement, _super);\n function LockManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, LockManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.LockControlPoint);\n _this.addCharacteristic(Characteristic_1.Characteristic.Version);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.AdministratorOnlyAccess);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.AudioFeedback);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentDoorState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockManagementAutoSecurityTimeout);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.LockLastKnownAction);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Logs);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.MotionDetected);\n return _this;\n }\n LockManagement.UUID = \"00000044-0000-1000-8000-0026BB765291\";\n return LockManagement;\n}(Service_1.Service));\nexports.LockManagement = LockManagement;\nService_1.Service.LockManagement = LockManagement;\n/**\n * Service \"Lock Mechanism\"\n */\nvar LockMechanism = /** @class */ (function (_super) {\n tslib_1.__extends(LockMechanism, _super);\n function LockMechanism(displayName, subtype) {\n var _this = _super.call(this, displayName, LockMechanism.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.LockCurrentState);\n _this.addCharacteristic(Characteristic_1.Characteristic.LockTargetState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n LockMechanism.UUID = \"00000045-0000-1000-8000-0026BB765291\";\n return LockMechanism;\n}(Service_1.Service));\nexports.LockMechanism = LockMechanism;\nService_1.Service.LockMechanism = LockMechanism;\n/**\n * Service \"Microphone\"\n */\nvar Microphone = /** @class */ (function (_super) {\n tslib_1.__extends(Microphone, _super);\n function Microphone(displayName, subtype) {\n var _this = _super.call(this, displayName, Microphone.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Mute);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Volume);\n return _this;\n }\n Microphone.UUID = \"00000112-0000-1000-8000-0026BB765291\";\n return Microphone;\n}(Service_1.Service));\nexports.Microphone = Microphone;\nService_1.Service.Microphone = Microphone;\n/**\n * Service \"Motion Sensor\"\n */\nvar MotionSensor = /** @class */ (function (_super) {\n tslib_1.__extends(MotionSensor, _super);\n function MotionSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, MotionSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.MotionDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n MotionSensor.UUID = \"00000085-0000-1000-8000-0026BB765291\";\n return MotionSensor;\n}(Service_1.Service));\nexports.MotionSensor = MotionSensor;\nService_1.Service.MotionSensor = MotionSensor;\n/**\n * Service \"NFC Access\"\n * @since iOS 15\n */\nvar NFCAccess = /** @class */ (function (_super) {\n tslib_1.__extends(NFCAccess, _super);\n function NFCAccess(displayName, subtype) {\n var _this = _super.call(this, displayName, NFCAccess.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfigurationState);\n _this.addCharacteristic(Characteristic_1.Characteristic.NFCAccessControlPoint);\n _this.addCharacteristic(Characteristic_1.Characteristic.NFCAccessSupportedConfiguration);\n return _this;\n }\n NFCAccess.UUID = \"00000266-0000-1000-8000-0026BB765291\";\n return NFCAccess;\n}(Service_1.Service));\nexports.NFCAccess = NFCAccess;\nService_1.Service.NFCAccess = NFCAccess;\n/**\n * Service \"Occupancy Sensor\"\n */\nvar OccupancySensor = /** @class */ (function (_super) {\n tslib_1.__extends(OccupancySensor, _super);\n function OccupancySensor(displayName, subtype) {\n var _this = _super.call(this, displayName, OccupancySensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.OccupancyDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n OccupancySensor.UUID = \"00000086-0000-1000-8000-0026BB765291\";\n return OccupancySensor;\n}(Service_1.Service));\nexports.OccupancySensor = OccupancySensor;\nService_1.Service.OccupancySensor = OccupancySensor;\n/**\n * Service \"Outlet\"\n * @since iOS 13\n */\nvar Outlet = /** @class */ (function (_super) {\n tslib_1.__extends(Outlet, _super);\n function Outlet(displayName, subtype) {\n var _this = _super.call(this, displayName, Outlet.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.On);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.OutletInUse);\n return _this;\n }\n Outlet.UUID = \"00000047-0000-1000-8000-0026BB765291\";\n return Outlet;\n}(Service_1.Service));\nexports.Outlet = Outlet;\nService_1.Service.Outlet = Outlet;\n/**\n * Service \"Pairing\"\n */\nvar Pairing = /** @class */ (function (_super) {\n tslib_1.__extends(Pairing, _super);\n function Pairing(displayName, subtype) {\n var _this = _super.call(this, displayName, Pairing.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ListPairings);\n _this.addCharacteristic(Characteristic_1.Characteristic.PairSetup);\n _this.addCharacteristic(Characteristic_1.Characteristic.PairVerify);\n _this.addCharacteristic(Characteristic_1.Characteristic.PairingFeatures);\n return _this;\n }\n Pairing.UUID = \"00000055-0000-1000-8000-0026BB765291\";\n return Pairing;\n}(Service_1.Service));\nexports.Pairing = Pairing;\nService_1.Service.Pairing = Pairing;\n/**\n * Service \"Power Management\"\n */\nvar PowerManagement = /** @class */ (function (_super) {\n tslib_1.__extends(PowerManagement, _super);\n function PowerManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, PowerManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.WakeConfiguration);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SelectedSleepConfiguration);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SupportedSleepConfiguration);\n return _this;\n }\n PowerManagement.UUID = \"00000221-0000-1000-8000-0026BB765291\";\n return PowerManagement;\n}(Service_1.Service));\nexports.PowerManagement = PowerManagement;\nService_1.Service.PowerManagement = PowerManagement;\n/**\n * Service \"Protocol Information\"\n */\nvar ProtocolInformation = /** @class */ (function (_super) {\n tslib_1.__extends(ProtocolInformation, _super);\n function ProtocolInformation(displayName, subtype) {\n var _this = _super.call(this, displayName, ProtocolInformation.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Version);\n return _this;\n }\n ProtocolInformation.UUID = \"000000A2-0000-1000-8000-0026BB765291\";\n return ProtocolInformation;\n}(Service_1.Service));\nexports.ProtocolInformation = ProtocolInformation;\nService_1.Service.ProtocolInformation = ProtocolInformation;\n/**\n * Service \"Security System\"\n */\nvar SecuritySystem = /** @class */ (function (_super) {\n tslib_1.__extends(SecuritySystem, _super);\n function SecuritySystem(displayName, subtype) {\n var _this = _super.call(this, displayName, SecuritySystem.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SecuritySystemCurrentState);\n _this.addCharacteristic(Characteristic_1.Characteristic.SecuritySystemTargetState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SecuritySystemAlarmType);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n SecuritySystem.UUID = \"0000007E-0000-1000-8000-0026BB765291\";\n return SecuritySystem;\n}(Service_1.Service));\nexports.SecuritySystem = SecuritySystem;\nService_1.Service.SecuritySystem = SecuritySystem;\n/**\n * Service \"Service Label\"\n */\nvar ServiceLabel = /** @class */ (function (_super) {\n tslib_1.__extends(ServiceLabel, _super);\n function ServiceLabel(displayName, subtype) {\n var _this = _super.call(this, displayName, ServiceLabel.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ServiceLabelNamespace);\n return _this;\n }\n ServiceLabel.UUID = \"000000CC-0000-1000-8000-0026BB765291\";\n return ServiceLabel;\n}(Service_1.Service));\nexports.ServiceLabel = ServiceLabel;\nService_1.Service.ServiceLabel = ServiceLabel;\n/**\n * Service \"Siri\"\n */\nvar Siri = /** @class */ (function (_super) {\n tslib_1.__extends(Siri, _super);\n function Siri(displayName, subtype) {\n var _this = _super.call(this, displayName, Siri.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SiriInputType);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.MultifunctionButton);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SiriEnable);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SiriEngineVersion);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SiriLightOnUse);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SiriListening);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SiriTouchToUse);\n return _this;\n }\n Siri.UUID = \"00000133-0000-1000-8000-0026BB765291\";\n return Siri;\n}(Service_1.Service));\nexports.Siri = Siri;\nService_1.Service.Siri = Siri;\n/**\n * Service \"Siri Endpoint\"\n */\nvar SiriEndpoint = /** @class */ (function (_super) {\n tslib_1.__extends(SiriEndpoint, _super);\n function SiriEndpoint(displayName, subtype) {\n var _this = _super.call(this, displayName, SiriEndpoint.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SiriEndpointSessionStatus);\n _this.addCharacteristic(Characteristic_1.Characteristic.Version);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ManuallyDisabled);\n return _this;\n }\n SiriEndpoint.UUID = \"00000253-0000-1000-8000-0026BB765291\";\n return SiriEndpoint;\n}(Service_1.Service));\nexports.SiriEndpoint = SiriEndpoint;\nService_1.Service.SiriEndpoint = SiriEndpoint;\n/**\n * Service \"Slats\"\n */\nvar Slats = /** @class */ (function (_super) {\n tslib_1.__extends(Slats, _super);\n function Slats(displayName, subtype) {\n var _this = _super.call(this, displayName, Slats.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentSlatState);\n _this.addCharacteristic(Characteristic_1.Characteristic.SlatType);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SwingMode);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetTiltAngle);\n return _this;\n }\n Slats.UUID = \"000000B9-0000-1000-8000-0026BB765291\";\n return Slats;\n}(Service_1.Service));\nexports.Slats = Slats;\n// noinspection JSDeprecatedSymbols\nService_1.Service.Slat = Slats;\nService_1.Service.Slats = Slats;\n/**\n * Service \"Smart Speaker\"\n */\nvar SmartSpeaker = /** @class */ (function (_super) {\n tslib_1.__extends(SmartSpeaker, _super);\n function SmartSpeaker(displayName, subtype) {\n var _this = _super.call(this, displayName, SmartSpeaker.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentMediaState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetMediaState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.AirPlayEnable);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ConfiguredName);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Mute);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Volume);\n return _this;\n }\n SmartSpeaker.UUID = \"00000228-0000-1000-8000-0026BB765291\";\n return SmartSpeaker;\n}(Service_1.Service));\nexports.SmartSpeaker = SmartSpeaker;\nService_1.Service.SmartSpeaker = SmartSpeaker;\n/**\n * Service \"Smoke Sensor\"\n */\nvar SmokeSensor = /** @class */ (function (_super) {\n tslib_1.__extends(SmokeSensor, _super);\n function SmokeSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, SmokeSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SmokeDetected);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n SmokeSensor.UUID = \"00000087-0000-1000-8000-0026BB765291\";\n return SmokeSensor;\n}(Service_1.Service));\nexports.SmokeSensor = SmokeSensor;\nService_1.Service.SmokeSensor = SmokeSensor;\n/**\n * Service \"Speaker\"\n * @since iOS 10\n */\nvar Speaker = /** @class */ (function (_super) {\n tslib_1.__extends(Speaker, _super);\n function Speaker(displayName, subtype) {\n var _this = _super.call(this, displayName, Speaker.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Mute);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Volume);\n return _this;\n }\n Speaker.UUID = \"00000113-0000-1000-8000-0026BB765291\";\n return Speaker;\n}(Service_1.Service));\nexports.Speaker = Speaker;\nService_1.Service.Speaker = Speaker;\n/**\n * Service \"Stateful Programmable Switch\"\n */\nvar StatefulProgrammableSwitch = /** @class */ (function (_super) {\n tslib_1.__extends(StatefulProgrammableSwitch, _super);\n function StatefulProgrammableSwitch(displayName, subtype) {\n var _this = _super.call(this, displayName, StatefulProgrammableSwitch.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchEvent);\n _this.addCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchOutputState);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n StatefulProgrammableSwitch.UUID = \"00000088-0000-1000-8000-0026BB765291\";\n return StatefulProgrammableSwitch;\n}(Service_1.Service));\nexports.StatefulProgrammableSwitch = StatefulProgrammableSwitch;\nService_1.Service.StatefulProgrammableSwitch = StatefulProgrammableSwitch;\n/**\n * Service \"Stateless Programmable Switch\"\n */\nvar StatelessProgrammableSwitch = /** @class */ (function (_super) {\n tslib_1.__extends(StatelessProgrammableSwitch, _super);\n function StatelessProgrammableSwitch(displayName, subtype) {\n var _this = _super.call(this, displayName, StatelessProgrammableSwitch.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ProgrammableSwitchEvent);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ServiceLabelIndex);\n return _this;\n }\n StatelessProgrammableSwitch.UUID = \"00000089-0000-1000-8000-0026BB765291\";\n return StatelessProgrammableSwitch;\n}(Service_1.Service));\nexports.StatelessProgrammableSwitch = StatelessProgrammableSwitch;\nService_1.Service.StatelessProgrammableSwitch = StatelessProgrammableSwitch;\n/**\n * Service \"Switch\"\n */\nvar Switch = /** @class */ (function (_super) {\n tslib_1.__extends(Switch, _super);\n function Switch(displayName, subtype) {\n var _this = _super.call(this, displayName, Switch.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.On);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n Switch.UUID = \"00000049-0000-1000-8000-0026BB765291\";\n return Switch;\n}(Service_1.Service));\nexports.Switch = Switch;\nService_1.Service.Switch = Switch;\n/**\n * Service \"Tap Management\"\n */\nvar TapManagement = /** @class */ (function (_super) {\n tslib_1.__extends(TapManagement, _super);\n function TapManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, TapManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.CryptoHash);\n _this.addCharacteristic(Characteristic_1.Characteristic.TapType);\n _this.addCharacteristic(Characteristic_1.Characteristic.Token);\n return _this;\n }\n TapManagement.UUID = \"0000022E-0000-1000-8000-0026BB765291\";\n return TapManagement;\n}(Service_1.Service));\nexports.TapManagement = TapManagement;\nService_1.Service.TapManagement = TapManagement;\n/**\n * Service \"Target Control\"\n */\nvar TargetControl = /** @class */ (function (_super) {\n tslib_1.__extends(TargetControl, _super);\n function TargetControl(displayName, subtype) {\n var _this = _super.call(this, displayName, TargetControl.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier);\n _this.addCharacteristic(Characteristic_1.Characteristic.ButtonEvent);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n TargetControl.UUID = \"00000125-0000-1000-8000-0026BB765291\";\n return TargetControl;\n}(Service_1.Service));\nexports.TargetControl = TargetControl;\nService_1.Service.TargetControl = TargetControl;\n/**\n * Service \"Target Control Management\"\n */\nvar TargetControlManagement = /** @class */ (function (_super) {\n tslib_1.__extends(TargetControlManagement, _super);\n function TargetControlManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, TargetControlManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetControlSupportedConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetControlList);\n return _this;\n }\n TargetControlManagement.UUID = \"00000122-0000-1000-8000-0026BB765291\";\n return TargetControlManagement;\n}(Service_1.Service));\nexports.TargetControlManagement = TargetControlManagement;\nService_1.Service.TargetControlManagement = TargetControlManagement;\n/**\n * Service \"Television\"\n */\nvar Television = /** @class */ (function (_super) {\n tslib_1.__extends(Television, _super);\n function Television(displayName, subtype) {\n var _this = _super.call(this, displayName, Television.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier);\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfiguredName);\n _this.addCharacteristic(Characteristic_1.Characteristic.RemoteKey);\n _this.addCharacteristic(Characteristic_1.Characteristic.SleepDiscoveryMode);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Brightness);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ClosedCaptions);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.DisplayOrder);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentMediaState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetMediaState);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PictureMode);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.PowerModeSelection);\n return _this;\n }\n Television.UUID = \"000000D8-0000-1000-8000-0026BB765291\";\n return Television;\n}(Service_1.Service));\nexports.Television = Television;\nService_1.Service.Television = Television;\n/**\n * Service \"Television Speaker\"\n */\nvar TelevisionSpeaker = /** @class */ (function (_super) {\n tslib_1.__extends(TelevisionSpeaker, _super);\n function TelevisionSpeaker(displayName, subtype) {\n var _this = _super.call(this, displayName, TelevisionSpeaker.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Mute);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Volume);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.VolumeControlType);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.VolumeSelector);\n return _this;\n }\n TelevisionSpeaker.UUID = \"00000113-0000-1000-8000-0026BB765291\";\n return TelevisionSpeaker;\n}(Service_1.Service));\nexports.TelevisionSpeaker = TelevisionSpeaker;\nService_1.Service.TelevisionSpeaker = TelevisionSpeaker;\n/**\n * Service \"Temperature Sensor\"\n */\nvar TemperatureSensor = /** @class */ (function (_super) {\n tslib_1.__extends(TemperatureSensor, _super);\n function TemperatureSensor(displayName, subtype) {\n var _this = _super.call(this, displayName, TemperatureSensor.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTemperature);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusActive);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusLowBattery);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusTampered);\n return _this;\n }\n TemperatureSensor.UUID = \"0000008A-0000-1000-8000-0026BB765291\";\n return TemperatureSensor;\n}(Service_1.Service));\nexports.TemperatureSensor = TemperatureSensor;\nService_1.Service.TemperatureSensor = TemperatureSensor;\n/**\n * Service \"Thermostat\"\n */\nvar Thermostat = /** @class */ (function (_super) {\n tslib_1.__extends(Thermostat, _super);\n function Thermostat(displayName, subtype) {\n var _this = _super.call(this, displayName, Thermostat.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentHeatingCoolingState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetHeatingCoolingState);\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTemperature);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetTemperature);\n _this.addCharacteristic(Characteristic_1.Characteristic.TemperatureDisplayUnits);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentRelativeHumidity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetRelativeHumidity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CoolingThresholdTemperature);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HeatingThresholdTemperature);\n return _this;\n }\n Thermostat.UUID = \"0000004A-0000-1000-8000-0026BB765291\";\n return Thermostat;\n}(Service_1.Service));\nexports.Thermostat = Thermostat;\nService_1.Service.Thermostat = Thermostat;\n/**\n * Service \"Thread Transport\"\n */\nvar ThreadTransport = /** @class */ (function (_super) {\n tslib_1.__extends(ThreadTransport, _super);\n function ThreadTransport(displayName, subtype) {\n var _this = _super.call(this, displayName, ThreadTransport.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTransport);\n _this.addCharacteristic(Characteristic_1.Characteristic.ThreadControlPoint);\n _this.addCharacteristic(Characteristic_1.Characteristic.ThreadNodeCapabilities);\n _this.addCharacteristic(Characteristic_1.Characteristic.ThreadStatus);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CCAEnergyDetectThreshold);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CCASignalDetectThreshold);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.EventRetransmissionMaximum);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.EventTransmissionCounters);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.MACRetransmissionMaximum);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.MACTransmissionCounters);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ReceiverSensitivity);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ReceivedSignalStrengthIndication);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SignalToNoiseRatio);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ThreadOpenThreadVersion);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TransmitPower);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.MaximumTransmitPower);\n return _this;\n }\n ThreadTransport.UUID = \"00000701-0000-1000-8000-0026BB765291\";\n return ThreadTransport;\n}(Service_1.Service));\nexports.ThreadTransport = ThreadTransport;\nService_1.Service.ThreadTransport = ThreadTransport;\n/**\n * Service \"Time Information\"\n * @deprecated Removed and not used anymore\n */\nvar TimeInformation = /** @class */ (function (_super) {\n tslib_1.__extends(TimeInformation, _super);\n function TimeInformation(displayName, subtype) {\n var _this = _super.call(this, displayName, TimeInformation.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTime);\n _this.addCharacteristic(Characteristic_1.Characteristic.DayoftheWeek);\n _this.addCharacteristic(Characteristic_1.Characteristic.TimeUpdate);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n return _this;\n }\n TimeInformation.UUID = \"00000099-0000-1000-8000-0026BB765291\";\n return TimeInformation;\n}(Service_1.Service));\nexports.TimeInformation = TimeInformation;\n// noinspection JSDeprecatedSymbols\nService_1.Service.TimeInformation = TimeInformation;\n/**\n * Service \"Transfer Transport Management\"\n */\nvar TransferTransportManagement = /** @class */ (function (_super) {\n tslib_1.__extends(TransferTransportManagement, _super);\n function TransferTransportManagement(displayName, subtype) {\n var _this = _super.call(this, displayName, TransferTransportManagement.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedTransferTransportConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.SetupTransferTransport);\n return _this;\n }\n TransferTransportManagement.UUID = \"00000203-0000-1000-8000-0026BB765291\";\n return TransferTransportManagement;\n}(Service_1.Service));\nexports.TransferTransportManagement = TransferTransportManagement;\nService_1.Service.TransferTransportManagement = TransferTransportManagement;\n/**\n * Service \"Tunnel\"\n */\nvar Tunnel = /** @class */ (function (_super) {\n tslib_1.__extends(Tunnel, _super);\n function Tunnel(displayName, subtype) {\n var _this = _super.call(this, displayName, Tunnel.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.AccessoryIdentifier);\n _this.addCharacteristic(Characteristic_1.Characteristic.TunnelConnectionTimeout);\n _this.addCharacteristic(Characteristic_1.Characteristic.TunneledAccessoryAdvertising);\n _this.addCharacteristic(Characteristic_1.Characteristic.TunneledAccessoryConnected);\n _this.addCharacteristic(Characteristic_1.Characteristic.TunneledAccessoryStateNumber);\n return _this;\n }\n Tunnel.UUID = \"00000056-0000-1000-8000-0026BB765291\";\n return Tunnel;\n}(Service_1.Service));\nexports.Tunnel = Tunnel;\n// noinspection JSDeprecatedSymbols\nService_1.Service.TunneledBTLEAccessoryService = Tunnel;\nService_1.Service.Tunnel = Tunnel;\n/**\n * Service \"Valve\"\n */\nvar Valve = /** @class */ (function (_super) {\n tslib_1.__extends(Valve, _super);\n function Valve(displayName, subtype) {\n var _this = _super.call(this, displayName, Valve.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.Active);\n _this.addCharacteristic(Characteristic_1.Characteristic.InUse);\n _this.addCharacteristic(Characteristic_1.Characteristic.ValveType);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.IsConfigured);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.RemainingDuration);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ServiceLabelIndex);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.SetDuration);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.StatusFault);\n return _this;\n }\n Valve.UUID = \"000000D0-0000-1000-8000-0026BB765291\";\n return Valve;\n}(Service_1.Service));\nexports.Valve = Valve;\nService_1.Service.Valve = Valve;\n/**\n * Service \"Wi-Fi Router\"\n */\nvar WiFiRouter = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiRouter, _super);\n function WiFiRouter(displayName, subtype) {\n var _this = _super.call(this, displayName, WiFiRouter.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.ConfiguredName);\n _this.addCharacteristic(Characteristic_1.Characteristic.ManagedNetworkEnable);\n _this.addCharacteristic(Characteristic_1.Characteristic.NetworkAccessViolationControl);\n _this.addCharacteristic(Characteristic_1.Characteristic.NetworkClientProfileControl);\n _this.addCharacteristic(Characteristic_1.Characteristic.NetworkClientStatusControl);\n _this.addCharacteristic(Characteristic_1.Characteristic.RouterStatus);\n _this.addCharacteristic(Characteristic_1.Characteristic.SupportedRouterConfiguration);\n _this.addCharacteristic(Characteristic_1.Characteristic.WANConfigurationList);\n _this.addCharacteristic(Characteristic_1.Characteristic.WANStatusList);\n return _this;\n }\n WiFiRouter.UUID = \"0000020A-0000-1000-8000-0026BB765291\";\n return WiFiRouter;\n}(Service_1.Service));\nexports.WiFiRouter = WiFiRouter;\nService_1.Service.WiFiRouter = WiFiRouter;\n/**\n * Service \"Wi-Fi Satellite\"\n */\nvar WiFiSatellite = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiSatellite, _super);\n function WiFiSatellite(displayName, subtype) {\n var _this = _super.call(this, displayName, WiFiSatellite.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.WiFiSatelliteStatus);\n return _this;\n }\n WiFiSatellite.UUID = \"0000020F-0000-1000-8000-0026BB765291\";\n return WiFiSatellite;\n}(Service_1.Service));\nexports.WiFiSatellite = WiFiSatellite;\nService_1.Service.WiFiSatellite = WiFiSatellite;\n/**\n * Service \"Wi-Fi Transport\"\n */\nvar WiFiTransport = /** @class */ (function (_super) {\n tslib_1.__extends(WiFiTransport, _super);\n function WiFiTransport(displayName, subtype) {\n var _this = _super.call(this, displayName, WiFiTransport.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentTransport);\n _this.addCharacteristic(Characteristic_1.Characteristic.WiFiCapabilities);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.WiFiConfigurationControl);\n return _this;\n }\n WiFiTransport.UUID = \"0000022A-0000-1000-8000-0026BB765291\";\n return WiFiTransport;\n}(Service_1.Service));\nexports.WiFiTransport = WiFiTransport;\nService_1.Service.WiFiTransport = WiFiTransport;\n/**\n * Service \"Window\"\n */\nvar Window = /** @class */ (function (_super) {\n tslib_1.__extends(Window, _super);\n function Window(displayName, subtype) {\n var _this = _super.call(this, displayName, Window.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentPosition);\n _this.addCharacteristic(Characteristic_1.Characteristic.PositionState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetPosition);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ObstructionDetected);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HoldPosition);\n return _this;\n }\n Window.UUID = \"0000008B-0000-1000-8000-0026BB765291\";\n return Window;\n}(Service_1.Service));\nexports.Window = Window;\nService_1.Service.Window = Window;\n/**\n * Service \"Window Covering\"\n */\nvar WindowCovering = /** @class */ (function (_super) {\n tslib_1.__extends(WindowCovering, _super);\n function WindowCovering(displayName, subtype) {\n var _this = _super.call(this, displayName, WindowCovering.UUID, subtype) || this;\n // Required Characteristics\n _this.addCharacteristic(Characteristic_1.Characteristic.CurrentPosition);\n _this.addCharacteristic(Characteristic_1.Characteristic.PositionState);\n _this.addCharacteristic(Characteristic_1.Characteristic.TargetPosition);\n // Optional Characteristics\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentHorizontalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetHorizontalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.Name);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.ObstructionDetected);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.HoldPosition);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.CurrentVerticalTiltAngle);\n _this.addOptionalCharacteristic(Characteristic_1.Characteristic.TargetVerticalTiltAngle);\n return _this;\n }\n WindowCovering.UUID = \"0000008C-0000-1000-8000-0026BB765291\";\n return WindowCovering;\n}(Service_1.Service));\nexports.WindowCovering = WindowCovering;\nService_1.Service.WindowCovering = WindowCovering;\n//# sourceMappingURL=ServiceDefinitions.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./CharacteristicDefinitions\"), exports);\ntslib_1.__exportStar(require(\"./ServiceDefinitions\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AccessoryInfo = exports.PermissionTypes = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar tweetnacl_1 = tslib_1.__importDefault(require(\"tweetnacl\"));\nvar util_1 = tslib_1.__importDefault(require(\"util\"));\nvar eventedhttp_1 = require(\"../util/eventedhttp\");\nvar HAPStorage_1 = require(\"./HAPStorage\");\nfunction getVersion() {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var packageJson = require(\"../../../package.json\");\n return packageJson.version;\n}\n/**\n * @group Model\n */\nvar PermissionTypes;\n(function (PermissionTypes) {\n // noinspection JSUnusedGlobalSymbols\n PermissionTypes[PermissionTypes[\"USER\"] = 0] = \"USER\";\n PermissionTypes[PermissionTypes[\"ADMIN\"] = 1] = \"ADMIN\";\n})(PermissionTypes = exports.PermissionTypes || (exports.PermissionTypes = {}));\n/**\n * AccessoryInfo is a model class containing a subset of Accessory data relevant to the internal HAP server,\n * such as encryption keys and username. It is persisted to disk.\n * @group Model\n */\nvar AccessoryInfo = /** @class */ (function () {\n function AccessoryInfo(username) {\n var _this = this;\n this.configVersion = 1;\n this.lastFirmwareVersion = \"\";\n // Returns a boolean indicating whether this accessory has been paired with a client.\n this.paired = function () {\n return Object.keys(_this.pairedClients).length > 0; // if we have any paired clients, we're paired.\n };\n this.username = username;\n this.displayName = \"\";\n this.model = \"\";\n this.category = 1 /* Categories.OTHER */;\n this.pincode = \"\";\n this.signSk = Buffer.alloc(0);\n this.signPk = Buffer.alloc(0);\n this.pairedClients = {};\n this.pairedAdminClients = 0;\n this.configHash = \"\";\n this.setupID = \"\";\n }\n /**\n * Add a paired client to memory.\n * @param {HAPUsername} username\n * @param {Buffer} publicKey\n * @param {PermissionTypes} permission\n */\n AccessoryInfo.prototype.addPairedClient = function (username, publicKey, permission) {\n this.pairedClients[username] = {\n username: username,\n publicKey: publicKey,\n permission: permission,\n };\n if (permission === 1 /* PermissionTypes.ADMIN */) {\n this.pairedAdminClients++;\n }\n };\n AccessoryInfo.prototype.updatePermission = function (username, permission) {\n var pairingInformation = this.pairedClients[username];\n if (pairingInformation) {\n var oldPermission = pairingInformation.permission;\n pairingInformation.permission = permission;\n if (oldPermission === 1 /* PermissionTypes.ADMIN */ && permission !== 1 /* PermissionTypes.ADMIN */) {\n this.pairedAdminClients--;\n }\n else if (oldPermission !== 1 /* PermissionTypes.ADMIN */ && permission === 1 /* PermissionTypes.ADMIN */) {\n this.pairedAdminClients++;\n }\n }\n };\n AccessoryInfo.prototype.listPairings = function () {\n var e_1, _a;\n var array = [];\n try {\n for (var _b = tslib_1.__values(Object.values(this.pairedClients)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var pairingInformation = _c.value;\n array.push(pairingInformation);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return array;\n };\n /**\n * Remove a paired client from memory.\n * @param connection - the session of the connection initiated the removal of the pairing\n * @param {string} username\n */\n AccessoryInfo.prototype.removePairedClient = function (connection, username) {\n var e_2, _a;\n this._removePairedClient0(connection, username);\n if (this.pairedAdminClients === 0) { // if we don't have any admin clients left paired it is required to kill all normal clients\n try {\n for (var _b = tslib_1.__values(Object.keys(this.pairedClients)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var username0 = _c.value;\n this._removePairedClient0(connection, username0);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n };\n AccessoryInfo.prototype._removePairedClient0 = function (connection, username) {\n if (this.pairedClients[username] && this.pairedClients[username].permission === 1 /* PermissionTypes.ADMIN */) {\n this.pairedAdminClients--;\n }\n delete this.pairedClients[username];\n eventedhttp_1.EventedHTTPServer.destroyExistingConnectionsAfterUnpair(connection, username);\n };\n /**\n * Check if username is paired\n * @param username\n */\n AccessoryInfo.prototype.isPaired = function (username) {\n return !!this.pairedClients[username];\n };\n AccessoryInfo.prototype.hasAdminPermissions = function (username) {\n if (!username) {\n return false;\n }\n var pairingInformation = this.pairedClients[username];\n return !!pairingInformation && pairingInformation.permission === 1 /* PermissionTypes.ADMIN */;\n };\n // Gets the public key for a paired client as a Buffer, or falsy value if not paired.\n AccessoryInfo.prototype.getClientPublicKey = function (username) {\n var pairingInformation = this.pairedClients[username];\n if (pairingInformation) {\n return pairingInformation.publicKey;\n }\n else {\n return undefined;\n }\n };\n /**\n * Checks based on the current accessory configuration if the current configuration number needs to be incremented.\n * Additionally, if desired, it checks if the firmware version was incremented (aka the HAP-NodeJS) version did grow.\n *\n * @param configuration - The current accessory configuration.\n * @param checkFirmwareIncrement\n * @returns True if the current configuration number was incremented and thus a new TXT must be advertised.\n */\n AccessoryInfo.prototype.checkForCurrentConfigurationNumberIncrement = function (configuration, checkFirmwareIncrement) {\n var shasum = crypto_1.default.createHash(\"sha1\");\n shasum.update(JSON.stringify(configuration));\n var configHash = shasum.digest(\"hex\");\n var changed = false;\n if (configHash !== this.configHash) {\n this.configVersion++;\n this.configHash = configHash;\n this.ensureConfigVersionBounds();\n changed = true;\n }\n if (checkFirmwareIncrement) {\n var version = getVersion();\n if (this.lastFirmwareVersion !== version) {\n // we only check if it is different and not only if it is incremented\n // HomeKit spec prohibits firmware downgrades, but with hap-nodejs it's possible lol\n this.lastFirmwareVersion = version;\n changed = true;\n }\n }\n if (changed) {\n this.save();\n }\n return changed;\n };\n AccessoryInfo.prototype.getConfigVersion = function () {\n return this.configVersion;\n };\n AccessoryInfo.prototype.ensureConfigVersionBounds = function () {\n // current configuration number must be in the range of 1-65535 and wrap to 1 when it overflows\n this.configVersion = this.configVersion % (0xFFFF + 1);\n if (this.configVersion === 0) {\n this.configVersion = 1;\n }\n };\n AccessoryInfo.prototype.save = function () {\n var e_3, _a;\n var saved = {\n displayName: this.displayName,\n category: this.category,\n pincode: this.pincode,\n signSk: this.signSk.toString(\"hex\"),\n signPk: this.signPk.toString(\"hex\"),\n pairedClients: {},\n // moving permissions into an extra object, so there is nothing to migrate from old files.\n // if the legacy node-persist storage should be upgraded some time, it would be reasonable to combine the storage\n // of public keys (pairedClients object) and permissions.\n pairedClientsPermission: {},\n configVersion: this.configVersion,\n configHash: this.configHash,\n setupID: this.setupID,\n lastFirmwareVersion: this.lastFirmwareVersion,\n };\n try {\n for (var _b = tslib_1.__values(Object.entries(this.pairedClients)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = tslib_1.__read(_c.value, 2), username = _d[0], pairingInformation = _d[1];\n // @ts-expect-error: missing typing, object instead of Record\n saved.pairedClients[username] = pairingInformation.publicKey.toString(\"hex\");\n // @ts-expect-error: missing typing, object instead of Record\n saved.pairedClientsPermission[username] = pairingInformation.permission;\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n var key = AccessoryInfo.persistKey(this.username);\n HAPStorage_1.HAPStorage.storage().setItemSync(key, saved);\n };\n // Gets a key for storing this AccessoryInfo in the filesystem, like \"AccessoryInfo.CC223DE3CEF3.json\"\n AccessoryInfo.persistKey = function (username) {\n return util_1.default.format(\"AccessoryInfo.%s.json\", username.replace(/:/g, \"\").toUpperCase());\n };\n AccessoryInfo.create = function (username) {\n AccessoryInfo.assertValidUsername(username);\n var accessoryInfo = new AccessoryInfo(username);\n accessoryInfo.lastFirmwareVersion = getVersion();\n // Create a new unique key pair for this accessory.\n var keyPair = tweetnacl_1.default.sign.keyPair();\n accessoryInfo.signSk = Buffer.from(keyPair.secretKey);\n accessoryInfo.signPk = Buffer.from(keyPair.publicKey);\n return accessoryInfo;\n };\n AccessoryInfo.load = function (username) {\n var e_4, _a;\n AccessoryInfo.assertValidUsername(username);\n var key = AccessoryInfo.persistKey(username);\n var saved = HAPStorage_1.HAPStorage.storage().getItem(key);\n if (saved) {\n var info = new AccessoryInfo(username);\n info.displayName = saved.displayName || \"\";\n info.category = saved.category || \"\";\n info.pincode = saved.pincode || \"\";\n info.signSk = Buffer.from(saved.signSk || \"\", \"hex\");\n info.signPk = Buffer.from(saved.signPk || \"\", \"hex\");\n info.pairedClients = {};\n try {\n for (var _b = tslib_1.__values(Object.keys(saved.pairedClients || {})), _c = _b.next(); !_c.done; _c = _b.next()) {\n var username_1 = _c.value;\n var publicKey = saved.pairedClients[username_1];\n var permission = saved.pairedClientsPermission ? saved.pairedClientsPermission[username_1] : undefined;\n if (permission === undefined) {\n permission = 1 /* PermissionTypes.ADMIN */;\n } // defaulting to admin permissions is the only suitable solution, there is no way to recover permissions\n info.pairedClients[username_1] = {\n username: username_1,\n publicKey: Buffer.from(publicKey, \"hex\"),\n permission: permission,\n };\n if (permission === 1 /* PermissionTypes.ADMIN */) {\n info.pairedAdminClients++;\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n info.configVersion = saved.configVersion || 1;\n info.configHash = saved.configHash || \"\";\n info.setupID = saved.setupID || \"\";\n info.lastFirmwareVersion = saved.lastFirmwareVersion || getVersion();\n info.ensureConfigVersionBounds();\n return info;\n }\n else {\n return null;\n }\n };\n AccessoryInfo.remove = function (username) {\n var key = AccessoryInfo.persistKey(username);\n HAPStorage_1.HAPStorage.storage().removeItemSync(key);\n };\n AccessoryInfo.assertValidUsername = function (username) {\n assert_1.default.ok(AccessoryInfo.deviceIdPattern.test(username), \"The supplied username (\" + username + \") is not valid \" +\n \"(expected a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string). \" +\n \"Note that, if you had this accessory already paired with the invalid username, you will need to repair \" +\n \"the accessory and reconfigure your services in the Home app. \" +\n \"Using an invalid username will lead to unexpected behaviour.\");\n };\n AccessoryInfo.deviceIdPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;\n return AccessoryInfo;\n}());\nexports.AccessoryInfo = AccessoryInfo;\n//# sourceMappingURL=AccessoryInfo.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ControllerStorage = void 0;\nvar tslib_1 = require(\"tslib\");\nvar util_1 = tslib_1.__importDefault(require(\"util\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar HAPStorage_1 = require(\"./HAPStorage\");\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:ControllerStorage\");\n/**\n * @group Model\n */\nvar ControllerStorage = /** @class */ (function () {\n function ControllerStorage(accessory) {\n this.initialized = false;\n this.fileCreated = false;\n this.purgeUnidentifiedAccessoryData = true;\n // ---------------------------------------------------------\n this.trackedControllers = []; // used to track controllers before data was loaded from disk\n this.controllerData = {};\n this.accessoryUUID = accessory.UUID;\n }\n ControllerStorage.prototype.enqueueSaveRequest = function (timeout) {\n var _this = this;\n var _a;\n if (timeout === void 0) { timeout = 0; }\n if (this.parent) {\n this.parent.enqueueSaveRequest(timeout);\n return;\n }\n var plannedTime = Date.now() + timeout;\n if (this.queuedSaveTimeout) {\n if (plannedTime <= ((_a = this.queuedSaveTime) !== null && _a !== void 0 ? _a : 0)) {\n return;\n }\n clearTimeout(this.queuedSaveTimeout);\n }\n this.queuedSaveTimeout = setTimeout(function () {\n _this.queuedSaveTimeout = _this.queuedSaveTime = undefined;\n _this.save();\n }, timeout).unref();\n this.queuedSaveTime = Date.now() + timeout;\n };\n /**\n * Links a bridged accessory to the ControllerStorage of the bridge accessory.\n *\n * @param accessory\n */\n ControllerStorage.prototype.linkAccessory = function (accessory) {\n if (!this.linkedAccessories) {\n this.linkedAccessories = [];\n }\n var storage = accessory.controllerStorage;\n this.linkedAccessories.push(storage);\n storage.parent = this;\n var saved = this.restoredAccessories && this.restoredAccessories[accessory.UUID];\n if (this.initialized) {\n storage.init(saved);\n }\n };\n ControllerStorage.prototype.trackController = function (controller) {\n controller.setupStateChangeDelegate(this.handleStateChange.bind(this, controller)); // setup delegate\n if (!this.initialized) { // track controller if data isn't loaded yet\n this.trackedControllers.push(controller);\n }\n else {\n this.restoreController(controller);\n }\n };\n ControllerStorage.prototype.untrackController = function (controller) {\n var index = this.trackedControllers.indexOf(controller);\n if (index !== -1) { // remove from trackedControllers if storage wasn't initialized yet\n this.trackedControllers.splice(index, 1);\n }\n controller.setupStateChangeDelegate(undefined); // remove association with this storage object\n this.purgeControllerData(controller);\n };\n ControllerStorage.prototype.purgeControllerData = function (controller) {\n delete this.controllerData[controller.controllerId()];\n if (this.initialized) {\n this.enqueueSaveRequest(100);\n }\n };\n ControllerStorage.prototype.handleStateChange = function (controller) {\n var id = controller.controllerId();\n var serialized = controller.serialize();\n if (!serialized) { // can be undefined when controller wishes to delete data\n delete this.controllerData[id];\n }\n else {\n var controllerData = this.controllerData[id];\n if (!controllerData) {\n this.controllerData[id] = {\n data: serialized,\n };\n }\n else {\n controllerData.data = serialized;\n }\n }\n if (this.initialized) { // only save if data was loaded\n // run save data \"async\", as handleStateChange call will probably always be caused by a http request\n // this should improve our response time\n this.enqueueSaveRequest(100);\n }\n };\n ControllerStorage.prototype.restoreController = function (controller) {\n if (!this.initialized) {\n throw new Error(\"Illegal state. Controller data wasn't loaded yet!\");\n }\n var controllerData = this.controllerData[controller.controllerId()];\n if (controllerData) {\n try {\n controller.deserialize(controllerData.data);\n }\n catch (error) {\n console.warn(\"Could not initialize controller of type '\".concat(controller.controllerId(), \"' from data stored on disk. Resetting to default: \").concat(error.stack));\n controller.handleFactoryReset();\n }\n controllerData.purgeOnNextLoad = undefined;\n }\n };\n /**\n * Called when this particular Storage object is feed with data loaded from disk.\n * This method is only called once.\n *\n * @param data - array of {@link StoredControllerData}. undefined if nothing was stored on disk for this particular storage object\n */\n ControllerStorage.prototype.init = function (data) {\n var _this = this;\n if (this.initialized) {\n throw new Error(\"ControllerStorage for accessory \".concat(this.accessoryUUID, \" was already initialized!\"));\n }\n this.initialized = true;\n // storing data into our local controllerData Record\n data && data.forEach(function (saved) { return _this.controllerData[saved.type] = saved.controllerData; });\n var restoredControllers = [];\n this.trackedControllers.forEach(function (controller) {\n _this.restoreController(controller);\n restoredControllers.push(controller.controllerId());\n });\n this.trackedControllers.splice(0, this.trackedControllers.length); // clear tracking list\n var purgedData = false;\n Object.entries(this.controllerData).forEach(function (_a) {\n var _b = tslib_1.__read(_a, 2), id = _b[0], data = _b[1];\n if (data.purgeOnNextLoad) {\n delete _this.controllerData[id];\n purgedData = true;\n return;\n }\n if (!restoredControllers.includes(id)) {\n data.purgeOnNextLoad = true;\n }\n });\n if (purgedData) {\n this.enqueueSaveRequest(500);\n }\n };\n ControllerStorage.prototype.load = function (username) {\n if (this.username) {\n throw new Error(\"ControllerStorage was already loaded!\");\n }\n this.username = username;\n var key = ControllerStorage.persistKey(username);\n var saved = HAPStorage_1.HAPStorage.storage().getItem(key);\n var ownData;\n if (saved) {\n this.fileCreated = true;\n ownData = saved.accessories[this.accessoryUUID];\n delete saved.accessories[this.accessoryUUID];\n }\n this.init(ownData);\n if (this.linkedAccessories) {\n this.linkedAccessories.forEach(function (linkedStorage) {\n var savedData = saved && saved.accessories[linkedStorage.accessoryUUID];\n linkedStorage.init(savedData);\n if (saved) {\n delete saved.accessories[linkedStorage.accessoryUUID];\n }\n });\n }\n if (saved && Object.keys(saved.accessories).length > 0) {\n if (!this.purgeUnidentifiedAccessoryData) {\n this.restoredAccessories = saved.accessories; // save data for controllers which aren't linked yet\n }\n else {\n debug(\"Purging unidentified controller data for bridge %s\", username);\n }\n }\n };\n ControllerStorage.prototype.save = function () {\n var _a;\n if (this.parent) {\n this.parent.save();\n return;\n }\n if (!this.initialized) {\n throw new Error(\"ControllerStorage has not yet been loaded!\");\n }\n if (!this.username) {\n throw new Error(\"Cannot save controllerData for a storage without a username!\");\n }\n var accessories = (_a = {},\n _a[this.accessoryUUID] = this.controllerData,\n _a);\n if (this.linkedAccessories) { // grab data from all linked storage objects\n this.linkedAccessories.forEach(function (accessory) { return accessories[accessory.accessoryUUID] = accessory.controllerData; });\n }\n // TODO removed accessories won't ever be deleted?\n var accessoryData = this.restoredAccessories || {};\n Object.entries(accessories).forEach(function (_a) {\n var _b = tslib_1.__read(_a, 2), uuid = _b[0], controllerData = _b[1];\n var entries = Object.entries(controllerData);\n if (entries.length > 0) {\n accessoryData[uuid] = entries.map(function (_a) {\n var _b = tslib_1.__read(_a, 2), id = _b[0], data = _b[1];\n return ({\n type: id,\n controllerData: data,\n });\n });\n }\n });\n var key = ControllerStorage.persistKey(this.username);\n if (Object.keys(accessoryData).length > 0) {\n var saved = {\n accessories: accessoryData,\n };\n this.fileCreated = true;\n HAPStorage_1.HAPStorage.storage().setItemSync(key, saved);\n }\n else if (this.fileCreated) {\n this.fileCreated = false;\n HAPStorage_1.HAPStorage.storage().removeItemSync(key);\n }\n };\n ControllerStorage.persistKey = function (username) {\n return util_1.default.format(\"ControllerStorage.%s.json\", username.replace(/:/g, \"\").toUpperCase());\n };\n ControllerStorage.remove = function (username) {\n var key = ControllerStorage.persistKey(username);\n HAPStorage_1.HAPStorage.storage().removeItemSync(key);\n };\n return ControllerStorage;\n}());\nexports.ControllerStorage = ControllerStorage;\n//# sourceMappingURL=ControllerStorage.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HAPStorage = void 0;\nvar tslib_1 = require(\"tslib\");\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nvar node_persist_1 = tslib_1.__importDefault(require(\"node-persist\"));\n/**\n * @group Model\n */\nvar HAPStorage = /** @class */ (function () {\n function HAPStorage() {\n }\n HAPStorage.storage = function () {\n return this.INSTANCE.storage();\n };\n HAPStorage.setCustomStoragePath = function (path) {\n this.INSTANCE.setCustomStoragePath(path);\n };\n HAPStorage.prototype.storage = function () {\n if (!this.localStore) {\n this.localStore = node_persist_1.default.create();\n if (this.customStoragePath) {\n this.localStore.initSync({\n dir: this.customStoragePath,\n });\n }\n else {\n this.localStore.initSync();\n }\n }\n return this.localStore;\n };\n HAPStorage.prototype.setCustomStoragePath = function (path) {\n if (this.localStore) {\n throw new Error(\"Cannot change storage path after it has already been initialized!\");\n }\n this.customStoragePath = path;\n };\n HAPStorage.INSTANCE = new HAPStorage();\n return HAPStorage;\n}());\nexports.HAPStorage = HAPStorage;\n//# sourceMappingURL=HAPStorage.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IdentifierCache = void 0;\nvar tslib_1 = require(\"tslib\");\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar util_1 = tslib_1.__importDefault(require(\"util\"));\nvar HAPStorage_1 = require(\"./HAPStorage\");\n/**\n * IdentifierCache is a model class that manages a system of associating HAP \"Accessory IDs\" and \"Instance IDs\"\n * with other values that don't usually change. HomeKit Clients use Accessory/Instance IDs as a primary key of\n * sorts, so the IDs need to remain \"stable\". For instance, if you create a HomeKit \"Scene\" called \"Leaving Home\"\n * that sets your Alarm System's \"Target Alarm State\" Characteristic to \"Arm Away\", that Scene will store whatever\n * \"Instance ID\" it was given for the \"Target Alarm State\" Characteristic. If the ID changes later on this server,\n * the scene will stop working.\n * @group Model\n */\nvar IdentifierCache = /** @class */ (function () {\n function IdentifierCache(username) {\n this.username = username;\n this._cache = {}; // cache[key:string] = id:number\n this._usedCache = null; // for usage tracking and expiring old keys\n this._savedCacheHash = \"\"; // for checking if new cache need to be saved\n }\n IdentifierCache.prototype.startTrackingUsage = function () {\n this._usedCache = {};\n };\n IdentifierCache.prototype.stopTrackingUsageAndExpireUnused = function () {\n // simply rotate in the new cache that was built during our normal getXYZ() calls.\n this._cache = this._usedCache || this._cache;\n this._usedCache = null;\n };\n IdentifierCache.prototype.getCache = function (key) {\n var value = this._cache[key];\n // track this cache item if needed\n if (this._usedCache && typeof value !== \"undefined\") {\n this._usedCache[key] = value;\n }\n return value;\n };\n IdentifierCache.prototype.setCache = function (key, value) {\n this._cache[key] = value;\n // track this cache item if needed\n if (this._usedCache) {\n this._usedCache[key] = value;\n }\n return value;\n };\n IdentifierCache.prototype.getAID = function (accessoryUUID) {\n var key = accessoryUUID;\n // ensure that our \"next AID\" field is not expired\n this.getCache(\"|nextAID\");\n return this.getCache(key) || this.setCache(key, this.getNextAID());\n };\n IdentifierCache.prototype.getIID = function (accessoryUUID, serviceUUID, serviceSubtype, characteristicUUID) {\n var key = accessoryUUID\n + \"|\" + serviceUUID\n + (serviceSubtype ? \"|\" + serviceSubtype : \"\")\n + (characteristicUUID ? \"|\" + characteristicUUID : \"\");\n // ensure that our \"next IID\" field for this accessory is not expired\n this.getCache(accessoryUUID + \"|nextIID\");\n return this.getCache(key) || this.setCache(key, this.getNextIID(accessoryUUID));\n };\n IdentifierCache.prototype.getNextAID = function () {\n var key = \"|nextAID\";\n var nextAID = this.getCache(key) || 2; // start at 2 because the root Accessory or Bridge must be 1\n this.setCache(key, nextAID + 1); // increment\n return nextAID;\n };\n IdentifierCache.prototype.getNextIID = function (accessoryUUID) {\n var key = accessoryUUID + \"|nextIID\";\n var nextIID = this.getCache(key) || 2; // iid 1 is reserved for the Accessory Information service\n this.setCache(key, nextIID + 1); // increment\n return nextIID;\n };\n IdentifierCache.prototype.save = function () {\n var newCacheHash = crypto_1.default.createHash(\"sha1\").update(JSON.stringify(this._cache)).digest(\"hex\"); //calculate hash of new cache\n if (newCacheHash !== this._savedCacheHash) { //check if cache need to be saved and proceed accordingly\n var saved = {\n cache: this._cache,\n };\n var key = IdentifierCache.persistKey(this.username);\n HAPStorage_1.HAPStorage.storage().setItemSync(key, saved);\n this._savedCacheHash = newCacheHash; //update hash of saved cache for future use\n }\n };\n /**\n * Persisting to File System\n */\n // Gets a key for storing this IdentifierCache in the filesystem, like \"IdentifierCache.CC223DE3CEF3.json\"\n IdentifierCache.persistKey = function (username) {\n return util_1.default.format(\"IdentifierCache.%s.json\", username.replace(/:/g, \"\").toUpperCase());\n };\n IdentifierCache.load = function (username) {\n var key = IdentifierCache.persistKey(username);\n var saved = HAPStorage_1.HAPStorage.storage().getItem(key);\n if (saved) {\n var info = new IdentifierCache(username);\n info._cache = saved.cache;\n // calculate hash of the saved hash to decide in future if saving of new cache is needed\n info._savedCacheHash = crypto_1.default.createHash(\"sha1\").update(JSON.stringify(info._cache)).digest(\"hex\");\n return info;\n }\n else {\n return null;\n }\n };\n IdentifierCache.remove = function (username) {\n var key = this.persistKey(username);\n HAPStorage_1.HAPStorage.storage().removeItemSync(key);\n };\n return IdentifierCache;\n}());\nexports.IdentifierCache = IdentifierCache;\n//# sourceMappingURL=IdentifierCache.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AccessControlManagement = exports.AccessControlEvent = exports.AccessLevel = void 0;\nvar tslib_1 = require(\"tslib\");\nvar events_1 = require(\"events\");\nvar Characteristic_1 = require(\"../Characteristic\");\nvar Service_1 = require(\"../Service\");\nvar tlv = tslib_1.__importStar(require(\"../util/tlv\"));\nvar AccessControlTypes;\n(function (AccessControlTypes) {\n AccessControlTypes[AccessControlTypes[\"PASSWORD\"] = 1] = \"PASSWORD\";\n AccessControlTypes[AccessControlTypes[\"PASSWORD_REQUIRED\"] = 2] = \"PASSWORD_REQUIRED\";\n})(AccessControlTypes || (AccessControlTypes = {}));\n/**\n * This defines the Access Level for TVs and Speakers. It is pretty much only used for the AirPlay 2 protocol\n * so this information is not really useful.\n *\n * @group Television\n */\nvar AccessLevel;\n(function (AccessLevel) {\n // noinspection JSUnusedGlobalSymbols\n /**\n * This access level is set when the users selects \"Anyone\" or \"Anyone On The Same Network\"\n * in the Access Control settings.\n */\n AccessLevel[AccessLevel[\"ANYONE\"] = 0] = \"ANYONE\";\n /**\n * This access level is set when the users selects \"Only People Sharing this Home\" in the\n * Access Control settings.\n * On this level password setting is ignored.\n * Requests to the HAPServer can only come from Home members anyways, so there is no real use to it.\n * This is pretty much only used for the AirPlay 2 protocol.\n */\n AccessLevel[AccessLevel[\"HOME_MEMBERS_ONLY\"] = 1] = \"HOME_MEMBERS_ONLY\";\n // 2 seems to be also a valid value in the range, but never encountered it.\n // so don't know what's the use of it.\n})(AccessLevel = exports.AccessLevel || (exports.AccessLevel = {}));\n/**\n * @group Television\n */\nvar AccessControlEvent;\n(function (AccessControlEvent) {\n AccessControlEvent[\"ACCESS_LEVEL_UPDATED\"] = \"update-control-level\";\n AccessControlEvent[\"PASSWORD_SETTING_UPDATED\"] = \"update-password\";\n})(AccessControlEvent = exports.AccessControlEvent || (exports.AccessControlEvent = {}));\n/**\n * @group Television\n */\nvar AccessControlManagement = /** @class */ (function (_super) {\n tslib_1.__extends(AccessControlManagement, _super);\n function AccessControlManagement(password, service) {\n var _this = _super.call(this) || this;\n /**\n * The current access level set for the Home\n */\n _this.accessLevel = 0;\n _this.passwordRequired = false;\n _this.accessControlService = service || new Service_1.Service.AccessControl();\n _this.setupServiceHandlers(password);\n return _this;\n }\n /**\n * @returns the AccessControl service\n */\n AccessControlManagement.prototype.getService = function () {\n return this.accessControlService;\n };\n /**\n * @returns the current {@link AccessLevel} configured for the Home\n */\n AccessControlManagement.prototype.getAccessLevel = function () {\n return this.accessLevel;\n };\n /**\n * @returns the current password configured for the Home or `undefined` if no password is required.\n */\n AccessControlManagement.prototype.getPassword = function () {\n return this.passwordRequired ? this.password : undefined;\n };\n /**\n * This destroys the AccessControlManagement.\n * It unregisters all GET or SET handler it has associated with the given AccessControl service.\n * It removes all event handlers which were registered to this object.\n */\n AccessControlManagement.prototype.destroy = function () {\n this.removeAllListeners();\n this.accessControlService.getCharacteristic(Characteristic_1.Characteristic.AccessControlLevel).removeOnSet();\n if (this.accessControlService.testCharacteristic(Characteristic_1.Characteristic.PasswordSetting)) {\n this.accessControlService.getCharacteristic(Characteristic_1.Characteristic.PasswordSetting).removeOnSet();\n }\n };\n AccessControlManagement.prototype.handleAccessLevelChange = function (value) {\n var _this = this;\n this.accessLevel = value;\n setTimeout(function () {\n _this.emit(\"update-control-level\" /* AccessControlEvent.ACCESS_LEVEL_UPDATED */, _this.accessLevel);\n }, 0).unref();\n };\n AccessControlManagement.prototype.handlePasswordChange = function (value) {\n var _this = this;\n var data = Buffer.from(value, \"base64\");\n var objects = tlv.decode(data);\n if (objects[1 /* AccessControlTypes.PASSWORD */]) {\n this.password = objects[1 /* AccessControlTypes.PASSWORD */].toString(\"utf8\");\n }\n else {\n this.password = undefined;\n }\n this.passwordRequired = !!objects[2 /* AccessControlTypes.PASSWORD_REQUIRED */][0];\n setTimeout(function () {\n _this.emit(\"update-password\" /* AccessControlEvent.PASSWORD_SETTING_UPDATED */, _this.password, _this.passwordRequired);\n }, 0).unref();\n };\n AccessControlManagement.prototype.setupServiceHandlers = function (enabledPasswordCharacteristics) {\n // perms: [Perms.NOTIFY, Perms.PAIRED_READ, Perms.PAIRED_WRITE],\n var _this = this;\n this.accessControlService.getCharacteristic(Characteristic_1.Characteristic.AccessControlLevel)\n .onSet(function (value) { return _this.handleAccessLevelChange(value); })\n .updateValue(0);\n if (enabledPasswordCharacteristics) {\n this.accessControlService.getCharacteristic(Characteristic_1.Characteristic.PasswordSetting)\n .onSet(function (value) { return _this.handlePasswordChange(value); })\n .updateValue(\"\");\n }\n };\n return AccessControlManagement;\n}(events_1.EventEmitter));\nexports.AccessControlManagement = AccessControlManagement;\n//# sourceMappingURL=AccessControlManagement.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clone = void 0;\nvar tslib_1 = require(\"tslib\");\n/**\n * A simple clone function that also allows you to pass an \"extend\" object whose properties will be\n * added to the cloned copy of the original object passed.\n * @group Utils\n */\nfunction clone(object, extend) {\n var e_1, _a, e_2, _b;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var cloned = {};\n try {\n for (var _c = tslib_1.__values(Object.entries(object)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var _e = tslib_1.__read(_d.value, 2), key = _e[0], value = _e[1];\n cloned[key] = value;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (extend) {\n try {\n for (var _f = tslib_1.__values(Object.entries(extend)), _g = _f.next(); !_g.done; _g = _f.next()) {\n var _h = tslib_1.__read(_g.value, 2), key = _h[0], value = _h[1];\n cloned[key] = value;\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_g && !_g.done && (_b = _f.return)) _b.call(_f);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n return cloned;\n}\nexports.clone = clone;\n//# sourceMappingURL=clone.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ColorUtils = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar lookupTable = new Map([\n [100, [19, 222.1]],\n [101, [18.7, 222.2]],\n [102, [18.4, 222.3]],\n [103, [18.2, 222.3]],\n [104, [17.9, 222.4]],\n [105, [17.6, 222.5]],\n [106, [17.3, 222.7]],\n [107, [17, 222.8]],\n [108, [16.7, 222.9]],\n [109, [16.4, 223]],\n [110, [16.1, 223.2]],\n [111, [15.8, 223.3]],\n [112, [15.4, 223.4]],\n [113, [15.2, 223.6]],\n [114, [14.9, 223.8]],\n [115, [14.7, 223.9]],\n [116, [14.3, 224.1]],\n [117, [14.1, 224.2]],\n [118, [13.8, 224.4]],\n [119, [13.5, 224.6]],\n [120, [13.2, 224.8]],\n [121, [12.9, 225]],\n [122, [12.5, 225.3]],\n [123, [12.2, 225.6]],\n [124, [11.8, 225.9]],\n [125, [11.4, 226.3]],\n [126, [11.1, 226.7]],\n [127, [10.7, 227.1]],\n [128, [10.3, 227.6]],\n [129, [9.9, 228]],\n [130, [9.6, 228.5]],\n [131, [9.3, 229.1]],\n [132, [8.9, 229.6]],\n [133, [8.5, 230.2]],\n [134, [8.2, 230.9]],\n [135, [7.8, 231.6]],\n [136, [7.5, 232.5]],\n [137, [7.1, 233.5]],\n [138, [6.7, 234.6]],\n [139, [6.3, 235.8]],\n [140, [6, 237.1]],\n [141, [5.6, 238.9]],\n [142, [5.2, 240.9]],\n [143, [5, 242.9]],\n [144, [4.8, 244.9]],\n [145, [4.6, 246.9]],\n [146, [4.4, 249.3]],\n [147, [4.3, 251.9]],\n [148, [4.1, 254.9]],\n [149, [3.9, 258]],\n [150, [3.7, 261.8]],\n [151, [3.4, 265.9]],\n [152, [3.2, 271]],\n [153, [3, 276.4]],\n [154, [2.8, 283.6]],\n [155, [2.6, 290.4]],\n [156, [2.3, 295.3]],\n [157, [2.1, 300]],\n [158, [1.9, 300]],\n [159, [1.6, 300]],\n [160, [1.4, 195.8]],\n [161, [1.2, 84.3]],\n [162, [1.3, 58.2]],\n [163, [1.5, 55.9]],\n [164, [1.7, 53.2]],\n [165, [1.9, 50.2]],\n [166, [2.1, 47.1]],\n [167, [2.4, 44.5]],\n [168, [2.6, 42.6]],\n [169, [2.9, 40.9]],\n [170, [3.1, 39.5]],\n [171, [3.4, 38.3]],\n [172, [3.7, 37.3]],\n [173, [3.9, 36.5]],\n [174, [4.2, 35.7]],\n [175, [4.4, 35.1]],\n [176, [4.6, 34.5]],\n [177, [4.9, 34]],\n [178, [5.1, 33.5]],\n [179, [5.3, 33]],\n [180, [5.6, 32.7]],\n [181, [5.8, 32.3]],\n [182, [6, 32]],\n [183, [6.3, 31.7]],\n [184, [6.5, 31.4]],\n [185, [6.7, 31.2]],\n [186, [7, 30.9]],\n [187, [7.2, 30.7]],\n [188, [7.4, 30.5]],\n [189, [7.6, 30.3]],\n [190, [7.9, 30.1]],\n [191, [8.1, 29.9]],\n [192, [8.4, 29.7]],\n [193, [8.6, 29.6]],\n [194, [8.9, 29.5]],\n [195, [9.1, 29.3]],\n [196, [9.4, 29.2]],\n [197, [9.6, 29.1]],\n [198, [9.8, 29]],\n [199, [10, 28.9]],\n [200, [10.2, 28.7]],\n [201, [10.5, 28.7]],\n [202, [10.7, 28.6]],\n [203, [11, 28.5]],\n [204, [11.2, 28.4]],\n [205, [11.4, 28.3]],\n [206, [11.6, 28.3]],\n [207, [11.8, 28.2]],\n [208, [12.1, 28.1]],\n [209, [12.3, 28.1]],\n [210, [12.5, 28]],\n [211, [12.7, 28]],\n [212, [12.9, 27.9]],\n [213, [13.2, 27.8]],\n [214, [13.4, 27.8]],\n [215, [13.6, 27.7]],\n [216, [13.8, 27.7]],\n [217, [14, 27.7]],\n [218, [14.3, 27.6]],\n [219, [14.5, 27.6]],\n [220, [14.7, 27.5]],\n [221, [14.9, 27.5]],\n [222, [15.1, 27.5]],\n [223, [15.3, 27.4]],\n [224, [15.5, 27.4]],\n [225, [15.8, 27.4]],\n [226, [16, 27.3]],\n [227, [16.2, 27.3]],\n [228, [16.4, 27.3]],\n [229, [16.6, 27.3]],\n [230, [16.8, 27.2]],\n [231, [17, 27.2]],\n [232, [17.2, 27.2]],\n [233, [17.4, 27.2]],\n [234, [17.6, 27.2]],\n [235, [17.8, 27.1]],\n [236, [18, 27.1]],\n [237, [18.2, 27.1]],\n [238, [18.4, 27.1]],\n [239, [18.7, 27.1]],\n [240, [18.8, 27]],\n [241, [19, 27]],\n [242, [19.2, 27]],\n [243, [19.4, 27]],\n [244, [19.6, 27]],\n [245, [19.8, 27]],\n [246, [20, 27]],\n [247, [20.3, 26.9]],\n [248, [20.5, 26.9]],\n [249, [20.6, 26.9]],\n [250, [20.8, 26.9]],\n [251, [21, 26.9]],\n [252, [21.3, 26.9]],\n [253, [21.5, 26.9]],\n [254, [21.6, 26.9]],\n [255, [21.8, 26.8]],\n [256, [22, 26.8]],\n [257, [22.2, 26.8]],\n [258, [22.4, 26.8]],\n [259, [22.6, 26.8]],\n [260, [22.8, 26.8]],\n [261, [23, 26.8]],\n [262, [23.2, 26.8]],\n [263, [23.4, 26.8]],\n [264, [23.6, 26.8]],\n [265, [23.8, 26.8]],\n [266, [24, 26.8]],\n [267, [24.1, 26.8]],\n [268, [24.3, 26.8]],\n [269, [24.5, 26.8]],\n [270, [24.7, 26.8]],\n [271, [24.8, 26.8]],\n [272, [25.1, 26.7]],\n [273, [25.3, 26.7]],\n [274, [25.4, 26.7]],\n [275, [25.6, 26.7]],\n [276, [25.8, 26.7]],\n [277, [26, 26.7]],\n [278, [26.1, 26.7]],\n [279, [26.3, 26.7]],\n [280, [26.5, 26.7]],\n [281, [26.7, 26.7]],\n [282, [26.9, 26.7]],\n [283, [27.1, 26.7]],\n [284, [27.3, 26.7]],\n [285, [27.5, 26.7]],\n [286, [27.7, 26.7]],\n [287, [27.8, 26.7]],\n [288, [28, 26.7]],\n [289, [28.2, 26.7]],\n [290, [28.4, 26.7]],\n [291, [28.6, 26.7]],\n [292, [28.8, 26.7]],\n [293, [28.9, 26.7]],\n [294, [29.1, 26.7]],\n [295, [29.3, 26.7]],\n [296, [29.5, 26.7]],\n [297, [29.6, 26.7]],\n [298, [29.8, 26.7]],\n [299, [30, 26.7]],\n [300, [30.2, 26.7]],\n [301, [30.4, 26.7]],\n [302, [30.5, 26.7]],\n [303, [30.7, 26.7]],\n [304, [30.9, 26.7]],\n [305, [31.1, 26.7]],\n [306, [31.2, 26.7]],\n [307, [31.4, 26.7]],\n [308, [31.6, 26.7]],\n [309, [31.8, 26.8]],\n [310, [31.9, 26.8]],\n [311, [32.1, 26.8]],\n [312, [32.3, 26.8]],\n [313, [32.5, 26.8]],\n [314, [32.6, 26.8]],\n [315, [32.8, 26.8]],\n [316, [33, 26.8]],\n [317, [33.2, 26.8]],\n [318, [33.3, 26.8]],\n [319, [33.5, 26.8]],\n [320, [33.7, 26.8]],\n [321, [33.8, 26.8]],\n [322, [34, 26.8]],\n [323, [34.2, 26.8]],\n [324, [34.4, 26.8]],\n [325, [34.5, 26.8]],\n [326, [34.7, 26.8]],\n [327, [34.9, 26.8]],\n [328, [35.1, 26.8]],\n [329, [35.2, 26.8]],\n [330, [35.4, 26.8]],\n [331, [35.5, 26.8]],\n [332, [35.7, 26.8]],\n [333, [35.9, 26.8]],\n [334, [36.1, 26.8]],\n [335, [36.3, 26.9]],\n [336, [36.5, 26.9]],\n [337, [36.7, 26.9]],\n [338, [36.9, 26.9]],\n [339, [37.1, 26.9]],\n [340, [37.2, 26.9]],\n [341, [37.4, 26.9]],\n [342, [37.5, 26.9]],\n [343, [37.7, 26.9]],\n [344, [37.9, 26.9]],\n [345, [38.1, 26.9]],\n [346, [38.3, 26.9]],\n [347, [38.5, 26.9]],\n [348, [38.7, 26.9]],\n [349, [38.9, 26.9]],\n [350, [39, 26.9]],\n [351, [39.2, 26.9]],\n [352, [39.3, 27]],\n [353, [39.5, 27]],\n [354, [39.7, 27]],\n [355, [39.9, 27]],\n [356, [40.1, 27]],\n [357, [40.2, 27]],\n [358, [40.4, 27]],\n [359, [40.6, 27]],\n [360, [40.8, 27]],\n [361, [40.9, 27]],\n [362, [41.1, 27]],\n [363, [41.2, 27]],\n [364, [41.4, 27]],\n [365, [41.6, 27]],\n [366, [41.8, 27]],\n [367, [42, 27]],\n [368, [42.1, 27.1]],\n [369, [42.3, 27.1]],\n [370, [42.4, 27.1]],\n [371, [42.6, 27.1]],\n [372, [42.8, 27.1]],\n [373, [43, 27.1]],\n [374, [43.1, 27.1]],\n [375, [43.2, 27.1]],\n [376, [43.4, 27.1]],\n [377, [43.6, 27.1]],\n [378, [43.8, 27.1]],\n [379, [43.9, 27.1]],\n [380, [44.1, 27.1]],\n [381, [44.3, 27.2]],\n [382, [44.4, 27.2]],\n [383, [44.6, 27.2]],\n [384, [44.7, 27.2]],\n [385, [44.9, 27.2]],\n [386, [45.1, 27.2]],\n [387, [45.3, 27.2]],\n [388, [45.5, 27.2]],\n [389, [45.6, 27.2]],\n [390, [45.8, 27.2]],\n [391, [46, 27.2]],\n [392, [46.2, 27.2]],\n [393, [46.4, 27.3]],\n [394, [46.5, 27.3]],\n [395, [46.7, 27.3]],\n [396, [46.9, 27.3]],\n [397, [47.1, 27.3]],\n [398, [47.2, 27.3]],\n [399, [47.4, 27.3]],\n [400, [47.6, 27.3]],\n [401, [47.7, 27.3]],\n [402, [47.9, 27.3]],\n [403, [48.1, 27.3]],\n [404, [48.3, 27.3]],\n [405, [48.5, 27.4]],\n [406, [48.7, 27.4]],\n [407, [48.8, 27.4]],\n [408, [49, 27.4]],\n [409, [49.2, 27.4]],\n [410, [49.4, 27.4]],\n [411, [49.6, 27.4]],\n [412, [49.7, 27.4]],\n [413, [49.9, 27.4]],\n [414, [50.1, 27.4]],\n [415, [50.2, 27.4]],\n [416, [50.4, 27.4]],\n [417, [50.6, 27.5]],\n [418, [50.7, 27.5]],\n [419, [50.9, 27.5]],\n [420, [51.1, 27.5]],\n [421, [51.2, 27.5]],\n [422, [51.4, 27.5]],\n [423, [51.6, 27.5]],\n [424, [51.7, 27.5]],\n [425, [51.9, 27.5]],\n [426, [52.1, 27.5]],\n [427, [51.2, 27.6]],\n [428, [52.4, 27.6]],\n [429, [52.5, 27.6]],\n [430, [52.7, 27.6]],\n [431, [52.9, 27.6]],\n [432, [53.1, 27.6]],\n [433, [53.2, 27.6]],\n [434, [53.4, 27.6]],\n [435, [53.6, 27.6]],\n [436, [53.7, 27.6]],\n [437, [53.9, 27.6]],\n [438, [54.1, 27.7]],\n [439, [54.2, 27.7]],\n [440, [54.3, 27.7]],\n [441, [54.5, 27.7]],\n [442, [54.7, 27.7]],\n [443, [54.8, 27.7]],\n [444, [55, 27.7]],\n [445, [55.2, 27.7]],\n [446, [55.3, 27.7]],\n [447, [55.5, 27.7]],\n [448, [55.7, 27.7]],\n [449, [55.8, 27.8]],\n [450, [56, 27.8]],\n [451, [56.2, 27.8]],\n [452, [56.3, 27.8]],\n [453, [56.5, 27.8]],\n [454, [56.7, 27.8]],\n [455, [56.8, 27.8]],\n [456, [57, 27.8]],\n [457, [57.2, 27.8]],\n [458, [57.3, 27.9]],\n [459, [57.4, 27.9]],\n [460, [57.6, 27.9]],\n [461, [57.8, 27.9]],\n [462, [57.9, 27.9]],\n [463, [58.1, 27.9]],\n [464, [58.3, 27.9]],\n [465, [58.4, 27.9]],\n [466, [58.6, 27.9]],\n [467, [58.8, 27.9]],\n [468, [59, 28]],\n [469, [59.1, 28]],\n [470, [59.2, 28]],\n [471, [59.4, 28]],\n [472, [59.6, 28]],\n [473, [59.7, 28]],\n [474, [60, 28]],\n [475, [60.1, 28]],\n [476, [60.2, 28]],\n [477, [60.4, 28]],\n [478, [60.6, 28.1]],\n [479, [60.7, 28.1]],\n [480, [60.9, 28.1]],\n [481, [60.1, 28.1]],\n [482, [60.3, 28.1]],\n [483, [61.4, 28.1]],\n [484, [61.5, 28.1]],\n [485, [61.7, 28.1]],\n [486, [61.9, 28.1]],\n [487, [62, 28.2]],\n [488, [62.2, 28.2]],\n [489, [62.3, 28.2]],\n [490, [62.5, 28.2]],\n [491, [62.7, 28.2]],\n [492, [62.8, 28.2]],\n [493, [63, 28.2]],\n [494, [63.2, 28.2]],\n [495, [63.3, 28.2]],\n [496, [63.4, 28.2]],\n [497, [63.6, 28.2]],\n [498, [63.8, 28.3]],\n [499, [63.9, 28.3]],\n [500, [64.1, 28.3]],\n]);\n/**\n * @group Utils\n */\nvar ColorUtils = /** @class */ (function () {\n function ColorUtils() {\n }\n /**\n * Returns the Hue and Saturation representation of the given color temperature in mired.\n *\n * @param colorTemperature - The color temperature in mired.\n * @param roundResults - The lookup table has a precision of .1 decimal places. The given characteristics only have a step value of 1.\n * Thus, the method will round the results by default to an integer value. This can be turned off using this option.\n * @returns An number array of length 2 with the first element being the saturation and the second argument being the hue.\n */\n ColorUtils.colorTemperatureToHueAndSaturation = function (colorTemperature, roundResults) {\n if (roundResults === void 0) { roundResults = true; }\n if (colorTemperature > 500) {\n colorTemperature = 500;\n }\n else if (colorTemperature < 100) {\n colorTemperature = 100;\n }\n colorTemperature = Math.round(colorTemperature); // ensure integer\n var hueAndTemperature = lookupTable.get(colorTemperature);\n (0, assert_1.default)(colorTemperature != null, \"lookup for temperature \" + colorTemperature + \" did not yield any results\");\n if (roundResults) {\n hueAndTemperature[0] = Math.round(hueAndTemperature[0]);\n hueAndTemperature[1] = Math.round(hueAndTemperature[1]);\n }\n return {\n saturation: hueAndTemperature[0],\n hue: hueAndTemperature[1],\n };\n };\n return ColorUtils;\n}());\nexports.ColorUtils = ColorUtils;\n//# sourceMappingURL=color-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HAPConnection = exports.HAPConnectionEvent = exports.HAPConnectionState = exports.EventedHTTPServer = exports.EventedHTTPServerEvent = exports.HAPEncryption = void 0;\nvar tslib_1 = require(\"tslib\");\nvar domain_formatter_1 = require(\"@homebridge/ciao/lib/util/domain-formatter\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar debug_1 = tslib_1.__importDefault(require(\"debug\"));\nvar events_1 = require(\"events\");\nvar http_1 = tslib_1.__importDefault(require(\"http\"));\nvar net_1 = tslib_1.__importDefault(require(\"net\"));\nvar os_1 = tslib_1.__importDefault(require(\"os\"));\nvar hapCrypto = tslib_1.__importStar(require(\"./hapCrypto\"));\nvar net_utils_1 = require(\"./net-utils\");\nvar uuid = tslib_1.__importStar(require(\"./uuid\"));\nvar debug = (0, debug_1.default)(\"HAP-NodeJS:EventedHTTPServer\");\nvar debugCon = (0, debug_1.default)(\"HAP-NodeJS:EventedHTTPServer:Connection\");\nvar debugEvents = (0, debug_1.default)(\"HAP-NodeJS:EventEmitter\");\n/**\n * Simple struct to hold vars needed to support HAP encryption.\n *\n * @group Cryptography\n */\nvar HAPEncryption = /** @class */ (function () {\n function HAPEncryption(clientPublicKey, secretKey, publicKey, sharedSecret, hkdfPairEncryptionKey) {\n this.accessoryToControllerCount = 0;\n this.controllerToAccessoryCount = 0;\n this.clientPublicKey = clientPublicKey;\n this.secretKey = secretKey;\n this.publicKey = publicKey;\n this.sharedSecret = sharedSecret;\n this.hkdfPairEncryptionKey = hkdfPairEncryptionKey;\n this.accessoryToControllerKey = Buffer.alloc(0);\n this.controllerToAccessoryKey = Buffer.alloc(0);\n }\n return HAPEncryption;\n}());\nexports.HAPEncryption = HAPEncryption;\n/**\n * @group HAP Accessory Server\n */\nvar EventedHTTPServerEvent;\n(function (EventedHTTPServerEvent) {\n EventedHTTPServerEvent[\"LISTENING\"] = \"listening\";\n EventedHTTPServerEvent[\"CONNECTION_OPENED\"] = \"connection-opened\";\n EventedHTTPServerEvent[\"REQUEST\"] = \"request\";\n EventedHTTPServerEvent[\"CONNECTION_CLOSED\"] = \"connection-closed\";\n})(EventedHTTPServerEvent = exports.EventedHTTPServerEvent || (exports.EventedHTTPServerEvent = {}));\n/**\n * EventedHTTPServer provides an HTTP-like server that supports HAP \"extensions\" for security and events.\n *\n * Implementation\n * --------------\n * In order to implement the \"custom HTTP\" server required by the HAP protocol (see HAPServer.js) without completely\n * reinventing the wheel, we create both a generic TCP socket server and a standard Node HTTP server.\n * The TCP socket server acts as a proxy, allowing users of this class to transform data (for encryption) as necessary\n * and passing through bytes directly to the HTTP server for processing. This way we get Node to do all\n * the \"heavy lifting\" of HTTP like parsing headers and formatting responses.\n *\n * Events are sent by simply waiting for current HTTP traffic to subside and then sending a custom response packet\n * directly down the wire via the socket.\n *\n * Each connection to the main TCP server gets its own internal HTTP server, so we can track ongoing requests/responses\n * for safe event insertion.\n *\n * @group HAP Accessory Server\n */\nvar EventedHTTPServer = /** @class */ (function (_super) {\n tslib_1.__extends(EventedHTTPServer, _super);\n function EventedHTTPServer() {\n var _this = _super.call(this) || this;\n /**\n * Set of all currently connected HAP connections.\n */\n _this.connections = new Set();\n /**\n * Session dictionary indexed by username/identifier. The username uniquely identifies every person added to the home.\n * So there can be multiple sessions open for a single username (multiple devices connected to the same Apple ID).\n */\n _this.connectionsByUsername = new Map();\n _this.tcpServer = net_1.default.createServer();\n return _this;\n }\n EventedHTTPServer.prototype.scheduleNextConnectionIdleTimeout = function () {\n var e_1, _a;\n this.connectionIdleTimeout = undefined;\n if (!this.tcpServer.listening) {\n return;\n }\n debug(\"Running idle timeout timer...\");\n var currentTime = new Date().getTime();\n var nextTimeout = -1;\n try {\n for (var _b = tslib_1.__values(this.connections), _c = _b.next(); !_c.done; _c = _b.next()) {\n var connection = _c.value;\n var timeDelta = currentTime - connection.lastSocketOperation;\n if (timeDelta >= EventedHTTPServer.MAX_CONNECTION_IDLE_TIME) {\n debug(\"[%s] Closing connection as it was inactive for \" + timeDelta + \"ms\");\n connection.close();\n }\n else {\n nextTimeout = Math.max(nextTimeout, EventedHTTPServer.MAX_CONNECTION_IDLE_TIME - timeDelta);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (this.connections.size >= EventedHTTPServer.CONNECTION_TIMEOUT_LIMIT) {\n this.connectionIdleTimeout = setTimeout(this.scheduleNextConnectionIdleTimeout.bind(this), nextTimeout);\n }\n };\n EventedHTTPServer.prototype.address = function () {\n return this.tcpServer.address();\n };\n EventedHTTPServer.prototype.listen = function (targetPort, hostname) {\n var _this = this;\n this.tcpServer.listen(targetPort, hostname, function () {\n var address = _this.tcpServer.address(); // address() is only a string when listening to unix domain sockets\n debug(\"Server listening on %s:%s\", address.family === \"IPv6\" ? \"[\".concat(address.address, \"]\") : address.address, address.port);\n _this.connectionLoggingInterval = setInterval(function () {\n var connectionInformation = tslib_1.__spreadArray([], tslib_1.__read(_this.connections), false).map(function (connection) { return \"\".concat(connection.remoteAddress, \":\").concat(connection.remotePort); })\n .join(\", \");\n debug(\"Currently %d hap connections open: %s\", _this.connections.size, connectionInformation);\n }, 60000);\n _this.connectionLoggingInterval.unref();\n _this.emit(\"listening\" /* EventedHTTPServerEvent.LISTENING */, address.port, address.address);\n });\n this.tcpServer.on(\"connection\", this.onConnection.bind(this));\n };\n EventedHTTPServer.prototype.stop = function () {\n var e_2, _a;\n if (this.connectionLoggingInterval != null) {\n clearInterval(this.connectionLoggingInterval);\n this.connectionLoggingInterval = undefined;\n }\n if (this.connectionIdleTimeout != null) {\n clearTimeout(this.connectionIdleTimeout);\n this.connectionIdleTimeout = undefined;\n }\n this.tcpServer.close();\n try {\n for (var _b = tslib_1.__values(this.connections), _c = _b.next(); !_c.done; _c = _b.next()) {\n var connection = _c.value;\n connection.close();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n EventedHTTPServer.prototype.destroy = function () {\n this.stop();\n this.removeAllListeners();\n };\n /**\n * Send an event notification for given characteristic and changed value to all connected clients.\n * If `originator` is specified, the given {@link HAPConnection} will be excluded from the broadcast.\n *\n * @param aid - The accessory id of the updated characteristic.\n * @param iid - The instance id of the updated characteristic.\n * @param value - The newly set value of the characteristic.\n * @param originator - If specified, the connection will not get an event message.\n * @param immediateDelivery - The HAP spec requires some characteristics to be delivery immediately.\n * Namely, for the {@link Characteristic.ButtonEvent} and the {@link Characteristic.ProgrammableSwitchEvent} characteristics.\n */\n EventedHTTPServer.prototype.broadcastEvent = function (aid, iid, value, originator, immediateDelivery) {\n var e_3, _a;\n try {\n for (var _b = tslib_1.__values(this.connections), _c = _b.next(); !_c.done; _c = _b.next()) {\n var connection = _c.value;\n if (connection === originator) {\n debug(\"[%s] Muting event '%s' notification for this connection since it originated here.\", connection.remoteAddress, aid + \".\" + iid);\n continue;\n }\n connection.sendEvent(aid, iid, value, immediateDelivery);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n EventedHTTPServer.prototype.onConnection = function (socket) {\n var _this = this;\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n var connection = new HAPConnection(this, socket);\n connection.on(\"request\" /* HAPConnectionEvent.REQUEST */, function (request, response) {\n _this.emit(\"request\" /* EventedHTTPServerEvent.REQUEST */, connection, request, response);\n });\n connection.on(\"authenticated\" /* HAPConnectionEvent.AUTHENTICATED */, this.handleConnectionAuthenticated.bind(this, connection));\n connection.on(\"closed\" /* HAPConnectionEvent.CLOSED */, this.handleConnectionClose.bind(this, connection));\n this.connections.add(connection);\n debug(\"[%s] New connection from client on interface %s (%s)\", connection.remoteAddress, connection.networkInterface, connection.localAddress);\n this.emit(\"connection-opened\" /* EventedHTTPServerEvent.CONNECTION_OPENED */, connection);\n if (this.connections.size >= EventedHTTPServer.CONNECTION_TIMEOUT_LIMIT && !this.connectionIdleTimeout) {\n this.scheduleNextConnectionIdleTimeout();\n }\n };\n EventedHTTPServer.prototype.handleConnectionAuthenticated = function (connection, username) {\n var connections = this.connectionsByUsername.get(username);\n if (!connections) {\n this.connectionsByUsername.set(username, [connection]);\n }\n else if (!connections.includes(connection)) { // ensure this doesn't get added more than one time\n connections.push(connection);\n }\n };\n EventedHTTPServer.prototype.handleConnectionClose = function (connection) {\n this.emit(\"connection-closed\" /* EventedHTTPServerEvent.CONNECTION_CLOSED */, connection);\n this.connections.delete(connection);\n if (connection.username) { // aka connection was authenticated\n var connections = this.connectionsByUsername.get(connection.username);\n if (connections) {\n var index = connections.indexOf(connection);\n if (index !== -1) {\n connections.splice(index, 1);\n }\n if (connections.length === 0) {\n this.connectionsByUsername.delete(connection.username);\n }\n }\n }\n };\n /**\n * This method is to be called when a given {@link HAPConnection} performs a request that should result in the disconnection\n * of all other {@link HAPConnection} with the same {@link HAPUsername}.\n *\n * The initiator MUST be in the middle of a http request were the response was not served yet.\n * Otherwise, the initiator connection might reside in a state where it isn't disconnected and can't make any further requests.\n *\n * @param initiator - The connection that requested to disconnect all connections of the same username.\n * @param username - The username for which all connections shall be closed.\n */\n EventedHTTPServer.destroyExistingConnectionsAfterUnpair = function (initiator, username) {\n var e_4, _a;\n var connections = initiator.server.connectionsByUsername.get(username);\n if (connections) {\n try {\n for (var connections_1 = tslib_1.__values(connections), connections_1_1 = connections_1.next(); !connections_1_1.done; connections_1_1 = connections_1.next()) {\n var connection = connections_1_1.value;\n connection.closeConnectionAsOfUnpair(initiator);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (connections_1_1 && !connections_1_1.done && (_a = connections_1.return)) _a.call(connections_1);\n }\n finally { if (e_4) throw e_4.error; }\n }\n }\n };\n EventedHTTPServer.CONNECTION_TIMEOUT_LIMIT = 16; // if we have more (or equal) # connections we start the timeout\n EventedHTTPServer.MAX_CONNECTION_IDLE_TIME = 60 * 60 * 1000; // 1h\n return EventedHTTPServer;\n}(events_1.EventEmitter));\nexports.EventedHTTPServer = EventedHTTPServer;\n/**\n * @private\n * @group HAP Accessory Server\n */\nvar HAPConnectionState;\n(function (HAPConnectionState) {\n HAPConnectionState[HAPConnectionState[\"CONNECTING\"] = 0] = \"CONNECTING\";\n HAPConnectionState[HAPConnectionState[\"FULLY_SET_UP\"] = 1] = \"FULLY_SET_UP\";\n HAPConnectionState[HAPConnectionState[\"AUTHENTICATED\"] = 2] = \"AUTHENTICATED\";\n // above signals represent an alive connection\n // below states are considered \"closed or soon closed\"\n HAPConnectionState[HAPConnectionState[\"TO_BE_TEARED_DOWN\"] = 3] = \"TO_BE_TEARED_DOWN\";\n HAPConnectionState[HAPConnectionState[\"CLOSING\"] = 4] = \"CLOSING\";\n HAPConnectionState[HAPConnectionState[\"CLOSED\"] = 5] = \"CLOSED\";\n})(HAPConnectionState = exports.HAPConnectionState || (exports.HAPConnectionState = {}));\n/**\n * @group HAP Accessory Server\n */\nvar HAPConnectionEvent;\n(function (HAPConnectionEvent) {\n HAPConnectionEvent[\"REQUEST\"] = \"request\";\n HAPConnectionEvent[\"AUTHENTICATED\"] = \"authenticated\";\n HAPConnectionEvent[\"CLOSED\"] = \"closed\";\n})(HAPConnectionEvent = exports.HAPConnectionEvent || (exports.HAPConnectionEvent = {}));\n/**\n * Manages a single iOS-initiated HTTP connection during its lifetime.\n * @group HAP Accessory Server\n */\nvar HAPConnection = /** @class */ (function (_super) {\n tslib_1.__extends(HAPConnection, _super);\n function HAPConnection(server, clientSocket) {\n var _this = _super.call(this) || this;\n _this.state = 0 /* HAPConnectionState.CONNECTING */;\n _this.lastSocketOperation = new Date().getTime();\n _this.pendingClientSocketData = Buffer.alloc(0); // data received from client before HTTP proxy is fully setup\n _this.handlingRequest = false; // true while we are composing an HTTP response (so events can wait)\n _this.registeredEvents = new Set();\n _this.queuedEvents = [];\n /**\n * If true, the above {@link queuedEvents} contains events which are set to be delivered immediately!\n */\n _this.eventsQueuedForImmediateDelivery = false;\n _this.server = server;\n _this.sessionID = uuid.generate(clientSocket.remoteAddress + \":\" + clientSocket.remotePort);\n _this.localAddress = clientSocket.localAddress;\n _this.remoteAddress = clientSocket.remoteAddress; // cache because it becomes undefined in 'onClientSocketClose'\n _this.remotePort = clientSocket.remotePort;\n _this.networkInterface = HAPConnection.getLocalNetworkInterface(clientSocket);\n // clientSocket is the socket connected to the actual iOS device\n _this.tcpSocket = clientSocket;\n _this.tcpSocket.on(\"data\", _this.onTCPSocketData.bind(_this));\n _this.tcpSocket.on(\"close\", _this.onTCPSocketClose.bind(_this));\n // we MUST register for this event, otherwise the error will bubble up to the top and crash the node process entirely.\n _this.tcpSocket.on(\"error\", _this.onTCPSocketError.bind(_this));\n _this.tcpSocket.setNoDelay(true); // disable Nagle algorithm\n // \"HAP accessory servers must not use keepalive messages, which periodically wake up iOS devices\".\n // Thus, we don't configure any tcp keepalive\n // create our internal HTTP server for this connection that we will proxy data to and from\n _this.internalHttpServer = http_1.default.createServer();\n _this.internalHttpServer.timeout = 0; // clients expect to hold connections open as long as they want\n _this.internalHttpServer.keepAliveTimeout = 0; // workaround for https://github.com/nodejs/node/issues/13391\n _this.internalHttpServer.on(\"listening\", _this.onHttpServerListening.bind(_this));\n _this.internalHttpServer.on(\"request\", _this.handleHttpServerRequest.bind(_this));\n _this.internalHttpServer.on(\"error\", _this.onHttpServerError.bind(_this));\n // close event is added later on the \"connect\" event as possible listen retries would throw unnecessary close events\n _this.internalHttpServer.listen(0, _this.internalHttpServerAddress = (0, net_utils_1.getOSLoopbackAddressIfAvailable)());\n return _this;\n }\n HAPConnection.prototype.debugListenerRegistration = function (event, registration, beforeCount) {\n if (registration === void 0) { registration = true; }\n if (beforeCount === void 0) { beforeCount = -1; }\n var stackTrace = new Error().stack.split(\"\\n\")[3];\n var eventCount = this.listeners(event).length;\n var tabs1 = event === \"authenticated\" /* HAPConnectionEvent.AUTHENTICATED */ ? \"\\t\" : \"\\t\\t\";\n var tabs2 = !registration ? \"\\t\" : \"\\t\\t\";\n // eslint-disable-next-line max-len\n debugEvents(\"[\".concat(this.remoteAddress, \"] \").concat(registration ? \"Registered\" : \"Unregistered\", \" event '\").concat(String(event).toUpperCase(), \"' \").concat(tabs1, \"(total: \").concat(eventCount).concat(!registration ? \" Before: \" + beforeCount : \"\", \") \").concat(tabs2).concat(stackTrace));\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n HAPConnection.prototype.on = function (event, listener) {\n var result = _super.prototype.on.call(this, event, listener);\n this.debugListenerRegistration(event);\n return result;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n HAPConnection.prototype.addListener = function (event, listener) {\n var result = _super.prototype.addListener.call(this, event, listener);\n this.debugListenerRegistration(event);\n return result;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n HAPConnection.prototype.removeListener = function (event, listener) {\n var beforeCount = this.listeners(event).length;\n var result = _super.prototype.removeListener.call(this, event, listener);\n this.debugListenerRegistration(event, false, beforeCount);\n return result;\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n HAPConnection.prototype.off = function (event, listener) {\n var result = _super.prototype.off.call(this, event, listener);\n var beforeCount = this.listeners(event).length;\n this.debugListenerRegistration(event, false, beforeCount);\n return result;\n };\n /**\n * This method is called once the connection has gone through pair-verify.\n * As any HomeKit controller will initiate a pair-verify after the pair-setup procedure, this method gets\n * not called on the initial pair-setup.\n *\n * Once this method has been called, the connection is authenticated and encryption is turned on.\n */\n HAPConnection.prototype.connectionAuthenticated = function (username) {\n this.state = 2 /* HAPConnectionState.AUTHENTICATED */;\n this.username = username;\n this.emit(\"authenticated\" /* HAPConnectionEvent.AUTHENTICATED */, username);\n };\n HAPConnection.prototype.isAuthenticated = function () {\n return this.state === 2 /* HAPConnectionState.AUTHENTICATED */;\n };\n HAPConnection.prototype.close = function () {\n if (this.state >= 4 /* HAPConnectionState.CLOSING */) {\n return; // already closed/closing\n }\n this.state = 4 /* HAPConnectionState.CLOSING */;\n this.tcpSocket.destroy();\n };\n HAPConnection.prototype.closeConnectionAsOfUnpair = function (initiator) {\n if (this === initiator) {\n // the initiator of the unpair request is this connection, meaning it unpaired itself.\n // we still need to send the response packet to the unpair request.\n this.state = 3 /* HAPConnectionState.TO_BE_TEARED_DOWN */;\n }\n else {\n // as HomeKit requires it, destroy any active session which got unpaired\n this.close();\n }\n };\n HAPConnection.prototype.sendEvent = function (aid, iid, value, immediateDelivery) {\n (0, assert_1.default)(aid != null, \"HAPConnection.sendEvent: aid must be defined!\");\n (0, assert_1.default)(iid != null, \"HAPConnection.sendEvent: iid must be defined!\");\n var eventName = aid + \".\" + iid;\n if (!this.registeredEvents.has(eventName)) {\n // non verified connections can't register events, so this case is covered!\n return;\n }\n var event = {\n aid: aid,\n iid: iid,\n value: value,\n };\n if (immediateDelivery) {\n // some characteristics are required to deliver notifications immediately\n // we will flush all other events too, on that occasion.\n this.queuedEvents.push(event);\n this.eventsQueuedForImmediateDelivery = true;\n if (this.eventsTimer) {\n clearTimeout(this.eventsTimer);\n this.eventsTimer = undefined;\n }\n this.handleEventsTimeout();\n return;\n }\n // we search the list of queued events in reverse order.\n // if the last element with the same aid and iid has the same value we don't want to send the event notification twice.\n // BUT, we do not want to override previous event notifications which have a different value. Automations must be executed!\n for (var i = this.queuedEvents.length - 1; i >= 0; i--) {\n var queuedEvent = this.queuedEvents[i];\n if (queuedEvent.aid === aid && queuedEvent.iid === iid) {\n if (queuedEvent.value === value) {\n return; // the same event was already queued. do not add it again!\n }\n break; // we break in any case\n }\n }\n this.queuedEvents.push(event);\n // if there is already a timer running we just add it in the queue.\n if (!this.eventsTimer) {\n this.eventsTimer = setTimeout(this.handleEventsTimeout.bind(this), 250);\n this.eventsTimer.unref();\n }\n };\n HAPConnection.prototype.handleEventsTimeout = function () {\n this.eventsTimer = undefined;\n if (this.state > 2 /* HAPConnectionState.AUTHENTICATED */) {\n // connection is closed or about to be closed. no need to send any further events\n return;\n }\n this.writeQueuedEventNotifications();\n };\n HAPConnection.prototype.writeQueuedEventNotifications = function () {\n var e_5, _a;\n if (this.queuedEvents.length === 0 || this.handlingRequest) {\n return; // don't send empty event notifications or if we are currently handling a request\n }\n if (this.eventsTimer) {\n // this method might be called when we have enqueued data AND data that is queued for immediate delivery!\n clearTimeout(this.eventsTimer);\n this.eventsTimer = undefined;\n }\n var eventData = {\n characteristics: [],\n };\n try {\n for (var _b = tslib_1.__values(this.queuedEvents), _c = _b.next(); !_c.done; _c = _b.next()) {\n var queuedEvent = _c.value;\n if (!this.registeredEvents.has(queuedEvent.aid + \".\" + queuedEvent.iid)) {\n continue; // client unregistered that event in the meantime\n }\n eventData.characteristics.push(queuedEvent);\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_5) throw e_5.error; }\n }\n this.queuedEvents.splice(0, this.queuedEvents.length);\n this.eventsQueuedForImmediateDelivery = false;\n this.writeEventNotification(eventData);\n };\n /**\n * This will create an EVENT/1.0 notification header with the provided event notification.\n * If currently an HTTP request is in progress the assembled packet will be\n * added to the pending events list.\n *\n * @param notification - The event which should be sent out\n */\n HAPConnection.prototype.writeEventNotification = function (notification) {\n debugCon(\"[%s] Sending HAP event notifications %o\", this.remoteAddress, notification.characteristics);\n (0, assert_1.default)(!this.handlingRequest, \"Can't write event notifications while handling a request!\");\n // Apple backend processes events in reverse order, so we need to reverse the array\n // so that events are processed in chronological order.\n notification.characteristics.reverse();\n var dataBuffer = Buffer.from(JSON.stringify(notification), \"utf8\");\n var header = Buffer.from(\"EVENT/1.0 200 OK\\r\\n\" +\n \"Content-Type: application/hap+json\\r\\n\" +\n \"Content-Length: \" + dataBuffer.length + \"\\r\\n\" +\n \"\\r\\n\", \"utf8\");\n var buffer = Buffer.concat([header, dataBuffer]);\n this.tcpSocket.write(this.encrypt(buffer), this.handleTCPSocketWriteFulfilled.bind(this));\n };\n HAPConnection.prototype.enableEventNotifications = function (aid, iid) {\n this.registeredEvents.add(aid + \".\" + iid);\n };\n HAPConnection.prototype.disableEventNotifications = function (aid, iid) {\n this.registeredEvents.delete(aid + \".\" + iid);\n };\n HAPConnection.prototype.hasEventNotifications = function (aid, iid) {\n return this.registeredEvents.has(aid + \".\" + iid);\n };\n HAPConnection.prototype.getRegisteredEvents = function () {\n return this.registeredEvents;\n };\n HAPConnection.prototype.clearRegisteredEvents = function () {\n this.registeredEvents.clear();\n };\n HAPConnection.prototype.encrypt = function (data) {\n // if accessoryToControllerKey is not empty, then encryption is enabled for this connection. However, we'll\n // need to be careful to ensure that we don't encrypt the last few bytes of the response from handlePairVerifyStepTwo.\n // Since all communication calls are asynchronous, we could easily receive this 'encrypt' event for those bytes.\n // So we want to make sure that we aren't encrypting data until we have *received* some encrypted data from the client first.\n if (this.encryption && this.encryption.accessoryToControllerKey.length > 0 && this.encryption.controllerToAccessoryCount > 0) {\n return hapCrypto.layerEncrypt(data, this.encryption);\n }\n return data; // otherwise, we don't encrypt and return plaintext\n };\n HAPConnection.prototype.decrypt = function (data) {\n if (this.encryption && this.encryption.controllerToAccessoryKey.length > 0) {\n // below call may throw an error if decryption failed\n return hapCrypto.layerDecrypt(data, this.encryption);\n }\n return data; // otherwise, we don't decrypt and return plaintext\n };\n HAPConnection.prototype.onHttpServerListening = function () {\n var _this = this;\n var addressInfo = this.internalHttpServer.address(); // address() is only a string when listening to unix domain sockets\n var addressString = addressInfo.family === \"IPv6\" ? \"[\".concat(addressInfo.address, \"]\") : addressInfo.address;\n this.internalHttpServerPort = addressInfo.port;\n debugCon(\"[%s] Internal HTTP server listening on %s:%s\", this.remoteAddress, addressString, addressInfo.port);\n this.internalHttpServer.on(\"close\", this.onHttpServerClose.bind(this));\n // now we can establish a connection to this running HTTP server for proxying data\n this.httpSocket = net_1.default.createConnection(this.internalHttpServerPort, this.internalHttpServerAddress); // previously we used addressInfo.address\n this.httpSocket.setNoDelay(true); // disable Nagle algorithm\n this.httpSocket.on(\"data\", this.handleHttpServerResponse.bind(this));\n // we MUST register for this event, otherwise the error will bubble up to the top and crash the node process entirely.\n this.httpSocket.on(\"error\", this.onHttpSocketError.bind(this));\n this.httpSocket.on(\"close\", this.onHttpSocketClose.bind(this));\n this.httpSocket.on(\"connect\", function () {\n // we are now fully set up:\n // - clientSocket is connected to the iOS device\n // - serverSocket is connected to the httpServer\n // - ready to proxy data!\n _this.state = 1 /* HAPConnectionState.FULLY_SET_UP */;\n debugCon(\"[%s] Internal HTTP socket connected. HAPConnection now fully set up!\", _this.remoteAddress);\n // start by flushing any pending buffered data received from the client while we were setting up\n if (_this.pendingClientSocketData && _this.pendingClientSocketData.length > 0) {\n _this.httpSocket.write(_this.pendingClientSocketData);\n }\n _this.pendingClientSocketData = undefined;\n });\n };\n /**\n * This event handler is called when we receive data from a HomeKit controller on our tcp socket.\n * We store the data if the internal http server is not read yet, or forward it to the http server.\n */\n HAPConnection.prototype.onTCPSocketData = function (data) {\n if (this.state > 2 /* HAPConnectionState.AUTHENTICATED */) {\n // don't accept data of a connection which is about to be closed or already closed\n return;\n }\n this.handlingRequest = true; // reverted to false once response was sent out\n this.lastSocketOperation = new Date().getTime();\n try {\n data = this.decrypt(data);\n }\n catch (error) { // decryption and/or verification failed, disconnect the client\n debugCon(\"[%s] Error occurred trying to decrypt incoming packet: %s\", this.remoteAddress, error.message);\n this.close();\n return;\n }\n if (this.state < 1 /* HAPConnectionState.FULLY_SET_UP */) { // we're not setup yet, so add this data to our intermediate buffer\n this.pendingClientSocketData = Buffer.concat([this.pendingClientSocketData, data]);\n }\n else {\n this.httpSocket.write(data); // proxy it along to the HTTP server\n }\n };\n /**\n * This event handler is called when the internal http server receives a request.\n * Meaning we received data from the HomeKit controller in {@link onTCPSocketData}, which then send the\n * data unencrypted to the internal http server. And now it landed here, fully parsed as a http request.\n */\n HAPConnection.prototype.handleHttpServerRequest = function (request, response) {\n if (this.state > 2 /* HAPConnectionState.AUTHENTICATED */) {\n // don't accept data of a connection which is about to be closed or already closed\n return;\n }\n debugCon(\"[%s] HTTP request: %s\", this.remoteAddress, request.url);\n request.socket.setNoDelay(true);\n this.emit(\"request\" /* HAPConnectionEvent.REQUEST */, request, response);\n };\n /**\n * This event handler is called by the socket which is connected to our internal http server.\n * It is called with the response returned from the http server.\n * In this method we have to encrypt and forward the message back to the HomeKit controller.\n */\n HAPConnection.prototype.handleHttpServerResponse = function (data) {\n var _this = this;\n data = this.encrypt(data);\n this.tcpSocket.write(data, this.handleTCPSocketWriteFulfilled.bind(this));\n debugCon(\"[%s] HTTP Response is finished\", this.remoteAddress);\n this.handlingRequest = false;\n if (this.state === 3 /* HAPConnectionState.TO_BE_TEARED_DOWN */) {\n setTimeout(function () { return _this.close(); }, 10);\n }\n else if (this.state < 3 /* HAPConnectionState.TO_BE_TEARED_DOWN */) {\n if (!this.eventsTimer || this.eventsQueuedForImmediateDelivery) {\n // we deliver events if there is no eventsTimer (meaning it ran out in the meantime)\n // or when the queue contains events set to be delivered immediately\n this.writeQueuedEventNotifications();\n }\n }\n };\n HAPConnection.prototype.handleTCPSocketWriteFulfilled = function () {\n this.lastSocketOperation = new Date().getTime();\n };\n HAPConnection.prototype.onTCPSocketError = function (err) {\n debugCon(\"[%s] Client connection error: %s\", this.remoteAddress, err.message);\n // onTCPSocketClose will be called next\n };\n HAPConnection.prototype.onTCPSocketClose = function () {\n this.state = 5 /* HAPConnectionState.CLOSED */;\n debugCon(\"[%s] Client connection closed\", this.remoteAddress);\n if (this.httpSocket) {\n this.httpSocket.destroy();\n }\n this.internalHttpServer.close();\n this.emit(\"closed\" /* HAPConnectionEvent.CLOSED */); // sending final closed event\n this.removeAllListeners(); // cleanup listeners, we are officially dead now\n };\n HAPConnection.prototype.onHttpServerError = function (err) {\n debugCon(\"[%s] HTTP server error: %s\", this.remoteAddress, err.message);\n if (err.code === \"EADDRINUSE\") {\n this.internalHttpServerPort = undefined;\n this.internalHttpServer.close();\n this.internalHttpServer.listen(0, this.internalHttpServerAddress = (0, net_utils_1.getOSLoopbackAddressIfAvailable)());\n }\n };\n HAPConnection.prototype.onHttpServerClose = function () {\n debugCon(\"[%s] HTTP server was closed\", this.remoteAddress);\n // make sure the iOS side is closed as well\n this.close();\n };\n HAPConnection.prototype.onHttpSocketError = function (err) {\n debugCon(\"[%s] HTTP connection error: \", this.remoteAddress, err.message);\n // onHttpSocketClose will be called next\n };\n HAPConnection.prototype.onHttpSocketClose = function () {\n debugCon(\"[%s] HTTP connection was closed\", this.remoteAddress);\n // we only support a single long-lived connection to our internal HTTP server. Since it's closed,\n // we'll need to shut it down entirely.\n this.internalHttpServer.close();\n };\n HAPConnection.prototype.getLocalAddress = function (ipVersion) {\n var e_6, _a, e_7, _b;\n var infos = os_1.default.networkInterfaces()[this.networkInterface];\n if (ipVersion === \"ipv4\") {\n try {\n for (var infos_1 = tslib_1.__values(infos), infos_1_1 = infos_1.next(); !infos_1_1.done; infos_1_1 = infos_1.next()) {\n var info = infos_1_1.value;\n // @ts-expect-error Nodejs 18+ uses the number 4 the string \"IPv4\"\n if (info.family === \"IPv4\" || info.family === 4) {\n return info.address;\n }\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (infos_1_1 && !infos_1_1.done && (_a = infos_1.return)) _a.call(infos_1);\n }\n finally { if (e_6) throw e_6.error; }\n }\n throw new Error(\"Could not find \" + ipVersion + \" address for interface \" + this.networkInterface);\n }\n else {\n var localUniqueAddress = undefined;\n try {\n for (var infos_2 = tslib_1.__values(infos), infos_2_1 = infos_2.next(); !infos_2_1.done; infos_2_1 = infos_2.next()) {\n var info = infos_2_1.value;\n // @ts-expect-error Nodejs 18+ uses the number 6 instead of the string \"IPv6\"\n if (info.family === \"IPv6\" || info.family === 6) {\n if (!info.scopeid) {\n return info.address;\n }\n else if (!localUniqueAddress) {\n localUniqueAddress = info.address;\n }\n }\n }\n }\n catch (e_7_1) { e_7 = { error: e_7_1 }; }\n finally {\n try {\n if (infos_2_1 && !infos_2_1.done && (_b = infos_2.return)) _b.call(infos_2);\n }\n finally { if (e_7) throw e_7.error; }\n }\n if (!localUniqueAddress) {\n throw new Error(\"Could not find \" + ipVersion + \" address for interface \" + this.networkInterface);\n }\n return localUniqueAddress;\n }\n };\n HAPConnection.getLocalNetworkInterface = function (socket) {\n var e_8, _a, e_9, _b, e_10, _c, e_11, _d;\n var localAddress = socket.localAddress;\n if (localAddress.startsWith(\"::ffff:\")) { // IPv4-Mapped IPv6 Address https://tools.ietf.org/html/rfc4291#section-2.5.5.2\n localAddress = localAddress.substring(7);\n }\n else {\n var index = localAddress.indexOf(\"%\");\n if (index !== -1) { // link-local ipv6\n localAddress = localAddress.substring(0, index);\n }\n }\n var interfaces = os_1.default.networkInterfaces();\n try {\n for (var _e = tslib_1.__values(Object.entries(interfaces)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var _g = tslib_1.__read(_f.value, 2), name = _g[0], infos = _g[1];\n try {\n for (var infos_3 = (e_9 = void 0, tslib_1.__values(infos)), infos_3_1 = infos_3.next(); !infos_3_1.done; infos_3_1 = infos_3.next()) {\n var info = infos_3_1.value;\n if (info.address === localAddress) {\n return name;\n }\n }\n }\n catch (e_9_1) { e_9 = { error: e_9_1 }; }\n finally {\n try {\n if (infos_3_1 && !infos_3_1.done && (_b = infos_3.return)) _b.call(infos_3);\n }\n finally { if (e_9) throw e_9.error; }\n }\n }\n }\n catch (e_8_1) { e_8 = { error: e_8_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n }\n finally { if (e_8) throw e_8.error; }\n }\n // we couldn't map the address from above, we try now to match subnets (see https://github.com/homebridge/HAP-NodeJS/issues/847)\n var family = net_1.default.isIPv4(localAddress) ? \"IPv4\" : \"IPv6\";\n try {\n for (var _h = tslib_1.__values(Object.entries(interfaces)), _j = _h.next(); !_j.done; _j = _h.next()) {\n var _k = tslib_1.__read(_j.value, 2), name = _k[0], infos = _k[1];\n try {\n for (var infos_4 = (e_11 = void 0, tslib_1.__values(infos)), infos_4_1 = infos_4.next(); !infos_4_1.done; infos_4_1 = infos_4.next()) {\n var info = infos_4_1.value;\n if (info.family !== family) {\n continue;\n }\n // check if the localAddress is in the same subnet\n if ((0, domain_formatter_1.getNetAddress)(localAddress, info.netmask) === (0, domain_formatter_1.getNetAddress)(info.address, info.netmask)) {\n return name;\n }\n }\n }\n catch (e_11_1) { e_11 = { error: e_11_1 }; }\n finally {\n try {\n if (infos_4_1 && !infos_4_1.done && (_d = infos_4.return)) _d.call(infos_4);\n }\n finally { if (e_11) throw e_11.error; }\n }\n }\n }\n catch (e_10_1) { e_10 = { error: e_10_1 }; }\n finally {\n try {\n if (_j && !_j.done && (_c = _h.return)) _c.call(_h);\n }\n finally { if (e_10) throw e_10.error; }\n }\n console.log(\"WARNING couldn't map socket coming from remote address \".concat(socket.remoteAddress, \":\").concat(socket.remotePort, \" at local address \").concat(socket.localAddress, \" to a interface!\"));\n return Object.keys(interfaces)[1]; // just use the first interface after the loopback interface as fallback\n };\n return HAPConnection;\n}(events_1.EventEmitter));\nexports.HAPConnection = HAPConnection;\n//# sourceMappingURL=eventedhttp.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.layerDecrypt = exports.layerEncrypt = exports.chacha20_poly1305_encryptAndSeal = exports.chacha20_poly1305_decryptAndVerify = exports.writeUInt64LE = exports.HKDF = exports.generateCurve25519SharedSecKey = exports.generateCurve25519KeyPair = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nvar futoin_hkdf_1 = tslib_1.__importDefault(require(\"futoin-hkdf\"));\nvar tweetnacl_1 = tslib_1.__importDefault(require(\"tweetnacl\"));\nif (!crypto_1.default.getCiphers().includes(\"chacha20-poly1305\")) {\n assert_1.default.fail(\"The cipher 'chacha20-poly1305' is not supported with your current running nodejs version v\" + process.version + \". \" +\n \"At least a nodejs version of v10.17.0 (excluding v11.0 and v11.1) is required!\");\n}\n/**\n * @group Cryptography\n */\nfunction generateCurve25519KeyPair() {\n return tweetnacl_1.default.box.keyPair();\n}\nexports.generateCurve25519KeyPair = generateCurve25519KeyPair;\n/**\n * @group Cryptography\n */\nfunction generateCurve25519SharedSecKey(priKey, pubKey) {\n return tweetnacl_1.default.scalarMult(priKey, pubKey);\n}\nexports.generateCurve25519SharedSecKey = generateCurve25519SharedSecKey;\n/**\n * @group Cryptography\n */\nfunction HKDF(hashAlg, salt, ikm, info, size) {\n return (0, futoin_hkdf_1.default)(ikm, size, { hash: hashAlg, salt: salt, info: info });\n}\nexports.HKDF = HKDF;\nvar MAX_UINT32 = 0x00000000FFFFFFFF;\nvar MAX_INT53 = 0x001FFFFFFFFFFFFF;\nfunction uintHighLow(number) {\n (0, assert_1.default)(number > -1 && number <= MAX_INT53, \"number out of range\");\n (0, assert_1.default)(Math.floor(number) === number, \"number must be an integer\");\n var high = 0;\n var signbit = number & 0xFFFFFFFF;\n var low = signbit < 0 ? (number & 0x7FFFFFFF) + 0x80000000 : signbit;\n if (number > MAX_UINT32) {\n high = (number - low) / (MAX_UINT32 + 1);\n }\n return [high, low];\n}\n/**\n * @group Utils\n */\nfunction writeUInt64LE(number, buffer, offset) {\n if (offset === void 0) { offset = 0; }\n var hl = uintHighLow(number);\n buffer.writeUInt32LE(hl[1], offset);\n buffer.writeUInt32LE(hl[0], offset + 4);\n}\nexports.writeUInt64LE = writeUInt64LE;\n//Security Layer Enc/Dec\n/**\n * @group Cryptography\n */\nfunction chacha20_poly1305_decryptAndVerify(key, nonce, aad, ciphertext, authTag) {\n if (nonce.length < 12) { // openssl 3.x.x requires 98 bits nonce length\n nonce = Buffer.concat([\n Buffer.alloc(12 - nonce.length, 0),\n nonce,\n ]);\n }\n // @ts-expect-error: types for this are really broken\n var decipher = crypto_1.default.createDecipheriv(\"chacha20-poly1305\", key, nonce, { authTagLength: 16 });\n if (aad) {\n decipher.setAAD(aad);\n }\n decipher.setAuthTag(authTag);\n var plaintext = decipher.update(ciphertext);\n decipher.final(); // final call verifies integrity using the auth tag. Throws error if something was manipulated!\n return plaintext;\n}\nexports.chacha20_poly1305_decryptAndVerify = chacha20_poly1305_decryptAndVerify;\n/**\n * @group Cryptography\n */\nfunction chacha20_poly1305_encryptAndSeal(key, nonce, aad, plaintext) {\n if (nonce.length < 12) { // openssl 3.x.x requires 98 bits nonce length\n nonce = Buffer.concat([\n Buffer.alloc(12 - nonce.length, 0),\n nonce,\n ]);\n }\n // @ts-expect-error: types for this are really broken\n var cipher = crypto_1.default.createCipheriv(\"chacha20-poly1305\", key, nonce, { authTagLength: 16 });\n if (aad) {\n cipher.setAAD(aad);\n }\n var ciphertext = cipher.update(plaintext);\n cipher.final(); // final call creates the auth tag\n var authTag = cipher.getAuthTag();\n return {\n ciphertext: ciphertext,\n authTag: authTag,\n };\n}\nexports.chacha20_poly1305_encryptAndSeal = chacha20_poly1305_encryptAndSeal;\n/**\n * @group Cryptography\n */\nfunction layerEncrypt(data, encryption) {\n var result = Buffer.alloc(0);\n var total = data.length;\n for (var offset = 0; offset < total;) {\n var length = Math.min(total - offset, 0x400);\n var leLength = Buffer.alloc(2);\n leLength.writeUInt16LE(length, 0);\n var nonce = Buffer.alloc(8);\n writeUInt64LE(encryption.accessoryToControllerCount++, nonce, 0);\n var encrypted = chacha20_poly1305_encryptAndSeal(encryption.accessoryToControllerKey, nonce, leLength, data.slice(offset, offset + length));\n offset += length;\n result = Buffer.concat([result, leLength, encrypted.ciphertext, encrypted.authTag]);\n }\n return result;\n}\nexports.layerEncrypt = layerEncrypt;\n/**\n * @group Cryptography\n */\nfunction layerDecrypt(packet, encryption) {\n if (encryption.incompleteFrame) {\n packet = Buffer.concat([encryption.incompleteFrame, packet]);\n encryption.incompleteFrame = undefined;\n }\n var result = Buffer.alloc(0);\n var total = packet.length;\n for (var offset = 0; offset < total;) {\n var realDataLength = packet.slice(offset, offset + 2).readUInt16LE(0);\n var availableDataLength = total - offset - 2 - 16;\n if (realDataLength > availableDataLength) { // Fragmented packet\n encryption.incompleteFrame = packet.slice(offset);\n break;\n }\n var nonce = Buffer.alloc(8);\n writeUInt64LE(encryption.controllerToAccessoryCount++, nonce, 0);\n var plaintext = chacha20_poly1305_decryptAndVerify(encryption.controllerToAccessoryKey, nonce, packet.slice(offset, offset + 2), packet.slice(offset + 2, offset + 2 + realDataLength), packet.slice(offset + 2 + realDataLength, offset + 2 + realDataLength + 16));\n result = Buffer.concat([result, plaintext]);\n offset += (18 + realDataLength);\n }\n return result;\n}\nexports.layerDecrypt = layerDecrypt;\n//# sourceMappingURL=hapCrypto.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HapStatusError = void 0;\nvar tslib_1 = require(\"tslib\");\nvar HAPServer_1 = require(\"../HAPServer\");\n/**\n * Throws a HAP status error that is sent back to HomeKit.\n *\n * @example\n * ```ts\n * throw new HapStatusError(HAPStatus.OPERATION_TIMED_OUT);\n * ```\n *\n * @group Utils\n */\nvar HapStatusError = /** @class */ (function (_super) {\n tslib_1.__extends(HapStatusError, _super);\n function HapStatusError(status) {\n var _this = _super.call(this, \"HAP Status Error: \" + status) || this;\n Object.setPrototypeOf(_this, HapStatusError.prototype);\n if ((0, HAPServer_1.IsKnownHAPStatusError)(status)) {\n _this.hapStatus = status;\n }\n else {\n _this.hapStatus = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;\n }\n return _this;\n }\n return HapStatusError;\n}(Error));\nexports.HapStatusError = HapStatusError;\n//# sourceMappingURL=hapStatusError.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getOSLoopbackAddressIfAvailable = exports.getOSLoopbackAddress = exports.findLoopbackAddress = void 0;\nvar tslib_1 = require(\"tslib\");\nvar os_1 = tslib_1.__importDefault(require(\"os\"));\n/**\n * @group Utils\n */\nfunction findLoopbackAddress() {\n var e_1, _a, e_2, _b;\n var ipv6 = undefined; // ::1/128\n var ipv6LinkLocal = undefined; // fe80::/10\n var ipv4 = undefined; // 127.0.0.1/8\n try {\n for (var _c = tslib_1.__values(Object.entries(os_1.default.networkInterfaces())), _d = _c.next(); !_d.done; _d = _c.next()) {\n var _e = tslib_1.__read(_d.value, 2), name = _e[0], infos = _e[1];\n var internal = false;\n try {\n for (var infos_1 = (e_2 = void 0, tslib_1.__values(infos)), infos_1_1 = infos_1.next(); !infos_1_1.done; infos_1_1 = infos_1.next()) {\n var info = infos_1_1.value;\n if (!info.internal) {\n continue;\n }\n internal = true;\n // @ts-expect-error Nodejs 18+ uses the number 4 the string \"IPv4\"\n if (info.family === \"IPv4\" || info.family === 4) {\n if (!ipv4) {\n ipv4 = info.address;\n }\n // @ts-expect-error Nodejs 18+ uses the number 6 the string \"IPv6\"\n }\n else if (info.family === \"IPv6\" || info.family === 6) {\n if (info.scopeid) {\n if (!ipv6LinkLocal) {\n ipv6LinkLocal = info.address + \"%\" + name; // ipv6 link local addresses are only valid with a scope\n }\n }\n else if (!ipv6) {\n ipv6 = info.address;\n }\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (infos_1_1 && !infos_1_1.done && (_b = infos_1.return)) _b.call(infos_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (internal) {\n break;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var address = ipv4 || ipv6 || ipv6LinkLocal;\n if (!address) {\n throw new Error(\"Could not find a valid loopback address on the platform!\");\n }\n return address;\n}\nexports.findLoopbackAddress = findLoopbackAddress;\nvar loopbackAddress = undefined; // loopback addressed used for the internal http server (::1 or 127.0.0.1)\n/**\n * Returns the loopback address for the machine.\n * Uses IPV4 loopback address by default and falls back to global unique IPv6 loopback and then\n * link local IPv6 loopback address.\n * If no loopback interface could be found a error is thrown.\n *\n * @group Utils\n */\nfunction getOSLoopbackAddress() {\n return loopbackAddress !== null && loopbackAddress !== void 0 ? loopbackAddress : (loopbackAddress = findLoopbackAddress());\n}\nexports.getOSLoopbackAddress = getOSLoopbackAddress;\n/**\n * Refer to {@link getOSLoopbackAddress}.\n * Instead of throwing an error, undefined is returned if loopback interface couldn't be detected.\n *\n * @group Utils\n */\nfunction getOSLoopbackAddressIfAvailable() {\n try {\n return loopbackAddress !== null && loopbackAddress !== void 0 ? loopbackAddress : (loopbackAddress = findLoopbackAddress());\n }\n catch (error) {\n console.log(error.stack);\n return undefined;\n }\n}\nexports.getOSLoopbackAddressIfAvailable = getOSLoopbackAddressIfAvailable;\n//# sourceMappingURL=net-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.once = void 0;\nvar tslib_1 = require(\"tslib\");\n/**\n * Function wrapper to ensure a function/callback is only called once.\n *\n * @group Utils\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction once(func) {\n var called = false;\n return (function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (called) {\n throw new Error(\"This callback function has already been called by someone else; it can only be called one time.\");\n }\n else {\n called = true;\n return func.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false));\n }\n });\n}\nexports.once = once;\n//# sourceMappingURL=once.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.awaitEventOnce = exports.PromiseTimeout = void 0;\n/**\n * @group Utils\n */\nfunction PromiseTimeout(timeout) {\n return new Promise(function (resolve) {\n setTimeout(function () { return resolve(); }, timeout);\n });\n}\nexports.PromiseTimeout = PromiseTimeout;\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction awaitEventOnce(element, event, timeout) {\n if (timeout === void 0) { timeout = 5000; }\n return new Promise(function (resolve, reject) {\n // eslint-disable-next-line prefer-const\n var timeoutId;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var resolveListener = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n clearTimeout(timeoutId);\n resolve(args.length ? (args.length === 1 ? args[0] : args) : undefined);\n };\n timeoutId = setTimeout(function () {\n element.removeListener(event, resolveListener);\n reject(new Error(\"awaitEvent for event \".concat(event, \" timed out!\")));\n }, timeout);\n element.once(event, resolveListener);\n });\n}\nexports.awaitEventOnce = awaitEventOnce;\n//# sourceMappingURL=promise-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.numericUpperBound = exports.numericLowerBound = exports.isIntegerNumericFormat = exports.isUnsignedNumericFormat = exports.isNumericFormat = exports.formatOutgoingCharacteristicValue = void 0;\nfunction formatOutgoingCharacteristicValue(value, props) {\n var _a;\n if (typeof value === \"boolean\") {\n return value ? 1 : 0;\n }\n else if (typeof value === \"number\") {\n if (!props.minStep || props.minStep >= 1) {\n return value;\n }\n var base = (_a = props.minValue) !== null && _a !== void 0 ? _a : 0;\n var inverse = 1 / props.minStep;\n return Math.round(((Math.round((value - base) * inverse) / inverse) + base) * 10000) / 10000;\n }\n return value;\n}\nexports.formatOutgoingCharacteristicValue = formatOutgoingCharacteristicValue;\n/**\n * @group Utils\n */\nfunction isNumericFormat(format) {\n switch (format) {\n case \"int\" /* Formats.INT */:\n case \"float\" /* Formats.FLOAT */:\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */:\n return true;\n default:\n return false;\n }\n}\nexports.isNumericFormat = isNumericFormat;\n/**\n * @group Utils\n */\nfunction isUnsignedNumericFormat(format) {\n switch (format) {\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */:\n return true;\n default:\n return false;\n }\n}\nexports.isUnsignedNumericFormat = isUnsignedNumericFormat;\n/**\n * @group Utils\n */\nfunction isIntegerNumericFormat(format) {\n switch (format) {\n case \"int\" /* Formats.INT */:\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */:\n return true;\n default:\n return false;\n }\n}\nexports.isIntegerNumericFormat = isIntegerNumericFormat;\n/**\n * @group Utils\n */\nfunction numericLowerBound(format) {\n switch (format) {\n case \"int\" /* Formats.INT */:\n return -2147483648;\n case \"float\" /* Formats.FLOAT */:\n return -Number.MAX_VALUE;\n case \"uint8\" /* Formats.UINT8 */:\n case \"uint16\" /* Formats.UINT16 */:\n case \"uint32\" /* Formats.UINT32 */:\n case \"uint64\" /* Formats.UINT64 */:\n return 0;\n default:\n throw new Error(\"Unable to determine numeric lower bound for \" + format);\n }\n}\nexports.numericLowerBound = numericLowerBound;\n/**\n * @group Utils\n */\nfunction numericUpperBound(format) {\n switch (format) {\n case \"int\" /* Formats.INT */:\n return 2147483647;\n case \"float\" /* Formats.FLOAT */:\n return Number.MAX_VALUE;\n case \"uint8\" /* Formats.UINT8 */:\n return 255;\n case \"uint16\" /* Formats.UINT16 */:\n return 65535;\n case \"uint32\" /* Formats.UINT32 */:\n return 4294967295;\n case \"uint64\" /* Formats.UINT64 */:\n // eslint-disable-next-line @typescript-eslint/no-loss-of-precision\n return 18446744073709551615; // don't get fooled, javascript uses 18446744073709552000 here\n default:\n throw new Error(\"Unable to determine numeric lower bound for \" + format);\n }\n}\nexports.numericUpperBound = numericUpperBound;\n//# sourceMappingURL=request-util.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.epochMillisFromMillisSince2001_01_01Buffer = exports.epochMillisFromMillisSince2001_01_01 = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar tlv_1 = require(\"./tlv\");\nvar EPOCH_MILLIS_2001_01_01 = Date.UTC(2001, 0, 1, 0, 0, 0, 0);\n/**\n * @group Utils\n */\nfunction epochMillisFromMillisSince2001_01_01(millis) {\n return EPOCH_MILLIS_2001_01_01 + millis;\n}\nexports.epochMillisFromMillisSince2001_01_01 = epochMillisFromMillisSince2001_01_01;\n/**\n * @group Utils\n */\nfunction epochMillisFromMillisSince2001_01_01Buffer(millis) {\n (0, assert_1.default)(millis.length === 8, \"can only parse 64 bit buffers!\");\n var millisSince2001 = (0, tlv_1.readUInt64LE)(millis);\n return epochMillisFromMillisSince2001_01_01(millisSince2001);\n}\nexports.epochMillisFromMillisSince2001_01_01Buffer = epochMillisFromMillisSince2001_01_01Buffer;\n//# sourceMappingURL=time.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.writeVariableUIntLE = exports.readVariableUIntLE = exports.readUInt16 = exports.writeUInt16 = exports.writeFloat32LE = exports.readUInt32 = exports.writeUInt32 = exports.readUInt64BE = exports.readUInt64LE = exports.readUInt64 = exports.writeUInt64 = exports.decodeList = exports.decodeWithLists = exports.decode = exports.encode = void 0;\nvar tslib_1 = require(\"tslib\");\nvar assert_1 = tslib_1.__importDefault(require(\"assert\"));\nvar hapCrypto = tslib_1.__importStar(require(\"../util/hapCrypto\"));\n/**\n * Type Length Value encoding/decoding, used by HAP as a wire format.\n * https://en.wikipedia.org/wiki/Type-length-value\n */\nvar EMPTY_TLV_TYPE = 0x00; // and empty tlv with id 0 is usually used as delimiter for tlv lists\n/**\n * @group TLV8\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction encode(type, data) {\n var e_1, _a;\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n var encodedTLVBuffers = [];\n // coerce data to Buffer if needed\n if (typeof data === \"number\") {\n data = Buffer.from([data]);\n }\n else if (typeof data === \"string\") {\n data = Buffer.from(data);\n }\n if (Array.isArray(data)) {\n var first = true;\n try {\n for (var data_1 = tslib_1.__values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {\n var entry = data_1_1.value;\n if (!first) {\n encodedTLVBuffers.push(Buffer.from([EMPTY_TLV_TYPE, 0])); // push delimiter\n }\n first = false;\n encodedTLVBuffers.push(encode(type, entry));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (first) { // we have a zero length array!\n encodedTLVBuffers.push(Buffer.from([type, 0]));\n }\n }\n else if (data.length <= 255) {\n encodedTLVBuffers.push(Buffer.concat([Buffer.from([type, data.length]), data]));\n }\n else { // otherwise it doesn't fit into one tlv entry, thus we push multiple\n var leftBytes = data.length;\n var currentIndex = 0;\n for (; leftBytes > 0;) {\n if (leftBytes >= 255) {\n encodedTLVBuffers.push(Buffer.concat([Buffer.from([type, 0xFF]), data.slice(currentIndex, currentIndex + 255)]));\n leftBytes -= 255;\n currentIndex += 255;\n }\n else {\n encodedTLVBuffers.push(Buffer.concat([Buffer.from([type, leftBytes]), data.slice(currentIndex)]));\n leftBytes -= leftBytes;\n }\n }\n }\n // do we have more arguments to encode?\n if (args.length >= 2) {\n // chop off the first two arguments which we already processed, and process the rest recursively\n var _b = tslib_1.__read(args), nextType = _b[0], nextData = _b[1], nextArgs = _b.slice(2);\n var remainingTLVBuffer = encode.apply(void 0, tslib_1.__spreadArray([nextType, nextData], tslib_1.__read(nextArgs), false));\n // append the remaining encoded arguments directly to the buffer\n encodedTLVBuffers.push(remainingTLVBuffer);\n }\n return Buffer.concat(encodedTLVBuffers);\n}\nexports.encode = encode;\n/**\n * This method is the legacy way of decoding tlv data.\n * It will not properly decode multiple list of the same id.\n * Should the decoder encounter multiple instances of the same id, it will just concatenate the buffer data.\n *\n * @param buffer - TLV8 data\n *\n * Note: Please use {@link decodeWithLists} which properly decodes list elements.\n *\n * @group TLV8\n */\nfunction decode(buffer) {\n (0, assert_1.default)(buffer instanceof Buffer, \"Illegal argument. tlv.decode() expects Buffer type!\");\n var objects = {};\n var leftLength = buffer.length;\n var currentIndex = 0;\n for (; leftLength > 0;) {\n var type = buffer[currentIndex];\n var length = buffer[currentIndex + 1];\n currentIndex += 2;\n leftLength -= 2;\n var data = buffer.slice(currentIndex, currentIndex + length);\n if (objects[type]) {\n objects[type] = Buffer.concat([objects[type], data]);\n }\n else {\n objects[type] = data;\n }\n currentIndex += length;\n leftLength -= length;\n }\n return objects;\n}\nexports.decode = decode;\n/**\n * Decode a buffer coding TLV8 encoded entries.\n *\n * This method decodes multiple entries split by a TLV delimiter properly into Buffer arrays.\n * It properly reassembles tlv entries if they were split across multiple entries due to exceeding the max tlv entry size of 255 bytes.\n * @param buffer - The Buffer containing TLV8 encoded data.\n *\n * @group TLV8\n */\nfunction decodeWithLists(buffer) {\n var result = {};\n var leftBytes = buffer.length;\n var readIndex = 0;\n var lastType = -1;\n var lastLength = -1;\n var lastItemWasDelimiter = false;\n for (; leftBytes > 0;) {\n var type = buffer.readUInt8(readIndex++);\n var length = buffer.readUInt8(readIndex++);\n leftBytes -= 2;\n var data = buffer.slice(readIndex, readIndex + length);\n readIndex += length;\n leftBytes -= length;\n if (type === 0 && length === 0) {\n lastItemWasDelimiter = true;\n continue;\n }\n var existing = result[type];\n if (existing) { // there is already an item with the same type\n if (lastItemWasDelimiter && lastType === type) { // list of tlv types\n if (Array.isArray(existing)) {\n existing.push(data);\n }\n else {\n result[type] = [existing, data];\n }\n }\n else if (lastType === type && lastLength === 255) { // tlv data got split into multiple entries as length exceeded 255\n if (Array.isArray(existing)) {\n // append to the last data blob in the array\n var last = existing[existing.length - 1];\n existing[existing.length - 1] = Buffer.concat([last, data]);\n }\n else {\n result[type] = Buffer.concat([existing, data]);\n }\n }\n else {\n throw new Error(\"Found duplicated tlv entry with type \".concat(type, \" and length \").concat(length, \" (lastItemWasDelimiter: \").concat(lastItemWasDelimiter, \", lastType: \").concat(lastType, \", lastLength: \").concat(lastLength, \")\"));\n }\n }\n else {\n result[type] = data;\n }\n lastType = type;\n lastLength = length;\n lastItemWasDelimiter = false;\n }\n return result;\n}\nexports.decodeWithLists = decodeWithLists;\n/**\n * This method can be used to parse a TLV8 encoded list that was concatenated.\n *\n * If you are thinking about using this method, try to refactor the code to use {@link decodeWithLists} instead of {@link decode}.\n * The single reason of this method's existence are the shortcomings {@link decode}, as it concatenates multiple tlv8 list entries\n * into a single Buffer.\n * This method can be used to undo that, by specifying the concatenated buffer and the tlv id of the element that should\n * mark the beginning of a new tlv8 list entry.\n *\n * @param data - The concatenated tlv8 list entries (probably output of {@link decode}).\n * @param entryStartId - The tlv id that marks the beginning of a new tlv8 entry.\n *\n * @group TLV8\n */\nfunction decodeList(data, entryStartId) {\n var objectsList = [];\n var leftLength = data.length;\n var currentIndex = 0;\n var objects = undefined;\n for (; leftLength > 0;) {\n var type = data[currentIndex]; // T\n var length = data[currentIndex + 1]; // L\n var value = data.slice(currentIndex + 2, currentIndex + 2 + length); // V\n if (type === entryStartId) { // we got the start of a new entry\n if (objects !== undefined) { // save the previous entry\n objectsList.push(objects);\n }\n objects = {};\n }\n if (objects === undefined) {\n throw new Error(\"Error parsing tlv list: Encountered uninitialized storage object\");\n }\n if (objects[type]) { // append to buffer if we have already data for this type\n objects[type] = Buffer.concat([objects[type], value]);\n }\n else {\n objects[type] = value;\n }\n currentIndex += 2 + length;\n leftLength -= 2 + length;\n }\n if (objects !== undefined) {\n objectsList.push(objects);\n } // push last entry\n return objectsList;\n}\nexports.decodeList = decodeList;\n/**\n * @deprecated This implementation is considered broken. Don't use it.\n *\n * @group TLV8\n */\nfunction writeUInt64(value) {\n var float64 = new Float64Array(1);\n float64[0] = value;\n var buffer = Buffer.alloc(float64.buffer.byteLength);\n var view = new Uint8Array(float64.buffer);\n for (var i = 0; i < buffer.length; i++) {\n buffer[i] = view[i];\n }\n return buffer;\n}\nexports.writeUInt64 = writeUInt64;\n// noinspection JSUnusedGlobalSymbols\n/**\n * @deprecated This implementation is considered broken. Don't use it.\n *\n * @group TLV8\n */\nfunction readUInt64(buffer) {\n var float64 = new Float64Array(buffer);\n return float64[0];\n}\nexports.readUInt64 = readUInt64;\n/**\n * @group TLV8\n */\nfunction readUInt64LE(buffer, offset) {\n if (offset === void 0) { offset = 0; }\n var low = buffer.readUInt32LE(offset);\n // javascript doesn't allow to shift by 32(?), therefore we multiply here\n return buffer.readUInt32LE(offset + 4) * 0x100000000 + low;\n}\nexports.readUInt64LE = readUInt64LE;\n// noinspection JSUnusedGlobalSymbols\n/**\n * @deprecated The method was named wrongfully and actually reads an UInt64 in **little endian** format.\n * @group TLV8\n */\nfunction readUInt64BE(buffer, offset) {\n if (offset === void 0) { offset = 0; }\n return readUInt64LE(buffer, offset);\n}\nexports.readUInt64BE = readUInt64BE;\n/**\n * `writeUint32LE`\n * @group TLV8\n */\nfunction writeUInt32(value) {\n var buffer = Buffer.alloc(4);\n buffer.writeUInt32LE(value, 0);\n return buffer;\n}\nexports.writeUInt32 = writeUInt32;\n/**\n * `readUInt32LE`\n * @group TLV8\n */\nfunction readUInt32(buffer) {\n return buffer.readUInt32LE(0);\n}\nexports.readUInt32 = readUInt32;\n/**\n * @group TLV8\n */\nfunction writeFloat32LE(value) {\n var buffer = Buffer.alloc(4);\n buffer.writeFloatLE(value, 0);\n return buffer;\n}\nexports.writeFloat32LE = writeFloat32LE;\n/**\n * `writeUInt16LE`\n * @group TLV8\n */\nfunction writeUInt16(value) {\n var buffer = Buffer.alloc(2);\n buffer.writeUInt16LE(value, 0);\n return buffer;\n}\nexports.writeUInt16 = writeUInt16;\n/**\n * `readUInt16LE`\n * @group TLV8\n */\nfunction readUInt16(buffer) {\n return buffer.readUInt16LE(0);\n}\nexports.readUInt16 = readUInt16;\nfunction readVariableUIntLE(buffer, offset) {\n if (offset === void 0) { offset = 0; }\n (0, assert_1.default)(offset === 0, \"Can't define a offset different than 0!\");\n switch (buffer.length) {\n case 1:\n return buffer.readUInt8(offset);\n case 2:\n return buffer.readUInt16LE(offset);\n case 4:\n return buffer.readUInt32LE(offset);\n case 8:\n return readUInt64LE(buffer, offset);\n default:\n throw new Error(\"Can't read uint LE with length \" + buffer.length);\n }\n}\nexports.readVariableUIntLE = readVariableUIntLE;\nfunction writeVariableUIntLE(number, offset) {\n if (offset === void 0) { offset = 0; }\n (0, assert_1.default)(number >= 0, \"Can't encode a negative integer as unsigned integer\");\n (0, assert_1.default)(offset === 0, \"Can't define a offset different than 0!\");\n if (number <= 255) {\n var buffer = Buffer.alloc(1);\n buffer.writeUInt8(number, offset);\n return buffer;\n }\n else if (number <= 65535) {\n return writeUInt16(number);\n }\n else if (number <= 4294967295) {\n return writeUInt32(number);\n }\n else {\n var buffer = Buffer.alloc(8);\n hapCrypto.writeUInt64LE(number, buffer, offset);\n return buffer;\n }\n}\nexports.writeVariableUIntLE = writeVariableUIntLE;\n//# sourceMappingURL=tlv.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toLongForm = exports.toShortForm = exports.write = exports.unparse = exports.isValid = exports.generate = exports.BASE_UUID = void 0;\nvar tslib_1 = require(\"tslib\");\nvar crypto_1 = tslib_1.__importDefault(require(\"crypto\"));\nexports.BASE_UUID = \"-0000-1000-8000-0026BB765291\";\n// http://stackoverflow.com/a/25951500/66673\nfunction generate(data) {\n var sha1sum = crypto_1.default.createHash(\"sha1\");\n sha1sum.update(data);\n var s = sha1sum.digest(\"hex\");\n var i = -1;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n i += 1;\n switch (c) {\n case \"y\":\n return ((parseInt(\"0x\" + s[i], 16) & 0x3) | 0x8).toString(16);\n case \"x\":\n default:\n return s[i];\n }\n });\n}\nexports.generate = generate;\nvar VALID_UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nfunction isValid(UUID) {\n return VALID_UUID_REGEX.test(UUID);\n}\nexports.isValid = isValid;\nfunction unparse(buf, offset) {\n if (offset === void 0) { offset = 0; }\n if (typeof buf === \"string\" && isValid(buf)) {\n /*\n This check was added to fix backwards compatibility with the old style CameraSource API.\n The old StreamController implementation would not unparse the HAP provided sessionId for the current streaming session.\n This was changed when the new Controller API was introduced, which now turns the sessionId Buffer into a string\n and passes it to the implementor of the Camera.\n Old style CameraSource implementations would use this unparse function to turn the Buffer into a string.\n As the sessionId is already a string we just return it here.\n \n The buf attribute being a also type of \"string\" as actually an error. Also I don't know who decided to\n not unparse the sessionId. I'm only here to fix things.\n */\n return buf;\n }\n var i = offset;\n return buf.toString(\"hex\", i, (i += 4)) + \"-\" +\n buf.toString(\"hex\", i, (i += 2)) + \"-\" +\n buf.toString(\"hex\", i, (i += 2)) + \"-\" +\n buf.toString(\"hex\", i, (i += 2)) + \"-\" +\n buf.toString(\"hex\", i, i + 6);\n}\nexports.unparse = unparse;\nfunction write(uuid, buf, offset) {\n if (offset === void 0) { offset = 0; }\n var buffer = Buffer.from(uuid.replace(/-/g, \"\"), \"hex\");\n if (buf) {\n buffer.copy(buf, offset);\n return buf;\n }\n else {\n return buffer;\n }\n}\nexports.write = write;\nvar SHORT_FORM_REGEX = /^0*([0-9a-f]{1,8})-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i;\nfunction toShortForm(uuid, base) {\n if (base === void 0) { base = exports.BASE_UUID; }\n if (!isValid(uuid)) {\n throw new TypeError(\"uuid was not a valid UUID or short form UUID\");\n }\n if (base && !isValid(\"00000000\" + base)) {\n throw new TypeError(\"base was not a valid base UUID\");\n }\n if (base && !uuid.endsWith(base)) {\n return uuid.toUpperCase();\n }\n return uuid.replace(SHORT_FORM_REGEX, \"$1\").toUpperCase();\n}\nexports.toShortForm = toShortForm;\nvar VALID_SHORT_REGEX = /^[0-9a-f]{1,8}$/i;\nfunction toLongForm(uuid, base) {\n if (base === void 0) { base = exports.BASE_UUID; }\n if (isValid(uuid)) {\n return uuid.toUpperCase();\n }\n if (!VALID_SHORT_REGEX.test(uuid)) {\n throw new TypeError(\"uuid was not a valid UUID or short form UUID\");\n }\n if (!isValid(\"00000000\" + base)) {\n throw new TypeError(\"base was not a valid base UUID\");\n }\n return ((\"00000000\" + uuid).substr(-8) + base).toUpperCase();\n}\nexports.toLongForm = toLongForm;\n//# sourceMappingURL=uuid.js.map","function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = () => ([]);\nwebpackEmptyContext.resolve = webpackEmptyContext;\nwebpackEmptyContext.id = 7506;\nmodule.exports = webpackEmptyContext;","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResourceRequestType = void 0;\n/**\n * @group HAP Accessory Server\n */\nvar ResourceRequestType;\n(function (ResourceRequestType) {\n ResourceRequestType[\"IMAGE\"] = \"image\";\n})(ResourceRequestType = exports.ResourceRequestType || (exports.ResourceRequestType = {}));\n//# sourceMappingURL=types.js.map","'use strict';\n\nvar $BigInt = typeof BigInt !== 'undefined' && BigInt;\n\nmodule.exports = function hasNativeBigInts() {\n\treturn typeof $BigInt === 'function'\n\t\t&& typeof BigInt === 'function'\n\t\t&& typeof $BigInt(42) === 'bigint' // eslint-disable-line no-magic-numbers\n\t\t&& typeof BigInt(42) === 'bigint'; // eslint-disable-line no-magic-numbers\n};\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","'use strict';\n\nvar $defineProperty = require('es-define-property');\n\nvar hasPropertyDescriptors = function hasPropertyDescriptors() {\n\treturn !!$defineProperty;\n};\n\nhasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n\t// node v0.6 has a bug where array lengths can be Set but not Defined\n\tif (!$defineProperty) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn $defineProperty([], 'length', { value: 1 }).length !== 1;\n\t} catch (e) {\n\t\t// In Firefox 4-22, defining length on an array throws an exception.\n\t\treturn true;\n\t}\n};\n\nmodule.exports = hasPropertyDescriptors;\n","'use strict';\n\nvar test = {\n\t__proto__: null,\n\tfoo: {}\n};\n\nvar $Object = Object;\n\n/** @type {import('.')} */\nmodule.exports = function hasProto() {\n\t// @ts-expect-error: TS errors on an inherited property for some reason\n\treturn { __proto__: test }.foo === test.foo\n\t\t&& !(test instanceof $Object);\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\n/** @type {import('.')} */\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar call = Function.prototype.call;\nvar $hasOwn = Object.prototype.hasOwnProperty;\nvar bind = require('function-bind');\n\n/** @type {import('.')} */\nmodule.exports = bind.call(call, $hasOwn);\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar callBind = require('call-bind');\nvar callBound = require('call-bind/callBound');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);\n/** @type {undefined | ((receiver: ArrayBuffer) => number) | ((receiver: unknown) => never)} */\nvar $byteLength = callBound('ArrayBuffer.prototype.byteLength', true);\nvar $toString = callBound('Object.prototype.toString');\n\n// in node 0.10, ArrayBuffers have no prototype methods, but have an own slot-checking `slice` method\nvar abSlice = !!$ArrayBuffer && !$byteLength && new $ArrayBuffer(0).slice;\nvar $abSlice = !!abSlice && callBind(abSlice);\n\n/** @type {import('.')} */\nmodule.exports = $byteLength || $abSlice\n\t? function isArrayBuffer(obj) {\n\t\tif (!obj || typeof obj !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\tif ($byteLength) {\n\t\t\t\t// @ts-expect-error no idea why TS can't handle the overload\n\t\t\t\t$byteLength(obj);\n\t\t\t} else {\n\t\t\t\t// @ts-expect-error TS chooses not to type-narrow inside a closure\n\t\t\t\t$abSlice(obj, 0);\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t: $ArrayBuffer\n\t\t// in node 0.8, ArrayBuffers have no prototype or own methods, but also no Symbol.toStringTag\n\t\t? function isArrayBuffer(obj) {\n\t\t\treturn $toString(obj) === '[object ArrayBuffer]';\n\t\t}\n\t\t: function isArrayBuffer(obj) { // eslint-disable-line no-unused-vars\n\t\t\treturn false;\n\t\t};\n","'use strict';\n\nvar hasBigInts = require('has-bigints')();\n\nif (hasBigInts) {\n\tvar bigIntValueOf = BigInt.prototype.valueOf;\n\tvar tryBigInt = function tryBigIntObject(value) {\n\t\ttry {\n\t\t\tbigIntValueOf.call(value);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t}\n\t\treturn false;\n\t};\n\n\tmodule.exports = function isBigInt(value) {\n\t\tif (\n\t\t\tvalue === null\n\t\t\t|| typeof value === 'undefined'\n\t\t\t|| typeof value === 'boolean'\n\t\t\t|| typeof value === 'string'\n\t\t\t|| typeof value === 'number'\n\t\t\t|| typeof value === 'symbol'\n\t\t\t|| typeof value === 'function'\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof value === 'bigint') {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn tryBigInt(value);\n\t};\n} else {\n\tmodule.exports = function isBigInt(value) {\n\t\treturn false && value;\n\t};\n}\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\nvar $boolToStr = callBound('Boolean.prototype.toString');\nvar $toString = callBound('Object.prototype.toString');\n\nvar tryBooleanObject = function booleanBrandCheck(value) {\n\ttry {\n\t\t$boolToStr(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar boolClass = '[object Boolean]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isBoolean(value) {\n\tif (typeof value === 'boolean') {\n\t\treturn true;\n\t}\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass;\n};\n","'use strict';\n\nvar fnToStr = Function.prototype.toString;\nvar reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;\nvar badArrayLike;\nvar isCallableMarker;\nif (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {\n\ttry {\n\t\tbadArrayLike = Object.defineProperty({}, 'length', {\n\t\t\tget: function () {\n\t\t\t\tthrow isCallableMarker;\n\t\t\t}\n\t\t});\n\t\tisCallableMarker = {};\n\t\t// eslint-disable-next-line no-throw-literal\n\t\treflectApply(function () { throw 42; }, null, badArrayLike);\n\t} catch (_) {\n\t\tif (_ !== isCallableMarker) {\n\t\t\treflectApply = null;\n\t\t}\n\t}\n} else {\n\treflectApply = null;\n}\n\nvar constructorRegex = /^\\s*class\\b/;\nvar isES6ClassFn = function isES6ClassFunction(value) {\n\ttry {\n\t\tvar fnStr = fnToStr.call(value);\n\t\treturn constructorRegex.test(fnStr);\n\t} catch (e) {\n\t\treturn false; // not a function\n\t}\n};\n\nvar tryFunctionObject = function tryFunctionToStr(value) {\n\ttry {\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tfnToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar objectClass = '[object Object]';\nvar fnClass = '[object Function]';\nvar genClass = '[object GeneratorFunction]';\nvar ddaClass = '[object HTMLAllCollection]'; // IE 11\nvar ddaClass2 = '[object HTML document.all class]';\nvar ddaClass3 = '[object HTMLCollection]'; // IE 9-10\nvar hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`\n\nvar isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing\n\nvar isDDA = function isDocumentDotAll() { return false; };\nif (typeof document === 'object') {\n\t// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly\n\tvar all = document.all;\n\tif (toStr.call(all) === toStr.call(document.all)) {\n\t\tisDDA = function isDocumentDotAll(value) {\n\t\t\t/* globals document: false */\n\t\t\t// in IE 6-8, typeof document.all is \"object\" and it's truthy\n\t\t\tif ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {\n\t\t\t\ttry {\n\t\t\t\t\tvar str = toStr.call(value);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tstr === ddaClass\n\t\t\t\t\t\t|| str === ddaClass2\n\t\t\t\t\t\t|| str === ddaClass3 // opera 12.16\n\t\t\t\t\t\t|| str === objectClass // IE 6-8\n\t\t\t\t\t) && value('') == null; // eslint-disable-line eqeqeq\n\t\t\t\t} catch (e) { /**/ }\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t}\n}\n\nmodule.exports = reflectApply\n\t? function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\ttry {\n\t\t\treflectApply(value, null, badArrayLike);\n\t\t} catch (e) {\n\t\t\tif (e !== isCallableMarker) { return false; }\n\t\t}\n\t\treturn !isES6ClassFn(value) && tryFunctionObject(value);\n\t}\n\t: function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\tif (hasToStringTag) { return tryFunctionObject(value); }\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tvar strClass = toStr.call(value);\n\t\tif (strClass !== fnClass && strClass !== genClass && !(/^\\[object HTML/).test(strClass)) { return false; }\n\t\treturn tryFunctionObject(value);\n\t};\n","'use strict';\n\nvar getDay = Date.prototype.getDay;\nvar tryDateObject = function tryDateGetDayCall(value) {\n\ttry {\n\t\tgetDay.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\nvar toStr = Object.prototype.toString;\nvar dateClass = '[object Date]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isDateObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;\n};\n","'use strict';\n\n/** @const */\nvar $Map = typeof Map === 'function' && Map.prototype ? Map : null;\nvar $Set = typeof Set === 'function' && Set.prototype ? Set : null;\n\nvar exported;\n\nif (!$Map) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isMap(x) {\n\t\t// `Map` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $Map ? Map.prototype.has : null;\nvar $setHas = $Set ? Set.prototype.has : null;\nif (!exported && !$mapHas) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isMap(x) {\n\t\t// `Map` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\n/** @type {import('.')} */\nmodule.exports = exported || function isMap(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$mapHas.call(x);\n\t\tif ($setHas) {\n\t\t\ttry {\n\t\t\t\t$setHas.call(x);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// @ts-expect-error TS can't figure out that $Map is always truthy here\n\t\treturn x instanceof $Map; // core-js workaround, pre-v2.5.0\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar numToStr = Number.prototype.toString;\nvar tryNumberObject = function tryNumberObject(value) {\n\ttry {\n\t\tnumToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar numClass = '[object Number]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isNumberObject(value) {\n\tif (typeof value === 'number') {\n\t\treturn true;\n\t}\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass;\n};\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar has;\nvar $exec;\nvar isRegexMarker;\nvar badStringifier;\n\nif (hasToStringTag) {\n\thas = callBound('Object.prototype.hasOwnProperty');\n\t$exec = callBound('RegExp.prototype.exec');\n\tisRegexMarker = {};\n\n\tvar throwRegexMarker = function () {\n\t\tthrow isRegexMarker;\n\t};\n\tbadStringifier = {\n\t\ttoString: throwRegexMarker,\n\t\tvalueOf: throwRegexMarker\n\t};\n\n\tif (typeof Symbol.toPrimitive === 'symbol') {\n\t\tbadStringifier[Symbol.toPrimitive] = throwRegexMarker;\n\t}\n}\n\nvar $toString = callBound('Object.prototype.toString');\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar regexClass = '[object RegExp]';\n\nmodule.exports = hasToStringTag\n\t// eslint-disable-next-line consistent-return\n\t? function isRegex(value) {\n\t\tif (!value || typeof value !== 'object') {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar descriptor = gOPD(value, 'lastIndex');\n\t\tvar hasLastIndexDataProperty = descriptor && has(descriptor, 'value');\n\t\tif (!hasLastIndexDataProperty) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\t$exec(value, badStringifier);\n\t\t} catch (e) {\n\t\t\treturn e === isRegexMarker;\n\t\t}\n\t}\n\t: function isRegex(value) {\n\t\t// In older browsers, typeof regex incorrectly returns 'function'\n\t\tif (!value || (typeof value !== 'object' && typeof value !== 'function')) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $toString(value) === regexClass;\n\t};\n","'use strict';\n\nvar $Map = typeof Map === 'function' && Map.prototype ? Map : null;\nvar $Set = typeof Set === 'function' && Set.prototype ? Set : null;\n\nvar exported;\n\nif (!$Set) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isSet(x) {\n\t\t// `Set` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $Map ? Map.prototype.has : null;\nvar $setHas = $Set ? Set.prototype.has : null;\nif (!exported && !$setHas) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isSet(x) {\n\t\t// `Set` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\n/** @type {import('.')} */\nmodule.exports = exported || function isSet(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$setHas.call(x);\n\t\tif ($mapHas) {\n\t\t\ttry {\n\t\t\t\t$mapHas.call(x);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// @ts-expect-error TS can't figure out that $Set is always truthy here\n\t\treturn x instanceof $Set; // core-js workaround, pre-v2.5.0\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\n\nvar $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true);\n\n/** @type {import('.')} */\nmodule.exports = $byteLength\n\t? function isSharedArrayBuffer(obj) {\n\t\tif (!obj || typeof obj !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\t$byteLength(obj);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t: function isSharedArrayBuffer(obj) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t};\n","'use strict';\n\nvar strValue = String.prototype.valueOf;\nvar tryStringObject = function tryStringObject(value) {\n\ttry {\n\t\tstrValue.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar strClass = '[object String]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isString(value) {\n\tif (typeof value === 'string') {\n\t\treturn true;\n\t}\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass;\n};\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar hasSymbols = require('has-symbols')();\n\nif (hasSymbols) {\n\tvar symToStr = Symbol.prototype.toString;\n\tvar symStringRegex = /^Symbol\\(.*\\)$/;\n\tvar isSymbolObject = function isRealSymbolObject(value) {\n\t\tif (typeof value.valueOf() !== 'symbol') {\n\t\t\treturn false;\n\t\t}\n\t\treturn symStringRegex.test(symToStr.call(value));\n\t};\n\n\tmodule.exports = function isSymbol(value) {\n\t\tif (typeof value === 'symbol') {\n\t\t\treturn true;\n\t\t}\n\t\tif (toStr.call(value) !== '[object Symbol]') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\treturn isSymbolObject(value);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n} else {\n\n\tmodule.exports = function isSymbol(value) {\n\t\t// this environment does not support Symbols.\n\t\treturn false && value;\n\t};\n}\n","'use strict';\n\nvar $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;\nvar $WeakSet = typeof WeakSet === 'function' && WeakSet.prototype ? WeakSet : null;\n\nvar exported;\n\nif (!$WeakMap) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isWeakMap(x) {\n\t\t// `WeakMap` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $WeakMap ? $WeakMap.prototype.has : null;\nvar $setHas = $WeakSet ? $WeakSet.prototype.has : null;\nif (!exported && !$mapHas) {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isWeakMap(x) {\n\t\t// `WeakMap` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\n/** @type {import('.')} */\nmodule.exports = exported || function isWeakMap(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$mapHas.call(x, $mapHas);\n\t\tif ($setHas) {\n\t\t\ttry {\n\t\t\t\t$setHas.call(x, $setHas);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// @ts-expect-error TS can't figure out that $WeakMap is always truthy here\n\t\treturn x instanceof $WeakMap; // core-js workaround, pre-v3\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\n\nvar $WeakSet = GetIntrinsic('%WeakSet%', true);\n\nvar $setHas = callBound('WeakSet.prototype.has', true);\n\nif ($setHas) {\n\tvar $mapHas = callBound('WeakMap.prototype.has', true);\n\n\t/** @type {import('.')} */\n\tmodule.exports = function isWeakSet(x) {\n\t\tif (!x || typeof x !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\t$setHas(x, $setHas);\n\t\t\tif ($mapHas) {\n\t\t\t\ttry {\n\t\t\t\t\t$mapHas(x, $mapHas);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// @ts-expect-error TS can't figure out that $WeakSet is always truthy here\n\t\t\treturn x instanceof $WeakSet; // core-js workaround, pre-v3\n\t\t} catch (e) {}\n\t\treturn false;\n\t};\n} else {\n\t/** @type {import('.')} */\n\t// eslint-disable-next-line no-unused-vars\n\tmodule.exports = function isWeakSet(x) {\n\t\t// `WeakSet` does not exist, or does not have a `has` method\n\t\treturn false;\n\t};\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","//filter will reemit the data if cb(err,pass) pass is truthy\n\n// reduce is more tricky\n// maybe we want to group the reductions or emit progress updates occasionally\n// the most basic reduce just emits one 'data' event after it has recieved 'end'\n\n\nvar Stream = require('stream').Stream\n\n\n//create an event stream and apply function to each .write\n//emitting each response as data\n//unless it's an empty callback\n\nmodule.exports = function (mapper, opts) {\n\n var stream = new Stream()\n , inputs = 0\n , outputs = 0\n , ended = false\n , paused = false\n , destroyed = false\n , lastWritten = 0\n , inNext = false\n\n opts = opts || {};\n var errorEventName = opts.failures ? 'failure' : 'error';\n\n // Items that are not ready to be written yet (because they would come out of\n // order) get stuck in a queue for later.\n var writeQueue = {}\n\n stream.writable = true\n stream.readable = true\n\n function queueData (data, number) {\n var nextToWrite = lastWritten + 1\n\n if (number === nextToWrite) {\n // If it's next, and its not undefined write it\n if (data !== undefined) {\n stream.emit.apply(stream, ['data', data])\n }\n lastWritten ++\n nextToWrite ++\n } else {\n // Otherwise queue it for later.\n writeQueue[number] = data\n }\n\n // If the next value is in the queue, write it\n if (writeQueue.hasOwnProperty(nextToWrite)) {\n var dataToWrite = writeQueue[nextToWrite]\n delete writeQueue[nextToWrite]\n return queueData(dataToWrite, nextToWrite)\n }\n\n outputs ++\n if(inputs === outputs) {\n if(paused) paused = false, stream.emit('drain') //written all the incoming events\n if(ended) end()\n }\n }\n\n function next (err, data, number) {\n if(destroyed) return\n inNext = true\n\n if (!err || opts.failures) {\n queueData(data, number)\n }\n\n if (err) {\n stream.emit.apply(stream, [ errorEventName, err ]);\n }\n\n inNext = false;\n }\n\n // Wrap the mapper function by calling its callback with the order number of\n // the item in the stream.\n function wrappedMapper (input, number, callback) {\n return mapper.call(null, input, function(err, data){\n callback(err, data, number)\n })\n }\n\n stream.write = function (data) {\n if(ended) throw new Error('map stream is not writable')\n inNext = false\n inputs ++\n\n try {\n //catch sync errors and handle them like async errors\n var written = wrappedMapper(data, inputs, next)\n paused = (written === false)\n return !paused\n } catch (err) {\n //if the callback has been called syncronously, and the error\n //has occured in an listener, throw it again.\n if(inNext)\n throw err\n next(err)\n return !paused\n }\n }\n\n function end (data) {\n //if end was called with args, write it, \n ended = true //write will emit 'end' if ended is true\n stream.writable = false\n if(data !== undefined) {\n return queueData(data, inputs)\n } else if (inputs == outputs) { //wait for processing \n stream.readable = false, stream.emit('end'), stream.destroy() \n }\n }\n\n stream.end = function (data) {\n if(ended) return\n end(data)\n }\n\n stream.destroy = function () {\n ended = destroyed = true\n stream.writable = stream.readable = paused = false\n process.nextTick(function () {\n stream.emit('close')\n })\n }\n stream.pause = function () {\n paused = true\n }\n\n stream.resume = function () {\n paused = false\n }\n\n return stream\n}\n\n\n\n\n","var path = require('path');\nvar fs = require('fs');\nvar _0777 = parseInt('0777', 8);\n\nmodule.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;\n\nfunction mkdirP (p, opts, f, made) {\n if (typeof opts === 'function') {\n f = opts;\n opts = {};\n }\n else if (!opts || typeof opts !== 'object') {\n opts = { mode: opts };\n }\n \n var mode = opts.mode;\n var xfs = opts.fs || fs;\n \n if (mode === undefined) {\n mode = _0777\n }\n if (!made) made = null;\n \n var cb = f || /* istanbul ignore next */ function () {};\n p = path.resolve(p);\n \n xfs.mkdir(p, mode, function (er) {\n if (!er) {\n made = made || p;\n return cb(null, made);\n }\n switch (er.code) {\n case 'ENOENT':\n /* istanbul ignore if */\n if (path.dirname(p) === p) return cb(er);\n mkdirP(path.dirname(p), opts, function (er, made) {\n /* istanbul ignore if */\n if (er) cb(er, made);\n else mkdirP(p, opts, cb, made);\n });\n break;\n\n // In the case of any other error, just see if there's a dir\n // there already. If so, then hooray! If not, then something\n // is borked.\n default:\n xfs.stat(p, function (er2, stat) {\n // if the stat fails, then that's super weird.\n // let the original error be the failure reason.\n if (er2 || !stat.isDirectory()) cb(er, made)\n else cb(null, made);\n });\n break;\n }\n });\n}\n\nmkdirP.sync = function sync (p, opts, made) {\n if (!opts || typeof opts !== 'object') {\n opts = { mode: opts };\n }\n \n var mode = opts.mode;\n var xfs = opts.fs || fs;\n \n if (mode === undefined) {\n mode = _0777\n }\n if (!made) made = null;\n\n p = path.resolve(p);\n\n try {\n xfs.mkdirSync(p, mode);\n made = made || p;\n }\n catch (err0) {\n switch (err0.code) {\n case 'ENOENT' :\n made = sync(path.dirname(p), opts, made);\n sync(p, opts, made);\n break;\n\n // In the case of any other error, just see if there's a dir\n // there already. If so, then hooray! If not, then something\n // is borked.\n default:\n var stat;\n try {\n stat = xfs.statSync(p);\n }\n catch (err1) /* istanbul ignore next */ {\n throw err0;\n }\n /* istanbul ignore if */\n if (!stat.isDirectory()) throw err0;\n break;\n }\n }\n\n return made;\n};\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","var prefix = function (name) {\n return '_' + name\n}\n\nvar defined = function (name) {\n return name\n}\n\nexports.stringify = function (data) {\n if (typeof data === 'object' && data && data.name) return exports.stringify(data.name, data.protocol, data.subtypes)\n return Array.prototype.concat.apply([], arguments).filter(defined).map(prefix).join('.')\n}\n\nexports.parse = function (str) {\n var parts = str.split('.')\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i][0] !== '_') continue\n parts[i] = parts[i].slice(1)\n }\n\n return {\n name: parts.shift(),\n protocol: parts.shift() || null,\n subtypes: parts\n }\n}\n\nexports.tcp = function (name) {\n return exports.stringify(name, 'tcp', Array.prototype.concat.apply([], Array.prototype.slice.call(arguments, 1)))\n}\n\nexports.udp = function (name) {\n return exports.stringify(name, 'udp', Array.prototype.concat.apply([], Array.prototype.slice.call(arguments, 1)))\n}\n","var packet = require('dns-packet')\nvar dgram = require('dgram')\nvar thunky = require('thunky')\nvar events = require('events')\nvar os = require('os')\n\nvar noop = function () {}\n\nmodule.exports = function (opts) {\n if (!opts) opts = {}\n\n var that = new events.EventEmitter()\n var port = typeof opts.port === 'number' ? opts.port : 5353\n var type = opts.type || 'udp4'\n var ip = opts.ip || opts.host || (type === 'udp4' ? '224.0.0.251' : null)\n var me = {address: ip, port: port}\n var memberships = {}\n var destroyed = false\n var interval = null\n\n if (type === 'udp6' && (!ip || !opts.interface)) {\n throw new Error('For IPv6 multicast you must specify `ip` and `interface`')\n }\n\n var socket = opts.socket || dgram.createSocket({\n type: type,\n reuseAddr: opts.reuseAddr !== false,\n toString: function () {\n return type\n }\n })\n\n socket.on('error', function (err) {\n if (err.code === 'EACCES' || err.code === 'EADDRINUSE') that.emit('error', err)\n else that.emit('warning', err)\n })\n\n socket.on('message', function (message, rinfo) {\n try {\n message = packet.decode(message)\n } catch (err) {\n that.emit('warning', err)\n return\n }\n\n that.emit('packet', message, rinfo)\n\n if (message.type === 'query') that.emit('query', message, rinfo)\n if (message.type === 'response') that.emit('response', message, rinfo)\n })\n\n socket.on('listening', function () {\n if (!port) port = me.port = socket.address().port\n if (opts.multicast !== false) {\n that.update()\n interval = setInterval(that.update, 5000)\n socket.setMulticastTTL(opts.ttl || 255)\n socket.setMulticastLoopback(opts.loopback !== false)\n }\n })\n\n var bind = thunky(function (cb) {\n if (!port || opts.bind === false) return cb(null)\n socket.once('error', cb)\n socket.bind(port, opts.bind || opts.interface, function () {\n socket.removeListener('error', cb)\n cb(null)\n })\n })\n\n bind(function (err) {\n if (err) return that.emit('error', err)\n that.emit('ready')\n })\n\n that.send = function (value, rinfo, cb) {\n if (typeof rinfo === 'function') return that.send(value, null, rinfo)\n if (!cb) cb = noop\n if (!rinfo) rinfo = me\n else if (!rinfo.host && !rinfo.address) rinfo.address = me.address\n\n bind(onbind)\n\n function onbind (err) {\n if (destroyed) return cb()\n if (err) return cb(err)\n var message = packet.encode(value)\n socket.send(message, 0, message.length, rinfo.port, rinfo.address || rinfo.host, cb)\n }\n }\n\n that.response =\n that.respond = function (res, rinfo, cb) {\n if (Array.isArray(res)) res = {answers: res}\n\n res.type = 'response'\n res.flags = (res.flags || 0) | packet.AUTHORITATIVE_ANSWER\n that.send(res, rinfo, cb)\n }\n\n that.query = function (q, type, rinfo, cb) {\n if (typeof type === 'function') return that.query(q, null, null, type)\n if (typeof type === 'object' && type && type.port) return that.query(q, null, type, rinfo)\n if (typeof rinfo === 'function') return that.query(q, type, null, rinfo)\n if (!cb) cb = noop\n\n if (typeof q === 'string') q = [{name: q, type: type || 'ANY'}]\n if (Array.isArray(q)) q = {type: 'query', questions: q}\n\n q.type = 'query'\n that.send(q, rinfo, cb)\n }\n\n that.destroy = function (cb) {\n if (!cb) cb = noop\n if (destroyed) return process.nextTick(cb)\n destroyed = true\n clearInterval(interval)\n\n // Need to drop memberships by hand and ignore errors.\n // socket.close() does not cope with errors.\n for (var iface in memberships) {\n try {\n socket.dropMembership(ip, iface)\n } catch (e) {\n // eat it\n }\n }\n memberships = {}\n socket.close(cb)\n }\n\n that.update = function () {\n var ifaces = opts.interface ? [].concat(opts.interface) : allInterfaces()\n var updated = false\n\n for (var i = 0; i < ifaces.length; i++) {\n var addr = ifaces[i]\n if (memberships[addr]) continue\n\n try {\n socket.addMembership(ip, addr)\n memberships[addr] = true\n updated = true\n } catch (err) {\n that.emit('warning', err)\n }\n }\n\n if (updated) {\n if (socket.setMulticastInterface) {\n try {\n socket.setMulticastInterface(opts.interface || defaultInterface())\n } catch (err) {\n that.emit('warning', err)\n }\n }\n that.emit('networkInterface')\n }\n }\n\n return that\n}\n\nfunction defaultInterface () {\n var networks = os.networkInterfaces()\n var names = Object.keys(networks)\n\n for (var i = 0; i < names.length; i++) {\n var net = networks[names[i]]\n for (var j = 0; j < net.length; j++) {\n var iface = net[j]\n if (isIPv4(iface.family) && !iface.internal) {\n if (os.platform() === 'darwin' && names[i] === 'en0') return iface.address\n return '0.0.0.0'\n }\n }\n }\n\n return '127.0.0.1'\n}\n\nfunction allInterfaces () {\n var networks = os.networkInterfaces()\n var names = Object.keys(networks)\n var res = []\n\n for (var i = 0; i < names.length; i++) {\n var net = networks[names[i]]\n for (var j = 0; j < net.length; j++) {\n var iface = net[j]\n if (isIPv4(iface.family)) {\n res.push(iface.address)\n // could only addMembership once per interface (https://nodejs.org/api/dgram.html#dgram_socket_addmembership_multicastaddress_multicastinterface)\n break\n }\n }\n }\n\n return res\n}\n\nfunction isIPv4 (family) { // for backwards compat\n return family === 4 || family === 'IPv4'\n}\n","/*\n * Simon Last, Sept 2013\n * http://simonlast.org\n */\n\nvar fs = require('fs'),\n path = require('path'),\n mkdirp = require(\"mkdirp\"),\n Q = require('q'),\n\n defaults = {\n dir: 'persist',\n stringify: JSON.stringify,\n parse: JSON.parse,\n encoding: 'utf8',\n logging: false,\n continuous: true,\n interval: false,\n ttl: false\n },\n\n defaultTTL = 24 * 60 * 60 * 1000 /* ttl is truthy but not a number ? 24h default */,\n\n isNumber = function(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n },\n\n isFunction = function(fn) {\n return typeof fn === 'function';\n },\n\n noop = function(err) {\n if (err) throw err;\n },\n\n /*\n * To support backward compatible callbacks,\n * i.e callback(data) vs callback(err, data);\n * replace with noop and fix args order, when ready to break backward compatibily for the following API functions\n * - values()\n * - valuesWithKeyMatch()\n * hint: look for 'todo-breaks-backward' in the source\n */\n noopWithoutError = function() {};\n\nvar LocalStorage = function (userOptions) {\n if(!(this instanceof LocalStorage)) {\n return new LocalStorage(userOptions);\n }\n this.data = {};\n this.ttls = {};\n this.changes = {};\n this.setOptions(userOptions);\n\n // we don't call init in the constructor because we can only so for the initSync\n // for init async, it returns a promise, and in order to maintain that API, we cannot return the promise in the constructor\n // so init must be called on the instance of new LocalStorage();\n};\n\nLocalStorage.prototype = {\n\n setOptions: function (userOptions) {\n var options = {};\n\n if (!userOptions) {\n options = defaults;\n } else {\n for (var key in defaults) {\n if (userOptions.hasOwnProperty(key)) {\n options[key] = userOptions[key];\n } else {\n options[key] = defaults[key];\n }\n }\n\n // dir is not absolute\n options.dir = this.resolveDir(options.dir);\n options.ttlDir = options.dir + '-ttl';\n options.ttl = options.ttl ? isNumber(options.ttl) && options.ttl > 0 ? options.ttl : defaultTTL : false;\n }\n\n // Check to see if we received an external logging function\n if (isFunction(options.logging)) {\n // Overwrite log function with external logging function\n this.log = options.logging;\n options.logging = true;\n }\n\n this.options = options;\n },\n\n init: function (userOptions, callback) {\n if (isFunction(userOptions)) {\n callback = userOptions;\n userOptions = null;\n }\n if (userOptions) {\n this.setOptions(userOptions);\n }\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var deferreds = [];\n\n var options = this.options;\n\n var result = {dir: options.dir};\n deferreds.push(this.parseDataDir());\n\n if (options.ttl) {\n result.ttlDir = options.ttlDir;\n deferreds.push(this.parseTTLDir());\n }\n\n //start persisting\n if (options.interval && options.interval > 0) {\n this._persistInterval = setInterval(this.persist.bind(this), options.interval);\n }\n\n Q.all(deferreds).then(\n function() {\n deferred.resolve(result);\n callback(null, result);\n },\n function(err) {\n deferred.reject(err);\n callback(err);\n });\n\n return deferred.promise;\n },\n\n initSync: function (userOptions) {\n if (userOptions) {\n this.setOptions(userOptions);\n }\n\n var options = this.options;\n\n if (options.logging) {\n this.log(\"options:\");\n this.log(options.stringify(options));\n }\n\n this.parseDataDirSync();\n\n if (options.ttl) {\n this.parseTTLDirSync();\n }\n\n //start synchronous persisting,\n if (options.interval && options.interval > 0) {\n this._persistInterval = setInterval(this.persistSync.bind(this), options.interval);\n }\n },\n\n key: function (n) {\n // todo-breaks-backward: remove this function\n // this is fragile, keys are not guaranteed to be in a any order, so 2 calls using the same index could return a different result\n // http://stackoverflow.com/a/5525820/493756, see the ECMAScript source in that answer\n var keys = this.keys();\n if (keys.length <= n) {\n return null;\n }\n return keys[n];\n },\n\n keys: function () {\n return Object.keys(this.data);\n },\n\n length: function () {\n return this.keys().length;\n },\n\n forEach: function(callback) {\n return this.keys().forEach(function(key) {\n callback(key, this.data[key]);\n }.bind(this));\n },\n\n values: function(callback) {\n\n // todo-breaks-backward: remove callback option\n callback = isFunction(callback) ? callback : noopWithoutError;\n\n var values = this.keys().map(function(k) {\n return this.data[k];\n }.bind(this));\n\n // todo-breaks-backward: remove callback, no need, this is sync\n callback(values);\n\n return values;\n },\n\n\n valuesWithKeyMatch: function(match, callback) {\n // todo-breaks-backward: remove callback option\n callback = isFunction(callback) ? callback : noopWithoutError;\n\n match = match || /.*/;\n\n var filter = match instanceof RegExp ?\n function(key) {\n return match.test(key);\n } :\n function(key) {\n return match.indexOf(key) !== -1;\n };\n\n var values = [];\n this.keys().forEach(function(k) {\n if (filter(k)) {\n values.push(this.data[k]);\n }\n }.bind(this));\n\n // todo-breaks-backward: remove callback, no need this is sync\n callback(values);\n return values;\n },\n\n setItem: function (key, value, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var options = this.options;\n var result;\n var logmsg = \"set (\" + key + \": \" + options.stringify(value) + \")\";\n\n var deferred = Q.defer();\n var deferreds = [];\n\n this.data[key] = value;\n if (options.ttl) {\n this.ttls[key] = new Date().getTime() + options.ttl;\n }\n\n result = {key: key, value: value, queued: !!options.interval, manual: !options.interval && !options.continuous};\n\n var onSuccess = function () {\n callback(null, result);\n deferred.resolve(result);\n };\n\n var onError = function (err) {\n callback(err);\n deferred.reject(err);\n };\n\n this.log(logmsg);\n\n if (options.interval || !options.continuous) {\n this.changes[key] = {onSuccess: onSuccess, onError: onError};\n } else {\n deferreds.push(this.persistKey(key));\n\n Q.all(deferreds).then(\n function(result) {\n deferred.resolve(result);\n callback(null, result);\n }.bind(this),\n function(err) {\n deferred.reject(err);\n callback(err);\n });\n }\n\n return deferred.promise;\n },\n\n setItemSync: function (key, value) {\n this.data[key] = value;\n if (this.options.ttl) {\n this.ttls[key] = new Date().getTime() + this.options.ttl;\n }\n this.persistKeySync(key);\n this.log(\"set (\" + key + \": \" + this.options.stringify(value) + \")\");\n },\n\n getItem: function (key, callback) {\n callback = isFunction(callback) ? callback : noop;\n if (this.isExpired(key)) {\n this.log(key + ' has expired');\n if (this.options.interval || !this.options.continuous) {\n callback(null, null);\n return;\n }\n this.removeItem(key, function() {\n callback(null, null);\n });\n } else {\n callback(null, this.data[key]);\n return this.data[key];\n }\n },\n\n getItemSync: function (key) {\n if (this.isExpired(key)) {\n this.removeItemSync(key);\n } else {\n return this.data[key];\n }\n },\n\n removeItem: function (key, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var deferreds = [];\n\n deferreds.push(this.removePersistedKey(key));\n\n Q.all(deferreds).then(\n function() {\n delete this.data[key];\n delete this.ttls[key];\n this.log('removed: ' + key);\n callback(null, this.data);\n deferred.resolve(this.data);\n }.bind(this),\n function(err) {\n callback(err);\n deferred.reject(err);\n }\n );\n\n return deferred.promise;\n },\n\n removeItemSync: function (key) {\n this.removePersistedKeySync(key);\n delete this.data[key];\n delete this.ttls[key];\n this.log('removed: ' + key);\n },\n\n clear: function (callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var result;\n var deferreds = [];\n\n var keys = this.keys();\n for (var i = 0; i < keys.length; i++) {\n deferreds.push(this.removePersistedKey(keys[i]));\n }\n\n Q.all(deferreds).then(\n function(result) {\n this.data = {};\n this.ttls = {};\n this.changes = {};\n deferred.resolve(result);\n callback(null, result);\n }.bind(this),\n function(err) {\n deferred.reject(err);\n callback(err);\n });\n\n return deferred.promise;\n },\n\n clearSync: function () {\n var keys = this.keys(true);\n for (var i = 0; i < keys.length; i++) {\n this.removePersistedKeySync(keys[i]);\n }\n this.data = {};\n this.ttls = {};\n this.changes = {};\n },\n\n persist: function (callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var result;\n var deferreds = [];\n\n for (var key in this.data) {\n if (this.changes[key]) {\n deferreds.push(this.persistKey(key));\n }\n }\n\n Q.all(deferreds).then(\n function(result) {\n deferred.resolve(result);\n callback(null, result);\n this.log('persist done');\n }.bind(this),\n function(err) {\n deferred.reject(result);\n callback(err);\n });\n\n return deferred.promise;\n },\n\n persistSync: function () {\n for (var key in this.data) {\n if (this.changes[key]) {\n this.persistKeySync(key);\n }\n }\n this.log('persistSync done');\n },\n\n /*\n * This function triggers a key within the database to persist asynchronously.\n */\n persistKey: function (key, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var self = this;\n var options = this.options;\n var json = options.stringify(this.data[key]);\n\n var file = path.join(options.dir, key);\n var ttlFile;\n\n var deferred = Q.defer();\n var result;\n\n var fail = function(err) {\n self.changes[key] && self.changes[key].onError && self.changes[key].onError(err);\n deferred.reject(err);\n return callback(err);\n };\n\n var done = function() {\n self.changes[key] && self.changes[key].onSuccess && self.changes[key].onSuccess();\n delete self.changes[key];\n self.log(\"wrote: \" + key);\n result = {key: key, data: json, file: file};\n deferred.resolve(result);\n callback(null, result);\n };\n\n mkdirp(path.dirname(file), function(err) {\n if (err) {\n fail(err);\n }\n fs.writeFile(file, json, options.encoding, function(err) {\n if (err) {\n fail(err);\n }\n if (options.ttl) {\n ttlFile = path.join(options.ttlDir, key);\n mkdirp(path.dirname(ttlFile), function(err) {\n fs.writeFile(ttlFile, options.stringify(self.ttls[key]), options.encoding, function() {\n if (err) {\n fail(err);\n } else {\n done();\n }\n });\n });\n } else {\n done();\n }\n }.bind(this));\n });\n\n return deferred.promise;\n },\n\n persistKeySync: function (key) {\n var options = this.options;\n var file = path.join(options.dir, key);\n try {\n mkdirp.sync(path.dirname(file));\n fs.writeFileSync(file, options.stringify(this.data[key]));\n this.changes[key] && this.changes[key].onSuccess && this.changes[key].onSuccess();\n } catch (e) {\n this.changes[key] && this.changes[key].onError && this.changes[key].onError(e);\n throw e;\n }\n\n var ttlFile;\n if (options.ttl) {\n ttlFile = path.join(options.ttlDir, key);\n mkdirp.sync(path.dirname(ttlFile));\n fs.writeFileSync(ttlFile, options.stringify(this.ttls[key]));\n }\n\n delete this.changes[key];\n this.log(\"wrote: \" + key);\n },\n\n removePersistedKey: function (key, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var options = this.options;\n var deferred = Q.defer();\n var result;\n\n //check to see if key has been persisted\n var file = path.join(options.dir, key);\n fs.exists(file, function (exists) {\n if (exists) {\n fs.unlink(file, function (err) {\n result = {key: key, removed: !err, exists: true};\n\n var fail = function(err) {\n deferred.reject(err);\n callback(err);\n };\n\n var done = function() {\n deferred.resolve(result);\n callback(null, result);\n };\n\n if (err) {\n return fail(err);\n }\n\n if (options.ttl) {\n var ttlFile = path.join(options.ttlDir, key);\n fs.exists(ttlFile, function (exists) {\n if (exists) {\n fs.unlink(ttlFile, function (err) {\n if (err) {\n fail(err);\n }\n done();\n });\n } else {\n done();\n }\n });\n } else {\n done();\n }\n });\n } else {\n result = {key: key, removed: false, exists: false};\n deferred.resolve(result);\n callback(null, result);\n }\n });\n\n return deferred.promise;\n },\n\n parseString: function(str){\n try {\n return this.options.parse(str);\n } catch(e) {\n this.log(\"parse error: \", this.options.stringify(e));\n return undefined;\n }\n },\n\n parseTTLDir: function(callback) {\n return this.parseDir(this.options.ttlDir, this.parseTTLFile.bind(this), callback);\n },\n\n parseTTLDirSync: function() {\n return this.parseDirSync(this.options.ttlDir, this.ttls);\n },\n\n parseDataDir: function(callback) {\n return this.parseDir(this.options.dir, this.parseDataFile.bind(this), callback);\n },\n\n parseDataDirSync: function() {\n return this.parseDirSync(this.options.dir, this.data);\n },\n\n parseDir: function(dir, parseFn, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var deferreds = [];\n\n var result = {dir: dir};\n //check to see if dir is present\n fs.exists(dir, function (exists) {\n if (exists) {\n //load data\n fs.readdir(dir, function (err, arr) {\n if (err) {\n deferred.reject(err);\n callback(err);\n }\n\n for (var i in arr) {\n var curr = arr[i];\n if (curr[0] !== '.') {\n deferreds.push(parseFn(curr));\n }\n }\n\n Q.all(deferreds).then(\n function() {\n deferred.resolve(result);\n callback(null, result);\n },\n function(err) {\n deferred.reject(err);\n callback(err);\n });\n\n }.bind(this));\n } else {\n //create the directory\n mkdirp(dir, function (err) {\n if (err) {\n console.error(err);\n deferred.reject(err);\n callback(err);\n } else {\n this.log('created ' + dir);\n deferred.resolve(result);\n callback(null, result);\n }\n }.bind(this));\n }\n }.bind(this));\n\n return deferred.promise;\n },\n\n parseDirSync: function(dir, hash) {\n var exists = fs.existsSync(dir);\n\n if (exists) { //load data\n var arr = fs.readdirSync(dir);\n for (var i = 0; i < arr.length; i++) {\n var curr = arr[i];\n if (arr[i] && curr[0] !== '.') {\n var json = fs.readFileSync(path.join(dir, curr), this.options.encoding);\n hash[curr] = this.parseString(json);\n }\n }\n } else { //create the directory\n mkdirp.sync(dir);\n }\n },\n\n parseDataFile: function(key, callback) {\n return this.parseFile(key, this.options.dir, this.data, callback);\n },\n\n parseDataFileSync: function(key) {\n return this.parseFileSync(key, this.options.dir, this.data);\n },\n\n parseTTLFile : function(key, callback) {\n return this.parseFile(key, this.options.ttlDir, this.ttls, callback);\n },\n\n parseTTLFileSync: function(key) {\n return this.parseFileSync(key, this.options.ttlDir, this.ttls);\n },\n\n parseFile: function (key, dir, hash, callback) {\n callback = isFunction(callback) ? callback : noop;\n\n var deferred = Q.defer();\n var result;\n var file = path.join(dir, key);\n var options = this.options;\n\n fs.readFile(file, options.encoding, function (err, json) {\n if (err) {\n deferred.reject(err);\n return callback(err);\n }\n\n var value = this.parseString(json);\n\n hash[key] = value;\n\n this.log(\"loaded: \" + dir + \"/\" + key);\n\n result = {key: key, value: value, file: file};\n deferred.resolve(result);\n callback(null, result);\n\n }.bind(this));\n\n return deferred.promise;\n },\n\n parseFileSync: function(key, dir, hash) {\n var file = path.join(dir, key);\n hash[key] = fs.readFileSync(file, this.options.encoding);\n this.log(\"loaded: \" + dir + \"/\" + key);\n return hash[key];\n },\n\n isExpired: function (key) {\n if (!this.options.ttl) return false;\n return this.ttls[key] < (new Date()).getTime();\n },\n\n removePersistedKeySync: function(key) {\n var options = this.options;\n\n var file = path.join(options.dir, key);\n if (fs.existsSync(file)) {\n fs.unlinkSync(file);\n }\n if (options.ttl) {\n var ttlFile = path.join(options.ttlDir, key);\n if (fs.existsSync(ttlFile)) {\n fs.unlinkSync(ttlFile);\n }\n }\n },\n\n resolveDir: function(dir) {\n dir = path.normalize(dir);\n if (dir !== path.resolve(dir)) {\n dir = path.join(__dirname, \"storage\", dir || \"\");\n this.log(\"Made dir absolute: \" + dir);\n }\n return dir;\n },\n\n stopInterval: function () {\n clearInterval(this._persistInterval);\n },\n\n log: function () {\n this.options && this.options.logging && console.log.apply(console, arguments);\n }\n};\n\nmodule.exports = LocalStorage;\n","/*\n * Simon Last, Sept 2013\n * http://simonlast.org\n */\n\nvar LocalStorage = require('./local-storage');\n\n(function(nodePersist) {\n var localStorage;\n\n /*\n * This function just creates a localStorage instance, incase you don't plan on using the default one\n * i.e.\n * var myStorage = nodePersist.create();\n * myStorage.init(myOptions); // you still have to call init or initSync();\n */\n nodePersist.create = function (userOptions) {\n return LocalStorage(userOptions);\n };\n\n /*\n * All functions below are just helpers to use the default storage instance\n * and to maintain backward compatibility\n */\n\n\n /*\n * This function, (or init) must be called before the library can be used.\n * An options hash can be optionally passed.\n */\n nodePersist.init = function (userOptions, callback) {\n localStorage = nodePersist.create(userOptions);\n return localStorage.init(callback);\n };\n /*\n * This function, (or initSync) must be called before the library can be used.\n * An options hash can be optionally passed.\n */\n nodePersist.initSync = function (userOptions) {\n localStorage = nodePersist.create(userOptions);\n return localStorage.initSync();\n };\n\n /*\n * This function returns a key with index n in the database, or null if\n * it is not present.\n * This function runs in 0(k), where k is the number of keys in the\n * database. You probably shouldn't use it.\n */\n nodePersist.key = function (n) {\n return localStorage.key(n);\n };\n\n /*\n * This function returns an array of all the keys in the database\n *\n */\n nodePersist.keys = function () {\n return localStorage.keys();\n };\n\n /*\n * This function returns the number of keys stored in the database.\n */\n nodePersist.length = function () {\n return localStorage.length();\n };\n\n /*\n * This function iterates over each key/value pair and executes a callback\n */\n nodePersist.forEach = function(callback) {\n return localStorage.forEach(callback);\n };\n\n /*\n * This function returns all the values in the database.\n */\n nodePersist.values = function(callback) {\n return localStorage.values(callback);\n };\n\n\n nodePersist.valuesWithKeyMatch = function(match, callback) {\n return localStorage.valuesWithKeyMatch(match, callback);\n };\n\n /*\n * This function sets a key to a given value in the database.\n */\n nodePersist.setItem = function (key, value, callback) {\n return localStorage.setItem(key, value, callback);\n };\n\n /*\n * This function sets a key to a given value in the database.\n */\n nodePersist.setItemSync = function (key, value) {\n return localStorage.setItemSync(key, value);\n };\n\n /*\n * This function returns the value associated with a key in the database,\n * or undefined if it is not present.\n */\n nodePersist.getItem = function (key, callback) {\n return localStorage.getItem(key, callback);\n };\n\n nodePersist.getItemSync = function (key) {\n return localStorage.getItemSync(key);\n };\n\n /*\n * This function removes key in the database if it is present, and\n * immediately deletes it from the file system asynchronously.\n */\n nodePersist.removeItem = function (key, callback) {\n return localStorage.removeItem(key, callback);\n };\n\n /*\n * This function removes key in the database if it is present, and\n * immediately deletes it from the file system synchronously.\n */\n nodePersist.removeItemSync = function (key) {\n return localStorage.removeItemSync(key);\n };\n\n /*\n * This function removes all keys in the database, and immediately\n * deletes all keys from the file system asynchronously.\n */\n nodePersist.clear = function (callback) {\n return localStorage.clear(callback);\n };\n\n /*\n * This function removes all keys in the database, and immediately\n * deletes all keys from the file system synchronously.\n */\n nodePersist.clearSync = function () {\n return localStorage.clearSync();\n };\n\n /*\n * This function triggers the database to persist asynchronously.\n */\n nodePersist.persist = function (callback) {\n return localStorage.persist(callback);\n };\n\n /*\n * This function triggers the database to persist synchronously.\n */\n nodePersist.persistSync = function () {\n return localStorage.persistSync();\n };\n\n /*\n * This function triggers a key within the database to persist asynchronously.\n */\n nodePersist.persistKey = function (key, callback) {\n return localStorage.persistKey(key, callback);\n };\n\n /*\n * This function triggers a key within the database to persist synchronously.\n */\n nodePersist.persistKeySync = function (key) {\n return localStorage.persistKeySync(key);\n };\n\n}(module.exports));\n","var hasMap = typeof Map === 'function' && Map.prototype;\nvar mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;\nvar mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;\nvar mapForEach = hasMap && Map.prototype.forEach;\nvar hasSet = typeof Set === 'function' && Set.prototype;\nvar setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;\nvar setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;\nvar setForEach = hasSet && Set.prototype.forEach;\nvar hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;\nvar weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;\nvar hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;\nvar weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;\nvar hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;\nvar weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;\nvar booleanValueOf = Boolean.prototype.valueOf;\nvar objectToString = Object.prototype.toString;\nvar functionToString = Function.prototype.toString;\nvar $match = String.prototype.match;\nvar $slice = String.prototype.slice;\nvar $replace = String.prototype.replace;\nvar $toUpperCase = String.prototype.toUpperCase;\nvar $toLowerCase = String.prototype.toLowerCase;\nvar $test = RegExp.prototype.test;\nvar $concat = Array.prototype.concat;\nvar $join = Array.prototype.join;\nvar $arrSlice = Array.prototype.slice;\nvar $floor = Math.floor;\nvar bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;\nvar gOPS = Object.getOwnPropertySymbols;\nvar symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;\nvar hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';\n// ie, `has-tostringtag/shams\nvar toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')\n ? Symbol.toStringTag\n : null;\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\nvar gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (\n [].__proto__ === Array.prototype // eslint-disable-line no-proto\n ? function (O) {\n return O.__proto__; // eslint-disable-line no-proto\n }\n : null\n);\n\nfunction addNumericSeparator(num, str) {\n if (\n num === Infinity\n || num === -Infinity\n || num !== num\n || (num && num > -1000 && num < 1000)\n || $test.call(/e/, str)\n ) {\n return str;\n }\n var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;\n if (typeof num === 'number') {\n var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)\n if (int !== num) {\n var intStr = String(int);\n var dec = $slice.call(str, intStr.length + 1);\n return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');\n }\n }\n return $replace.call(str, sepRegex, '$&_');\n}\n\nvar utilInspect = require('./util.inspect');\nvar inspectCustom = utilInspect.custom;\nvar inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;\n\nmodule.exports = function inspect_(obj, options, depth, seen) {\n var opts = options || {};\n\n if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {\n throw new TypeError('option \"quoteStyle\" must be \"single\" or \"double\"');\n }\n if (\n has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'\n ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity\n : opts.maxStringLength !== null\n )\n ) {\n throw new TypeError('option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`');\n }\n var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;\n if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {\n throw new TypeError('option \"customInspect\", if provided, must be `true`, `false`, or `\\'symbol\\'`');\n }\n\n if (\n has(opts, 'indent')\n && opts.indent !== null\n && opts.indent !== '\\t'\n && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)\n ) {\n throw new TypeError('option \"indent\" must be \"\\\\t\", an integer > 0, or `null`');\n }\n if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {\n throw new TypeError('option \"numericSeparator\", if provided, must be `true` or `false`');\n }\n var numericSeparator = opts.numericSeparator;\n\n if (typeof obj === 'undefined') {\n return 'undefined';\n }\n if (obj === null) {\n return 'null';\n }\n if (typeof obj === 'boolean') {\n return obj ? 'true' : 'false';\n }\n\n if (typeof obj === 'string') {\n return inspectString(obj, opts);\n }\n if (typeof obj === 'number') {\n if (obj === 0) {\n return Infinity / obj > 0 ? '0' : '-0';\n }\n var str = String(obj);\n return numericSeparator ? addNumericSeparator(obj, str) : str;\n }\n if (typeof obj === 'bigint') {\n var bigIntStr = String(obj) + 'n';\n return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;\n }\n\n var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;\n if (typeof depth === 'undefined') { depth = 0; }\n if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {\n return isArray(obj) ? '[Array]' : '[Object]';\n }\n\n var indent = getIndent(opts, depth);\n\n if (typeof seen === 'undefined') {\n seen = [];\n } else if (indexOf(seen, obj) >= 0) {\n return '[Circular]';\n }\n\n function inspect(value, from, noIndent) {\n if (from) {\n seen = $arrSlice.call(seen);\n seen.push(from);\n }\n if (noIndent) {\n var newOpts = {\n depth: opts.depth\n };\n if (has(opts, 'quoteStyle')) {\n newOpts.quoteStyle = opts.quoteStyle;\n }\n return inspect_(value, newOpts, depth + 1, seen);\n }\n return inspect_(value, opts, depth + 1, seen);\n }\n\n if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable\n var name = nameOf(obj);\n var keys = arrObjKeys(obj, inspect);\n return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');\n }\n if (isSymbol(obj)) {\n var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\\(.*\\))_[^)]*$/, '$1') : symToString.call(obj);\n return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;\n }\n if (isElement(obj)) {\n var s = '<' + $toLowerCase.call(String(obj.nodeName));\n var attrs = obj.attributes || [];\n for (var i = 0; i < attrs.length; i++) {\n s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);\n }\n s += '>';\n if (obj.childNodes && obj.childNodes.length) { s += '...'; }\n s += '';\n return s;\n }\n if (isArray(obj)) {\n if (obj.length === 0) { return '[]'; }\n var xs = arrObjKeys(obj, inspect);\n if (indent && !singleLineValues(xs)) {\n return '[' + indentedJoin(xs, indent) + ']';\n }\n return '[ ' + $join.call(xs, ', ') + ' ]';\n }\n if (isError(obj)) {\n var parts = arrObjKeys(obj, inspect);\n if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {\n return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';\n }\n if (parts.length === 0) { return '[' + String(obj) + ']'; }\n return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';\n }\n if (typeof obj === 'object' && customInspect) {\n if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {\n return utilInspect(obj, { depth: maxDepth - depth });\n } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {\n return obj.inspect();\n }\n }\n if (isMap(obj)) {\n var mapParts = [];\n if (mapForEach) {\n mapForEach.call(obj, function (value, key) {\n mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));\n });\n }\n return collectionOf('Map', mapSize.call(obj), mapParts, indent);\n }\n if (isSet(obj)) {\n var setParts = [];\n if (setForEach) {\n setForEach.call(obj, function (value) {\n setParts.push(inspect(value, obj));\n });\n }\n return collectionOf('Set', setSize.call(obj), setParts, indent);\n }\n if (isWeakMap(obj)) {\n return weakCollectionOf('WeakMap');\n }\n if (isWeakSet(obj)) {\n return weakCollectionOf('WeakSet');\n }\n if (isWeakRef(obj)) {\n return weakCollectionOf('WeakRef');\n }\n if (isNumber(obj)) {\n return markBoxed(inspect(Number(obj)));\n }\n if (isBigInt(obj)) {\n return markBoxed(inspect(bigIntValueOf.call(obj)));\n }\n if (isBoolean(obj)) {\n return markBoxed(booleanValueOf.call(obj));\n }\n if (isString(obj)) {\n return markBoxed(inspect(String(obj)));\n }\n // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other\n /* eslint-env browser */\n if (typeof window !== 'undefined' && obj === window) {\n return '{ [object Window] }';\n }\n if (obj === global) {\n return '{ [object globalThis] }';\n }\n if (!isDate(obj) && !isRegExp(obj)) {\n var ys = arrObjKeys(obj, inspect);\n var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;\n var protoTag = obj instanceof Object ? '' : 'null prototype';\n var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';\n var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';\n var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');\n if (ys.length === 0) { return tag + '{}'; }\n if (indent) {\n return tag + '{' + indentedJoin(ys, indent) + '}';\n }\n return tag + '{ ' + $join.call(ys, ', ') + ' }';\n }\n return String(obj);\n};\n\nfunction wrapQuotes(s, defaultStyle, opts) {\n var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '\"' : \"'\";\n return quoteChar + s + quoteChar;\n}\n\nfunction quote(s) {\n return $replace.call(String(s), /\"/g, '"');\n}\n\nfunction isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\n\n// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives\nfunction isSymbol(obj) {\n if (hasShammedSymbols) {\n return obj && typeof obj === 'object' && obj instanceof Symbol;\n }\n if (typeof obj === 'symbol') {\n return true;\n }\n if (!obj || typeof obj !== 'object' || !symToString) {\n return false;\n }\n try {\n symToString.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isBigInt(obj) {\n if (!obj || typeof obj !== 'object' || !bigIntValueOf) {\n return false;\n }\n try {\n bigIntValueOf.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };\nfunction has(obj, key) {\n return hasOwn.call(obj, key);\n}\n\nfunction toStr(obj) {\n return objectToString.call(obj);\n}\n\nfunction nameOf(f) {\n if (f.name) { return f.name; }\n var m = $match.call(functionToString.call(f), /^function\\s*([\\w$]+)/);\n if (m) { return m[1]; }\n return null;\n}\n\nfunction indexOf(xs, x) {\n if (xs.indexOf) { return xs.indexOf(x); }\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) { return i; }\n }\n return -1;\n}\n\nfunction isMap(x) {\n if (!mapSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n mapSize.call(x);\n try {\n setSize.call(x);\n } catch (s) {\n return true;\n }\n return x instanceof Map; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakMap(x) {\n if (!weakMapHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakMapHas.call(x, weakMapHas);\n try {\n weakSetHas.call(x, weakSetHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakMap; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakRef(x) {\n if (!weakRefDeref || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakRefDeref.call(x);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isSet(x) {\n if (!setSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n setSize.call(x);\n try {\n mapSize.call(x);\n } catch (m) {\n return true;\n }\n return x instanceof Set; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakSet(x) {\n if (!weakSetHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakSetHas.call(x, weakSetHas);\n try {\n weakMapHas.call(x, weakMapHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakSet; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isElement(x) {\n if (!x || typeof x !== 'object') { return false; }\n if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {\n return true;\n }\n return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';\n}\n\nfunction inspectString(str, opts) {\n if (str.length > opts.maxStringLength) {\n var remaining = str.length - opts.maxStringLength;\n var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');\n return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;\n }\n // eslint-disable-next-line no-control-regex\n var s = $replace.call($replace.call(str, /(['\\\\])/g, '\\\\$1'), /[\\x00-\\x1f]/g, lowbyte);\n return wrapQuotes(s, 'single', opts);\n}\n\nfunction lowbyte(c) {\n var n = c.charCodeAt(0);\n var x = {\n 8: 'b',\n 9: 't',\n 10: 'n',\n 12: 'f',\n 13: 'r'\n }[n];\n if (x) { return '\\\\' + x; }\n return '\\\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));\n}\n\nfunction markBoxed(str) {\n return 'Object(' + str + ')';\n}\n\nfunction weakCollectionOf(type) {\n return type + ' { ? }';\n}\n\nfunction collectionOf(type, size, entries, indent) {\n var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');\n return type + ' (' + size + ') {' + joinedEntries + '}';\n}\n\nfunction singleLineValues(xs) {\n for (var i = 0; i < xs.length; i++) {\n if (indexOf(xs[i], '\\n') >= 0) {\n return false;\n }\n }\n return true;\n}\n\nfunction getIndent(opts, depth) {\n var baseIndent;\n if (opts.indent === '\\t') {\n baseIndent = '\\t';\n } else if (typeof opts.indent === 'number' && opts.indent > 0) {\n baseIndent = $join.call(Array(opts.indent + 1), ' ');\n } else {\n return null;\n }\n return {\n base: baseIndent,\n prev: $join.call(Array(depth + 1), baseIndent)\n };\n}\n\nfunction indentedJoin(xs, indent) {\n if (xs.length === 0) { return ''; }\n var lineJoiner = '\\n' + indent.prev + indent.base;\n return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\\n' + indent.prev;\n}\n\nfunction arrObjKeys(obj, inspect) {\n var isArr = isArray(obj);\n var xs = [];\n if (isArr) {\n xs.length = obj.length;\n for (var i = 0; i < obj.length; i++) {\n xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';\n }\n }\n var syms = typeof gOPS === 'function' ? gOPS(obj) : [];\n var symMap;\n if (hasShammedSymbols) {\n symMap = {};\n for (var k = 0; k < syms.length; k++) {\n symMap['$' + syms[k]] = syms[k];\n }\n }\n\n for (var key in obj) { // eslint-disable-line no-restricted-syntax\n if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {\n // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section\n continue; // eslint-disable-line no-restricted-syntax, no-continue\n } else if ($test.call(/[^\\w$]/, key)) {\n xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));\n } else {\n xs.push(key + ': ' + inspect(obj[key], obj));\n }\n }\n if (typeof gOPS === 'function') {\n for (var j = 0; j < syms.length; j++) {\n if (isEnumerable.call(obj, syms[j])) {\n xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));\n }\n }\n }\n return xs;\n}\n","module.exports = require('util').inspect;\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","'use strict';\n\n// modified from https://github.com/es-shims/es6-shim\nvar objectKeys = require('object-keys');\nvar hasSymbols = require('has-symbols/shams')();\nvar callBound = require('call-bind/callBound');\nvar toObject = Object;\nvar $push = callBound('Array.prototype.push');\nvar $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');\nvar originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;\n\n// eslint-disable-next-line no-unused-vars\nmodule.exports = function assign(target, source1) {\n\tif (target == null) { throw new TypeError('target must be an object'); }\n\tvar to = toObject(target); // step 1\n\tif (arguments.length === 1) {\n\t\treturn to; // step 2\n\t}\n\tfor (var s = 1; s < arguments.length; ++s) {\n\t\tvar from = toObject(arguments[s]); // step 3.a.i\n\n\t\t// step 3.a.ii:\n\t\tvar keys = objectKeys(from);\n\t\tvar getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);\n\t\tif (getSymbols) {\n\t\t\tvar syms = getSymbols(from);\n\t\t\tfor (var j = 0; j < syms.length; ++j) {\n\t\t\t\tvar key = syms[j];\n\t\t\t\tif ($propIsEnumerable(from, key)) {\n\t\t\t\t\t$push(keys, key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// step 3.a.iii:\n\t\tfor (var i = 0; i < keys.length; ++i) {\n\t\t\tvar nextKey = keys[i];\n\t\t\tif ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2\n\t\t\t\tvar propValue = from[nextKey]; // step 3.a.iii.2.a\n\t\t\t\tto[nextKey] = propValue; // step 3.a.iii.2.b\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to; // step 4\n};\n","'use strict';\n\nvar defineProperties = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind.apply(getPolyfill());\n// eslint-disable-next-line no-unused-vars\nvar bound = function assign(target, source1) {\n\treturn polyfill(Object, arguments);\n};\n\ndefineProperties(bound, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = bound;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nvar lacksProperEnumerationOrder = function () {\n\tif (!Object.assign) {\n\t\treturn false;\n\t}\n\t/*\n\t * v8, specifically in node 4.x, has a bug with incorrect property enumeration order\n\t * note: this does not detect the bug unless there's 20 characters\n\t */\n\tvar str = 'abcdefghijklmnopqrst';\n\tvar letters = str.split('');\n\tvar map = {};\n\tfor (var i = 0; i < letters.length; ++i) {\n\t\tmap[letters[i]] = letters[i];\n\t}\n\tvar obj = Object.assign({}, map);\n\tvar actual = '';\n\tfor (var k in obj) {\n\t\tactual += k;\n\t}\n\treturn str !== actual;\n};\n\nvar assignHasPendingExceptions = function () {\n\tif (!Object.assign || !Object.preventExtensions) {\n\t\treturn false;\n\t}\n\t/*\n\t * Firefox 37 still has \"pending exception\" logic in its Object.assign implementation,\n\t * which is 72% slower than our shim, and Firefox 40's native implementation.\n\t */\n\tvar thrower = Object.preventExtensions({ 1: 2 });\n\ttry {\n\t\tObject.assign(thrower, 'xy');\n\t} catch (e) {\n\t\treturn thrower[1] === 'y';\n\t}\n\treturn false;\n};\n\nmodule.exports = function getPolyfill() {\n\tif (!Object.assign) {\n\t\treturn implementation;\n\t}\n\tif (lacksProperEnumerationOrder()) {\n\t\treturn implementation;\n\t}\n\tif (assignHasPendingExceptions()) {\n\t\treturn implementation;\n\t}\n\treturn Object.assign;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\nmodule.exports = function shimAssign() {\n\tvar polyfill = getPolyfill();\n\tdefine(\n\t\tObject,\n\t\t{ assign: polyfill },\n\t\t{ assign: function () { return Object.assign !== polyfill; } }\n\t);\n\treturn polyfill;\n};\n","//through@2 handles this by default!\nmodule.exports = require('through')\n\n","const net = require('net');\nconst debug = require('debug')('pick-port');\nconst warn = require('debug')('pick-port:WARN');\nconst tcp = require('./lib/tcp');\nconst udp = require('./lib/udp');\n\n/* eslint-disable no-console */\ndebug.log = console.debug.bind(console);\nwarn.log = console.warn.bind(console);\n/* eslint-enable no-console */\n\n// Store picked ports for the specified reserveTimeout time.\n// This Set stores strings with the form \"type:ip:port\".\nconst reserved = new Set();\n\nmodule.exports = async function(\n\t{\n\t\ttype = 'udp',\n\t\tip = '0.0.0.0',\n\t\tminPort = 10000,\n\t\tmaxPort = 20000,\n\t\treserveTimeout = 5\n\t} = {}\n)\n{\n\tdebug(\n\t\t'called with [type:%s, ip:%s, minPort:%d, maxPort:%d, reserveTimeout:%d]',\n\t\ttype, ip, minPort, maxPort, reserveTimeout);\n\n\t// Sanity checks.\n\ttype = type.toLowerCase();\n\n\tconst family = net.isIP(ip);\n\n\tif (type !== 'udp' && type !== 'tcp')\n\t\tthrow new TypeError('invalid type parameter');\n\n\tif (family !== 4 && family !== 6)\n\t\tthrow new TypeError('invalid ip parameter');\n\n\tif (typeof minPort !== 'number' || typeof maxPort !== 'number' || minPort > maxPort)\n\t\tthrow new TypeError('invalid minPort/maxPort parameter');\n\n\tif (typeof reserveTimeout !== 'number')\n\t\tthrow new TypeError('invalid reserveTimeout parameter');\n\n\tconst handle = type === 'udp'? udp : tcp;\n\n\t// Take a random port in the range.\n\tlet port = Math.floor(Math.random() * ((maxPort + 1) - minPort)) + minPort;\n\tlet retries = maxPort - minPort + 1;\n\n\twhile (--retries >= 0)\n\t{\n\t\t// Keep the port within the range.\n\t\tif (++port > maxPort)\n\t\t\tport = minPort;\n\n\t\t// If current port is reserved, try next one.\n\t\tif (isReserved({ type, ip, port }))\n\t\t\tcontinue;\n\n\t\ttry\n\t\t{\n\t\t\tawait handle({ ip, port, family });\n\n\t\t\treserve({ type, ip, port, reserveTimeout });\n\n\t\t\tdebug('got an available port [type:%s, ip:%s, port:%d]', type, ip, port);\n\n\t\t\treturn port;\n\t\t}\n\t\tcatch (error)\n\t\t{\n\t\t\tif (error.code === 'EADDRINUSE')\n\t\t\t{\n\t\t\t\tdebug('port in use [type:%s, ip:%s, port:%d]', type, ip, port);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twarn(\n\t\t\t\t\t'could not get any available port [type:%s, ip:%s, port:%d]: %s',\n\t\t\t\t\ttype, ip, port, error.toString());\n\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('no port available');\n};\n\nfunction reserve({ type, ip, port, reserveTimeout })\n{\n\tconst value = `${type}:${ip}:${port}`;\n\n\treserved.add(value);\n\n\tsetTimeout(() => reserved.delete(value), reserveTimeout * 1000);\n}\n\nfunction isReserved({ type, ip, port })\n{\n\tconst value = `${type}:${ip}:${port}`;\n\n\treturn reserved.has(value);\n}\n","const net = require('net');\n\nmodule.exports = async function({ ip, port })\n{\n\tconst server = net.createServer();\n\n\treturn new Promise((resolve, reject) =>\n\t{\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.listen({ port, exclusive: true }, ip, () => server.close(resolve));\n\t});\n};\n","const dgram = require('dgram');\n\nmodule.exports = async function({ ip, port, family })\n{\n\tconst server = dgram.createSocket(family === 4 ? 'udp4' : 'udp6');\n\n\treturn new Promise((resolve, reject) =>\n\t{\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.bind({ port, exclusive: true }, ip, () => server.close(resolve));\n\t});\n};\n","'use strict';\n\n/** @type {import('.')} */\nmodule.exports = [\n\t'Float32Array',\n\t'Float64Array',\n\t'Int8Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'BigInt64Array',\n\t'BigUint64Array'\n];\n","// vim:ts=4:sts=4:sw=4:\n/*!\n *\n * Copyright 2009-2012 Kris Kowal under the terms of the MIT\n * license found at http://github.com/kriskowal/q/raw/master/LICENSE\n *\n * With parts by Tyler Close\n * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found\n * at http://www.opensource.org/licenses/mit-license.html\n * Forked at ref_send.js version: 2009-05-11\n *\n * With parts by Mark Miller\n * Copyright (C) 2011 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n(function (definition) {\n \"use strict\";\n\n // This file will function properly as a