@pioneer-platform/pioneer-react 0.2.36 → 0.2.38

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/index.js CHANGED
@@ -47231,10 +47231,10 @@
47231
47231
  return fn.apply(thisArg, arguments);
47232
47232
  };
47233
47233
  }
47234
- const { toString: toString$h } = Object.prototype;
47234
+ const { toString: toString$g } = Object.prototype;
47235
47235
  const { getPrototypeOf: getPrototypeOf$3 } = Object;
47236
47236
  const kindOf$1 = ((cache) => (thing) => {
47237
- const str2 = toString$h.call(thing);
47237
+ const str2 = toString$g.call(thing);
47238
47238
  return cache[str2] || (cache[str2] = str2.slice(8, -1).toLowerCase());
47239
47239
  })(/* @__PURE__ */ Object.create(null));
47240
47240
  const kindOfTest$1 = (type2) => {
@@ -50040,10 +50040,10 @@
50040
50040
  };
50041
50041
  };
50042
50042
  var uncurryThis$k = functionUncurryThis;
50043
- var toString$g = uncurryThis$k({}.toString);
50043
+ var toString$f = uncurryThis$k({}.toString);
50044
50044
  var stringSlice$1 = uncurryThis$k("".slice);
50045
50045
  var classofRaw$2 = function(it) {
50046
- return stringSlice$1(toString$g(it), 8, -1);
50046
+ return stringSlice$1(toString$f(it), 8, -1);
50047
50047
  };
50048
50048
  var classofRaw$1 = classofRaw$2;
50049
50049
  var uncurryThis$j = functionUncurryThis;
@@ -50257,9 +50257,9 @@
50257
50257
  var uncurryThis$f = functionUncurryThis;
50258
50258
  var id$2 = 0;
50259
50259
  var postfix = Math.random();
50260
- var toString$f = uncurryThis$f(1 .toString);
50260
+ var toString$e = uncurryThis$f(1 .toString);
50261
50261
  var uid$3 = function(key2) {
50262
- return "Symbol(" + (key2 === void 0 ? "" : key2) + ")_" + toString$f(++id$2 + postfix, 36);
50262
+ return "Symbol(" + (key2 === void 0 ? "" : key2) + ")_" + toString$e(++id$2 + postfix, 36);
50263
50263
  };
50264
50264
  var global$8 = global$e;
50265
50265
  var shared$6 = sharedExports;
@@ -50652,7 +50652,7 @@
50652
50652
  };
50653
50653
  var classof$7 = classof$8;
50654
50654
  var $String$1 = String;
50655
- var toString$e = function(argument) {
50655
+ var toString$d = function(argument) {
50656
50656
  if (classof$7(argument) === "Symbol")
50657
50657
  throw TypeError("Cannot convert a Symbol value to a string");
50658
50658
  return $String$1(argument);
@@ -50844,7 +50844,7 @@
50844
50844
  var defineProperty$9 = objectDefineProperty.f;
50845
50845
  var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
50846
50846
  var hasOwn$a = hasOwnProperty_1;
50847
- var toString$d = objectToString$4;
50847
+ var toString$c = objectToString$4;
50848
50848
  var wellKnownSymbol$9 = wellKnownSymbol$f;
50849
50849
  var TO_STRING_TAG$1 = wellKnownSymbol$9("toStringTag");
50850
50850
  var setToStringTag$5 = function(it, TAG2, STATIC, SET_METHOD) {
@@ -50854,7 +50854,7 @@
50854
50854
  defineProperty$9(target, TO_STRING_TAG$1, { configurable: true, value: TAG2 });
50855
50855
  }
50856
50856
  if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
50857
- createNonEnumerableProperty$2(target, "toString", toString$d);
50857
+ createNonEnumerableProperty$2(target, "toString", toString$c);
50858
50858
  }
50859
50859
  }
50860
50860
  };
@@ -51103,7 +51103,7 @@
51103
51103
  var anObject$1 = anObject$5;
51104
51104
  var toIndexedObject$3 = toIndexedObject$9;
51105
51105
  var toPropertyKey$1 = toPropertyKey$5;
51106
- var $toString = toString$e;
51106
+ var $toString = toString$d;
51107
51107
  var createPropertyDescriptor$1 = createPropertyDescriptor$5;
51108
51108
  var nativeObjectCreate = objectCreate;
51109
51109
  var objectKeys$4 = objectKeys$6;
@@ -51326,14 +51326,14 @@
51326
51326
  var $$h = _export;
51327
51327
  var getBuiltIn$5 = getBuiltIn$a;
51328
51328
  var hasOwn$7 = hasOwnProperty_1;
51329
- var toString$c = toString$e;
51329
+ var toString$b = toString$d;
51330
51330
  var shared$2 = sharedExports;
51331
51331
  var NATIVE_SYMBOL_REGISTRY$1 = symbolRegistryDetection;
51332
51332
  var StringToSymbolRegistry = shared$2("string-to-symbol-registry");
51333
51333
  var SymbolToStringRegistry$1 = shared$2("symbol-to-string-registry");
