@luxonis/visualizer-protobuf 2.2.0 → 2.3.0
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/dist/{communicator-DKKKAI0H.js → FoxgloveServer-tJZcJH5-.js} +1216 -174
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js +9 -10
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/adapter.d.ts +4 -7
- package/dist/apps/depthai-visualizer/src/connection/adapter.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/adapter.js +5 -5
- package/dist/apps/depthai-visualizer/src/connection/adapter.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts +7 -13
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/communicator.js +5 -4
- package/dist/apps/depthai-visualizer/src/connection/communicator.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts +8 -13
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/connection.js +19 -22
- package/dist/apps/depthai-visualizer/src/connection/connection.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.d.ts +6 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.js +63 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.js +29 -49
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts +20 -20
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js +34 -35
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.d.ts +16 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.js +114 -2
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.d.ts +1 -2
- package/dist/apps/depthai-visualizer/src/index.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.js +0 -1
- package/dist/apps/depthai-visualizer/src/index.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js +5 -5
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/utils.d.ts +7 -6
- package/dist/apps/depthai-visualizer/src/messaging/utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/utils.js +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.d.ts +6 -6
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.js +10 -7
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js +5 -5
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/compatibility.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js +1 -0
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js.map +1 -1
- package/dist/communicator-D9LSiWws.js +147 -0
- package/dist/foxglove-protocol-RBwoTi12.js +76 -0
- package/dist/{index-DbIgJEn4.js → index-BatOjqHR.js} +4 -5
- package/dist/{index-BZjzIIuE.js → index-BeMujwTx.js} +4 -5
- package/dist/{index-CE1LH59a.js → index-Bmv-vCsr.js} +4 -5
- package/dist/{index-Dai0K-_7.js → index-Bpb1nLXX.js} +4 -5
- package/dist/{index-FdS8KlrP.js → index-C38MwKQ5.js} +4 -5
- package/dist/{index-BsdqQ862.js → index-C4Xw5gJf.js} +4 -5
- package/dist/{index-C6m30paN.js → index-CCjTYhIj.js} +4 -5
- package/dist/{index-D0g7yNKD.js → index-CRzS8jhh.js} +4 -5
- package/dist/{index-MOg_zBJW.js → index-CTV8k4Ur.js} +4 -5
- package/dist/{index-Cqzhj8jS.js → index-Cjzn2Mk3.js} +4 -5
- package/dist/{index-SZgAiOi4.js → index-CzJG5yoW.js} +4 -5
- package/dist/{index-Cmp_Tjng.js → index-D2tE4ai8.js} +5 -6
- package/dist/{index-DleEaqya.js → index-D8PL1mUz.js} +4 -5
- package/dist/{index-B3F-eA-i.js → index-Dx5rKk7S.js} +115 -126
- package/dist/{index-DkDTcHOl.js → index-JdSlhtdz.js} +4 -5
- package/dist/{index-D_AhdZqi.js → index-LBWmbzab.js} +4 -5
- package/dist/{index-D7I7neMi.js → index-fDKFJqYA.js} +4 -5
- package/dist/{index-1yvlF6NH.js → index-kO40p_fI.js} +4 -5
- package/dist/{index-B4j3EVf8.js → index-lcxcWrBB.js} +4 -5
- package/dist/index.js +4 -5
- package/dist/{worker-CMZIJlQN.js → worker-BX0SIDt0.js} +24 -20
- package/dist/worker-C6ruK-iB.js +150 -0
- package/package.json +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts +0 -19
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js +0 -128
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js.map +0 -1
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.d.ts +0 -12
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.js +0 -52
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.js.map +0 -1
- package/dist/worker-DtDgSl3T.js +0 -11
- package/dist/worker-utils-BuUq1bP1.js +0 -1357
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import _m0 from 'protobufjs/minimal';
|
|
2
|
+
import require$$0 from 'ms';
|
|
3
|
+
|
|
4
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
|
+
|
|
6
|
+
function getDefaultExportFromCjs (x) {
|
|
7
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getAugmentedNamespace(n) {
|
|
11
|
+
if (n.__esModule) return n;
|
|
12
|
+
var f = n.default;
|
|
13
|
+
if (typeof f == "function") {
|
|
14
|
+
var a = function a () {
|
|
15
|
+
if (this instanceof a) {
|
|
16
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
17
|
+
}
|
|
18
|
+
return f.apply(this, arguments);
|
|
19
|
+
};
|
|
20
|
+
a.prototype = f.prototype;
|
|
21
|
+
} else a = {};
|
|
22
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
23
|
+
Object.keys(n).forEach(function (k) {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
25
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return n[k];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return a;
|
|
33
|
+
}
|
|
2
34
|
|
|
3
35
|
/**
|
|
4
36
|
* @license
|
|
@@ -1466,11 +1498,9 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
|
1466
1498
|
);
|
|
1467
1499
|
};
|
|
1468
1500
|
|
|
1469
|
-
// Code
|
|
1470
|
-
//
|
|
1471
|
-
//
|
|
1472
|
-
// protoc v3.19.6
|
|
1473
|
-
// source: common.proto
|
|
1501
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
1502
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
1503
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
1474
1504
|
|
|
1475
1505
|
let CameraModel = /*#__PURE__*/function (CameraModel) {
|
|
1476
1506
|
CameraModel[CameraModel["PERSPECTIVE"] = 0] = "PERSPECTIVE";
|
|
@@ -2164,11 +2194,9 @@ function isSet$6(value) {
|
|
|
2164
2194
|
return value !== null && value !== undefined;
|
|
2165
2195
|
}
|
|
2166
2196
|
|
|
2167
|
-
// Code
|
|
2168
|
-
//
|
|
2169
|
-
//
|
|
2170
|
-
// protoc v3.19.6
|
|
2171
|
-
// source: ImageAnnotations.proto
|
|
2197
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2198
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
2199
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
2172
2200
|
|
|
2173
2201
|
const protobufPackage$5 = "dai.proto.image_annotations";
|
|
2174
2202
|
let PointsAnnotationType = /*#__PURE__*/function (PointsAnnotationType) {
|
|
@@ -2778,11 +2806,9 @@ function isSet$5(value) {
|
|
|
2778
2806
|
}
|
|
2779
2807
|
const protobufName$5 = "ImageAnnotations";
|
|
2780
2808
|
|
|
2781
|
-
// Code
|
|
2782
|
-
//
|
|
2783
|
-
//
|
|
2784
|
-
// protoc v3.19.6
|
|
2785
|
-
// source: ImgFrame.proto
|
|
2809
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2810
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
2811
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
2786
2812
|
|
|
2787
2813
|
const protobufPackage$4 = "dai.proto.img_frame";
|
|
2788
2814
|
let Type = /*#__PURE__*/function (Type) {
|
|
@@ -3412,11 +3438,9 @@ function isSet$4(value) {
|
|
|
3412
3438
|
}
|
|
3413
3439
|
const protobufName$4 = "ImgFrame";
|
|
3414
3440
|
|
|
3415
|
-
// Code
|
|
3416
|
-
//
|
|
3417
|
-
//
|
|
3418
|
-
// protoc v3.19.6
|
|
3419
|
-
// source: EncodedFrame.proto
|
|
3441
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
3442
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3443
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
3420
3444
|
|
|
3421
3445
|
const protobufPackage$3 = "dai.proto.encoded_frame";
|
|
3422
3446
|
let Profile = /*#__PURE__*/function (Profile) {
|
|
@@ -3819,11 +3843,9 @@ function isSet$3(value) {
|
|
|
3819
3843
|
}
|
|
3820
3844
|
const protobufName$3 = "EncodedFrame";
|
|
3821
3845
|
|
|
3822
|
-
// Code
|
|
3823
|
-
//
|
|
3824
|
-
//
|
|
3825
|
-
// protoc v3.19.6
|
|
3826
|
-
// source: ImgDetections.proto
|
|
3846
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
3847
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3848
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
3827
3849
|
|
|
3828
3850
|
const protobufPackage$2 = "dai.proto.img_detections";
|
|
3829
3851
|
function createBaseImgDetections() {
|
|
@@ -4087,11 +4109,9 @@ function isSet$2(value) {
|
|
|
4087
4109
|
}
|
|
4088
4110
|
const protobufName$2 = "ImgDetections";
|
|
4089
4111
|
|
|
4090
|
-
// Code
|
|
4091
|
-
//
|
|
4092
|
-
//
|
|
4093
|
-
// protoc v3.19.6
|
|
4094
|
-
// source: PointCloudData.proto
|
|
4112
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
4113
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
4114
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4095
4115
|
|
|
4096
4116
|
const protobufPackage$1 = "dai.proto.point_cloud_data";
|
|
4097
4117
|
function createBasePointCloudData() {
|
|
@@ -4399,11 +4419,9 @@ function isSet$1(value) {
|
|
|
4399
4419
|
}
|
|
4400
4420
|
const protobufName$1 = "PointCloudData";
|
|
4401
4421
|
|
|
4402
|
-
// Code
|
|
4403
|
-
//
|
|
4404
|
-
//
|
|
4405
|
-
// protoc v3.19.6
|
|
4406
|
-
// source: SpatialImgDetections.proto
|
|
4422
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
4423
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
4424
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4407
4425
|
|
|
4408
4426
|
const protobufPackage = "dai.proto.spatial_img_detections";
|
|
4409
4427
|
let SpatialLocationCalculatorAlgorithm = /*#__PURE__*/function (SpatialLocationCalculatorAlgorithm) {
|
|
@@ -5069,148 +5087,1172 @@ const protobufsBySchema = Object.fromEntries(Object.entries(protobufs).map(([typ
|
|
|
5069
5087
|
...data
|
|
5070
5088
|
}]));
|
|
5071
5089
|
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5090
|
+
var eventemitter3 = {exports: {}};
|
|
5091
|
+
|
|
5092
|
+
(function (module) {
|
|
5093
|
+
|
|
5094
|
+
var has = Object.prototype.hasOwnProperty
|
|
5095
|
+
, prefix = '~';
|
|
5096
|
+
|
|
5097
|
+
/**
|
|
5098
|
+
* Constructor to create a storage for our `EE` objects.
|
|
5099
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
5100
|
+
*
|
|
5101
|
+
* @constructor
|
|
5102
|
+
* @private
|
|
5103
|
+
*/
|
|
5104
|
+
function Events() {}
|
|
5105
|
+
|
|
5106
|
+
//
|
|
5107
|
+
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
5108
|
+
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
5109
|
+
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
5110
|
+
// character to make sure that the built-in object properties are not
|
|
5111
|
+
// overridden or used as an attack vector.
|
|
5112
|
+
//
|
|
5113
|
+
if (Object.create) {
|
|
5114
|
+
Events.prototype = Object.create(null);
|
|
5115
|
+
|
|
5116
|
+
//
|
|
5117
|
+
// This hack is needed because the `__proto__` property is still inherited in
|
|
5118
|
+
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
5119
|
+
//
|
|
5120
|
+
if (!new Events().__proto__) prefix = false;
|
|
5121
|
+
}
|
|
5122
|
+
|
|
5123
|
+
/**
|
|
5124
|
+
* Representation of a single event listener.
|
|
5125
|
+
*
|
|
5126
|
+
* @param {Function} fn The listener function.
|
|
5127
|
+
* @param {*} context The context to invoke the listener with.
|
|
5128
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
5129
|
+
* @constructor
|
|
5130
|
+
* @private
|
|
5131
|
+
*/
|
|
5132
|
+
function EE(fn, context, once) {
|
|
5133
|
+
this.fn = fn;
|
|
5134
|
+
this.context = context;
|
|
5135
|
+
this.once = once || false;
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
/**
|
|
5139
|
+
* Add a listener for a given event.
|
|
5140
|
+
*
|
|
5141
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
5142
|
+
* @param {(String|Symbol)} event The event name.
|
|
5143
|
+
* @param {Function} fn The listener function.
|
|
5144
|
+
* @param {*} context The context to invoke the listener with.
|
|
5145
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
5146
|
+
* @returns {EventEmitter}
|
|
5147
|
+
* @private
|
|
5148
|
+
*/
|
|
5149
|
+
function addListener(emitter, event, fn, context, once) {
|
|
5150
|
+
if (typeof fn !== 'function') {
|
|
5151
|
+
throw new TypeError('The listener must be a function');
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
var listener = new EE(fn, context || emitter, once)
|
|
5155
|
+
, evt = prefix ? prefix + event : event;
|
|
5156
|
+
|
|
5157
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
5158
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
5159
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
5160
|
+
|
|
5161
|
+
return emitter;
|
|
5162
|
+
}
|
|
5163
|
+
|
|
5164
|
+
/**
|
|
5165
|
+
* Clear event by name.
|
|
5166
|
+
*
|
|
5167
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
5168
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
5169
|
+
* @private
|
|
5170
|
+
*/
|
|
5171
|
+
function clearEvent(emitter, evt) {
|
|
5172
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
5173
|
+
else delete emitter._events[evt];
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
/**
|
|
5177
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
5178
|
+
* `EventEmitter` interface.
|
|
5179
|
+
*
|
|
5180
|
+
* @constructor
|
|
5181
|
+
* @public
|
|
5182
|
+
*/
|
|
5183
|
+
function EventEmitter() {
|
|
5184
|
+
this._events = new Events();
|
|
5185
|
+
this._eventsCount = 0;
|
|
5186
|
+
}
|
|
5187
|
+
|
|
5188
|
+
/**
|
|
5189
|
+
* Return an array listing the events for which the emitter has registered
|
|
5190
|
+
* listeners.
|
|
5191
|
+
*
|
|
5192
|
+
* @returns {Array}
|
|
5193
|
+
* @public
|
|
5194
|
+
*/
|
|
5195
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
5196
|
+
var names = []
|
|
5197
|
+
, events
|
|
5198
|
+
, name;
|
|
5199
|
+
|
|
5200
|
+
if (this._eventsCount === 0) return names;
|
|
5201
|
+
|
|
5202
|
+
for (name in (events = this._events)) {
|
|
5203
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
5204
|
+
}
|
|
5205
|
+
|
|
5206
|
+
if (Object.getOwnPropertySymbols) {
|
|
5207
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5210
|
+
return names;
|
|
5211
|
+
};
|
|
5212
|
+
|
|
5213
|
+
/**
|
|
5214
|
+
* Return the listeners registered for a given event.
|
|
5215
|
+
*
|
|
5216
|
+
* @param {(String|Symbol)} event The event name.
|
|
5217
|
+
* @returns {Array} The registered listeners.
|
|
5218
|
+
* @public
|
|
5219
|
+
*/
|
|
5220
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
5221
|
+
var evt = prefix ? prefix + event : event
|
|
5222
|
+
, handlers = this._events[evt];
|
|
5223
|
+
|
|
5224
|
+
if (!handlers) return [];
|
|
5225
|
+
if (handlers.fn) return [handlers.fn];
|
|
5226
|
+
|
|
5227
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
5228
|
+
ee[i] = handlers[i].fn;
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
return ee;
|
|
5232
|
+
};
|
|
5233
|
+
|
|
5234
|
+
/**
|
|
5235
|
+
* Return the number of listeners listening to a given event.
|
|
5236
|
+
*
|
|
5237
|
+
* @param {(String|Symbol)} event The event name.
|
|
5238
|
+
* @returns {Number} The number of listeners.
|
|
5239
|
+
* @public
|
|
5240
|
+
*/
|
|
5241
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
5242
|
+
var evt = prefix ? prefix + event : event
|
|
5243
|
+
, listeners = this._events[evt];
|
|
5244
|
+
|
|
5245
|
+
if (!listeners) return 0;
|
|
5246
|
+
if (listeners.fn) return 1;
|
|
5247
|
+
return listeners.length;
|
|
5248
|
+
};
|
|
5249
|
+
|
|
5250
|
+
/**
|
|
5251
|
+
* Calls each of the listeners registered for a given event.
|
|
5252
|
+
*
|
|
5253
|
+
* @param {(String|Symbol)} event The event name.
|
|
5254
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
5255
|
+
* @public
|
|
5256
|
+
*/
|
|
5257
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
5258
|
+
var evt = prefix ? prefix + event : event;
|
|
5259
|
+
|
|
5260
|
+
if (!this._events[evt]) return false;
|
|
5261
|
+
|
|
5262
|
+
var listeners = this._events[evt]
|
|
5263
|
+
, len = arguments.length
|
|
5264
|
+
, args
|
|
5265
|
+
, i;
|
|
5266
|
+
|
|
5267
|
+
if (listeners.fn) {
|
|
5268
|
+
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
5269
|
+
|
|
5270
|
+
switch (len) {
|
|
5271
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
5272
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
5273
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
5274
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
5275
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
5276
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
5277
|
+
}
|
|
5278
|
+
|
|
5279
|
+
for (i = 1, args = new Array(len -1); i < len; i++) {
|
|
5280
|
+
args[i - 1] = arguments[i];
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
listeners.fn.apply(listeners.context, args);
|
|
5284
|
+
} else {
|
|
5285
|
+
var length = listeners.length
|
|
5286
|
+
, j;
|
|
5287
|
+
|
|
5288
|
+
for (i = 0; i < length; i++) {
|
|
5289
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
5290
|
+
|
|
5291
|
+
switch (len) {
|
|
5292
|
+
case 1: listeners[i].fn.call(listeners[i].context); break;
|
|
5293
|
+
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
|
5294
|
+
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
|
5295
|
+
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
|
5296
|
+
default:
|
|
5297
|
+
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
|
5298
|
+
args[j - 1] = arguments[j];
|
|
5299
|
+
}
|
|
5300
|
+
|
|
5301
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
5302
|
+
}
|
|
5303
|
+
}
|
|
5304
|
+
}
|
|
5305
|
+
|
|
5306
|
+
return true;
|
|
5307
|
+
};
|
|
5308
|
+
|
|
5309
|
+
/**
|
|
5310
|
+
* Add a listener for a given event.
|
|
5311
|
+
*
|
|
5312
|
+
* @param {(String|Symbol)} event The event name.
|
|
5313
|
+
* @param {Function} fn The listener function.
|
|
5314
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
5315
|
+
* @returns {EventEmitter} `this`.
|
|
5316
|
+
* @public
|
|
5317
|
+
*/
|
|
5318
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
5319
|
+
return addListener(this, event, fn, context, false);
|
|
5320
|
+
};
|
|
5321
|
+
|
|
5322
|
+
/**
|
|
5323
|
+
* Add a one-time listener for a given event.
|
|
5324
|
+
*
|
|
5325
|
+
* @param {(String|Symbol)} event The event name.
|
|
5326
|
+
* @param {Function} fn The listener function.
|
|
5327
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
5328
|
+
* @returns {EventEmitter} `this`.
|
|
5329
|
+
* @public
|
|
5330
|
+
*/
|
|
5331
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
5332
|
+
return addListener(this, event, fn, context, true);
|
|
5333
|
+
};
|
|
5334
|
+
|
|
5335
|
+
/**
|
|
5336
|
+
* Remove the listeners of a given event.
|
|
5337
|
+
*
|
|
5338
|
+
* @param {(String|Symbol)} event The event name.
|
|
5339
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
5340
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
5341
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
5342
|
+
* @returns {EventEmitter} `this`.
|
|
5343
|
+
* @public
|
|
5344
|
+
*/
|
|
5345
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
5346
|
+
var evt = prefix ? prefix + event : event;
|
|
5347
|
+
|
|
5348
|
+
if (!this._events[evt]) return this;
|
|
5349
|
+
if (!fn) {
|
|
5350
|
+
clearEvent(this, evt);
|
|
5351
|
+
return this;
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
var listeners = this._events[evt];
|
|
5355
|
+
|
|
5356
|
+
if (listeners.fn) {
|
|
5357
|
+
if (
|
|
5358
|
+
listeners.fn === fn &&
|
|
5359
|
+
(!once || listeners.once) &&
|
|
5360
|
+
(!context || listeners.context === context)
|
|
5361
|
+
) {
|
|
5362
|
+
clearEvent(this, evt);
|
|
5363
|
+
}
|
|
5364
|
+
} else {
|
|
5365
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
5366
|
+
if (
|
|
5367
|
+
listeners[i].fn !== fn ||
|
|
5368
|
+
(once && !listeners[i].once) ||
|
|
5369
|
+
(context && listeners[i].context !== context)
|
|
5370
|
+
) {
|
|
5371
|
+
events.push(listeners[i]);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5375
|
+
//
|
|
5376
|
+
// Reset the array, or remove it completely if we have no more listeners.
|
|
5377
|
+
//
|
|
5378
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
5379
|
+
else clearEvent(this, evt);
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5382
|
+
return this;
|
|
5383
|
+
};
|
|
5384
|
+
|
|
5385
|
+
/**
|
|
5386
|
+
* Remove all listeners, or those of the specified event.
|
|
5387
|
+
*
|
|
5388
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
5389
|
+
* @returns {EventEmitter} `this`.
|
|
5390
|
+
* @public
|
|
5391
|
+
*/
|
|
5392
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
5393
|
+
var evt;
|
|
5394
|
+
|
|
5395
|
+
if (event) {
|
|
5396
|
+
evt = prefix ? prefix + event : event;
|
|
5397
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
5398
|
+
} else {
|
|
5399
|
+
this._events = new Events();
|
|
5400
|
+
this._eventsCount = 0;
|
|
5401
|
+
}
|
|
5402
|
+
|
|
5403
|
+
return this;
|
|
5404
|
+
};
|
|
5405
|
+
|
|
5406
|
+
//
|
|
5407
|
+
// Alias methods names because people roll like that.
|
|
5408
|
+
//
|
|
5409
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
5410
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
5411
|
+
|
|
5412
|
+
//
|
|
5413
|
+
// Expose the prefix.
|
|
5414
|
+
//
|
|
5415
|
+
EventEmitter.prefixed = prefix;
|
|
5416
|
+
|
|
5417
|
+
//
|
|
5418
|
+
// Allow `EventEmitter` to be imported as module namespace.
|
|
5419
|
+
//
|
|
5420
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
5421
|
+
|
|
5422
|
+
//
|
|
5423
|
+
// Expose the module.
|
|
5424
|
+
//
|
|
5425
|
+
{
|
|
5426
|
+
module.exports = EventEmitter;
|
|
5427
|
+
}
|
|
5428
|
+
} (eventemitter3));
|
|
5429
|
+
|
|
5430
|
+
var eventemitter3Exports = eventemitter3.exports;
|
|
5431
|
+
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
5432
|
+
|
|
5433
|
+
var BinaryOpcode;
|
|
5434
|
+
(function (BinaryOpcode) {
|
|
5435
|
+
BinaryOpcode[BinaryOpcode["MESSAGE_DATA"] = 1] = "MESSAGE_DATA";
|
|
5436
|
+
BinaryOpcode[BinaryOpcode["TIME"] = 2] = "TIME";
|
|
5437
|
+
BinaryOpcode[BinaryOpcode["SERVICE_CALL_RESPONSE"] = 3] = "SERVICE_CALL_RESPONSE";
|
|
5438
|
+
BinaryOpcode[BinaryOpcode["FETCH_ASSET_RESPONSE"] = 4] = "FETCH_ASSET_RESPONSE";
|
|
5439
|
+
})(BinaryOpcode || (BinaryOpcode = {}));
|
|
5440
|
+
var ClientBinaryOpcode;
|
|
5441
|
+
(function (ClientBinaryOpcode) {
|
|
5442
|
+
ClientBinaryOpcode[ClientBinaryOpcode["MESSAGE_DATA"] = 1] = "MESSAGE_DATA";
|
|
5443
|
+
ClientBinaryOpcode[ClientBinaryOpcode["SERVICE_CALL_REQUEST"] = 2] = "SERVICE_CALL_REQUEST";
|
|
5444
|
+
})(ClientBinaryOpcode || (ClientBinaryOpcode = {}));
|
|
5445
|
+
var StatusLevel;
|
|
5446
|
+
(function (StatusLevel) {
|
|
5447
|
+
StatusLevel[StatusLevel["INFO"] = 0] = "INFO";
|
|
5448
|
+
StatusLevel[StatusLevel["WARNING"] = 1] = "WARNING";
|
|
5449
|
+
StatusLevel[StatusLevel["ERROR"] = 2] = "ERROR";
|
|
5450
|
+
})(StatusLevel || (StatusLevel = {}));
|
|
5451
|
+
var ServerCapability;
|
|
5452
|
+
(function (ServerCapability) {
|
|
5453
|
+
ServerCapability["clientPublish"] = "clientPublish";
|
|
5454
|
+
ServerCapability["time"] = "time";
|
|
5455
|
+
ServerCapability["parameters"] = "parameters";
|
|
5456
|
+
ServerCapability["parametersSubscribe"] = "parametersSubscribe";
|
|
5457
|
+
ServerCapability["services"] = "services";
|
|
5458
|
+
ServerCapability["connectionGraph"] = "connectionGraph";
|
|
5459
|
+
ServerCapability["assets"] = "assets";
|
|
5460
|
+
})(ServerCapability || (ServerCapability = {}));
|
|
5461
|
+
var FetchAssetStatus;
|
|
5462
|
+
(function (FetchAssetStatus) {
|
|
5463
|
+
FetchAssetStatus[FetchAssetStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
5464
|
+
FetchAssetStatus[FetchAssetStatus["ERROR"] = 1] = "ERROR";
|
|
5465
|
+
})(FetchAssetStatus || (FetchAssetStatus = {}));
|
|
5466
|
+
|
|
5467
|
+
const textDecoder = new TextDecoder();
|
|
5468
|
+
function parseServerMessage(buffer) {
|
|
5469
|
+
const view = new DataView(buffer);
|
|
5470
|
+
let offset = 0;
|
|
5471
|
+
const op = view.getUint8(offset);
|
|
5472
|
+
offset += 1;
|
|
5473
|
+
switch (op) {
|
|
5474
|
+
case BinaryOpcode.MESSAGE_DATA: {
|
|
5475
|
+
const subscriptionId = view.getUint32(offset, true);
|
|
5476
|
+
offset += 4;
|
|
5477
|
+
const timestamp = view.getBigUint64(offset, true);
|
|
5478
|
+
offset += 8;
|
|
5479
|
+
const data = new DataView(buffer, offset);
|
|
5480
|
+
return { op, subscriptionId, timestamp, data };
|
|
5481
|
+
}
|
|
5482
|
+
case BinaryOpcode.TIME: {
|
|
5483
|
+
const timestamp = view.getBigUint64(offset, true);
|
|
5484
|
+
return { op, timestamp };
|
|
5485
|
+
}
|
|
5486
|
+
case BinaryOpcode.SERVICE_CALL_RESPONSE: {
|
|
5487
|
+
const serviceId = view.getUint32(offset, true);
|
|
5488
|
+
offset += 4;
|
|
5489
|
+
const callId = view.getUint32(offset, true);
|
|
5490
|
+
offset += 4;
|
|
5491
|
+
const encodingLength = view.getUint32(offset, true);
|
|
5492
|
+
offset += 4;
|
|
5493
|
+
const encodingBytes = new DataView(buffer, offset, encodingLength);
|
|
5494
|
+
const encoding = textDecoder.decode(encodingBytes);
|
|
5495
|
+
offset += encodingLength;
|
|
5496
|
+
const data = new DataView(buffer, offset, buffer.byteLength - offset);
|
|
5497
|
+
return { op, serviceId, callId, encoding, data };
|
|
5498
|
+
}
|
|
5499
|
+
case BinaryOpcode.FETCH_ASSET_RESPONSE: {
|
|
5500
|
+
const requestId = view.getUint32(offset, true);
|
|
5501
|
+
offset += 4;
|
|
5502
|
+
const status = view.getUint8(offset);
|
|
5503
|
+
offset += 1;
|
|
5504
|
+
const errorMsgLength = view.getUint32(offset, true);
|
|
5505
|
+
offset += 4;
|
|
5506
|
+
const error = textDecoder.decode(new DataView(buffer, offset, errorMsgLength));
|
|
5507
|
+
offset += errorMsgLength;
|
|
5508
|
+
switch (status) {
|
|
5509
|
+
case FetchAssetStatus.SUCCESS: {
|
|
5510
|
+
const data = new DataView(buffer, offset, buffer.byteLength - offset);
|
|
5511
|
+
return { op, requestId, status, data };
|
|
5512
|
+
}
|
|
5513
|
+
case FetchAssetStatus.ERROR:
|
|
5514
|
+
return { op, requestId, status, error };
|
|
5515
|
+
default:
|
|
5516
|
+
throw new Error(`Unrecognized fetch asset status: ${status}`);
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
throw new Error(`Unrecognized server opcode in binary message: ${op.toString(16)}`);
|
|
5521
|
+
}
|
|
5075
5522
|
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5523
|
+
const textEncoder = new TextEncoder();
|
|
5524
|
+
class FoxgloveClient {
|
|
5525
|
+
static SUPPORTED_SUBPROTOCOL = "foxglove.websocket.v1";
|
|
5526
|
+
#emitter = new EventEmitter();
|
|
5527
|
+
#ws;
|
|
5528
|
+
#nextSubscriptionId = 0;
|
|
5529
|
+
#nextAdvertisementId = 0;
|
|
5530
|
+
constructor({ ws }) {
|
|
5531
|
+
this.#ws = ws;
|
|
5532
|
+
this.#reconnect();
|
|
5533
|
+
}
|
|
5534
|
+
on(name, listener) {
|
|
5535
|
+
this.#emitter.on(name, listener);
|
|
5536
|
+
}
|
|
5537
|
+
off(name, listener) {
|
|
5538
|
+
this.#emitter.off(name, listener);
|
|
5539
|
+
}
|
|
5540
|
+
#reconnect() {
|
|
5541
|
+
this.#ws.binaryType = "arraybuffer";
|
|
5542
|
+
this.#ws.onerror = (event) => {
|
|
5543
|
+
this.#emitter.emit("error", event.error);
|
|
5544
|
+
};
|
|
5545
|
+
this.#ws.onopen = (_event) => {
|
|
5546
|
+
if (this.#ws.protocol !== FoxgloveClient.SUPPORTED_SUBPROTOCOL) {
|
|
5547
|
+
throw new Error(`Expected subprotocol ${FoxgloveClient.SUPPORTED_SUBPROTOCOL}, got '${this.#ws.protocol}'`);
|
|
5548
|
+
}
|
|
5549
|
+
this.#emitter.emit("open");
|
|
5550
|
+
};
|
|
5551
|
+
this.#ws.onmessage = (event) => {
|
|
5552
|
+
let message;
|
|
5553
|
+
try {
|
|
5554
|
+
if (event.data instanceof ArrayBuffer) {
|
|
5555
|
+
message = parseServerMessage(event.data);
|
|
5556
|
+
}
|
|
5557
|
+
else {
|
|
5558
|
+
message = JSON.parse(event.data);
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
catch (error) {
|
|
5562
|
+
this.#emitter.emit("error", error);
|
|
5563
|
+
return;
|
|
5564
|
+
}
|
|
5565
|
+
switch (message.op) {
|
|
5566
|
+
case "serverInfo":
|
|
5567
|
+
this.#emitter.emit("serverInfo", message);
|
|
5568
|
+
return;
|
|
5569
|
+
case "status":
|
|
5570
|
+
this.#emitter.emit("status", message);
|
|
5571
|
+
return;
|
|
5572
|
+
case "advertise":
|
|
5573
|
+
this.#emitter.emit("advertise", message.channels);
|
|
5574
|
+
return;
|
|
5575
|
+
case "unadvertise":
|
|
5576
|
+
this.#emitter.emit("unadvertise", message.channelIds);
|
|
5577
|
+
return;
|
|
5578
|
+
case "parameterValues":
|
|
5579
|
+
this.#emitter.emit("parameterValues", message);
|
|
5580
|
+
return;
|
|
5581
|
+
case "advertiseServices":
|
|
5582
|
+
this.#emitter.emit("advertiseServices", message.services);
|
|
5583
|
+
return;
|
|
5584
|
+
case "unadvertiseServices":
|
|
5585
|
+
this.#emitter.emit("unadvertiseServices", message.serviceIds);
|
|
5586
|
+
return;
|
|
5587
|
+
case "connectionGraphUpdate":
|
|
5588
|
+
this.#emitter.emit("connectionGraphUpdate", message);
|
|
5589
|
+
return;
|
|
5590
|
+
case BinaryOpcode.MESSAGE_DATA:
|
|
5591
|
+
this.#emitter.emit("message", message);
|
|
5592
|
+
return;
|
|
5593
|
+
case BinaryOpcode.TIME:
|
|
5594
|
+
this.#emitter.emit("time", message);
|
|
5595
|
+
return;
|
|
5596
|
+
case BinaryOpcode.SERVICE_CALL_RESPONSE:
|
|
5597
|
+
this.#emitter.emit("serviceCallResponse", message);
|
|
5598
|
+
return;
|
|
5599
|
+
case BinaryOpcode.FETCH_ASSET_RESPONSE:
|
|
5600
|
+
this.#emitter.emit("fetchAssetResponse", message);
|
|
5601
|
+
return;
|
|
5602
|
+
}
|
|
5603
|
+
this.#emitter.emit("error", new Error(`Unrecognized server opcode: ${message.op}`));
|
|
5604
|
+
};
|
|
5605
|
+
this.#ws.onclose = (event) => {
|
|
5606
|
+
this.#emitter.emit("close", event);
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5609
|
+
close() {
|
|
5610
|
+
this.#ws.close();
|
|
5611
|
+
}
|
|
5612
|
+
subscribe(channelId) {
|
|
5613
|
+
const id = this.#nextSubscriptionId++;
|
|
5614
|
+
const subscriptions = [{ id, channelId }];
|
|
5615
|
+
this.#send({ op: "subscribe", subscriptions });
|
|
5616
|
+
return id;
|
|
5617
|
+
}
|
|
5618
|
+
unsubscribe(subscriptionId) {
|
|
5619
|
+
this.#send({ op: "unsubscribe", subscriptionIds: [subscriptionId] });
|
|
5620
|
+
}
|
|
5621
|
+
advertise(clientChannel) {
|
|
5622
|
+
const id = ++this.#nextAdvertisementId;
|
|
5623
|
+
const channels = [{ id, ...clientChannel }];
|
|
5624
|
+
this.#send({ op: "advertise", channels });
|
|
5625
|
+
return id;
|
|
5626
|
+
}
|
|
5627
|
+
unadvertise(channelId) {
|
|
5628
|
+
this.#send({ op: "unadvertise", channelIds: [channelId] });
|
|
5629
|
+
}
|
|
5630
|
+
getParameters(parameterNames, id) {
|
|
5631
|
+
this.#send({ op: "getParameters", parameterNames, id });
|
|
5632
|
+
}
|
|
5633
|
+
setParameters(parameters, id) {
|
|
5634
|
+
this.#send({ op: "setParameters", parameters, id });
|
|
5635
|
+
}
|
|
5636
|
+
subscribeParameterUpdates(parameterNames) {
|
|
5637
|
+
this.#send({ op: "subscribeParameterUpdates", parameterNames });
|
|
5638
|
+
}
|
|
5639
|
+
unsubscribeParameterUpdates(parameterNames) {
|
|
5640
|
+
this.#send({ op: "unsubscribeParameterUpdates", parameterNames });
|
|
5641
|
+
}
|
|
5642
|
+
sendMessage(channelId, data) {
|
|
5643
|
+
const payload = new Uint8Array(5 + data.byteLength);
|
|
5644
|
+
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
5645
|
+
view.setUint8(0, ClientBinaryOpcode.MESSAGE_DATA);
|
|
5646
|
+
view.setUint32(1, channelId, true);
|
|
5647
|
+
payload.set(data, 5);
|
|
5648
|
+
this.#ws.send(payload);
|
|
5649
|
+
}
|
|
5650
|
+
sendServiceCallRequest(request) {
|
|
5651
|
+
const encoding = textEncoder.encode(request.encoding);
|
|
5652
|
+
const payload = new Uint8Array(1 + 4 + 4 + 4 + encoding.length + request.data.byteLength);
|
|
5653
|
+
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
5654
|
+
let offset = 0;
|
|
5655
|
+
view.setUint8(offset, ClientBinaryOpcode.SERVICE_CALL_REQUEST);
|
|
5656
|
+
offset += 1;
|
|
5657
|
+
view.setUint32(offset, request.serviceId, true);
|
|
5658
|
+
offset += 4;
|
|
5659
|
+
view.setUint32(offset, request.callId, true);
|
|
5660
|
+
offset += 4;
|
|
5661
|
+
view.setUint32(offset, request.encoding.length, true);
|
|
5662
|
+
offset += 4;
|
|
5663
|
+
payload.set(encoding, offset);
|
|
5664
|
+
offset += encoding.length;
|
|
5665
|
+
const data = new Uint8Array(request.data.buffer, request.data.byteOffset, request.data.byteLength);
|
|
5666
|
+
payload.set(data, offset);
|
|
5667
|
+
this.#ws.send(payload);
|
|
5668
|
+
}
|
|
5669
|
+
subscribeConnectionGraph() {
|
|
5670
|
+
this.#send({ op: "subscribeConnectionGraph" });
|
|
5671
|
+
}
|
|
5672
|
+
unsubscribeConnectionGraph() {
|
|
5673
|
+
this.#send({ op: "unsubscribeConnectionGraph" });
|
|
5674
|
+
}
|
|
5675
|
+
fetchAsset(uri, requestId) {
|
|
5676
|
+
this.#send({ op: "fetchAsset", uri, requestId });
|
|
5677
|
+
}
|
|
5678
|
+
/**
|
|
5679
|
+
* @deprecated Use `sendServiceCallRequest` instead
|
|
5680
|
+
*/
|
|
5681
|
+
sendCallServiceRequest(request) {
|
|
5682
|
+
this.sendServiceCallRequest(request);
|
|
5683
|
+
}
|
|
5684
|
+
#send(message) {
|
|
5685
|
+
this.#ws.send(JSON.stringify(message));
|
|
5686
|
+
}
|
|
5085
5687
|
}
|
|
5086
5688
|
|
|
5087
|
-
|
|
5088
|
-
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
5089
|
-
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
5689
|
+
var browser = {exports: {}};
|
|
5090
5690
|
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5691
|
+
/**
|
|
5692
|
+
* This is the common logic for both the Node.js and web browser
|
|
5693
|
+
* implementations of `debug()`.
|
|
5694
|
+
*/
|
|
5695
|
+
|
|
5696
|
+
function setup(env) {
|
|
5697
|
+
createDebug.debug = createDebug;
|
|
5698
|
+
createDebug.default = createDebug;
|
|
5699
|
+
createDebug.coerce = coerce;
|
|
5700
|
+
createDebug.disable = disable;
|
|
5701
|
+
createDebug.enable = enable;
|
|
5702
|
+
createDebug.enabled = enabled;
|
|
5703
|
+
createDebug.humanize = require$$0;
|
|
5704
|
+
createDebug.destroy = destroy;
|
|
5705
|
+
|
|
5706
|
+
Object.keys(env).forEach(key => {
|
|
5707
|
+
createDebug[key] = env[key];
|
|
5708
|
+
});
|
|
5709
|
+
|
|
5710
|
+
/**
|
|
5711
|
+
* The currently active debug mode names, and names to skip.
|
|
5712
|
+
*/
|
|
5713
|
+
|
|
5714
|
+
createDebug.names = [];
|
|
5715
|
+
createDebug.skips = [];
|
|
5716
|
+
|
|
5717
|
+
/**
|
|
5718
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
5719
|
+
*
|
|
5720
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
5721
|
+
*/
|
|
5722
|
+
createDebug.formatters = {};
|
|
5723
|
+
|
|
5724
|
+
/**
|
|
5725
|
+
* Selects a color for a debug namespace
|
|
5726
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
5727
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
5728
|
+
* @api private
|
|
5729
|
+
*/
|
|
5730
|
+
function selectColor(namespace) {
|
|
5731
|
+
let hash = 0;
|
|
5732
|
+
|
|
5733
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
5734
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
5735
|
+
hash |= 0; // Convert to 32bit integer
|
|
5736
|
+
}
|
|
5737
|
+
|
|
5738
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
5739
|
+
}
|
|
5740
|
+
createDebug.selectColor = selectColor;
|
|
5741
|
+
|
|
5742
|
+
/**
|
|
5743
|
+
* Create a debugger with the given `namespace`.
|
|
5744
|
+
*
|
|
5745
|
+
* @param {String} namespace
|
|
5746
|
+
* @return {Function}
|
|
5747
|
+
* @api public
|
|
5748
|
+
*/
|
|
5749
|
+
function createDebug(namespace) {
|
|
5750
|
+
let prevTime;
|
|
5751
|
+
let enableOverride = null;
|
|
5752
|
+
let namespacesCache;
|
|
5753
|
+
let enabledCache;
|
|
5754
|
+
|
|
5755
|
+
function debug(...args) {
|
|
5756
|
+
// Disabled?
|
|
5757
|
+
if (!debug.enabled) {
|
|
5758
|
+
return;
|
|
5759
|
+
}
|
|
5760
|
+
|
|
5761
|
+
const self = debug;
|
|
5762
|
+
|
|
5763
|
+
// Set `diff` timestamp
|
|
5764
|
+
const curr = Number(new Date());
|
|
5765
|
+
const ms = curr - (prevTime || curr);
|
|
5766
|
+
self.diff = ms;
|
|
5767
|
+
self.prev = prevTime;
|
|
5768
|
+
self.curr = curr;
|
|
5769
|
+
prevTime = curr;
|
|
5770
|
+
|
|
5771
|
+
args[0] = createDebug.coerce(args[0]);
|
|
5772
|
+
|
|
5773
|
+
if (typeof args[0] !== 'string') {
|
|
5774
|
+
// Anything else let's inspect with %O
|
|
5775
|
+
args.unshift('%O');
|
|
5776
|
+
}
|
|
5777
|
+
|
|
5778
|
+
// Apply any `formatters` transformations
|
|
5779
|
+
let index = 0;
|
|
5780
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
5781
|
+
// If we encounter an escaped % then don't increase the array index
|
|
5782
|
+
if (match === '%%') {
|
|
5783
|
+
return '%';
|
|
5784
|
+
}
|
|
5785
|
+
index++;
|
|
5786
|
+
const formatter = createDebug.formatters[format];
|
|
5787
|
+
if (typeof formatter === 'function') {
|
|
5788
|
+
const val = args[index];
|
|
5789
|
+
match = formatter.call(self, val);
|
|
5790
|
+
|
|
5791
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
5792
|
+
args.splice(index, 1);
|
|
5793
|
+
index--;
|
|
5794
|
+
}
|
|
5795
|
+
return match;
|
|
5796
|
+
});
|
|
5797
|
+
|
|
5798
|
+
// Apply env-specific formatting (colors, etc.)
|
|
5799
|
+
createDebug.formatArgs.call(self, args);
|
|
5800
|
+
|
|
5801
|
+
const logFn = self.log || createDebug.log;
|
|
5802
|
+
logFn.apply(self, args);
|
|
5803
|
+
}
|
|
5804
|
+
|
|
5805
|
+
debug.namespace = namespace;
|
|
5806
|
+
debug.useColors = createDebug.useColors();
|
|
5807
|
+
debug.color = createDebug.selectColor(namespace);
|
|
5808
|
+
debug.extend = extend;
|
|
5809
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
5810
|
+
|
|
5811
|
+
Object.defineProperty(debug, 'enabled', {
|
|
5812
|
+
enumerable: true,
|
|
5813
|
+
configurable: false,
|
|
5814
|
+
get: () => {
|
|
5815
|
+
if (enableOverride !== null) {
|
|
5816
|
+
return enableOverride;
|
|
5817
|
+
}
|
|
5818
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
5819
|
+
namespacesCache = createDebug.namespaces;
|
|
5820
|
+
enabledCache = createDebug.enabled(namespace);
|
|
5821
|
+
}
|
|
5822
|
+
|
|
5823
|
+
return enabledCache;
|
|
5824
|
+
},
|
|
5825
|
+
set: v => {
|
|
5826
|
+
enableOverride = v;
|
|
5827
|
+
}
|
|
5828
|
+
});
|
|
5829
|
+
|
|
5830
|
+
// Env-specific initialization logic for debug instances
|
|
5831
|
+
if (typeof createDebug.init === 'function') {
|
|
5832
|
+
createDebug.init(debug);
|
|
5833
|
+
}
|
|
5834
|
+
|
|
5835
|
+
return debug;
|
|
5836
|
+
}
|
|
5837
|
+
|
|
5838
|
+
function extend(namespace, delimiter) {
|
|
5839
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
5840
|
+
newDebug.log = this.log;
|
|
5841
|
+
return newDebug;
|
|
5842
|
+
}
|
|
5843
|
+
|
|
5844
|
+
/**
|
|
5845
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
5846
|
+
* separated by a colon and wildcards.
|
|
5847
|
+
*
|
|
5848
|
+
* @param {String} namespaces
|
|
5849
|
+
* @api public
|
|
5850
|
+
*/
|
|
5851
|
+
function enable(namespaces) {
|
|
5852
|
+
createDebug.save(namespaces);
|
|
5853
|
+
createDebug.namespaces = namespaces;
|
|
5854
|
+
|
|
5855
|
+
createDebug.names = [];
|
|
5856
|
+
createDebug.skips = [];
|
|
5857
|
+
|
|
5858
|
+
let i;
|
|
5859
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
5860
|
+
const len = split.length;
|
|
5861
|
+
|
|
5862
|
+
for (i = 0; i < len; i++) {
|
|
5863
|
+
if (!split[i]) {
|
|
5864
|
+
// ignore empty strings
|
|
5865
|
+
continue;
|
|
5866
|
+
}
|
|
5867
|
+
|
|
5868
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
5869
|
+
|
|
5870
|
+
if (namespaces[0] === '-') {
|
|
5871
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
5872
|
+
} else {
|
|
5873
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
|
|
5878
|
+
/**
|
|
5879
|
+
* Disable debug output.
|
|
5880
|
+
*
|
|
5881
|
+
* @return {String} namespaces
|
|
5882
|
+
* @api public
|
|
5883
|
+
*/
|
|
5884
|
+
function disable() {
|
|
5885
|
+
const namespaces = [
|
|
5886
|
+
...createDebug.names.map(toNamespace),
|
|
5887
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
5888
|
+
].join(',');
|
|
5889
|
+
createDebug.enable('');
|
|
5890
|
+
return namespaces;
|
|
5891
|
+
}
|
|
5892
|
+
|
|
5893
|
+
/**
|
|
5894
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
5895
|
+
*
|
|
5896
|
+
* @param {String} name
|
|
5897
|
+
* @return {Boolean}
|
|
5898
|
+
* @api public
|
|
5899
|
+
*/
|
|
5900
|
+
function enabled(name) {
|
|
5901
|
+
if (name[name.length - 1] === '*') {
|
|
5902
|
+
return true;
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5905
|
+
let i;
|
|
5906
|
+
let len;
|
|
5907
|
+
|
|
5908
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
5909
|
+
if (createDebug.skips[i].test(name)) {
|
|
5910
|
+
return false;
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
5915
|
+
if (createDebug.names[i].test(name)) {
|
|
5916
|
+
return true;
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
|
|
5920
|
+
return false;
|
|
5921
|
+
}
|
|
5922
|
+
|
|
5923
|
+
/**
|
|
5924
|
+
* Convert regexp to namespace
|
|
5925
|
+
*
|
|
5926
|
+
* @param {RegExp} regxep
|
|
5927
|
+
* @return {String} namespace
|
|
5928
|
+
* @api private
|
|
5929
|
+
*/
|
|
5930
|
+
function toNamespace(regexp) {
|
|
5931
|
+
return regexp.toString()
|
|
5932
|
+
.substring(2, regexp.toString().length - 2)
|
|
5933
|
+
.replace(/\.\*\?$/, '*');
|
|
5934
|
+
}
|
|
5935
|
+
|
|
5936
|
+
/**
|
|
5937
|
+
* Coerce `val`.
|
|
5938
|
+
*
|
|
5939
|
+
* @param {Mixed} val
|
|
5940
|
+
* @return {Mixed}
|
|
5941
|
+
* @api private
|
|
5942
|
+
*/
|
|
5943
|
+
function coerce(val) {
|
|
5944
|
+
if (val instanceof Error) {
|
|
5945
|
+
return val.stack || val.message;
|
|
5946
|
+
}
|
|
5947
|
+
return val;
|
|
5948
|
+
}
|
|
5949
|
+
|
|
5950
|
+
/**
|
|
5951
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
5952
|
+
* XXX It WILL be removed in the next major release.
|
|
5953
|
+
*/
|
|
5954
|
+
function destroy() {
|
|
5955
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
createDebug.enable(createDebug.load());
|
|
5959
|
+
|
|
5960
|
+
return createDebug;
|
|
5214
5961
|
}
|
|
5215
5962
|
|
|
5216
|
-
|
|
5963
|
+
var common = setup;
|
|
5964
|
+
|
|
5965
|
+
/* eslint-env browser */
|
|
5966
|
+
|
|
5967
|
+
(function (module, exports) {
|
|
5968
|
+
/**
|
|
5969
|
+
* This is the web browser implementation of `debug()`.
|
|
5970
|
+
*/
|
|
5971
|
+
|
|
5972
|
+
exports.formatArgs = formatArgs;
|
|
5973
|
+
exports.save = save;
|
|
5974
|
+
exports.load = load;
|
|
5975
|
+
exports.useColors = useColors;
|
|
5976
|
+
exports.storage = localstorage();
|
|
5977
|
+
exports.destroy = (() => {
|
|
5978
|
+
let warned = false;
|
|
5979
|
+
|
|
5980
|
+
return () => {
|
|
5981
|
+
if (!warned) {
|
|
5982
|
+
warned = true;
|
|
5983
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
5984
|
+
}
|
|
5985
|
+
};
|
|
5986
|
+
})();
|
|
5987
|
+
|
|
5988
|
+
/**
|
|
5989
|
+
* Colors.
|
|
5990
|
+
*/
|
|
5991
|
+
|
|
5992
|
+
exports.colors = [
|
|
5993
|
+
'#0000CC',
|
|
5994
|
+
'#0000FF',
|
|
5995
|
+
'#0033CC',
|
|
5996
|
+
'#0033FF',
|
|
5997
|
+
'#0066CC',
|
|
5998
|
+
'#0066FF',
|
|
5999
|
+
'#0099CC',
|
|
6000
|
+
'#0099FF',
|
|
6001
|
+
'#00CC00',
|
|
6002
|
+
'#00CC33',
|
|
6003
|
+
'#00CC66',
|
|
6004
|
+
'#00CC99',
|
|
6005
|
+
'#00CCCC',
|
|
6006
|
+
'#00CCFF',
|
|
6007
|
+
'#3300CC',
|
|
6008
|
+
'#3300FF',
|
|
6009
|
+
'#3333CC',
|
|
6010
|
+
'#3333FF',
|
|
6011
|
+
'#3366CC',
|
|
6012
|
+
'#3366FF',
|
|
6013
|
+
'#3399CC',
|
|
6014
|
+
'#3399FF',
|
|
6015
|
+
'#33CC00',
|
|
6016
|
+
'#33CC33',
|
|
6017
|
+
'#33CC66',
|
|
6018
|
+
'#33CC99',
|
|
6019
|
+
'#33CCCC',
|
|
6020
|
+
'#33CCFF',
|
|
6021
|
+
'#6600CC',
|
|
6022
|
+
'#6600FF',
|
|
6023
|
+
'#6633CC',
|
|
6024
|
+
'#6633FF',
|
|
6025
|
+
'#66CC00',
|
|
6026
|
+
'#66CC33',
|
|
6027
|
+
'#9900CC',
|
|
6028
|
+
'#9900FF',
|
|
6029
|
+
'#9933CC',
|
|
6030
|
+
'#9933FF',
|
|
6031
|
+
'#99CC00',
|
|
6032
|
+
'#99CC33',
|
|
6033
|
+
'#CC0000',
|
|
6034
|
+
'#CC0033',
|
|
6035
|
+
'#CC0066',
|
|
6036
|
+
'#CC0099',
|
|
6037
|
+
'#CC00CC',
|
|
6038
|
+
'#CC00FF',
|
|
6039
|
+
'#CC3300',
|
|
6040
|
+
'#CC3333',
|
|
6041
|
+
'#CC3366',
|
|
6042
|
+
'#CC3399',
|
|
6043
|
+
'#CC33CC',
|
|
6044
|
+
'#CC33FF',
|
|
6045
|
+
'#CC6600',
|
|
6046
|
+
'#CC6633',
|
|
6047
|
+
'#CC9900',
|
|
6048
|
+
'#CC9933',
|
|
6049
|
+
'#CCCC00',
|
|
6050
|
+
'#CCCC33',
|
|
6051
|
+
'#FF0000',
|
|
6052
|
+
'#FF0033',
|
|
6053
|
+
'#FF0066',
|
|
6054
|
+
'#FF0099',
|
|
6055
|
+
'#FF00CC',
|
|
6056
|
+
'#FF00FF',
|
|
6057
|
+
'#FF3300',
|
|
6058
|
+
'#FF3333',
|
|
6059
|
+
'#FF3366',
|
|
6060
|
+
'#FF3399',
|
|
6061
|
+
'#FF33CC',
|
|
6062
|
+
'#FF33FF',
|
|
6063
|
+
'#FF6600',
|
|
6064
|
+
'#FF6633',
|
|
6065
|
+
'#FF9900',
|
|
6066
|
+
'#FF9933',
|
|
6067
|
+
'#FFCC00',
|
|
6068
|
+
'#FFCC33'
|
|
6069
|
+
];
|
|
6070
|
+
|
|
6071
|
+
/**
|
|
6072
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
6073
|
+
* and the Firebug extension (any Firefox version) are known
|
|
6074
|
+
* to support "%c" CSS customizations.
|
|
6075
|
+
*
|
|
6076
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
6077
|
+
*/
|
|
6078
|
+
|
|
6079
|
+
// eslint-disable-next-line complexity
|
|
6080
|
+
function useColors() {
|
|
6081
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
6082
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
6083
|
+
// explicitly
|
|
6084
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
6085
|
+
return true;
|
|
6086
|
+
}
|
|
6087
|
+
|
|
6088
|
+
// Internet Explorer and Edge do not support colors.
|
|
6089
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
6090
|
+
return false;
|
|
6091
|
+
}
|
|
6092
|
+
|
|
6093
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
6094
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
6095
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
6096
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
6097
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
6098
|
+
// Is firefox >= v31?
|
|
6099
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
6100
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
6101
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
6102
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
6103
|
+
}
|
|
6104
|
+
|
|
6105
|
+
/**
|
|
6106
|
+
* Colorize log arguments if enabled.
|
|
6107
|
+
*
|
|
6108
|
+
* @api public
|
|
6109
|
+
*/
|
|
6110
|
+
|
|
6111
|
+
function formatArgs(args) {
|
|
6112
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
6113
|
+
this.namespace +
|
|
6114
|
+
(this.useColors ? ' %c' : ' ') +
|
|
6115
|
+
args[0] +
|
|
6116
|
+
(this.useColors ? '%c ' : ' ') +
|
|
6117
|
+
'+' + module.exports.humanize(this.diff);
|
|
6118
|
+
|
|
6119
|
+
if (!this.useColors) {
|
|
6120
|
+
return;
|
|
6121
|
+
}
|
|
6122
|
+
|
|
6123
|
+
const c = 'color: ' + this.color;
|
|
6124
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
6125
|
+
|
|
6126
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
6127
|
+
// arguments passed either before or after the %c, so we need to
|
|
6128
|
+
// figure out the correct index to insert the CSS into
|
|
6129
|
+
let index = 0;
|
|
6130
|
+
let lastC = 0;
|
|
6131
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
6132
|
+
if (match === '%%') {
|
|
6133
|
+
return;
|
|
6134
|
+
}
|
|
6135
|
+
index++;
|
|
6136
|
+
if (match === '%c') {
|
|
6137
|
+
// We only are interested in the *last* %c
|
|
6138
|
+
// (the user may have provided their own)
|
|
6139
|
+
lastC = index;
|
|
6140
|
+
}
|
|
6141
|
+
});
|
|
6142
|
+
|
|
6143
|
+
args.splice(lastC, 0, c);
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
/**
|
|
6147
|
+
* Invokes `console.debug()` when available.
|
|
6148
|
+
* No-op when `console.debug` is not a "function".
|
|
6149
|
+
* If `console.debug` is not available, falls back
|
|
6150
|
+
* to `console.log`.
|
|
6151
|
+
*
|
|
6152
|
+
* @api public
|
|
6153
|
+
*/
|
|
6154
|
+
exports.log = console.debug || console.log || (() => {});
|
|
6155
|
+
|
|
6156
|
+
/**
|
|
6157
|
+
* Save `namespaces`.
|
|
6158
|
+
*
|
|
6159
|
+
* @param {String} namespaces
|
|
6160
|
+
* @api private
|
|
6161
|
+
*/
|
|
6162
|
+
function save(namespaces) {
|
|
6163
|
+
try {
|
|
6164
|
+
if (namespaces) {
|
|
6165
|
+
exports.storage.setItem('debug', namespaces);
|
|
6166
|
+
} else {
|
|
6167
|
+
exports.storage.removeItem('debug');
|
|
6168
|
+
}
|
|
6169
|
+
} catch (error) {
|
|
6170
|
+
// Swallow
|
|
6171
|
+
// XXX (@Qix-) should we be logging these?
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
/**
|
|
6176
|
+
* Load `namespaces`.
|
|
6177
|
+
*
|
|
6178
|
+
* @return {String} returns the previously persisted debug modes
|
|
6179
|
+
* @api private
|
|
6180
|
+
*/
|
|
6181
|
+
function load() {
|
|
6182
|
+
let r;
|
|
6183
|
+
try {
|
|
6184
|
+
r = exports.storage.getItem('debug');
|
|
6185
|
+
} catch (error) {
|
|
6186
|
+
// Swallow
|
|
6187
|
+
// XXX (@Qix-) should we be logging these?
|
|
6188
|
+
}
|
|
6189
|
+
|
|
6190
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
6191
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
6192
|
+
r = process.env.DEBUG;
|
|
6193
|
+
}
|
|
6194
|
+
|
|
6195
|
+
return r;
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6198
|
+
/**
|
|
6199
|
+
* Localstorage attempts to return the localstorage.
|
|
6200
|
+
*
|
|
6201
|
+
* This is necessary because safari throws
|
|
6202
|
+
* when a user disables cookies/localstorage
|
|
6203
|
+
* and you attempt to access it.
|
|
6204
|
+
*
|
|
6205
|
+
* @return {LocalStorage}
|
|
6206
|
+
* @api private
|
|
6207
|
+
*/
|
|
6208
|
+
|
|
6209
|
+
function localstorage() {
|
|
6210
|
+
try {
|
|
6211
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
6212
|
+
// The Browser also has localStorage in the global context.
|
|
6213
|
+
return localStorage;
|
|
6214
|
+
} catch (error) {
|
|
6215
|
+
// Swallow
|
|
6216
|
+
// XXX (@Qix-) should we be logging these?
|
|
6217
|
+
}
|
|
6218
|
+
}
|
|
6219
|
+
|
|
6220
|
+
module.exports = common(exports);
|
|
6221
|
+
|
|
6222
|
+
const {formatters} = module.exports;
|
|
6223
|
+
|
|
6224
|
+
/**
|
|
6225
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
6226
|
+
*/
|
|
6227
|
+
|
|
6228
|
+
formatters.j = function (v) {
|
|
6229
|
+
try {
|
|
6230
|
+
return JSON.stringify(v);
|
|
6231
|
+
} catch (error) {
|
|
6232
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
6233
|
+
}
|
|
6234
|
+
};
|
|
6235
|
+
} (browser, browser.exports));
|
|
6236
|
+
|
|
6237
|
+
var browserExports = browser.exports;
|
|
6238
|
+
var createDebug = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
6239
|
+
|
|
6240
|
+
createDebug("foxglove:server");
|
|
6241
|
+
new TextEncoder();
|
|
6242
|
+
({
|
|
6243
|
+
subscribe: undefined,
|
|
6244
|
+
unsubscribe: undefined,
|
|
6245
|
+
advertise: ServerCapability.clientPublish,
|
|
6246
|
+
unadvertise: ServerCapability.clientPublish,
|
|
6247
|
+
[ClientBinaryOpcode.MESSAGE_DATA]: ServerCapability.clientPublish,
|
|
6248
|
+
getParameters: ServerCapability.parameters,
|
|
6249
|
+
setParameters: ServerCapability.parameters,
|
|
6250
|
+
subscribeParameterUpdates: ServerCapability.parametersSubscribe,
|
|
6251
|
+
unsubscribeParameterUpdates: ServerCapability.parametersSubscribe,
|
|
6252
|
+
[ClientBinaryOpcode.SERVICE_CALL_REQUEST]: ServerCapability.services,
|
|
6253
|
+
subscribeConnectionGraph: ServerCapability.connectionGraph,
|
|
6254
|
+
unsubscribeConnectionGraph: ServerCapability.connectionGraph,
|
|
6255
|
+
fetchAsset: ServerCapability.assets,
|
|
6256
|
+
});
|
|
6257
|
+
|
|
6258
|
+
export { BinaryOpcode as B, ClientBinaryOpcode as C, EventEmitter as E, FoxgloveClient as F, PointsAnnotationType as P, Type as T, getDefaultExportFromCjs as a, Profile as b, commonjsGlobal as c, getAugmentedNamespace as g, protobufsBySchema as p };
|