mqtt 5.8.1 → 5.9.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/mqtt.js CHANGED
@@ -24,18 +24,9 @@ var mqtt = (() => {
24
24
  };
25
25
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
26
 
27
- // node_modules/esbuild-plugin-polyfill-node/polyfills/navigator.js
28
- var navigator;
29
- var init_navigator = __esm({
30
- "node_modules/esbuild-plugin-polyfill-node/polyfills/navigator.js"() {
31
- navigator = {
32
- deviceMemory: 8,
33
- // Highest allowed value
34
- hardwareConcurrency: 8,
35
- // Fairly common default
36
- language: "en-US"
37
- // Most common default
38
- };
27
+ // node_modules/esbuild-plugin-polyfill-node/polyfills/__dirname.js
28
+ var init_dirname = __esm({
29
+ "node_modules/esbuild-plugin-polyfill-node/polyfills/__dirname.js"() {
39
30
  }
40
31
  });
41
32
 
@@ -210,9 +201,9 @@ var mqtt = (() => {
210
201
  var queue, draining, currentQueue, queueIndex, title, arch, platform, env, argv, execArgv, version, versions, emitWarning, binding, umask, cwd, chdir, release, _rawDebug, moduleLoadList, domain, _exiting, config, reallyExit, _kill, cpuUsage, resourceUsage, memoryUsage, kill, exit, openStdin, allowedNodeEnvironmentFlags, features, _fatalExceptions, setUncaughtExceptionCaptureCallback, _tickCallback, _debugProcess, _debugEnd, _startProfilerIdleNotifier, _stopProfilerIdleNotifier, stdout, stderr, stdin, abort, pid, ppid, execPath, debugPort, argv0, _preload_modules, setSourceMapsEnabled, _performance, nowOffset, nanoPerSec, _maxListeners, _events, _eventsCount, addListener, once, off, removeListener, removeAllListeners, emit, prependListener, prependOnceListener, process;
211
202
  var init_process = __esm({
212
203
  "node_modules/@jspm/core/nodelibs/browser/process.js"() {
204
+ init_dirname();
213
205
  init_buffer2();
214
206
  init_process2();
215
- init_navigator();
216
207
  queue = [];
217
208
  draining = false;
218
209
  queueIndex = -1;
@@ -2237,9 +2228,9 @@ var mqtt = (() => {
2237
2228
  var exports$3, _dewExec$2, exports$2, _dewExec$1, exports$1, _dewExec, exports, Buffer2, INSPECT_MAX_BYTES, kMaxLength;
2238
2229
  var init_buffer = __esm({
2239
2230
  "node_modules/@jspm/core/nodelibs/browser/buffer.js"() {
2231
+ init_dirname();
2240
2232
  init_buffer2();
2241
2233
  init_process2();
2242
- init_navigator();
2243
2234
  exports$3 = {};
2244
2235
  _dewExec$2 = false;
2245
2236
  exports$2 = {};
@@ -2268,9 +2259,9 @@ var mqtt = (() => {
2268
2259
  var require_topic_alias_recv = __commonJS({
2269
2260
  "build/lib/topic-alias-recv.js"(exports5) {
2270
2261
  "use strict";
2262
+ init_dirname();
2271
2263
  init_buffer2();
2272
2264
  init_process2();
2273
- init_navigator();
2274
2265
  Object.defineProperty(exports5, "__esModule", { value: true });
2275
2266
  var TopicAliasRecv = class {
2276
2267
  constructor(max) {
@@ -2300,9 +2291,9 @@ var mqtt = (() => {
2300
2291
  var require_primordials = __commonJS({
2301
2292
  "node_modules/readable-stream/lib/ours/primordials.js"(exports5, module) {
2302
2293
  "use strict";
2294
+ init_dirname();
2303
2295
  init_buffer2();
2304
2296
  init_process2();
2305
- init_navigator();
2306
2297
  module.exports = {
2307
2298
  ArrayIsArray(self2) {
2308
2299
  return Array.isArray(self2);
@@ -2402,9 +2393,9 @@ var mqtt = (() => {
2402
2393
  var require_util = __commonJS({
2403
2394
  "node_modules/readable-stream/lib/ours/util.js"(exports5, module) {
2404
2395
  "use strict";
2396
+ init_dirname();
2405
2397
  init_buffer2();
2406
2398
  init_process2();
2407
- init_navigator();
2408
2399
  var bufferModule = (init_buffer(), __toCommonJS(buffer_exports));
2409
2400
  var AsyncFunction = Object.getPrototypeOf(async function() {
2410
2401
  }).constructor;
@@ -2529,9 +2520,9 @@ var mqtt = (() => {
2529
2520
  var require_browser = __commonJS({
2530
2521
  "node_modules/abort-controller/browser.js"(exports5, module) {
2531
2522
  "use strict";
2523
+ init_dirname();
2532
2524
  init_buffer2();
2533
2525
  init_process2();
2534
- init_navigator();
2535
2526
  var { AbortController, AbortSignal } = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : (
2536
2527
  /* otherwise */
2537
2528
  void 0
@@ -2546,9 +2537,9 @@ var mqtt = (() => {
2546
2537
  var require_errors = __commonJS({
2547
2538
  "node_modules/readable-stream/lib/ours/errors.js"(exports5, module) {
2548
2539
  "use strict";
2540
+ init_dirname();
2549
2541
  init_buffer2();
2550
2542
  init_process2();
2551
- init_navigator();
2552
2543
  var { format: format2, inspect, AggregateError: CustomAggregateError } = require_util();
2553
2544
  var AggregateError = globalThis.AggregateError || CustomAggregateError;
2554
2545
  var kIsNodeError = Symbol("kIsNodeError");
@@ -2865,9 +2856,9 @@ var mqtt = (() => {
2865
2856
  var require_validators = __commonJS({
2866
2857
  "node_modules/readable-stream/lib/internal/validators.js"(exports5, module) {
2867
2858
  "use strict";
2859
+ init_dirname();
2868
2860
  init_buffer2();
2869
2861
  init_process2();
2870
- init_navigator();
2871
2862
  var {
2872
2863
  ArrayIsArray,
2873
2864
  ArrayPrototypeIncludes,
@@ -3128,9 +3119,9 @@ var mqtt = (() => {
3128
3119
  // node_modules/process/browser.js
3129
3120
  var require_browser2 = __commonJS({
3130
3121
  "node_modules/process/browser.js"(exports5, module) {
3122
+ init_dirname();
3131
3123
  init_buffer2();
3132
3124
  init_process2();
3133
- init_navigator();
3134
3125
  var process3 = module.exports = {};
3135
3126
  var cachedSetTimeout;
3136
3127
  var cachedClearTimeout;
@@ -3294,9 +3285,9 @@ var mqtt = (() => {
3294
3285
  var require_utils = __commonJS({
3295
3286
  "node_modules/readable-stream/lib/internal/streams/utils.js"(exports5, module) {
3296
3287
  "use strict";
3288
+ init_dirname();
3297
3289
  init_buffer2();
3298
3290
  init_process2();
3299
- init_navigator();
3300
3291
  var { Symbol: Symbol2, SymbolAsyncIterator, SymbolIterator, SymbolFor } = require_primordials();
3301
3292
  var kDestroyed = Symbol2("kDestroyed");
3302
3293
  var kIsErrored = Symbol2("kIsErrored");
@@ -3527,9 +3518,9 @@ var mqtt = (() => {
3527
3518
  // node_modules/readable-stream/lib/internal/streams/end-of-stream.js
3528
3519
  var require_end_of_stream = __commonJS({
3529
3520
  "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports5, module) {
3521
+ init_dirname();
3530
3522
  init_buffer2();
3531
3523
  init_process2();
3532
- init_navigator();
3533
3524
  var process3 = require_browser2();
3534
3525
  var { AbortError, codes } = require_errors();
3535
3526
  var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
@@ -3782,9 +3773,9 @@ var mqtt = (() => {
3782
3773
  var require_destroy = __commonJS({
3783
3774
  "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports5, module) {
3784
3775
  "use strict";
3776
+ init_dirname();
3785
3777
  init_buffer2();
3786
3778
  init_process2();
3787
- init_navigator();
3788
3779
  var process3 = require_browser2();
3789
3780
  var {
3790
3781
  aggregateTwoErrors,
@@ -4106,9 +4097,9 @@ var mqtt = (() => {
4106
4097
  var e, t, n, r, i, s, y;
4107
4098
  var init_chunk_4bd36a8f = __esm({
4108
4099
  "node_modules/@jspm/core/nodelibs/browser/chunk-4bd36a8f.js"() {
4100
+ init_dirname();
4109
4101
  init_buffer2();
4110
4102
  init_process2();
4111
- init_navigator();
4112
4103
  n = "object" == typeof Reflect ? Reflect : null;
4113
4104
  r = n && "function" == typeof n.apply ? n.apply : function(e7, t6, n7) {
4114
4105
  return Function.prototype.apply.call(e7, t6, n7);
@@ -4247,9 +4238,9 @@ var mqtt = (() => {
4247
4238
  var EventEmitter, defaultMaxListeners, init, listenerCount, on2, once2;
4248
4239
  var init_events = __esm({
4249
4240
  "node_modules/@jspm/core/nodelibs/browser/events.js"() {
4241
+ init_dirname();
4250
4242
  init_buffer2();
4251
4243
  init_process2();
4252
- init_navigator();
4253
4244
  init_chunk_4bd36a8f();
4254
4245
  init_chunk_4bd36a8f();
4255
4246
  y.once = function(emitter, event) {
@@ -4347,9 +4338,9 @@ var mqtt = (() => {
4347
4338
  var require_legacy = __commonJS({
4348
4339
  "node_modules/readable-stream/lib/internal/streams/legacy.js"(exports5, module) {
4349
4340
  "use strict";
4341
+ init_dirname();
4350
4342
  init_buffer2();
4351
4343
  init_process2();
4352
- init_navigator();
4353
4344
  var { ArrayIsArray, ObjectSetPrototypeOf } = require_primordials();
4354
4345
  var { EventEmitter: EE } = (init_events(), __toCommonJS(events_exports));
4355
4346
  function Stream(opts) {
@@ -4435,9 +4426,9 @@ var mqtt = (() => {
4435
4426
  var require_add_abort_signal = __commonJS({
4436
4427
  "node_modules/readable-stream/lib/internal/streams/add-abort-signal.js"(exports5, module) {
4437
4428
  "use strict";
4429
+ init_dirname();
4438
4430
  init_buffer2();
4439
4431
  init_process2();
4440
- init_navigator();
4441
4432
  var { AbortError, codes } = require_errors();
4442
4433
  var { isNodeStream, isWebStream, kControllerErrorFunction } = require_utils();
4443
4434
  var eos = require_end_of_stream();
@@ -4486,9 +4477,9 @@ var mqtt = (() => {
4486
4477
  var require_buffer_list = __commonJS({
4487
4478
  "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports5, module) {
4488
4479
  "use strict";
4480
+ init_dirname();
4489
4481
  init_buffer2();
4490
4482
  init_process2();
4491
- init_navigator();
4492
4483
  var { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array: Uint8Array2 } = require_primordials();
4493
4484
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
4494
4485
  var { inspect } = require_util();
@@ -4657,9 +4648,9 @@ var mqtt = (() => {
4657
4648
  var require_state = __commonJS({
4658
4649
  "node_modules/readable-stream/lib/internal/streams/state.js"(exports5, module) {
4659
4650
  "use strict";
4651
+ init_dirname();
4660
4652
  init_buffer2();
4661
4653
  init_process2();
4662
- init_navigator();
4663
4654
  var { MathFloor, NumberIsInteger } = require_primordials();
4664
4655
  var { ERR_INVALID_ARG_VALUE } = require_errors().codes;
4665
4656
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
@@ -5193,9 +5184,9 @@ var mqtt = (() => {
5193
5184
  var r$1, t$1, e$2, n$2, o$2, a$1, h$1, a$1$1, e$1$1, n$1$1, i$1, o$1$1, j, Y, e2, n2, o2, u2, e$1, s2, i2;
5194
5185
  var init_chunk_4ccc3a29 = __esm({
5195
5186
  "node_modules/@jspm/core/nodelibs/browser/chunk-4ccc3a29.js"() {
5187
+ init_dirname();
5196
5188
  init_buffer2();
5197
5189
  init_process2();
5198
- init_navigator();
5199
5190
  for (r$1 = { byteLength: function(r7) {
5200
5191
  var t6 = u$2(r7), e7 = t6[0], n7 = t6[1];
5201
5192
  return 3 * (e7 + n7) / 4 - n7;
@@ -5690,9 +5681,9 @@ var mqtt = (() => {
5690
5681
  var StringDecoder;
5691
5682
  var init_string_decoder = __esm({
5692
5683
  "node_modules/@jspm/core/nodelibs/browser/string_decoder.js"() {
5684
+ init_dirname();
5693
5685
  init_buffer2();
5694
5686
  init_process2();
5695
- init_navigator();
5696
5687
  init_chunk_4ccc3a29();
5697
5688
  init_chunk_4ccc3a29();
5698
5689
  StringDecoder = e$1.StringDecoder;
@@ -5703,9 +5694,9 @@ var mqtt = (() => {
5703
5694
  var require_from = __commonJS({
5704
5695
  "node_modules/readable-stream/lib/internal/streams/from.js"(exports5, module) {
5705
5696
  "use strict";
5697
+ init_dirname();
5706
5698
  init_buffer2();
5707
5699
  init_process2();
5708
- init_navigator();
5709
5700
  var process3 = require_browser2();
5710
5701
  var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
5711
5702
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
@@ -5800,9 +5791,9 @@ var mqtt = (() => {
5800
5791
  // node_modules/readable-stream/lib/internal/streams/readable.js
5801
5792
  var require_readable = __commonJS({
5802
5793
  "node_modules/readable-stream/lib/internal/streams/readable.js"(exports5, module) {
5794
+ init_dirname();
5803
5795
  init_buffer2();
5804
5796
  init_process2();
5805
- init_navigator();
5806
5797
  var process3 = require_browser2();
5807
5798
  var {
5808
5799
  ArrayPrototypeIndexOf,
@@ -6755,9 +6746,9 @@ var mqtt = (() => {
6755
6746
  // node_modules/readable-stream/lib/internal/streams/writable.js
6756
6747
  var require_writable = __commonJS({
6757
6748
  "node_modules/readable-stream/lib/internal/streams/writable.js"(exports5, module) {
6749
+ init_dirname();
6758
6750
  init_buffer2();
6759
6751
  init_process2();
6760
- init_navigator();
6761
6752
  var process3 = require_browser2();
6762
6753
  var {
6763
6754
  ArrayPrototypeSlice,
@@ -7401,9 +7392,9 @@ var mqtt = (() => {
7401
7392
  // node_modules/readable-stream/lib/internal/streams/duplexify.js
7402
7393
  var require_duplexify = __commonJS({
7403
7394
  "node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports5, module) {
7395
+ init_dirname();
7404
7396
  init_buffer2();
7405
7397
  init_process2();
7406
- init_navigator();
7407
7398
  var process3 = require_browser2();
7408
7399
  var bufferModule = (init_buffer(), __toCommonJS(buffer_exports));
7409
7400
  var {
@@ -7737,9 +7728,9 @@ var mqtt = (() => {
7737
7728
  var require_duplex = __commonJS({
7738
7729
  "node_modules/readable-stream/lib/internal/streams/duplex.js"(exports5, module) {
7739
7730
  "use strict";
7731
+ init_dirname();
7740
7732
  init_buffer2();
7741
7733
  init_process2();
7742
- init_navigator();
7743
7734
  var {
7744
7735
  ObjectDefineProperties,
7745
7736
  ObjectGetOwnPropertyDescriptor,
@@ -7860,9 +7851,9 @@ var mqtt = (() => {
7860
7851
  var require_transform = __commonJS({
7861
7852
  "node_modules/readable-stream/lib/internal/streams/transform.js"(exports5, module) {
7862
7853
  "use strict";
7854
+ init_dirname();
7863
7855
  init_buffer2();
7864
7856
  init_process2();
7865
- init_navigator();
7866
7857
  var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials();
7867
7858
  module.exports = Transform;
7868
7859
  var { ERR_METHOD_NOT_IMPLEMENTED } = require_errors().codes;
@@ -7968,9 +7959,9 @@ var mqtt = (() => {
7968
7959
  var require_passthrough = __commonJS({
7969
7960
  "node_modules/readable-stream/lib/internal/streams/passthrough.js"(exports5, module) {
7970
7961
  "use strict";
7962
+ init_dirname();
7971
7963
  init_buffer2();
7972
7964
  init_process2();
7973
- init_navigator();
7974
7965
  var { ObjectSetPrototypeOf } = require_primordials();
7975
7966
  module.exports = PassThrough;
7976
7967
  var Transform = require_transform();
@@ -7990,9 +7981,9 @@ var mqtt = (() => {
7990
7981
  // node_modules/readable-stream/lib/internal/streams/pipeline.js
7991
7982
  var require_pipeline = __commonJS({
7992
7983
  "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports5, module) {
7984
+ init_dirname();
7993
7985
  init_buffer2();
7994
7986
  init_process2();
7995
- init_navigator();
7996
7987
  var process3 = require_browser2();
7997
7988
  var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator } = require_primordials();
7998
7989
  var eos = require_end_of_stream();
@@ -8416,9 +8407,9 @@ var mqtt = (() => {
8416
8407
  var require_compose = __commonJS({
8417
8408
  "node_modules/readable-stream/lib/internal/streams/compose.js"(exports5, module) {
8418
8409
  "use strict";
8410
+ init_dirname();
8419
8411
  init_buffer2();
8420
8412
  init_process2();
8421
- init_navigator();
8422
8413
  var { pipeline } = require_pipeline();
8423
8414
  var Duplex = require_duplex();
8424
8415
  var { destroyer } = require_destroy();
@@ -8612,9 +8603,9 @@ var mqtt = (() => {
8612
8603
  var require_operators = __commonJS({
8613
8604
  "node_modules/readable-stream/lib/internal/streams/operators.js"(exports5, module) {
8614
8605
  "use strict";
8606
+ init_dirname();
8615
8607
  init_buffer2();
8616
8608
  init_process2();
8617
- init_navigator();
8618
8609
  var AbortController = globalThis.AbortController || require_browser().AbortController;
8619
8610
  var {
8620
8611
  codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },
@@ -9009,9 +9000,9 @@ var mqtt = (() => {
9009
9000
  var require_promises = __commonJS({
9010
9001
  "node_modules/readable-stream/lib/stream/promises.js"(exports5, module) {
9011
9002
  "use strict";
9003
+ init_dirname();
9012
9004
  init_buffer2();
9013
9005
  init_process2();
9014
- init_navigator();
9015
9006
  var { ArrayPrototypePop, Promise: Promise2 } = require_primordials();
9016
9007
  var { isIterable, isNodeStream, isWebStream } = require_utils();
9017
9008
  var { pipelineImpl: pl } = require_pipeline();
@@ -9053,9 +9044,9 @@ var mqtt = (() => {
9053
9044
  // node_modules/readable-stream/lib/stream.js
9054
9045
  var require_stream = __commonJS({
9055
9046
  "node_modules/readable-stream/lib/stream.js"(exports5, module) {
9047
+ init_dirname();
9056
9048
  init_buffer2();
9057
9049
  init_process2();
9058
- init_navigator();
9059
9050
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
9060
9051
  var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials();
9061
9052
  var {
@@ -9174,9 +9165,9 @@ var mqtt = (() => {
9174
9165
  var require_browser3 = __commonJS({
9175
9166
  "node_modules/readable-stream/lib/ours/browser.js"(exports5, module) {
9176
9167
  "use strict";
9168
+ init_dirname();
9177
9169
  init_buffer2();
9178
9170
  init_process2();
9179
- init_navigator();
9180
9171
  var CustomStream = require_stream();
9181
9172
  var promises = require_promises();
9182
9173
  var originalDestroy = CustomStream.Readable.destroy;
@@ -9212,9 +9203,9 @@ var mqtt = (() => {
9212
9203
  // node_modules/inherits/inherits_browser.js
9213
9204
  var require_inherits_browser = __commonJS({
9214
9205
  "node_modules/inherits/inherits_browser.js"(exports5, module) {
9206
+ init_dirname();
9215
9207
  init_buffer2();
9216
9208
  init_process2();
9217
- init_navigator();
9218
9209
  if (typeof Object.create === "function") {
9219
9210
  module.exports = function inherits(ctor, superCtor) {
9220
9211
  if (superCtor) {
@@ -9248,9 +9239,9 @@ var mqtt = (() => {
9248
9239
  var require_BufferList = __commonJS({
9249
9240
  "node_modules/mqtt-packet/node_modules/bl/BufferList.js"(exports5, module) {
9250
9241
  "use strict";
9242
+ init_dirname();
9251
9243
  init_buffer2();
9252
9244
  init_process2();
9253
- init_navigator();
9254
9245
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
9255
9246
  var symbol = Symbol.for("BufferList");
9256
9247
  function BufferList(buf) {
@@ -9559,9 +9550,9 @@ var mqtt = (() => {
9559
9550
  var require_bl = __commonJS({
9560
9551
  "node_modules/mqtt-packet/node_modules/bl/bl.js"(exports5, module) {
9561
9552
  "use strict";
9553
+ init_dirname();
9562
9554
  init_buffer2();
9563
9555
  init_process2();
9564
- init_navigator();
9565
9556
  var DuplexStream = require_browser3().Duplex;
9566
9557
  var inherits = require_inherits_browser();
9567
9558
  var BufferList = require_BufferList();
@@ -9632,9 +9623,9 @@ var mqtt = (() => {
9632
9623
  // node_modules/mqtt-packet/packet.js
9633
9624
  var require_packet = __commonJS({
9634
9625
  "node_modules/mqtt-packet/packet.js"(exports5, module) {
9626
+ init_dirname();
9635
9627
  init_buffer2();
9636
9628
  init_process2();
9637
- init_navigator();
9638
9629
  var Packet = class {
9639
9630
  constructor() {
9640
9631
  this.cmd = null;
@@ -9653,9 +9644,9 @@ var mqtt = (() => {
9653
9644
  // node_modules/mqtt-packet/constants.js
9654
9645
  var require_constants = __commonJS({
9655
9646
  "node_modules/mqtt-packet/constants.js"(exports5, module) {
9647
+ init_dirname();
9656
9648
  init_buffer2();
9657
9649
  init_process2();
9658
- init_navigator();
9659
9650
  var protocol = module.exports;
9660
9651
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
9661
9652
  protocol.types = {
@@ -9929,9 +9920,9 @@ var mqtt = (() => {
9929
9920
  // node_modules/ms/index.js
9930
9921
  var require_ms = __commonJS({
9931
9922
  "node_modules/ms/index.js"(exports5, module) {
9923
+ init_dirname();
9932
9924
  init_buffer2();
9933
9925
  init_process2();
9934
- init_navigator();
9935
9926
  var s5 = 1e3;
9936
9927
  var m4 = s5 * 60;
9937
9928
  var h6 = m4 * 60;
@@ -10048,9 +10039,9 @@ var mqtt = (() => {
10048
10039
  // node_modules/debug/src/common.js
10049
10040
  var require_common = __commonJS({
10050
10041
  "node_modules/debug/src/common.js"(exports5, module) {
10042
+ init_dirname();
10051
10043
  init_buffer2();
10052
10044
  init_process2();
10053
- init_navigator();
10054
10045
  function setup(env2) {
10055
10046
  createDebug.debug = createDebug;
10056
10047
  createDebug.default = createDebug;
@@ -10214,9 +10205,9 @@ var mqtt = (() => {
10214
10205
  // node_modules/debug/src/browser.js
10215
10206
  var require_browser4 = __commonJS({
10216
10207
  "node_modules/debug/src/browser.js"(exports5, module) {
10208
+ init_dirname();
10217
10209
  init_buffer2();
10218
10210
  init_process2();
10219
- init_navigator();
10220
10211
  exports5.formatArgs = formatArgs;
10221
10212
  exports5.save = save;
10222
10213
  exports5.load = load;
@@ -10386,9 +10377,9 @@ var mqtt = (() => {
10386
10377
  // node_modules/mqtt-packet/parser.js
10387
10378
  var require_parser = __commonJS({
10388
10379
  "node_modules/mqtt-packet/parser.js"(exports5, module) {
10380
+ init_dirname();
10389
10381
  init_buffer2();
10390
10382
  init_process2();
10391
- init_navigator();
10392
10383
  var bl = require_bl();
10393
10384
  var { EventEmitter: EventEmitter2 } = (init_events(), __toCommonJS(events_exports));
10394
10385
  var Packet = require_packet();
@@ -11083,9 +11074,9 @@ var mqtt = (() => {
11083
11074
  // node_modules/mqtt-packet/numbers.js
11084
11075
  var require_numbers = __commonJS({
11085
11076
  "node_modules/mqtt-packet/numbers.js"(exports5, module) {
11077
+ init_dirname();
11086
11078
  init_buffer2();
11087
11079
  init_process2();
11088
- init_navigator();
11089
11080
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
11090
11081
  var max = 65536;
11091
11082
  var cache = {};
@@ -11137,9 +11128,9 @@ var mqtt = (() => {
11137
11128
  var require_process_nextick_args = __commonJS({
11138
11129
  "node_modules/process-nextick-args/index.js"(exports5, module) {
11139
11130
  "use strict";
11131
+ init_dirname();
11140
11132
  init_buffer2();
11141
11133
  init_process2();
11142
- init_navigator();
11143
11134
  if (typeof process_exports === "undefined" || !process_exports.version || process_exports.version.indexOf("v0.") === 0 || process_exports.version.indexOf("v1.") === 0 && process_exports.version.indexOf("v1.8.") !== 0) {
11144
11135
  module.exports = { nextTick: nextTick2 };
11145
11136
  } else {
@@ -11184,9 +11175,9 @@ var mqtt = (() => {
11184
11175
  // node_modules/mqtt-packet/writeToStream.js
11185
11176
  var require_writeToStream = __commonJS({
11186
11177
  "node_modules/mqtt-packet/writeToStream.js"(exports5, module) {
11178
+ init_dirname();
11187
11179
  init_buffer2();
11188
11180
  init_process2();
11189
- init_navigator();
11190
11181
  var protocol = require_constants();
11191
11182
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
11192
11183
  var empty = Buffer3.allocUnsafe(0);
@@ -12074,9 +12065,9 @@ var mqtt = (() => {
12074
12065
  // node_modules/mqtt-packet/generate.js
12075
12066
  var require_generate = __commonJS({
12076
12067
  "node_modules/mqtt-packet/generate.js"(exports5, module) {
12068
+ init_dirname();
12077
12069
  init_buffer2();
12078
12070
  init_process2();
12079
- init_navigator();
12080
12071
  var writeToStream = require_writeToStream();
12081
12072
  var { EventEmitter: EventEmitter2 } = (init_events(), __toCommonJS(events_exports));
12082
12073
  var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
@@ -12132,9 +12123,9 @@ var mqtt = (() => {
12132
12123
  // node_modules/mqtt-packet/mqtt.js
12133
12124
  var require_mqtt = __commonJS({
12134
12125
  "node_modules/mqtt-packet/mqtt.js"(exports5) {
12126
+ init_dirname();
12135
12127
  init_buffer2();
12136
12128
  init_process2();
12137
- init_navigator();
12138
12129
  exports5.parser = require_parser().parser;
12139
12130
  exports5.generate = require_generate();
12140
12131
  exports5.writeToStream = require_writeToStream();
@@ -12145,9 +12136,9 @@ var mqtt = (() => {
12145
12136
  var require_default_message_id_provider = __commonJS({
12146
12137
  "build/lib/default-message-id-provider.js"(exports5) {
12147
12138
  "use strict";
12139
+ init_dirname();
12148
12140
  init_buffer2();
12149
12141
  init_process2();
12150
- init_navigator();
12151
12142
  Object.defineProperty(exports5, "__esModule", { value: true });
12152
12143
  var DefaultMessageIdProvider = class {
12153
12144
  constructor() {
@@ -12179,9 +12170,9 @@ var mqtt = (() => {
12179
12170
  var require_rfdc = __commonJS({
12180
12171
  "node_modules/rfdc/index.js"(exports5, module) {
12181
12172
  "use strict";
12173
+ init_dirname();
12182
12174
  init_buffer2();
12183
12175
  init_process2();
12184
- init_navigator();
12185
12176
  module.exports = rfdc;
12186
12177
  function copyBuffer(cur) {
12187
12178
  if (cur instanceof Buffer2) {
@@ -12390,9 +12381,9 @@ var mqtt = (() => {
12390
12381
  var require_default = __commonJS({
12391
12382
  "node_modules/rfdc/default.js"(exports5, module) {
12392
12383
  "use strict";
12384
+ init_dirname();
12393
12385
  init_buffer2();
12394
12386
  init_process2();
12395
- init_navigator();
12396
12387
  module.exports = require_rfdc()();
12397
12388
  }
12398
12389
  });
@@ -12401,9 +12392,9 @@ var mqtt = (() => {
12401
12392
  var require_validations = __commonJS({
12402
12393
  "build/lib/validations.js"(exports5) {
12403
12394
  "use strict";
12395
+ init_dirname();
12404
12396
  init_buffer2();
12405
12397
  init_process2();
12406
- init_navigator();
12407
12398
  Object.defineProperty(exports5, "__esModule", { value: true });
12408
12399
  exports5.validateTopics = exports5.validateTopic = void 0;
12409
12400
  function validateTopic(topic) {
@@ -12441,9 +12432,9 @@ var mqtt = (() => {
12441
12432
  var require_store = __commonJS({
12442
12433
  "build/lib/store.js"(exports5) {
12443
12434
  "use strict";
12435
+ init_dirname();
12444
12436
  init_buffer2();
12445
12437
  init_process2();
12446
- init_navigator();
12447
12438
  Object.defineProperty(exports5, "__esModule", { value: true });
12448
12439
  var readable_stream_1 = require_browser3();
12449
12440
  var streamsOpts = { objectMode: true };
@@ -12526,9 +12517,9 @@ var mqtt = (() => {
12526
12517
  var require_publish = __commonJS({
12527
12518
  "build/lib/handlers/publish.js"(exports5) {
12528
12519
  "use strict";
12520
+ init_dirname();
12529
12521
  init_buffer2();
12530
12522
  init_process2();
12531
- init_navigator();
12532
12523
  Object.defineProperty(exports5, "__esModule", { value: true });
12533
12524
  var validReasonCodes = [0, 16, 128, 131, 135, 144, 145, 151, 153];
12534
12525
  var handlePublish = (client, packet, done) => {
@@ -12634,7 +12625,7 @@ var mqtt = (() => {
12634
12625
  // package-json:../../package.json
12635
12626
  var require_package = __commonJS({
12636
12627
  "package-json:../../package.json"(exports5, module) {
12637
- module.exports = { version: "5.8.1" };
12628
+ module.exports = { version: "5.9.0" };
12638
12629
  }
12639
12630
  });
12640
12631
 
@@ -12642,9 +12633,9 @@ var mqtt = (() => {
12642
12633
  var require_shared = __commonJS({
12643
12634
  "build/lib/shared.js"(exports5) {
12644
12635
  "use strict";
12636
+ init_dirname();
12645
12637
  init_buffer2();
12646
12638
  init_process2();
12647
- init_navigator();
12648
12639
  Object.defineProperty(exports5, "__esModule", { value: true });
12649
12640
  exports5.MQTTJS_VERSION = exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
12650
12641
  var ErrorWithReasonCode = class _ErrorWithReasonCode extends Error {
@@ -12688,9 +12679,9 @@ var mqtt = (() => {
12688
12679
  var require_ack = __commonJS({
12689
12680
  "build/lib/handlers/ack.js"(exports5) {
12690
12681
  "use strict";
12682
+ init_dirname();
12691
12683
  init_buffer2();
12692
12684
  init_process2();
12693
- init_navigator();
12694
12685
  Object.defineProperty(exports5, "__esModule", { value: true });
12695
12686
  exports5.ReasonCodes = void 0;
12696
12687
  exports5.ReasonCodes = {
@@ -12826,9 +12817,9 @@ var mqtt = (() => {
12826
12817
  var require_auth = __commonJS({
12827
12818
  "build/lib/handlers/auth.js"(exports5) {
12828
12819
  "use strict";
12820
+ init_dirname();
12829
12821
  init_buffer2();
12830
12822
  init_process2();
12831
- init_navigator();
12832
12823
  Object.defineProperty(exports5, "__esModule", { value: true });
12833
12824
  var shared_1 = require_shared();
12834
12825
  var ack_1 = require_ack();
@@ -12863,9 +12854,9 @@ var mqtt = (() => {
12863
12854
  var require_cjs = __commonJS({
12864
12855
  "node_modules/lru-cache/dist/cjs/index.js"(exports5) {
12865
12856
  "use strict";
12857
+ init_dirname();
12866
12858
  init_buffer2();
12867
12859
  init_process2();
12868
- init_navigator();
12869
12860
  Object.defineProperty(exports5, "__esModule", { value: true });
12870
12861
  exports5.LRUCache = void 0;
12871
12862
  var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
@@ -14109,9 +14100,9 @@ var mqtt = (() => {
14109
14100
  var require_ContainerBase = __commonJS({
14110
14101
  "node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js"(exports5) {
14111
14102
  "use strict";
14103
+ init_dirname();
14112
14104
  init_buffer2();
14113
14105
  init_process2();
14114
- init_navigator();
14115
14106
  Object.defineProperty(exports5, "t", {
14116
14107
  value: true
14117
14108
  });
@@ -14150,9 +14141,9 @@ var mqtt = (() => {
14150
14141
  var require_Stack = __commonJS({
14151
14142
  "node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js"(exports5) {
14152
14143
  "use strict";
14144
+ init_dirname();
14153
14145
  init_buffer2();
14154
14146
  init_process2();
14155
- init_navigator();
14156
14147
  Object.defineProperty(exports5, "t", {
14157
14148
  value: true
14158
14149
  });
@@ -14195,9 +14186,9 @@ var mqtt = (() => {
14195
14186
  var require_Queue = __commonJS({
14196
14187
  "node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js"(exports5) {
14197
14188
  "use strict";
14189
+ init_dirname();
14198
14190
  init_buffer2();
14199
14191
  init_process2();
14200
- init_navigator();
14201
14192
  Object.defineProperty(exports5, "t", {
14202
14193
  value: true
14203
14194
  });
@@ -14252,9 +14243,9 @@ var mqtt = (() => {
14252
14243
  var require_PriorityQueue = __commonJS({
14253
14244
  "node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js"(exports5) {
14254
14245
  "use strict";
14246
+ init_dirname();
14255
14247
  init_buffer2();
14256
14248
  init_process2();
14257
- init_navigator();
14258
14249
  Object.defineProperty(exports5, "t", {
14259
14250
  value: true
14260
14251
  });
@@ -14379,9 +14370,9 @@ var mqtt = (() => {
14379
14370
  var require_Base = __commonJS({
14380
14371
  "node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js"(exports5) {
14381
14372
  "use strict";
14373
+ init_dirname();
14382
14374
  init_buffer2();
14383
14375
  init_process2();
14384
- init_navigator();
14385
14376
  Object.defineProperty(exports5, "t", {
14386
14377
  value: true
14387
14378
  });
@@ -14398,9 +14389,9 @@ var mqtt = (() => {
14398
14389
  var require_throwError = __commonJS({
14399
14390
  "node_modules/js-sdsl/dist/cjs/utils/throwError.js"(exports5) {
14400
14391
  "use strict";
14392
+ init_dirname();
14401
14393
  init_buffer2();
14402
14394
  init_process2();
14403
- init_navigator();
14404
14395
  Object.defineProperty(exports5, "t", {
14405
14396
  value: true
14406
14397
  });
@@ -14415,9 +14406,9 @@ var mqtt = (() => {
14415
14406
  var require_RandomIterator = __commonJS({
14416
14407
  "node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js"(exports5) {
14417
14408
  "use strict";
14409
+ init_dirname();
14418
14410
  init_buffer2();
14419
14411
  init_process2();
14420
- init_navigator();
14421
14412
  Object.defineProperty(exports5, "t", {
14422
14413
  value: true
14423
14414
  });
@@ -14475,9 +14466,9 @@ var mqtt = (() => {
14475
14466
  var require_Vector = __commonJS({
14476
14467
  "node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js"(exports5) {
14477
14468
  "use strict";
14469
+ init_dirname();
14478
14470
  init_buffer2();
14479
14471
  init_process2();
14480
- init_navigator();
14481
14472
  Object.defineProperty(exports5, "t", {
14482
14473
  value: true
14483
14474
  });
@@ -14633,9 +14624,9 @@ var mqtt = (() => {
14633
14624
  var require_LinkList = __commonJS({
14634
14625
  "node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js"(exports5) {
14635
14626
  "use strict";
14627
+ init_dirname();
14636
14628
  init_buffer2();
14637
14629
  init_process2();
14638
- init_navigator();
14639
14630
  Object.defineProperty(exports5, "t", {
14640
14631
  value: true
14641
14632
  });
@@ -14969,9 +14960,9 @@ var mqtt = (() => {
14969
14960
  var require_Deque = __commonJS({
14970
14961
  "node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js"(exports5) {
14971
14962
  "use strict";
14963
+ init_dirname();
14972
14964
  init_buffer2();
14973
14965
  init_process2();
14974
- init_navigator();
14975
14966
  Object.defineProperty(exports5, "t", {
14976
14967
  value: true
14977
14968
  });
@@ -15332,9 +15323,9 @@ var mqtt = (() => {
15332
15323
  var require_TreeNode = __commonJS({
15333
15324
  "node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js"(exports5) {
15334
15325
  "use strict";
15326
+ init_dirname();
15335
15327
  init_buffer2();
15336
15328
  init_process2();
15337
- init_navigator();
15338
15329
  Object.defineProperty(exports5, "t", {
15339
15330
  value: true
15340
15331
  });
@@ -15462,9 +15453,9 @@ var mqtt = (() => {
15462
15453
  var require_Base2 = __commonJS({
15463
15454
  "node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js"(exports5) {
15464
15455
  "use strict";
15456
+ init_dirname();
15465
15457
  init_buffer2();
15466
15458
  init_process2();
15467
- init_navigator();
15468
15459
  Object.defineProperty(exports5, "t", {
15469
15460
  value: true
15470
15461
  });
@@ -16012,9 +16003,9 @@ var mqtt = (() => {
16012
16003
  var require_TreeIterator = __commonJS({
16013
16004
  "node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js"(exports5) {
16014
16005
  "use strict";
16006
+ init_dirname();
16015
16007
  init_buffer2();
16016
16008
  init_process2();
16017
- init_navigator();
16018
16009
  Object.defineProperty(exports5, "t", {
16019
16010
  value: true
16020
16011
  });
@@ -16093,9 +16084,9 @@ var mqtt = (() => {
16093
16084
  var require_OrderedSet = __commonJS({
16094
16085
  "node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js"(exports5) {
16095
16086
  "use strict";
16087
+ init_dirname();
16096
16088
  init_buffer2();
16097
16089
  init_process2();
16098
- init_navigator();
16099
16090
  Object.defineProperty(exports5, "t", {
16100
16091
  value: true
16101
16092
  });
@@ -16199,9 +16190,9 @@ var mqtt = (() => {
16199
16190
  var require_OrderedMap = __commonJS({
16200
16191
  "node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js"(exports5) {
16201
16192
  "use strict";
16193
+ init_dirname();
16202
16194
  init_buffer2();
16203
16195
  init_process2();
16204
- init_navigator();
16205
16196
  Object.defineProperty(exports5, "t", {
16206
16197
  value: true
16207
16198
  });
@@ -16330,9 +16321,9 @@ var mqtt = (() => {
16330
16321
  var require_checkObject = __commonJS({
16331
16322
  "node_modules/js-sdsl/dist/cjs/utils/checkObject.js"(exports5) {
16332
16323
  "use strict";
16324
+ init_dirname();
16333
16325
  init_buffer2();
16334
16326
  init_process2();
16335
- init_navigator();
16336
16327
  Object.defineProperty(exports5, "t", {
16337
16328
  value: true
16338
16329
  });
@@ -16348,9 +16339,9 @@ var mqtt = (() => {
16348
16339
  var require_Base3 = __commonJS({
16349
16340
  "node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js"(exports5) {
16350
16341
  "use strict";
16342
+ init_dirname();
16351
16343
  init_buffer2();
16352
16344
  init_process2();
16353
- init_navigator();
16354
16345
  Object.defineProperty(exports5, "t", {
16355
16346
  value: true
16356
16347
  });
@@ -16540,9 +16531,9 @@ var mqtt = (() => {
16540
16531
  var require_HashSet = __commonJS({
16541
16532
  "node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js"(exports5) {
16542
16533
  "use strict";
16534
+ init_dirname();
16543
16535
  init_buffer2();
16544
16536
  init_process2();
16545
- init_navigator();
16546
16537
  Object.defineProperty(exports5, "t", {
16547
16538
  value: true
16548
16539
  });
@@ -16634,9 +16625,9 @@ var mqtt = (() => {
16634
16625
  var require_HashMap = __commonJS({
16635
16626
  "node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js"(exports5) {
16636
16627
  "use strict";
16628
+ init_dirname();
16637
16629
  init_buffer2();
16638
16630
  init_process2();
16639
- init_navigator();
16640
16631
  Object.defineProperty(exports5, "t", {
16641
16632
  value: true
16642
16633
  });
@@ -16763,9 +16754,9 @@ var mqtt = (() => {
16763
16754
  var require_cjs2 = __commonJS({
16764
16755
  "node_modules/js-sdsl/dist/cjs/index.js"(exports5) {
16765
16756
  "use strict";
16757
+ init_dirname();
16766
16758
  init_buffer2();
16767
16759
  init_process2();
16768
- init_navigator();
16769
16760
  Object.defineProperty(exports5, "t", {
16770
16761
  value: true
16771
16762
  });
@@ -16851,9 +16842,9 @@ var mqtt = (() => {
16851
16842
  var require_number_allocator = __commonJS({
16852
16843
  "node_modules/number-allocator/lib/number-allocator.js"(exports5, module) {
16853
16844
  "use strict";
16845
+ init_dirname();
16854
16846
  init_buffer2();
16855
16847
  init_process2();
16856
- init_navigator();
16857
16848
  var SortedSet = require_cjs2().OrderedSet;
16858
16849
  var debugTrace = require_browser4()("number-allocator:trace");
16859
16850
  var debugError = require_browser4()("number-allocator:error");
@@ -17013,9 +17004,9 @@ var mqtt = (() => {
17013
17004
  // node_modules/number-allocator/index.js
17014
17005
  var require_number_allocator2 = __commonJS({
17015
17006
  "node_modules/number-allocator/index.js"(exports5, module) {
17007
+ init_dirname();
17016
17008
  init_buffer2();
17017
17009
  init_process2();
17018
- init_navigator();
17019
17010
  var NumberAllocator = require_number_allocator();
17020
17011
  module.exports.NumberAllocator = NumberAllocator;
17021
17012
  }
@@ -17025,9 +17016,9 @@ var mqtt = (() => {
17025
17016
  var require_topic_alias_send = __commonJS({
17026
17017
  "build/lib/topic-alias-send.js"(exports5) {
17027
17018
  "use strict";
17019
+ init_dirname();
17028
17020
  init_buffer2();
17029
17021
  init_process2();
17030
- init_navigator();
17031
17022
  Object.defineProperty(exports5, "__esModule", { value: true });
17032
17023
  var lru_cache_1 = require_cjs();
17033
17024
  var number_allocator_1 = require_number_allocator2();
@@ -17086,9 +17077,9 @@ var mqtt = (() => {
17086
17077
  var require_connack = __commonJS({
17087
17078
  "build/lib/handlers/connack.js"(exports5) {
17088
17079
  "use strict";
17080
+ init_dirname();
17089
17081
  init_buffer2();
17090
17082
  init_process2();
17091
- init_navigator();
17092
17083
  var __importDefault = exports5 && exports5.__importDefault || function(mod) {
17093
17084
  return mod && mod.__esModule ? mod : { "default": mod };
17094
17085
  };
@@ -17139,9 +17130,9 @@ var mqtt = (() => {
17139
17130
  var require_pubrel = __commonJS({
17140
17131
  "build/lib/handlers/pubrel.js"(exports5) {
17141
17132
  "use strict";
17133
+ init_dirname();
17142
17134
  init_buffer2();
17143
17135
  init_process2();
17144
- init_navigator();
17145
17136
  Object.defineProperty(exports5, "__esModule", { value: true });
17146
17137
  var handlePubrel = (client, packet, done) => {
17147
17138
  client.log("handling pubrel packet");
@@ -17171,9 +17162,9 @@ var mqtt = (() => {
17171
17162
  var require_handlers = __commonJS({
17172
17163
  "build/lib/handlers/index.js"(exports5) {
17173
17164
  "use strict";
17165
+ init_dirname();
17174
17166
  init_buffer2();
17175
17167
  init_process2();
17176
- init_navigator();
17177
17168
  var __importDefault = exports5 && exports5.__importDefault || function(mod) {
17178
17169
  return mod && mod.__esModule ? mod : { "default": mod };
17179
17170
  };
@@ -17244,9 +17235,9 @@ var mqtt = (() => {
17244
17235
  var require_TypedEmitter = __commonJS({
17245
17236
  "build/lib/TypedEmitter.js"(exports5) {
17246
17237
  "use strict";
17238
+ init_dirname();
17247
17239
  init_buffer2();
17248
17240
  init_process2();
17249
- init_navigator();
17250
17241
  var __importDefault = exports5 && exports5.__importDefault || function(mod) {
17251
17242
  return mod && mod.__esModule ? mod : { "default": mod };
17252
17243
  };
@@ -17265,9 +17256,9 @@ var mqtt = (() => {
17265
17256
  var require_is_browser = __commonJS({
17266
17257
  "build/lib/is-browser.js"(exports5) {
17267
17258
  "use strict";
17259
+ init_dirname();
17268
17260
  init_buffer2();
17269
17261
  init_process2();
17270
- init_navigator();
17271
17262
  Object.defineProperty(exports5, "__esModule", { value: true });
17272
17263
  exports5.isReactNativeBrowser = exports5.isWebWorker = void 0;
17273
17264
  var isStandardBrowserEnv = () => {
@@ -17282,13 +17273,12 @@ var mqtt = (() => {
17282
17273
  }
17283
17274
  return false;
17284
17275
  };
17285
- var isTxikijsEnv = () => typeof navigator !== "undefined" && navigator.userAgent === "txiki.js";
17286
17276
  var isWebWorkerEnv = () => {
17287
17277
  var _a, _b;
17288
17278
  return Boolean(typeof self === "object" && ((_b = (_a = self === null || self === void 0 ? void 0 : self.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes("WorkerGlobalScope")));
17289
17279
  };
17290
17280
  var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
17291
- var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv() || isTxikijsEnv();
17281
+ var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
17292
17282
  exports5.isWebWorker = isWebWorkerEnv();
17293
17283
  exports5.isReactNativeBrowser = isReactNativeEnv();
17294
17284
  exports5.default = isBrowser;
@@ -17298,9 +17288,9 @@ var mqtt = (() => {
17298
17288
  // node_modules/fast-unique-numbers/build/es5/bundle.js
17299
17289
  var require_bundle = __commonJS({
17300
17290
  "node_modules/fast-unique-numbers/build/es5/bundle.js"(exports5, module) {
17291
+ init_dirname();
17301
17292
  init_buffer2();
17302
17293
  init_process2();
17303
- init_navigator();
17304
17294
  (function(global2, factory) {
17305
17295
  typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.fastUniqueNumbers = {}));
17306
17296
  })(exports5, function(exports6) {
@@ -17356,9 +17346,9 @@ var mqtt = (() => {
17356
17346
  // node_modules/worker-timers-broker/build/es5/bundle.js
17357
17347
  var require_bundle2 = __commonJS({
17358
17348
  "node_modules/worker-timers-broker/build/es5/bundle.js"(exports5, module) {
17349
+ init_dirname();
17359
17350
  init_buffer2();
17360
17351
  init_process2();
17361
- init_navigator();
17362
17352
  (function(global2, factory) {
17363
17353
  typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5, require_bundle()) : typeof define === "function" && define.amd ? define(["exports", "fast-unique-numbers"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.workerTimersBroker = {}, global2.fastUniqueNumbers));
17364
17354
  })(exports5, function(exports6, fastUniqueNumbers) {
@@ -17517,9 +17507,9 @@ var mqtt = (() => {
17517
17507
  // node_modules/worker-timers/build/es5/bundle.js
17518
17508
  var require_bundle3 = __commonJS({
17519
17509
  "node_modules/worker-timers/build/es5/bundle.js"(exports5, module) {
17510
+ init_dirname();
17520
17511
  init_buffer2();
17521
17512
  init_process2();
17522
- init_navigator();
17523
17513
  (function(global2, factory) {
17524
17514
  typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5, require_bundle2()) : typeof define === "function" && define.amd ? define(["exports", "worker-timers-broker"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.workerTimers = {}, global2.workerTimersBroker));
17525
17515
  })(exports5, function(exports6, workerTimersBroker) {
@@ -17569,9 +17559,9 @@ var mqtt = (() => {
17569
17559
  var require_get_timer = __commonJS({
17570
17560
  "build/lib/get-timer.js"(exports5) {
17571
17561
  "use strict";
17562
+ init_dirname();
17572
17563
  init_buffer2();
17573
17564
  init_process2();
17574
- init_navigator();
17575
17565
  var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
17576
17566
  if (k22 === void 0)
17577
17567
  k22 = k2;
@@ -17637,9 +17627,9 @@ var mqtt = (() => {
17637
17627
  var require_KeepaliveManager = __commonJS({
17638
17628
  "build/lib/KeepaliveManager.js"(exports5) {
17639
17629
  "use strict";
17630
+ init_dirname();
17640
17631
  init_buffer2();
17641
17632
  init_process2();
17642
- init_navigator();
17643
17633
  var __importDefault = exports5 && exports5.__importDefault || function(mod) {
17644
17634
  return mod && mod.__esModule ? mod : { "default": mod };
17645
17635
  };
@@ -17710,9 +17700,9 @@ var mqtt = (() => {
17710
17700
  var require_client = __commonJS({
17711
17701
  "build/lib/client.js"(exports5) {
17712
17702
  "use strict";
17703
+ init_dirname();
17713
17704
  init_buffer2();
17714
17705
  init_process2();
17715
- init_navigator();
17716
17706
  var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
17717
17707
  if (k22 === void 0)
17718
17708
  k22 = k2;
@@ -18861,9 +18851,9 @@ var mqtt = (() => {
18861
18851
  var require_unique_message_id_provider = __commonJS({
18862
18852
  "build/lib/unique-message-id-provider.js"(exports5) {
18863
18853
  "use strict";
18854
+ init_dirname();
18864
18855
  init_buffer2();
18865
18856
  init_process2();
18866
- init_navigator();
18867
18857
  Object.defineProperty(exports5, "__esModule", { value: true });
18868
18858
  var number_allocator_1 = require_number_allocator2();
18869
18859
  var UniqueMessageIdProvider = class {
@@ -18925,9 +18915,9 @@ var mqtt = (() => {
18925
18915
  var t3, o3, n3, e3, r3, c3, s3, u3, a3, d2, h3, p3;
18926
18916
  var init_chunk_924bb2e1 = __esm({
18927
18917
  "node_modules/@jspm/core/nodelibs/browser/chunk-924bb2e1.js"() {
18918
+ init_dirname();
18928
18919
  init_buffer2();
18929
18920
  init_process2();
18930
- init_navigator();
18931
18921
  t3 = 2147483647;
18932
18922
  o3 = /^xn--/;
18933
18923
  n3 = /[^\0-\x7E]/;
@@ -19021,9 +19011,9 @@ var mqtt = (() => {
19021
19011
  var n4, r4, t4, o4;
19022
19012
  var init_chunk_b04e620d = __esm({
19023
19013
  "node_modules/@jspm/core/nodelibs/browser/chunk-b04e620d.js"() {
19014
+ init_dirname();
19024
19015
  init_buffer2();
19025
19016
  init_process2();
19026
- init_navigator();
19027
19017
  n4 = function(n7, r7, t6, o7) {
19028
19018
  r7 = r7 || "&", t6 = t6 || "=";
19029
19019
  var a6 = {};
@@ -19129,9 +19119,9 @@ var mqtt = (() => {
19129
19119
  var e5, t5, n5, r5, o5, l4, s4, f4, a4, T2;
19130
19120
  var init_chunk_5decc758 = __esm({
19131
19121
  "node_modules/@jspm/core/nodelibs/browser/chunk-5decc758.js"() {
19122
+ init_dirname();
19132
19123
  init_buffer2();
19133
19124
  init_process2();
19134
- init_navigator();
19135
19125
  r5 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : global;
19136
19126
  o5 = e5 = {};
19137
19127
  !function() {
@@ -19359,9 +19349,9 @@ var mqtt = (() => {
19359
19349
  var exports2, _dewExec2, _global, process2;
19360
19350
  var init_chunk_2eac56ff = __esm({
19361
19351
  "node_modules/@jspm/core/nodelibs/browser/chunk-2eac56ff.js"() {
19352
+ init_dirname();
19362
19353
  init_buffer2();
19363
19354
  init_process2();
19364
- init_navigator();
19365
19355
  exports2 = {};
19366
19356
  _dewExec2 = false;
19367
19357
  _global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
@@ -19830,9 +19820,9 @@ var mqtt = (() => {
19830
19820
  var exports$12, _dewExec3, exports3;
19831
19821
  var init_chunk_23dbec7b = __esm({
19832
19822
  "node_modules/@jspm/core/nodelibs/browser/chunk-23dbec7b.js"() {
19823
+ init_dirname();
19833
19824
  init_buffer2();
19834
19825
  init_process2();
19835
- init_navigator();
19836
19826
  init_chunk_2eac56ff();
19837
19827
  exports$12 = {};
19838
19828
  _dewExec3 = false;
@@ -20460,9 +20450,9 @@ var mqtt = (() => {
20460
20450
  var h5, e6, a5, o6, n6, i5, l5, p5, c5, u5, f5, m3, v3, g2, y3, b2, exports4, _dewExec4, path, processPlatform$1, CHAR_BACKWARD_SLASH$1, CHAR_FORWARD_SLASH$1, CHAR_LOWERCASE_A$1, CHAR_LOWERCASE_Z$1, isWindows$1, forwardSlashRegEx$1, percentRegEx$1, backslashRegEx$1, newlineRegEx$1, carriageReturnRegEx$1, tabRegEx$1, processPlatform, Url, format, resolve, resolveObject, parse, _URL, CHAR_BACKWARD_SLASH, CHAR_FORWARD_SLASH, CHAR_LOWERCASE_A, CHAR_LOWERCASE_Z, isWindows, forwardSlashRegEx, percentRegEx, backslashRegEx, newlineRegEx, carriageReturnRegEx, tabRegEx;
20461
20451
  var init_url = __esm({
20462
20452
  "node_modules/@jspm/core/nodelibs/browser/url.js"() {
20453
+ init_dirname();
20463
20454
  init_buffer2();
20464
20455
  init_process2();
20465
- init_navigator();
20466
20456
  init_chunk_924bb2e1();
20467
20457
  init_chunk_b04e620d();
20468
20458
  init_chunk_5decc758();
@@ -20691,132 +20681,18 @@ var mqtt = (() => {
20691
20681
  }
20692
20682
  });
20693
20683
 
20694
- // node_modules/@jspm/core/nodelibs/browser/net.js
20695
- var net_exports = {};
20696
- __export(net_exports, {
20697
- Server: () => unimplemented2,
20698
- Socket: () => unimplemented2,
20699
- Stream: () => unimplemented2,
20700
- _createServerHandle: () => unimplemented2,
20701
- _normalizeArgs: () => unimplemented2,
20702
- _setSimultaneousAccepts: () => unimplemented2,
20703
- connect: () => unimplemented2,
20704
- createConnection: () => unimplemented2,
20705
- createServer: () => unimplemented2,
20706
- default: () => net,
20707
- isIP: () => unimplemented2,
20708
- isIPv4: () => unimplemented2,
20709
- isIPv6: () => unimplemented2
20710
- });
20711
- function unimplemented2() {
20712
- throw new Error("Node.js net module is not supported by JSPM core outside of Node.js");
20713
- }
20714
- var net;
20715
- var init_net = __esm({
20716
- "node_modules/@jspm/core/nodelibs/browser/net.js"() {
20717
- init_buffer2();
20718
- init_process2();
20719
- init_navigator();
20720
- net = {
20721
- _createServerHandle: unimplemented2,
20722
- _normalizeArgs: unimplemented2,
20723
- _setSimultaneousAccepts: unimplemented2,
20724
- connect: unimplemented2,
20725
- createConnection: unimplemented2,
20726
- createServer: unimplemented2,
20727
- isIP: unimplemented2,
20728
- isIPv4: unimplemented2,
20729
- isIPv6: unimplemented2,
20730
- Server: unimplemented2,
20731
- Socket: unimplemented2,
20732
- Stream: unimplemented2
20733
- };
20734
- }
20735
- });
20736
-
20737
- // build/lib/connect/tcp.js
20738
- var require_tcp = __commonJS({
20739
- "build/lib/connect/tcp.js"(exports5) {
20740
- "use strict";
20741
- init_buffer2();
20742
- init_process2();
20743
- init_navigator();
20744
- var __importDefault = exports5 && exports5.__importDefault || function(mod) {
20745
- return mod && mod.__esModule ? mod : { "default": mod };
20746
- };
20747
- Object.defineProperty(exports5, "__esModule", { value: true });
20748
- var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
20749
- var debug_1 = __importDefault(require_browser4());
20750
- var debug = (0, debug_1.default)("mqttjs:tcp");
20751
- var buildStream = (client, opts) => {
20752
- opts.port = opts.port || 1883;
20753
- opts.hostname = opts.hostname || opts.host || "localhost";
20754
- const { port, path: path2 } = opts;
20755
- const host = opts.hostname;
20756
- debug("port %d and host %s", port, host);
20757
- return net_1.default.createConnection({ port, host, path: path2 });
20758
- };
20759
- exports5.default = buildStream;
20760
- }
20761
- });
20762
-
20763
- // node_modules/esbuild-plugin-polyfill-node/polyfills/empty.js
20764
- var empty_exports = {};
20765
- __export(empty_exports, {
20766
- default: () => empty_default
20767
- });
20768
- var empty_default;
20769
- var init_empty = __esm({
20770
- "node_modules/esbuild-plugin-polyfill-node/polyfills/empty.js"() {
20771
- init_buffer2();
20772
- init_process2();
20773
- init_navigator();
20774
- empty_default = {};
20775
- }
20776
- });
20777
-
20778
- // build/lib/connect/tls.js
20779
- var require_tls = __commonJS({
20780
- "build/lib/connect/tls.js"(exports5) {
20684
+ // node_modules/ws/browser.js
20685
+ var require_browser5 = __commonJS({
20686
+ "node_modules/ws/browser.js"(exports5, module) {
20781
20687
  "use strict";
20688
+ init_dirname();
20782
20689
  init_buffer2();
20783
20690
  init_process2();
20784
- init_navigator();
20785
- var __importDefault = exports5 && exports5.__importDefault || function(mod) {
20786
- return mod && mod.__esModule ? mod : { "default": mod };
20787
- };
20788
- Object.defineProperty(exports5, "__esModule", { value: true });
20789
- var tls_1 = __importDefault((init_empty(), __toCommonJS(empty_exports)));
20790
- var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
20791
- var debug_1 = __importDefault(require_browser4());
20792
- var debug = (0, debug_1.default)("mqttjs:tls");
20793
- var buildStream = (client, opts) => {
20794
- opts.port = opts.port || 8883;
20795
- opts.host = opts.hostname || opts.host || "localhost";
20796
- if (net_1.default.isIP(opts.host) === 0) {
20797
- opts.servername = opts.host;
20798
- }
20799
- opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
20800
- delete opts.path;
20801
- debug("port %d host %s rejectUnauthorized %b", opts.port, opts.host, opts.rejectUnauthorized);
20802
- const connection = tls_1.default.connect(opts);
20803
- connection.on("secureConnect", () => {
20804
- if (opts.rejectUnauthorized && !connection.authorized) {
20805
- connection.emit("error", new Error("TLS not authorized"));
20806
- } else {
20807
- connection.removeListener("error", handleTLSerrors);
20808
- }
20809
- });
20810
- function handleTLSerrors(err) {
20811
- if (opts.rejectUnauthorized) {
20812
- client.emit("error", err);
20813
- }
20814
- connection.end();
20815
- }
20816
- connection.on("error", handleTLSerrors);
20817
- return connection;
20691
+ module.exports = function() {
20692
+ throw new Error(
20693
+ "ws does not work in the browser. Browser clients must use the native WebSocket object"
20694
+ );
20818
20695
  };
20819
- exports5.default = buildStream;
20820
20696
  }
20821
20697
  });
20822
20698
 
@@ -20824,9 +20700,9 @@ var mqtt = (() => {
20824
20700
  var require_BufferedDuplex = __commonJS({
20825
20701
  "build/lib/BufferedDuplex.js"(exports5) {
20826
20702
  "use strict";
20703
+ init_dirname();
20827
20704
  init_buffer2();
20828
20705
  init_process2();
20829
- init_navigator();
20830
20706
  Object.defineProperty(exports5, "__esModule", { value: true });
20831
20707
  exports5.BufferedDuplex = exports5.writev = void 0;
20832
20708
  var readable_stream_1 = require_browser3();
@@ -20901,96 +20777,436 @@ var mqtt = (() => {
20901
20777
  }
20902
20778
  });
20903
20779
 
20904
- // build/lib/connect/wx.js
20905
- var require_wx = __commonJS({
20906
- "build/lib/connect/wx.js"(exports5) {
20780
+ // build/lib/connect/ws.js
20781
+ var require_ws = __commonJS({
20782
+ "build/lib/connect/ws.js"(exports5) {
20907
20783
  "use strict";
20784
+ init_dirname();
20908
20785
  init_buffer2();
20909
20786
  init_process2();
20910
- init_navigator();
20787
+ var __importDefault = exports5 && exports5.__importDefault || function(mod) {
20788
+ return mod && mod.__esModule ? mod : { "default": mod };
20789
+ };
20911
20790
  Object.defineProperty(exports5, "__esModule", { value: true });
20791
+ exports5.streamBuilder = exports5.browserStreamBuilder = void 0;
20912
20792
  var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
20793
+ var ws_1 = __importDefault(require_browser5());
20794
+ var debug_1 = __importDefault(require_browser4());
20913
20795
  var readable_stream_1 = require_browser3();
20796
+ var is_browser_1 = __importDefault(require_is_browser());
20914
20797
  var BufferedDuplex_1 = require_BufferedDuplex();
20915
- var socketTask;
20916
- var proxy;
20917
- var stream;
20918
- function buildProxy() {
20919
- const _proxy = new readable_stream_1.Transform();
20920
- _proxy._write = (chunk, encoding, next) => {
20921
- socketTask.send({
20922
- data: chunk.buffer,
20923
- success() {
20924
- next();
20925
- },
20926
- fail(errMsg) {
20927
- next(new Error(errMsg));
20928
- }
20929
- });
20930
- };
20931
- _proxy._flush = (done) => {
20932
- socketTask.close({
20933
- success() {
20934
- done();
20935
- }
20936
- });
20937
- };
20938
- return _proxy;
20798
+ var debug = (0, debug_1.default)("mqttjs:ws");
20799
+ var WSS_OPTIONS = [
20800
+ "rejectUnauthorized",
20801
+ "ca",
20802
+ "cert",
20803
+ "key",
20804
+ "pfx",
20805
+ "passphrase"
20806
+ ];
20807
+ function buildUrl(opts, client) {
20808
+ let url = `${opts.protocol}://${opts.hostname}:${opts.port}${opts.path}`;
20809
+ if (typeof opts.transformWsUrl === "function") {
20810
+ url = opts.transformWsUrl(url, opts, client);
20811
+ }
20812
+ return url;
20939
20813
  }
20940
20814
  function setDefaultOpts(opts) {
20941
- if (!opts.hostname) {
20942
- opts.hostname = "localhost";
20815
+ const options = opts;
20816
+ if (!opts.port) {
20817
+ if (opts.protocol === "wss") {
20818
+ options.port = 443;
20819
+ } else {
20820
+ options.port = 80;
20821
+ }
20943
20822
  }
20944
20823
  if (!opts.path) {
20945
- opts.path = "/";
20824
+ options.path = "/";
20946
20825
  }
20947
20826
  if (!opts.wsOptions) {
20948
- opts.wsOptions = {};
20827
+ options.wsOptions = {};
20828
+ }
20829
+ if (!is_browser_1.default && !opts.forceNativeWebSocket && opts.protocol === "wss") {
20830
+ WSS_OPTIONS.forEach((prop) => {
20831
+ if (Object.prototype.hasOwnProperty.call(opts, prop) && !Object.prototype.hasOwnProperty.call(opts.wsOptions, prop)) {
20832
+ options.wsOptions[prop] = opts[prop];
20833
+ }
20834
+ });
20949
20835
  }
20836
+ return options;
20950
20837
  }
20951
- function buildUrl(opts, client) {
20952
- const protocol = opts.protocol === "wxs" ? "wss" : "ws";
20953
- let url = `${protocol}://${opts.hostname}${opts.path}`;
20954
- if (opts.port && opts.port !== 80 && opts.port !== 443) {
20955
- url = `${protocol}://${opts.hostname}:${opts.port}${opts.path}`;
20838
+ function setDefaultBrowserOpts(opts) {
20839
+ const options = setDefaultOpts(opts);
20840
+ if (!options.hostname) {
20841
+ options.hostname = options.host;
20956
20842
  }
20957
- if (typeof opts.transformWsUrl === "function") {
20958
- url = opts.transformWsUrl(url, opts, client);
20843
+ if (!options.hostname) {
20844
+ if (typeof document === "undefined") {
20845
+ throw new Error("Could not determine host. Specify host manually.");
20846
+ }
20847
+ const parsed = new URL(document.URL);
20848
+ options.hostname = parsed.hostname;
20849
+ if (!options.port) {
20850
+ options.port = Number(parsed.port);
20851
+ }
20959
20852
  }
20960
- return url;
20961
- }
20962
- function bindEventHandler() {
20963
- socketTask.onOpen(() => {
20964
- stream.socketReady();
20965
- });
20966
- socketTask.onMessage((res) => {
20967
- let { data } = res;
20968
- if (data instanceof ArrayBuffer)
20969
- data = buffer_1.Buffer.from(data);
20970
- else
20971
- data = buffer_1.Buffer.from(data, "utf8");
20972
- proxy.push(data);
20973
- });
20974
- socketTask.onClose(() => {
20975
- stream.emit("close");
20976
- stream.end();
20977
- stream.destroy();
20978
- });
20979
- socketTask.onError((error) => {
20980
- const err = new Error(error.errMsg);
20981
- stream.destroy(err);
20982
- });
20983
- }
20984
- var buildStream = (client, opts) => {
20985
- opts.hostname = opts.hostname || opts.host;
20986
- if (!opts.hostname) {
20987
- throw new Error("Could not determine host. Specify host manually.");
20853
+ if (options.objectMode === void 0) {
20854
+ options.objectMode = !(options.binary === true || options.binary === void 0);
20988
20855
  }
20856
+ return options;
20857
+ }
20858
+ function createWebSocket(client, url, opts) {
20859
+ debug("createWebSocket");
20860
+ debug(`protocol: ${opts.protocolId} ${opts.protocolVersion}`);
20989
20861
  const websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
20990
- setDefaultOpts(opts);
20991
- const url = buildUrl(opts, client);
20992
- socketTask = wx.connectSocket({
20993
- url,
20862
+ debug(`creating new Websocket for url: ${url} and protocol: ${websocketSubProtocol}`);
20863
+ let socket;
20864
+ if (opts.createWebsocket) {
20865
+ socket = opts.createWebsocket(url, [websocketSubProtocol], opts);
20866
+ } else {
20867
+ socket = new ws_1.default(url, [websocketSubProtocol], opts.wsOptions);
20868
+ }
20869
+ return socket;
20870
+ }
20871
+ function createBrowserWebSocket(client, opts) {
20872
+ const websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
20873
+ const url = buildUrl(opts, client);
20874
+ let socket;
20875
+ if (opts.createWebsocket) {
20876
+ socket = opts.createWebsocket(url, [websocketSubProtocol], opts);
20877
+ } else {
20878
+ socket = new WebSocket(url, [websocketSubProtocol]);
20879
+ }
20880
+ socket.binaryType = "arraybuffer";
20881
+ return socket;
20882
+ }
20883
+ var streamBuilder = (client, opts) => {
20884
+ debug("streamBuilder");
20885
+ const options = setDefaultOpts(opts);
20886
+ options.hostname = options.hostname || options.host || "localhost";
20887
+ const url = buildUrl(options, client);
20888
+ const socket = createWebSocket(client, url, options);
20889
+ const webSocketStream = ws_1.default.createWebSocketStream(socket, options.wsOptions);
20890
+ webSocketStream["url"] = url;
20891
+ socket.on("close", () => {
20892
+ webSocketStream.destroy();
20893
+ });
20894
+ return webSocketStream;
20895
+ };
20896
+ exports5.streamBuilder = streamBuilder;
20897
+ var browserStreamBuilder = (client, opts) => {
20898
+ debug("browserStreamBuilder");
20899
+ let stream;
20900
+ const options = setDefaultBrowserOpts(opts);
20901
+ const bufferSize = options.browserBufferSize || 1024 * 512;
20902
+ const bufferTimeout = opts.browserBufferTimeout || 1e3;
20903
+ const coerceToBuffer = !opts.objectMode;
20904
+ const socket = createBrowserWebSocket(client, opts);
20905
+ const proxy = buildProxy(opts, socketWriteBrowser, socketEndBrowser);
20906
+ if (!opts.objectMode) {
20907
+ proxy._writev = BufferedDuplex_1.writev.bind(proxy);
20908
+ }
20909
+ proxy.on("close", () => {
20910
+ socket.close();
20911
+ });
20912
+ const eventListenerSupport = typeof socket.addEventListener !== "undefined";
20913
+ if (socket.readyState === socket.OPEN) {
20914
+ stream = proxy;
20915
+ stream.socket = socket;
20916
+ } else {
20917
+ stream = new BufferedDuplex_1.BufferedDuplex(opts, proxy, socket);
20918
+ if (eventListenerSupport) {
20919
+ socket.addEventListener("open", onOpen);
20920
+ } else {
20921
+ socket.onopen = onOpen;
20922
+ }
20923
+ }
20924
+ if (eventListenerSupport) {
20925
+ socket.addEventListener("close", onClose);
20926
+ socket.addEventListener("error", onError);
20927
+ socket.addEventListener("message", onMessage);
20928
+ } else {
20929
+ socket.onclose = onClose;
20930
+ socket.onerror = onError;
20931
+ socket.onmessage = onMessage;
20932
+ }
20933
+ function buildProxy(pOptions, socketWrite, socketEnd) {
20934
+ const _proxy = new readable_stream_1.Transform({
20935
+ objectMode: pOptions.objectMode
20936
+ });
20937
+ _proxy._write = socketWrite;
20938
+ _proxy._flush = socketEnd;
20939
+ return _proxy;
20940
+ }
20941
+ function onOpen() {
20942
+ debug("WebSocket onOpen");
20943
+ if (stream instanceof BufferedDuplex_1.BufferedDuplex) {
20944
+ stream.socketReady();
20945
+ }
20946
+ }
20947
+ function onClose(event) {
20948
+ debug("WebSocket onClose", event);
20949
+ stream.end();
20950
+ stream.destroy();
20951
+ }
20952
+ function onError(err) {
20953
+ debug("WebSocket onError", err);
20954
+ const error = new Error("WebSocket error");
20955
+ error["event"] = err;
20956
+ stream.destroy(error);
20957
+ }
20958
+ function onMessage(event) {
20959
+ let { data } = event;
20960
+ if (data instanceof ArrayBuffer)
20961
+ data = buffer_1.Buffer.from(data);
20962
+ else
20963
+ data = buffer_1.Buffer.from(data, "utf8");
20964
+ proxy.push(data);
20965
+ }
20966
+ function socketWriteBrowser(chunk, enc, next) {
20967
+ if (socket.bufferedAmount > bufferSize) {
20968
+ setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next);
20969
+ return;
20970
+ }
20971
+ if (coerceToBuffer && typeof chunk === "string") {
20972
+ chunk = buffer_1.Buffer.from(chunk, "utf8");
20973
+ }
20974
+ try {
20975
+ socket.send(chunk);
20976
+ } catch (err) {
20977
+ return next(err);
20978
+ }
20979
+ next();
20980
+ }
20981
+ function socketEndBrowser(done) {
20982
+ socket.close();
20983
+ done();
20984
+ }
20985
+ return stream;
20986
+ };
20987
+ exports5.browserStreamBuilder = browserStreamBuilder;
20988
+ }
20989
+ });
20990
+
20991
+ // node_modules/@jspm/core/nodelibs/browser/net.js
20992
+ var net_exports = {};
20993
+ __export(net_exports, {
20994
+ Server: () => unimplemented2,
20995
+ Socket: () => unimplemented2,
20996
+ Stream: () => unimplemented2,
20997
+ _createServerHandle: () => unimplemented2,
20998
+ _normalizeArgs: () => unimplemented2,
20999
+ _setSimultaneousAccepts: () => unimplemented2,
21000
+ connect: () => unimplemented2,
21001
+ createConnection: () => unimplemented2,
21002
+ createServer: () => unimplemented2,
21003
+ default: () => net,
21004
+ isIP: () => unimplemented2,
21005
+ isIPv4: () => unimplemented2,
21006
+ isIPv6: () => unimplemented2
21007
+ });
21008
+ function unimplemented2() {
21009
+ throw new Error("Node.js net module is not supported by JSPM core outside of Node.js");
21010
+ }
21011
+ var net;
21012
+ var init_net = __esm({
21013
+ "node_modules/@jspm/core/nodelibs/browser/net.js"() {
21014
+ init_dirname();
21015
+ init_buffer2();
21016
+ init_process2();
21017
+ net = {
21018
+ _createServerHandle: unimplemented2,
21019
+ _normalizeArgs: unimplemented2,
21020
+ _setSimultaneousAccepts: unimplemented2,
21021
+ connect: unimplemented2,
21022
+ createConnection: unimplemented2,
21023
+ createServer: unimplemented2,
21024
+ isIP: unimplemented2,
21025
+ isIPv4: unimplemented2,
21026
+ isIPv6: unimplemented2,
21027
+ Server: unimplemented2,
21028
+ Socket: unimplemented2,
21029
+ Stream: unimplemented2
21030
+ };
21031
+ }
21032
+ });
21033
+
21034
+ // build/lib/connect/tcp.js
21035
+ var require_tcp = __commonJS({
21036
+ "build/lib/connect/tcp.js"(exports5) {
21037
+ "use strict";
21038
+ init_dirname();
21039
+ init_buffer2();
21040
+ init_process2();
21041
+ var __importDefault = exports5 && exports5.__importDefault || function(mod) {
21042
+ return mod && mod.__esModule ? mod : { "default": mod };
21043
+ };
21044
+ Object.defineProperty(exports5, "__esModule", { value: true });
21045
+ var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
21046
+ var debug_1 = __importDefault(require_browser4());
21047
+ var debug = (0, debug_1.default)("mqttjs:tcp");
21048
+ var buildStream = (client, opts) => {
21049
+ opts.port = opts.port || 1883;
21050
+ opts.hostname = opts.hostname || opts.host || "localhost";
21051
+ const { port, path: path2 } = opts;
21052
+ const host = opts.hostname;
21053
+ debug("port %d and host %s", port, host);
21054
+ return net_1.default.createConnection({ port, host, path: path2 });
21055
+ };
21056
+ exports5.default = buildStream;
21057
+ }
21058
+ });
21059
+
21060
+ // node_modules/esbuild-plugin-polyfill-node/polyfills/empty.js
21061
+ var empty_exports = {};
21062
+ __export(empty_exports, {
21063
+ default: () => empty_default
21064
+ });
21065
+ var empty_default;
21066
+ var init_empty = __esm({
21067
+ "node_modules/esbuild-plugin-polyfill-node/polyfills/empty.js"() {
21068
+ init_dirname();
21069
+ init_buffer2();
21070
+ init_process2();
21071
+ empty_default = {};
21072
+ }
21073
+ });
21074
+
21075
+ // build/lib/connect/tls.js
21076
+ var require_tls = __commonJS({
21077
+ "build/lib/connect/tls.js"(exports5) {
21078
+ "use strict";
21079
+ init_dirname();
21080
+ init_buffer2();
21081
+ init_process2();
21082
+ var __importDefault = exports5 && exports5.__importDefault || function(mod) {
21083
+ return mod && mod.__esModule ? mod : { "default": mod };
21084
+ };
21085
+ Object.defineProperty(exports5, "__esModule", { value: true });
21086
+ var tls_1 = __importDefault((init_empty(), __toCommonJS(empty_exports)));
21087
+ var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
21088
+ var debug_1 = __importDefault(require_browser4());
21089
+ var debug = (0, debug_1.default)("mqttjs:tls");
21090
+ var buildStream = (client, opts) => {
21091
+ opts.port = opts.port || 8883;
21092
+ opts.host = opts.hostname || opts.host || "localhost";
21093
+ if (net_1.default.isIP(opts.host) === 0) {
21094
+ opts.servername = opts.host;
21095
+ }
21096
+ opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
21097
+ delete opts.path;
21098
+ debug("port %d host %s rejectUnauthorized %b", opts.port, opts.host, opts.rejectUnauthorized);
21099
+ const connection = tls_1.default.connect(opts);
21100
+ connection.on("secureConnect", () => {
21101
+ if (opts.rejectUnauthorized && !connection.authorized) {
21102
+ connection.emit("error", new Error("TLS not authorized"));
21103
+ } else {
21104
+ connection.removeListener("error", handleTLSerrors);
21105
+ }
21106
+ });
21107
+ function handleTLSerrors(err) {
21108
+ if (opts.rejectUnauthorized) {
21109
+ client.emit("error", err);
21110
+ }
21111
+ connection.end();
21112
+ }
21113
+ connection.on("error", handleTLSerrors);
21114
+ return connection;
21115
+ };
21116
+ exports5.default = buildStream;
21117
+ }
21118
+ });
21119
+
21120
+ // build/lib/connect/wx.js
21121
+ var require_wx = __commonJS({
21122
+ "build/lib/connect/wx.js"(exports5) {
21123
+ "use strict";
21124
+ init_dirname();
21125
+ init_buffer2();
21126
+ init_process2();
21127
+ Object.defineProperty(exports5, "__esModule", { value: true });
21128
+ var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
21129
+ var readable_stream_1 = require_browser3();
21130
+ var BufferedDuplex_1 = require_BufferedDuplex();
21131
+ var socketTask;
21132
+ var proxy;
21133
+ var stream;
21134
+ function buildProxy() {
21135
+ const _proxy = new readable_stream_1.Transform();
21136
+ _proxy._write = (chunk, encoding, next) => {
21137
+ socketTask.send({
21138
+ data: chunk.buffer,
21139
+ success() {
21140
+ next();
21141
+ },
21142
+ fail(errMsg) {
21143
+ next(new Error(errMsg));
21144
+ }
21145
+ });
21146
+ };
21147
+ _proxy._flush = (done) => {
21148
+ socketTask.close({
21149
+ success() {
21150
+ done();
21151
+ }
21152
+ });
21153
+ };
21154
+ return _proxy;
21155
+ }
21156
+ function setDefaultOpts(opts) {
21157
+ if (!opts.hostname) {
21158
+ opts.hostname = "localhost";
21159
+ }
21160
+ if (!opts.path) {
21161
+ opts.path = "/";
21162
+ }
21163
+ if (!opts.wsOptions) {
21164
+ opts.wsOptions = {};
21165
+ }
21166
+ }
21167
+ function buildUrl(opts, client) {
21168
+ const protocol = opts.protocol === "wxs" ? "wss" : "ws";
21169
+ let url = `${protocol}://${opts.hostname}${opts.path}`;
21170
+ if (opts.port && opts.port !== 80 && opts.port !== 443) {
21171
+ url = `${protocol}://${opts.hostname}:${opts.port}${opts.path}`;
21172
+ }
21173
+ if (typeof opts.transformWsUrl === "function") {
21174
+ url = opts.transformWsUrl(url, opts, client);
21175
+ }
21176
+ return url;
21177
+ }
21178
+ function bindEventHandler() {
21179
+ socketTask.onOpen(() => {
21180
+ stream.socketReady();
21181
+ });
21182
+ socketTask.onMessage((res) => {
21183
+ let { data } = res;
21184
+ if (data instanceof ArrayBuffer)
21185
+ data = buffer_1.Buffer.from(data);
21186
+ else
21187
+ data = buffer_1.Buffer.from(data, "utf8");
21188
+ proxy.push(data);
21189
+ });
21190
+ socketTask.onClose(() => {
21191
+ stream.emit("close");
21192
+ stream.end();
21193
+ stream.destroy();
21194
+ });
21195
+ socketTask.onError((error) => {
21196
+ const err = new Error(error.errMsg);
21197
+ stream.destroy(err);
21198
+ });
21199
+ }
21200
+ var buildStream = (client, opts) => {
21201
+ opts.hostname = opts.hostname || opts.host;
21202
+ if (!opts.hostname) {
21203
+ throw new Error("Could not determine host. Specify host manually.");
21204
+ }
21205
+ const websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
21206
+ setDefaultOpts(opts);
21207
+ const url = buildUrl(opts, client);
21208
+ socketTask = wx.connectSocket({
21209
+ url,
20994
21210
  protocols: [websocketSubProtocol]
20995
21211
  });
20996
21212
  proxy = buildProxy();
@@ -21026,9 +21242,9 @@ var mqtt = (() => {
21026
21242
  var require_ali = __commonJS({
21027
21243
  "build/lib/connect/ali.js"(exports5) {
21028
21244
  "use strict";
21245
+ init_dirname();
21029
21246
  init_buffer2();
21030
21247
  init_process2();
21031
- init_navigator();
21032
21248
  Object.defineProperty(exports5, "__esModule", { value: true });
21033
21249
  var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
21034
21250
  var readable_stream_1 = require_browser3();
@@ -21135,237 +21351,13 @@ var mqtt = (() => {
21135
21351
  }
21136
21352
  });
21137
21353
 
21138
- // node_modules/ws/browser.js
21139
- var require_browser5 = __commonJS({
21140
- "node_modules/ws/browser.js"(exports5, module) {
21141
- "use strict";
21142
- init_buffer2();
21143
- init_process2();
21144
- init_navigator();
21145
- module.exports = function() {
21146
- throw new Error(
21147
- "ws does not work in the browser. Browser clients must use the native WebSocket object"
21148
- );
21149
- };
21150
- }
21151
- });
21152
-
21153
- // build/lib/connect/ws.js
21154
- var require_ws = __commonJS({
21155
- "build/lib/connect/ws.js"(exports5) {
21156
- "use strict";
21157
- init_buffer2();
21158
- init_process2();
21159
- init_navigator();
21160
- var __importDefault = exports5 && exports5.__importDefault || function(mod) {
21161
- return mod && mod.__esModule ? mod : { "default": mod };
21162
- };
21163
- Object.defineProperty(exports5, "__esModule", { value: true });
21164
- var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
21165
- var ws_1 = __importDefault(require_browser5());
21166
- var debug_1 = __importDefault(require_browser4());
21167
- var readable_stream_1 = require_browser3();
21168
- var is_browser_1 = __importDefault(require_is_browser());
21169
- var BufferedDuplex_1 = require_BufferedDuplex();
21170
- var debug = (0, debug_1.default)("mqttjs:ws");
21171
- var WSS_OPTIONS = [
21172
- "rejectUnauthorized",
21173
- "ca",
21174
- "cert",
21175
- "key",
21176
- "pfx",
21177
- "passphrase"
21178
- ];
21179
- function buildUrl(opts, client) {
21180
- let url = `${opts.protocol}://${opts.hostname}:${opts.port}${opts.path}`;
21181
- if (typeof opts.transformWsUrl === "function") {
21182
- url = opts.transformWsUrl(url, opts, client);
21183
- }
21184
- return url;
21185
- }
21186
- function setDefaultOpts(opts) {
21187
- const options = opts;
21188
- if (!opts.port) {
21189
- if (opts.protocol === "wss") {
21190
- options.port = 443;
21191
- } else {
21192
- options.port = 80;
21193
- }
21194
- }
21195
- if (!opts.path) {
21196
- options.path = "/";
21197
- }
21198
- if (!opts.wsOptions) {
21199
- options.wsOptions = {};
21200
- }
21201
- if (!is_browser_1.default && opts.protocol === "wss") {
21202
- WSS_OPTIONS.forEach((prop) => {
21203
- if (Object.prototype.hasOwnProperty.call(opts, prop) && !Object.prototype.hasOwnProperty.call(opts.wsOptions, prop)) {
21204
- options.wsOptions[prop] = opts[prop];
21205
- }
21206
- });
21207
- }
21208
- return options;
21209
- }
21210
- function setDefaultBrowserOpts(opts) {
21211
- const options = setDefaultOpts(opts);
21212
- if (!options.hostname) {
21213
- options.hostname = options.host;
21214
- }
21215
- if (!options.hostname) {
21216
- if (typeof document === "undefined") {
21217
- throw new Error("Could not determine host. Specify host manually.");
21218
- }
21219
- const parsed = new URL(document.URL);
21220
- options.hostname = parsed.hostname;
21221
- if (!options.port) {
21222
- options.port = Number(parsed.port);
21223
- }
21224
- }
21225
- if (options.objectMode === void 0) {
21226
- options.objectMode = !(options.binary === true || options.binary === void 0);
21227
- }
21228
- return options;
21229
- }
21230
- function createWebSocket(client, url, opts) {
21231
- debug("createWebSocket");
21232
- debug(`protocol: ${opts.protocolId} ${opts.protocolVersion}`);
21233
- const websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
21234
- debug(`creating new Websocket for url: ${url} and protocol: ${websocketSubProtocol}`);
21235
- let socket;
21236
- if (opts.createWebsocket) {
21237
- socket = opts.createWebsocket(url, [websocketSubProtocol], opts);
21238
- } else {
21239
- socket = new ws_1.default(url, [websocketSubProtocol], opts.wsOptions);
21240
- }
21241
- return socket;
21242
- }
21243
- function createBrowserWebSocket(client, opts) {
21244
- const websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
21245
- const url = buildUrl(opts, client);
21246
- let socket;
21247
- if (opts.createWebsocket) {
21248
- socket = opts.createWebsocket(url, [websocketSubProtocol], opts);
21249
- } else {
21250
- socket = new WebSocket(url, [websocketSubProtocol]);
21251
- }
21252
- socket.binaryType = "arraybuffer";
21253
- return socket;
21254
- }
21255
- var streamBuilder = (client, opts) => {
21256
- debug("streamBuilder");
21257
- const options = setDefaultOpts(opts);
21258
- options.hostname = options.hostname || options.host || "localhost";
21259
- const url = buildUrl(options, client);
21260
- const socket = createWebSocket(client, url, options);
21261
- const webSocketStream = ws_1.default.createWebSocketStream(socket, options.wsOptions);
21262
- webSocketStream["url"] = url;
21263
- socket.on("close", () => {
21264
- webSocketStream.destroy();
21265
- });
21266
- return webSocketStream;
21267
- };
21268
- var browserStreamBuilder = (client, opts) => {
21269
- debug("browserStreamBuilder");
21270
- let stream;
21271
- const options = setDefaultBrowserOpts(opts);
21272
- const bufferSize = options.browserBufferSize || 1024 * 512;
21273
- const bufferTimeout = opts.browserBufferTimeout || 1e3;
21274
- const coerceToBuffer = !opts.objectMode;
21275
- const socket = createBrowserWebSocket(client, opts);
21276
- const proxy = buildProxy(opts, socketWriteBrowser, socketEndBrowser);
21277
- if (!opts.objectMode) {
21278
- proxy._writev = BufferedDuplex_1.writev.bind(proxy);
21279
- }
21280
- proxy.on("close", () => {
21281
- socket.close();
21282
- });
21283
- const eventListenerSupport = typeof socket.addEventListener !== "undefined";
21284
- if (socket.readyState === socket.OPEN) {
21285
- stream = proxy;
21286
- stream.socket = socket;
21287
- } else {
21288
- stream = new BufferedDuplex_1.BufferedDuplex(opts, proxy, socket);
21289
- if (eventListenerSupport) {
21290
- socket.addEventListener("open", onOpen);
21291
- } else {
21292
- socket.onopen = onOpen;
21293
- }
21294
- }
21295
- if (eventListenerSupport) {
21296
- socket.addEventListener("close", onClose);
21297
- socket.addEventListener("error", onError);
21298
- socket.addEventListener("message", onMessage);
21299
- } else {
21300
- socket.onclose = onClose;
21301
- socket.onerror = onError;
21302
- socket.onmessage = onMessage;
21303
- }
21304
- function buildProxy(pOptions, socketWrite, socketEnd) {
21305
- const _proxy = new readable_stream_1.Transform({
21306
- objectMode: pOptions.objectMode
21307
- });
21308
- _proxy._write = socketWrite;
21309
- _proxy._flush = socketEnd;
21310
- return _proxy;
21311
- }
21312
- function onOpen() {
21313
- debug("WebSocket onOpen");
21314
- if (stream instanceof BufferedDuplex_1.BufferedDuplex) {
21315
- stream.socketReady();
21316
- }
21317
- }
21318
- function onClose(event) {
21319
- debug("WebSocket onClose", event);
21320
- stream.end();
21321
- stream.destroy();
21322
- }
21323
- function onError(err) {
21324
- debug("WebSocket onError", err);
21325
- const error = new Error("WebSocket error");
21326
- error["event"] = err;
21327
- stream.destroy(error);
21328
- }
21329
- function onMessage(event) {
21330
- let { data } = event;
21331
- if (data instanceof ArrayBuffer)
21332
- data = buffer_1.Buffer.from(data);
21333
- else
21334
- data = buffer_1.Buffer.from(data, "utf8");
21335
- proxy.push(data);
21336
- }
21337
- function socketWriteBrowser(chunk, enc, next) {
21338
- if (socket.bufferedAmount > bufferSize) {
21339
- setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next);
21340
- return;
21341
- }
21342
- if (coerceToBuffer && typeof chunk === "string") {
21343
- chunk = buffer_1.Buffer.from(chunk, "utf8");
21344
- }
21345
- try {
21346
- socket.send(chunk);
21347
- } catch (err) {
21348
- return next(err);
21349
- }
21350
- next();
21351
- }
21352
- function socketEndBrowser(done) {
21353
- socket.close();
21354
- done();
21355
- }
21356
- return stream;
21357
- };
21358
- exports5.default = is_browser_1.default ? browserStreamBuilder : streamBuilder;
21359
- }
21360
- });
21361
-
21362
21354
  // build/lib/connect/index.js
21363
21355
  var require_connect = __commonJS({
21364
21356
  "build/lib/connect/index.js"(exports5) {
21365
21357
  "use strict";
21358
+ init_dirname();
21366
21359
  init_buffer2();
21367
21360
  init_process2();
21368
- init_navigator();
21369
21361
  var __importDefault = exports5 && exports5.__importDefault || function(mod) {
21370
21362
  return mod && mod.__esModule ? mod : { "default": mod };
21371
21363
  };
@@ -21379,21 +21371,7 @@ var mqtt = (() => {
21379
21371
  process_exports.nextTick = setImmediate;
21380
21372
  }
21381
21373
  var debug = (0, debug_1.default)("mqttjs");
21382
- var protocols = {};
21383
- if (!is_browser_1.default) {
21384
- protocols.mqtt = require_tcp().default;
21385
- protocols.tcp = require_tcp().default;
21386
- protocols.ssl = require_tls().default;
21387
- protocols.tls = protocols.ssl;
21388
- protocols.mqtts = require_tls().default;
21389
- } else {
21390
- protocols.wx = require_wx().default;
21391
- protocols.wxs = require_wx().default;
21392
- protocols.ali = require_ali().default;
21393
- protocols.alis = require_ali().default;
21394
- }
21395
- protocols.ws = require_ws().default;
21396
- protocols.wss = require_ws().default;
21374
+ var protocols = null;
21397
21375
  function parseAuthOptions(opts) {
21398
21376
  let matches;
21399
21377
  if (opts.auth) {
@@ -21465,6 +21443,25 @@ var mqtt = (() => {
21465
21443
  throw new Error("Missing secure protocol key");
21466
21444
  }
21467
21445
  }
21446
+ if (!protocols) {
21447
+ protocols = {};
21448
+ if (!is_browser_1.default && !opts.forceNativeWebSocket) {
21449
+ protocols.ws = require_ws().streamBuilder;
21450
+ protocols.wss = require_ws().streamBuilder;
21451
+ protocols.mqtt = require_tcp().default;
21452
+ protocols.tcp = require_tcp().default;
21453
+ protocols.ssl = require_tls().default;
21454
+ protocols.tls = protocols.ssl;
21455
+ protocols.mqtts = require_tls().default;
21456
+ } else {
21457
+ protocols.ws = require_ws().browserStreamBuilder;
21458
+ protocols.wss = require_ws().browserStreamBuilder;
21459
+ protocols.wx = require_wx().default;
21460
+ protocols.wxs = require_wx().default;
21461
+ protocols.ali = require_ali().default;
21462
+ protocols.alis = require_ali().default;
21463
+ }
21464
+ }
21468
21465
  if (!protocols[opts.protocol]) {
21469
21466
  const isSecure = ["mqtts", "wss"].indexOf(opts.protocol) !== -1;
21470
21467
  opts.protocol = [
@@ -21550,9 +21547,9 @@ var mqtt = (() => {
21550
21547
  var require_mqtt2 = __commonJS({
21551
21548
  "build/mqtt.js"(exports5) {
21552
21549
  "use strict";
21550
+ init_dirname();
21553
21551
  init_buffer2();
21554
21552
  init_process2();
21555
- init_navigator();
21556
21553
  var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
21557
21554
  if (k22 === void 0)
21558
21555
  k22 = k2;
@@ -21623,9 +21620,9 @@ var mqtt = (() => {
21623
21620
  // build/index.js
21624
21621
  var require_build = __commonJS({
21625
21622
  "build/index.js"(exports5) {
21623
+ init_dirname();
21626
21624
  init_buffer2();
21627
21625
  init_process2();
21628
- init_navigator();
21629
21626
  var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
21630
21627
  if (k22 === void 0)
21631
21628
  k22 = k2;