@credenza3/contracts-lib-sui 0.2.3 → 0.2.5
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/cjs/client/CredenzaSuiClient.d.ts +4 -1
- package/dist/cjs/client/index.cjs +1824 -26
- package/dist/cjs/client/index.cjs.map +4 -4
- package/dist/esm/client/CredenzaSuiClient.d.ts +4 -1
- package/dist/esm/client/index.mjs +1825 -26
- package/dist/esm/client/index.mjs.map +4 -4
- package/dist/umd/client/index.js +56 -45
- package/dist/umd/client/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -35,8 +35,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
35
35
|
// node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isArray.js
|
|
36
36
|
var require_isArray = __commonJS({
|
|
37
37
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isArray.js"(exports, module2) {
|
|
38
|
-
var
|
|
39
|
-
module2.exports =
|
|
38
|
+
var isArray2 = Array.isArray;
|
|
39
|
+
module2.exports = isArray2;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -153,12 +153,12 @@ var require_isSymbol = __commonJS({
|
|
|
153
153
|
// node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_isKey.js
|
|
154
154
|
var require_isKey = __commonJS({
|
|
155
155
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_isKey.js"(exports, module2) {
|
|
156
|
-
var
|
|
156
|
+
var isArray2 = require_isArray();
|
|
157
157
|
var isSymbol = require_isSymbol();
|
|
158
158
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
159
159
|
var reIsPlainProp = /^\w*$/;
|
|
160
160
|
function isKey(value, object) {
|
|
161
|
-
if (
|
|
161
|
+
if (isArray2(value)) {
|
|
162
162
|
return false;
|
|
163
163
|
}
|
|
164
164
|
var type = typeof value;
|
|
@@ -741,7 +741,7 @@ var require_baseToString = __commonJS({
|
|
|
741
741
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseToString.js"(exports, module2) {
|
|
742
742
|
var Symbol2 = require_Symbol();
|
|
743
743
|
var arrayMap = require_arrayMap();
|
|
744
|
-
var
|
|
744
|
+
var isArray2 = require_isArray();
|
|
745
745
|
var isSymbol = require_isSymbol();
|
|
746
746
|
var INFINITY = 1 / 0;
|
|
747
747
|
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
|
|
@@ -750,7 +750,7 @@ var require_baseToString = __commonJS({
|
|
|
750
750
|
if (typeof value == "string") {
|
|
751
751
|
return value;
|
|
752
752
|
}
|
|
753
|
-
if (
|
|
753
|
+
if (isArray2(value)) {
|
|
754
754
|
return arrayMap(value, baseToString) + "";
|
|
755
755
|
}
|
|
756
756
|
if (isSymbol(value)) {
|
|
@@ -777,12 +777,12 @@ var require_toString = __commonJS({
|
|
|
777
777
|
// node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_castPath.js
|
|
778
778
|
var require_castPath = __commonJS({
|
|
779
779
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_castPath.js"(exports, module2) {
|
|
780
|
-
var
|
|
780
|
+
var isArray2 = require_isArray();
|
|
781
781
|
var isKey = require_isKey();
|
|
782
782
|
var stringToPath = require_stringToPath();
|
|
783
783
|
var toString = require_toString();
|
|
784
784
|
function castPath(value, object) {
|
|
785
|
-
if (
|
|
785
|
+
if (isArray2(value)) {
|
|
786
786
|
return value;
|
|
787
787
|
}
|
|
788
788
|
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
@@ -846,6 +846,1782 @@ var require_isNil = __commonJS({
|
|
|
846
846
|
}
|
|
847
847
|
});
|
|
848
848
|
|
|
849
|
+
// node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
|
850
|
+
var require_base64_js = __commonJS({
|
|
851
|
+
"node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports) {
|
|
852
|
+
"use strict";
|
|
853
|
+
exports.byteLength = byteLength;
|
|
854
|
+
exports.toByteArray = toByteArray;
|
|
855
|
+
exports.fromByteArray = fromByteArray;
|
|
856
|
+
var lookup = [];
|
|
857
|
+
var revLookup = [];
|
|
858
|
+
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
859
|
+
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
860
|
+
for (i = 0, len = code.length; i < len; ++i) {
|
|
861
|
+
lookup[i] = code[i];
|
|
862
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
863
|
+
}
|
|
864
|
+
var i;
|
|
865
|
+
var len;
|
|
866
|
+
revLookup["-".charCodeAt(0)] = 62;
|
|
867
|
+
revLookup["_".charCodeAt(0)] = 63;
|
|
868
|
+
function getLens(b64) {
|
|
869
|
+
var len2 = b64.length;
|
|
870
|
+
if (len2 % 4 > 0) {
|
|
871
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
872
|
+
}
|
|
873
|
+
var validLen = b64.indexOf("=");
|
|
874
|
+
if (validLen === -1) validLen = len2;
|
|
875
|
+
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
|
876
|
+
return [validLen, placeHoldersLen];
|
|
877
|
+
}
|
|
878
|
+
function byteLength(b64) {
|
|
879
|
+
var lens = getLens(b64);
|
|
880
|
+
var validLen = lens[0];
|
|
881
|
+
var placeHoldersLen = lens[1];
|
|
882
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
883
|
+
}
|
|
884
|
+
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
885
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
886
|
+
}
|
|
887
|
+
function toByteArray(b64) {
|
|
888
|
+
var tmp;
|
|
889
|
+
var lens = getLens(b64);
|
|
890
|
+
var validLen = lens[0];
|
|
891
|
+
var placeHoldersLen = lens[1];
|
|
892
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
|
893
|
+
var curByte = 0;
|
|
894
|
+
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
895
|
+
var i2;
|
|
896
|
+
for (i2 = 0; i2 < len2; i2 += 4) {
|
|
897
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
|
|
898
|
+
arr[curByte++] = tmp >> 16 & 255;
|
|
899
|
+
arr[curByte++] = tmp >> 8 & 255;
|
|
900
|
+
arr[curByte++] = tmp & 255;
|
|
901
|
+
}
|
|
902
|
+
if (placeHoldersLen === 2) {
|
|
903
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
|
|
904
|
+
arr[curByte++] = tmp & 255;
|
|
905
|
+
}
|
|
906
|
+
if (placeHoldersLen === 1) {
|
|
907
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
|
|
908
|
+
arr[curByte++] = tmp >> 8 & 255;
|
|
909
|
+
arr[curByte++] = tmp & 255;
|
|
910
|
+
}
|
|
911
|
+
return arr;
|
|
912
|
+
}
|
|
913
|
+
function tripletToBase64(num) {
|
|
914
|
+
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
915
|
+
}
|
|
916
|
+
function encodeChunk(uint8, start, end) {
|
|
917
|
+
var tmp;
|
|
918
|
+
var output = [];
|
|
919
|
+
for (var i2 = start; i2 < end; i2 += 3) {
|
|
920
|
+
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
|
|
921
|
+
output.push(tripletToBase64(tmp));
|
|
922
|
+
}
|
|
923
|
+
return output.join("");
|
|
924
|
+
}
|
|
925
|
+
function fromByteArray(uint8) {
|
|
926
|
+
var tmp;
|
|
927
|
+
var len2 = uint8.length;
|
|
928
|
+
var extraBytes = len2 % 3;
|
|
929
|
+
var parts = [];
|
|
930
|
+
var maxChunkLength = 16383;
|
|
931
|
+
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
|
|
932
|
+
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
|
|
933
|
+
}
|
|
934
|
+
if (extraBytes === 1) {
|
|
935
|
+
tmp = uint8[len2 - 1];
|
|
936
|
+
parts.push(
|
|
937
|
+
lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
|
|
938
|
+
);
|
|
939
|
+
} else if (extraBytes === 2) {
|
|
940
|
+
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
|
|
941
|
+
parts.push(
|
|
942
|
+
lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
return parts.join("");
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
// node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
|
951
|
+
var require_ieee754 = __commonJS({
|
|
952
|
+
"node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports) {
|
|
953
|
+
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
954
|
+
var e, m;
|
|
955
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
956
|
+
var eMax = (1 << eLen) - 1;
|
|
957
|
+
var eBias = eMax >> 1;
|
|
958
|
+
var nBits = -7;
|
|
959
|
+
var i = isLE ? nBytes - 1 : 0;
|
|
960
|
+
var d = isLE ? -1 : 1;
|
|
961
|
+
var s = buffer[offset + i];
|
|
962
|
+
i += d;
|
|
963
|
+
e = s & (1 << -nBits) - 1;
|
|
964
|
+
s >>= -nBits;
|
|
965
|
+
nBits += eLen;
|
|
966
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
967
|
+
}
|
|
968
|
+
m = e & (1 << -nBits) - 1;
|
|
969
|
+
e >>= -nBits;
|
|
970
|
+
nBits += mLen;
|
|
971
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
972
|
+
}
|
|
973
|
+
if (e === 0) {
|
|
974
|
+
e = 1 - eBias;
|
|
975
|
+
} else if (e === eMax) {
|
|
976
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
977
|
+
} else {
|
|
978
|
+
m = m + Math.pow(2, mLen);
|
|
979
|
+
e = e - eBias;
|
|
980
|
+
}
|
|
981
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
982
|
+
};
|
|
983
|
+
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
984
|
+
var e, m, c;
|
|
985
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
986
|
+
var eMax = (1 << eLen) - 1;
|
|
987
|
+
var eBias = eMax >> 1;
|
|
988
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
989
|
+
var i = isLE ? 0 : nBytes - 1;
|
|
990
|
+
var d = isLE ? 1 : -1;
|
|
991
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
992
|
+
value = Math.abs(value);
|
|
993
|
+
if (isNaN(value) || value === Infinity) {
|
|
994
|
+
m = isNaN(value) ? 1 : 0;
|
|
995
|
+
e = eMax;
|
|
996
|
+
} else {
|
|
997
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
998
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
999
|
+
e--;
|
|
1000
|
+
c *= 2;
|
|
1001
|
+
}
|
|
1002
|
+
if (e + eBias >= 1) {
|
|
1003
|
+
value += rt / c;
|
|
1004
|
+
} else {
|
|
1005
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
1006
|
+
}
|
|
1007
|
+
if (value * c >= 2) {
|
|
1008
|
+
e++;
|
|
1009
|
+
c /= 2;
|
|
1010
|
+
}
|
|
1011
|
+
if (e + eBias >= eMax) {
|
|
1012
|
+
m = 0;
|
|
1013
|
+
e = eMax;
|
|
1014
|
+
} else if (e + eBias >= 1) {
|
|
1015
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
1016
|
+
e = e + eBias;
|
|
1017
|
+
} else {
|
|
1018
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
1019
|
+
e = 0;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
1023
|
+
}
|
|
1024
|
+
e = e << mLen | m;
|
|
1025
|
+
eLen += mLen;
|
|
1026
|
+
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
1027
|
+
}
|
|
1028
|
+
buffer[offset + i - d] |= s * 128;
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
|
|
1034
|
+
var require_buffer = __commonJS({
|
|
1035
|
+
"node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js"(exports) {
|
|
1036
|
+
"use strict";
|
|
1037
|
+
var base64 = require_base64_js();
|
|
1038
|
+
var ieee754 = require_ieee754();
|
|
1039
|
+
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
1040
|
+
exports.Buffer = Buffer4;
|
|
1041
|
+
exports.SlowBuffer = SlowBuffer;
|
|
1042
|
+
exports.INSPECT_MAX_BYTES = 50;
|
|
1043
|
+
var K_MAX_LENGTH = 2147483647;
|
|
1044
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
|
1045
|
+
Buffer4.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
1046
|
+
if (!Buffer4.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
1047
|
+
console.error(
|
|
1048
|
+
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
function typedArraySupport() {
|
|
1052
|
+
try {
|
|
1053
|
+
const arr = new Uint8Array(1);
|
|
1054
|
+
const proto = { foo: function() {
|
|
1055
|
+
return 42;
|
|
1056
|
+
} };
|
|
1057
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
|
1058
|
+
Object.setPrototypeOf(arr, proto);
|
|
1059
|
+
return arr.foo() === 42;
|
|
1060
|
+
} catch (e) {
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
Object.defineProperty(Buffer4.prototype, "parent", {
|
|
1065
|
+
enumerable: true,
|
|
1066
|
+
get: function() {
|
|
1067
|
+
if (!Buffer4.isBuffer(this)) return void 0;
|
|
1068
|
+
return this.buffer;
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
Object.defineProperty(Buffer4.prototype, "offset", {
|
|
1072
|
+
enumerable: true,
|
|
1073
|
+
get: function() {
|
|
1074
|
+
if (!Buffer4.isBuffer(this)) return void 0;
|
|
1075
|
+
return this.byteOffset;
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
function createBuffer(length) {
|
|
1079
|
+
if (length > K_MAX_LENGTH) {
|
|
1080
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
1081
|
+
}
|
|
1082
|
+
const buf = new Uint8Array(length);
|
|
1083
|
+
Object.setPrototypeOf(buf, Buffer4.prototype);
|
|
1084
|
+
return buf;
|
|
1085
|
+
}
|
|
1086
|
+
function Buffer4(arg, encodingOrOffset, length) {
|
|
1087
|
+
if (typeof arg === "number") {
|
|
1088
|
+
if (typeof encodingOrOffset === "string") {
|
|
1089
|
+
throw new TypeError(
|
|
1090
|
+
'The "string" argument must be of type string. Received type number'
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
return allocUnsafe(arg);
|
|
1094
|
+
}
|
|
1095
|
+
return from(arg, encodingOrOffset, length);
|
|
1096
|
+
}
|
|
1097
|
+
Buffer4.poolSize = 8192;
|
|
1098
|
+
function from(value, encodingOrOffset, length) {
|
|
1099
|
+
if (typeof value === "string") {
|
|
1100
|
+
return fromString(value, encodingOrOffset);
|
|
1101
|
+
}
|
|
1102
|
+
if (ArrayBuffer.isView(value)) {
|
|
1103
|
+
return fromArrayView(value);
|
|
1104
|
+
}
|
|
1105
|
+
if (value == null) {
|
|
1106
|
+
throw new TypeError(
|
|
1107
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
|
1111
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1112
|
+
}
|
|
1113
|
+
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
|
1114
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1115
|
+
}
|
|
1116
|
+
if (typeof value === "number") {
|
|
1117
|
+
throw new TypeError(
|
|
1118
|
+
'The "value" argument must not be of type number. Received type number'
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
const valueOf = value.valueOf && value.valueOf();
|
|
1122
|
+
if (valueOf != null && valueOf !== value) {
|
|
1123
|
+
return Buffer4.from(valueOf, encodingOrOffset, length);
|
|
1124
|
+
}
|
|
1125
|
+
const b = fromObject(value);
|
|
1126
|
+
if (b) return b;
|
|
1127
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
1128
|
+
return Buffer4.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
1129
|
+
}
|
|
1130
|
+
throw new TypeError(
|
|
1131
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
Buffer4.from = function(value, encodingOrOffset, length) {
|
|
1135
|
+
return from(value, encodingOrOffset, length);
|
|
1136
|
+
};
|
|
1137
|
+
Object.setPrototypeOf(Buffer4.prototype, Uint8Array.prototype);
|
|
1138
|
+
Object.setPrototypeOf(Buffer4, Uint8Array);
|
|
1139
|
+
function assertSize(size) {
|
|
1140
|
+
if (typeof size !== "number") {
|
|
1141
|
+
throw new TypeError('"size" argument must be of type number');
|
|
1142
|
+
} else if (size < 0) {
|
|
1143
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
function alloc(size, fill, encoding) {
|
|
1147
|
+
assertSize(size);
|
|
1148
|
+
if (size <= 0) {
|
|
1149
|
+
return createBuffer(size);
|
|
1150
|
+
}
|
|
1151
|
+
if (fill !== void 0) {
|
|
1152
|
+
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
1153
|
+
}
|
|
1154
|
+
return createBuffer(size);
|
|
1155
|
+
}
|
|
1156
|
+
Buffer4.alloc = function(size, fill, encoding) {
|
|
1157
|
+
return alloc(size, fill, encoding);
|
|
1158
|
+
};
|
|
1159
|
+
function allocUnsafe(size) {
|
|
1160
|
+
assertSize(size);
|
|
1161
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
1162
|
+
}
|
|
1163
|
+
Buffer4.allocUnsafe = function(size) {
|
|
1164
|
+
return allocUnsafe(size);
|
|
1165
|
+
};
|
|
1166
|
+
Buffer4.allocUnsafeSlow = function(size) {
|
|
1167
|
+
return allocUnsafe(size);
|
|
1168
|
+
};
|
|
1169
|
+
function fromString(string, encoding) {
|
|
1170
|
+
if (typeof encoding !== "string" || encoding === "") {
|
|
1171
|
+
encoding = "utf8";
|
|
1172
|
+
}
|
|
1173
|
+
if (!Buffer4.isEncoding(encoding)) {
|
|
1174
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
|
1175
|
+
}
|
|
1176
|
+
const length = byteLength(string, encoding) | 0;
|
|
1177
|
+
let buf = createBuffer(length);
|
|
1178
|
+
const actual = buf.write(string, encoding);
|
|
1179
|
+
if (actual !== length) {
|
|
1180
|
+
buf = buf.slice(0, actual);
|
|
1181
|
+
}
|
|
1182
|
+
return buf;
|
|
1183
|
+
}
|
|
1184
|
+
function fromArrayLike(array) {
|
|
1185
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
1186
|
+
const buf = createBuffer(length);
|
|
1187
|
+
for (let i = 0; i < length; i += 1) {
|
|
1188
|
+
buf[i] = array[i] & 255;
|
|
1189
|
+
}
|
|
1190
|
+
return buf;
|
|
1191
|
+
}
|
|
1192
|
+
function fromArrayView(arrayView) {
|
|
1193
|
+
if (isInstance(arrayView, Uint8Array)) {
|
|
1194
|
+
const copy = new Uint8Array(arrayView);
|
|
1195
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
1196
|
+
}
|
|
1197
|
+
return fromArrayLike(arrayView);
|
|
1198
|
+
}
|
|
1199
|
+
function fromArrayBuffer(array, byteOffset, length) {
|
|
1200
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
1201
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1202
|
+
}
|
|
1203
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
1204
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
1205
|
+
}
|
|
1206
|
+
let buf;
|
|
1207
|
+
if (byteOffset === void 0 && length === void 0) {
|
|
1208
|
+
buf = new Uint8Array(array);
|
|
1209
|
+
} else if (length === void 0) {
|
|
1210
|
+
buf = new Uint8Array(array, byteOffset);
|
|
1211
|
+
} else {
|
|
1212
|
+
buf = new Uint8Array(array, byteOffset, length);
|
|
1213
|
+
}
|
|
1214
|
+
Object.setPrototypeOf(buf, Buffer4.prototype);
|
|
1215
|
+
return buf;
|
|
1216
|
+
}
|
|
1217
|
+
function fromObject(obj) {
|
|
1218
|
+
if (Buffer4.isBuffer(obj)) {
|
|
1219
|
+
const len = checked(obj.length) | 0;
|
|
1220
|
+
const buf = createBuffer(len);
|
|
1221
|
+
if (buf.length === 0) {
|
|
1222
|
+
return buf;
|
|
1223
|
+
}
|
|
1224
|
+
obj.copy(buf, 0, 0, len);
|
|
1225
|
+
return buf;
|
|
1226
|
+
}
|
|
1227
|
+
if (obj.length !== void 0) {
|
|
1228
|
+
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
|
1229
|
+
return createBuffer(0);
|
|
1230
|
+
}
|
|
1231
|
+
return fromArrayLike(obj);
|
|
1232
|
+
}
|
|
1233
|
+
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
1234
|
+
return fromArrayLike(obj.data);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function checked(length) {
|
|
1238
|
+
if (length >= K_MAX_LENGTH) {
|
|
1239
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
|
1240
|
+
}
|
|
1241
|
+
return length | 0;
|
|
1242
|
+
}
|
|
1243
|
+
function SlowBuffer(length) {
|
|
1244
|
+
if (+length != length) {
|
|
1245
|
+
length = 0;
|
|
1246
|
+
}
|
|
1247
|
+
return Buffer4.alloc(+length);
|
|
1248
|
+
}
|
|
1249
|
+
Buffer4.isBuffer = function isBuffer(b) {
|
|
1250
|
+
return b != null && b._isBuffer === true && b !== Buffer4.prototype;
|
|
1251
|
+
};
|
|
1252
|
+
Buffer4.compare = function compare(a, b) {
|
|
1253
|
+
if (isInstance(a, Uint8Array)) a = Buffer4.from(a, a.offset, a.byteLength);
|
|
1254
|
+
if (isInstance(b, Uint8Array)) b = Buffer4.from(b, b.offset, b.byteLength);
|
|
1255
|
+
if (!Buffer4.isBuffer(a) || !Buffer4.isBuffer(b)) {
|
|
1256
|
+
throw new TypeError(
|
|
1257
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
1258
|
+
);
|
|
1259
|
+
}
|
|
1260
|
+
if (a === b) return 0;
|
|
1261
|
+
let x = a.length;
|
|
1262
|
+
let y = b.length;
|
|
1263
|
+
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
1264
|
+
if (a[i] !== b[i]) {
|
|
1265
|
+
x = a[i];
|
|
1266
|
+
y = b[i];
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
if (x < y) return -1;
|
|
1271
|
+
if (y < x) return 1;
|
|
1272
|
+
return 0;
|
|
1273
|
+
};
|
|
1274
|
+
Buffer4.isEncoding = function isEncoding(encoding) {
|
|
1275
|
+
switch (String(encoding).toLowerCase()) {
|
|
1276
|
+
case "hex":
|
|
1277
|
+
case "utf8":
|
|
1278
|
+
case "utf-8":
|
|
1279
|
+
case "ascii":
|
|
1280
|
+
case "latin1":
|
|
1281
|
+
case "binary":
|
|
1282
|
+
case "base64":
|
|
1283
|
+
case "ucs2":
|
|
1284
|
+
case "ucs-2":
|
|
1285
|
+
case "utf16le":
|
|
1286
|
+
case "utf-16le":
|
|
1287
|
+
return true;
|
|
1288
|
+
default:
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
Buffer4.concat = function concat(list, length) {
|
|
1293
|
+
if (!Array.isArray(list)) {
|
|
1294
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1295
|
+
}
|
|
1296
|
+
if (list.length === 0) {
|
|
1297
|
+
return Buffer4.alloc(0);
|
|
1298
|
+
}
|
|
1299
|
+
let i;
|
|
1300
|
+
if (length === void 0) {
|
|
1301
|
+
length = 0;
|
|
1302
|
+
for (i = 0; i < list.length; ++i) {
|
|
1303
|
+
length += list[i].length;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
const buffer = Buffer4.allocUnsafe(length);
|
|
1307
|
+
let pos = 0;
|
|
1308
|
+
for (i = 0; i < list.length; ++i) {
|
|
1309
|
+
let buf = list[i];
|
|
1310
|
+
if (isInstance(buf, Uint8Array)) {
|
|
1311
|
+
if (pos + buf.length > buffer.length) {
|
|
1312
|
+
if (!Buffer4.isBuffer(buf)) buf = Buffer4.from(buf);
|
|
1313
|
+
buf.copy(buffer, pos);
|
|
1314
|
+
} else {
|
|
1315
|
+
Uint8Array.prototype.set.call(
|
|
1316
|
+
buffer,
|
|
1317
|
+
buf,
|
|
1318
|
+
pos
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
} else if (!Buffer4.isBuffer(buf)) {
|
|
1322
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1323
|
+
} else {
|
|
1324
|
+
buf.copy(buffer, pos);
|
|
1325
|
+
}
|
|
1326
|
+
pos += buf.length;
|
|
1327
|
+
}
|
|
1328
|
+
return buffer;
|
|
1329
|
+
};
|
|
1330
|
+
function byteLength(string, encoding) {
|
|
1331
|
+
if (Buffer4.isBuffer(string)) {
|
|
1332
|
+
return string.length;
|
|
1333
|
+
}
|
|
1334
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
1335
|
+
return string.byteLength;
|
|
1336
|
+
}
|
|
1337
|
+
if (typeof string !== "string") {
|
|
1338
|
+
throw new TypeError(
|
|
1339
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
const len = string.length;
|
|
1343
|
+
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
1344
|
+
if (!mustMatch && len === 0) return 0;
|
|
1345
|
+
let loweredCase = false;
|
|
1346
|
+
for (; ; ) {
|
|
1347
|
+
switch (encoding) {
|
|
1348
|
+
case "ascii":
|
|
1349
|
+
case "latin1":
|
|
1350
|
+
case "binary":
|
|
1351
|
+
return len;
|
|
1352
|
+
case "utf8":
|
|
1353
|
+
case "utf-8":
|
|
1354
|
+
return utf8ToBytes(string).length;
|
|
1355
|
+
case "ucs2":
|
|
1356
|
+
case "ucs-2":
|
|
1357
|
+
case "utf16le":
|
|
1358
|
+
case "utf-16le":
|
|
1359
|
+
return len * 2;
|
|
1360
|
+
case "hex":
|
|
1361
|
+
return len >>> 1;
|
|
1362
|
+
case "base64":
|
|
1363
|
+
return base64ToBytes(string).length;
|
|
1364
|
+
default:
|
|
1365
|
+
if (loweredCase) {
|
|
1366
|
+
return mustMatch ? -1 : utf8ToBytes(string).length;
|
|
1367
|
+
}
|
|
1368
|
+
encoding = ("" + encoding).toLowerCase();
|
|
1369
|
+
loweredCase = true;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
Buffer4.byteLength = byteLength;
|
|
1374
|
+
function slowToString(encoding, start, end) {
|
|
1375
|
+
let loweredCase = false;
|
|
1376
|
+
if (start === void 0 || start < 0) {
|
|
1377
|
+
start = 0;
|
|
1378
|
+
}
|
|
1379
|
+
if (start > this.length) {
|
|
1380
|
+
return "";
|
|
1381
|
+
}
|
|
1382
|
+
if (end === void 0 || end > this.length) {
|
|
1383
|
+
end = this.length;
|
|
1384
|
+
}
|
|
1385
|
+
if (end <= 0) {
|
|
1386
|
+
return "";
|
|
1387
|
+
}
|
|
1388
|
+
end >>>= 0;
|
|
1389
|
+
start >>>= 0;
|
|
1390
|
+
if (end <= start) {
|
|
1391
|
+
return "";
|
|
1392
|
+
}
|
|
1393
|
+
if (!encoding) encoding = "utf8";
|
|
1394
|
+
while (true) {
|
|
1395
|
+
switch (encoding) {
|
|
1396
|
+
case "hex":
|
|
1397
|
+
return hexSlice(this, start, end);
|
|
1398
|
+
case "utf8":
|
|
1399
|
+
case "utf-8":
|
|
1400
|
+
return utf8Slice(this, start, end);
|
|
1401
|
+
case "ascii":
|
|
1402
|
+
return asciiSlice(this, start, end);
|
|
1403
|
+
case "latin1":
|
|
1404
|
+
case "binary":
|
|
1405
|
+
return latin1Slice(this, start, end);
|
|
1406
|
+
case "base64":
|
|
1407
|
+
return base64Slice(this, start, end);
|
|
1408
|
+
case "ucs2":
|
|
1409
|
+
case "ucs-2":
|
|
1410
|
+
case "utf16le":
|
|
1411
|
+
case "utf-16le":
|
|
1412
|
+
return utf16leSlice(this, start, end);
|
|
1413
|
+
default:
|
|
1414
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1415
|
+
encoding = (encoding + "").toLowerCase();
|
|
1416
|
+
loweredCase = true;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
Buffer4.prototype._isBuffer = true;
|
|
1421
|
+
function swap(b, n, m) {
|
|
1422
|
+
const i = b[n];
|
|
1423
|
+
b[n] = b[m];
|
|
1424
|
+
b[m] = i;
|
|
1425
|
+
}
|
|
1426
|
+
Buffer4.prototype.swap16 = function swap16() {
|
|
1427
|
+
const len = this.length;
|
|
1428
|
+
if (len % 2 !== 0) {
|
|
1429
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1430
|
+
}
|
|
1431
|
+
for (let i = 0; i < len; i += 2) {
|
|
1432
|
+
swap(this, i, i + 1);
|
|
1433
|
+
}
|
|
1434
|
+
return this;
|
|
1435
|
+
};
|
|
1436
|
+
Buffer4.prototype.swap32 = function swap32() {
|
|
1437
|
+
const len = this.length;
|
|
1438
|
+
if (len % 4 !== 0) {
|
|
1439
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1440
|
+
}
|
|
1441
|
+
for (let i = 0; i < len; i += 4) {
|
|
1442
|
+
swap(this, i, i + 3);
|
|
1443
|
+
swap(this, i + 1, i + 2);
|
|
1444
|
+
}
|
|
1445
|
+
return this;
|
|
1446
|
+
};
|
|
1447
|
+
Buffer4.prototype.swap64 = function swap64() {
|
|
1448
|
+
const len = this.length;
|
|
1449
|
+
if (len % 8 !== 0) {
|
|
1450
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1451
|
+
}
|
|
1452
|
+
for (let i = 0; i < len; i += 8) {
|
|
1453
|
+
swap(this, i, i + 7);
|
|
1454
|
+
swap(this, i + 1, i + 6);
|
|
1455
|
+
swap(this, i + 2, i + 5);
|
|
1456
|
+
swap(this, i + 3, i + 4);
|
|
1457
|
+
}
|
|
1458
|
+
return this;
|
|
1459
|
+
};
|
|
1460
|
+
Buffer4.prototype.toString = function toString() {
|
|
1461
|
+
const length = this.length;
|
|
1462
|
+
if (length === 0) return "";
|
|
1463
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1464
|
+
return slowToString.apply(this, arguments);
|
|
1465
|
+
};
|
|
1466
|
+
Buffer4.prototype.toLocaleString = Buffer4.prototype.toString;
|
|
1467
|
+
Buffer4.prototype.equals = function equals(b) {
|
|
1468
|
+
if (!Buffer4.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1469
|
+
if (this === b) return true;
|
|
1470
|
+
return Buffer4.compare(this, b) === 0;
|
|
1471
|
+
};
|
|
1472
|
+
Buffer4.prototype.inspect = function inspect2() {
|
|
1473
|
+
let str = "";
|
|
1474
|
+
const max = exports.INSPECT_MAX_BYTES;
|
|
1475
|
+
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1476
|
+
if (this.length > max) str += " ... ";
|
|
1477
|
+
return "<Buffer " + str + ">";
|
|
1478
|
+
};
|
|
1479
|
+
if (customInspectSymbol) {
|
|
1480
|
+
Buffer4.prototype[customInspectSymbol] = Buffer4.prototype.inspect;
|
|
1481
|
+
}
|
|
1482
|
+
Buffer4.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1483
|
+
if (isInstance(target, Uint8Array)) {
|
|
1484
|
+
target = Buffer4.from(target, target.offset, target.byteLength);
|
|
1485
|
+
}
|
|
1486
|
+
if (!Buffer4.isBuffer(target)) {
|
|
1487
|
+
throw new TypeError(
|
|
1488
|
+
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
|
|
1489
|
+
);
|
|
1490
|
+
}
|
|
1491
|
+
if (start === void 0) {
|
|
1492
|
+
start = 0;
|
|
1493
|
+
}
|
|
1494
|
+
if (end === void 0) {
|
|
1495
|
+
end = target ? target.length : 0;
|
|
1496
|
+
}
|
|
1497
|
+
if (thisStart === void 0) {
|
|
1498
|
+
thisStart = 0;
|
|
1499
|
+
}
|
|
1500
|
+
if (thisEnd === void 0) {
|
|
1501
|
+
thisEnd = this.length;
|
|
1502
|
+
}
|
|
1503
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1504
|
+
throw new RangeError("out of range index");
|
|
1505
|
+
}
|
|
1506
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
1507
|
+
return 0;
|
|
1508
|
+
}
|
|
1509
|
+
if (thisStart >= thisEnd) {
|
|
1510
|
+
return -1;
|
|
1511
|
+
}
|
|
1512
|
+
if (start >= end) {
|
|
1513
|
+
return 1;
|
|
1514
|
+
}
|
|
1515
|
+
start >>>= 0;
|
|
1516
|
+
end >>>= 0;
|
|
1517
|
+
thisStart >>>= 0;
|
|
1518
|
+
thisEnd >>>= 0;
|
|
1519
|
+
if (this === target) return 0;
|
|
1520
|
+
let x = thisEnd - thisStart;
|
|
1521
|
+
let y = end - start;
|
|
1522
|
+
const len = Math.min(x, y);
|
|
1523
|
+
const thisCopy = this.slice(thisStart, thisEnd);
|
|
1524
|
+
const targetCopy = target.slice(start, end);
|
|
1525
|
+
for (let i = 0; i < len; ++i) {
|
|
1526
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
1527
|
+
x = thisCopy[i];
|
|
1528
|
+
y = targetCopy[i];
|
|
1529
|
+
break;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
if (x < y) return -1;
|
|
1533
|
+
if (y < x) return 1;
|
|
1534
|
+
return 0;
|
|
1535
|
+
};
|
|
1536
|
+
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1537
|
+
if (buffer.length === 0) return -1;
|
|
1538
|
+
if (typeof byteOffset === "string") {
|
|
1539
|
+
encoding = byteOffset;
|
|
1540
|
+
byteOffset = 0;
|
|
1541
|
+
} else if (byteOffset > 2147483647) {
|
|
1542
|
+
byteOffset = 2147483647;
|
|
1543
|
+
} else if (byteOffset < -2147483648) {
|
|
1544
|
+
byteOffset = -2147483648;
|
|
1545
|
+
}
|
|
1546
|
+
byteOffset = +byteOffset;
|
|
1547
|
+
if (numberIsNaN(byteOffset)) {
|
|
1548
|
+
byteOffset = dir ? 0 : buffer.length - 1;
|
|
1549
|
+
}
|
|
1550
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1551
|
+
if (byteOffset >= buffer.length) {
|
|
1552
|
+
if (dir) return -1;
|
|
1553
|
+
else byteOffset = buffer.length - 1;
|
|
1554
|
+
} else if (byteOffset < 0) {
|
|
1555
|
+
if (dir) byteOffset = 0;
|
|
1556
|
+
else return -1;
|
|
1557
|
+
}
|
|
1558
|
+
if (typeof val === "string") {
|
|
1559
|
+
val = Buffer4.from(val, encoding);
|
|
1560
|
+
}
|
|
1561
|
+
if (Buffer4.isBuffer(val)) {
|
|
1562
|
+
if (val.length === 0) {
|
|
1563
|
+
return -1;
|
|
1564
|
+
}
|
|
1565
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
1566
|
+
} else if (typeof val === "number") {
|
|
1567
|
+
val = val & 255;
|
|
1568
|
+
if (typeof Uint8Array.prototype.indexOf === "function") {
|
|
1569
|
+
if (dir) {
|
|
1570
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
1571
|
+
} else {
|
|
1572
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
1576
|
+
}
|
|
1577
|
+
throw new TypeError("val must be string, number or Buffer");
|
|
1578
|
+
}
|
|
1579
|
+
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
1580
|
+
let indexSize = 1;
|
|
1581
|
+
let arrLength = arr.length;
|
|
1582
|
+
let valLength = val.length;
|
|
1583
|
+
if (encoding !== void 0) {
|
|
1584
|
+
encoding = String(encoding).toLowerCase();
|
|
1585
|
+
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
1586
|
+
if (arr.length < 2 || val.length < 2) {
|
|
1587
|
+
return -1;
|
|
1588
|
+
}
|
|
1589
|
+
indexSize = 2;
|
|
1590
|
+
arrLength /= 2;
|
|
1591
|
+
valLength /= 2;
|
|
1592
|
+
byteOffset /= 2;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
function read(buf, i2) {
|
|
1596
|
+
if (indexSize === 1) {
|
|
1597
|
+
return buf[i2];
|
|
1598
|
+
} else {
|
|
1599
|
+
return buf.readUInt16BE(i2 * indexSize);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
let i;
|
|
1603
|
+
if (dir) {
|
|
1604
|
+
let foundIndex = -1;
|
|
1605
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
1606
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1607
|
+
if (foundIndex === -1) foundIndex = i;
|
|
1608
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
1609
|
+
} else {
|
|
1610
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1611
|
+
foundIndex = -1;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
} else {
|
|
1615
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1616
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
1617
|
+
let found = true;
|
|
1618
|
+
for (let j = 0; j < valLength; j++) {
|
|
1619
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
1620
|
+
found = false;
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
if (found) return i;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
return -1;
|
|
1628
|
+
}
|
|
1629
|
+
Buffer4.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1630
|
+
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1631
|
+
};
|
|
1632
|
+
Buffer4.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1633
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1634
|
+
};
|
|
1635
|
+
Buffer4.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1636
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1637
|
+
};
|
|
1638
|
+
function hexWrite(buf, string, offset, length) {
|
|
1639
|
+
offset = Number(offset) || 0;
|
|
1640
|
+
const remaining = buf.length - offset;
|
|
1641
|
+
if (!length) {
|
|
1642
|
+
length = remaining;
|
|
1643
|
+
} else {
|
|
1644
|
+
length = Number(length);
|
|
1645
|
+
if (length > remaining) {
|
|
1646
|
+
length = remaining;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
const strLen = string.length;
|
|
1650
|
+
if (length > strLen / 2) {
|
|
1651
|
+
length = strLen / 2;
|
|
1652
|
+
}
|
|
1653
|
+
let i;
|
|
1654
|
+
for (i = 0; i < length; ++i) {
|
|
1655
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1656
|
+
if (numberIsNaN(parsed)) return i;
|
|
1657
|
+
buf[offset + i] = parsed;
|
|
1658
|
+
}
|
|
1659
|
+
return i;
|
|
1660
|
+
}
|
|
1661
|
+
function utf8Write(buf, string, offset, length) {
|
|
1662
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
1663
|
+
}
|
|
1664
|
+
function asciiWrite(buf, string, offset, length) {
|
|
1665
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
1666
|
+
}
|
|
1667
|
+
function base64Write(buf, string, offset, length) {
|
|
1668
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
1669
|
+
}
|
|
1670
|
+
function ucs2Write(buf, string, offset, length) {
|
|
1671
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1672
|
+
}
|
|
1673
|
+
Buffer4.prototype.write = function write(string, offset, length, encoding) {
|
|
1674
|
+
if (offset === void 0) {
|
|
1675
|
+
encoding = "utf8";
|
|
1676
|
+
length = this.length;
|
|
1677
|
+
offset = 0;
|
|
1678
|
+
} else if (length === void 0 && typeof offset === "string") {
|
|
1679
|
+
encoding = offset;
|
|
1680
|
+
length = this.length;
|
|
1681
|
+
offset = 0;
|
|
1682
|
+
} else if (isFinite(offset)) {
|
|
1683
|
+
offset = offset >>> 0;
|
|
1684
|
+
if (isFinite(length)) {
|
|
1685
|
+
length = length >>> 0;
|
|
1686
|
+
if (encoding === void 0) encoding = "utf8";
|
|
1687
|
+
} else {
|
|
1688
|
+
encoding = length;
|
|
1689
|
+
length = void 0;
|
|
1690
|
+
}
|
|
1691
|
+
} else {
|
|
1692
|
+
throw new Error(
|
|
1693
|
+
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
const remaining = this.length - offset;
|
|
1697
|
+
if (length === void 0 || length > remaining) length = remaining;
|
|
1698
|
+
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1699
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1700
|
+
}
|
|
1701
|
+
if (!encoding) encoding = "utf8";
|
|
1702
|
+
let loweredCase = false;
|
|
1703
|
+
for (; ; ) {
|
|
1704
|
+
switch (encoding) {
|
|
1705
|
+
case "hex":
|
|
1706
|
+
return hexWrite(this, string, offset, length);
|
|
1707
|
+
case "utf8":
|
|
1708
|
+
case "utf-8":
|
|
1709
|
+
return utf8Write(this, string, offset, length);
|
|
1710
|
+
case "ascii":
|
|
1711
|
+
case "latin1":
|
|
1712
|
+
case "binary":
|
|
1713
|
+
return asciiWrite(this, string, offset, length);
|
|
1714
|
+
case "base64":
|
|
1715
|
+
return base64Write(this, string, offset, length);
|
|
1716
|
+
case "ucs2":
|
|
1717
|
+
case "ucs-2":
|
|
1718
|
+
case "utf16le":
|
|
1719
|
+
case "utf-16le":
|
|
1720
|
+
return ucs2Write(this, string, offset, length);
|
|
1721
|
+
default:
|
|
1722
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1723
|
+
encoding = ("" + encoding).toLowerCase();
|
|
1724
|
+
loweredCase = true;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
Buffer4.prototype.toJSON = function toJSON() {
|
|
1729
|
+
return {
|
|
1730
|
+
type: "Buffer",
|
|
1731
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
function base64Slice(buf, start, end) {
|
|
1735
|
+
if (start === 0 && end === buf.length) {
|
|
1736
|
+
return base64.fromByteArray(buf);
|
|
1737
|
+
} else {
|
|
1738
|
+
return base64.fromByteArray(buf.slice(start, end));
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
function utf8Slice(buf, start, end) {
|
|
1742
|
+
end = Math.min(buf.length, end);
|
|
1743
|
+
const res = [];
|
|
1744
|
+
let i = start;
|
|
1745
|
+
while (i < end) {
|
|
1746
|
+
const firstByte = buf[i];
|
|
1747
|
+
let codePoint = null;
|
|
1748
|
+
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
1749
|
+
if (i + bytesPerSequence <= end) {
|
|
1750
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
1751
|
+
switch (bytesPerSequence) {
|
|
1752
|
+
case 1:
|
|
1753
|
+
if (firstByte < 128) {
|
|
1754
|
+
codePoint = firstByte;
|
|
1755
|
+
}
|
|
1756
|
+
break;
|
|
1757
|
+
case 2:
|
|
1758
|
+
secondByte = buf[i + 1];
|
|
1759
|
+
if ((secondByte & 192) === 128) {
|
|
1760
|
+
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
1761
|
+
if (tempCodePoint > 127) {
|
|
1762
|
+
codePoint = tempCodePoint;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
break;
|
|
1766
|
+
case 3:
|
|
1767
|
+
secondByte = buf[i + 1];
|
|
1768
|
+
thirdByte = buf[i + 2];
|
|
1769
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
1770
|
+
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
1771
|
+
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
1772
|
+
codePoint = tempCodePoint;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
break;
|
|
1776
|
+
case 4:
|
|
1777
|
+
secondByte = buf[i + 1];
|
|
1778
|
+
thirdByte = buf[i + 2];
|
|
1779
|
+
fourthByte = buf[i + 3];
|
|
1780
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
1781
|
+
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
1782
|
+
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
1783
|
+
codePoint = tempCodePoint;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
if (codePoint === null) {
|
|
1789
|
+
codePoint = 65533;
|
|
1790
|
+
bytesPerSequence = 1;
|
|
1791
|
+
} else if (codePoint > 65535) {
|
|
1792
|
+
codePoint -= 65536;
|
|
1793
|
+
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
1794
|
+
codePoint = 56320 | codePoint & 1023;
|
|
1795
|
+
}
|
|
1796
|
+
res.push(codePoint);
|
|
1797
|
+
i += bytesPerSequence;
|
|
1798
|
+
}
|
|
1799
|
+
return decodeCodePointsArray(res);
|
|
1800
|
+
}
|
|
1801
|
+
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
1802
|
+
function decodeCodePointsArray(codePoints) {
|
|
1803
|
+
const len = codePoints.length;
|
|
1804
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1805
|
+
return String.fromCharCode.apply(String, codePoints);
|
|
1806
|
+
}
|
|
1807
|
+
let res = "";
|
|
1808
|
+
let i = 0;
|
|
1809
|
+
while (i < len) {
|
|
1810
|
+
res += String.fromCharCode.apply(
|
|
1811
|
+
String,
|
|
1812
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1815
|
+
return res;
|
|
1816
|
+
}
|
|
1817
|
+
function asciiSlice(buf, start, end) {
|
|
1818
|
+
let ret = "";
|
|
1819
|
+
end = Math.min(buf.length, end);
|
|
1820
|
+
for (let i = start; i < end; ++i) {
|
|
1821
|
+
ret += String.fromCharCode(buf[i] & 127);
|
|
1822
|
+
}
|
|
1823
|
+
return ret;
|
|
1824
|
+
}
|
|
1825
|
+
function latin1Slice(buf, start, end) {
|
|
1826
|
+
let ret = "";
|
|
1827
|
+
end = Math.min(buf.length, end);
|
|
1828
|
+
for (let i = start; i < end; ++i) {
|
|
1829
|
+
ret += String.fromCharCode(buf[i]);
|
|
1830
|
+
}
|
|
1831
|
+
return ret;
|
|
1832
|
+
}
|
|
1833
|
+
function hexSlice(buf, start, end) {
|
|
1834
|
+
const len = buf.length;
|
|
1835
|
+
if (!start || start < 0) start = 0;
|
|
1836
|
+
if (!end || end < 0 || end > len) end = len;
|
|
1837
|
+
let out = "";
|
|
1838
|
+
for (let i = start; i < end; ++i) {
|
|
1839
|
+
out += hexSliceLookupTable[buf[i]];
|
|
1840
|
+
}
|
|
1841
|
+
return out;
|
|
1842
|
+
}
|
|
1843
|
+
function utf16leSlice(buf, start, end) {
|
|
1844
|
+
const bytes = buf.slice(start, end);
|
|
1845
|
+
let res = "";
|
|
1846
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
|
1847
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
1848
|
+
}
|
|
1849
|
+
return res;
|
|
1850
|
+
}
|
|
1851
|
+
Buffer4.prototype.slice = function slice(start, end) {
|
|
1852
|
+
const len = this.length;
|
|
1853
|
+
start = ~~start;
|
|
1854
|
+
end = end === void 0 ? len : ~~end;
|
|
1855
|
+
if (start < 0) {
|
|
1856
|
+
start += len;
|
|
1857
|
+
if (start < 0) start = 0;
|
|
1858
|
+
} else if (start > len) {
|
|
1859
|
+
start = len;
|
|
1860
|
+
}
|
|
1861
|
+
if (end < 0) {
|
|
1862
|
+
end += len;
|
|
1863
|
+
if (end < 0) end = 0;
|
|
1864
|
+
} else if (end > len) {
|
|
1865
|
+
end = len;
|
|
1866
|
+
}
|
|
1867
|
+
if (end < start) end = start;
|
|
1868
|
+
const newBuf = this.subarray(start, end);
|
|
1869
|
+
Object.setPrototypeOf(newBuf, Buffer4.prototype);
|
|
1870
|
+
return newBuf;
|
|
1871
|
+
};
|
|
1872
|
+
function checkOffset(offset, ext, length) {
|
|
1873
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1874
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1875
|
+
}
|
|
1876
|
+
Buffer4.prototype.readUintLE = Buffer4.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
|
|
1877
|
+
offset = offset >>> 0;
|
|
1878
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1879
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1880
|
+
let val = this[offset];
|
|
1881
|
+
let mul = 1;
|
|
1882
|
+
let i = 0;
|
|
1883
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
1884
|
+
val += this[offset + i] * mul;
|
|
1885
|
+
}
|
|
1886
|
+
return val;
|
|
1887
|
+
};
|
|
1888
|
+
Buffer4.prototype.readUintBE = Buffer4.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
|
|
1889
|
+
offset = offset >>> 0;
|
|
1890
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1891
|
+
if (!noAssert) {
|
|
1892
|
+
checkOffset(offset, byteLength2, this.length);
|
|
1893
|
+
}
|
|
1894
|
+
let val = this[offset + --byteLength2];
|
|
1895
|
+
let mul = 1;
|
|
1896
|
+
while (byteLength2 > 0 && (mul *= 256)) {
|
|
1897
|
+
val += this[offset + --byteLength2] * mul;
|
|
1898
|
+
}
|
|
1899
|
+
return val;
|
|
1900
|
+
};
|
|
1901
|
+
Buffer4.prototype.readUint8 = Buffer4.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1902
|
+
offset = offset >>> 0;
|
|
1903
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1904
|
+
return this[offset];
|
|
1905
|
+
};
|
|
1906
|
+
Buffer4.prototype.readUint16LE = Buffer4.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1907
|
+
offset = offset >>> 0;
|
|
1908
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1909
|
+
return this[offset] | this[offset + 1] << 8;
|
|
1910
|
+
};
|
|
1911
|
+
Buffer4.prototype.readUint16BE = Buffer4.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1912
|
+
offset = offset >>> 0;
|
|
1913
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1914
|
+
return this[offset] << 8 | this[offset + 1];
|
|
1915
|
+
};
|
|
1916
|
+
Buffer4.prototype.readUint32LE = Buffer4.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1917
|
+
offset = offset >>> 0;
|
|
1918
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1919
|
+
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1920
|
+
};
|
|
1921
|
+
Buffer4.prototype.readUint32BE = Buffer4.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1922
|
+
offset = offset >>> 0;
|
|
1923
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1924
|
+
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1925
|
+
};
|
|
1926
|
+
Buffer4.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
1927
|
+
offset = offset >>> 0;
|
|
1928
|
+
validateNumber(offset, "offset");
|
|
1929
|
+
const first = this[offset];
|
|
1930
|
+
const last = this[offset + 7];
|
|
1931
|
+
if (first === void 0 || last === void 0) {
|
|
1932
|
+
boundsError(offset, this.length - 8);
|
|
1933
|
+
}
|
|
1934
|
+
const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
|
|
1935
|
+
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
|
|
1936
|
+
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
1937
|
+
});
|
|
1938
|
+
Buffer4.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
1939
|
+
offset = offset >>> 0;
|
|
1940
|
+
validateNumber(offset, "offset");
|
|
1941
|
+
const first = this[offset];
|
|
1942
|
+
const last = this[offset + 7];
|
|
1943
|
+
if (first === void 0 || last === void 0) {
|
|
1944
|
+
boundsError(offset, this.length - 8);
|
|
1945
|
+
}
|
|
1946
|
+
const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
1947
|
+
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
|
1948
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
1949
|
+
});
|
|
1950
|
+
Buffer4.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
|
|
1951
|
+
offset = offset >>> 0;
|
|
1952
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1953
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1954
|
+
let val = this[offset];
|
|
1955
|
+
let mul = 1;
|
|
1956
|
+
let i = 0;
|
|
1957
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
1958
|
+
val += this[offset + i] * mul;
|
|
1959
|
+
}
|
|
1960
|
+
mul *= 128;
|
|
1961
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1962
|
+
return val;
|
|
1963
|
+
};
|
|
1964
|
+
Buffer4.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
|
|
1965
|
+
offset = offset >>> 0;
|
|
1966
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1967
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1968
|
+
let i = byteLength2;
|
|
1969
|
+
let mul = 1;
|
|
1970
|
+
let val = this[offset + --i];
|
|
1971
|
+
while (i > 0 && (mul *= 256)) {
|
|
1972
|
+
val += this[offset + --i] * mul;
|
|
1973
|
+
}
|
|
1974
|
+
mul *= 128;
|
|
1975
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
1976
|
+
return val;
|
|
1977
|
+
};
|
|
1978
|
+
Buffer4.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1979
|
+
offset = offset >>> 0;
|
|
1980
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1981
|
+
if (!(this[offset] & 128)) return this[offset];
|
|
1982
|
+
return (255 - this[offset] + 1) * -1;
|
|
1983
|
+
};
|
|
1984
|
+
Buffer4.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1985
|
+
offset = offset >>> 0;
|
|
1986
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1987
|
+
const val = this[offset] | this[offset + 1] << 8;
|
|
1988
|
+
return val & 32768 ? val | 4294901760 : val;
|
|
1989
|
+
};
|
|
1990
|
+
Buffer4.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1991
|
+
offset = offset >>> 0;
|
|
1992
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1993
|
+
const val = this[offset + 1] | this[offset] << 8;
|
|
1994
|
+
return val & 32768 ? val | 4294901760 : val;
|
|
1995
|
+
};
|
|
1996
|
+
Buffer4.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1997
|
+
offset = offset >>> 0;
|
|
1998
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1999
|
+
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
2000
|
+
};
|
|
2001
|
+
Buffer4.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
2002
|
+
offset = offset >>> 0;
|
|
2003
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2004
|
+
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
2005
|
+
};
|
|
2006
|
+
Buffer4.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
2007
|
+
offset = offset >>> 0;
|
|
2008
|
+
validateNumber(offset, "offset");
|
|
2009
|
+
const first = this[offset];
|
|
2010
|
+
const last = this[offset + 7];
|
|
2011
|
+
if (first === void 0 || last === void 0) {
|
|
2012
|
+
boundsError(offset, this.length - 8);
|
|
2013
|
+
}
|
|
2014
|
+
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
|
|
2015
|
+
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
|
|
2016
|
+
});
|
|
2017
|
+
Buffer4.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
2018
|
+
offset = offset >>> 0;
|
|
2019
|
+
validateNumber(offset, "offset");
|
|
2020
|
+
const first = this[offset];
|
|
2021
|
+
const last = this[offset + 7];
|
|
2022
|
+
if (first === void 0 || last === void 0) {
|
|
2023
|
+
boundsError(offset, this.length - 8);
|
|
2024
|
+
}
|
|
2025
|
+
const val = (first << 24) + // Overflow
|
|
2026
|
+
this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
2027
|
+
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
|
|
2028
|
+
});
|
|
2029
|
+
Buffer4.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
2030
|
+
offset = offset >>> 0;
|
|
2031
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2032
|
+
return ieee754.read(this, offset, true, 23, 4);
|
|
2033
|
+
};
|
|
2034
|
+
Buffer4.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2035
|
+
offset = offset >>> 0;
|
|
2036
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2037
|
+
return ieee754.read(this, offset, false, 23, 4);
|
|
2038
|
+
};
|
|
2039
|
+
Buffer4.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2040
|
+
offset = offset >>> 0;
|
|
2041
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2042
|
+
return ieee754.read(this, offset, true, 52, 8);
|
|
2043
|
+
};
|
|
2044
|
+
Buffer4.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2045
|
+
offset = offset >>> 0;
|
|
2046
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2047
|
+
return ieee754.read(this, offset, false, 52, 8);
|
|
2048
|
+
};
|
|
2049
|
+
function checkInt(buf, value, offset, ext, max, min) {
|
|
2050
|
+
if (!Buffer4.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
2051
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
2052
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2053
|
+
}
|
|
2054
|
+
Buffer4.prototype.writeUintLE = Buffer4.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
|
|
2055
|
+
value = +value;
|
|
2056
|
+
offset = offset >>> 0;
|
|
2057
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2058
|
+
if (!noAssert) {
|
|
2059
|
+
const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
2060
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
2061
|
+
}
|
|
2062
|
+
let mul = 1;
|
|
2063
|
+
let i = 0;
|
|
2064
|
+
this[offset] = value & 255;
|
|
2065
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
2066
|
+
this[offset + i] = value / mul & 255;
|
|
2067
|
+
}
|
|
2068
|
+
return offset + byteLength2;
|
|
2069
|
+
};
|
|
2070
|
+
Buffer4.prototype.writeUintBE = Buffer4.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
|
|
2071
|
+
value = +value;
|
|
2072
|
+
offset = offset >>> 0;
|
|
2073
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2074
|
+
if (!noAssert) {
|
|
2075
|
+
const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
2076
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
2077
|
+
}
|
|
2078
|
+
let i = byteLength2 - 1;
|
|
2079
|
+
let mul = 1;
|
|
2080
|
+
this[offset + i] = value & 255;
|
|
2081
|
+
while (--i >= 0 && (mul *= 256)) {
|
|
2082
|
+
this[offset + i] = value / mul & 255;
|
|
2083
|
+
}
|
|
2084
|
+
return offset + byteLength2;
|
|
2085
|
+
};
|
|
2086
|
+
Buffer4.prototype.writeUint8 = Buffer4.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2087
|
+
value = +value;
|
|
2088
|
+
offset = offset >>> 0;
|
|
2089
|
+
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
2090
|
+
this[offset] = value & 255;
|
|
2091
|
+
return offset + 1;
|
|
2092
|
+
};
|
|
2093
|
+
Buffer4.prototype.writeUint16LE = Buffer4.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2094
|
+
value = +value;
|
|
2095
|
+
offset = offset >>> 0;
|
|
2096
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2097
|
+
this[offset] = value & 255;
|
|
2098
|
+
this[offset + 1] = value >>> 8;
|
|
2099
|
+
return offset + 2;
|
|
2100
|
+
};
|
|
2101
|
+
Buffer4.prototype.writeUint16BE = Buffer4.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2102
|
+
value = +value;
|
|
2103
|
+
offset = offset >>> 0;
|
|
2104
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2105
|
+
this[offset] = value >>> 8;
|
|
2106
|
+
this[offset + 1] = value & 255;
|
|
2107
|
+
return offset + 2;
|
|
2108
|
+
};
|
|
2109
|
+
Buffer4.prototype.writeUint32LE = Buffer4.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2110
|
+
value = +value;
|
|
2111
|
+
offset = offset >>> 0;
|
|
2112
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2113
|
+
this[offset + 3] = value >>> 24;
|
|
2114
|
+
this[offset + 2] = value >>> 16;
|
|
2115
|
+
this[offset + 1] = value >>> 8;
|
|
2116
|
+
this[offset] = value & 255;
|
|
2117
|
+
return offset + 4;
|
|
2118
|
+
};
|
|
2119
|
+
Buffer4.prototype.writeUint32BE = Buffer4.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2120
|
+
value = +value;
|
|
2121
|
+
offset = offset >>> 0;
|
|
2122
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2123
|
+
this[offset] = value >>> 24;
|
|
2124
|
+
this[offset + 1] = value >>> 16;
|
|
2125
|
+
this[offset + 2] = value >>> 8;
|
|
2126
|
+
this[offset + 3] = value & 255;
|
|
2127
|
+
return offset + 4;
|
|
2128
|
+
};
|
|
2129
|
+
function wrtBigUInt64LE(buf, value, offset, min, max) {
|
|
2130
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
2131
|
+
let lo = Number(value & BigInt(4294967295));
|
|
2132
|
+
buf[offset++] = lo;
|
|
2133
|
+
lo = lo >> 8;
|
|
2134
|
+
buf[offset++] = lo;
|
|
2135
|
+
lo = lo >> 8;
|
|
2136
|
+
buf[offset++] = lo;
|
|
2137
|
+
lo = lo >> 8;
|
|
2138
|
+
buf[offset++] = lo;
|
|
2139
|
+
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
2140
|
+
buf[offset++] = hi;
|
|
2141
|
+
hi = hi >> 8;
|
|
2142
|
+
buf[offset++] = hi;
|
|
2143
|
+
hi = hi >> 8;
|
|
2144
|
+
buf[offset++] = hi;
|
|
2145
|
+
hi = hi >> 8;
|
|
2146
|
+
buf[offset++] = hi;
|
|
2147
|
+
return offset;
|
|
2148
|
+
}
|
|
2149
|
+
function wrtBigUInt64BE(buf, value, offset, min, max) {
|
|
2150
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
2151
|
+
let lo = Number(value & BigInt(4294967295));
|
|
2152
|
+
buf[offset + 7] = lo;
|
|
2153
|
+
lo = lo >> 8;
|
|
2154
|
+
buf[offset + 6] = lo;
|
|
2155
|
+
lo = lo >> 8;
|
|
2156
|
+
buf[offset + 5] = lo;
|
|
2157
|
+
lo = lo >> 8;
|
|
2158
|
+
buf[offset + 4] = lo;
|
|
2159
|
+
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
2160
|
+
buf[offset + 3] = hi;
|
|
2161
|
+
hi = hi >> 8;
|
|
2162
|
+
buf[offset + 2] = hi;
|
|
2163
|
+
hi = hi >> 8;
|
|
2164
|
+
buf[offset + 1] = hi;
|
|
2165
|
+
hi = hi >> 8;
|
|
2166
|
+
buf[offset] = hi;
|
|
2167
|
+
return offset + 8;
|
|
2168
|
+
}
|
|
2169
|
+
Buffer4.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
|
|
2170
|
+
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2171
|
+
});
|
|
2172
|
+
Buffer4.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
|
|
2173
|
+
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2174
|
+
});
|
|
2175
|
+
Buffer4.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
|
|
2176
|
+
value = +value;
|
|
2177
|
+
offset = offset >>> 0;
|
|
2178
|
+
if (!noAssert) {
|
|
2179
|
+
const limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
2180
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
2181
|
+
}
|
|
2182
|
+
let i = 0;
|
|
2183
|
+
let mul = 1;
|
|
2184
|
+
let sub = 0;
|
|
2185
|
+
this[offset] = value & 255;
|
|
2186
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
2187
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
2188
|
+
sub = 1;
|
|
2189
|
+
}
|
|
2190
|
+
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2191
|
+
}
|
|
2192
|
+
return offset + byteLength2;
|
|
2193
|
+
};
|
|
2194
|
+
Buffer4.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
|
|
2195
|
+
value = +value;
|
|
2196
|
+
offset = offset >>> 0;
|
|
2197
|
+
if (!noAssert) {
|
|
2198
|
+
const limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
2199
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
2200
|
+
}
|
|
2201
|
+
let i = byteLength2 - 1;
|
|
2202
|
+
let mul = 1;
|
|
2203
|
+
let sub = 0;
|
|
2204
|
+
this[offset + i] = value & 255;
|
|
2205
|
+
while (--i >= 0 && (mul *= 256)) {
|
|
2206
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
2207
|
+
sub = 1;
|
|
2208
|
+
}
|
|
2209
|
+
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2210
|
+
}
|
|
2211
|
+
return offset + byteLength2;
|
|
2212
|
+
};
|
|
2213
|
+
Buffer4.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2214
|
+
value = +value;
|
|
2215
|
+
offset = offset >>> 0;
|
|
2216
|
+
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
2217
|
+
if (value < 0) value = 255 + value + 1;
|
|
2218
|
+
this[offset] = value & 255;
|
|
2219
|
+
return offset + 1;
|
|
2220
|
+
};
|
|
2221
|
+
Buffer4.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2222
|
+
value = +value;
|
|
2223
|
+
offset = offset >>> 0;
|
|
2224
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2225
|
+
this[offset] = value & 255;
|
|
2226
|
+
this[offset + 1] = value >>> 8;
|
|
2227
|
+
return offset + 2;
|
|
2228
|
+
};
|
|
2229
|
+
Buffer4.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2230
|
+
value = +value;
|
|
2231
|
+
offset = offset >>> 0;
|
|
2232
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2233
|
+
this[offset] = value >>> 8;
|
|
2234
|
+
this[offset + 1] = value & 255;
|
|
2235
|
+
return offset + 2;
|
|
2236
|
+
};
|
|
2237
|
+
Buffer4.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2238
|
+
value = +value;
|
|
2239
|
+
offset = offset >>> 0;
|
|
2240
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2241
|
+
this[offset] = value & 255;
|
|
2242
|
+
this[offset + 1] = value >>> 8;
|
|
2243
|
+
this[offset + 2] = value >>> 16;
|
|
2244
|
+
this[offset + 3] = value >>> 24;
|
|
2245
|
+
return offset + 4;
|
|
2246
|
+
};
|
|
2247
|
+
Buffer4.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2248
|
+
value = +value;
|
|
2249
|
+
offset = offset >>> 0;
|
|
2250
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2251
|
+
if (value < 0) value = 4294967295 + value + 1;
|
|
2252
|
+
this[offset] = value >>> 24;
|
|
2253
|
+
this[offset + 1] = value >>> 16;
|
|
2254
|
+
this[offset + 2] = value >>> 8;
|
|
2255
|
+
this[offset + 3] = value & 255;
|
|
2256
|
+
return offset + 4;
|
|
2257
|
+
};
|
|
2258
|
+
Buffer4.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
|
|
2259
|
+
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2260
|
+
});
|
|
2261
|
+
Buffer4.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
|
|
2262
|
+
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2263
|
+
});
|
|
2264
|
+
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
2265
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2266
|
+
if (offset < 0) throw new RangeError("Index out of range");
|
|
2267
|
+
}
|
|
2268
|
+
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
2269
|
+
value = +value;
|
|
2270
|
+
offset = offset >>> 0;
|
|
2271
|
+
if (!noAssert) {
|
|
2272
|
+
checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
|
|
2273
|
+
}
|
|
2274
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
2275
|
+
return offset + 4;
|
|
2276
|
+
}
|
|
2277
|
+
Buffer4.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
2278
|
+
return writeFloat(this, value, offset, true, noAssert);
|
|
2279
|
+
};
|
|
2280
|
+
Buffer4.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
2281
|
+
return writeFloat(this, value, offset, false, noAssert);
|
|
2282
|
+
};
|
|
2283
|
+
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
2284
|
+
value = +value;
|
|
2285
|
+
offset = offset >>> 0;
|
|
2286
|
+
if (!noAssert) {
|
|
2287
|
+
checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
|
|
2288
|
+
}
|
|
2289
|
+
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
2290
|
+
return offset + 8;
|
|
2291
|
+
}
|
|
2292
|
+
Buffer4.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
2293
|
+
return writeDouble(this, value, offset, true, noAssert);
|
|
2294
|
+
};
|
|
2295
|
+
Buffer4.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
2296
|
+
return writeDouble(this, value, offset, false, noAssert);
|
|
2297
|
+
};
|
|
2298
|
+
Buffer4.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2299
|
+
if (!Buffer4.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
2300
|
+
if (!start) start = 0;
|
|
2301
|
+
if (!end && end !== 0) end = this.length;
|
|
2302
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
2303
|
+
if (!targetStart) targetStart = 0;
|
|
2304
|
+
if (end > 0 && end < start) end = start;
|
|
2305
|
+
if (end === start) return 0;
|
|
2306
|
+
if (target.length === 0 || this.length === 0) return 0;
|
|
2307
|
+
if (targetStart < 0) {
|
|
2308
|
+
throw new RangeError("targetStart out of bounds");
|
|
2309
|
+
}
|
|
2310
|
+
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
2311
|
+
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
2312
|
+
if (end > this.length) end = this.length;
|
|
2313
|
+
if (target.length - targetStart < end - start) {
|
|
2314
|
+
end = target.length - targetStart + start;
|
|
2315
|
+
}
|
|
2316
|
+
const len = end - start;
|
|
2317
|
+
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
|
2318
|
+
this.copyWithin(targetStart, start, end);
|
|
2319
|
+
} else {
|
|
2320
|
+
Uint8Array.prototype.set.call(
|
|
2321
|
+
target,
|
|
2322
|
+
this.subarray(start, end),
|
|
2323
|
+
targetStart
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2326
|
+
return len;
|
|
2327
|
+
};
|
|
2328
|
+
Buffer4.prototype.fill = function fill(val, start, end, encoding) {
|
|
2329
|
+
if (typeof val === "string") {
|
|
2330
|
+
if (typeof start === "string") {
|
|
2331
|
+
encoding = start;
|
|
2332
|
+
start = 0;
|
|
2333
|
+
end = this.length;
|
|
2334
|
+
} else if (typeof end === "string") {
|
|
2335
|
+
encoding = end;
|
|
2336
|
+
end = this.length;
|
|
2337
|
+
}
|
|
2338
|
+
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
2339
|
+
throw new TypeError("encoding must be a string");
|
|
2340
|
+
}
|
|
2341
|
+
if (typeof encoding === "string" && !Buffer4.isEncoding(encoding)) {
|
|
2342
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
|
2343
|
+
}
|
|
2344
|
+
if (val.length === 1) {
|
|
2345
|
+
const code = val.charCodeAt(0);
|
|
2346
|
+
if (encoding === "utf8" && code < 128 || encoding === "latin1") {
|
|
2347
|
+
val = code;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
} else if (typeof val === "number") {
|
|
2351
|
+
val = val & 255;
|
|
2352
|
+
} else if (typeof val === "boolean") {
|
|
2353
|
+
val = Number(val);
|
|
2354
|
+
}
|
|
2355
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
2356
|
+
throw new RangeError("Out of range index");
|
|
2357
|
+
}
|
|
2358
|
+
if (end <= start) {
|
|
2359
|
+
return this;
|
|
2360
|
+
}
|
|
2361
|
+
start = start >>> 0;
|
|
2362
|
+
end = end === void 0 ? this.length : end >>> 0;
|
|
2363
|
+
if (!val) val = 0;
|
|
2364
|
+
let i;
|
|
2365
|
+
if (typeof val === "number") {
|
|
2366
|
+
for (i = start; i < end; ++i) {
|
|
2367
|
+
this[i] = val;
|
|
2368
|
+
}
|
|
2369
|
+
} else {
|
|
2370
|
+
const bytes = Buffer4.isBuffer(val) ? val : Buffer4.from(val, encoding);
|
|
2371
|
+
const len = bytes.length;
|
|
2372
|
+
if (len === 0) {
|
|
2373
|
+
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
2374
|
+
}
|
|
2375
|
+
for (i = 0; i < end - start; ++i) {
|
|
2376
|
+
this[i + start] = bytes[i % len];
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
return this;
|
|
2380
|
+
};
|
|
2381
|
+
var errors = {};
|
|
2382
|
+
function E(sym, getMessage, Base) {
|
|
2383
|
+
errors[sym] = class NodeError extends Base {
|
|
2384
|
+
constructor() {
|
|
2385
|
+
super();
|
|
2386
|
+
Object.defineProperty(this, "message", {
|
|
2387
|
+
value: getMessage.apply(this, arguments),
|
|
2388
|
+
writable: true,
|
|
2389
|
+
configurable: true
|
|
2390
|
+
});
|
|
2391
|
+
this.name = `${this.name} [${sym}]`;
|
|
2392
|
+
this.stack;
|
|
2393
|
+
delete this.name;
|
|
2394
|
+
}
|
|
2395
|
+
get code() {
|
|
2396
|
+
return sym;
|
|
2397
|
+
}
|
|
2398
|
+
set code(value) {
|
|
2399
|
+
Object.defineProperty(this, "code", {
|
|
2400
|
+
configurable: true,
|
|
2401
|
+
enumerable: true,
|
|
2402
|
+
value,
|
|
2403
|
+
writable: true
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
toString() {
|
|
2407
|
+
return `${this.name} [${sym}]: ${this.message}`;
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
E(
|
|
2412
|
+
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
2413
|
+
function(name) {
|
|
2414
|
+
if (name) {
|
|
2415
|
+
return `${name} is outside of buffer bounds`;
|
|
2416
|
+
}
|
|
2417
|
+
return "Attempt to access memory outside buffer bounds";
|
|
2418
|
+
},
|
|
2419
|
+
RangeError
|
|
2420
|
+
);
|
|
2421
|
+
E(
|
|
2422
|
+
"ERR_INVALID_ARG_TYPE",
|
|
2423
|
+
function(name, actual) {
|
|
2424
|
+
return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
|
|
2425
|
+
},
|
|
2426
|
+
TypeError
|
|
2427
|
+
);
|
|
2428
|
+
E(
|
|
2429
|
+
"ERR_OUT_OF_RANGE",
|
|
2430
|
+
function(str, range, input) {
|
|
2431
|
+
let msg = `The value of "${str}" is out of range.`;
|
|
2432
|
+
let received = input;
|
|
2433
|
+
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
|
2434
|
+
received = addNumericalSeparator(String(input));
|
|
2435
|
+
} else if (typeof input === "bigint") {
|
|
2436
|
+
received = String(input);
|
|
2437
|
+
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
|
2438
|
+
received = addNumericalSeparator(received);
|
|
2439
|
+
}
|
|
2440
|
+
received += "n";
|
|
2441
|
+
}
|
|
2442
|
+
msg += ` It must be ${range}. Received ${received}`;
|
|
2443
|
+
return msg;
|
|
2444
|
+
},
|
|
2445
|
+
RangeError
|
|
2446
|
+
);
|
|
2447
|
+
function addNumericalSeparator(val) {
|
|
2448
|
+
let res = "";
|
|
2449
|
+
let i = val.length;
|
|
2450
|
+
const start = val[0] === "-" ? 1 : 0;
|
|
2451
|
+
for (; i >= start + 4; i -= 3) {
|
|
2452
|
+
res = `_${val.slice(i - 3, i)}${res}`;
|
|
2453
|
+
}
|
|
2454
|
+
return `${val.slice(0, i)}${res}`;
|
|
2455
|
+
}
|
|
2456
|
+
function checkBounds(buf, offset, byteLength2) {
|
|
2457
|
+
validateNumber(offset, "offset");
|
|
2458
|
+
if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
|
|
2459
|
+
boundsError(offset, buf.length - (byteLength2 + 1));
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
function checkIntBI(value, min, max, buf, offset, byteLength2) {
|
|
2463
|
+
if (value > max || value < min) {
|
|
2464
|
+
const n = typeof min === "bigint" ? "n" : "";
|
|
2465
|
+
let range;
|
|
2466
|
+
if (byteLength2 > 3) {
|
|
2467
|
+
if (min === 0 || min === BigInt(0)) {
|
|
2468
|
+
range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
|
|
2469
|
+
} else {
|
|
2470
|
+
range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
|
|
2471
|
+
}
|
|
2472
|
+
} else {
|
|
2473
|
+
range = `>= ${min}${n} and <= ${max}${n}`;
|
|
2474
|
+
}
|
|
2475
|
+
throw new errors.ERR_OUT_OF_RANGE("value", range, value);
|
|
2476
|
+
}
|
|
2477
|
+
checkBounds(buf, offset, byteLength2);
|
|
2478
|
+
}
|
|
2479
|
+
function validateNumber(value, name) {
|
|
2480
|
+
if (typeof value !== "number") {
|
|
2481
|
+
throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function boundsError(value, length, type) {
|
|
2485
|
+
if (Math.floor(value) !== value) {
|
|
2486
|
+
validateNumber(value, type);
|
|
2487
|
+
throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);
|
|
2488
|
+
}
|
|
2489
|
+
if (length < 0) {
|
|
2490
|
+
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
|
|
2491
|
+
}
|
|
2492
|
+
throw new errors.ERR_OUT_OF_RANGE(
|
|
2493
|
+
type || "offset",
|
|
2494
|
+
`>= ${type ? 1 : 0} and <= ${length}`,
|
|
2495
|
+
value
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
2499
|
+
function base64clean(str) {
|
|
2500
|
+
str = str.split("=")[0];
|
|
2501
|
+
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
2502
|
+
if (str.length < 2) return "";
|
|
2503
|
+
while (str.length % 4 !== 0) {
|
|
2504
|
+
str = str + "=";
|
|
2505
|
+
}
|
|
2506
|
+
return str;
|
|
2507
|
+
}
|
|
2508
|
+
function utf8ToBytes(string, units) {
|
|
2509
|
+
units = units || Infinity;
|
|
2510
|
+
let codePoint;
|
|
2511
|
+
const length = string.length;
|
|
2512
|
+
let leadSurrogate = null;
|
|
2513
|
+
const bytes = [];
|
|
2514
|
+
for (let i = 0; i < length; ++i) {
|
|
2515
|
+
codePoint = string.charCodeAt(i);
|
|
2516
|
+
if (codePoint > 55295 && codePoint < 57344) {
|
|
2517
|
+
if (!leadSurrogate) {
|
|
2518
|
+
if (codePoint > 56319) {
|
|
2519
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2520
|
+
continue;
|
|
2521
|
+
} else if (i + 1 === length) {
|
|
2522
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2523
|
+
continue;
|
|
2524
|
+
}
|
|
2525
|
+
leadSurrogate = codePoint;
|
|
2526
|
+
continue;
|
|
2527
|
+
}
|
|
2528
|
+
if (codePoint < 56320) {
|
|
2529
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2530
|
+
leadSurrogate = codePoint;
|
|
2531
|
+
continue;
|
|
2532
|
+
}
|
|
2533
|
+
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
2534
|
+
} else if (leadSurrogate) {
|
|
2535
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2536
|
+
}
|
|
2537
|
+
leadSurrogate = null;
|
|
2538
|
+
if (codePoint < 128) {
|
|
2539
|
+
if ((units -= 1) < 0) break;
|
|
2540
|
+
bytes.push(codePoint);
|
|
2541
|
+
} else if (codePoint < 2048) {
|
|
2542
|
+
if ((units -= 2) < 0) break;
|
|
2543
|
+
bytes.push(
|
|
2544
|
+
codePoint >> 6 | 192,
|
|
2545
|
+
codePoint & 63 | 128
|
|
2546
|
+
);
|
|
2547
|
+
} else if (codePoint < 65536) {
|
|
2548
|
+
if ((units -= 3) < 0) break;
|
|
2549
|
+
bytes.push(
|
|
2550
|
+
codePoint >> 12 | 224,
|
|
2551
|
+
codePoint >> 6 & 63 | 128,
|
|
2552
|
+
codePoint & 63 | 128
|
|
2553
|
+
);
|
|
2554
|
+
} else if (codePoint < 1114112) {
|
|
2555
|
+
if ((units -= 4) < 0) break;
|
|
2556
|
+
bytes.push(
|
|
2557
|
+
codePoint >> 18 | 240,
|
|
2558
|
+
codePoint >> 12 & 63 | 128,
|
|
2559
|
+
codePoint >> 6 & 63 | 128,
|
|
2560
|
+
codePoint & 63 | 128
|
|
2561
|
+
);
|
|
2562
|
+
} else {
|
|
2563
|
+
throw new Error("Invalid code point");
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
return bytes;
|
|
2567
|
+
}
|
|
2568
|
+
function asciiToBytes(str) {
|
|
2569
|
+
const byteArray = [];
|
|
2570
|
+
for (let i = 0; i < str.length; ++i) {
|
|
2571
|
+
byteArray.push(str.charCodeAt(i) & 255);
|
|
2572
|
+
}
|
|
2573
|
+
return byteArray;
|
|
2574
|
+
}
|
|
2575
|
+
function utf16leToBytes(str, units) {
|
|
2576
|
+
let c, hi, lo;
|
|
2577
|
+
const byteArray = [];
|
|
2578
|
+
for (let i = 0; i < str.length; ++i) {
|
|
2579
|
+
if ((units -= 2) < 0) break;
|
|
2580
|
+
c = str.charCodeAt(i);
|
|
2581
|
+
hi = c >> 8;
|
|
2582
|
+
lo = c % 256;
|
|
2583
|
+
byteArray.push(lo);
|
|
2584
|
+
byteArray.push(hi);
|
|
2585
|
+
}
|
|
2586
|
+
return byteArray;
|
|
2587
|
+
}
|
|
2588
|
+
function base64ToBytes(str) {
|
|
2589
|
+
return base64.toByteArray(base64clean(str));
|
|
2590
|
+
}
|
|
2591
|
+
function blitBuffer(src, dst, offset, length) {
|
|
2592
|
+
let i;
|
|
2593
|
+
for (i = 0; i < length; ++i) {
|
|
2594
|
+
if (i + offset >= dst.length || i >= src.length) break;
|
|
2595
|
+
dst[i + offset] = src[i];
|
|
2596
|
+
}
|
|
2597
|
+
return i;
|
|
2598
|
+
}
|
|
2599
|
+
function isInstance(obj, type) {
|
|
2600
|
+
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
|
2601
|
+
}
|
|
2602
|
+
function numberIsNaN(obj) {
|
|
2603
|
+
return obj !== obj;
|
|
2604
|
+
}
|
|
2605
|
+
var hexSliceLookupTable = (function() {
|
|
2606
|
+
const alphabet = "0123456789abcdef";
|
|
2607
|
+
const table = new Array(256);
|
|
2608
|
+
for (let i = 0; i < 16; ++i) {
|
|
2609
|
+
const i16 = i * 16;
|
|
2610
|
+
for (let j = 0; j < 16; ++j) {
|
|
2611
|
+
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
return table;
|
|
2615
|
+
})();
|
|
2616
|
+
function defineBigIntMethod(fn) {
|
|
2617
|
+
return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
|
|
2618
|
+
}
|
|
2619
|
+
function BufferBigIntNotDefined() {
|
|
2620
|
+
throw new Error("BigInt not supported");
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
|
|
849
2625
|
// node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_arrayFilter.js
|
|
850
2626
|
var require_arrayFilter = __commonJS({
|
|
851
2627
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_arrayFilter.js"(exports, module2) {
|
|
@@ -953,8 +2729,8 @@ var require_isBuffer = __commonJS({
|
|
|
953
2729
|
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
954
2730
|
var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
|
|
955
2731
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
956
|
-
var
|
|
957
|
-
var nativeIsBuffer =
|
|
2732
|
+
var Buffer4 = moduleExports ? root.Buffer : void 0;
|
|
2733
|
+
var nativeIsBuffer = Buffer4 ? Buffer4.isBuffer : void 0;
|
|
958
2734
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
959
2735
|
module2.exports = isBuffer;
|
|
960
2736
|
}
|
|
@@ -1076,14 +2852,14 @@ var require_arrayLikeKeys = __commonJS({
|
|
|
1076
2852
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_arrayLikeKeys.js"(exports, module2) {
|
|
1077
2853
|
var baseTimes = require_baseTimes();
|
|
1078
2854
|
var isArguments = require_isArguments();
|
|
1079
|
-
var
|
|
2855
|
+
var isArray2 = require_isArray();
|
|
1080
2856
|
var isBuffer = require_isBuffer();
|
|
1081
2857
|
var isIndex = require_isIndex();
|
|
1082
2858
|
var isTypedArray = require_isTypedArray();
|
|
1083
2859
|
var objectProto = Object.prototype;
|
|
1084
2860
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1085
2861
|
function arrayLikeKeys(value, inherited) {
|
|
1086
|
-
var isArr =
|
|
2862
|
+
var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
1087
2863
|
for (var key in value) {
|
|
1088
2864
|
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1089
2865
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -1587,10 +3363,10 @@ var require_arrayPush = __commonJS({
|
|
|
1587
3363
|
var require_baseGetAllKeys = __commonJS({
|
|
1588
3364
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGetAllKeys.js"(exports, module2) {
|
|
1589
3365
|
var arrayPush = require_arrayPush();
|
|
1590
|
-
var
|
|
3366
|
+
var isArray2 = require_isArray();
|
|
1591
3367
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1592
3368
|
var result = keysFunc(object);
|
|
1593
|
-
return
|
|
3369
|
+
return isArray2(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1594
3370
|
}
|
|
1595
3371
|
module2.exports = baseGetAllKeys;
|
|
1596
3372
|
}
|
|
@@ -1788,7 +3564,7 @@ var require_baseIsEqualDeep = __commonJS({
|
|
|
1788
3564
|
var equalByTag = require_equalByTag();
|
|
1789
3565
|
var equalObjects = require_equalObjects();
|
|
1790
3566
|
var getTag = require_getTag();
|
|
1791
|
-
var
|
|
3567
|
+
var isArray2 = require_isArray();
|
|
1792
3568
|
var isBuffer = require_isBuffer();
|
|
1793
3569
|
var isTypedArray = require_isTypedArray();
|
|
1794
3570
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
@@ -1798,7 +3574,7 @@ var require_baseIsEqualDeep = __commonJS({
|
|
|
1798
3574
|
var objectProto = Object.prototype;
|
|
1799
3575
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1800
3576
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1801
|
-
var objIsArr =
|
|
3577
|
+
var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
1802
3578
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1803
3579
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1804
3580
|
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
@@ -1968,7 +3744,7 @@ var require_hasPath = __commonJS({
|
|
|
1968
3744
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_hasPath.js"(exports, module2) {
|
|
1969
3745
|
var castPath = require_castPath();
|
|
1970
3746
|
var isArguments = require_isArguments();
|
|
1971
|
-
var
|
|
3747
|
+
var isArray2 = require_isArray();
|
|
1972
3748
|
var isIndex = require_isIndex();
|
|
1973
3749
|
var isLength = require_isLength();
|
|
1974
3750
|
var toKey = require_toKey();
|
|
@@ -1986,7 +3762,7 @@ var require_hasPath = __commonJS({
|
|
|
1986
3762
|
return result;
|
|
1987
3763
|
}
|
|
1988
3764
|
length = object == null ? 0 : object.length;
|
|
1989
|
-
return !!length && isLength(length) && isIndex(key, length) && (
|
|
3765
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
|
|
1990
3766
|
}
|
|
1991
3767
|
module2.exports = hasPath;
|
|
1992
3768
|
}
|
|
@@ -2084,7 +3860,7 @@ var require_baseIteratee = __commonJS({
|
|
|
2084
3860
|
var baseMatches = require_baseMatches();
|
|
2085
3861
|
var baseMatchesProperty = require_baseMatchesProperty();
|
|
2086
3862
|
var identity = require_identity();
|
|
2087
|
-
var
|
|
3863
|
+
var isArray2 = require_isArray();
|
|
2088
3864
|
var property = require_property();
|
|
2089
3865
|
function baseIteratee(value) {
|
|
2090
3866
|
if (typeof value == "function") {
|
|
@@ -2094,7 +3870,7 @@ var require_baseIteratee = __commonJS({
|
|
|
2094
3870
|
return identity;
|
|
2095
3871
|
}
|
|
2096
3872
|
if (typeof value == "object") {
|
|
2097
|
-
return
|
|
3873
|
+
return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
2098
3874
|
}
|
|
2099
3875
|
return property(value);
|
|
2100
3876
|
}
|
|
@@ -2108,9 +3884,9 @@ var require_filter = __commonJS({
|
|
|
2108
3884
|
var arrayFilter = require_arrayFilter();
|
|
2109
3885
|
var baseFilter = require_baseFilter();
|
|
2110
3886
|
var baseIteratee = require_baseIteratee();
|
|
2111
|
-
var
|
|
3887
|
+
var isArray2 = require_isArray();
|
|
2112
3888
|
function filter3(collection, predicate) {
|
|
2113
|
-
var func =
|
|
3889
|
+
var func = isArray2(collection) ? arrayFilter : baseFilter;
|
|
2114
3890
|
return func(collection, baseIteratee(predicate, 3));
|
|
2115
3891
|
}
|
|
2116
3892
|
module2.exports = filter3;
|
|
@@ -2705,6 +4481,7 @@ var CredenzaDecom = class extends CredenzaSuiModule {
|
|
|
2705
4481
|
|
|
2706
4482
|
// src/client/modules/Sellable.ts
|
|
2707
4483
|
var import_transactions6 = require("@mysten/sui/transactions");
|
|
4484
|
+
var import_buffer = __toESM(require_buffer());
|
|
2708
4485
|
var import_get4 = __toESM(require_get());
|
|
2709
4486
|
var Sellable = class extends CredenzaSuiModule {
|
|
2710
4487
|
async getSellConfig(assetType) {
|
|
@@ -2836,7 +4613,7 @@ var Sellable = class extends CredenzaSuiModule {
|
|
|
2836
4613
|
(0, import_get4.default)(field, "value.price_fiat_for_currency.id")
|
|
2837
4614
|
);
|
|
2838
4615
|
for (const assetPriceForCurrencyField of assetPriceForCurrenciesFields) {
|
|
2839
|
-
if (Buffer.from(assetPriceForCurrencyField.name, "base64").toString("utf-8") === currency) {
|
|
4616
|
+
if (import_buffer.Buffer.from(assetPriceForCurrencyField.name, "base64").toString("utf-8") === currency) {
|
|
2840
4617
|
return parseInt(assetPriceForCurrencyField.value) ?? 0;
|
|
2841
4618
|
}
|
|
2842
4619
|
}
|
|
@@ -2852,7 +4629,7 @@ var Sellable = class extends CredenzaSuiModule {
|
|
|
2852
4629
|
} else {
|
|
2853
4630
|
const fields = await this.client.getDynamicFields((0, import_get4.default)(obj, "json.price_fiat_for_currency.id"));
|
|
2854
4631
|
for (const field of fields) {
|
|
2855
|
-
if (Buffer.from(field.name, "base64").toString("utf-8") === currency) {
|
|
4632
|
+
if (import_buffer.Buffer.from(field.name, "base64").toString("utf-8") === currency) {
|
|
2856
4633
|
return parseInt(field.value) ?? 0;
|
|
2857
4634
|
}
|
|
2858
4635
|
}
|
|
@@ -3349,6 +5126,7 @@ var CredenzaDeposit = class extends CredenzaSuiModule {
|
|
|
3349
5126
|
var import_ed25519 = require("@mysten/sui/keypairs/ed25519");
|
|
3350
5127
|
var import_utils2 = require("@mysten/sui/utils");
|
|
3351
5128
|
var import_grpc = require("@mysten/sui/grpc");
|
|
5129
|
+
var import_buffer2 = __toESM(require_buffer());
|
|
3352
5130
|
|
|
3353
5131
|
// node_modules/.pnpm/graphql-request@7.4.0_graphql@16.12.0/node_modules/graphql-request/build/legacy/classes/ClientError.js
|
|
3354
5132
|
var ClientError = class _ClientError extends Error {
|
|
@@ -7355,6 +9133,7 @@ var SuiGraphqlClient = class {
|
|
|
7355
9133
|
|
|
7356
9134
|
// src/client/CredenzaSuiClient.ts
|
|
7357
9135
|
var import_filter2 = __toESM(require_filter());
|
|
9136
|
+
var import_isArray = __toESM(require_isArray());
|
|
7358
9137
|
var ENVIRONMENT_RPC = {
|
|
7359
9138
|
DEVNET: "https://fullnode.devnet.sui.io:443",
|
|
7360
9139
|
TESTNET: "https://fullnode.testnet.sui.io:443",
|
|
@@ -7415,9 +9194,15 @@ var CredenzaSuiClient = class {
|
|
|
7415
9194
|
return await this.options.signer.signTransaction(txBytes);
|
|
7416
9195
|
}
|
|
7417
9196
|
async executeTransaction(signatureWithBytes) {
|
|
9197
|
+
let signatures;
|
|
9198
|
+
if (!(0, import_isArray.default)(signatureWithBytes.signature)) {
|
|
9199
|
+
signatures = [signatureWithBytes.signature];
|
|
9200
|
+
} else {
|
|
9201
|
+
signatures = signatureWithBytes.signature;
|
|
9202
|
+
}
|
|
7418
9203
|
const res = await this.suiGrpcClient.executeTransaction({
|
|
7419
|
-
transaction: Buffer.from(signatureWithBytes.bytes, "base64"),
|
|
7420
|
-
signatures
|
|
9204
|
+
transaction: import_buffer2.Buffer.from(signatureWithBytes.bytes, "base64"),
|
|
9205
|
+
signatures,
|
|
7421
9206
|
include: {
|
|
7422
9207
|
effects: true,
|
|
7423
9208
|
events: true
|
|
@@ -7529,4 +9314,17 @@ var CredenzaSuiClient = class {
|
|
|
7529
9314
|
};
|
|
7530
9315
|
}
|
|
7531
9316
|
};
|
|
9317
|
+
/*! Bundled license information:
|
|
9318
|
+
|
|
9319
|
+
ieee754/index.js:
|
|
9320
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
9321
|
+
|
|
9322
|
+
buffer/index.js:
|
|
9323
|
+
(*!
|
|
9324
|
+
* The buffer module from node.js, for the browser.
|
|
9325
|
+
*
|
|
9326
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
9327
|
+
* @license MIT
|
|
9328
|
+
*)
|
|
9329
|
+
*/
|
|
7532
9330
|
//# sourceMappingURL=index.cjs.map
|