buttplug 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarnrc.yml +4 -0
- package/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/dist/main/src/client/ButtplugClientDevice.js +4 -3
- package/dist/main/src/client/ButtplugClientDevice.js.map +1 -1
- package/dist/main/src/client/Client.js +5 -4
- package/dist/main/src/client/Client.js.map +1 -1
- package/dist/main/src/core/MessageUtils.d.ts +1 -0
- package/dist/main/src/core/MessageUtils.js +7 -1
- package/dist/main/src/core/MessageUtils.js.map +1 -1
- package/dist/web/buttplug.js +6 -6
- package/dist/web/buttplug.mjs +398 -394
- package/dist/web/core/MessageUtils.d.ts +1 -0
- package/package.json +21 -21
- package/src/client/ButtplugClientDevice.ts +4 -3
- package/src/client/Client.ts +5 -4
- package/src/core/MessageUtils.ts +8 -0
- package/src/utils/ButtplugBrowserWebsocketConnector.ts +25 -28
- package/util/convert_device_config.js +0 -6
package/dist/web/buttplug.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
1
|
+
var rt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function Dt(r) {
|
|
3
3
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
5
|
+
var at = { exports: {} };
|
|
6
6
|
(function(r) {
|
|
7
7
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
8
8
|
function n() {
|
|
@@ -112,9 +112,9 @@ var ot = { exports: {} };
|
|
|
112
112
|
var p;
|
|
113
113
|
return v ? (p = t ? t + v : v, this._events[p] && a(this, p)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
114
114
|
}, f.prototype.off = f.prototype.removeListener, f.prototype.addListener = f.prototype.on, f.prefixed = t, f.EventEmitter = f, r.exports = f;
|
|
115
|
-
})(
|
|
116
|
-
var
|
|
117
|
-
const
|
|
115
|
+
})(at);
|
|
116
|
+
var Nt = at.exports;
|
|
117
|
+
const ve = /* @__PURE__ */ Dt(Nt);
|
|
118
118
|
/*!
|
|
119
119
|
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
120
120
|
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
@@ -122,8 +122,8 @@ const ye = /* @__PURE__ */ It(Rt);
|
|
|
122
122
|
*
|
|
123
123
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
124
124
|
*/
|
|
125
|
-
var
|
|
126
|
-
class
|
|
125
|
+
var ct = /* @__PURE__ */ ((r) => (r[r.Off = 0] = "Off", r[r.Error = 1] = "Error", r[r.Warn = 2] = "Warn", r[r.Info = 3] = "Info", r[r.Debug = 4] = "Debug", r[r.Trace = 5] = "Trace", r))(ct || {});
|
|
126
|
+
class Tt {
|
|
127
127
|
/**
|
|
128
128
|
* @param logMessage Log message.
|
|
129
129
|
* @param logLevel: Log severity level.
|
|
@@ -154,10 +154,10 @@ class Dt {
|
|
|
154
154
|
* Returns a formatted string with timestamp, level, and message.
|
|
155
155
|
*/
|
|
156
156
|
get FormattedMessage() {
|
|
157
|
-
return `${
|
|
157
|
+
return `${ct[this.logLevel]} : ${this.timestamp} : ${this.logMessage}`;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
const
|
|
160
|
+
const ut = class le extends ve {
|
|
161
161
|
/**
|
|
162
162
|
* Constructor. Can only be called internally since we regulate ButtplugLogger
|
|
163
163
|
* ownership.
|
|
@@ -170,7 +170,7 @@ const ct = class pe extends ye {
|
|
|
170
170
|
* doesn't currently exist.
|
|
171
171
|
*/
|
|
172
172
|
static get Logger() {
|
|
173
|
-
return
|
|
173
|
+
return le.sLogger === void 0 && (le.sLogger = new le()), this.sLogger;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* Set the maximum log level to output to console.
|
|
@@ -253,17 +253,17 @@ const ct = class pe extends ye {
|
|
|
253
253
|
AddLogMessage(e, t) {
|
|
254
254
|
if (t > this.maximumEventLogLevel && t > this.maximumConsoleLogLevel)
|
|
255
255
|
return;
|
|
256
|
-
const n = new
|
|
256
|
+
const n = new Tt(e, t);
|
|
257
257
|
t <= this.maximumConsoleLogLevel && console.log(n.FormattedMessage), t <= this.maximumEventLogLevel && this.emit("log", n);
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
|
|
261
|
-
let
|
|
260
|
+
ut.sLogger = void 0;
|
|
261
|
+
let Pt = ut;
|
|
262
262
|
var b;
|
|
263
263
|
(function(r) {
|
|
264
264
|
r[r.PLAIN_TO_CLASS = 0] = "PLAIN_TO_CLASS", r[r.CLASS_TO_PLAIN = 1] = "CLASS_TO_PLAIN", r[r.CLASS_TO_CLASS = 2] = "CLASS_TO_CLASS";
|
|
265
265
|
})(b || (b = {}));
|
|
266
|
-
var
|
|
266
|
+
var kt = (
|
|
267
267
|
/** @class */
|
|
268
268
|
function() {
|
|
269
269
|
function r() {
|
|
@@ -361,8 +361,8 @@ var Nt = (
|
|
|
361
361
|
return this._ancestorsMap.get(e);
|
|
362
362
|
}, r;
|
|
363
363
|
}()
|
|
364
|
-
), F = new
|
|
365
|
-
function
|
|
364
|
+
), F = new kt();
|
|
365
|
+
function jt() {
|
|
366
366
|
if (typeof globalThis < "u")
|
|
367
367
|
return globalThis;
|
|
368
368
|
if (typeof global < "u")
|
|
@@ -372,20 +372,20 @@ function Pt() {
|
|
|
372
372
|
if (typeof self < "u")
|
|
373
373
|
return self;
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Bt(r) {
|
|
376
376
|
return r !== null && typeof r == "object" && typeof r.then == "function";
|
|
377
377
|
}
|
|
378
|
-
var
|
|
378
|
+
var st = globalThis && globalThis.__spreadArray || function(r, e, t) {
|
|
379
379
|
if (t || arguments.length === 2)
|
|
380
380
|
for (var n = 0, i = e.length, u; n < i; n++)
|
|
381
381
|
(u || !(n in e)) && (u || (u = Array.prototype.slice.call(e, 0, n)), u[n] = e[n]);
|
|
382
382
|
return r.concat(u || Array.prototype.slice.call(e));
|
|
383
383
|
};
|
|
384
|
-
function
|
|
384
|
+
function $t(r) {
|
|
385
385
|
var e = new r();
|
|
386
386
|
return !(e instanceof Set) && !("push" in e) ? [] : e;
|
|
387
387
|
}
|
|
388
|
-
var
|
|
388
|
+
var oe = (
|
|
389
389
|
/** @class */
|
|
390
390
|
function() {
|
|
391
391
|
function r(e, t) {
|
|
@@ -394,7 +394,7 @@ var ie = (
|
|
|
394
394
|
return r.prototype.transform = function(e, t, n, i, u, a) {
|
|
395
395
|
var f = this;
|
|
396
396
|
if (a === void 0 && (a = 0), Array.isArray(t) || t instanceof Set) {
|
|
397
|
-
var l = i && this.transformationType === b.PLAIN_TO_CLASS ?
|
|
397
|
+
var l = i && this.transformationType === b.PLAIN_TO_CLASS ? $t(i) : [];
|
|
398
398
|
return t.forEach(function(g, I) {
|
|
399
399
|
var O = e ? e[I] : void 0;
|
|
400
400
|
if (!f.options.enableCircularCheck || !f.isCircular(g)) {
|
|
@@ -426,9 +426,9 @@ var ie = (
|
|
|
426
426
|
return t == null ? t : !!t;
|
|
427
427
|
if ((n === Date || t instanceof Date) && !u)
|
|
428
428
|
return t instanceof Date ? new Date(t.valueOf()) : t == null ? t : new Date(t);
|
|
429
|
-
if (
|
|
429
|
+
if (jt().Buffer && (n === Buffer || t instanceof Buffer) && !u)
|
|
430
430
|
return t == null ? t : Buffer.from(t);
|
|
431
|
-
if (
|
|
431
|
+
if (Bt(t) && !u)
|
|
432
432
|
return new Promise(function(g, I) {
|
|
433
433
|
t.then(function(O) {
|
|
434
434
|
return g(f.transform(void 0, O, n, void 0, void 0, a + 1));
|
|
@@ -459,15 +459,15 @@ var ie = (
|
|
|
459
459
|
if (n && u)
|
|
460
460
|
k = n;
|
|
461
461
|
else if (n) {
|
|
462
|
-
var
|
|
463
|
-
if (
|
|
464
|
-
var
|
|
465
|
-
|
|
466
|
-
if (C && C instanceof Object &&
|
|
467
|
-
return q.name === C[
|
|
468
|
-
}), k === void 0 ? k =
|
|
462
|
+
var N = F.findTypeMetadata(n, S);
|
|
463
|
+
if (N) {
|
|
464
|
+
var Me = { newObject: p, object: t, property: S }, he = N.typeFunction ? N.typeFunction(Me) : N.reflectedType;
|
|
465
|
+
N.options && N.options.discriminator && N.options.discriminator.property && N.options.discriminator.subTypes ? t[I] instanceof Array ? k = N : (h.transformationType === b.PLAIN_TO_CLASS && (k = N.options.discriminator.subTypes.find(function(q) {
|
|
466
|
+
if (C && C instanceof Object && N.options.discriminator.property in C)
|
|
467
|
+
return q.name === C[N.options.discriminator.property];
|
|
468
|
+
}), k === void 0 ? k = he : k = k.value, N.options.keepDiscriminatorProperty || C && C instanceof Object && N.options.discriminator.property in C && delete C[N.options.discriminator.property]), h.transformationType === b.CLASS_TO_CLASS && (k = C.constructor), h.transformationType === b.CLASS_TO_PLAIN && C && (C[N.options.discriminator.property] = N.options.discriminator.subTypes.find(function(q) {
|
|
469
469
|
return q.value === C.constructor;
|
|
470
|
-
}).name)) : k =
|
|
470
|
+
}).name)) : k = he, Y = Y || N.reflectedType === Map;
|
|
471
471
|
} else if (h.options.targetMaps)
|
|
472
472
|
h.options.targetMaps.filter(function(q) {
|
|
473
473
|
return q.target === n && !!q.properties[S];
|
|
@@ -475,20 +475,20 @@ var ie = (
|
|
|
475
475
|
return k = q.properties[S];
|
|
476
476
|
});
|
|
477
477
|
else if (h.options.enableImplicitConversion && h.transformationType === b.PLAIN_TO_CLASS) {
|
|
478
|
-
var
|
|
479
|
-
|
|
478
|
+
var pe = Reflect.getMetadata("design:type", n.prototype, S);
|
|
479
|
+
pe && (k = pe);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var K = Array.isArray(t[I]) ? h.getReflectedType(n, S) : void 0,
|
|
482
|
+
var K = Array.isArray(t[I]) ? h.getReflectedType(n, S) : void 0, fe = e ? e[I] : void 0;
|
|
483
483
|
if (p.constructor.prototype) {
|
|
484
|
-
var
|
|
484
|
+
var re = Object.getOwnPropertyDescriptor(p.constructor.prototype, O);
|
|
485
485
|
if ((h.transformationType === b.PLAIN_TO_CLASS || h.transformationType === b.CLASS_TO_CLASS) && // eslint-disable-next-line @typescript-eslint/unbound-method
|
|
486
|
-
(
|
|
486
|
+
(re && !re.set || p[O] instanceof Function))
|
|
487
487
|
return "continue";
|
|
488
488
|
}
|
|
489
489
|
if (!h.options.enableCircularCheck || !h.isCircular(C)) {
|
|
490
490
|
var te = h.transformationType === b.PLAIN_TO_CLASS ? O : g, L = void 0;
|
|
491
|
-
h.transformationType === b.CLASS_TO_PLAIN ? (L = t[te], L = h.applyCustomTransformations(L, n, te, t, h.transformationType), L = t[te] === L ? C : L, L = h.transform(
|
|
491
|
+
h.transformationType === b.CLASS_TO_PLAIN ? (L = t[te], L = h.applyCustomTransformations(L, n, te, t, h.transformationType), L = t[te] === L ? C : L, L = h.transform(fe, L, k, K, Y, a + 1)) : C === void 0 && h.options.exposeDefaultValues ? L = p[O] : (L = h.transform(fe, C, k, K, Y, a + 1), L = h.applyCustomTransformations(L, n, te, t, h.transformationType)), (L !== void 0 || h.options.exposeUnsetFields) && (p instanceof Map ? p.set(O, L) : p[O] = L);
|
|
492
492
|
} else if (h.transformationType === b.CLASS_TO_CLASS) {
|
|
493
493
|
var L = C;
|
|
494
494
|
L = h.applyCustomTransformations(L, n, g, t, h.transformationType), (L !== void 0 || h.options.exposeUnsetFields) && (p instanceof Map ? p.set(O, L) : p[O] = L);
|
|
@@ -527,7 +527,7 @@ var ie = (
|
|
|
527
527
|
return a;
|
|
528
528
|
if (this.options.ignoreDecorators && this.options.excludeExtraneousValues && e) {
|
|
529
529
|
var f = F.getExposedProperties(e, this.transformationType), l = F.getExcludedProperties(e, this.transformationType);
|
|
530
|
-
a =
|
|
530
|
+
a = st(st([], f, !0), l, !0);
|
|
531
531
|
}
|
|
532
532
|
if (!this.options.ignoreDecorators && e) {
|
|
533
533
|
var f = F.getExposedProperties(e, this.transformationType);
|
|
@@ -565,7 +565,7 @@ var ie = (
|
|
|
565
565
|
}) : !0;
|
|
566
566
|
}, r;
|
|
567
567
|
}()
|
|
568
|
-
),
|
|
568
|
+
), ae = {
|
|
569
569
|
enableCircularCheck: !1,
|
|
570
570
|
enableImplicitConversion: !1,
|
|
571
571
|
excludeExtraneousValues: !1,
|
|
@@ -586,28 +586,28 @@ var ie = (
|
|
|
586
586
|
}
|
|
587
587
|
return r;
|
|
588
588
|
}, G.apply(this, arguments);
|
|
589
|
-
},
|
|
589
|
+
}, Ft = (
|
|
590
590
|
/** @class */
|
|
591
591
|
function() {
|
|
592
592
|
function r() {
|
|
593
593
|
}
|
|
594
594
|
return r.prototype.instanceToPlain = function(e, t) {
|
|
595
|
-
var n = new
|
|
595
|
+
var n = new oe(b.CLASS_TO_PLAIN, G(G({}, ae), t));
|
|
596
596
|
return n.transform(void 0, e, void 0, void 0, void 0, void 0);
|
|
597
597
|
}, r.prototype.classToPlainFromExist = function(e, t, n) {
|
|
598
|
-
var i = new
|
|
598
|
+
var i = new oe(b.CLASS_TO_PLAIN, G(G({}, ae), n));
|
|
599
599
|
return i.transform(t, e, void 0, void 0, void 0, void 0);
|
|
600
600
|
}, r.prototype.plainToInstance = function(e, t, n) {
|
|
601
|
-
var i = new
|
|
601
|
+
var i = new oe(b.PLAIN_TO_CLASS, G(G({}, ae), n));
|
|
602
602
|
return i.transform(void 0, t, e, void 0, void 0, void 0);
|
|
603
603
|
}, r.prototype.plainToClassFromExist = function(e, t, n) {
|
|
604
|
-
var i = new
|
|
604
|
+
var i = new oe(b.PLAIN_TO_CLASS, G(G({}, ae), n));
|
|
605
605
|
return i.transform(e, t, void 0, void 0, void 0, void 0);
|
|
606
606
|
}, r.prototype.instanceToInstance = function(e, t) {
|
|
607
|
-
var n = new
|
|
607
|
+
var n = new oe(b.CLASS_TO_CLASS, G(G({}, ae), t));
|
|
608
608
|
return n.transform(void 0, e, void 0, void 0, void 0, void 0);
|
|
609
609
|
}, r.prototype.classToClassFromExist = function(e, t, n) {
|
|
610
|
-
var i = new
|
|
610
|
+
var i = new oe(b.CLASS_TO_CLASS, G(G({}, ae), n));
|
|
611
611
|
return i.transform(t, e, void 0, void 0, void 0, void 0);
|
|
612
612
|
}, r.prototype.serialize = function(e, t) {
|
|
613
613
|
return JSON.stringify(this.instanceToPlain(e, t));
|
|
@@ -620,7 +620,7 @@ var ie = (
|
|
|
620
620
|
}, r;
|
|
621
621
|
}()
|
|
622
622
|
);
|
|
623
|
-
function
|
|
623
|
+
function Le(r, e) {
|
|
624
624
|
return e === void 0 && (e = {}), function(t, n) {
|
|
625
625
|
var i = Reflect.getMetadata("design:type", t, n);
|
|
626
626
|
F.addTypeMetadata({
|
|
@@ -632,12 +632,12 @@ function Oe(r, e) {
|
|
|
632
632
|
});
|
|
633
633
|
};
|
|
634
634
|
}
|
|
635
|
-
var
|
|
636
|
-
function
|
|
637
|
-
return
|
|
635
|
+
var ft = new Ft();
|
|
636
|
+
function Ut(r, e) {
|
|
637
|
+
return ft.instanceToPlain(r, e);
|
|
638
638
|
}
|
|
639
|
-
function
|
|
640
|
-
return
|
|
639
|
+
function Wt(r, e, t) {
|
|
640
|
+
return ft.plainToInstance(r, e, t);
|
|
641
641
|
}
|
|
642
642
|
/*! *****************************************************************************
|
|
643
643
|
Copyright (C) Microsoft. All rights reserved.
|
|
@@ -653,10 +653,10 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
653
653
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
654
654
|
and limitations under the License.
|
|
655
655
|
***************************************************************************** */
|
|
656
|
-
var
|
|
656
|
+
var it;
|
|
657
657
|
(function(r) {
|
|
658
658
|
(function(e) {
|
|
659
|
-
var t = typeof
|
|
659
|
+
var t = typeof rt == "object" ? rt : typeof self == "object" ? self : typeof this == "object" ? this : Function("return this;")(), n = i(r);
|
|
660
660
|
typeof t.Reflect > "u" ? t.Reflect = r : n = i(t.Reflect, n), e(n);
|
|
661
661
|
function i(u, a) {
|
|
662
662
|
return function(f, l) {
|
|
@@ -667,11 +667,11 @@ var st;
|
|
|
667
667
|
var t = Object.prototype.hasOwnProperty, n = typeof Symbol == "function", i = n && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", u = n && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", a = typeof Object.create == "function", f = { __proto__: [] } instanceof Array, l = !a && !f, v = {
|
|
668
668
|
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
669
669
|
create: a ? function() {
|
|
670
|
-
return
|
|
670
|
+
return Ce(/* @__PURE__ */ Object.create(null));
|
|
671
671
|
} : f ? function() {
|
|
672
|
-
return
|
|
672
|
+
return Ce({ __proto__: null });
|
|
673
673
|
} : function() {
|
|
674
|
-
return
|
|
674
|
+
return Ce({});
|
|
675
675
|
},
|
|
676
676
|
has: l ? function(s, o) {
|
|
677
677
|
return t.call(s, o);
|
|
@@ -683,22 +683,22 @@ var st;
|
|
|
683
683
|
} : function(s, o) {
|
|
684
684
|
return s[o];
|
|
685
685
|
}
|
|
686
|
-
}, p = Object.getPrototypeOf(Function), m = typeof process == "object" && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL === "true", h = !m && typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map :
|
|
686
|
+
}, p = Object.getPrototypeOf(Function), m = typeof process == "object" && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL === "true", h = !m && typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : Lt(), R = !m && typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : It(), E = !m && typeof WeakMap == "function" ? WeakMap : Rt(), $ = new E();
|
|
687
687
|
function g(s, o, c, d) {
|
|
688
|
-
if (
|
|
689
|
-
if (!
|
|
688
|
+
if (T(c)) {
|
|
689
|
+
if (!Ve(s))
|
|
690
690
|
throw new TypeError();
|
|
691
|
-
if (!
|
|
691
|
+
if (!et(o))
|
|
692
692
|
throw new TypeError();
|
|
693
|
-
return
|
|
693
|
+
return he(s, o);
|
|
694
694
|
} else {
|
|
695
|
-
if (!
|
|
695
|
+
if (!Ve(s))
|
|
696
696
|
throw new TypeError();
|
|
697
697
|
if (!j(o))
|
|
698
698
|
throw new TypeError();
|
|
699
|
-
if (!j(d) && !
|
|
699
|
+
if (!j(d) && !T(d) && !se(d))
|
|
700
700
|
throw new TypeError();
|
|
701
|
-
return
|
|
701
|
+
return se(d) && (d = void 0), c = Z(c), pe(s, o, c, d);
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
704
|
e("decorate", g);
|
|
@@ -706,7 +706,7 @@ var st;
|
|
|
706
706
|
function c(d, y) {
|
|
707
707
|
if (!j(d))
|
|
708
708
|
throw new TypeError();
|
|
709
|
-
if (!
|
|
709
|
+
if (!T(y) && !Ct(y))
|
|
710
710
|
throw new TypeError();
|
|
711
711
|
q(s, o, d, y);
|
|
712
712
|
}
|
|
@@ -716,78 +716,78 @@ var st;
|
|
|
716
716
|
function O(s, o, c, d) {
|
|
717
717
|
if (!j(c))
|
|
718
718
|
throw new TypeError();
|
|
719
|
-
return
|
|
719
|
+
return T(d) || (d = Z(d)), q(s, o, c, d);
|
|
720
720
|
}
|
|
721
721
|
e("defineMetadata", O);
|
|
722
722
|
function S(s, o, c) {
|
|
723
723
|
if (!j(o))
|
|
724
724
|
throw new TypeError();
|
|
725
|
-
return
|
|
725
|
+
return T(c) || (c = Z(c)), fe(s, o, c);
|
|
726
726
|
}
|
|
727
727
|
e("hasMetadata", S);
|
|
728
728
|
function W(s, o, c) {
|
|
729
729
|
if (!j(o))
|
|
730
730
|
throw new TypeError();
|
|
731
|
-
return
|
|
731
|
+
return T(c) || (c = Z(c)), re(s, o, c);
|
|
732
732
|
}
|
|
733
733
|
e("hasOwnMetadata", W);
|
|
734
734
|
function C(s, o, c) {
|
|
735
735
|
if (!j(o))
|
|
736
736
|
throw new TypeError();
|
|
737
|
-
return
|
|
737
|
+
return T(c) || (c = Z(c)), te(s, o, c);
|
|
738
738
|
}
|
|
739
739
|
e("getMetadata", C);
|
|
740
740
|
function k(s, o, c) {
|
|
741
741
|
if (!j(o))
|
|
742
742
|
throw new TypeError();
|
|
743
|
-
return
|
|
743
|
+
return T(c) || (c = Z(c)), L(s, o, c);
|
|
744
744
|
}
|
|
745
745
|
e("getOwnMetadata", k);
|
|
746
746
|
function Y(s, o) {
|
|
747
747
|
if (!j(s))
|
|
748
748
|
throw new TypeError();
|
|
749
|
-
return
|
|
749
|
+
return T(o) || (o = Z(o)), Ze(s, o);
|
|
750
750
|
}
|
|
751
751
|
e("getMetadataKeys", Y);
|
|
752
|
-
function
|
|
752
|
+
function N(s, o) {
|
|
753
753
|
if (!j(s))
|
|
754
754
|
throw new TypeError();
|
|
755
|
-
return
|
|
755
|
+
return T(o) || (o = Z(o)), Qe(s, o);
|
|
756
756
|
}
|
|
757
|
-
e("getOwnMetadataKeys",
|
|
758
|
-
function
|
|
757
|
+
e("getOwnMetadataKeys", N);
|
|
758
|
+
function Me(s, o, c) {
|
|
759
759
|
if (!j(o))
|
|
760
760
|
throw new TypeError();
|
|
761
|
-
|
|
761
|
+
T(c) || (c = Z(c));
|
|
762
762
|
var d = K(
|
|
763
763
|
o,
|
|
764
764
|
c,
|
|
765
765
|
/*Create*/
|
|
766
766
|
!1
|
|
767
767
|
);
|
|
768
|
-
if (
|
|
768
|
+
if (T(d) || !d.delete(s))
|
|
769
769
|
return !1;
|
|
770
770
|
if (d.size > 0)
|
|
771
771
|
return !0;
|
|
772
772
|
var y = $.get(o);
|
|
773
773
|
return y.delete(c), y.size > 0 || $.delete(o), !0;
|
|
774
774
|
}
|
|
775
|
-
e("deleteMetadata",
|
|
776
|
-
function
|
|
775
|
+
e("deleteMetadata", Me);
|
|
776
|
+
function he(s, o) {
|
|
777
777
|
for (var c = s.length - 1; c >= 0; --c) {
|
|
778
778
|
var d = s[c], y = d(o);
|
|
779
|
-
if (!
|
|
780
|
-
if (!
|
|
779
|
+
if (!T(y) && !se(y)) {
|
|
780
|
+
if (!et(y))
|
|
781
781
|
throw new TypeError();
|
|
782
782
|
o = y;
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
return o;
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function pe(s, o, c, d) {
|
|
788
788
|
for (var y = s.length - 1; y >= 0; --y) {
|
|
789
789
|
var B = s[y], _ = B(o, c, d);
|
|
790
|
-
if (!
|
|
790
|
+
if (!T(_) && !se(_)) {
|
|
791
791
|
if (!j(_))
|
|
792
792
|
throw new TypeError();
|
|
793
793
|
d = _;
|
|
@@ -797,41 +797,41 @@ var st;
|
|
|
797
797
|
}
|
|
798
798
|
function K(s, o, c) {
|
|
799
799
|
var d = $.get(s);
|
|
800
|
-
if (
|
|
800
|
+
if (T(d)) {
|
|
801
801
|
if (!c)
|
|
802
802
|
return;
|
|
803
803
|
d = new h(), $.set(s, d);
|
|
804
804
|
}
|
|
805
805
|
var y = d.get(o);
|
|
806
|
-
if (
|
|
806
|
+
if (T(y)) {
|
|
807
807
|
if (!c)
|
|
808
808
|
return;
|
|
809
809
|
y = new h(), d.set(o, y);
|
|
810
810
|
}
|
|
811
811
|
return y;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
var d =
|
|
813
|
+
function fe(s, o, c) {
|
|
814
|
+
var d = re(s, o, c);
|
|
815
815
|
if (d)
|
|
816
816
|
return !0;
|
|
817
|
-
var y =
|
|
818
|
-
return
|
|
817
|
+
var y = be(o);
|
|
818
|
+
return se(y) ? !1 : fe(s, y, c);
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function re(s, o, c) {
|
|
821
821
|
var d = K(
|
|
822
822
|
o,
|
|
823
823
|
c,
|
|
824
824
|
/*Create*/
|
|
825
825
|
!1
|
|
826
826
|
);
|
|
827
|
-
return
|
|
827
|
+
return T(d) ? !1 : Mt(d.has(s));
|
|
828
828
|
}
|
|
829
829
|
function te(s, o, c) {
|
|
830
|
-
var d =
|
|
830
|
+
var d = re(s, o, c);
|
|
831
831
|
if (d)
|
|
832
832
|
return L(s, o, c);
|
|
833
|
-
var y =
|
|
834
|
-
if (!
|
|
833
|
+
var y = be(o);
|
|
834
|
+
if (!se(y))
|
|
835
835
|
return te(s, y, c);
|
|
836
836
|
}
|
|
837
837
|
function L(s, o, c) {
|
|
@@ -841,7 +841,7 @@ var st;
|
|
|
841
841
|
/*Create*/
|
|
842
842
|
!1
|
|
843
843
|
);
|
|
844
|
-
if (!
|
|
844
|
+
if (!T(d))
|
|
845
845
|
return d.get(s);
|
|
846
846
|
}
|
|
847
847
|
function q(s, o, c, d) {
|
|
@@ -853,11 +853,11 @@ var st;
|
|
|
853
853
|
);
|
|
854
854
|
y.set(s, o);
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
var c =
|
|
856
|
+
function Ze(s, o) {
|
|
857
|
+
var c = Qe(s, o), d = be(s);
|
|
858
858
|
if (d === null)
|
|
859
859
|
return c;
|
|
860
|
-
var y =
|
|
860
|
+
var y = Ze(d, o);
|
|
861
861
|
if (y.length <= 0)
|
|
862
862
|
return c;
|
|
863
863
|
if (c.length <= 0)
|
|
@@ -866,31 +866,31 @@ var st;
|
|
|
866
866
|
var x = w[M], A = B.has(x);
|
|
867
867
|
A || (B.add(x), _.push(x));
|
|
868
868
|
}
|
|
869
|
-
for (var V = 0,
|
|
870
|
-
var x =
|
|
869
|
+
for (var V = 0, nt = y; V < nt.length; V++) {
|
|
870
|
+
var x = nt[V], A = B.has(x);
|
|
871
871
|
A || (B.add(x), _.push(x));
|
|
872
872
|
}
|
|
873
873
|
return _;
|
|
874
874
|
}
|
|
875
|
-
function
|
|
875
|
+
function Qe(s, o) {
|
|
876
876
|
var c = [], d = K(
|
|
877
877
|
s,
|
|
878
878
|
o,
|
|
879
879
|
/*Create*/
|
|
880
880
|
!1
|
|
881
881
|
);
|
|
882
|
-
if (
|
|
882
|
+
if (T(d))
|
|
883
883
|
return c;
|
|
884
|
-
for (var y = d.keys(), B =
|
|
885
|
-
var M =
|
|
884
|
+
for (var y = d.keys(), B = xt(y), _ = 0; ; ) {
|
|
885
|
+
var M = Et(B);
|
|
886
886
|
if (!M)
|
|
887
887
|
return c.length = _, c;
|
|
888
|
-
var w =
|
|
888
|
+
var w = At(M);
|
|
889
889
|
try {
|
|
890
890
|
c[_] = w;
|
|
891
891
|
} catch (x) {
|
|
892
892
|
try {
|
|
893
|
-
|
|
893
|
+
Ot(B);
|
|
894
894
|
} finally {
|
|
895
895
|
throw x;
|
|
896
896
|
}
|
|
@@ -898,7 +898,7 @@ var st;
|
|
|
898
898
|
_++;
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function Ke(s) {
|
|
902
902
|
if (s === null)
|
|
903
903
|
return 1;
|
|
904
904
|
switch (typeof s) {
|
|
@@ -918,20 +918,20 @@ var st;
|
|
|
918
918
|
return 6;
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function T(s) {
|
|
922
922
|
return s === void 0;
|
|
923
923
|
}
|
|
924
|
-
function
|
|
924
|
+
function se(s) {
|
|
925
925
|
return s === null;
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function wt(s) {
|
|
928
928
|
return typeof s == "symbol";
|
|
929
929
|
}
|
|
930
930
|
function j(s) {
|
|
931
931
|
return typeof s == "object" ? s !== null : typeof s == "function";
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
switch (
|
|
933
|
+
function _t(s, o) {
|
|
934
|
+
switch (Ke(s)) {
|
|
935
935
|
case 0:
|
|
936
936
|
return s;
|
|
937
937
|
case 1:
|
|
@@ -945,38 +945,38 @@ var st;
|
|
|
945
945
|
case 5:
|
|
946
946
|
return s;
|
|
947
947
|
}
|
|
948
|
-
var c = o === 3 ? "string" : o === 5 ? "number" : "default", d =
|
|
948
|
+
var c = o === 3 ? "string" : o === 5 ? "number" : "default", d = tt(s, i);
|
|
949
949
|
if (d !== void 0) {
|
|
950
950
|
var y = d.call(s, c);
|
|
951
951
|
if (j(y))
|
|
952
952
|
throw new TypeError();
|
|
953
953
|
return y;
|
|
954
954
|
}
|
|
955
|
-
return
|
|
955
|
+
return St(s, c === "default" ? "number" : c);
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function St(s, o) {
|
|
958
958
|
if (o === "string") {
|
|
959
959
|
var c = s.toString;
|
|
960
|
-
if (
|
|
960
|
+
if (ie(c)) {
|
|
961
961
|
var d = c.call(s);
|
|
962
962
|
if (!j(d))
|
|
963
963
|
return d;
|
|
964
964
|
}
|
|
965
965
|
var y = s.valueOf;
|
|
966
|
-
if (
|
|
966
|
+
if (ie(y)) {
|
|
967
967
|
var d = y.call(s);
|
|
968
968
|
if (!j(d))
|
|
969
969
|
return d;
|
|
970
970
|
}
|
|
971
971
|
} else {
|
|
972
972
|
var y = s.valueOf;
|
|
973
|
-
if (
|
|
973
|
+
if (ie(y)) {
|
|
974
974
|
var d = y.call(s);
|
|
975
975
|
if (!j(d))
|
|
976
976
|
return d;
|
|
977
977
|
}
|
|
978
978
|
var B = s.toString;
|
|
979
|
-
if (
|
|
979
|
+
if (ie(B)) {
|
|
980
980
|
var d = B.call(s);
|
|
981
981
|
if (!j(d))
|
|
982
982
|
return d;
|
|
@@ -984,31 +984,31 @@ var st;
|
|
|
984
984
|
}
|
|
985
985
|
throw new TypeError();
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function Mt(s) {
|
|
988
988
|
return !!s;
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function bt(s) {
|
|
991
991
|
return "" + s;
|
|
992
992
|
}
|
|
993
993
|
function Z(s) {
|
|
994
|
-
var o =
|
|
994
|
+
var o = _t(
|
|
995
995
|
s,
|
|
996
996
|
3
|
|
997
997
|
/* String */
|
|
998
998
|
);
|
|
999
|
-
return
|
|
999
|
+
return wt(o) ? o : bt(o);
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function Ve(s) {
|
|
1002
1002
|
return Array.isArray ? Array.isArray(s) : s instanceof Object ? s instanceof Array : Object.prototype.toString.call(s) === "[object Array]";
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function ie(s) {
|
|
1005
1005
|
return typeof s == "function";
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function et(s) {
|
|
1008
1008
|
return typeof s == "function";
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
switch (
|
|
1010
|
+
function Ct(s) {
|
|
1011
|
+
switch (Ke(s)) {
|
|
1012
1012
|
case 3:
|
|
1013
1013
|
return !0;
|
|
1014
1014
|
case 4:
|
|
@@ -1017,35 +1017,35 @@ var st;
|
|
|
1017
1017
|
return !1;
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function tt(s, o) {
|
|
1021
1021
|
var c = s[o];
|
|
1022
1022
|
if (c != null) {
|
|
1023
|
-
if (!
|
|
1023
|
+
if (!ie(c))
|
|
1024
1024
|
throw new TypeError();
|
|
1025
1025
|
return c;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
var o =
|
|
1030
|
-
if (!
|
|
1028
|
+
function xt(s) {
|
|
1029
|
+
var o = tt(s, u);
|
|
1030
|
+
if (!ie(o))
|
|
1031
1031
|
throw new TypeError();
|
|
1032
1032
|
var c = o.call(s);
|
|
1033
1033
|
if (!j(c))
|
|
1034
1034
|
throw new TypeError();
|
|
1035
1035
|
return c;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function At(s) {
|
|
1038
1038
|
return s.value;
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function Et(s) {
|
|
1041
1041
|
var o = s.next();
|
|
1042
1042
|
return o.done ? !1 : o;
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function Ot(s) {
|
|
1045
1045
|
var o = s.return;
|
|
1046
1046
|
o && o.call(s);
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function be(s) {
|
|
1049
1049
|
var o = Object.getPrototypeOf(s);
|
|
1050
1050
|
if (typeof s != "function" || s === p || o !== p)
|
|
1051
1051
|
return o;
|
|
@@ -1055,7 +1055,7 @@ var st;
|
|
|
1055
1055
|
var y = d.constructor;
|
|
1056
1056
|
return typeof y != "function" || y === s ? o : y;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Lt() {
|
|
1059
1059
|
var s = {}, o = [], c = (
|
|
1060
1060
|
/** @class */
|
|
1061
1061
|
function() {
|
|
@@ -1151,7 +1151,7 @@ var st;
|
|
|
1151
1151
|
return [_, M];
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function It() {
|
|
1155
1155
|
return (
|
|
1156
1156
|
/** @class */
|
|
1157
1157
|
function() {
|
|
@@ -1186,7 +1186,7 @@ var st;
|
|
|
1186
1186
|
}()
|
|
1187
1187
|
);
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function Rt() {
|
|
1190
1190
|
var s = 16, o = v.create(), c = d();
|
|
1191
1191
|
return (
|
|
1192
1192
|
/** @class */
|
|
@@ -1260,18 +1260,18 @@ var st;
|
|
|
1260
1260
|
return x;
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function Ce(s) {
|
|
1264
1264
|
return s.__ = void 0, delete s.__, s;
|
|
1265
1265
|
}
|
|
1266
1266
|
});
|
|
1267
|
-
})(
|
|
1268
|
-
var
|
|
1269
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1267
|
+
})(it || (it = {}));
|
|
1268
|
+
var Gt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Ie = (r, e, t, n) => {
|
|
1269
|
+
for (var i = n > 1 ? void 0 : n ? zt(e, t) : e, u = r.length - 1, a; u >= 0; u--)
|
|
1270
1270
|
(a = r[u]) && (i = (n ? a(e, t, i) : a(i)) || i);
|
|
1271
|
-
return n && i &&
|
|
1271
|
+
return n && i && Gt(e, t, i), i;
|
|
1272
1272
|
};
|
|
1273
|
-
const X = 0, D = 1,
|
|
1274
|
-
class
|
|
1273
|
+
const X = 0, D = 1, Jt = 4294967295, ge = 3;
|
|
1274
|
+
class Re {
|
|
1275
1275
|
constructor(e) {
|
|
1276
1276
|
Object.assign(this, e);
|
|
1277
1277
|
}
|
|
@@ -1280,18 +1280,18 @@ class Ie {
|
|
|
1280
1280
|
(e = this.ScalarCmd) == null || e.forEach((a, f) => a.Index = f), (t = this.RotateCmd) == null || t.forEach((a, f) => a.Index = f), (n = this.LinearCmd) == null || n.forEach((a, f) => a.Index = f), (i = this.SensorReadCmd) == null || i.forEach((a, f) => a.Index = f), (u = this.SensorSubscribeCmd) == null || u.forEach((a, f) => a.Index = f);
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
var
|
|
1284
|
-
class
|
|
1283
|
+
var ce = /* @__PURE__ */ ((r) => (r.Unknown = "Unknown", r.Vibrate = "Vibrate", r.Rotate = "Rotate", r.Oscillate = "Oscillate", r.Constrict = "Constrict", r.Inflate = "Inflate", r.Position = "Position", r))(ce || {}), ee = /* @__PURE__ */ ((r) => (r.Unknown = "Unknown", r.Battery = "Battery", r.RSSI = "RSSI", r.Button = "Button", r.Pressure = "Pressure", r))(ee || {});
|
|
1284
|
+
class qt {
|
|
1285
1285
|
constructor(e) {
|
|
1286
1286
|
this.Index = 0, Object.assign(this, e);
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
|
-
class
|
|
1289
|
+
class Ht {
|
|
1290
1290
|
constructor(e) {
|
|
1291
1291
|
this.Endpoints = e;
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
|
-
class
|
|
1294
|
+
class Yt {
|
|
1295
1295
|
constructor(e) {
|
|
1296
1296
|
this.Index = 0, Object.assign(this, e);
|
|
1297
1297
|
}
|
|
@@ -1309,7 +1309,7 @@ class H {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
toProtocolFormat() {
|
|
1311
1311
|
const e = {};
|
|
1312
|
-
return e[this.constructor.Name] =
|
|
1312
|
+
return e[this.constructor.Name] = Ut(this), e;
|
|
1313
1313
|
}
|
|
1314
1314
|
update() {
|
|
1315
1315
|
}
|
|
@@ -1319,23 +1319,23 @@ class J extends H {
|
|
|
1319
1319
|
super(t), this.DeviceIndex = e, this.Id = t;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
class
|
|
1322
|
+
class ue extends H {
|
|
1323
1323
|
constructor(e = X) {
|
|
1324
1324
|
super(e), this.Id = e;
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
|
-
class
|
|
1327
|
+
class we extends ue {
|
|
1328
1328
|
constructor(e = D) {
|
|
1329
1329
|
super(e), this.Id = e;
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
|
-
|
|
1333
|
-
class
|
|
1332
|
+
we.Name = "Ok";
|
|
1333
|
+
class dt extends H {
|
|
1334
1334
|
constructor(e = D) {
|
|
1335
1335
|
super(e), this.Id = e;
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
|
|
1338
|
+
dt.Name = "Ping";
|
|
1339
1339
|
var z = /* @__PURE__ */ ((r) => (r[r.ERROR_UNKNOWN = 0] = "ERROR_UNKNOWN", r[r.ERROR_INIT = 1] = "ERROR_INIT", r[r.ERROR_PING = 2] = "ERROR_PING", r[r.ERROR_MSG = 3] = "ERROR_MSG", r[r.ERROR_DEVICE = 4] = "ERROR_DEVICE", r))(z || {});
|
|
1340
1340
|
let Q = class extends H {
|
|
1341
1341
|
constructor(e, t = 0, n = D) {
|
|
@@ -1346,15 +1346,15 @@ let Q = class extends H {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
};
|
|
1348
1348
|
Q.Name = "Error";
|
|
1349
|
-
class
|
|
1349
|
+
class De {
|
|
1350
1350
|
constructor(e) {
|
|
1351
1351
|
Object.assign(this, e);
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
],
|
|
1357
|
-
class
|
|
1354
|
+
Ie([
|
|
1355
|
+
Le(() => Re)
|
|
1356
|
+
], De.prototype, "DeviceMessages", 2);
|
|
1357
|
+
class Ne extends H {
|
|
1358
1358
|
constructor(e, t = D) {
|
|
1359
1359
|
super(t), this.Devices = e, this.Id = t;
|
|
1360
1360
|
}
|
|
@@ -1363,11 +1363,11 @@ class De extends H {
|
|
|
1363
1363
|
e.DeviceMessages.update();
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
],
|
|
1370
|
-
class
|
|
1366
|
+
Ne.Name = "DeviceList";
|
|
1367
|
+
Ie([
|
|
1368
|
+
Le(() => De)
|
|
1369
|
+
], Ne.prototype, "Devices", 2);
|
|
1370
|
+
class _e extends ue {
|
|
1371
1371
|
constructor(e) {
|
|
1372
1372
|
super(), Object.assign(this, e);
|
|
1373
1373
|
}
|
|
@@ -1375,86 +1375,86 @@ class we extends ce {
|
|
|
1375
1375
|
this.DeviceMessages.update();
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
],
|
|
1382
|
-
class Te extends
|
|
1378
|
+
_e.Name = "DeviceAdded";
|
|
1379
|
+
Ie([
|
|
1380
|
+
Le(() => Re)
|
|
1381
|
+
], _e.prototype, "DeviceMessages", 2);
|
|
1382
|
+
class Te extends ue {
|
|
1383
1383
|
constructor(e) {
|
|
1384
1384
|
super(), this.DeviceIndex = e;
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
1387
|
Te.Name = "DeviceRemoved";
|
|
1388
|
-
class
|
|
1388
|
+
class Pe extends H {
|
|
1389
1389
|
constructor(e = D) {
|
|
1390
1390
|
super(e), this.Id = e;
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
|
-
|
|
1394
|
-
class
|
|
1393
|
+
Pe.Name = "RequestDeviceList";
|
|
1394
|
+
class ke extends H {
|
|
1395
1395
|
constructor(e = D) {
|
|
1396
1396
|
super(e), this.Id = e;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
|
|
1400
|
-
class
|
|
1399
|
+
ke.Name = "StartScanning";
|
|
1400
|
+
class je extends H {
|
|
1401
1401
|
constructor(e = D) {
|
|
1402
1402
|
super(e), this.Id = e;
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
|
-
|
|
1406
|
-
class
|
|
1405
|
+
je.Name = "StopScanning";
|
|
1406
|
+
class Be extends ue {
|
|
1407
1407
|
constructor() {
|
|
1408
1408
|
super();
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1412
|
-
class
|
|
1411
|
+
Be.Name = "ScanningFinished";
|
|
1412
|
+
class $e extends H {
|
|
1413
1413
|
constructor(e, t = 0, n = D) {
|
|
1414
1414
|
super(n), this.ClientName = e, this.MessageVersion = t, this.Id = n;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
|
|
1418
|
-
class
|
|
1417
|
+
$e.Name = "RequestServerInfo";
|
|
1418
|
+
class Fe extends ue {
|
|
1419
1419
|
constructor(e, t, n, i = D) {
|
|
1420
1420
|
super(), this.MessageVersion = e, this.MaxPingTime = t, this.ServerName = n, this.Id = i;
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
|
-
|
|
1424
|
-
class
|
|
1423
|
+
Fe.Name = "ServerInfo";
|
|
1424
|
+
class Ue extends J {
|
|
1425
1425
|
constructor(e = -1, t = D) {
|
|
1426
1426
|
super(e, t), this.DeviceIndex = e, this.Id = t;
|
|
1427
1427
|
}
|
|
1428
1428
|
}
|
|
1429
|
-
|
|
1430
|
-
class
|
|
1429
|
+
Ue.Name = "StopDeviceCmd";
|
|
1430
|
+
class We extends H {
|
|
1431
1431
|
constructor(e = D) {
|
|
1432
1432
|
super(e), this.Id = e;
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
|
|
1436
|
-
class
|
|
1435
|
+
We.Name = "StopAllDevices";
|
|
1436
|
+
class Se {
|
|
1437
1437
|
constructor(e) {
|
|
1438
1438
|
this.Index = e;
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
class
|
|
1441
|
+
class xe extends Se {
|
|
1442
1442
|
constructor(e, t, n) {
|
|
1443
1443
|
super(e), this.Scalar = t, this.ActuatorType = n;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class
|
|
1446
|
+
class me extends J {
|
|
1447
1447
|
constructor(e, t = -1, n = D) {
|
|
1448
1448
|
super(t, n), this.Scalars = e, this.DeviceIndex = t, this.Id = n;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
|
|
1452
|
-
class
|
|
1451
|
+
me.Name = "ScalarCmd";
|
|
1452
|
+
class ht extends Se {
|
|
1453
1453
|
constructor(e, t, n) {
|
|
1454
1454
|
super(e), this.Speed = t, this.Clockwise = n;
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
-
const
|
|
1457
|
+
const pt = class lt extends J {
|
|
1458
1458
|
constructor(e, t = -1, n = D) {
|
|
1459
1459
|
super(t, n), this.Rotations = e, this.DeviceIndex = t, this.Id = n;
|
|
1460
1460
|
}
|
|
@@ -1462,18 +1462,18 @@ const ht = class pt extends J {
|
|
|
1462
1462
|
const n = new Array();
|
|
1463
1463
|
let i = 0;
|
|
1464
1464
|
for (const [u, a] of t)
|
|
1465
|
-
n.push(new
|
|
1466
|
-
return new
|
|
1465
|
+
n.push(new ht(i, u, a)), ++i;
|
|
1466
|
+
return new lt(n, e);
|
|
1467
1467
|
}
|
|
1468
1468
|
};
|
|
1469
|
-
|
|
1470
|
-
let
|
|
1471
|
-
class
|
|
1469
|
+
pt.Name = "RotateCmd";
|
|
1470
|
+
let Ae = pt;
|
|
1471
|
+
class gt extends Se {
|
|
1472
1472
|
constructor(e, t, n) {
|
|
1473
1473
|
super(e), this.Position = t, this.Duration = n;
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
|
-
const
|
|
1476
|
+
const mt = class yt extends J {
|
|
1477
1477
|
constructor(e, t = -1, n = D) {
|
|
1478
1478
|
super(t, n), this.Vectors = e, this.DeviceIndex = t, this.Id = n;
|
|
1479
1479
|
}
|
|
@@ -1481,99 +1481,99 @@ const gt = class mt extends J {
|
|
|
1481
1481
|
const n = new Array();
|
|
1482
1482
|
let i = 0;
|
|
1483
1483
|
for (const u of t)
|
|
1484
|
-
n.push(new
|
|
1485
|
-
return new
|
|
1484
|
+
n.push(new gt(i, u[0], u[1])), ++i;
|
|
1485
|
+
return new yt(n, e);
|
|
1486
1486
|
}
|
|
1487
1487
|
};
|
|
1488
|
-
|
|
1489
|
-
let
|
|
1490
|
-
class
|
|
1488
|
+
mt.Name = "LinearCmd";
|
|
1489
|
+
let Ee = mt;
|
|
1490
|
+
class Ge extends J {
|
|
1491
1491
|
constructor(e, t, n, i = D) {
|
|
1492
1492
|
super(e, i), this.DeviceIndex = e, this.SensorIndex = t, this.SensorType = n, this.Id = i;
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
|
|
1496
|
-
class
|
|
1495
|
+
Ge.Name = "SensorReadCmd";
|
|
1496
|
+
class ze extends J {
|
|
1497
1497
|
constructor(e, t, n, i, u = D) {
|
|
1498
1498
|
super(e, u), this.DeviceIndex = e, this.SensorIndex = t, this.SensorType = n, this.Data = i, this.Id = u;
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1502
|
-
class
|
|
1501
|
+
ze.Name = "SensorReading";
|
|
1502
|
+
class Je extends J {
|
|
1503
1503
|
constructor(e, t, n, i, u = D) {
|
|
1504
1504
|
super(e, u), this.DeviceIndex = e, this.Endpoint = t, this.ExpectedLength = n, this.Timeout = i, this.Id = u;
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
|
|
1508
|
-
class
|
|
1507
|
+
Je.Name = "RawReadCmd";
|
|
1508
|
+
class qe extends J {
|
|
1509
1509
|
constructor(e, t, n, i, u = D) {
|
|
1510
1510
|
super(e, u), this.DeviceIndex = e, this.Endpoint = t, this.Data = n, this.WriteWithResponse = i, this.Id = u;
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
|
-
|
|
1514
|
-
class
|
|
1513
|
+
qe.Name = "RawWriteCmd";
|
|
1514
|
+
class He extends J {
|
|
1515
1515
|
constructor(e, t, n = D) {
|
|
1516
1516
|
super(e, n), this.DeviceIndex = e, this.Endpoint = t, this.Id = n;
|
|
1517
1517
|
}
|
|
1518
1518
|
}
|
|
1519
|
-
|
|
1520
|
-
class
|
|
1519
|
+
He.Name = "RawSubscribeCmd";
|
|
1520
|
+
class Ye extends J {
|
|
1521
1521
|
constructor(e, t, n = D) {
|
|
1522
1522
|
super(e, n), this.DeviceIndex = e, this.Endpoint = t, this.Id = n;
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1526
|
-
class
|
|
1525
|
+
Ye.Name = "RawUnsubscribeCmd";
|
|
1526
|
+
class Xe extends J {
|
|
1527
1527
|
constructor(e, t, n, i = D) {
|
|
1528
1528
|
super(e, i), this.DeviceIndex = e, this.Endpoint = t, this.Data = n, this.Id = i;
|
|
1529
1529
|
}
|
|
1530
1530
|
}
|
|
1531
|
-
|
|
1532
|
-
const
|
|
1531
|
+
Xe.Name = "RawReading";
|
|
1532
|
+
const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1533
1533
|
__proto__: null,
|
|
1534
|
-
ActuatorType:
|
|
1534
|
+
ActuatorType: ce,
|
|
1535
1535
|
ButtplugDeviceMessage: J,
|
|
1536
1536
|
ButtplugMessage: H,
|
|
1537
|
-
ButtplugSystemMessage:
|
|
1537
|
+
ButtplugSystemMessage: ue,
|
|
1538
1538
|
DEFAULT_MESSAGE_ID: D,
|
|
1539
|
-
DeviceAdded:
|
|
1540
|
-
DeviceInfo:
|
|
1541
|
-
DeviceList:
|
|
1539
|
+
DeviceAdded: _e,
|
|
1540
|
+
DeviceInfo: De,
|
|
1541
|
+
DeviceList: Ne,
|
|
1542
1542
|
DeviceRemoved: Te,
|
|
1543
1543
|
Error: Q,
|
|
1544
1544
|
ErrorClass: z,
|
|
1545
|
-
GenericDeviceMessageAttributes:
|
|
1546
|
-
GenericMessageSubcommand:
|
|
1547
|
-
LinearCmd:
|
|
1548
|
-
MAX_ID:
|
|
1549
|
-
MESSAGE_SPEC_VERSION:
|
|
1550
|
-
MessageAttributes:
|
|
1551
|
-
Ok:
|
|
1552
|
-
Ping:
|
|
1553
|
-
RawDeviceMessageAttributes:
|
|
1554
|
-
RawReadCmd:
|
|
1555
|
-
RawReading:
|
|
1556
|
-
RawSubscribeCmd:
|
|
1557
|
-
RawUnsubscribeCmd:
|
|
1558
|
-
RawWriteCmd:
|
|
1559
|
-
RequestDeviceList:
|
|
1560
|
-
RequestServerInfo:
|
|
1561
|
-
RotateCmd:
|
|
1562
|
-
RotateSubcommand:
|
|
1545
|
+
GenericDeviceMessageAttributes: qt,
|
|
1546
|
+
GenericMessageSubcommand: Se,
|
|
1547
|
+
LinearCmd: Ee,
|
|
1548
|
+
MAX_ID: Jt,
|
|
1549
|
+
MESSAGE_SPEC_VERSION: ge,
|
|
1550
|
+
MessageAttributes: Re,
|
|
1551
|
+
Ok: we,
|
|
1552
|
+
Ping: dt,
|
|
1553
|
+
RawDeviceMessageAttributes: Ht,
|
|
1554
|
+
RawReadCmd: Je,
|
|
1555
|
+
RawReading: Xe,
|
|
1556
|
+
RawSubscribeCmd: He,
|
|
1557
|
+
RawUnsubscribeCmd: Ye,
|
|
1558
|
+
RawWriteCmd: qe,
|
|
1559
|
+
RequestDeviceList: Pe,
|
|
1560
|
+
RequestServerInfo: $e,
|
|
1561
|
+
RotateCmd: Ae,
|
|
1562
|
+
RotateSubcommand: ht,
|
|
1563
1563
|
SYSTEM_MESSAGE_ID: X,
|
|
1564
|
-
ScalarCmd:
|
|
1565
|
-
ScalarSubcommand:
|
|
1566
|
-
ScanningFinished:
|
|
1567
|
-
SensorDeviceMessageAttributes:
|
|
1568
|
-
SensorReadCmd:
|
|
1569
|
-
SensorReading:
|
|
1564
|
+
ScalarCmd: me,
|
|
1565
|
+
ScalarSubcommand: xe,
|
|
1566
|
+
ScanningFinished: Be,
|
|
1567
|
+
SensorDeviceMessageAttributes: Yt,
|
|
1568
|
+
SensorReadCmd: Ge,
|
|
1569
|
+
SensorReading: ze,
|
|
1570
1570
|
SensorType: ee,
|
|
1571
|
-
ServerInfo:
|
|
1572
|
-
StartScanning:
|
|
1573
|
-
StopAllDevices:
|
|
1574
|
-
StopDeviceCmd:
|
|
1575
|
-
StopScanning:
|
|
1576
|
-
VectorSubcommand:
|
|
1571
|
+
ServerInfo: Fe,
|
|
1572
|
+
StartScanning: ke,
|
|
1573
|
+
StopAllDevices: We,
|
|
1574
|
+
StopDeviceCmd: Ue,
|
|
1575
|
+
StopScanning: je,
|
|
1576
|
+
VectorSubcommand: gt
|
|
1577
1577
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1578
1578
|
/*!
|
|
1579
1579
|
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
@@ -1606,19 +1606,19 @@ class U extends Error {
|
|
|
1606
1606
|
case z.ERROR_DEVICE:
|
|
1607
1607
|
return new P(e.ErrorMessage, e.Id);
|
|
1608
1608
|
case z.ERROR_INIT:
|
|
1609
|
-
return new
|
|
1609
|
+
return new Oe(e.ErrorMessage, e.Id);
|
|
1610
1610
|
case z.ERROR_UNKNOWN:
|
|
1611
|
-
return new
|
|
1611
|
+
return new Qt(e.ErrorMessage, e.Id);
|
|
1612
1612
|
case z.ERROR_PING:
|
|
1613
|
-
return new
|
|
1613
|
+
return new Zt(e.ErrorMessage, e.Id);
|
|
1614
1614
|
case z.ERROR_MSG:
|
|
1615
|
-
return new
|
|
1615
|
+
return new de(e.ErrorMessage, e.Id);
|
|
1616
1616
|
default:
|
|
1617
1617
|
throw new Error(`Message type ${e.ErrorCode} not handled`);
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
class
|
|
1621
|
+
class Oe extends U {
|
|
1622
1622
|
constructor(e, t = X) {
|
|
1623
1623
|
super(e, z.ERROR_INIT, t);
|
|
1624
1624
|
}
|
|
@@ -1628,22 +1628,45 @@ class P extends U {
|
|
|
1628
1628
|
super(e, z.ERROR_DEVICE, t);
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
|
-
class
|
|
1631
|
+
class de extends U {
|
|
1632
1632
|
constructor(e, t = X) {
|
|
1633
1633
|
super(e, z.ERROR_MSG, t);
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
|
-
class
|
|
1636
|
+
class Zt extends U {
|
|
1637
1637
|
constructor(e, t = X) {
|
|
1638
1638
|
super(e, z.ERROR_PING, t);
|
|
1639
1639
|
}
|
|
1640
1640
|
}
|
|
1641
|
-
class
|
|
1641
|
+
class Qt extends U {
|
|
1642
1642
|
constructor(e, t = X) {
|
|
1643
1643
|
super(e, z.ERROR_UNKNOWN, t);
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
|
-
|
|
1646
|
+
function vt(r) {
|
|
1647
|
+
for (const e of Object.values(Xt))
|
|
1648
|
+
if (typeof e == "function" && "Name" in e && e.Name === r)
|
|
1649
|
+
return e;
|
|
1650
|
+
return null;
|
|
1651
|
+
}
|
|
1652
|
+
function ne(r) {
|
|
1653
|
+
return vt(Object.getPrototypeOf(r).constructor.Name);
|
|
1654
|
+
}
|
|
1655
|
+
function ot(r) {
|
|
1656
|
+
const e = JSON.parse(r), t = [];
|
|
1657
|
+
for (const n of Array.from(e)) {
|
|
1658
|
+
const i = Object.getOwnPropertyNames(n)[0], u = vt(i);
|
|
1659
|
+
if (u) {
|
|
1660
|
+
const a = Wt(
|
|
1661
|
+
u,
|
|
1662
|
+
n[i]
|
|
1663
|
+
);
|
|
1664
|
+
a.update(), t.push(a);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return t;
|
|
1668
|
+
}
|
|
1669
|
+
class ye extends ve {
|
|
1647
1670
|
/**
|
|
1648
1671
|
* @param _index Index of the device, as created by the device manager.
|
|
1649
1672
|
* @param _name Name of the device.
|
|
@@ -1683,26 +1706,26 @@ class me extends ye {
|
|
|
1683
1706
|
return this._deviceInfo.DeviceMessages;
|
|
1684
1707
|
}
|
|
1685
1708
|
static fromMsg(e, t) {
|
|
1686
|
-
return new
|
|
1709
|
+
return new ye(e, t);
|
|
1687
1710
|
}
|
|
1688
1711
|
async send(e) {
|
|
1689
1712
|
return await this._sendClosure(this, e);
|
|
1690
1713
|
}
|
|
1691
1714
|
async sendExpectOk(e) {
|
|
1692
1715
|
const t = await this.send(e);
|
|
1693
|
-
switch (t
|
|
1694
|
-
case
|
|
1716
|
+
switch (ne(t)) {
|
|
1717
|
+
case we:
|
|
1695
1718
|
return;
|
|
1696
1719
|
case Q:
|
|
1697
1720
|
throw U.FromError(t);
|
|
1698
1721
|
default:
|
|
1699
|
-
throw new
|
|
1722
|
+
throw new de(
|
|
1700
1723
|
`Message type ${t.constructor} not handled by SendMsgExpectOk`
|
|
1701
1724
|
);
|
|
1702
1725
|
}
|
|
1703
1726
|
}
|
|
1704
1727
|
async scalar(e) {
|
|
1705
|
-
Array.isArray(e) ? await this.sendExpectOk(new
|
|
1728
|
+
Array.isArray(e) ? await this.sendExpectOk(new me(e, this.index)) : await this.sendExpectOk(new me([e], this.index));
|
|
1706
1729
|
}
|
|
1707
1730
|
async scalarCommandBuilder(e, t) {
|
|
1708
1731
|
var u;
|
|
@@ -1716,7 +1739,7 @@ class me extends ye {
|
|
|
1716
1739
|
const i = [];
|
|
1717
1740
|
if (typeof e == "number")
|
|
1718
1741
|
n.forEach(
|
|
1719
|
-
(a) => i.push(new
|
|
1742
|
+
(a) => i.push(new xe(a.Index, e, t))
|
|
1720
1743
|
);
|
|
1721
1744
|
else if (Array.isArray(e)) {
|
|
1722
1745
|
if (e.length > n.length)
|
|
@@ -1724,7 +1747,7 @@ class me extends ye {
|
|
|
1724
1747
|
`${e.length} commands send to a device with ${n.length} vibrators`
|
|
1725
1748
|
);
|
|
1726
1749
|
n.forEach((a, f) => {
|
|
1727
|
-
i.push(new
|
|
1750
|
+
i.push(new xe(a.Index, e[f], t));
|
|
1728
1751
|
});
|
|
1729
1752
|
} else
|
|
1730
1753
|
throw new P(
|
|
@@ -1735,20 +1758,20 @@ class me extends ye {
|
|
|
1735
1758
|
get vibrateAttributes() {
|
|
1736
1759
|
var e;
|
|
1737
1760
|
return ((e = this.messageAttributes.ScalarCmd) == null ? void 0 : e.filter(
|
|
1738
|
-
(t) => t.ActuatorType ===
|
|
1761
|
+
(t) => t.ActuatorType === ce.Vibrate
|
|
1739
1762
|
)) ?? [];
|
|
1740
1763
|
}
|
|
1741
1764
|
async vibrate(e) {
|
|
1742
|
-
await this.scalarCommandBuilder(e,
|
|
1765
|
+
await this.scalarCommandBuilder(e, ce.Vibrate);
|
|
1743
1766
|
}
|
|
1744
1767
|
get oscillateAttributes() {
|
|
1745
1768
|
var e;
|
|
1746
1769
|
return ((e = this.messageAttributes.ScalarCmd) == null ? void 0 : e.filter(
|
|
1747
|
-
(t) => t.ActuatorType ===
|
|
1770
|
+
(t) => t.ActuatorType === ce.Oscillate
|
|
1748
1771
|
)) ?? [];
|
|
1749
1772
|
}
|
|
1750
1773
|
async oscillate(e) {
|
|
1751
|
-
await this.scalarCommandBuilder(e,
|
|
1774
|
+
await this.scalarCommandBuilder(e, ce.Oscillate);
|
|
1752
1775
|
}
|
|
1753
1776
|
get rotateAttributes() {
|
|
1754
1777
|
return this.messageAttributes.RotateCmd ?? [];
|
|
@@ -1761,12 +1784,12 @@ class me extends ye {
|
|
|
1761
1784
|
);
|
|
1762
1785
|
let i;
|
|
1763
1786
|
if (typeof e == "number")
|
|
1764
|
-
i =
|
|
1787
|
+
i = Ae.Create(
|
|
1765
1788
|
this.index,
|
|
1766
1789
|
new Array(n.length).fill([e, t])
|
|
1767
1790
|
);
|
|
1768
1791
|
else if (Array.isArray(e))
|
|
1769
|
-
i =
|
|
1792
|
+
i = Ae.Create(this.index, e);
|
|
1770
1793
|
else
|
|
1771
1794
|
throw new P(
|
|
1772
1795
|
"SendRotateCmd can only take a number and boolean, or an array of number/boolean tuples"
|
|
@@ -1784,12 +1807,12 @@ class me extends ye {
|
|
|
1784
1807
|
);
|
|
1785
1808
|
let i;
|
|
1786
1809
|
if (typeof e == "number")
|
|
1787
|
-
i =
|
|
1810
|
+
i = Ee.Create(
|
|
1788
1811
|
this.index,
|
|
1789
1812
|
new Array(n.length).fill([e, t])
|
|
1790
1813
|
);
|
|
1791
1814
|
else if (Array.isArray(e))
|
|
1792
|
-
i =
|
|
1815
|
+
i = Ee.Create(this.index, e);
|
|
1793
1816
|
else
|
|
1794
1817
|
throw new P(
|
|
1795
1818
|
"SendLinearCmd can only take a number and number, or an array of number/number tuples"
|
|
@@ -1798,15 +1821,15 @@ class me extends ye {
|
|
|
1798
1821
|
}
|
|
1799
1822
|
async sensorRead(e, t) {
|
|
1800
1823
|
const n = await this.send(
|
|
1801
|
-
new
|
|
1824
|
+
new Ge(this.index, e, t)
|
|
1802
1825
|
);
|
|
1803
|
-
switch (n
|
|
1804
|
-
case
|
|
1826
|
+
switch (ne(n)) {
|
|
1827
|
+
case ze:
|
|
1805
1828
|
return n.Data;
|
|
1806
1829
|
case Q:
|
|
1807
1830
|
throw U.FromError(n);
|
|
1808
1831
|
default:
|
|
1809
|
-
throw new
|
|
1832
|
+
throw new de(
|
|
1810
1833
|
`Message type ${n.constructor} not handled by sensorRead`
|
|
1811
1834
|
);
|
|
1812
1835
|
}
|
|
@@ -1863,15 +1886,15 @@ class me extends ye {
|
|
|
1863
1886
|
`Device ${this.name} has no raw readable endpoint ${e}`
|
|
1864
1887
|
);
|
|
1865
1888
|
const i = await this.send(
|
|
1866
|
-
new
|
|
1889
|
+
new Je(this.index, e, t, n)
|
|
1867
1890
|
);
|
|
1868
|
-
switch (i
|
|
1869
|
-
case
|
|
1891
|
+
switch (ne(i)) {
|
|
1892
|
+
case Xe:
|
|
1870
1893
|
return new Uint8Array(i.Data);
|
|
1871
1894
|
case Q:
|
|
1872
1895
|
throw U.FromError(i);
|
|
1873
1896
|
default:
|
|
1874
|
-
throw new
|
|
1897
|
+
throw new de(
|
|
1875
1898
|
`Message type ${i.constructor} not handled by rawRead`
|
|
1876
1899
|
);
|
|
1877
1900
|
}
|
|
@@ -1886,7 +1909,7 @@ class me extends ye {
|
|
|
1886
1909
|
`Device ${this.name} has no raw writable endpoint ${e}`
|
|
1887
1910
|
);
|
|
1888
1911
|
await this.sendExpectOk(
|
|
1889
|
-
new
|
|
1912
|
+
new qe(this.index, e, t, n)
|
|
1890
1913
|
);
|
|
1891
1914
|
}
|
|
1892
1915
|
async rawSubscribe(e) {
|
|
@@ -1898,7 +1921,7 @@ class me extends ye {
|
|
|
1898
1921
|
throw new P(
|
|
1899
1922
|
`Device ${this.name} has no raw subscribable endpoint ${e}`
|
|
1900
1923
|
);
|
|
1901
|
-
await this.sendExpectOk(new
|
|
1924
|
+
await this.sendExpectOk(new He(this.index, e));
|
|
1902
1925
|
}
|
|
1903
1926
|
async rawUnsubscribe(e) {
|
|
1904
1927
|
if (!this.messageAttributes.RawSubscribeCmd)
|
|
@@ -1910,11 +1933,11 @@ class me extends ye {
|
|
|
1910
1933
|
`Device ${this.name} has no raw unsubscribable endpoint ${e}`
|
|
1911
1934
|
);
|
|
1912
1935
|
await this.sendExpectOk(
|
|
1913
|
-
new
|
|
1936
|
+
new Ye(this.index, e)
|
|
1914
1937
|
);
|
|
1915
1938
|
}
|
|
1916
1939
|
async stop() {
|
|
1917
|
-
await this.sendExpectOk(new
|
|
1940
|
+
await this.sendExpectOk(new Ue(this.index));
|
|
1918
1941
|
}
|
|
1919
1942
|
emitDisconnected() {
|
|
1920
1943
|
this.emit("deviceremoved");
|
|
@@ -1927,7 +1950,7 @@ class me extends ye {
|
|
|
1927
1950
|
*
|
|
1928
1951
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
1929
1952
|
*/
|
|
1930
|
-
class
|
|
1953
|
+
class Kt {
|
|
1931
1954
|
constructor(e) {
|
|
1932
1955
|
this._useCounter = e, this._counter = 1, this._waitingMsgs = /* @__PURE__ */ new Map();
|
|
1933
1956
|
}
|
|
@@ -1967,33 +1990,33 @@ class Zt {
|
|
|
1967
1990
|
*
|
|
1968
1991
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
1969
1992
|
*/
|
|
1970
|
-
class
|
|
1993
|
+
class Vt extends U {
|
|
1971
1994
|
constructor(e) {
|
|
1972
1995
|
super(e, z.ERROR_UNKNOWN);
|
|
1973
1996
|
}
|
|
1974
1997
|
}
|
|
1975
|
-
class
|
|
1998
|
+
class sn extends ve {
|
|
1976
1999
|
constructor(e = "Generic Buttplug Client") {
|
|
1977
|
-
super(), this._pingTimer = null, this._connector = null, this._devices = /* @__PURE__ */ new Map(), this._logger =
|
|
2000
|
+
super(), this._pingTimer = null, this._connector = null, this._devices = /* @__PURE__ */ new Map(), this._logger = Pt.Logger, this._isScanning = !1, this._sorter = new Kt(!0), this.connect = async (t) => {
|
|
1978
2001
|
this._logger.Info(
|
|
1979
2002
|
`ButtplugClient: Connecting using ${t.constructor.name}`
|
|
1980
2003
|
), await t.connect(), this._connector = t, this._connector.addListener("message", this.parseMessages), this._connector.addListener("disconnect", this.disconnectHandler), await this.initializeConnection();
|
|
1981
2004
|
}, this.disconnect = async () => {
|
|
1982
2005
|
this._logger.Debug("ButtplugClient: Disconnect called"), this.checkConnector(), await this.shutdownConnection(), await this._connector.disconnect();
|
|
1983
2006
|
}, this.startScanning = async () => {
|
|
1984
|
-
this._logger.Debug("ButtplugClient: StartScanning called"), this._isScanning = !0, await this.sendMsgExpectOk(new
|
|
2007
|
+
this._logger.Debug("ButtplugClient: StartScanning called"), this._isScanning = !0, await this.sendMsgExpectOk(new ke());
|
|
1985
2008
|
}, this.stopScanning = async () => {
|
|
1986
|
-
this._logger.Debug("ButtplugClient: StopScanning called"), this._isScanning = !1, await this.sendMsgExpectOk(new
|
|
2009
|
+
this._logger.Debug("ButtplugClient: StopScanning called"), this._isScanning = !1, await this.sendMsgExpectOk(new je());
|
|
1987
2010
|
}, this.stopAllDevices = async () => {
|
|
1988
|
-
this._logger.Debug("ButtplugClient: StopAllDevices"), await this.sendMsgExpectOk(new
|
|
2011
|
+
this._logger.Debug("ButtplugClient: StopAllDevices"), await this.sendMsgExpectOk(new We());
|
|
1989
2012
|
}, this.disconnectHandler = () => {
|
|
1990
2013
|
this._logger.Info("ButtplugClient: Disconnect event receieved."), this.emit("disconnect");
|
|
1991
2014
|
}, this.parseMessages = (t) => {
|
|
1992
2015
|
const n = this._sorter.ParseIncomingMessages(t);
|
|
1993
2016
|
for (const i of n)
|
|
1994
|
-
switch (i
|
|
1995
|
-
case
|
|
1996
|
-
const u = i, a =
|
|
2017
|
+
switch (ne(i)) {
|
|
2018
|
+
case _e: {
|
|
2019
|
+
const u = i, a = ye.fromMsg(
|
|
1997
2020
|
u,
|
|
1998
2021
|
this.sendDeviceMessageClosure
|
|
1999
2022
|
);
|
|
@@ -2008,28 +2031,28 @@ class rn extends ye {
|
|
|
2008
2031
|
}
|
|
2009
2032
|
break;
|
|
2010
2033
|
}
|
|
2011
|
-
case
|
|
2034
|
+
case Be:
|
|
2012
2035
|
this._isScanning = !1, this.emit("scanningfinished", i);
|
|
2013
2036
|
break;
|
|
2014
2037
|
}
|
|
2015
2038
|
}, this.initializeConnection = async () => {
|
|
2016
2039
|
this.checkConnector();
|
|
2017
2040
|
const t = await this.sendMessage(
|
|
2018
|
-
new
|
|
2041
|
+
new $e(
|
|
2019
2042
|
this._clientName,
|
|
2020
|
-
|
|
2043
|
+
ge
|
|
2021
2044
|
)
|
|
2022
2045
|
);
|
|
2023
|
-
switch (t
|
|
2024
|
-
case
|
|
2046
|
+
switch (ne(t)) {
|
|
2047
|
+
case Fe: {
|
|
2025
2048
|
const n = t;
|
|
2026
2049
|
if (this._logger.Info(
|
|
2027
2050
|
`ButtplugClient: Connected to Server ${n.ServerName}`
|
|
2028
|
-
), n.MaxPingTime, n.MessageVersion <
|
|
2051
|
+
), n.MaxPingTime, n.MessageVersion < ge)
|
|
2029
2052
|
throw await this._connector.disconnect(), U.LogAndError(
|
|
2030
|
-
|
|
2053
|
+
Oe,
|
|
2031
2054
|
this._logger,
|
|
2032
|
-
`Server protocol version ${n.MessageVersion} is older than client protocol version ${
|
|
2055
|
+
`Server protocol version ${n.MessageVersion} is older than client protocol version ${ge}. Please update server.`
|
|
2033
2056
|
);
|
|
2034
2057
|
return await this.requestDeviceList(), !0;
|
|
2035
2058
|
}
|
|
@@ -2037,7 +2060,7 @@ class rn extends ye {
|
|
|
2037
2060
|
await this._connector.disconnect();
|
|
2038
2061
|
const n = t;
|
|
2039
2062
|
throw U.LogAndError(
|
|
2040
|
-
|
|
2063
|
+
Oe,
|
|
2041
2064
|
this._logger,
|
|
2042
2065
|
`Cannot connect to server. ${n.ErrorMessage}`
|
|
2043
2066
|
);
|
|
@@ -2046,12 +2069,12 @@ class rn extends ye {
|
|
|
2046
2069
|
return !1;
|
|
2047
2070
|
}, this.requestDeviceList = async () => {
|
|
2048
2071
|
this.checkConnector(), this._logger.Debug("ButtplugClient: ReceiveDeviceList called"), (await this.sendMessage(
|
|
2049
|
-
new
|
|
2072
|
+
new Pe()
|
|
2050
2073
|
)).Devices.forEach((n) => {
|
|
2051
2074
|
if (this._devices.has(n.DeviceIndex))
|
|
2052
2075
|
this._logger.Debug(`ButtplugClient: Device already added: ${n}`);
|
|
2053
2076
|
else {
|
|
2054
|
-
const i =
|
|
2077
|
+
const i = ye.fromMsg(
|
|
2055
2078
|
n,
|
|
2056
2079
|
this.sendDeviceMessageClosure
|
|
2057
2080
|
);
|
|
@@ -2062,16 +2085,16 @@ class rn extends ye {
|
|
|
2062
2085
|
await this.stopAllDevices(), this._pingTimer !== null && (clearInterval(this._pingTimer), this._pingTimer = null);
|
|
2063
2086
|
}, this.sendMsgExpectOk = async (t) => {
|
|
2064
2087
|
const n = await this.sendMessage(t);
|
|
2065
|
-
switch (n
|
|
2066
|
-
case
|
|
2088
|
+
switch (ne(n)) {
|
|
2089
|
+
case we:
|
|
2067
2090
|
return;
|
|
2068
2091
|
case Q:
|
|
2069
2092
|
throw U.FromError(n);
|
|
2070
2093
|
default:
|
|
2071
2094
|
throw U.LogAndError(
|
|
2072
|
-
|
|
2095
|
+
de,
|
|
2073
2096
|
this._logger,
|
|
2074
|
-
`Message type ${n.constructor} not handled by SendMsgExpectOk`
|
|
2097
|
+
`Message type ${ne(n).constructor} not handled by SendMsgExpectOk`
|
|
2075
2098
|
);
|
|
2076
2099
|
}
|
|
2077
2100
|
}, this.sendDeviceMessageClosure = async (t, n) => await this.sendDeviceMessage(t, n), this._clientName = e, this._logger.Debug(`ButtplugClient: Client ${e} created.`);
|
|
@@ -2105,32 +2128,12 @@ class rn extends ye {
|
|
|
2105
2128
|
}
|
|
2106
2129
|
checkConnector() {
|
|
2107
2130
|
if (!this.connected)
|
|
2108
|
-
throw new
|
|
2131
|
+
throw new Vt(
|
|
2109
2132
|
"ButtplugClient not connected"
|
|
2110
2133
|
);
|
|
2111
2134
|
}
|
|
2112
2135
|
}
|
|
2113
|
-
|
|
2114
|
-
for (const e of Object.values(Ht))
|
|
2115
|
-
if (typeof e == "function" && "Name" in e && e.Name === r)
|
|
2116
|
-
return e;
|
|
2117
|
-
return null;
|
|
2118
|
-
}
|
|
2119
|
-
function it(r) {
|
|
2120
|
-
const e = JSON.parse(r), t = [];
|
|
2121
|
-
for (const n of Array.from(e)) {
|
|
2122
|
-
const i = Object.getOwnPropertyNames(n)[0], u = Kt(i);
|
|
2123
|
-
if (u) {
|
|
2124
|
-
const a = Ft(
|
|
2125
|
-
u,
|
|
2126
|
-
n[i]
|
|
2127
|
-
);
|
|
2128
|
-
a.update(), t.push(a);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
return t;
|
|
2132
|
-
}
|
|
2133
|
-
class Vt extends ye {
|
|
2136
|
+
class en extends ve {
|
|
2134
2137
|
constructor(e) {
|
|
2135
2138
|
super(), this._url = e, this._websocketConstructor = null, this.connect = async () => {
|
|
2136
2139
|
const t = new (this._websocketConstructor ?? WebSocket)(this._url);
|
|
@@ -2162,17 +2165,17 @@ class Vt extends ye {
|
|
|
2162
2165
|
}
|
|
2163
2166
|
parseIncomingMessage(e) {
|
|
2164
2167
|
if (typeof e.data == "string") {
|
|
2165
|
-
const t =
|
|
2168
|
+
const t = ot(e.data);
|
|
2166
2169
|
this.emit("message", t);
|
|
2167
2170
|
} else
|
|
2168
2171
|
e.data instanceof Blob;
|
|
2169
2172
|
}
|
|
2170
2173
|
onReaderLoad(e) {
|
|
2171
|
-
const t =
|
|
2174
|
+
const t = ot(e.target.result);
|
|
2172
2175
|
this.emit("message", t);
|
|
2173
2176
|
}
|
|
2174
2177
|
}
|
|
2175
|
-
class
|
|
2178
|
+
class tn extends en {
|
|
2176
2179
|
constructor() {
|
|
2177
2180
|
super(...arguments), this.send = (e) => {
|
|
2178
2181
|
if (!this.Connected)
|
|
@@ -2181,74 +2184,75 @@ class en extends Vt {
|
|
|
2181
2184
|
};
|
|
2182
2185
|
}
|
|
2183
2186
|
}
|
|
2184
|
-
var
|
|
2187
|
+
var nn = function() {
|
|
2185
2188
|
throw new Error(
|
|
2186
2189
|
"ws does not work in the browser. Browser clients must use the native WebSocket object"
|
|
2187
2190
|
);
|
|
2188
2191
|
};
|
|
2189
|
-
class
|
|
2192
|
+
class on extends tn {
|
|
2190
2193
|
constructor() {
|
|
2191
|
-
super(...arguments), this._websocketConstructor =
|
|
2194
|
+
super(...arguments), this._websocketConstructor = nn.WebSocket;
|
|
2192
2195
|
}
|
|
2193
2196
|
}
|
|
2194
2197
|
export {
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2198
|
+
ce as ActuatorType,
|
|
2199
|
+
tn as ButtplugBrowserWebsocketClientConnector,
|
|
2200
|
+
sn as ButtplugClient,
|
|
2201
|
+
Vt as ButtplugClientConnectorException,
|
|
2202
|
+
ye as ButtplugClientDevice,
|
|
2200
2203
|
P as ButtplugDeviceError,
|
|
2201
2204
|
J as ButtplugDeviceMessage,
|
|
2202
2205
|
U as ButtplugError,
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
+
Oe as ButtplugInitError,
|
|
2207
|
+
ct as ButtplugLogLevel,
|
|
2208
|
+
Pt as ButtplugLogger,
|
|
2206
2209
|
H as ButtplugMessage,
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2210
|
+
de as ButtplugMessageError,
|
|
2211
|
+
Kt as ButtplugMessageSorter,
|
|
2212
|
+
on as ButtplugNodeWebsocketClientConnector,
|
|
2213
|
+
Zt as ButtplugPingError,
|
|
2214
|
+
ue as ButtplugSystemMessage,
|
|
2215
|
+
Qt as ButtplugUnknownError,
|
|
2213
2216
|
D as DEFAULT_MESSAGE_ID,
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
+
_e as DeviceAdded,
|
|
2218
|
+
De as DeviceInfo,
|
|
2219
|
+
Ne as DeviceList,
|
|
2217
2220
|
Te as DeviceRemoved,
|
|
2218
2221
|
Q as Error,
|
|
2219
2222
|
z as ErrorClass,
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2223
|
+
qt as GenericDeviceMessageAttributes,
|
|
2224
|
+
Se as GenericMessageSubcommand,
|
|
2225
|
+
Ee as LinearCmd,
|
|
2226
|
+
Tt as LogMessage,
|
|
2227
|
+
Jt as MAX_ID,
|
|
2228
|
+
ge as MESSAGE_SPEC_VERSION,
|
|
2229
|
+
Re as MessageAttributes,
|
|
2230
|
+
we as Ok,
|
|
2231
|
+
dt as Ping,
|
|
2232
|
+
Ht as RawDeviceMessageAttributes,
|
|
2233
|
+
Je as RawReadCmd,
|
|
2234
|
+
Xe as RawReading,
|
|
2235
|
+
He as RawSubscribeCmd,
|
|
2236
|
+
Ye as RawUnsubscribeCmd,
|
|
2237
|
+
qe as RawWriteCmd,
|
|
2238
|
+
Pe as RequestDeviceList,
|
|
2239
|
+
$e as RequestServerInfo,
|
|
2240
|
+
Ae as RotateCmd,
|
|
2241
|
+
ht as RotateSubcommand,
|
|
2239
2242
|
X as SYSTEM_MESSAGE_ID,
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2243
|
+
me as ScalarCmd,
|
|
2244
|
+
xe as ScalarSubcommand,
|
|
2245
|
+
Be as ScanningFinished,
|
|
2246
|
+
Yt as SensorDeviceMessageAttributes,
|
|
2247
|
+
Ge as SensorReadCmd,
|
|
2248
|
+
ze as SensorReading,
|
|
2246
2249
|
ee as SensorType,
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2250
|
+
Fe as ServerInfo,
|
|
2251
|
+
ke as StartScanning,
|
|
2252
|
+
We as StopAllDevices,
|
|
2253
|
+
Ue as StopDeviceCmd,
|
|
2254
|
+
je as StopScanning,
|
|
2255
|
+
gt as VectorSubcommand,
|
|
2256
|
+
ot as fromJSON,
|
|
2257
|
+
ne as getMessageClassFromMessage
|
|
2254
2258
|
};
|