51334
51334
  $$h({ target: "Symbol", stat: true, forced: !NATIVE_SYMBOL_REGISTRY$1 }, {
51335
51335
  "for": function(key2) {
51336
- var string2 = toString$c(key2);
51336
+ var string2 = toString$b(key2);
51337
51337
  if (hasOwn$7(StringToSymbolRegistry, string2))
51338
51338
  return StringToSymbolRegistry[string2];
51339
51339
  var symbol2 = getBuiltIn$5("Symbol")(string2);
@@ -51363,7 +51363,7 @@
51363
51363
  var isArray$l = isArray$n;
51364
51364
  var isCallable$3 = isCallable$f;
51365
51365
  var classof$2 = classofRaw$2;
51366
- var toString$b = toString$e;
51366
+ var toString$a = toString$d;
51367
51367
  var push$8 = uncurryThis$6([].push);
51368
51368
  var getJsonReplacerFunction = function(replacer) {
51369
51369
  if (isCallable$3(replacer))
@@ -51377,7 +51377,7 @@
51377
51377
  if (typeof element == "string")
51378
51378
  push$8(keys2, element);
51379
51379
  else if (typeof element == "number" || classof$2(element) == "Number" || classof$2(element) == "String")
51380
- push$8(keys2, toString$b(element));
51380
+ push$8(keys2, toString$a(element));
51381
51381
  }
51382
51382
  var keysLength = keys2.length;
51383
51383
  var root2 = true;
@@ -52208,14 +52208,14 @@
52208
52208
  const _Symbol$1 = /* @__PURE__ */ getDefaultExportFromCjs(symbol);
52209
52209
  var uncurryThis$1 = functionUncurryThis;
52210
52210
  var toIntegerOrInfinity = toIntegerOrInfinity$3;
52211
- var toString$a = toString$e;
52211
+ var toString$9 = toString$d;
52212
52212
  var requireObjectCoercible = requireObjectCoercible$3;
52213
52213
  var charAt$1 = uncurryThis$1("".charAt);
52214
52214
  var charCodeAt = uncurryThis$1("".charCodeAt);
52215
52215
  var stringSlice = uncurryThis$1("".slice);
52216
52216
  var createMethod = function(CONVERT_TO_STRING) {
52217
52217
  return function($this, pos) {
52218
- var S = toString$a(requireObjectCoercible($this));
52218
+ var S = toString$9(requireObjectCoercible($this));
52219
52219
  var position2 = toIntegerOrInfinity(pos);
52220
52220
  var size2 = S.length;
52221
52221
  var first2, second;
@@ -52234,7 +52234,7 @@
52234
52234
  charAt: createMethod(true)
52235
52235
  };
52236
52236
  var charAt = stringMultibyte.charAt;
52237
- var toString$9 = toString$e;
52237
+ var toString$8 = toString$d;
52238
52238
  var InternalStateModule = internalState;
52239
52239
  var defineIterator = iteratorDefine;
52240
52240
  var createIterResultObject = createIterResultObject$2;
@@ -52244,7 +52244,7 @@
52244
52244
  defineIterator(String, "String", function(iterated) {
52245
52245
  setInternalState(this, {
52246
52246
  type: STRING_ITERATOR,
52247
- string: toString$9(iterated),
52247
+ string: toString$8(iterated),
52248
52248
  index: 0
52249
52249
  });
52250
52250
  }, function next() {
@@ -56488,14 +56488,14 @@
56488
56488
  }
56489
56489
  return result;
56490
56490
  }
56491
- function isBinary$2(obj) {
56491
+ function isBinary$1(obj) {
56492
56492
  return Object.prototype.toString.call(obj) === "[object Uint8Array]";
56493
56493
  }
56494
56494
  var binary$1 = new type$5("tag:yaml.org,2002:binary", {
56495
56495
  kind: "scalar",
56496
56496
  resolve: resolveYamlBinary,
56497
56497
  construct: constructYamlBinary,
56498
- predicate: isBinary$2,
56498
+ predicate: isBinary$1,
56499
56499
  represent: representYamlBinary
56500
56500
  });
56501
56501
  var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
@@ -61864,16 +61864,16 @@
61864
61864
  }
61865
61865
  var _baseToString = baseToString$1;
61866
61866
  var baseToString = _baseToString;
61867
- function toString$8(value2) {
61867
+ function toString$7(value2) {
61868
61868
  return value2 == null ? "" : baseToString(value2);
61869
61869
  }
61870
- var toString_1 = toString$8;
61871
- var isArray$8 = isArray_1, isKey = _isKey, stringToPath = _stringToPath, toString$7 = toString_1;
61870
+ var toString_1 = toString$7;
61871
+ var isArray$8 = isArray_1, isKey = _isKey, stringToPath = _stringToPath, toString$6 = toString_1;
61872
61872
  function castPath$1(value2, object2) {
61873
61873
  if (isArray$8(value2)) {
61874
61874
  return value2;
61875
61875
  }
61876
- return isKey(value2, object2) ? [value2] : stringToPath(toString$7(value2));
61876
+ return isKey(value2, object2) ? [value2] : stringToPath(toString$6(value2));
61877
61877
  }
61878
61878
  var _castPath = castPath$1;
61879
61879
  var isSymbol = isSymbol_1;
@@ -62230,10 +62230,10 @@
62230
62230
  }
62231
62231
  }
62232
62232
  const _objectIs$1 = typeof Object.is === "function" ? Object.is : _objectIs;
62233
- var toString$6 = Object.prototype.toString;
62233
+ var toString$5 = Object.prototype.toString;
62234
62234
  var _isArguments = /* @__PURE__ */ function() {
62235
- return toString$6.call(arguments) === "[object Arguments]" ? function _isArguments2(x2) {
62236
- return toString$6.call(x2) === "[object Arguments]";
62235
+ return toString$5.call(arguments) === "[object Arguments]" ? function _isArguments2(x2) {
62236
+ return toString$5.call(x2) === "[object Arguments]";
62237
62237
  } : function _isArguments2(x2) {
62238
62238
  return _has("callee", x2);
62239
62239
  };
@@ -62573,10 +62573,10 @@
62573
62573
  return "{" + mapPairs(x2, keys$6(x2)).join(", ") + "}";
62574
62574
  }
62575
62575
  }
62576
- var toString$4 = /* @__PURE__ */ _curry1(function toString2(val) {
62576
+ var toString$3 = /* @__PURE__ */ _curry1(function toString2(val) {
62577
62577
  return _toString(val, []);
62578
62578
  });
62579
- const toString$5 = toString$4;
62579
+ const toString$4 = toString$3;
62580
62580
  var max$1 = /* @__PURE__ */ _curry2(function max2(a2, b) {
62581
62581
  if (a2 === b) {
62582
62582
  return b;
@@ -62595,8 +62595,8 @@
62595
62595
  if (maxByType !== void 0) {
62596
62596
  return maxByType === typeof a2 ? a2 : b;
62597
62597
  }
62598
- var stringA = toString$5(a2);
62599
- var maxByStringValue = safeMax(stringA, toString$5(b));
62598
+ var stringA = toString$4(a2);
62599
+ var maxByStringValue = safeMax(stringA, toString$4(b));
62600
62600
  if (maxByStringValue !== void 0) {
62601
62601
  return maxByStringValue === stringA ? a2 : b;
62602
62602
  }
@@ -63449,7 +63449,7 @@
63449
63449
  if (target != null && _isFunction(target[method2])) {
63450
63450
  return target[method2].apply(target, Array.prototype.slice.call(arguments, 0, arity));
63451
63451
  }
63452
- throw new TypeError(toString$5(target) + ' does not have a method named "' + method2 + '"');
63452
+ throw new TypeError(toString$4(target) + ' does not have a method named "' + method2 + '"');
63453
63453
  });
63454
63454
  });
63455
63455
  const invoker$1 = invoker;
@@ -63614,7 +63614,7 @@
63614
63614
  }
63615
63615
  var test = /* @__PURE__ */ _curry2(function test2(pattern2, str2) {
63616
63616
  if (!_isRegExp(pattern2)) {
63617
- throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received " + toString$5(pattern2));
63617
+ throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received " + toString$4(pattern2));
63618
63618
  }
63619
63619
  return _cloneRegExp(pattern2).test(str2);
63620
63620
  });
@@ -63716,7 +63716,7 @@
63716
63716
  var isObjLike = curryN$1(1, both$1(isNotNull$1, isOfTypeObject$1));
63717
63717
  const isObjLike$1 = isObjLike;
63718
63718
  var isObject$8 = pipe(type$4, identical$1("Object"));
63719
- var isObjectConstructor = pipe(toString$5, equals$1(toString$5(Object)));
63719
+ var isObjectConstructor = pipe(toString$4, equals$1(toString$4(Object)));
63720
63720
  var hasObjectConstructor = pathSatisfies$1(both$1(isFunction$3, isObjectConstructor), ["constructor"]);
63721
63721
  var isPlainObj = curryN$1(1, function(val) {
63722
63722
  if (!isObjLike$1(val) || !isObject$8(val)) {
@@ -86149,19 +86149,19 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
86149
86149
  Object.defineProperty(encodePacket_browser, "__esModule", { value: true });
86150
86150
  encodePacket_browser.encodePacket = encodePacket_browser.encodePacketToBinary = void 0;
86151
86151
  const commons_js_1$1 = commons;
86152
- const withNativeBlob$1 = typeof Blob === "function" || typeof Blob !== "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]";
86153
- const withNativeArrayBuffer$2 = typeof ArrayBuffer === "function";
86154
- const isView$2 = (obj) => {
86152
+ const withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]";
86153
+ const withNativeArrayBuffer$1 = typeof ArrayBuffer === "function";
86154
+ const isView$1 = (obj) => {
86155
86155
  return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj && obj.buffer instanceof ArrayBuffer;
86156
86156
  };
86157
86157
  const encodePacket = ({ type: type2, data: data2 }, supportsBinary, callback) => {
86158
- if (withNativeBlob$1 && data2 instanceof Blob) {
86158
+ if (withNativeBlob && data2 instanceof Blob) {
86159
86159
  if (supportsBinary) {
86160
86160
  return callback(data2);
86161
86161
  } else {
86162
86162
  return encodeBlobAsBase64(data2, callback);
86163
86163
  }
86164
- } else if (withNativeArrayBuffer$2 && (data2 instanceof ArrayBuffer || isView$2(data2))) {
86164
+ } else if (withNativeArrayBuffer$1 && (data2 instanceof ArrayBuffer || isView$1(data2))) {
86165
86165
  if (supportsBinary) {
86166
86166
  return callback(data2);
86167
86167
  } else {
@@ -86190,9 +86190,9 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
86190
86190
  }
86191
86191
  let TEXT_ENCODER;
86192
86192
  function encodePacketToBinary(packet, callback) {
86193
- if (withNativeBlob$1 && packet.data instanceof Blob) {
86193
+ if (withNativeBlob && packet.data instanceof Blob) {
86194
86194
  return packet.data.arrayBuffer().then(toArray$1).then(callback);
86195
- } else if (withNativeArrayBuffer$2 && (packet.data instanceof ArrayBuffer || isView$2(packet.data))) {
86195
+ } else if (withNativeArrayBuffer$1 && (packet.data instanceof ArrayBuffer || isView$1(packet.data))) {
86196
86196
  return callback(toArray$1(packet.data));
86197
86197
  }
86198
86198
  encodePacket(packet, false, (encoded) => {
@@ -86253,7 +86253,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
86253
86253
  decodePacket_browser.decodePacket = void 0;
86254
86254
  const commons_js_1 = commons;
86255
86255
  const base64_arraybuffer_js_1 = base64Arraybuffer;
86256
- const withNativeArrayBuffer$1 = typeof ArrayBuffer === "function";
86256
+ const withNativeArrayBuffer = typeof ArrayBuffer === "function";
86257
86257
  const decodePacket = (encodedPacket, binaryType) => {
86258
86258
  if (typeof encodedPacket !== "string") {
86259
86259
  return {
@@ -86281,7 +86281,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
86281
86281
  };
86282
86282
  decodePacket_browser.decodePacket = decodePacket;
86283
86283
  const decodeBase64Packet = (data2, binaryType) => {
86284
- if (withNativeArrayBuffer$1) {
86284
+ if (withNativeArrayBuffer) {
86285
86285
  const decoded = (0, base64_arraybuffer_js_1.decode)(data2);
86286
86286
  return mapBinary(decoded, binaryType);
86287
86287
  } else {
@@ -88573,379 +88573,400 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
88573
88573
  var socket = {};
88574
88574
  var cjs = {};
88575
88575
  var binary = {};
88576
- var isBinary$1 = {};
88577
- Object.defineProperty(isBinary$1, "__esModule", { value: true });
88578
- isBinary$1.hasBinary = isBinary$1.isBinary = void 0;
88579
- const withNativeArrayBuffer = typeof ArrayBuffer === "function";
88580
- const isView$1 = (obj) => {
88581
- return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffer instanceof ArrayBuffer;
88582
- };
88583
- const toString$3 = Object.prototype.toString;
88584
- const withNativeBlob = typeof Blob === "function" || typeof Blob !== "undefined" && toString$3.call(Blob) === "[object BlobConstructor]";
88585
- const withNativeFile = typeof File === "function" || typeof File !== "undefined" && toString$3.call(File) === "[object FileConstructor]";
88586
- function isBinary(obj) {
88587
- return withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView$1(obj)) || withNativeBlob && obj instanceof Blob || withNativeFile && obj instanceof File;
88588
- }
88589
- isBinary$1.isBinary = isBinary;
88590
- function hasBinary(obj, toJSON) {
88591
- if (!obj || typeof obj !== "object") {
88592
- return false;
88593
- }
88594
- if (Array.isArray(obj)) {
88595
- for (let i2 = 0, l2 = obj.length; i2 < l2; i2++) {
88596
- if (hasBinary(obj[i2])) {
88597
- return true;
88576
+ var isBinary = {};
88577
+ var hasRequiredIsBinary;
88578
+ function requireIsBinary() {
88579
+ if (hasRequiredIsBinary)
88580
+ return isBinary;
88581
+ hasRequiredIsBinary = 1;
88582
+ Object.defineProperty(isBinary, "__esModule", { value: true });
88583
+ isBinary.hasBinary = isBinary.isBinary = void 0;
88584
+ const withNativeArrayBuffer2 = typeof ArrayBuffer === "function";
88585
+ const isView2 = (obj) => {
88586
+ return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffer instanceof ArrayBuffer;
88587
+ };
88588
+ const toString2 = Object.prototype.toString;
88589
+ const withNativeBlob2 = typeof Blob === "function" || typeof Blob !== "undefined" && toString2.call(Blob) === "[object BlobConstructor]";
88590
+ const withNativeFile = typeof File === "function" || typeof File !== "undefined" && toString2.call(File) === "[object FileConstructor]";
88591
+ function isBinary$12(obj) {
88592
+ return withNativeArrayBuffer2 && (obj instanceof ArrayBuffer || isView2(obj)) || withNativeBlob2 && obj instanceof Blob || withNativeFile && obj instanceof File;
88593
+ }
88594
+ isBinary.isBinary = isBinary$12;
88595
+ function hasBinary(obj, toJSON) {
88596
+ if (!obj || typeof obj !== "object") {
88597
+ return false;
88598
+ }
88599
+ if (Array.isArray(obj)) {
88600
+ for (let i2 = 0, l2 = obj.length; i2 < l2; i2++) {
88601
+ if (hasBinary(obj[i2])) {
88602
+ return true;
88603
+ }
88598
88604
  }
88605
+ return false;
88599
88606
  }
88600
- return false;
88601
- }
88602
- if (isBinary(obj)) {
88603
- return true;
88604
- }
88605
- if (obj.toJSON && typeof obj.toJSON === "function" && arguments.length === 1) {
88606
- return hasBinary(obj.toJSON(), true);
88607
- }
88608
- for (const key2 in obj) {
88609
- if (Object.prototype.hasOwnProperty.call(obj, key2) && hasBinary(obj[key2])) {
88607
+ if (isBinary$12(obj)) {
88610
88608
  return true;
88611
88609
  }
88612
- }
88613
- return false;
88614
- }
88615
- isBinary$1.hasBinary = hasBinary;
88616
- Object.defineProperty(binary, "__esModule", { value: true });
88617
- binary.reconstructPacket = binary.deconstructPacket = void 0;
88618
- const is_binary_js_1 = isBinary$1;
88619
- function deconstructPacket(packet) {
88620
- const buffers = [];
88621
- const packetData = packet.data;
88622
- const pack2 = packet;
88623
- pack2.data = _deconstructPacket(packetData, buffers);
88624
- pack2.attachments = buffers.length;
88625
- return { packet: pack2, buffers };
88626
- }
88627
- binary.deconstructPacket = deconstructPacket;
88628
- function _deconstructPacket(data2, buffers) {
88629
- if (!data2)
88630
- return data2;
88631
- if ((0, is_binary_js_1.isBinary)(data2)) {
88632
- const placeholder = { _placeholder: true, num: buffers.length };
88633
- buffers.push(data2);
88634
- return placeholder;
88635
- } else if (Array.isArray(data2)) {
88636
- const newData = new Array(data2.length);
88637
- for (let i2 = 0; i2 < data2.length; i2++) {
88638
- newData[i2] = _deconstructPacket(data2[i2], buffers);
88610
+ if (obj.toJSON && typeof obj.toJSON === "function" && arguments.length === 1) {
88611
+ return hasBinary(obj.toJSON(), true);
88639
88612
  }
88640
- return newData;
88641
- } else if (typeof data2 === "object" && !(data2 instanceof Date)) {
88642
- const newData = {};
88643
- for (const key2 in data2) {
88644
- if (Object.prototype.hasOwnProperty.call(data2, key2)) {
88645
- newData[key2] = _deconstructPacket(data2[key2], buffers);
88613
+ for (const key2 in obj) {
88614
+ if (Object.prototype.hasOwnProperty.call(obj, key2) && hasBinary(obj[key2])) {
88615
+ return true;
88646
88616
  }
88647
88617
  }
88648
- return newData;
88618
+ return false;
88649
88619
  }
88650
- return data2;
88651
- }
88652
- function reconstructPacket(packet, buffers) {
88653
- packet.data = _reconstructPacket(packet.data, buffers);
88654
- delete packet.attachments;
88655
- return packet;
88656
- }
88657
- binary.reconstructPacket = reconstructPacket;
88658
- function _reconstructPacket(data2, buffers) {
88659
- if (!data2)
88660
- return data2;
88661
- if (data2 && data2._placeholder === true) {
88662
- const isIndexValid = typeof data2.num === "number" && data2.num >= 0 && data2.num < buffers.length;
88663
- if (isIndexValid) {
88664
- return buffers[data2.num];
88665
- } else {
88666
- throw new Error("illegal attachments");
88667
- }
88668
- } else if (Array.isArray(data2)) {
88669
- for (let i2 = 0; i2 < data2.length; i2++) {
88670
- data2[i2] = _reconstructPacket(data2[i2], buffers);
88671
- }
88672
- } else if (typeof data2 === "object") {
88673
- for (const key2 in data2) {
88674
- if (Object.prototype.hasOwnProperty.call(data2, key2)) {
88675
- data2[key2] = _reconstructPacket(data2[key2], buffers);
88620
+ isBinary.hasBinary = hasBinary;
88621
+ return isBinary;
88622
+ }
88623
+ var hasRequiredBinary;
88624
+ function requireBinary() {
88625
+ if (hasRequiredBinary)
88626
+ return binary;
88627
+ hasRequiredBinary = 1;
88628
+ Object.defineProperty(binary, "__esModule", { value: true });
88629
+ binary.reconstructPacket = binary.deconstructPacket = void 0;
88630
+ const is_binary_js_1 = requireIsBinary();
88631
+ function deconstructPacket(packet) {
88632
+ const buffers = [];
88633
+ const packetData = packet.data;
88634
+ const pack2 = packet;
88635
+ pack2.data = _deconstructPacket(packetData, buffers);
88636
+ pack2.attachments = buffers.length;
88637
+ return { packet: pack2, buffers };
88638
+ }
88639
+ binary.deconstructPacket = deconstructPacket;
88640
+ function _deconstructPacket(data2, buffers) {
88641
+ if (!data2)
88642
+ return data2;
88643
+ if ((0, is_binary_js_1.isBinary)(data2)) {
88644
+ const placeholder = { _placeholder: true, num: buffers.length };
88645
+ buffers.push(data2);
88646
+ return placeholder;
88647
+ } else if (Array.isArray(data2)) {
88648
+ const newData = new Array(data2.length);
88649
+ for (let i2 = 0; i2 < data2.length; i2++) {
88650
+ newData[i2] = _deconstructPacket(data2[i2], buffers);
88651
+ }
88652
+ return newData;
88653
+ } else if (typeof data2 === "object" && !(data2 instanceof Date)) {
88654
+ const newData = {};
88655
+ for (const key2 in data2) {
88656
+ if (Object.prototype.hasOwnProperty.call(data2, key2)) {
88657
+ newData[key2] = _deconstructPacket(data2[key2], buffers);
88658
+ }
88676
88659
  }
88660
+ return newData;
88677
88661
  }
88662
+ return data2;
88678
88663
  }
88679
- return data2;
88680
- }
88681
- (function(exports2) {
88682
- Object.defineProperty(exports2, "__esModule", { value: true });
88683
- exports2.Decoder = exports2.Encoder = exports2.PacketType = exports2.protocol = void 0;
88684
- const component_emitter_12 = require$$5$1;
88685
- const binary_js_1 = binary;
88686
- const is_binary_js_12 = isBinary$1;
88687
- const debug_12 = browserExports$2;
88688
- const debug2 = (0, debug_12.default)("socket.io-parser");
88689
- const RESERVED_EVENTS2 = [
88690
- "connect",
88691
- "connect_error",
88692
- "disconnect",
88693
- "disconnecting",
88694
- "newListener",
88695
- "removeListener"
88696
- // used by the Node.js EventEmitter
88697
- ];
88698
- exports2.protocol = 5;
88699
- var PacketType;
88700
- (function(PacketType2) {
88701
- PacketType2[PacketType2["CONNECT"] = 0] = "CONNECT";
88702
- PacketType2[PacketType2["DISCONNECT"] = 1] = "DISCONNECT";
88703
- PacketType2[PacketType2["EVENT"] = 2] = "EVENT";
88704
- PacketType2[PacketType2["ACK"] = 3] = "ACK";
88705
- PacketType2[PacketType2["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
88706
- PacketType2[PacketType2["BINARY_EVENT"] = 5] = "BINARY_EVENT";
88707
- PacketType2[PacketType2["BINARY_ACK"] = 6] = "BINARY_ACK";
88708
- })(PacketType = exports2.PacketType || (exports2.PacketType = {}));
88709
- class Encoder {
88710
- /**
88711
- * Encoder constructor
88712
- *
88713
- * @param {function} replacer - custom replacer to pass down to JSON.parse
88714
- */
88715
- constructor(replacer) {
88716
- this.replacer = replacer;
88717
- }
88718
- /**
88719
- * Encode a packet as a single string if non-binary, or as a
88720
- * buffer sequence, depending on packet type.
88721
- *
88722
- * @param {Object} obj - packet object
88723
- */
88724
- encode(obj) {
88725
- debug2("encoding packet %j", obj);
88726
- if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
88727
- if ((0, is_binary_js_12.hasBinary)(obj)) {
88728
- return this.encodeAsBinary({
88729
- type: obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK,
88730
- nsp: obj.nsp,
88731
- data: obj.data,
88732
- id: obj.id
88733
- });
88664
+ function reconstructPacket(packet, buffers) {
88665
+ packet.data = _reconstructPacket(packet.data, buffers);
88666
+ delete packet.attachments;
88667
+ return packet;
88668
+ }
88669
+ binary.reconstructPacket = reconstructPacket;
88670
+ function _reconstructPacket(data2, buffers) {
88671
+ if (!data2)
88672
+ return data2;
88673
+ if (data2 && data2._placeholder === true) {
88674
+ const isIndexValid = typeof data2.num === "number" && data2.num >= 0 && data2.num < buffers.length;
88675
+ if (isIndexValid) {
88676
+ return buffers[data2.num];
88677
+ } else {
88678
+ throw new Error("illegal attachments");
88679
+ }
88680
+ } else if (Array.isArray(data2)) {
88681
+ for (let i2 = 0; i2 < data2.length; i2++) {
88682
+ data2[i2] = _reconstructPacket(data2[i2], buffers);
88683
+ }
88684
+ } else if (typeof data2 === "object") {
88685
+ for (const key2 in data2) {
88686
+ if (Object.prototype.hasOwnProperty.call(data2, key2)) {
88687
+ data2[key2] = _reconstructPacket(data2[key2], buffers);
88734
88688
  }
88735
88689
  }
88736
- return [this.encodeAsString(obj)];
88737
88690
  }
88738
- /**
88739
- * Encode packet as string.
88740
- */
88741
- encodeAsString(obj) {
88742
- let str2 = "" + obj.type;
88743
- if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) {
88744
- str2 += obj.attachments + "-";
88691
+ return data2;
88692
+ }
88693
+ return binary;
88694
+ }
88695
+ var hasRequiredCjs;
88696
+ function requireCjs() {
88697
+ if (hasRequiredCjs)
88698
+ return cjs;
88699
+ hasRequiredCjs = 1;
88700
+ (function(exports2) {
88701
+ Object.defineProperty(exports2, "__esModule", { value: true });
88702
+ exports2.Decoder = exports2.Encoder = exports2.PacketType = exports2.protocol = void 0;
88703
+ const component_emitter_12 = require$$5$1;
88704
+ const binary_js_1 = requireBinary();
88705
+ const is_binary_js_1 = requireIsBinary();
88706
+ const debug_12 = browserExports$2;
88707
+ const debug2 = (0, debug_12.default)("socket.io-parser");
88708
+ const RESERVED_EVENTS2 = [
88709
+ "connect",
88710
+ "connect_error",
88711
+ "disconnect",
88712
+ "disconnecting",
88713
+ "newListener",
88714
+ "removeListener"
88715
+ // used by the Node.js EventEmitter
88716
+ ];
88717
+ exports2.protocol = 5;
88718
+ var PacketType;
88719
+ (function(PacketType2) {
88720
+ PacketType2[PacketType2["CONNECT"] = 0] = "CONNECT";
88721
+ PacketType2[PacketType2["DISCONNECT"] = 1] = "DISCONNECT";
88722
+ PacketType2[PacketType2["EVENT"] = 2] = "EVENT";
88723
+ PacketType2[PacketType2["ACK"] = 3] = "ACK";
88724
+ PacketType2[PacketType2["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
88725
+ PacketType2[PacketType2["BINARY_EVENT"] = 5] = "BINARY_EVENT";
88726
+ PacketType2[PacketType2["BINARY_ACK"] = 6] = "BINARY_ACK";
88727
+ })(PacketType = exports2.PacketType || (exports2.PacketType = {}));
88728
+ class Encoder {
88729
+ /**
88730
+ * Encoder constructor
88731
+ *
88732
+ * @param {function} replacer - custom replacer to pass down to JSON.parse
88733
+ */
88734
+ constructor(replacer) {
88735
+ this.replacer = replacer;
88745
88736
  }
88746
- if (obj.nsp && "/" !== obj.nsp) {
88747
- str2 += obj.nsp + ",";
88737
+ /**
88738
+ * Encode a packet as a single string if non-binary, or as a
88739
+ * buffer sequence, depending on packet type.
88740
+ *
88741
+ * @param {Object} obj - packet object
88742
+ */
88743
+ encode(obj) {
88744
+ debug2("encoding packet %j", obj);
88745
+ if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
88746
+ if ((0, is_binary_js_1.hasBinary)(obj)) {
88747
+ return this.encodeAsBinary({
88748
+ type: obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK,
88749
+ nsp: obj.nsp,
88750
+ data: obj.data,
88751
+ id: obj.id
88752
+ });
88753
+ }
88754
+ }
88755
+ return [this.encodeAsString(obj)];
88748
88756
  }
88749
- if (null != obj.id) {
88750
- str2 += obj.id;
88757
+ /**
88758
+ * Encode packet as string.
88759
+ */
88760
+ encodeAsString(obj) {
88761
+ let str2 = "" + obj.type;
88762
+ if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) {
88763
+ str2 += obj.attachments + "-";
88764
+ }
88765
+ if (obj.nsp && "/" !== obj.nsp) {
88766
+ str2 += obj.nsp + ",";
88767
+ }
88768
+ if (null != obj.id) {
88769
+ str2 += obj.id;
88770
+ }
88771
+ if (null != obj.data) {
88772
+ str2 += JSON.stringify(obj.data, this.replacer);
88773
+ }
88774
+ debug2("encoded %j as %s", obj, str2);
88775
+ return str2;
88751
88776
  }
88752
- if (null != obj.data) {
88753
- str2 += JSON.stringify(obj.data, this.replacer);
88777
+ /**
88778
+ * Encode packet as 'buffer sequence' by removing blobs, and
88779
+ * deconstructing packet into object with placeholders and
88780
+ * a list of buffers.
88781
+ */
88782
+ encodeAsBinary(obj) {
88783
+ const deconstruction = (0, binary_js_1.deconstructPacket)(obj);
88784
+ const pack2 = this.encodeAsString(deconstruction.packet);
88785
+ const buffers = deconstruction.buffers;
88786
+ buffers.unshift(pack2);
88787
+ return buffers;
88754
88788
  }
88755
- debug2("encoded %j as %s", obj, str2);
88756
- return str2;
88757
88789
  }
88758
- /**
88759
- * Encode packet as 'buffer sequence' by removing blobs, and
88760
- * deconstructing packet into object with placeholders and
88761
- * a list of buffers.
88762
- */
88763
- encodeAsBinary(obj) {
88764
- const deconstruction = (0, binary_js_1.deconstructPacket)(obj);
88765
- const pack2 = this.encodeAsString(deconstruction.packet);
88766
- const buffers = deconstruction.buffers;
88767
- buffers.unshift(pack2);
88768
- return buffers;
88769
- }
88770
- }
88771
- exports2.Encoder = Encoder;
88772
- function isObject2(value2) {
88773
- return Object.prototype.toString.call(value2) === "[object Object]";
88774
- }
88775
- class Decoder extends component_emitter_12.Emitter {
88776
- /**
88777
- * Decoder constructor
88778
- *
88779
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
88780
- */
88781
- constructor(reviver) {
88782
- super();
88783
- this.reviver = reviver;
88790
+ exports2.Encoder = Encoder;
88791
+ function isObject2(value2) {
88792
+ return Object.prototype.toString.call(value2) === "[object Object]";
88784
88793
  }
88785
- /**
88786
- * Decodes an encoded packet string into packet JSON.
88787
- *
88788
- * @param {String} obj - encoded packet
88789
- */
88790
- add(obj) {
88791
- let packet;
88792
- if (typeof obj === "string") {
88793
- if (this.reconstructor) {
88794
- throw new Error("got plaintext data when reconstructing a packet");
88795
- }
88796
- packet = this.decodeString(obj);
88797
- const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
88798
- if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
88799
- packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
88800
- this.reconstructor = new BinaryReconstructor(packet);
88801
- if (packet.attachments === 0) {
88794
+ class Decoder extends component_emitter_12.Emitter {
88795
+ /**
88796
+ * Decoder constructor
88797
+ *
88798
+ * @param {function} reviver - custom reviver to pass down to JSON.stringify
88799
+ */
88800
+ constructor(reviver) {
88801
+ super();
88802
+ this.reviver = reviver;
88803
+ }
88804
+ /**
88805
+ * Decodes an encoded packet string into packet JSON.
88806
+ *
88807
+ * @param {String} obj - encoded packet
88808
+ */
88809
+ add(obj) {
88810
+ let packet;
88811
+ if (typeof obj === "string") {
88812
+ if (this.reconstructor) {
88813
+ throw new Error("got plaintext data when reconstructing a packet");
88814
+ }
88815
+ packet = this.decodeString(obj);
88816
+ const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
88817
+ if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
88818
+ packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
88819
+ this.reconstructor = new BinaryReconstructor(packet);
88820
+ if (packet.attachments === 0) {
88821
+ super.emitReserved("decoded", packet);
88822
+ }
88823
+ } else {
88802
88824
  super.emitReserved("decoded", packet);
88803
88825
  }
88804
- } else {
88805
- super.emitReserved("decoded", packet);
88806
- }
88807
- } else if ((0, is_binary_js_12.isBinary)(obj) || obj.base64) {
88808
- if (!this.reconstructor) {
88809
- throw new Error("got binary data when not reconstructing a packet");
88810
- } else {
88811
- packet = this.reconstructor.takeBinaryData(obj);
88812
- if (packet) {
88813
- this.reconstructor = null;
88814
- super.emitReserved("decoded", packet);
88826
+ } else if ((0, is_binary_js_1.isBinary)(obj) || obj.base64) {
88827
+ if (!this.reconstructor) {
88828
+ throw new Error("got binary data when not reconstructing a packet");
88829
+ } else {
88830
+ packet = this.reconstructor.takeBinaryData(obj);
88831
+ if (packet) {
88832
+ this.reconstructor = null;
88833
+ super.emitReserved("decoded", packet);
88834
+ }
88815
88835
  }
88836
+ } else {
88837
+ throw new Error("Unknown type: " + obj);
88816
88838
  }
88817
- } else {
88818
- throw new Error("Unknown type: " + obj);
88819
88839
  }
88820
- }
88821
- /**
88822
- * Decode a packet String (JSON data)
88823
- *
88824
- * @param {String} str
88825
- * @return {Object} packet
88826
- */
88827
- decodeString(str2) {
88828
- let i2 = 0;
88829
- const p2 = {
88830
- type: Number(str2.charAt(0))
88831
- };
88832
- if (PacketType[p2.type] === void 0) {
88833
- throw new Error("unknown packet type " + p2.type);
88834
- }
88835
- if (p2.type === PacketType.BINARY_EVENT || p2.type === PacketType.BINARY_ACK) {
88836
- const start = i2 + 1;
88837
- while (str2.charAt(++i2) !== "-" && i2 != str2.length) {
88840
+ /**
88841
+ * Decode a packet String (JSON data)
88842
+ *
88843
+ * @param {String} str
88844
+ * @return {Object} packet
88845
+ */
88846
+ decodeString(str2) {
88847
+ let i2 = 0;
88848
+ const p2 = {
88849
+ type: Number(str2.charAt(0))
88850
+ };
88851
+ if (PacketType[p2.type] === void 0) {
88852
+ throw new Error("unknown packet type " + p2.type);
88838
88853
  }
88839
- const buf = str2.substring(start, i2);
88840
- if (buf != Number(buf) || str2.charAt(i2) !== "-") {
88841
- throw new Error("Illegal attachments");
88854
+ if (p2.type === PacketType.BINARY_EVENT || p2.type === PacketType.BINARY_ACK) {
88855
+ const start = i2 + 1;
88856
+ while (str2.charAt(++i2) !== "-" && i2 != str2.length) {
88857
+ }
88858
+ const buf = str2.substring(start, i2);
88859
+ if (buf != Number(buf) || str2.charAt(i2) !== "-") {
88860
+ throw new Error("Illegal attachments");
88861
+ }
88862
+ p2.attachments = Number(buf);
88842
88863
  }
88843
- p2.attachments = Number(buf);
88844
- }
88845
- if ("/" === str2.charAt(i2 + 1)) {
88846
- const start = i2 + 1;
88847
- while (++i2) {
88848
- const c2 = str2.charAt(i2);
88849
- if ("," === c2)
88850
- break;
88851
- if (i2 === str2.length)
88852
- break;
88864
+ if ("/" === str2.charAt(i2 + 1)) {
88865
+ const start = i2 + 1;
88866
+ while (++i2) {
88867
+ const c2 = str2.charAt(i2);
88868
+ if ("," === c2)
88869
+ break;
88870
+ if (i2 === str2.length)
88871
+ break;
88872
+ }
88873
+ p2.nsp = str2.substring(start, i2);
88874
+ } else {
88875
+ p2.nsp = "/";
88853
88876
  }
88854
- p2.nsp = str2.substring(start, i2);
88855
- } else {
88856
- p2.nsp = "/";
88857
- }
88858
- const next = str2.charAt(i2 + 1);
88859
- if ("" !== next && Number(next) == next) {
88860
- const start = i2 + 1;
88861
- while (++i2) {
88862
- const c2 = str2.charAt(i2);
88863
- if (null == c2 || Number(c2) != c2) {
88864
- --i2;
88865
- break;
88877
+ const next = str2.charAt(i2 + 1);
88878
+ if ("" !== next && Number(next) == next) {
88879
+ const start = i2 + 1;
88880
+ while (++i2) {
88881
+ const c2 = str2.charAt(i2);
88882
+ if (null == c2 || Number(c2) != c2) {
88883
+ --i2;
88884
+ break;
88885
+ }
88886
+ if (i2 === str2.length)
88887
+ break;
88888
+ }
88889
+ p2.id = Number(str2.substring(start, i2 + 1));
88890
+ }
88891
+ if (str2.charAt(++i2)) {
88892
+ const payload = this.tryParse(str2.substr(i2));
88893
+ if (Decoder.isPayloadValid(p2.type, payload)) {
88894
+ p2.data = payload;
88895
+ } else {
88896
+ throw new Error("invalid payload");
88866
88897
  }
88867
- if (i2 === str2.length)
88868
- break;
88869
88898
  }
88870
- p2.id = Number(str2.substring(start, i2 + 1));
88899
+ debug2("decoded %s as %j", str2, p2);
88900
+ return p2;
88871
88901
  }
88872
- if (str2.charAt(++i2)) {
88873
- const payload = this.tryParse(str2.substr(i2));
88874
- if (Decoder.isPayloadValid(p2.type, payload)) {
88875
- p2.data = payload;
88876
- } else {
88877
- throw new Error("invalid payload");
88902
+ tryParse(str2) {
88903
+ try {
88904
+ return JSON.parse(str2, this.reviver);
88905
+ } catch (e2) {
88906
+ return false;
88878
88907
  }
88879
88908
  }
88880
- debug2("decoded %s as %j", str2, p2);
88881
- return p2;
88882
- }
88883
- tryParse(str2) {
88884
- try {
88885
- return JSON.parse(str2, this.reviver);
88886
- } catch (e2) {
88887
- return false;
88909
+ static isPayloadValid(type2, payload) {
88910
+ switch (type2) {
88911
+ case PacketType.CONNECT:
88912
+ return isObject2(payload);
88913
+ case PacketType.DISCONNECT:
88914
+ return payload === void 0;
88915
+ case PacketType.CONNECT_ERROR:
88916
+ return typeof payload === "string" || isObject2(payload);
88917
+ case PacketType.EVENT:
88918
+ case PacketType.BINARY_EVENT:
88919
+ return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS2.indexOf(payload[0]) === -1);
88920
+ case PacketType.ACK:
88921
+ case PacketType.BINARY_ACK:
88922
+ return Array.isArray(payload);
88923
+ }
88888
88924
  }
88889
- }
88890
- static isPayloadValid(type2, payload) {
88891
- switch (type2) {
88892
- case PacketType.CONNECT:
88893
- return isObject2(payload);
88894
- case PacketType.DISCONNECT:
88895
- return payload === void 0;
88896
- case PacketType.CONNECT_ERROR:
88897
- return typeof payload === "string" || isObject2(payload);
88898
- case PacketType.EVENT:
88899
- case PacketType.BINARY_EVENT:
88900
- return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS2.indexOf(payload[0]) === -1);
88901
- case PacketType.ACK:
88902
- case PacketType.BINARY_ACK:
88903
- return Array.isArray(payload);
88925
+ /**
88926
+ * Deallocates a parser's resources
88927
+ */
88928
+ destroy() {
88929
+ if (this.reconstructor) {
88930
+ this.reconstructor.finishedReconstruction();
88931
+ this.reconstructor = null;
88932
+ }
88904
88933
  }
88905
88934
  }
88906
- /**
88907
- * Deallocates a parser's resources
88908
- */
88909
- destroy() {
88910
- if (this.reconstructor) {
88911
- this.reconstructor.finishedReconstruction();
88912
- this.reconstructor = null;
88935
+ exports2.Decoder = Decoder;
88936
+ class BinaryReconstructor {
88937
+ constructor(packet) {
88938
+ this.packet = packet;
88939
+ this.buffers = [];
88940
+ this.reconPack = packet;
88913
88941
  }
88914
- }
88915
- }
88916
- exports2.Decoder = Decoder;
88917
- class BinaryReconstructor {
88918
- constructor(packet) {
88919
- this.packet = packet;
88920
- this.buffers = [];
88921
- this.reconPack = packet;
88922
- }
88923
- /**
88924
- * Method to be called when binary data received from connection
88925
- * after a BINARY_EVENT packet.
88926
- *
88927
- * @param {Buffer | ArrayBuffer} binData - the raw binary data received
88928
- * @return {null | Object} returns null if more binary data is expected or
88929
- * a reconstructed packet object if all buffers have been received.
88930
- */
88931
- takeBinaryData(binData) {
88932
- this.buffers.push(binData);
88933
- if (this.buffers.length === this.reconPack.attachments) {
88934
- const packet = (0, binary_js_1.reconstructPacket)(this.reconPack, this.buffers);
88935
- this.finishedReconstruction();
88936
- return packet;
88942
+ /**
88943
+ * Method to be called when binary data received from connection
88944
+ * after a BINARY_EVENT packet.
88945
+ *
88946
+ * @param {Buffer | ArrayBuffer} binData - the raw binary data received
88947
+ * @return {null | Object} returns null if more binary data is expected or
88948
+ * a reconstructed packet object if all buffers have been received.
88949
+ */
88950
+ takeBinaryData(binData) {
88951
+ this.buffers.push(binData);
88952
+ if (this.buffers.length === this.reconPack.attachments) {
88953
+ const packet = (0, binary_js_1.reconstructPacket)(this.reconPack, this.buffers);
88954
+ this.finishedReconstruction();
88955
+ return packet;
88956
+ }
88957
+ return null;
88958
+ }
88959
+ /**
88960
+ * Cleans up binary packet reconstruction variables.
88961
+ */
88962
+ finishedReconstruction() {
88963
+ this.reconPack = null;
88964
+ this.buffers = [];
88937
88965
  }
88938
- return null;
88939
- }
88940
- /**
88941
- * Cleans up binary packet reconstruction variables.
88942
- */
88943
- finishedReconstruction() {
88944
- this.reconPack = null;
88945
- this.buffers = [];
88946
88966
  }
88947
- }
88948
- })(cjs);
88967
+ })(cjs);
88968
+ return cjs;
88969
+ }
88949
88970
  var on$1 = {};
88950
88971
  Object.defineProperty(on$1, "__esModule", { value: true });
88951
88972
  on$1.on = void 0;
@@ -88961,7 +88982,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
88961
88982
  };
88962
88983
  Object.defineProperty(socket, "__esModule", { value: true });
88963
88984
  socket.Socket = void 0;
88964
- const socket_io_parser_1 = cjs;
88985
+ const socket_io_parser_1 = requireCjs();
88965
88986
  const on_js_1$1 = on$1;
88966
88987
  const component_emitter_1$1 = require$$5$1;
88967
88988
  const debug_1$3 = __importDefault$A(browserExports$2);
@@ -89803,7 +89824,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
89803
89824
  manager.Manager = void 0;
89804
89825
  const engine_io_client_1 = cjs$2;
89805
89826
  const socket_js_1 = socket;
89806
- const parser$1 = __importStar$A(cjs);
89827
+ const parser$1 = __importStar$A(requireCjs());
89807
89828
  const on_js_1 = on$1;
89808
89829
  const backo2_js_1 = backo2;
89809
89830
  const component_emitter_1 = require$$5$1;
@@ -90216,7 +90237,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
90216
90237
  io: lookup2,
90217
90238
  connect: lookup2
90218
90239
  });
90219
- var socket_io_parser_12 = cjs;
90240
+ var socket_io_parser_12 = requireCjs();
90220
90241
  Object.defineProperty(exports2, "protocol", { enumerable: true, get: function() {
90221
90242
  return socket_io_parser_12.protocol;
90222
90243
  } });
@@ -102719,7 +102740,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
102719
102740
  };
102720
102741
  var REGISTRATION_IN_PROGRESS = "REGISTRATION_IN_PROGRESS";
102721
102742
  var FORWARDER_ID = "FORWARDER_ID";
102722
- var Onboarding = (
102743
+ var Onboarding$1 = (
102723
102744
  /** @class */
102724
102745
  function() {
102725
102746
  function Onboarding2(_a2) {
@@ -102877,7 +102898,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
102877
102898
  );
102878
102899
  const metamaskOnboarding_es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
102879
102900
  __proto__: null,
102880
- default: Onboarding
102901
+ default: Onboarding$1
102881
102902
  }, Symbol.toStringTag, { value: "Module" }));
102882
102903
  const require$$1$9 = /* @__PURE__ */ getAugmentedNamespace(metamaskOnboarding_es);
102883
102904
  var dist$7 = {};
@@ -149764,7 +149785,7 @@ CAUSE: ${cause === null || cause === void 0 ? void 0 : cause.stack}`;
149764
149785
  rng2 = rng2 || ((size2) => buffer$2.Buffer.from(utils_1$l.randomBytes(size2)));
149765
149786
  return entropyToMnemonic(rng2(strength / 8), wordlist2);
149766
149787
  }
149767
- src$3.generateMnemonic = generateMnemonic;
149788
+ var generateMnemonic_1 = src$3.generateMnemonic = generateMnemonic;
149768
149789
  function validateMnemonic(mnemonic, wordlist2) {
149769
149790
  try {
149770
149791
  mnemonicToEntropy(mnemonic, wordlist2);
@@ -391954,7 +391975,6 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
391954
391975
  setIsModalOpen(true);
391955
391976
  };
391956
391977
  const onStart = async function() {
391957
- var _a2, _b;
391958
391978
  try {
391959
391979
  const serviceKey = localStorage.getItem("serviceKey");
391960
391980
  let queryKey2 = localStorage.getItem("queryKey");
@@ -392024,21 +392044,12 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
392024
392044
  method: "eth_requestAccounts"
392025
392045
  });
392026
392046
  walletMetaMask.accounts = accounts2;
392027
- const successMetaMask = await appInit.pairWallet(walletMetaMask);
392028
- console.log("successMetaMask: ", successMetaMask);
392029
- if (successMetaMask) {
392030
- if (((_a2 = appInit.pubkeyContext) == null ? void 0 : _a2.master) || (appInit == null ? void 0 : appInit.pubkey)) {
392031
- dispatch2({
392032
- type: "SET_PUBKEY_CONTEXT",
392033
- // @ts-ignore
392034
- payload: ((_b = appInit.pubkeyContext) == null ? void 0 : _b.master) || (appInit == null ? void 0 : appInit.pubkey)
392035
- });
392036
- }
392037
- }
392038
392047
  dispatch2({
392039
392048
  type: "SET_STATUS",
392040
392049
  payload: "MetaMask connected!"
392041
392050
  });
392051
+ dispatch2({ type: "ADD_WALLET", payload: walletMetaMask });
392052
+ appInit.pairWallet(walletMetaMask);
392042
392053
  }
392043
392054
  } else {
392044
392055
  console.log("MetaMask is not available");
@@ -392064,12 +392075,12 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
392064
392075
  dist$l.KkRestAdapter.useKeyring(keyring2).pairDevice(sdkKeepKey),
392065
392076
  timeout(3e4)
392066
392077
  ]);
392067
- const successKeepKey = await appInit.pairWallet(walletKeepKey);
392068
392078
  dispatch2({ type: "ADD_WALLET", payload: walletKeepKey });
392069
392079
  dispatch2({
392070
392080
  type: "SET_STATUS",
392071
392081
  payload: "KeepKey connected!"
392072
392082
  });
392083
+ appInit.pairWallet(walletKeepKey);
392073
392084
  } catch (error2) {
392074
392085
  console.error("Error or Timeout:", error2.message);
392075
392086
  alert("Please restart your KeepKey and try again.");
@@ -392083,14 +392094,13 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
392083
392094
  walletSoftware = await nativeAdapter.pairDevice("testid");
392084
392095
  await nativeAdapter.initialize();
392085
392096
  await walletSoftware.loadDevice({ mnemonic });
392086
- console.log("walletSoftware: ", walletSoftware);
392087
- const successSoftware = await appInit.pairWallet(walletSoftware);
392088
- console.log("successSoftware: ", successSoftware);
392089
392097
  dispatch2({ type: "ADD_WALLET", payload: walletSoftware });
392090
392098
  dispatch2({
392091
392099
  type: "SET_STATUS",
392092
392100
  payload: "Software wallet connected!"
392093
392101
  });
392102
+ console.log("walletSoftware: ", walletSoftware);
392103
+ appInit.pairWallet(walletSoftware);
392094
392104
  }
392095
392105
  } catch (e2) {
392096
392106
  console.error(e2);
@@ -393793,14 +393803,116 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
393793
393803
  ] })
393794
393804
  ] });
393795
393805
  }
393806
+ const Onboarding = ({ onClose }) => {
393807
+ const { state: state2, dispatch: dispatch2 } = usePioneer();
393808
+ const { api: api2, app, user, context: context2 } = state2;
393809
+ const [walletDescriptions, setWalletDescriptions] = React.useState([]);
393810
+ const [balances, setBalances] = React.useState([]);
393811
+ React.useState(false);
393812
+ React.useState(false);
393813
+ React.useState(false);
393814
+ React.useState("");
393815
+ React.useState("");
393816
+ const [seedPhrase, setSeedPhrase] = React.useState("");
393817
+ const [error2, setError] = React.useState(null);
393818
+ const [isValid, setIsValid] = React.useState(false);
393819
+ const [action, setAction] = React.useState(null);
393820
+ const setUser = async function() {
393821
+ try {
393822
+ if (user && user.wallets) {
393823
+ const { wallets, walletDescriptions: walletDescriptions2, balances: balances2, pubkeys: pubkeys2 } = user;
393824
+ setWalletDescriptions(walletDescriptions2);
393825
+ setBalances(balances2);
393826
+ }
393827
+ } catch (e2) {
393828
+ console.error("header e: ", e2);
393829
+ }
393830
+ };
393831
+ React.useEffect(() => {
393832
+ setUser();
393833
+ }, [user]);
393834
+ React.useEffect(() => {
393835
+ const words2 = seedPhrase.trim().split(" ");
393836
+ if (words2.length === 12 && words2.every((word) => word.length > 0)) {
393837
+ setError(null);
393838
+ setIsValid(true);
393839
+ } else {
393840
+ setError("Seed phrase must be exactly 12 words");
393841
+ setIsValid(false);
393842
+ }
393843
+ }, [seedPhrase]);
393844
+ const handleSubmit = (event2) => {
393845
+ event2.preventDefault();
393846
+ if (isValid) {
393847
+ console.log("Seed Phrase Submitted:", seedPhrase);
393848
+ localStorage.setItem("seedPhrase", seedPhrase);
393849
+ localStorage.setItem("isOnboarded", "true");
393850
+ alert("Wallet Saved to localstorage. please restart app /n (Note: this is not secure! use a hardware wallet!)");
393851
+ onClose();
393852
+ }
393853
+ };
393854
+ const handleImport = () => {
393855
+ setSeedPhrase("");
393856
+ setAction("import");
393857
+ };
393858
+ const handleGenerate = () => {
393859
+ const newSeedPhrase = generateMnemonic_1();
393860
+ setSeedPhrase(newSeedPhrase);
393861
+ setAction("generate");
393862
+ };
393863
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(react.Box, { children: [
393864
+ "Welcome to Pioneer SDK! Please select a wallet to continue.",
393865
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
393866
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.Avatar, { size: "lg", src: PIONEER_ICON }),
393867
+ action ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
393868
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [
393869
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(react.FormControl, { isInvalid: !!error2, children: [
393870
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.FormLabel, { htmlFor: "seedPhrase", children: "Seed Phrase" }),
393871
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
393872
+ react.Input,
393873
+ {
393874
+ id: "seedPhrase",
393875
+ name: "seedPhrase",
393876
+ type: "text",
393877
+ value: seedPhrase,
393878
+ onChange: (e2) => setSeedPhrase(e2.target.value),
393879
+ borderColor: isValid ? "green.500" : "red.500"
393880
+ }
393881
+ ),
393882
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.FormErrorMessage, { children: error2 })
393883
+ ] }),
393884
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.Button, { mt: 4, colorScheme: "teal", type: "submit", children: "Submit" })
393885
+ ] }),
393886
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.Button, { mt: 4, onClick: () => setAction(null), children: "Go Back" })
393887
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(react.VStack, { spacing: 4, children: [
393888
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.Button, { colorScheme: "teal", onClick: handleGenerate, children: "Generate New Seed Phrase" }),
393889
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.Button, { colorScheme: "teal", onClick: handleImport, children: "Import Seed Phrase" })
393890
+ ] })
393891
+ ] });
393892
+ };
393796
393893
  const SettingsModal = ({ isOpen, onClose }) => {
393797
393894
  const { state: state2 } = usePioneer();
393798
393895
  const { app, status: status2 } = state2;
393896
+ const [isOnboarded, setIsOnboarded] = React.useState(false);
393897
+ const onStart = async function() {
393898
+ try {
393899
+ console.log("onStart");
393900
+ let isOnboarded2 = await localStorage.getItem("isOnboarded");
393901
+ if (!isOnboarded2) {
393902
+ console.log("Starting onboarding process");
393903
+ }
393904
+ } catch (e2) {
393905
+ console.error(e2);
393906
+ }
393907
+ };
393908
+ React.useEffect(() => {
393909
+ onStart();
393910
+ }, []);
393799
393911
  React.useEffect(() => {
393800
393912
  }, [app, app == null ? void 0 : app.balances, app == null ? void 0 : app.pubkeys, app == null ? void 0 : app.wallets, app == null ? void 0 : app.paths, status2]);
393801
393913
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(react.Modal, { isOpen, onClose, size: "xl", children: [
393802
393914
  /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalOverlay, {}),
393803
- /* @__PURE__ */ jsxRuntimeExports.jsxs(react.ModalContent, { children: [
393915
+ /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalContent, { children: !isOnboarded ? /* @__PURE__ */ jsxRuntimeExports.jsx(Onboarding, { onClose }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
393804
393916
  /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalHeader, { children: "Pioneer Settings" }),
393805
393917
  /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalCloseButton, {}),
393806
393918
  /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalBody, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(react.Tabs, { variant: "enclosed", children: [
@@ -393817,7 +393929,7 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
393817
393929
  ] })
393818
393930
  ] }) }),
393819
393931
  /* @__PURE__ */ jsxRuntimeExports.jsx(react.ModalFooter, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(react.Button, { colorScheme: "blue", mr: 3, onClick: onClose, children: "Close" }) })
393820
- ] })
393932
+ ] }) })
393821
393933
  ] });
393822
393934
  };
393823
393935
  const getWalletBadgeContent = (walletType) => {
@@ -393866,6 +393978,21 @@ Proven: ${(0, encoding_1$e.toHex)(op2.key)}`);
393866
393978
  React.useState(false);
393867
393979
  React.useState([]);
393868
393980
  const [balances, setBalances] = React.useState([]);
393981
+ const onStart = async function() {
393982
+ try {
393983
+ console.log("onStart");
393984
+ let isOnboarded = await localStorage.getItem("isOnboarded");
393985
+ if (!isOnboarded) {
393986
+ console.log("Starting onboarding process");
393987
+ onOpen();
393988
+ }
393989
+ } catch (e2) {
393990
+ console.error(e2);
393991
+ }
393992
+ };
393993
+ React.useEffect(() => {
393994
+ onStart();
393995
+ }, []);
393869
393996
  const settingsSelected = async function() {
393870
393997
  try {
393871
393998
  onOpen();