//#region \0rolldown/runtime.js var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => { if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, { get: ((e) => i[e]).bind(null, d), enumerable: !(s = n(i, d)) || s.enumerable }); return e; }, c = /* @__PURE__ */ ((n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", { value: n, enumerable: !0 }) : a, n)))((/* @__PURE__ */ o(((e, t) => { var n = Object.prototype.hasOwnProperty, r = "~"; function i() {} Object.create && (i.prototype = Object.create(null), new i().__proto__ || (r = !1)); function a(e, t, n) { this.fn = e, this.context = t, this.once = n || !1; } function o(e, t, n, i, o) { if (typeof n != "function") throw TypeError("The listener must be a function"); var s = new a(n, i || e, o), c = r ? r + t : t; return e._events[c] ? e._events[c].fn ? e._events[c] = [e._events[c], s] : e._events[c].push(s) : (e._events[c] = s, e._eventsCount++), e; } function s(e, t) { --e._eventsCount === 0 ? e._events = new i() : delete e._events[t]; } function c() { this._events = new i(), this._eventsCount = 0; } c.prototype.eventNames = function() { var e = [], t, i; if (this._eventsCount === 0) return e; for (i in t = this._events) n.call(t, i) && e.push(r ? i.slice(1) : i); return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e; }, c.prototype.listeners = function(e) { var t = r ? r + e : e, n = this._events[t]; if (!n) return []; if (n.fn) return [n.fn]; for (var i = 0, a = n.length, o = Array(a); i < a; i++) o[i] = n[i].fn; return o; }, c.prototype.listenerCount = function(e) { var t = r ? r + e : e, n = this._events[t]; return n ? n.fn ? 1 : n.length : 0; }, c.prototype.emit = function(e, t, n, i, a, o) { var s = r ? r + e : e; if (!this._events[s]) return !1; var c = this._events[s], l = arguments.length, u, d; if (c.fn) { switch (c.once && this.removeListener(e, c.fn, void 0, !0), l) { case 1: return c.fn.call(c.context), !0; case 2: return c.fn.call(c.context, t), !0; case 3: return c.fn.call(c.context, t, n), !0; case 4: return c.fn.call(c.context, t, n, i), !0; case 5: return c.fn.call(c.context, t, n, i, a), !0; case 6: return c.fn.call(c.context, t, n, i, a, o), !0; } for (d = 1, u = Array(l - 1); d < l; d++) u[d - 1] = arguments[d]; c.fn.apply(c.context, u); } else { var f = c.length, p; for (d = 0; d < f; d++) switch (c[d].once && this.removeListener(e, c[d].fn, void 0, !0), l) { case 1: c[d].fn.call(c[d].context); break; case 2: c[d].fn.call(c[d].context, t); break; case 3: c[d].fn.call(c[d].context, t, n); break; case 4: c[d].fn.call(c[d].context, t, n, i); break; default: if (!u) for (p = 1, u = Array(l - 1); p < l; p++) u[p - 1] = arguments[p]; c[d].fn.apply(c[d].context, u); } } return !0; }, c.prototype.on = function(e, t, n) { return o(this, e, t, n, !1); }, c.prototype.once = function(e, t, n) { return o(this, e, t, n, !0); }, c.prototype.removeListener = function(e, t, n, i) { var a = r ? r + e : e; if (!this._events[a]) return this; if (!t) return s(this, a), this; var o = this._events[a]; if (o.fn) o.fn === t && (!i || o.once) && (!n || o.context === n) && s(this, a); else { for (var c = 0, l = [], u = o.length; c < u; c++) (o[c].fn !== t || i && !o[c].once || n && o[c].context !== n) && l.push(o[c]); l.length ? this._events[a] = l.length === 1 ? l[0] : l : s(this, a); } return this; }, c.prototype.removeAllListeners = function(e) { var t; return e ? (t = r ? r + e : e, this._events[t] && s(this, t)) : (this._events = new i(), this._eventsCount = 0), this; }, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = r, c.EventEmitter = c, t !== void 0 && (t.exports = c); })))(), 1), l = /* @__PURE__ */ function(e) { return e[e.Off = 0] = "Off", e[e.Error = 1] = "Error", e[e.Warn = 2] = "Warn", e[e.Info = 3] = "Info", e[e.Debug = 4] = "Debug", e[e.Trace = 5] = "Trace", e; }({}), u = class { timestamp; logMessage; logLevel; constructor(e, t) { let n = /* @__PURE__ */ new Date(), r = n.getHours(), i = n.getMinutes(), a = n.getSeconds(); this.timestamp = `${r}:${i}:${a}`, this.logMessage = e, this.logLevel = t; } get Message() { return this.logMessage; } get LogLevel() { return this.logLevel; } get Timestamp() { return this.timestamp; } get FormattedMessage() { return `${l[this.logLevel]} : ${this.timestamp} : ${this.logMessage}`; } }, d = class e extends c.default { static sLogger = void 0; maximumConsoleLogLevel = 0; maximumEventLogLevel = 0; static get Logger() { return e.sLogger === void 0 && (e.sLogger = new e()), this.sLogger; } constructor() { super(); } get MaximumConsoleLogLevel() { return this.maximumConsoleLogLevel; } set MaximumConsoleLogLevel(e) { this.maximumConsoleLogLevel = e; } get MaximumEventLogLevel() { return this.maximumEventLogLevel; } set MaximumEventLogLevel(e) { this.maximumEventLogLevel = e; } Error(e) { this.AddLogMessage(e, 1); } Warn(e) { this.AddLogMessage(e, 2); } Info(e) { this.AddLogMessage(e, 3); } Debug(e) { this.AddLogMessage(e, 4); } Trace(e) { this.AddLogMessage(e, 5); } AddLogMessage(e, t) { if (t > this.maximumEventLogLevel && t > this.maximumConsoleLogLevel) return; let n = new u(e, t); t <= this.maximumConsoleLogLevel && console.log(n.FormattedMessage), t <= this.maximumEventLogLevel && this.emit("log", n); } }, f = class extends Error { get ErrorClass() { return this._errorClass; } get InnerError() { return this._innerError; } get Id() { return this._messageId; } get ErrorMessage() { return { Error: { Id: this.Id, ErrorCode: this.ErrorClass, ErrorMessage: this.message } }; } static LogAndError(e, t, n, r = 0) { return t.Error(n), new e(n, r); } static FromError(e) { switch (e.ErrorCode) { case T.ERROR_DEVICE: return new m(e.ErrorMessage, e.Id); case T.ERROR_INIT: return new p(e.ErrorMessage, e.Id); case T.ERROR_UNKNOWN: return new _(e.ErrorMessage, e.Id); case T.ERROR_PING: return new g(e.ErrorMessage, e.Id); case T.ERROR_MSG: return new h(e.ErrorMessage, e.Id); default: throw Error(`Message type ${e.ErrorCode} not handled`); } } _errorClass; _innerError; _messageId; constructor(e, t, n = 0, r) { super(e), this._errorClass = t, this._innerError = r, this._messageId = n; } }, p = class extends f { constructor(e, t = 0) { super(e, T.ERROR_INIT, t); } }, m = class extends f { constructor(e, t = 0) { super(e, T.ERROR_DEVICE, t); } }, h = class extends f { constructor(e, t = 0) { super(e, T.ERROR_MSG, t); } }, g = class extends f { constructor(e, t = 0) { super(e, T.ERROR_PING, t); } }, _ = class extends f { constructor(e, t = 0) { super(e, T.ERROR_UNKNOWN, t); } }, v = 0, y = 1, b = 4294967295, x = 4, S = 0; function C(e) { for (let [t, n] of Object.entries(e)) if (n != null) return n.Id; throw new h(`Message ${e} does not have an ID.`); } function w(e, t) { for (let [n, r] of Object.entries(e)) if (r != null) { r.Id = t; return; } throw new h(`Message ${e} does not have an ID.`); } var T = /* @__PURE__ */ function(e) { return e[e.ERROR_UNKNOWN = 0] = "ERROR_UNKNOWN", e[e.ERROR_INIT = 1] = "ERROR_INIT", e[e.ERROR_PING = 2] = "ERROR_PING", e[e.ERROR_MSG = 3] = "ERROR_MSG", e[e.ERROR_DEVICE = 4] = "ERROR_DEVICE", e; }({}), E = /* @__PURE__ */ function(e) { return e.Unknown = "Unknown", e.Vibrate = "Vibrate", e.Rotate = "Rotate", e.Oscillate = "Oscillate", e.Constrict = "Constrict", e.Inflate = "Inflate", e.Position = "Position", e.HwPositionWithDuration = "HwPositionWithDuration", e.Temperature = "Temperature", e.Spray = "Spray", e.Led = "Led", e; }({}), D = /* @__PURE__ */ function(e) { return e.Unknown = "Unknown", e.Battery = "Battery", e.RSSI = "RSSI", e.Button = "Button", e.Pressure = "Pressure", e; }({}), O = /* @__PURE__ */ function(e) { return e.Read = "Read", e.Subscribe = "Subscribe", e.Unsubscribe = "Unsubscribe", e; }({}), k = class extends c.default { _device; _feature; _sendClosure; constructor(e, t, n) { super(), this._device = e, this._feature = t, this._sendClosure = n; } send = async (e) => await this._sendClosure(e); sendMsgExpectOk = async (e) => { let t = await this.send(e); if (t.Ok === void 0) throw t.Error === void 0 ? new h("Expected Ok or Error, and didn't get either!") : f.FromError(t); }; isOutputValid(e) { if (this._feature.Output !== void 0 && !this._feature.Output.hasOwnProperty(e)) throw new m(`Feature index ${this._feature.FeatureIndex} does not support type ${e} for device ${this._device.name}`); } isInputValid(e) { if (this._feature.Input !== void 0 && !this._feature.Input.hasOwnProperty(e)) throw new m(`Feature index ${this._feature.FeatureIndex} does not support type ${e} for device ${this._device.name}`); } valueRange(e) { return Object.freeze([e[0], e[1]]); } createOutputInfo(e, t) { let n = Array.isArray(t.Duration) ? this.valueRange(t.Duration) : void 0; return Object.freeze({ type: e, valueRange: this.valueRange(t.Value), ...n === void 0 ? {} : { durationRange: n } }); } createInputInfo(e, t) { return Object.freeze({ type: e, valueRange: this.valueRange(t.Value), commands: Object.freeze([...t.Command]) }); } async sendOutputCmd(e) { this.isOutputValid(e.outputType); let t = e.outputType, n = this._feature.Output[t], r; if (t == E.HwPositionWithDuration) { if (e.duration === void 0) throw new m("PositionWithDuration requires duration defined"); if (r = e.duration, n.Duration !== void 0 && (r < n.Duration[0] || r > n.Duration[1])) throw new m(`Duration value ${r} is not in the range ${n.Duration[0]} <= x <= ${n.Duration[1]}`); } let i, [a, o] = n.Value; if (e.percent === void 0) { if (e.value === void 0) throw new m(`${e.outputType} requires value defined`); i = e.value; } else i = Math.ceil(a + (o - a) * e.percent); if (i < a || i > o) throw new m(`${e.outputType} value ${i} is not in the range ${a} <= x <= ${o}`); let s = { Value: i, Duration: r }, c = {}; c[t.toString()] = s; let l = { OutputCmd: { Id: 1, DeviceIndex: this._device.index, FeatureIndex: this._feature.FeatureIndex, Command: c } }; await this.sendMsgExpectOk(l); } get index() { return this._feature.FeatureIndex; } get descriptor() { return this._feature.FeatureDescriptor; } get featureDescriptor() { return this.descriptor; } get outputs() { let e = /* @__PURE__ */ new Map(); if (this._feature.Output !== void 0) for (let [t, n] of Object.entries(this._feature.Output)) e.set(t, this.createOutputInfo(t, n)); return e; } get inputs() { let e = /* @__PURE__ */ new Map(); if (this._feature.Input !== void 0) for (let [t, n] of Object.entries(this._feature.Input)) e.set(t, this.createInputInfo(t, n)); return e; } output(e) { let t = this._feature.Output?.[e]; if (t !== void 0) return this.createOutputInfo(e, t); } input(e) { let t = this._feature.Input?.[e]; if (t !== void 0) return this.createInputInfo(e, t); } inputReadingsFromMessage(e) { if (e.FeatureIndex !== this._feature.FeatureIndex) return []; let t = []; for (let [n, r] of Object.entries(e.Reading)) t.push(Object.freeze({ device: this._device, feature: this, inputType: n, value: r.Value })); return t; } emitInputReading(e) { let t = this.inputReadingsFromMessage(e); for (let e of t) this.emit("inputreading", e); return t; } hasOutput(e) { return this._feature.Output === void 0 ? !1 : this._feature.Output.hasOwnProperty(e.toString()); } hasInput(e) { return this._feature.Input === void 0 ? !1 : this._feature.Input.hasOwnProperty(e.toString()); } async runOutput(e) { if (this._feature.Output !== void 0 && this._feature.Output.hasOwnProperty(e.outputType.toString())) return this.sendOutputCmd(e); throw new m(`Output type ${e.outputType} not supported by feature.`); } async runInput(e, t) { this.isInputValid(e); let n = this._feature.Input[e]; if (t === O.Unsubscribe && !n.Command.includes(O.Subscribe) && !n.Command.includes(t)) throw new m(`${e} does not support command ${t}`); let r = { InputCmd: { Id: 1, DeviceIndex: this._device.index, FeatureIndex: this._feature.FeatureIndex, Type: e, Command: t } }; if (t == O.Read) { let t = await this.send(r); if (t.InputReading !== void 0) { let n = this.inputReadingsFromMessage(t.InputReading).find((t) => t.inputType === e); if (n === void 0) throw new h(`Expected ${e} reading, and didn't get one.`); return n; } else if (t.Error !== void 0) throw f.FromError(t); else throw new h("Expected InputReading or Error, and didn't get either!"); } else await this.sendMsgExpectOk(r); } }, A = class e extends c.default { _deviceInfo; _sendClosure; _features; get name() { return this._deviceInfo.DeviceName; } get displayName() { return this._deviceInfo.DeviceDisplayName; } get index() { return this._deviceInfo.DeviceIndex; } get messageTimingGap() { return this._deviceInfo.DeviceMessageTimingGap; } get features() { return new Map(this._features); } static fromMsg(t, n) { return new e(t, n); } constructor(e, t) { super(), this._deviceInfo = e, this._sendClosure = t, this._features = new Map(Object.entries(e.DeviceFeatures).map(([e, n]) => [parseInt(e), new k(this, n, t)])); } async send(e) { return await this._sendClosure(e); } sendMsgExpectOk = async (e) => { let t = await this.send(e); if (t.Ok === void 0 && t.Error !== void 0) throw f.FromError(t); }; isOutputValid(e, t) { if (!this._deviceInfo.DeviceFeatures.hasOwnProperty(e)) throw new m(`Feature index ${e} does not exist for device ${this.name}`); if (this._deviceInfo.DeviceFeatures[e].Output !== void 0 && !this._deviceInfo.DeviceFeatures[e].Output.hasOwnProperty(t)) throw new m(`Feature index ${e} does not support type ${t} for device ${this.name}`); } hasOutput(e) { return this._features.values().some((t) => t.hasOutput(e)); } hasInput(e) { return this._features.values().some((t) => t.hasInput(e)); } async runOutput(e) { let t = []; for (let n of this._features.values()) n.hasOutput(e.outputType) && t.push(n.runOutput(e)); if (t.length == 0) return Promise.reject(`No features with output type ${e.outputType}`); await Promise.all(t); } async stop() { await this.sendMsgExpectOk({ StopCmd: { Id: 1, DeviceIndex: this.index, FeatureIndex: void 0, Inputs: !0, Outputs: !0 } }); } async battery() { for (let e of this._features.values()) if (e.hasInput(D.Battery)) { let t = await e.runInput(D.Battery, O.Read); if (t === void 0) throw new h("Got incorrect message back."); return t.value; } throw new m("No battery present on this device."); } emitInputReading(e) { let t = this._features.get(e.FeatureIndex); if (t === void 0) return []; let n = t.emitInputReading(e); for (let e of n) this.emit("inputreading", e); return n; } emitDisconnected() { this.emit("deviceremoved"); } }, j = class { _useCounter; _counter = 1; _waitingMsgs = /* @__PURE__ */ new Map(); constructor(e) { this._useCounter = e; } PrepareOutgoingMessage(e) { this._useCounter && (w(e, this._counter), this._counter += 1); let t, n, r = new Promise((e, r) => { t = e, n = r; }); return this._waitingMsgs.set(C(e), [t, n]), r; } ParseIncomingMessages(e) { let t = []; for (let n of e) { let e = C(n); if (e !== 0 && this._waitingMsgs.has(e)) { let [t, r] = this._waitingMsgs.get(e); if (n.Error !== void 0) { r(f.FromError(n.Error)); continue; } t(n); continue; } else t.push(n); } return t; } }, M = class extends f { constructor(e) { super(e, T.ERROR_UNKNOWN); } }, N = class extends c.default { _pingTimer = null; _connector = null; _devices = /* @__PURE__ */ new Map(); _clientName; _logger = d.Logger; _isScanning = !1; _serverInfo; _sorter = new j(!0); constructor(e = "Generic Buttplug Client") { super(), this._clientName = e, this._logger.Debug(`ButtplugClient: Client ${e} created.`); } get connected() { return this._connector !== null && this._connector.Connected; } get devices() { return this.checkConnector(), new Map(this._devices); } get isScanning() { return this._isScanning; } get serverInfo() { return this._serverInfo; } connect = async (e) => { this._logger.Info(`ButtplugClient: Connecting using ${e.constructor.name}`), await e.connect(), this._connector = e, this._connector.addListener("message", this.parseMessages), this._connector.addListener("disconnect", this.disconnectHandler), await this.initializeConnection(); }; disconnect = async () => { this._logger.Debug("ButtplugClient: Disconnect called"), this._devices.clear(), this.checkConnector(), await this.shutdownConnection(), await this._connector.disconnect(), this._serverInfo = void 0; }; startScanning = async () => { this._logger.Debug("ButtplugClient: StartScanning called"), this._isScanning = !0, await this.sendMsgExpectOk({ StartScanning: { Id: 1 } }); }; stopScanning = async () => { this._logger.Debug("ButtplugClient: StopScanning called"), this._isScanning = !1, await this.sendMsgExpectOk({ StopScanning: { Id: 1 } }); }; stopAllDevices = async () => { this._logger.Debug("ButtplugClient: StopCmd (all devices)"), await this.sendMsgExpectOk({ StopCmd: { Id: 1, DeviceIndex: void 0, FeatureIndex: void 0, Inputs: !0, Outputs: !0 } }); }; disconnectHandler = () => { this._logger.Info("ButtplugClient: Disconnect event receieved."), this.emit("disconnect"); }; parseMessages = (e) => { let t = this._sorter.ParseIncomingMessages(e); for (let e of t) if (e.DeviceList !== void 0) { this.parseDeviceList(e.DeviceList); break; } else if (e.ScanningFinished !== void 0) this._isScanning = !1, this.emit("scanningfinished", e); else if (e.InputReading !== void 0) { let t = this._devices.get(e.InputReading.DeviceIndex); if (t !== void 0) for (let n of t.emitInputReading(e.InputReading)) this.emit("inputreading", n); } else console.log(`Unhandled message: ${e}`); }; initializeConnection = async () => { this.checkConnector(); let e = await this.sendMessage({ RequestServerInfo: { ClientName: this._clientName, Id: 1, ProtocolVersionMajor: 4, ProtocolVersionMinor: 0 } }); if (e.ServerInfo !== void 0) { let t = e.ServerInfo; return this._serverInfo = Object.freeze({ serverName: t.ServerName, maxPingTime: t.MaxPingTime, protocolVersionMajor: t.ProtocolVersionMajor, protocolVersionMinor: t.ProtocolVersionMinor }), this._logger.Info(`ButtplugClient: Connected to Server ${t.ServerName}`), t.MaxPingTime, await this.requestDeviceList(), !0; } else if (e.Error !== void 0) { await this._connector.disconnect(); let t = e.Error; throw f.LogAndError(p, this._logger, `Cannot connect to server. ${t.ErrorMessage}`); } return !1; }; parseDeviceList = (e) => { for (let [t, n] of Object.entries(e.Devices)) if (this._devices.has(n.DeviceIndex)) this._logger.Debug(`ButtplugClient: Device already added: ${n}`); else { let e = A.fromMsg(n, this.sendMessageClosure); this._logger.Debug(`ButtplugClient: Adding Device: ${e}`), this._devices.set(n.DeviceIndex, e), this.emit("deviceadded", e); } for (let [t, n] of this._devices.entries()) e.Devices.hasOwnProperty(t.toString()) || (this._devices.delete(t), this.emit("deviceremoved", n)); }; requestDeviceList = async () => { this.checkConnector(), this._logger.Debug("ButtplugClient: ReceiveDeviceList called"); let e = await this.sendMessage({ RequestDeviceList: { Id: 1 } }); this.parseDeviceList(e.DeviceList); }; shutdownConnection = async () => { await this.stopAllDevices(), this._pingTimer !== null && (clearInterval(this._pingTimer), this._pingTimer = null); }; async sendMessage(e) { this.checkConnector(); let t = this._sorter.PrepareOutgoingMessage(e); return await this._connector.send(e), await t; } checkConnector() { if (!this.connected) throw new M("ButtplugClient not connected"); } sendMsgExpectOk = async (e) => { let t = await this.sendMessage(e); if (t.Ok === void 0) throw t.Error === void 0 ? f.LogAndError(h, this._logger, `Message ${t} not handled by SendMsgExpectOk`) : f.FromError(t); }; sendMessageClosure = async (e) => await this.sendMessage(e); }, P = class extends c.default { _url; _ws; _websocketConstructor = null; constructor(e) { super(), this._url = e; } get Connected() { return this._ws !== void 0; } connect = async () => new Promise((e, t) => { let n = new (this._websocketConstructor ?? WebSocket)(this._url), r = (e) => { t(new M(`WebSocket connection failed to ${this._url}`)); }, i = (e) => { t(new M(e.reason || `WebSocket closed before connection to ${this._url} was established`)); }; n.addEventListener("open", async () => { this._ws = n; try { await this.initialize(), this._ws.addEventListener("message", (e) => { this.parseIncomingMessage(e); }), this._ws.removeEventListener("close", i), this._ws.removeEventListener("error", r), this._ws.addEventListener("close", this.disconnect), e(); } catch (e) { t(e); } }), n.addEventListener("error", r), n.addEventListener("close", i); }); disconnect = async () => { this.Connected && (this._ws.close(), this._ws = void 0, this.emit("disconnect")); }; sendMessage(e) { if (!this.Connected) throw Error("ButtplugBrowserWebsocketConnector not connected"); this._ws.send("[" + JSON.stringify(e) + "]"); } initialize = async () => Promise.resolve(); parseIncomingMessage(e) { if (typeof e.data == "string") { let t = JSON.parse(e.data); this.emit("message", t); } else e.data instanceof Blob; } onReaderLoad(e) { let t = JSON.parse(e.target.result); this.emit("message", t); } }, F = class extends P { send = (e) => { if (!this.Connected) throw Error("ButtplugClient not connected"); this.sendMessage(e); }; }, I = (/* @__PURE__ */ o(((e, t) => { t.exports = function() { throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object"); }; })))(), L = class extends F { _websocketConstructor = I.WebSocket; }, R = class e { _percent; _value; get percent() { return this._percent; } get value() { return this._value; } static createValue(t) { if (!Number.isFinite(t)) throw new m(`Output value ${t} is not finite`); let n = new e(); return n._value = t, n; } static createPercent(t) { if (t < 0 || t > 1) throw new m(`Percent value ${t} is not in the range 0.0 <= x <= 1.0`); let n = new e(); return n._percent = t, n; } }, z = class e { _outputType; _value; _duration; constructor(e, t, n) { this._outputType = e, this._value = t, this._duration = n; } static createValue(t, n, r) { return new e(t, R.createValue(n), r); } static createPercent(t, n, r) { return new e(t, R.createPercent(n), r); } get outputType() { return this._outputType; } get value() { return this._value.value; } get percent() { return this._value.percent; } get duration() { return this._duration; } }, B = class { _outputType; constructor(e) { this._outputType = e; } value(e) { return z.createValue(this._outputType, e); } steps(e) { return this.value(e); } percent(e) { return z.createPercent(this._outputType, e); } }, V = class { value(e, t) { return z.createValue(E.HwPositionWithDuration, e, t); } steps(e, t) { return this.value(e, t); } percent(e, t) { return z.createPercent(E.HwPositionWithDuration, e, t); } }, H = class { constructor() {} static get Vibrate() { return new B(E.Vibrate); } static get Rotate() { return new B(E.Rotate); } static get Oscillate() { return new B(E.Oscillate); } static get Constrict() { return new B(E.Constrict); } static get Inflate() { return new B(E.Inflate); } static get Temperature() { return new B(E.Temperature); } static get Led() { return new B(E.Led); } static get Spray() { return new B(E.Spray); } static get Position() { return new B(E.Position); } static get PositionWithDuration() { return new V(); } static get HwPositionWithDuration() { return new V(); } }; //#endregion export { F as ButtplugBrowserWebsocketClientConnector, N as ButtplugClient, M as ButtplugClientConnectorException, A as ButtplugClientDevice, m as ButtplugDeviceError, f as ButtplugError, p as ButtplugInitError, l as ButtplugLogLevel, d as ButtplugLogger, h as ButtplugMessageError, L as ButtplugNodeWebsocketClientConnector, g as ButtplugPingError, _ as ButtplugUnknownError, y as DEFAULT_MESSAGE_ID, H as DeviceOutput, z as DeviceOutputCommand, V as DeviceOutputPositionWithDurationConstructor, B as DeviceOutputValueConstructor, T as ErrorClass, O as InputCommandType, D as InputType, u as LogMessage, b as MAX_ID, x as MESSAGE_SPEC_VERSION_MAJOR, S as MESSAGE_SPEC_VERSION_MINOR, E as OutputType, v as SYSTEM_MESSAGE_ID, C as msgId, w as setMsgId };