@wovin/core 0.1.24 → 0.1.25
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/applog.min.js +1 -1
- package/dist/chunk-CWGXD56S.min.js +1601 -0
- package/dist/chunk-CWGXD56S.min.js.map +1 -0
- package/dist/{chunk-NDHTR5QC.min.js → chunk-HHFNRKOI.min.js} +2 -2
- package/dist/{chunk-DYHLKKOE.min.js → chunk-ITZTLALV.min.js} +2 -2
- package/dist/{chunk-CZTDDXGE.min.js → chunk-R7EMHBM3.min.js} +1601 -545
- package/dist/chunk-R7EMHBM3.min.js.map +1 -0
- package/dist/{chunk-FWL2ZJCW.min.js → chunk-SA7YLEF6.min.js} +5 -5
- package/dist/{chunk-UJMWWDG4.min.js → chunk-USEP3ZEM.min.js} +2 -2
- package/dist/{chunk-73CG5VUI.min.js → chunk-ZGU3O24G.min.js} +4 -4
- package/dist/index.min.js +7 -7
- package/dist/ipfs.min.js +4 -4
- package/dist/pubsub.min.js +4 -4
- package/dist/query.min.js +3 -3
- package/dist/retrieve.min.js +4 -4
- package/dist/thread.min.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CZTDDXGE.min.js.map +0 -1
- package/dist/chunk-IIF2KSDX.min.js +0 -4173
- package/dist/chunk-IIF2KSDX.min.js.map +0 -1
- /package/dist/{chunk-NDHTR5QC.min.js.map → chunk-HHFNRKOI.min.js.map} +0 -0
- /package/dist/{chunk-DYHLKKOE.min.js.map → chunk-ITZTLALV.min.js.map} +0 -0
- /package/dist/{chunk-FWL2ZJCW.min.js.map → chunk-SA7YLEF6.min.js.map} +0 -0
- /package/dist/{chunk-UJMWWDG4.min.js.map → chunk-USEP3ZEM.min.js.map} +0 -0
- /package/dist/{chunk-73CG5VUI.min.js.map → chunk-ZGU3O24G.min.js.map} +0 -0
|
@@ -827,11 +827,11 @@ var require_system = __commonJS({
|
|
|
827
827
|
return (options = {}) => Types.Type.Unsafe({ ...options, [Types.Kind]: kind });
|
|
828
828
|
}
|
|
829
829
|
TypeSystem2.Type = Type3;
|
|
830
|
-
function Format(
|
|
831
|
-
if (Types.FormatRegistry.Has(
|
|
832
|
-
throw new TypeSystemDuplicateFormat(
|
|
833
|
-
Types.FormatRegistry.Set(
|
|
834
|
-
return
|
|
830
|
+
function Format(format4, check) {
|
|
831
|
+
if (Types.FormatRegistry.Has(format4))
|
|
832
|
+
throw new TypeSystemDuplicateFormat(format4);
|
|
833
|
+
Types.FormatRegistry.Set(format4, check);
|
|
834
|
+
return format4;
|
|
835
835
|
}
|
|
836
836
|
TypeSystem2.Format = Format;
|
|
837
837
|
})(TypeSystem || (exports2.TypeSystem = TypeSystem = {}));
|
|
@@ -1567,8 +1567,8 @@ var require_errors = __commonJS({
|
|
|
1567
1567
|
if (!Types.FormatRegistry.Has(schema.format)) {
|
|
1568
1568
|
yield Create(ValueErrorType.StringFormatUnknown, schema, path, value);
|
|
1569
1569
|
} else {
|
|
1570
|
-
const
|
|
1571
|
-
if (!
|
|
1570
|
+
const format4 = Types.FormatRegistry.Get(schema.format);
|
|
1571
|
+
if (!format4(value)) {
|
|
1572
1572
|
yield Create(ValueErrorType.StringFormat, schema, path, value);
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
@@ -3083,7 +3083,7 @@ var require_compiler = __commonJS({
|
|
|
3083
3083
|
return variableName;
|
|
3084
3084
|
}
|
|
3085
3085
|
function CreateFunction(name2, schema, references, value, useHoisting = true) {
|
|
3086
|
-
const [newline, pad] = ["\n", (
|
|
3086
|
+
const [newline, pad] = ["\n", (length3) => "".padStart(length3, " ")];
|
|
3087
3087
|
const parameter = CreateParameter("value", "any");
|
|
3088
3088
|
const returns = CreateReturns("boolean");
|
|
3089
3089
|
const expression = [...Visit(schema, references, value, useHoisting)].map((expression2) => `${pad(4)}${expression2}`).join(` &&${newline}`);
|
|
@@ -3134,10 +3134,10 @@ var require_compiler = __commonJS({
|
|
|
3134
3134
|
const schema2 = instances.get(instance);
|
|
3135
3135
|
return checkFunc(schema2, value);
|
|
3136
3136
|
}
|
|
3137
|
-
function formatRegistryFunction(
|
|
3138
|
-
if (!Types.FormatRegistry.Has(
|
|
3137
|
+
function formatRegistryFunction(format4, value) {
|
|
3138
|
+
if (!Types.FormatRegistry.Has(format4))
|
|
3139
3139
|
return false;
|
|
3140
|
-
const checkFunc = Types.FormatRegistry.Get(
|
|
3140
|
+
const checkFunc = Types.FormatRegistry.Get(format4);
|
|
3141
3141
|
return checkFunc(value);
|
|
3142
3142
|
}
|
|
3143
3143
|
function hashFunction(value) {
|
|
@@ -3357,8 +3357,8 @@ var isSymbol_default = isSymbol;
|
|
|
3357
3357
|
|
|
3358
3358
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js
|
|
3359
3359
|
function arrayMap(array, iteratee) {
|
|
3360
|
-
var index = -1,
|
|
3361
|
-
while (++index <
|
|
3360
|
+
var index = -1, length3 = array == null ? 0 : array.length, result = Array(length3);
|
|
3361
|
+
while (++index < length3) {
|
|
3362
3362
|
result[index] = iteratee(array[index], index, array);
|
|
3363
3363
|
}
|
|
3364
3364
|
return result;
|
|
@@ -3677,9 +3677,9 @@ var composeArgsRight_default = composeArgsRight;
|
|
|
3677
3677
|
|
|
3678
3678
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_countHolders.js
|
|
3679
3679
|
function countHolders(array, placeholder) {
|
|
3680
|
-
var
|
|
3681
|
-
while (
|
|
3682
|
-
if (array[
|
|
3680
|
+
var length3 = array.length, result = 0;
|
|
3681
|
+
while (length3--) {
|
|
3682
|
+
if (array[length3] === placeholder) {
|
|
3683
3683
|
++result;
|
|
3684
3684
|
}
|
|
3685
3685
|
}
|
|
@@ -3726,9 +3726,9 @@ var realNames_default = realNames;
|
|
|
3726
3726
|
var objectProto4 = Object.prototype;
|
|
3727
3727
|
var hasOwnProperty3 = objectProto4.hasOwnProperty;
|
|
3728
3728
|
function getFuncName(func) {
|
|
3729
|
-
var result = func.name + "", array = realNames_default[result],
|
|
3730
|
-
while (
|
|
3731
|
-
var data = array[
|
|
3729
|
+
var result = func.name + "", array = realNames_default[result], length3 = hasOwnProperty3.call(realNames_default, result) ? array.length : 0;
|
|
3730
|
+
while (length3--) {
|
|
3731
|
+
var data = array[length3], otherFunc = data.func;
|
|
3732
3732
|
if (otherFunc == null || otherFunc == func) {
|
|
3733
3733
|
return data.name;
|
|
3734
3734
|
}
|
|
@@ -3751,9 +3751,9 @@ var LodashWrapper_default = LodashWrapper;
|
|
|
3751
3751
|
|
|
3752
3752
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js
|
|
3753
3753
|
function copyArray(source, array) {
|
|
3754
|
-
var index = -1,
|
|
3755
|
-
array || (array = Array(
|
|
3756
|
-
while (++index <
|
|
3754
|
+
var index = -1, length3 = source.length;
|
|
3755
|
+
array || (array = Array(length3));
|
|
3756
|
+
while (++index < length3) {
|
|
3757
3757
|
array[index] = source[index];
|
|
3758
3758
|
}
|
|
3759
3759
|
return array;
|
|
@@ -3842,13 +3842,13 @@ var getWrapDetails_default = getWrapDetails;
|
|
|
3842
3842
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_insertWrapDetails.js
|
|
3843
3843
|
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
|
|
3844
3844
|
function insertWrapDetails(source, details) {
|
|
3845
|
-
var
|
|
3846
|
-
if (!
|
|
3845
|
+
var length3 = details.length;
|
|
3846
|
+
if (!length3) {
|
|
3847
3847
|
return source;
|
|
3848
3848
|
}
|
|
3849
|
-
var lastIndex =
|
|
3850
|
-
details[lastIndex] = (
|
|
3851
|
-
details = details.join(
|
|
3849
|
+
var lastIndex = length3 - 1;
|
|
3850
|
+
details[lastIndex] = (length3 > 1 ? "& " : "") + details[lastIndex];
|
|
3851
|
+
details = details.join(length3 > 2 ? ", " : " ");
|
|
3852
3852
|
return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
|
|
3853
3853
|
}
|
|
3854
3854
|
var insertWrapDetails_default = insertWrapDetails;
|
|
@@ -3889,8 +3889,8 @@ var setToString_default = setToString;
|
|
|
3889
3889
|
|
|
3890
3890
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayEach.js
|
|
3891
3891
|
function arrayEach(array, iteratee) {
|
|
3892
|
-
var index = -1,
|
|
3893
|
-
while (++index <
|
|
3892
|
+
var index = -1, length3 = array == null ? 0 : array.length;
|
|
3893
|
+
while (++index < length3) {
|
|
3894
3894
|
if (iteratee(array[index], index, array) === false) {
|
|
3895
3895
|
break;
|
|
3896
3896
|
}
|
|
@@ -3901,8 +3901,8 @@ var arrayEach_default = arrayEach;
|
|
|
3901
3901
|
|
|
3902
3902
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js
|
|
3903
3903
|
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
3904
|
-
var
|
|
3905
|
-
while (fromRight ? index-- : ++index <
|
|
3904
|
+
var length3 = array.length, index = fromIndex + (fromRight ? 1 : -1);
|
|
3905
|
+
while (fromRight ? index-- : ++index < length3) {
|
|
3906
3906
|
if (predicate(array[index], index, array)) {
|
|
3907
3907
|
return index;
|
|
3908
3908
|
}
|
|
@@ -3919,8 +3919,8 @@ var baseIsNaN_default = baseIsNaN;
|
|
|
3919
3919
|
|
|
3920
3920
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.js
|
|
3921
3921
|
function strictIndexOf(array, value, fromIndex) {
|
|
3922
|
-
var index = fromIndex - 1,
|
|
3923
|
-
while (++index <
|
|
3922
|
+
var index = fromIndex - 1, length3 = array.length;
|
|
3923
|
+
while (++index < length3) {
|
|
3924
3924
|
if (array[index] === value) {
|
|
3925
3925
|
return index;
|
|
3926
3926
|
}
|
|
@@ -3937,8 +3937,8 @@ var baseIndexOf_default = baseIndexOf;
|
|
|
3937
3937
|
|
|
3938
3938
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.js
|
|
3939
3939
|
function arrayIncludes(array, value) {
|
|
3940
|
-
var
|
|
3941
|
-
return !!
|
|
3940
|
+
var length3 = array == null ? 0 : array.length;
|
|
3941
|
+
return !!length3 && baseIndexOf_default(array, value, 0) > -1;
|
|
3942
3942
|
}
|
|
3943
3943
|
var arrayIncludes_default = arrayIncludes;
|
|
3944
3944
|
|
|
@@ -4026,20 +4026,20 @@ var getHolder_default = getHolder;
|
|
|
4026
4026
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js
|
|
4027
4027
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
4028
4028
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
4029
|
-
function isIndex(value,
|
|
4029
|
+
function isIndex(value, length3) {
|
|
4030
4030
|
var type = typeof value;
|
|
4031
|
-
|
|
4032
|
-
return !!
|
|
4031
|
+
length3 = length3 == null ? MAX_SAFE_INTEGER : length3;
|
|
4032
|
+
return !!length3 && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length3);
|
|
4033
4033
|
}
|
|
4034
4034
|
var isIndex_default = isIndex;
|
|
4035
4035
|
|
|
4036
4036
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_reorder.js
|
|
4037
4037
|
var nativeMin = Math.min;
|
|
4038
4038
|
function reorder(array, indexes) {
|
|
4039
|
-
var arrLength = array.length,
|
|
4040
|
-
while (
|
|
4041
|
-
var index = indexes[
|
|
4042
|
-
array[
|
|
4039
|
+
var arrLength = array.length, length3 = nativeMin(indexes.length, arrLength), oldArray = copyArray_default(array);
|
|
4040
|
+
while (length3--) {
|
|
4041
|
+
var index = indexes[length3];
|
|
4042
|
+
array[length3] = isIndex_default(index, arrLength) ? oldArray[index] : void 0;
|
|
4043
4043
|
}
|
|
4044
4044
|
return array;
|
|
4045
4045
|
}
|
|
@@ -4048,8 +4048,8 @@ var reorder_default = reorder;
|
|
|
4048
4048
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_replaceHolders.js
|
|
4049
4049
|
var PLACEHOLDER = "__lodash_placeholder__";
|
|
4050
4050
|
function replaceHolders(array, placeholder) {
|
|
4051
|
-
var index = -1,
|
|
4052
|
-
while (++index <
|
|
4051
|
+
var index = -1, length3 = array.length, resIndex = 0, result = [];
|
|
4052
|
+
while (++index < length3) {
|
|
4053
4053
|
var value = array[index];
|
|
4054
4054
|
if (value === placeholder || value === PLACEHOLDER) {
|
|
4055
4055
|
array[index] = PLACEHOLDER;
|
|
@@ -4070,7 +4070,7 @@ var WRAP_FLIP_FLAG2 = 512;
|
|
|
4070
4070
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
|
|
4071
4071
|
var isAry = bitmask & WRAP_ARY_FLAG2, isBind = bitmask & WRAP_BIND_FLAG4, isBindKey = bitmask & WRAP_BIND_KEY_FLAG3, isCurried = bitmask & (WRAP_CURRY_FLAG3 | WRAP_CURRY_RIGHT_FLAG2), isFlip = bitmask & WRAP_FLIP_FLAG2, Ctor = isBindKey ? void 0 : createCtor_default(func);
|
|
4072
4072
|
function wrapper() {
|
|
4073
|
-
var
|
|
4073
|
+
var length3 = arguments.length, args = Array(length3), index = length3;
|
|
4074
4074
|
while (index--) {
|
|
4075
4075
|
args[index] = arguments[index];
|
|
4076
4076
|
}
|
|
@@ -4083,8 +4083,8 @@ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight,
|
|
|
4083
4083
|
if (partialsRight) {
|
|
4084
4084
|
args = composeArgsRight_default(args, partialsRight, holdersRight, isCurried);
|
|
4085
4085
|
}
|
|
4086
|
-
|
|
4087
|
-
if (isCurried &&
|
|
4086
|
+
length3 -= holdersCount;
|
|
4087
|
+
if (isCurried && length3 < arity) {
|
|
4088
4088
|
var newHolders = replaceHolders_default(args, placeholder);
|
|
4089
4089
|
return createRecurry_default(
|
|
4090
4090
|
func,
|
|
@@ -4096,17 +4096,17 @@ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight,
|
|
|
4096
4096
|
newHolders,
|
|
4097
4097
|
argPos,
|
|
4098
4098
|
ary,
|
|
4099
|
-
arity -
|
|
4099
|
+
arity - length3
|
|
4100
4100
|
);
|
|
4101
4101
|
}
|
|
4102
4102
|
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
|
|
4103
|
-
|
|
4103
|
+
length3 = args.length;
|
|
4104
4104
|
if (argPos) {
|
|
4105
4105
|
args = reorder_default(args, argPos);
|
|
4106
|
-
} else if (isFlip &&
|
|
4106
|
+
} else if (isFlip && length3 > 1) {
|
|
4107
4107
|
args.reverse();
|
|
4108
4108
|
}
|
|
4109
|
-
if (isAry && ary <
|
|
4109
|
+
if (isAry && ary < length3) {
|
|
4110
4110
|
args.length = ary;
|
|
4111
4111
|
}
|
|
4112
4112
|
if (this && this !== root_default && this instanceof wrapper) {
|
|
@@ -4122,13 +4122,13 @@ var createHybrid_default = createHybrid;
|
|
|
4122
4122
|
function createCurry(func, bitmask, arity) {
|
|
4123
4123
|
var Ctor = createCtor_default(func);
|
|
4124
4124
|
function wrapper() {
|
|
4125
|
-
var
|
|
4125
|
+
var length3 = arguments.length, args = Array(length3), index = length3, placeholder = getHolder_default(wrapper);
|
|
4126
4126
|
while (index--) {
|
|
4127
4127
|
args[index] = arguments[index];
|
|
4128
4128
|
}
|
|
4129
|
-
var holders =
|
|
4130
|
-
|
|
4131
|
-
if (
|
|
4129
|
+
var holders = length3 < 3 && args[0] !== placeholder && args[length3 - 1] !== placeholder ? [] : replaceHolders_default(args, placeholder);
|
|
4130
|
+
length3 -= holders.length;
|
|
4131
|
+
if (length3 < arity) {
|
|
4132
4132
|
return createRecurry_default(
|
|
4133
4133
|
func,
|
|
4134
4134
|
bitmask,
|
|
@@ -4139,7 +4139,7 @@ function createCurry(func, bitmask, arity) {
|
|
|
4139
4139
|
holders,
|
|
4140
4140
|
void 0,
|
|
4141
4141
|
void 0,
|
|
4142
|
-
arity -
|
|
4142
|
+
arity - length3
|
|
4143
4143
|
);
|
|
4144
4144
|
}
|
|
4145
4145
|
var fn = this && this !== root_default && this instanceof wrapper ? Ctor : func;
|
|
@@ -4228,14 +4228,14 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
|
|
|
4228
4228
|
if (!isBindKey && typeof func != "function") {
|
|
4229
4229
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
4230
4230
|
}
|
|
4231
|
-
var
|
|
4232
|
-
if (!
|
|
4231
|
+
var length3 = partials ? partials.length : 0;
|
|
4232
|
+
if (!length3) {
|
|
4233
4233
|
bitmask &= ~(WRAP_PARTIAL_FLAG3 | WRAP_PARTIAL_RIGHT_FLAG3);
|
|
4234
4234
|
partials = holders = void 0;
|
|
4235
4235
|
}
|
|
4236
4236
|
ary = ary === void 0 ? ary : nativeMax3(toInteger_default(ary), 0);
|
|
4237
4237
|
arity = arity === void 0 ? arity : toInteger_default(arity);
|
|
4238
|
-
|
|
4238
|
+
length3 -= holders ? holders.length : 0;
|
|
4239
4239
|
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG3) {
|
|
4240
4240
|
var partialsRight = partials, holdersRight = holders;
|
|
4241
4241
|
partials = holders = void 0;
|
|
@@ -4261,7 +4261,7 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
|
|
|
4261
4261
|
thisArg = newData[2];
|
|
4262
4262
|
partials = newData[3];
|
|
4263
4263
|
holders = newData[4];
|
|
4264
|
-
arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax3(newData[9] -
|
|
4264
|
+
arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax3(newData[9] - length3, 0);
|
|
4265
4265
|
if (!arity && bitmask & (WRAP_CURRY_FLAG5 | WRAP_CURRY_RIGHT_FLAG3)) {
|
|
4266
4266
|
bitmask &= ~(WRAP_CURRY_FLAG5 | WRAP_CURRY_RIGHT_FLAG3);
|
|
4267
4267
|
}
|
|
@@ -4316,8 +4316,8 @@ var nativeMax4 = Math.max;
|
|
|
4316
4316
|
function overRest(func, start, transform) {
|
|
4317
4317
|
start = nativeMax4(start === void 0 ? func.length - 1 : start, 0);
|
|
4318
4318
|
return function() {
|
|
4319
|
-
var args = arguments, index = -1,
|
|
4320
|
-
while (++index <
|
|
4319
|
+
var args = arguments, index = -1, length3 = nativeMax4(args.length - start, 0), array = Array(length3);
|
|
4320
|
+
while (++index < length3) {
|
|
4321
4321
|
array[index] = args[start + index];
|
|
4322
4322
|
}
|
|
4323
4323
|
index = -1;
|
|
@@ -4468,13 +4468,13 @@ var isTypedArray_default = isTypedArray;
|
|
|
4468
4468
|
var objectProto9 = Object.prototype;
|
|
4469
4469
|
var hasOwnProperty7 = objectProto9.hasOwnProperty;
|
|
4470
4470
|
function arrayLikeKeys(value, inherited) {
|
|
4471
|
-
var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [],
|
|
4471
|
+
var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length3 = result.length;
|
|
4472
4472
|
for (var key in value) {
|
|
4473
4473
|
if ((inherited || hasOwnProperty7.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
4474
4474
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
4475
4475
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
4476
4476
|
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
4477
|
-
isIndex_default(key,
|
|
4477
|
+
isIndex_default(key, length3)))) {
|
|
4478
4478
|
result.push(key);
|
|
4479
4479
|
}
|
|
4480
4480
|
}
|
|
@@ -4586,9 +4586,9 @@ var hashSet_default = hashSet;
|
|
|
4586
4586
|
|
|
4587
4587
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js
|
|
4588
4588
|
function Hash(entries) {
|
|
4589
|
-
var index = -1,
|
|
4589
|
+
var index = -1, length3 = entries == null ? 0 : entries.length;
|
|
4590
4590
|
this.clear();
|
|
4591
|
-
while (++index <
|
|
4591
|
+
while (++index < length3) {
|
|
4592
4592
|
var entry = entries[index];
|
|
4593
4593
|
this.set(entry[0], entry[1]);
|
|
4594
4594
|
}
|
|
@@ -4609,10 +4609,10 @@ var listCacheClear_default = listCacheClear;
|
|
|
4609
4609
|
|
|
4610
4610
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js
|
|
4611
4611
|
function assocIndexOf(array, key) {
|
|
4612
|
-
var
|
|
4613
|
-
while (
|
|
4614
|
-
if (eq_default(array[
|
|
4615
|
-
return
|
|
4612
|
+
var length3 = array.length;
|
|
4613
|
+
while (length3--) {
|
|
4614
|
+
if (eq_default(array[length3][0], key)) {
|
|
4615
|
+
return length3;
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
4618
4618
|
return -1;
|
|
@@ -4666,9 +4666,9 @@ var listCacheSet_default = listCacheSet;
|
|
|
4666
4666
|
|
|
4667
4667
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js
|
|
4668
4668
|
function ListCache(entries) {
|
|
4669
|
-
var index = -1,
|
|
4669
|
+
var index = -1, length3 = entries == null ? 0 : entries.length;
|
|
4670
4670
|
this.clear();
|
|
4671
|
-
while (++index <
|
|
4671
|
+
while (++index < length3) {
|
|
4672
4672
|
var entry = entries[index];
|
|
4673
4673
|
this.set(entry[0], entry[1]);
|
|
4674
4674
|
}
|
|
@@ -4740,9 +4740,9 @@ var mapCacheSet_default = mapCacheSet;
|
|
|
4740
4740
|
|
|
4741
4741
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js
|
|
4742
4742
|
function MapCache(entries) {
|
|
4743
|
-
var index = -1,
|
|
4743
|
+
var index = -1, length3 = entries == null ? 0 : entries.length;
|
|
4744
4744
|
this.clear();
|
|
4745
|
-
while (++index <
|
|
4745
|
+
while (++index < length3) {
|
|
4746
4746
|
var entry = entries[index];
|
|
4747
4747
|
this.set(entry[0], entry[1]);
|
|
4748
4748
|
}
|
|
@@ -4761,12 +4761,12 @@ function memoize(func, resolver) {
|
|
|
4761
4761
|
throw new TypeError(FUNC_ERROR_TEXT2);
|
|
4762
4762
|
}
|
|
4763
4763
|
var memoized = function() {
|
|
4764
|
-
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0],
|
|
4765
|
-
if (
|
|
4766
|
-
return
|
|
4764
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache3 = memoized.cache;
|
|
4765
|
+
if (cache3.has(key)) {
|
|
4766
|
+
return cache3.get(key);
|
|
4767
4767
|
}
|
|
4768
4768
|
var result = func.apply(this, args);
|
|
4769
|
-
memoized.cache =
|
|
4769
|
+
memoized.cache = cache3.set(key, result) || cache3;
|
|
4770
4770
|
return result;
|
|
4771
4771
|
};
|
|
4772
4772
|
memoized.cache = new (memoize.Cache || MapCache_default)();
|
|
@@ -4779,12 +4779,12 @@ var memoize_default = memoize;
|
|
|
4779
4779
|
var MAX_MEMOIZE_SIZE = 500;
|
|
4780
4780
|
function memoizeCapped(func) {
|
|
4781
4781
|
var result = memoize_default(func, function(key) {
|
|
4782
|
-
if (
|
|
4783
|
-
|
|
4782
|
+
if (cache3.size === MAX_MEMOIZE_SIZE) {
|
|
4783
|
+
cache3.clear();
|
|
4784
4784
|
}
|
|
4785
4785
|
return key;
|
|
4786
4786
|
});
|
|
4787
|
-
var
|
|
4787
|
+
var cache3 = result.cache;
|
|
4788
4788
|
return result;
|
|
4789
4789
|
}
|
|
4790
4790
|
var memoizeCapped_default = memoizeCapped;
|
|
@@ -4833,11 +4833,11 @@ var toKey_default = toKey;
|
|
|
4833
4833
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGet.js
|
|
4834
4834
|
function baseGet(object, path) {
|
|
4835
4835
|
path = castPath_default(path, object);
|
|
4836
|
-
var index = 0,
|
|
4837
|
-
while (object != null && index <
|
|
4836
|
+
var index = 0, length3 = path.length;
|
|
4837
|
+
while (object != null && index < length3) {
|
|
4838
4838
|
object = object[toKey_default(path[index++])];
|
|
4839
4839
|
}
|
|
4840
|
-
return index && index ==
|
|
4840
|
+
return index && index == length3 ? object : void 0;
|
|
4841
4841
|
}
|
|
4842
4842
|
var baseGet_default = baseGet;
|
|
4843
4843
|
|
|
@@ -4850,8 +4850,8 @@ var get_default = get;
|
|
|
4850
4850
|
|
|
4851
4851
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js
|
|
4852
4852
|
function arrayPush(array, values) {
|
|
4853
|
-
var index = -1,
|
|
4854
|
-
while (++index <
|
|
4853
|
+
var index = -1, length3 = values.length, offset = array.length;
|
|
4854
|
+
while (++index < length3) {
|
|
4855
4855
|
array[offset + index] = values[index];
|
|
4856
4856
|
}
|
|
4857
4857
|
return array;
|
|
@@ -4867,10 +4867,10 @@ var isFlattenable_default = isFlattenable;
|
|
|
4867
4867
|
|
|
4868
4868
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFlatten.js
|
|
4869
4869
|
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
4870
|
-
var index = -1,
|
|
4870
|
+
var index = -1, length3 = array.length;
|
|
4871
4871
|
predicate || (predicate = isFlattenable_default);
|
|
4872
4872
|
result || (result = []);
|
|
4873
|
-
while (++index <
|
|
4873
|
+
while (++index < length3) {
|
|
4874
4874
|
var value = array[index];
|
|
4875
4875
|
if (depth > 0 && predicate(value)) {
|
|
4876
4876
|
if (depth > 1) {
|
|
@@ -4888,8 +4888,8 @@ var baseFlatten_default = baseFlatten;
|
|
|
4888
4888
|
|
|
4889
4889
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/flatten.js
|
|
4890
4890
|
function flatten(array) {
|
|
4891
|
-
var
|
|
4892
|
-
return
|
|
4891
|
+
var length3 = array == null ? 0 : array.length;
|
|
4892
|
+
return length3 ? baseFlatten_default(array, 1) : [];
|
|
4893
4893
|
}
|
|
4894
4894
|
var flatten_default = flatten;
|
|
4895
4895
|
|
|
@@ -4959,8 +4959,8 @@ var Stack_default = Stack;
|
|
|
4959
4959
|
|
|
4960
4960
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js
|
|
4961
4961
|
function arrayFilter(array, predicate) {
|
|
4962
|
-
var index = -1,
|
|
4963
|
-
while (++index <
|
|
4962
|
+
var index = -1, length3 = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
4963
|
+
while (++index < length3) {
|
|
4964
4964
|
var value = array[index];
|
|
4965
4965
|
if (predicate(value, index, array)) {
|
|
4966
4966
|
result[resIndex++] = value;
|
|
@@ -5071,9 +5071,9 @@ var setCacheHas_default = setCacheHas;
|
|
|
5071
5071
|
|
|
5072
5072
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js
|
|
5073
5073
|
function SetCache(values) {
|
|
5074
|
-
var index = -1,
|
|
5074
|
+
var index = -1, length3 = values == null ? 0 : values.length;
|
|
5075
5075
|
this.__data__ = new MapCache_default();
|
|
5076
|
-
while (++index <
|
|
5076
|
+
while (++index < length3) {
|
|
5077
5077
|
this.add(values[index]);
|
|
5078
5078
|
}
|
|
5079
5079
|
}
|
|
@@ -5083,8 +5083,8 @@ var SetCache_default = SetCache;
|
|
|
5083
5083
|
|
|
5084
5084
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js
|
|
5085
5085
|
function arraySome(array, predicate) {
|
|
5086
|
-
var index = -1,
|
|
5087
|
-
while (++index <
|
|
5086
|
+
var index = -1, length3 = array == null ? 0 : array.length;
|
|
5087
|
+
while (++index < length3) {
|
|
5088
5088
|
if (predicate(array[index], index, array)) {
|
|
5089
5089
|
return true;
|
|
5090
5090
|
}
|
|
@@ -5094,8 +5094,8 @@ function arraySome(array, predicate) {
|
|
|
5094
5094
|
var arraySome_default = arraySome;
|
|
5095
5095
|
|
|
5096
5096
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js
|
|
5097
|
-
function cacheHas(
|
|
5098
|
-
return
|
|
5097
|
+
function cacheHas(cache3, key) {
|
|
5098
|
+
return cache3.has(key);
|
|
5099
5099
|
}
|
|
5100
5100
|
var cacheHas_default = cacheHas;
|
|
5101
5101
|
|
|
@@ -5335,9 +5335,9 @@ var baseIsEqual_default = baseIsEqual;
|
|
|
5335
5335
|
var COMPARE_PARTIAL_FLAG5 = 1;
|
|
5336
5336
|
var COMPARE_UNORDERED_FLAG3 = 2;
|
|
5337
5337
|
function baseIsMatch(object, source, matchData, customizer) {
|
|
5338
|
-
var index = matchData.length,
|
|
5338
|
+
var index = matchData.length, length3 = index, noCustomizer = !customizer;
|
|
5339
5339
|
if (object == null) {
|
|
5340
|
-
return !
|
|
5340
|
+
return !length3;
|
|
5341
5341
|
}
|
|
5342
5342
|
object = Object(object);
|
|
5343
5343
|
while (index--) {
|
|
@@ -5346,7 +5346,7 @@ function baseIsMatch(object, source, matchData, customizer) {
|
|
|
5346
5346
|
return false;
|
|
5347
5347
|
}
|
|
5348
5348
|
}
|
|
5349
|
-
while (++index <
|
|
5349
|
+
while (++index < length3) {
|
|
5350
5350
|
data = matchData[index];
|
|
5351
5351
|
var key = data[0], objValue = object[key], srcValue = data[1];
|
|
5352
5352
|
if (noCustomizer && data[2]) {
|
|
@@ -5375,10 +5375,10 @@ var isStrictComparable_default = isStrictComparable;
|
|
|
5375
5375
|
|
|
5376
5376
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMatchData.js
|
|
5377
5377
|
function getMatchData(object) {
|
|
5378
|
-
var result = keys_default(object),
|
|
5379
|
-
while (
|
|
5380
|
-
var key = result[
|
|
5381
|
-
result[
|
|
5378
|
+
var result = keys_default(object), length3 = result.length;
|
|
5379
|
+
while (length3--) {
|
|
5380
|
+
var key = result[length3], value = object[key];
|
|
5381
|
+
result[length3] = [key, value, isStrictComparable_default(value)];
|
|
5382
5382
|
}
|
|
5383
5383
|
return result;
|
|
5384
5384
|
}
|
|
@@ -5416,19 +5416,19 @@ var baseHasIn_default = baseHasIn;
|
|
|
5416
5416
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasPath.js
|
|
5417
5417
|
function hasPath(object, path, hasFunc) {
|
|
5418
5418
|
path = castPath_default(path, object);
|
|
5419
|
-
var index = -1,
|
|
5420
|
-
while (++index <
|
|
5419
|
+
var index = -1, length3 = path.length, result = false;
|
|
5420
|
+
while (++index < length3) {
|
|
5421
5421
|
var key = toKey_default(path[index]);
|
|
5422
5422
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
5423
5423
|
break;
|
|
5424
5424
|
}
|
|
5425
5425
|
object = object[key];
|
|
5426
5426
|
}
|
|
5427
|
-
if (result || ++index !=
|
|
5427
|
+
if (result || ++index != length3) {
|
|
5428
5428
|
return result;
|
|
5429
5429
|
}
|
|
5430
|
-
|
|
5431
|
-
return !!
|
|
5430
|
+
length3 = object == null ? 0 : object.length;
|
|
5431
|
+
return !!length3 && isLength_default(length3) && isIndex_default(key, length3) && (isArray_default(object) || isArguments_default(object));
|
|
5432
5432
|
}
|
|
5433
5433
|
var hasPath_default = hasPath;
|
|
5434
5434
|
|
|
@@ -5590,8 +5590,8 @@ var isArrayLikeObject_default = isArrayLikeObject;
|
|
|
5590
5590
|
|
|
5591
5591
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.js
|
|
5592
5592
|
function arrayIncludesWith(array, value, comparator) {
|
|
5593
|
-
var index = -1,
|
|
5594
|
-
while (++index <
|
|
5593
|
+
var index = -1, length3 = array == null ? 0 : array.length;
|
|
5594
|
+
while (++index < length3) {
|
|
5595
5595
|
if (comparator(value, array[index])) {
|
|
5596
5596
|
return true;
|
|
5597
5597
|
}
|
|
@@ -5603,8 +5603,8 @@ var arrayIncludesWith_default = arrayIncludesWith;
|
|
|
5603
5603
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseDifference.js
|
|
5604
5604
|
var LARGE_ARRAY_SIZE2 = 200;
|
|
5605
5605
|
function baseDifference(array, values, iteratee, comparator) {
|
|
5606
|
-
var index = -1, includes = arrayIncludes_default, isCommon = true,
|
|
5607
|
-
if (!
|
|
5606
|
+
var index = -1, includes = arrayIncludes_default, isCommon = true, length3 = array.length, result = [], valuesLength = values.length;
|
|
5607
|
+
if (!length3) {
|
|
5608
5608
|
return result;
|
|
5609
5609
|
}
|
|
5610
5610
|
if (iteratee) {
|
|
@@ -5619,7 +5619,7 @@ function baseDifference(array, values, iteratee, comparator) {
|
|
|
5619
5619
|
values = new SetCache_default(values);
|
|
5620
5620
|
}
|
|
5621
5621
|
outer:
|
|
5622
|
-
while (++index <
|
|
5622
|
+
while (++index < length3) {
|
|
5623
5623
|
var value = array[index], computed2 = iteratee == null ? value : iteratee(value);
|
|
5624
5624
|
value = comparator || value !== 0 ? value : 0;
|
|
5625
5625
|
if (isCommon && computed2 === computed2) {
|
|
@@ -5644,8 +5644,8 @@ function baseSet(object, path, value, customizer) {
|
|
|
5644
5644
|
return object;
|
|
5645
5645
|
}
|
|
5646
5646
|
path = castPath_default(path, object);
|
|
5647
|
-
var index = -1,
|
|
5648
|
-
while (nested != null && ++index <
|
|
5647
|
+
var index = -1, length3 = path.length, lastIndex = length3 - 1, nested = object;
|
|
5648
|
+
while (nested != null && ++index < length3) {
|
|
5649
5649
|
var key = toKey_default(path[index]), newValue = value;
|
|
5650
5650
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
5651
5651
|
return object;
|
|
@@ -5666,8 +5666,8 @@ var baseSet_default = baseSet;
|
|
|
5666
5666
|
|
|
5667
5667
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_basePickBy.js
|
|
5668
5668
|
function basePickBy(object, paths, predicate) {
|
|
5669
|
-
var index = -1,
|
|
5670
|
-
while (++index <
|
|
5669
|
+
var index = -1, length3 = paths.length, result = {};
|
|
5670
|
+
while (++index < length3) {
|
|
5671
5671
|
var path = paths[index], value = baseGet_default(object, path);
|
|
5672
5672
|
if (predicate(value, path)) {
|
|
5673
5673
|
baseSet_default(result, castPath_default(path, object), value);
|
|
@@ -5753,11 +5753,11 @@ var createSet_default = createSet;
|
|
|
5753
5753
|
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.js
|
|
5754
5754
|
var LARGE_ARRAY_SIZE3 = 200;
|
|
5755
5755
|
function baseUniq(array, iteratee, comparator) {
|
|
5756
|
-
var index = -1, includes = arrayIncludes_default,
|
|
5756
|
+
var index = -1, includes = arrayIncludes_default, length3 = array.length, isCommon = true, result = [], seen = result;
|
|
5757
5757
|
if (comparator) {
|
|
5758
5758
|
isCommon = false;
|
|
5759
5759
|
includes = arrayIncludesWith_default;
|
|
5760
|
-
} else if (
|
|
5760
|
+
} else if (length3 >= LARGE_ARRAY_SIZE3) {
|
|
5761
5761
|
var set = iteratee ? null : createSet_default(array);
|
|
5762
5762
|
if (set) {
|
|
5763
5763
|
return setToArray_default(set);
|
|
@@ -5769,7 +5769,7 @@ function baseUniq(array, iteratee, comparator) {
|
|
|
5769
5769
|
seen = iteratee ? [] : result;
|
|
5770
5770
|
}
|
|
5771
5771
|
outer:
|
|
5772
|
-
while (++index <
|
|
5772
|
+
while (++index < length3) {
|
|
5773
5773
|
var value = array[index], computed2 = iteratee ? iteratee(value) : value;
|
|
5774
5774
|
value = comparator || value !== 0 ? value : 0;
|
|
5775
5775
|
if (isCommon && computed2 === computed2) {
|
|
@@ -5867,9 +5867,9 @@ function queryNodesComparer(a, b2) {
|
|
|
5867
5867
|
return true;
|
|
5868
5868
|
}
|
|
5869
5869
|
var observableArrayMapID = 0;
|
|
5870
|
-
function observableArrayMap(fn, { name: name2, equals:
|
|
5870
|
+
function observableArrayMap(fn, { name: name2, equals: equals5 } = {}) {
|
|
5871
5871
|
const debugName = `observableArrayMap@${++observableArrayMapID}{${name2}}`;
|
|
5872
|
-
if (VERBOSE.isEnabled) VERBOSE(`[${debugName}] create`, { fnname: fn.name, fn, name: name2, equals:
|
|
5872
|
+
if (VERBOSE.isEnabled) VERBOSE(`[${debugName}] create`, { fnname: fn.name, fn, name: name2, equals: equals5 });
|
|
5873
5873
|
let observableArr;
|
|
5874
5874
|
const disposeAutorun = autorunButAlsoImmediately(
|
|
5875
5875
|
fn,
|
|
@@ -5878,10 +5878,10 @@ function observableArrayMap(fn, { name: name2, equals: equals3 } = {}) {
|
|
|
5878
5878
|
observableArr = observable.array(
|
|
5879
5879
|
items,
|
|
5880
5880
|
/* ['NEVER'] as T[] */
|
|
5881
|
-
{ deep: false, name: name2, equals:
|
|
5881
|
+
{ deep: false, name: name2, equals: equals5 }
|
|
5882
5882
|
);
|
|
5883
5883
|
} else {
|
|
5884
|
-
if (!untracked(() => (
|
|
5884
|
+
if (!untracked(() => (equals5 ?? comparer.structural)(observableArr, items))) {
|
|
5885
5885
|
observableArr.replace(items);
|
|
5886
5886
|
if (DEBUG.isEnabled) DEBUG(`[${debugName}] updated`, { updatedItems: items, observableArr });
|
|
5887
5887
|
} else {
|
|
@@ -5966,9 +5966,9 @@ function observableSetMap(fn, { name: name2 } = {}) {
|
|
|
5966
5966
|
return observableSet;
|
|
5967
5967
|
}
|
|
5968
5968
|
var observableMapMapID = 0;
|
|
5969
|
-
function observableMapMap(fn, { name: name2, equals:
|
|
5969
|
+
function observableMapMap(fn, { name: name2, equals: equals5 } = {}) {
|
|
5970
5970
|
const debugName = `observableMapMap@${++observableMapMapID}{${name2}}`;
|
|
5971
|
-
if (DEBUG.isEnabled) DEBUG(`[${debugName}] create`, { fnname: fn.name, fn, name: name2, equals:
|
|
5971
|
+
if (DEBUG.isEnabled) DEBUG(`[${debugName}] create`, { fnname: fn.name, fn, name: name2, equals: equals5 });
|
|
5972
5972
|
let observableMap;
|
|
5973
5973
|
const dispose = autorunButAlsoImmediately(
|
|
5974
5974
|
fn,
|
|
@@ -5981,7 +5981,7 @@ function observableMapMap(fn, { name: name2, equals: equals3 } = {}) {
|
|
|
5981
5981
|
);
|
|
5982
5982
|
if (DEBUG.isEnabled) DEBUG(`[${debugName}] initial`, { items, observableMap });
|
|
5983
5983
|
} else {
|
|
5984
|
-
if (!untracked(() => (
|
|
5984
|
+
if (!untracked(() => (equals5 ?? comparer.structural)([...observableMap.entries()], items))) {
|
|
5985
5985
|
observableMap.replace(items);
|
|
5986
5986
|
if (DEBUG.isEnabled) DEBUG(`[${debugName}] updated`, { items, observableMap });
|
|
5987
5987
|
} else if (DEBUG.isEnabled) DEBUG(`[${debugName}] update skipped`, { items, observableMap });
|
|
@@ -6323,24 +6323,10 @@ __export(src_exports, {
|
|
|
6323
6323
|
stringify: () => format2
|
|
6324
6324
|
});
|
|
6325
6325
|
|
|
6326
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6327
|
-
var typeofs = [
|
|
6328
|
-
"string",
|
|
6329
|
-
"number",
|
|
6330
|
-
"bigint",
|
|
6331
|
-
"symbol"
|
|
6332
|
-
];
|
|
6326
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/is.js
|
|
6333
6327
|
var objectTypeNames = [
|
|
6334
|
-
"Function",
|
|
6335
|
-
"Generator",
|
|
6336
|
-
"AsyncGenerator",
|
|
6337
|
-
"GeneratorFunction",
|
|
6338
|
-
"AsyncGeneratorFunction",
|
|
6339
|
-
"AsyncFunction",
|
|
6340
|
-
"Observable",
|
|
6341
|
-
"Array",
|
|
6342
|
-
"Buffer",
|
|
6343
6328
|
"Object",
|
|
6329
|
+
// for Object.create(null) and other non-plain objects
|
|
6344
6330
|
"RegExp",
|
|
6345
6331
|
"Date",
|
|
6346
6332
|
"Error",
|
|
@@ -6355,7 +6341,6 @@ var objectTypeNames = [
|
|
|
6355
6341
|
"URL",
|
|
6356
6342
|
"HTMLElement",
|
|
6357
6343
|
"Int8Array",
|
|
6358
|
-
"Uint8Array",
|
|
6359
6344
|
"Uint8ClampedArray",
|
|
6360
6345
|
"Int16Array",
|
|
6361
6346
|
"Uint16Array",
|
|
@@ -6377,7 +6362,7 @@ function is(value) {
|
|
|
6377
6362
|
return "boolean";
|
|
6378
6363
|
}
|
|
6379
6364
|
const typeOf = typeof value;
|
|
6380
|
-
if (
|
|
6365
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") {
|
|
6381
6366
|
return typeOf;
|
|
6382
6367
|
}
|
|
6383
6368
|
if (typeOf === "function") {
|
|
@@ -6386,8 +6371,11 @@ function is(value) {
|
|
|
6386
6371
|
if (Array.isArray(value)) {
|
|
6387
6372
|
return "Array";
|
|
6388
6373
|
}
|
|
6389
|
-
if (
|
|
6390
|
-
return "
|
|
6374
|
+
if (value instanceof Uint8Array) {
|
|
6375
|
+
return "Uint8Array";
|
|
6376
|
+
}
|
|
6377
|
+
if (value.constructor === Object) {
|
|
6378
|
+
return "Object";
|
|
6391
6379
|
}
|
|
6392
6380
|
const objectType = getObjectType(value);
|
|
6393
6381
|
if (objectType) {
|
|
@@ -6395,9 +6383,6 @@ function is(value) {
|
|
|
6395
6383
|
}
|
|
6396
6384
|
return "Object";
|
|
6397
6385
|
}
|
|
6398
|
-
function isBuffer2(value) {
|
|
6399
|
-
return value && value.constructor && value.constructor.isBuffer && value.constructor.isBuffer.call(null, value);
|
|
6400
|
-
}
|
|
6401
6386
|
function getObjectType(value) {
|
|
6402
6387
|
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
6403
6388
|
if (objectTypeNames.includes(objectTypeName)) {
|
|
@@ -6406,7 +6391,7 @@ function getObjectType(value) {
|
|
|
6406
6391
|
return void 0;
|
|
6407
6392
|
}
|
|
6408
6393
|
|
|
6409
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6394
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/token.js
|
|
6410
6395
|
var Type = class {
|
|
6411
6396
|
/**
|
|
6412
6397
|
* @param {number} major
|
|
@@ -6430,6 +6415,17 @@ var Type = class {
|
|
|
6430
6415
|
compare(typ) {
|
|
6431
6416
|
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
6432
6417
|
}
|
|
6418
|
+
/**
|
|
6419
|
+
* Check equality between two Type instances. Safe to use across different
|
|
6420
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
6421
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
6422
|
+
* @param {Type} a
|
|
6423
|
+
* @param {Type} b
|
|
6424
|
+
* @returns {boolean}
|
|
6425
|
+
*/
|
|
6426
|
+
static equals(a, b2) {
|
|
6427
|
+
return a === b2 || a.major === b2.major && a.name === b2.name;
|
|
6428
|
+
}
|
|
6433
6429
|
};
|
|
6434
6430
|
Type.uint = new Type(0, "uint", true);
|
|
6435
6431
|
Type.negint = new Type(1, "negint", true);
|
|
@@ -6463,54 +6459,30 @@ var Token = class {
|
|
|
6463
6459
|
}
|
|
6464
6460
|
};
|
|
6465
6461
|
|
|
6466
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6462
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/byte-utils.js
|
|
6467
6463
|
var useBuffer = globalThis.process && // @ts-ignore
|
|
6468
6464
|
!globalThis.process.browser && // @ts-ignore
|
|
6469
6465
|
globalThis.Buffer && // @ts-ignore
|
|
6470
6466
|
typeof globalThis.Buffer.isBuffer === "function";
|
|
6471
|
-
var textDecoder = new TextDecoder();
|
|
6472
6467
|
var textEncoder = new TextEncoder();
|
|
6473
|
-
function
|
|
6474
|
-
return useBuffer && globalThis.Buffer.isBuffer(
|
|
6468
|
+
function isBuffer2(buf) {
|
|
6469
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
6475
6470
|
}
|
|
6476
|
-
function asU8A(
|
|
6477
|
-
if (!(
|
|
6478
|
-
return Uint8Array.from(
|
|
6471
|
+
function asU8A(buf) {
|
|
6472
|
+
if (!(buf instanceof Uint8Array)) {
|
|
6473
|
+
return Uint8Array.from(buf);
|
|
6479
6474
|
}
|
|
6480
|
-
return
|
|
6475
|
+
return isBuffer2(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
6481
6476
|
}
|
|
6482
|
-
var
|
|
6483
|
-
|
|
6484
|
-
/**
|
|
6485
|
-
* @param {Uint8Array} bytes
|
|
6486
|
-
* @param {number} start
|
|
6487
|
-
* @param {number} end
|
|
6488
|
-
*/
|
|
6489
|
-
(bytes, start, end) => {
|
|
6490
|
-
return end - start > 64 ? (
|
|
6491
|
-
// eslint-disable-line operator-linebreak
|
|
6492
|
-
// @ts-ignore
|
|
6493
|
-
globalThis.Buffer.from(bytes.subarray(start, end)).toString("utf8")
|
|
6494
|
-
) : utf8Slice(bytes, start, end);
|
|
6495
|
-
}
|
|
6496
|
-
) : (
|
|
6497
|
-
// eslint-disable-line operator-linebreak
|
|
6498
|
-
/**
|
|
6499
|
-
* @param {Uint8Array} bytes
|
|
6500
|
-
* @param {number} start
|
|
6501
|
-
* @param {number} end
|
|
6502
|
-
*/
|
|
6503
|
-
(bytes, start, end) => {
|
|
6504
|
-
return end - start > 64 ? textDecoder.decode(bytes.subarray(start, end)) : utf8Slice(bytes, start, end);
|
|
6505
|
-
}
|
|
6506
|
-
);
|
|
6477
|
+
var FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
6478
|
+
var FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
6507
6479
|
var fromString = useBuffer ? (
|
|
6508
6480
|
// eslint-disable-line operator-linebreak
|
|
6509
6481
|
/**
|
|
6510
6482
|
* @param {string} string
|
|
6511
6483
|
*/
|
|
6512
6484
|
(string) => {
|
|
6513
|
-
return string.length
|
|
6485
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? (
|
|
6514
6486
|
// eslint-disable-line operator-linebreak
|
|
6515
6487
|
// @ts-ignore
|
|
6516
6488
|
globalThis.Buffer.from(string)
|
|
@@ -6522,9 +6494,12 @@ var fromString = useBuffer ? (
|
|
|
6522
6494
|
* @param {string} string
|
|
6523
6495
|
*/
|
|
6524
6496
|
(string) => {
|
|
6525
|
-
return string.length
|
|
6497
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder.encode(string) : utf8ToBytes(string);
|
|
6526
6498
|
}
|
|
6527
6499
|
);
|
|
6500
|
+
var fromArray = (arr) => {
|
|
6501
|
+
return Uint8Array.from(arr);
|
|
6502
|
+
};
|
|
6528
6503
|
var slice = useBuffer ? (
|
|
6529
6504
|
// eslint-disable-line operator-linebreak
|
|
6530
6505
|
/**
|
|
@@ -6532,8 +6507,9 @@ var slice = useBuffer ? (
|
|
|
6532
6507
|
* @param {number} start
|
|
6533
6508
|
* @param {number} end
|
|
6534
6509
|
*/
|
|
6510
|
+
// Buffer.slice() returns a view, not a copy, so we need special handling
|
|
6535
6511
|
(bytes, start, end) => {
|
|
6536
|
-
if (
|
|
6512
|
+
if (isBuffer2(bytes)) {
|
|
6537
6513
|
return new Uint8Array(bytes.subarray(start, end));
|
|
6538
6514
|
}
|
|
6539
6515
|
return bytes.slice(start, end);
|
|
@@ -6556,13 +6532,13 @@ var concat = useBuffer ? (
|
|
|
6556
6532
|
* @param {number} length
|
|
6557
6533
|
* @returns {Uint8Array}
|
|
6558
6534
|
*/
|
|
6559
|
-
(chunks,
|
|
6535
|
+
(chunks, length3) => {
|
|
6560
6536
|
chunks = chunks.map((c) => c instanceof Uint8Array ? c : (
|
|
6561
6537
|
// eslint-disable-line operator-linebreak
|
|
6562
6538
|
// @ts-ignore
|
|
6563
6539
|
globalThis.Buffer.from(c)
|
|
6564
6540
|
));
|
|
6565
|
-
return asU8A(globalThis.Buffer.concat(chunks,
|
|
6541
|
+
return asU8A(globalThis.Buffer.concat(chunks, length3));
|
|
6566
6542
|
}
|
|
6567
6543
|
) : (
|
|
6568
6544
|
// eslint-disable-line operator-linebreak
|
|
@@ -6571,8 +6547,8 @@ var concat = useBuffer ? (
|
|
|
6571
6547
|
* @param {number} length
|
|
6572
6548
|
* @returns {Uint8Array}
|
|
6573
6549
|
*/
|
|
6574
|
-
(chunks,
|
|
6575
|
-
const out = new Uint8Array(
|
|
6550
|
+
(chunks, length3) => {
|
|
6551
|
+
const out = new Uint8Array(length3);
|
|
6576
6552
|
let off = 0;
|
|
6577
6553
|
for (let b2 of chunks) {
|
|
6578
6554
|
if (off + b2.length > out.length) {
|
|
@@ -6604,7 +6580,7 @@ var alloc = useBuffer ? (
|
|
|
6604
6580
|
}
|
|
6605
6581
|
);
|
|
6606
6582
|
function compare(b1, b2) {
|
|
6607
|
-
if (
|
|
6583
|
+
if (isBuffer2(b1) && isBuffer2(b2)) {
|
|
6608
6584
|
return b1.compare(b2);
|
|
6609
6585
|
}
|
|
6610
6586
|
for (let i = 0; i < b1.length; i++) {
|
|
@@ -6632,6 +6608,9 @@ function utf8ToBytes(str) {
|
|
|
6632
6608
|
out[p++] = c >> 6 & 63 | 128;
|
|
6633
6609
|
out[p++] = c & 63 | 128;
|
|
6634
6610
|
} else {
|
|
6611
|
+
if (c >= 55296 && c <= 57343) {
|
|
6612
|
+
c = 65533;
|
|
6613
|
+
}
|
|
6635
6614
|
out[p++] = c >> 12 | 224;
|
|
6636
6615
|
out[p++] = c >> 6 & 63 | 128;
|
|
6637
6616
|
out[p++] = c & 63 | 128;
|
|
@@ -6639,64 +6618,6 @@ function utf8ToBytes(str) {
|
|
|
6639
6618
|
}
|
|
6640
6619
|
return out;
|
|
6641
6620
|
}
|
|
6642
|
-
function utf8Slice(buf2, offset, end) {
|
|
6643
|
-
const res = [];
|
|
6644
|
-
while (offset < end) {
|
|
6645
|
-
const firstByte = buf2[offset];
|
|
6646
|
-
let codePoint = null;
|
|
6647
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
6648
|
-
if (offset + bytesPerSequence <= end) {
|
|
6649
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
6650
|
-
switch (bytesPerSequence) {
|
|
6651
|
-
case 1:
|
|
6652
|
-
if (firstByte < 128) {
|
|
6653
|
-
codePoint = firstByte;
|
|
6654
|
-
}
|
|
6655
|
-
break;
|
|
6656
|
-
case 2:
|
|
6657
|
-
secondByte = buf2[offset + 1];
|
|
6658
|
-
if ((secondByte & 192) === 128) {
|
|
6659
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
6660
|
-
if (tempCodePoint > 127) {
|
|
6661
|
-
codePoint = tempCodePoint;
|
|
6662
|
-
}
|
|
6663
|
-
}
|
|
6664
|
-
break;
|
|
6665
|
-
case 3:
|
|
6666
|
-
secondByte = buf2[offset + 1];
|
|
6667
|
-
thirdByte = buf2[offset + 2];
|
|
6668
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
6669
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
6670
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
6671
|
-
codePoint = tempCodePoint;
|
|
6672
|
-
}
|
|
6673
|
-
}
|
|
6674
|
-
break;
|
|
6675
|
-
case 4:
|
|
6676
|
-
secondByte = buf2[offset + 1];
|
|
6677
|
-
thirdByte = buf2[offset + 2];
|
|
6678
|
-
fourthByte = buf2[offset + 3];
|
|
6679
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
6680
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
6681
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
6682
|
-
codePoint = tempCodePoint;
|
|
6683
|
-
}
|
|
6684
|
-
}
|
|
6685
|
-
}
|
|
6686
|
-
}
|
|
6687
|
-
if (codePoint === null) {
|
|
6688
|
-
codePoint = 65533;
|
|
6689
|
-
bytesPerSequence = 1;
|
|
6690
|
-
} else if (codePoint > 65535) {
|
|
6691
|
-
codePoint -= 65536;
|
|
6692
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
6693
|
-
codePoint = 56320 | codePoint & 1023;
|
|
6694
|
-
}
|
|
6695
|
-
res.push(codePoint);
|
|
6696
|
-
offset += bytesPerSequence;
|
|
6697
|
-
}
|
|
6698
|
-
return decodeCodePointsArray(res);
|
|
6699
|
-
}
|
|
6700
6621
|
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
6701
6622
|
function decodeCodePointsArray(codePoints) {
|
|
6702
6623
|
const len = codePoints.length;
|
|
@@ -6714,7 +6635,7 @@ function decodeCodePointsArray(codePoints) {
|
|
|
6714
6635
|
return res;
|
|
6715
6636
|
}
|
|
6716
6637
|
|
|
6717
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6638
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/bl.js
|
|
6718
6639
|
var defaultChunkSize = 256;
|
|
6719
6640
|
var Bl = class {
|
|
6720
6641
|
/**
|
|
@@ -6794,8 +6715,42 @@ var Bl = class {
|
|
|
6794
6715
|
return byts;
|
|
6795
6716
|
}
|
|
6796
6717
|
};
|
|
6718
|
+
var U8Bl = class {
|
|
6719
|
+
/**
|
|
6720
|
+
* @param {Uint8Array} dest
|
|
6721
|
+
*/
|
|
6722
|
+
constructor(dest) {
|
|
6723
|
+
this.dest = dest;
|
|
6724
|
+
this.cursor = 0;
|
|
6725
|
+
this.chunks = [dest];
|
|
6726
|
+
}
|
|
6727
|
+
reset() {
|
|
6728
|
+
this.cursor = 0;
|
|
6729
|
+
}
|
|
6730
|
+
/**
|
|
6731
|
+
* @param {Uint8Array|number[]} bytes
|
|
6732
|
+
*/
|
|
6733
|
+
push(bytes) {
|
|
6734
|
+
if (this.cursor + bytes.length > this.dest.length) {
|
|
6735
|
+
throw new Error("write out of bounds, destination buffer is too small");
|
|
6736
|
+
}
|
|
6737
|
+
this.dest.set(bytes, this.cursor);
|
|
6738
|
+
this.cursor += bytes.length;
|
|
6739
|
+
}
|
|
6740
|
+
/**
|
|
6741
|
+
* @param {boolean} [reset]
|
|
6742
|
+
* @returns {Uint8Array}
|
|
6743
|
+
*/
|
|
6744
|
+
toBytes(reset = false) {
|
|
6745
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
6746
|
+
if (reset) {
|
|
6747
|
+
this.reset();
|
|
6748
|
+
}
|
|
6749
|
+
return byts;
|
|
6750
|
+
}
|
|
6751
|
+
};
|
|
6797
6752
|
|
|
6798
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6753
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/common.js
|
|
6799
6754
|
var decodeErrPrefix = "CBOR decode error:";
|
|
6800
6755
|
var encodeErrPrefix = "CBOR encode error:";
|
|
6801
6756
|
var uintMinorPrefixBytes = [];
|
|
@@ -6810,7 +6765,7 @@ function assertEnoughData(data, pos, need) {
|
|
|
6810
6765
|
}
|
|
6811
6766
|
}
|
|
6812
6767
|
|
|
6813
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6768
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/0uint.js
|
|
6814
6769
|
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
|
6815
6770
|
function readUint8(data, offset, options) {
|
|
6816
6771
|
assertEnoughData(data, offset, 1);
|
|
@@ -6864,22 +6819,22 @@ function decodeUint32(data, pos, _minor, options) {
|
|
|
6864
6819
|
function decodeUint64(data, pos, _minor, options) {
|
|
6865
6820
|
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
6866
6821
|
}
|
|
6867
|
-
function encodeUint(
|
|
6868
|
-
return encodeUintValue(
|
|
6822
|
+
function encodeUint(writer, token) {
|
|
6823
|
+
return encodeUintValue(writer, 0, token.value);
|
|
6869
6824
|
}
|
|
6870
|
-
function encodeUintValue(
|
|
6825
|
+
function encodeUintValue(writer, major, uint) {
|
|
6871
6826
|
if (uint < uintBoundaries[0]) {
|
|
6872
6827
|
const nuint = Number(uint);
|
|
6873
|
-
|
|
6828
|
+
writer.push([major | nuint]);
|
|
6874
6829
|
} else if (uint < uintBoundaries[1]) {
|
|
6875
6830
|
const nuint = Number(uint);
|
|
6876
|
-
|
|
6831
|
+
writer.push([major | 24, nuint]);
|
|
6877
6832
|
} else if (uint < uintBoundaries[2]) {
|
|
6878
6833
|
const nuint = Number(uint);
|
|
6879
|
-
|
|
6834
|
+
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
6880
6835
|
} else if (uint < uintBoundaries[3]) {
|
|
6881
6836
|
const nuint = Number(uint);
|
|
6882
|
-
|
|
6837
|
+
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
6883
6838
|
} else {
|
|
6884
6839
|
const buint = BigInt(uint);
|
|
6885
6840
|
if (buint < uintBoundaries[4]) {
|
|
@@ -6900,7 +6855,7 @@ function encodeUintValue(buf2, major, uint) {
|
|
|
6900
6855
|
set[2] = hi & 255;
|
|
6901
6856
|
hi = hi >> 8;
|
|
6902
6857
|
set[1] = hi & 255;
|
|
6903
|
-
|
|
6858
|
+
writer.push(set);
|
|
6904
6859
|
} else {
|
|
6905
6860
|
throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
6906
6861
|
}
|
|
@@ -6931,7 +6886,7 @@ encodeUint.compareTokens = function compareTokens(tok1, tok2) {
|
|
|
6931
6886
|
);
|
|
6932
6887
|
};
|
|
6933
6888
|
|
|
6934
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6889
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/1negint.js
|
|
6935
6890
|
function decodeNegint8(data, pos, _minor, options) {
|
|
6936
6891
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
6937
6892
|
}
|
|
@@ -6956,10 +6911,10 @@ function decodeNegint64(data, pos, _minor, options) {
|
|
|
6956
6911
|
}
|
|
6957
6912
|
return new Token(Type.negint, neg1b - BigInt(int), 9);
|
|
6958
6913
|
}
|
|
6959
|
-
function encodeNegint(
|
|
6914
|
+
function encodeNegint(writer, token) {
|
|
6960
6915
|
const negint = token.value;
|
|
6961
6916
|
const unsigned = typeof negint === "bigint" ? negint * neg1b - pos1b : negint * -1 - 1;
|
|
6962
|
-
encodeUintValue(
|
|
6917
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
6963
6918
|
}
|
|
6964
6919
|
encodeNegint.encodedSize = function encodedSize3(token) {
|
|
6965
6920
|
const negint = token.value;
|
|
@@ -6985,11 +6940,11 @@ encodeNegint.compareTokens = function compareTokens2(tok1, tok2) {
|
|
|
6985
6940
|
);
|
|
6986
6941
|
};
|
|
6987
6942
|
|
|
6988
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
6989
|
-
function toToken(data, pos, prefix,
|
|
6990
|
-
assertEnoughData(data, pos, prefix +
|
|
6991
|
-
const
|
|
6992
|
-
return new Token(Type.bytes,
|
|
6943
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/2bytes.js
|
|
6944
|
+
function toToken(data, pos, prefix, length3) {
|
|
6945
|
+
assertEnoughData(data, pos, prefix + length3);
|
|
6946
|
+
const buf = data.slice(pos + prefix, pos + prefix + length3);
|
|
6947
|
+
return new Token(Type.bytes, buf, prefix + length3);
|
|
6993
6948
|
}
|
|
6994
6949
|
function decodeBytesCompact(data, pos, minor, _options) {
|
|
6995
6950
|
return toToken(data, pos, 1, minor);
|
|
@@ -7012,14 +6967,14 @@ function decodeBytes64(data, pos, _minor, options) {
|
|
|
7012
6967
|
}
|
|
7013
6968
|
function tokenBytes(token) {
|
|
7014
6969
|
if (token.encodedBytes === void 0) {
|
|
7015
|
-
token.encodedBytes = token.type
|
|
6970
|
+
token.encodedBytes = Type.equals(token.type, Type.string) ? fromString(token.value) : token.value;
|
|
7016
6971
|
}
|
|
7017
6972
|
return token.encodedBytes;
|
|
7018
6973
|
}
|
|
7019
|
-
function encodeBytes(
|
|
6974
|
+
function encodeBytes(writer, token) {
|
|
7020
6975
|
const bytes = tokenBytes(token);
|
|
7021
|
-
encodeUintValue(
|
|
7022
|
-
|
|
6976
|
+
encodeUintValue(writer, token.type.majorEncoded, bytes.length);
|
|
6977
|
+
writer.push(bytes);
|
|
7023
6978
|
}
|
|
7024
6979
|
encodeBytes.encodedSize = function encodedSize4(token) {
|
|
7025
6980
|
const bytes = tokenBytes(token);
|
|
@@ -7032,13 +6987,30 @@ function compareBytes(b1, b2) {
|
|
|
7032
6987
|
return b1.length < b2.length ? -1 : b1.length > b2.length ? 1 : compare(b1, b2);
|
|
7033
6988
|
}
|
|
7034
6989
|
|
|
7035
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7036
|
-
|
|
7037
|
-
|
|
6990
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/3string.js
|
|
6991
|
+
var textDecoder = new TextDecoder();
|
|
6992
|
+
var ASCII_THRESHOLD = 32;
|
|
6993
|
+
function toStr(bytes, start, end) {
|
|
6994
|
+
const len = end - start;
|
|
6995
|
+
if (len < ASCII_THRESHOLD) {
|
|
6996
|
+
let str = "";
|
|
6997
|
+
for (let i = start; i < end; i++) {
|
|
6998
|
+
const c = bytes[i];
|
|
6999
|
+
if (c & 128) {
|
|
7000
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
7001
|
+
}
|
|
7002
|
+
str += String.fromCharCode(c);
|
|
7003
|
+
}
|
|
7004
|
+
return str;
|
|
7005
|
+
}
|
|
7006
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
7007
|
+
}
|
|
7008
|
+
function toToken2(data, pos, prefix, length3, options) {
|
|
7009
|
+
const totLength = prefix + length3;
|
|
7038
7010
|
assertEnoughData(data, pos, totLength);
|
|
7039
|
-
const tok = new Token(Type.string,
|
|
7011
|
+
const tok = new Token(Type.string, toStr(data, pos + prefix, pos + totLength), totLength);
|
|
7040
7012
|
if (options.retainStringBytes === true) {
|
|
7041
|
-
tok.byteValue = slice(
|
|
7013
|
+
tok.byteValue = data.slice(pos + prefix, pos + totLength);
|
|
7042
7014
|
}
|
|
7043
7015
|
return tok;
|
|
7044
7016
|
}
|
|
@@ -7063,9 +7035,9 @@ function decodeString64(data, pos, _minor, options) {
|
|
|
7063
7035
|
}
|
|
7064
7036
|
var encodeString = encodeBytes;
|
|
7065
7037
|
|
|
7066
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7067
|
-
function toToken3(_data, _pos, prefix,
|
|
7068
|
-
return new Token(Type.array,
|
|
7038
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/4array.js
|
|
7039
|
+
function toToken3(_data, _pos, prefix, length3) {
|
|
7040
|
+
return new Token(Type.array, length3, prefix);
|
|
7069
7041
|
}
|
|
7070
7042
|
function decodeArrayCompact(data, pos, minor, _options) {
|
|
7071
7043
|
return toToken3(data, pos, 1, minor);
|
|
@@ -7092,17 +7064,17 @@ function decodeArrayIndefinite(data, pos, _minor, options) {
|
|
|
7092
7064
|
}
|
|
7093
7065
|
return toToken3(data, pos, 1, Infinity);
|
|
7094
7066
|
}
|
|
7095
|
-
function encodeArray(
|
|
7096
|
-
encodeUintValue(
|
|
7067
|
+
function encodeArray(writer, token) {
|
|
7068
|
+
encodeUintValue(writer, Type.array.majorEncoded, token.value);
|
|
7097
7069
|
}
|
|
7098
7070
|
encodeArray.compareTokens = encodeUint.compareTokens;
|
|
7099
7071
|
encodeArray.encodedSize = function encodedSize5(token) {
|
|
7100
7072
|
return encodeUintValue.encodedSize(token.value);
|
|
7101
7073
|
};
|
|
7102
7074
|
|
|
7103
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7104
|
-
function toToken4(_data, _pos, prefix,
|
|
7105
|
-
return new Token(Type.map,
|
|
7075
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/5map.js
|
|
7076
|
+
function toToken4(_data, _pos, prefix, length3) {
|
|
7077
|
+
return new Token(Type.map, length3, prefix);
|
|
7106
7078
|
}
|
|
7107
7079
|
function decodeMapCompact(data, pos, minor, _options) {
|
|
7108
7080
|
return toToken4(data, pos, 1, minor);
|
|
@@ -7129,15 +7101,15 @@ function decodeMapIndefinite(data, pos, _minor, options) {
|
|
|
7129
7101
|
}
|
|
7130
7102
|
return toToken4(data, pos, 1, Infinity);
|
|
7131
7103
|
}
|
|
7132
|
-
function encodeMap(
|
|
7133
|
-
encodeUintValue(
|
|
7104
|
+
function encodeMap(writer, token) {
|
|
7105
|
+
encodeUintValue(writer, Type.map.majorEncoded, token.value);
|
|
7134
7106
|
}
|
|
7135
7107
|
encodeMap.compareTokens = encodeUint.compareTokens;
|
|
7136
7108
|
encodeMap.encodedSize = function encodedSize6(token) {
|
|
7137
7109
|
return encodeUintValue.encodedSize(token.value);
|
|
7138
7110
|
};
|
|
7139
7111
|
|
|
7140
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7112
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/6tag.js
|
|
7141
7113
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
|
7142
7114
|
return new Token(Type.tag, minor, 1);
|
|
7143
7115
|
}
|
|
@@ -7153,15 +7125,15 @@ function decodeTag32(data, pos, _minor, options) {
|
|
|
7153
7125
|
function decodeTag64(data, pos, _minor, options) {
|
|
7154
7126
|
return new Token(Type.tag, readUint64(data, pos + 1, options), 9);
|
|
7155
7127
|
}
|
|
7156
|
-
function encodeTag(
|
|
7157
|
-
encodeUintValue(
|
|
7128
|
+
function encodeTag(writer, token) {
|
|
7129
|
+
encodeUintValue(writer, Type.tag.majorEncoded, token.value);
|
|
7158
7130
|
}
|
|
7159
7131
|
encodeTag.compareTokens = encodeUint.compareTokens;
|
|
7160
7132
|
encodeTag.encodedSize = function encodedSize7(token) {
|
|
7161
7133
|
return encodeUintValue.encodedSize(token.value);
|
|
7162
7134
|
};
|
|
7163
7135
|
|
|
7164
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7136
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/7float.js
|
|
7165
7137
|
var MINOR_FALSE = 20;
|
|
7166
7138
|
var MINOR_TRUE = 21;
|
|
7167
7139
|
var MINOR_NULL = 22;
|
|
@@ -7200,16 +7172,16 @@ function decodeFloat32(data, pos, _minor, options) {
|
|
|
7200
7172
|
function decodeFloat64(data, pos, _minor, options) {
|
|
7201
7173
|
return createToken(readFloat64(data, pos + 1), 9, options);
|
|
7202
7174
|
}
|
|
7203
|
-
function encodeFloat(
|
|
7175
|
+
function encodeFloat(writer, token, options) {
|
|
7204
7176
|
const float = token.value;
|
|
7205
7177
|
if (float === false) {
|
|
7206
|
-
|
|
7178
|
+
writer.push([Type.float.majorEncoded | MINOR_FALSE]);
|
|
7207
7179
|
} else if (float === true) {
|
|
7208
|
-
|
|
7180
|
+
writer.push([Type.float.majorEncoded | MINOR_TRUE]);
|
|
7209
7181
|
} else if (float === null) {
|
|
7210
|
-
|
|
7182
|
+
writer.push([Type.float.majorEncoded | MINOR_NULL]);
|
|
7211
7183
|
} else if (float === void 0) {
|
|
7212
|
-
|
|
7184
|
+
writer.push([Type.float.majorEncoded | MINOR_UNDEFINED]);
|
|
7213
7185
|
} else {
|
|
7214
7186
|
let decoded;
|
|
7215
7187
|
let success = false;
|
|
@@ -7218,14 +7190,14 @@ function encodeFloat(buf2, token, options) {
|
|
|
7218
7190
|
decoded = readFloat16(ui8a, 1);
|
|
7219
7191
|
if (float === decoded || Number.isNaN(float)) {
|
|
7220
7192
|
ui8a[0] = 249;
|
|
7221
|
-
|
|
7193
|
+
writer.push(ui8a.slice(0, 3));
|
|
7222
7194
|
success = true;
|
|
7223
7195
|
} else {
|
|
7224
7196
|
encodeFloat32(float);
|
|
7225
7197
|
decoded = readFloat32(ui8a, 1);
|
|
7226
7198
|
if (float === decoded) {
|
|
7227
7199
|
ui8a[0] = 250;
|
|
7228
|
-
|
|
7200
|
+
writer.push(ui8a.slice(0, 5));
|
|
7229
7201
|
success = true;
|
|
7230
7202
|
}
|
|
7231
7203
|
}
|
|
@@ -7234,7 +7206,7 @@ function encodeFloat(buf2, token, options) {
|
|
|
7234
7206
|
encodeFloat64(float);
|
|
7235
7207
|
decoded = readFloat64(ui8a, 1);
|
|
7236
7208
|
ui8a[0] = 251;
|
|
7237
|
-
|
|
7209
|
+
writer.push(ui8a.slice(0, 9));
|
|
7238
7210
|
}
|
|
7239
7211
|
}
|
|
7240
7212
|
}
|
|
@@ -7337,7 +7309,7 @@ function readFloat64(ui8a2, pos) {
|
|
|
7337
7309
|
}
|
|
7338
7310
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
|
7339
7311
|
|
|
7340
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7312
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/jump.js
|
|
7341
7313
|
function invalidMinor(data, pos, minor) {
|
|
7342
7314
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
|
7343
7315
|
}
|
|
@@ -7453,8 +7425,57 @@ quick[160] = new Token(Type.map, 0, 1);
|
|
|
7453
7425
|
quick[244] = new Token(Type.false, false, 1);
|
|
7454
7426
|
quick[245] = new Token(Type.true, true, 1);
|
|
7455
7427
|
quick[246] = new Token(Type.null, null, 1);
|
|
7428
|
+
function quickEncodeToken(token) {
|
|
7429
|
+
switch (token.type) {
|
|
7430
|
+
case Type.false:
|
|
7431
|
+
return fromArray([244]);
|
|
7432
|
+
case Type.true:
|
|
7433
|
+
return fromArray([245]);
|
|
7434
|
+
case Type.null:
|
|
7435
|
+
return fromArray([246]);
|
|
7436
|
+
case Type.bytes:
|
|
7437
|
+
if (!token.value.length) {
|
|
7438
|
+
return fromArray([64]);
|
|
7439
|
+
}
|
|
7440
|
+
return;
|
|
7441
|
+
case Type.string:
|
|
7442
|
+
if (token.value === "") {
|
|
7443
|
+
return fromArray([96]);
|
|
7444
|
+
}
|
|
7445
|
+
return;
|
|
7446
|
+
case Type.array:
|
|
7447
|
+
if (token.value === 0) {
|
|
7448
|
+
return fromArray([128]);
|
|
7449
|
+
}
|
|
7450
|
+
return;
|
|
7451
|
+
case Type.map:
|
|
7452
|
+
if (token.value === 0) {
|
|
7453
|
+
return fromArray([160]);
|
|
7454
|
+
}
|
|
7455
|
+
return;
|
|
7456
|
+
case Type.uint:
|
|
7457
|
+
if (token.value < 24) {
|
|
7458
|
+
return fromArray([Number(token.value)]);
|
|
7459
|
+
}
|
|
7460
|
+
return;
|
|
7461
|
+
case Type.negint:
|
|
7462
|
+
if (token.value >= -24) {
|
|
7463
|
+
return fromArray([31 - Number(token.value)]);
|
|
7464
|
+
}
|
|
7465
|
+
}
|
|
7466
|
+
}
|
|
7456
7467
|
|
|
7457
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7468
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/encode.js
|
|
7469
|
+
var defaultEncodeOptions = {
|
|
7470
|
+
float64: false,
|
|
7471
|
+
mapSorter,
|
|
7472
|
+
quickEncodeToken
|
|
7473
|
+
};
|
|
7474
|
+
var rfc8949EncodeOptions = Object.freeze({
|
|
7475
|
+
float64: true,
|
|
7476
|
+
mapSorter: rfc8949MapSorter,
|
|
7477
|
+
quickEncodeToken
|
|
7478
|
+
});
|
|
7458
7479
|
function makeCborEncoders() {
|
|
7459
7480
|
const encoders = [];
|
|
7460
7481
|
encoders[Type.uint.major] = encodeUint;
|
|
@@ -7468,7 +7489,7 @@ function makeCborEncoders() {
|
|
|
7468
7489
|
return encoders;
|
|
7469
7490
|
}
|
|
7470
7491
|
var cborEncoders = makeCborEncoders();
|
|
7471
|
-
var
|
|
7492
|
+
var defaultWriter = new Bl();
|
|
7472
7493
|
var Ref = class _Ref {
|
|
7473
7494
|
/**
|
|
7474
7495
|
* @param {object|any[]} obj
|
|
@@ -7647,27 +7668,38 @@ var typeEncoders = {
|
|
|
7647
7668
|
Object(obj, typ, options, refStack) {
|
|
7648
7669
|
const isMap = typ !== "Object";
|
|
7649
7670
|
const keys2 = isMap ? obj.keys() : Object.keys(obj);
|
|
7650
|
-
const
|
|
7651
|
-
|
|
7671
|
+
const maxLength = isMap ? obj.size : keys2.length;
|
|
7672
|
+
let entries;
|
|
7673
|
+
if (maxLength) {
|
|
7674
|
+
entries = new Array(maxLength);
|
|
7675
|
+
refStack = Ref.createCheck(refStack, obj);
|
|
7676
|
+
const skipUndefined = !isMap && options.ignoreUndefinedProperties;
|
|
7677
|
+
let i = 0;
|
|
7678
|
+
for (const key of keys2) {
|
|
7679
|
+
const value = isMap ? obj.get(key) : obj[key];
|
|
7680
|
+
if (skipUndefined && value === void 0) {
|
|
7681
|
+
continue;
|
|
7682
|
+
}
|
|
7683
|
+
entries[i++] = [
|
|
7684
|
+
objectToTokens(key, options, refStack),
|
|
7685
|
+
objectToTokens(value, options, refStack)
|
|
7686
|
+
];
|
|
7687
|
+
}
|
|
7688
|
+
if (i < maxLength) {
|
|
7689
|
+
entries.length = i;
|
|
7690
|
+
}
|
|
7691
|
+
}
|
|
7692
|
+
if (!entries?.length) {
|
|
7652
7693
|
if (options.addBreakTokens === true) {
|
|
7653
7694
|
return [simpleTokens.emptyMap, new Token(Type.break)];
|
|
7654
7695
|
}
|
|
7655
7696
|
return simpleTokens.emptyMap;
|
|
7656
7697
|
}
|
|
7657
|
-
refStack = Ref.createCheck(refStack, obj);
|
|
7658
|
-
const entries = [];
|
|
7659
|
-
let i = 0;
|
|
7660
|
-
for (const key of keys2) {
|
|
7661
|
-
entries[i++] = [
|
|
7662
|
-
objectToTokens(key, options, refStack),
|
|
7663
|
-
objectToTokens(isMap ? obj.get(key) : obj[key], options, refStack)
|
|
7664
|
-
];
|
|
7665
|
-
}
|
|
7666
7698
|
sortMapEntries(entries, options);
|
|
7667
7699
|
if (options.addBreakTokens) {
|
|
7668
|
-
return [new Token(Type.map,
|
|
7700
|
+
return [new Token(Type.map, entries.length), entries, new Token(Type.break)];
|
|
7669
7701
|
}
|
|
7670
|
-
return [new Token(Type.map,
|
|
7702
|
+
return [new Token(Type.map, entries.length), entries];
|
|
7671
7703
|
}
|
|
7672
7704
|
};
|
|
7673
7705
|
typeEncoders.Map = typeEncoders.Object;
|
|
@@ -7696,39 +7728,180 @@ function sortMapEntries(entries, options) {
|
|
|
7696
7728
|
entries.sort(options.mapSorter);
|
|
7697
7729
|
}
|
|
7698
7730
|
}
|
|
7699
|
-
function
|
|
7731
|
+
function mapSorter(e1, e2) {
|
|
7732
|
+
const keyToken1 = Array.isArray(e1[0]) ? e1[0][0] : e1[0];
|
|
7733
|
+
const keyToken2 = Array.isArray(e2[0]) ? e2[0][0] : e2[0];
|
|
7734
|
+
if (keyToken1.type !== keyToken2.type) {
|
|
7735
|
+
return keyToken1.type.compare(keyToken2.type);
|
|
7736
|
+
}
|
|
7737
|
+
const major = keyToken1.type.major;
|
|
7738
|
+
const tcmp = cborEncoders[major].compareTokens(keyToken1, keyToken2);
|
|
7739
|
+
if (tcmp === 0) {
|
|
7740
|
+
console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone");
|
|
7741
|
+
}
|
|
7742
|
+
return tcmp;
|
|
7743
|
+
}
|
|
7744
|
+
function rfc8949MapSorter(e1, e2) {
|
|
7745
|
+
if (e1[0] instanceof Token && e2[0] instanceof Token) {
|
|
7746
|
+
const t1 = (
|
|
7747
|
+
/** @type {TokenEx} */
|
|
7748
|
+
e1[0]
|
|
7749
|
+
);
|
|
7750
|
+
const t2 = (
|
|
7751
|
+
/** @type {TokenEx} */
|
|
7752
|
+
e2[0]
|
|
7753
|
+
);
|
|
7754
|
+
if (!t1._keyBytes) {
|
|
7755
|
+
t1._keyBytes = encodeRfc8949(t1.value);
|
|
7756
|
+
}
|
|
7757
|
+
if (!t2._keyBytes) {
|
|
7758
|
+
t2._keyBytes = encodeRfc8949(t2.value);
|
|
7759
|
+
}
|
|
7760
|
+
return compare(t1._keyBytes, t2._keyBytes);
|
|
7761
|
+
}
|
|
7762
|
+
throw new Error("rfc8949MapSorter: complex key types are not supported yet");
|
|
7763
|
+
}
|
|
7764
|
+
function encodeRfc8949(data) {
|
|
7765
|
+
return encodeCustom(data, cborEncoders, rfc8949EncodeOptions);
|
|
7766
|
+
}
|
|
7767
|
+
function tokensToEncoded(writer, tokens, encoders, options) {
|
|
7700
7768
|
if (Array.isArray(tokens)) {
|
|
7701
7769
|
for (const token of tokens) {
|
|
7702
|
-
tokensToEncoded(
|
|
7770
|
+
tokensToEncoded(writer, token, encoders, options);
|
|
7703
7771
|
}
|
|
7704
7772
|
} else {
|
|
7705
|
-
encoders[tokens.type.major](
|
|
7773
|
+
encoders[tokens.type.major](writer, tokens, options);
|
|
7774
|
+
}
|
|
7775
|
+
}
|
|
7776
|
+
var MAJOR_UINT = Type.uint.majorEncoded;
|
|
7777
|
+
var MAJOR_NEGINT = Type.negint.majorEncoded;
|
|
7778
|
+
var MAJOR_BYTES = Type.bytes.majorEncoded;
|
|
7779
|
+
var MAJOR_STRING = Type.string.majorEncoded;
|
|
7780
|
+
var MAJOR_ARRAY = Type.array.majorEncoded;
|
|
7781
|
+
var SIMPLE_FALSE = Type.float.majorEncoded | MINOR_FALSE;
|
|
7782
|
+
var SIMPLE_TRUE = Type.float.majorEncoded | MINOR_TRUE;
|
|
7783
|
+
var SIMPLE_NULL = Type.float.majorEncoded | MINOR_NULL;
|
|
7784
|
+
var SIMPLE_UNDEFINED = Type.float.majorEncoded | MINOR_UNDEFINED;
|
|
7785
|
+
var neg1b2 = BigInt(-1);
|
|
7786
|
+
var pos1b2 = BigInt(1);
|
|
7787
|
+
function canDirectEncode(options) {
|
|
7788
|
+
return options.addBreakTokens !== true;
|
|
7789
|
+
}
|
|
7790
|
+
function directEncode(writer, data, options, refStack) {
|
|
7791
|
+
const typ = is(data);
|
|
7792
|
+
const customEncoder = options.typeEncoders && options.typeEncoders[typ];
|
|
7793
|
+
if (customEncoder) {
|
|
7794
|
+
const tokens = customEncoder(data, typ, options, refStack);
|
|
7795
|
+
if (tokens != null) {
|
|
7796
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
7797
|
+
return;
|
|
7798
|
+
}
|
|
7799
|
+
}
|
|
7800
|
+
switch (typ) {
|
|
7801
|
+
case "null":
|
|
7802
|
+
writer.push([SIMPLE_NULL]);
|
|
7803
|
+
return;
|
|
7804
|
+
case "undefined":
|
|
7805
|
+
writer.push([SIMPLE_UNDEFINED]);
|
|
7806
|
+
return;
|
|
7807
|
+
case "boolean":
|
|
7808
|
+
writer.push([data ? SIMPLE_TRUE : SIMPLE_FALSE]);
|
|
7809
|
+
return;
|
|
7810
|
+
case "number":
|
|
7811
|
+
if (!Number.isInteger(data) || !Number.isSafeInteger(data)) {
|
|
7812
|
+
encodeFloat(writer, new Token(Type.float, data), options);
|
|
7813
|
+
} else if (data >= 0) {
|
|
7814
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
7815
|
+
} else {
|
|
7816
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * -1 - 1);
|
|
7817
|
+
}
|
|
7818
|
+
return;
|
|
7819
|
+
case "bigint":
|
|
7820
|
+
if (data >= BigInt(0)) {
|
|
7821
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
7822
|
+
} else {
|
|
7823
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * neg1b2 - pos1b2);
|
|
7824
|
+
}
|
|
7825
|
+
return;
|
|
7826
|
+
case "string": {
|
|
7827
|
+
const bytes = fromString(data);
|
|
7828
|
+
encodeUintValue(writer, MAJOR_STRING, bytes.length);
|
|
7829
|
+
writer.push(bytes);
|
|
7830
|
+
return;
|
|
7831
|
+
}
|
|
7832
|
+
case "Uint8Array":
|
|
7833
|
+
encodeUintValue(writer, MAJOR_BYTES, data.length);
|
|
7834
|
+
writer.push(data);
|
|
7835
|
+
return;
|
|
7836
|
+
case "Array":
|
|
7837
|
+
if (!data.length) {
|
|
7838
|
+
writer.push([MAJOR_ARRAY]);
|
|
7839
|
+
return;
|
|
7840
|
+
}
|
|
7841
|
+
refStack = Ref.createCheck(refStack, data);
|
|
7842
|
+
encodeUintValue(writer, MAJOR_ARRAY, data.length);
|
|
7843
|
+
for (const elem of data) {
|
|
7844
|
+
directEncode(writer, elem, options, refStack);
|
|
7845
|
+
}
|
|
7846
|
+
return;
|
|
7847
|
+
case "Object":
|
|
7848
|
+
case "Map":
|
|
7849
|
+
{
|
|
7850
|
+
const tokens = typeEncoders.Object(data, typ, options, refStack);
|
|
7851
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
7852
|
+
}
|
|
7853
|
+
return;
|
|
7854
|
+
default: {
|
|
7855
|
+
const typeEncoder = typeEncoders[typ];
|
|
7856
|
+
if (!typeEncoder) {
|
|
7857
|
+
throw new Error(`${encodeErrPrefix} unsupported type: ${typ}`);
|
|
7858
|
+
}
|
|
7859
|
+
const tokens = typeEncoder(data, typ, options, refStack);
|
|
7860
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
7861
|
+
}
|
|
7706
7862
|
}
|
|
7707
7863
|
}
|
|
7708
|
-
function encodeCustom(data, encoders, options) {
|
|
7864
|
+
function encodeCustom(data, encoders, options, destination) {
|
|
7865
|
+
const hasDest = destination instanceof Uint8Array;
|
|
7866
|
+
let writeTo = hasDest ? new U8Bl(destination) : defaultWriter;
|
|
7709
7867
|
const tokens = objectToTokens(data, options);
|
|
7710
7868
|
if (!Array.isArray(tokens) && options.quickEncodeToken) {
|
|
7711
7869
|
const quickBytes = options.quickEncodeToken(tokens);
|
|
7712
7870
|
if (quickBytes) {
|
|
7871
|
+
if (hasDest) {
|
|
7872
|
+
writeTo.push(quickBytes);
|
|
7873
|
+
return writeTo.toBytes();
|
|
7874
|
+
}
|
|
7713
7875
|
return quickBytes;
|
|
7714
7876
|
}
|
|
7715
7877
|
const encoder = encoders[tokens.type.major];
|
|
7716
7878
|
if (encoder.encodedSize) {
|
|
7717
7879
|
const size = encoder.encodedSize(tokens, options);
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7880
|
+
if (!hasDest) {
|
|
7881
|
+
writeTo = new Bl(size);
|
|
7882
|
+
}
|
|
7883
|
+
encoder(writeTo, tokens, options);
|
|
7884
|
+
if (writeTo.chunks.length !== 1) {
|
|
7721
7885
|
throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
|
|
7722
7886
|
}
|
|
7723
|
-
return asU8A(
|
|
7887
|
+
return hasDest ? writeTo.toBytes() : asU8A(writeTo.chunks[0]);
|
|
7724
7888
|
}
|
|
7725
7889
|
}
|
|
7726
|
-
|
|
7727
|
-
tokensToEncoded(
|
|
7728
|
-
return
|
|
7890
|
+
writeTo.reset();
|
|
7891
|
+
tokensToEncoded(writeTo, tokens, encoders, options);
|
|
7892
|
+
return writeTo.toBytes(true);
|
|
7893
|
+
}
|
|
7894
|
+
function encode(data, options) {
|
|
7895
|
+
options = Object.assign({}, defaultEncodeOptions, options);
|
|
7896
|
+
if (canDirectEncode(options)) {
|
|
7897
|
+
defaultWriter.reset();
|
|
7898
|
+
directEncode(defaultWriter, data, options, void 0);
|
|
7899
|
+
return defaultWriter.toBytes(true);
|
|
7900
|
+
}
|
|
7901
|
+
return encodeCustom(data, cborEncoders, options);
|
|
7729
7902
|
}
|
|
7730
7903
|
|
|
7731
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
7904
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/decode.js
|
|
7732
7905
|
var defaultDecodeOptions = {
|
|
7733
7906
|
strict: false,
|
|
7734
7907
|
allowIndefinite: true,
|
|
@@ -7787,6 +7960,7 @@ function tokenToArray(token, tokeniser, options) {
|
|
|
7787
7960
|
}
|
|
7788
7961
|
function tokenToMap(token, tokeniser, options) {
|
|
7789
7962
|
const useMaps = options.useMaps === true;
|
|
7963
|
+
const rejectDuplicateMapKeys = options.rejectDuplicateMapKeys === true;
|
|
7790
7964
|
const obj = useMaps ? void 0 : {};
|
|
7791
7965
|
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
7792
7966
|
for (let i = 0; i < token.value; i++) {
|
|
@@ -7800,11 +7974,11 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
7800
7974
|
if (key === DONE) {
|
|
7801
7975
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
7802
7976
|
}
|
|
7803
|
-
if (useMaps
|
|
7977
|
+
if (!useMaps && typeof key !== "string") {
|
|
7804
7978
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
7805
7979
|
}
|
|
7806
|
-
if (
|
|
7807
|
-
if (useMaps && m.has(key) || !useMaps && key
|
|
7980
|
+
if (rejectDuplicateMapKeys) {
|
|
7981
|
+
if (useMaps && m.has(key) || !useMaps && Object.hasOwn(obj, key)) {
|
|
7808
7982
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
7809
7983
|
}
|
|
7810
7984
|
}
|
|
@@ -7825,19 +7999,19 @@ function tokensToObject(tokeniser, options) {
|
|
|
7825
7999
|
return DONE;
|
|
7826
8000
|
}
|
|
7827
8001
|
const token = tokeniser.next();
|
|
7828
|
-
if (token.type
|
|
8002
|
+
if (Type.equals(token.type, Type.break)) {
|
|
7829
8003
|
return BREAK;
|
|
7830
8004
|
}
|
|
7831
8005
|
if (token.type.terminal) {
|
|
7832
8006
|
return token.value;
|
|
7833
8007
|
}
|
|
7834
|
-
if (token.type
|
|
8008
|
+
if (Type.equals(token.type, Type.array)) {
|
|
7835
8009
|
return tokenToArray(token, tokeniser, options);
|
|
7836
8010
|
}
|
|
7837
|
-
if (token.type
|
|
8011
|
+
if (Type.equals(token.type, Type.map)) {
|
|
7838
8012
|
return tokenToMap(token, tokeniser, options);
|
|
7839
8013
|
}
|
|
7840
|
-
if (token.type
|
|
8014
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
7841
8015
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
7842
8016
|
const tagged = tokensToObject(tokeniser, options);
|
|
7843
8017
|
return options.tags[token.value](tagged);
|
|
@@ -7851,7 +8025,8 @@ function decodeFirst(data, options) {
|
|
|
7851
8025
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
7852
8026
|
}
|
|
7853
8027
|
options = Object.assign({}, defaultDecodeOptions, options);
|
|
7854
|
-
const
|
|
8028
|
+
const u8aData = asU8A(data);
|
|
8029
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
7855
8030
|
const decoded = tokensToObject(tokeniser, options);
|
|
7856
8031
|
if (decoded === DONE) {
|
|
7857
8032
|
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
@@ -7869,108 +8044,108 @@ function decode(data, options) {
|
|
|
7869
8044
|
return decoded;
|
|
7870
8045
|
}
|
|
7871
8046
|
|
|
7872
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
8047
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/json/encode.js
|
|
7873
8048
|
var JSONEncoder = class extends Array {
|
|
7874
8049
|
constructor() {
|
|
7875
8050
|
super();
|
|
7876
8051
|
this.inRecursive = [];
|
|
7877
8052
|
}
|
|
7878
8053
|
/**
|
|
7879
|
-
* @param {
|
|
8054
|
+
* @param {ByteWriter} buf
|
|
7880
8055
|
*/
|
|
7881
|
-
prefix(
|
|
8056
|
+
prefix(buf) {
|
|
7882
8057
|
const recurs = this.inRecursive[this.inRecursive.length - 1];
|
|
7883
8058
|
if (recurs) {
|
|
7884
|
-
if (recurs.type
|
|
8059
|
+
if (Type.equals(recurs.type, Type.array)) {
|
|
7885
8060
|
recurs.elements++;
|
|
7886
8061
|
if (recurs.elements !== 1) {
|
|
7887
|
-
|
|
8062
|
+
buf.push([44]);
|
|
7888
8063
|
}
|
|
7889
8064
|
}
|
|
7890
|
-
if (recurs.type
|
|
8065
|
+
if (Type.equals(recurs.type, Type.map)) {
|
|
7891
8066
|
recurs.elements++;
|
|
7892
8067
|
if (recurs.elements !== 1) {
|
|
7893
8068
|
if (recurs.elements % 2 === 1) {
|
|
7894
|
-
|
|
8069
|
+
buf.push([44]);
|
|
7895
8070
|
} else {
|
|
7896
|
-
|
|
8071
|
+
buf.push([58]);
|
|
7897
8072
|
}
|
|
7898
8073
|
}
|
|
7899
8074
|
}
|
|
7900
8075
|
}
|
|
7901
8076
|
}
|
|
7902
8077
|
/**
|
|
7903
|
-
* @param {
|
|
8078
|
+
* @param {ByteWriter} buf
|
|
7904
8079
|
* @param {Token} token
|
|
7905
8080
|
*/
|
|
7906
|
-
[Type.uint.major](
|
|
7907
|
-
this.prefix(
|
|
8081
|
+
[Type.uint.major](buf, token) {
|
|
8082
|
+
this.prefix(buf);
|
|
7908
8083
|
const is2 = String(token.value);
|
|
7909
8084
|
const isa = [];
|
|
7910
8085
|
for (let i = 0; i < is2.length; i++) {
|
|
7911
8086
|
isa[i] = is2.charCodeAt(i);
|
|
7912
8087
|
}
|
|
7913
|
-
|
|
8088
|
+
buf.push(isa);
|
|
7914
8089
|
}
|
|
7915
8090
|
/**
|
|
7916
|
-
* @param {
|
|
8091
|
+
* @param {ByteWriter} buf
|
|
7917
8092
|
* @param {Token} token
|
|
7918
8093
|
*/
|
|
7919
|
-
[Type.negint.major](
|
|
7920
|
-
this[Type.uint.major](
|
|
8094
|
+
[Type.negint.major](buf, token) {
|
|
8095
|
+
this[Type.uint.major](buf, token);
|
|
7921
8096
|
}
|
|
7922
8097
|
/**
|
|
7923
|
-
* @param {
|
|
8098
|
+
* @param {ByteWriter} _buf
|
|
7924
8099
|
* @param {Token} _token
|
|
7925
8100
|
*/
|
|
7926
8101
|
[Type.bytes.major](_buf, _token) {
|
|
7927
8102
|
throw new Error(`${encodeErrPrefix} unsupported type: Uint8Array`);
|
|
7928
8103
|
}
|
|
7929
8104
|
/**
|
|
7930
|
-
* @param {
|
|
8105
|
+
* @param {ByteWriter} buf
|
|
7931
8106
|
* @param {Token} token
|
|
7932
8107
|
*/
|
|
7933
|
-
[Type.string.major](
|
|
7934
|
-
this.prefix(
|
|
8108
|
+
[Type.string.major](buf, token) {
|
|
8109
|
+
this.prefix(buf);
|
|
7935
8110
|
const byts = fromString(JSON.stringify(token.value));
|
|
7936
|
-
|
|
8111
|
+
buf.push(byts.length > 32 ? asU8A(byts) : byts);
|
|
7937
8112
|
}
|
|
7938
8113
|
/**
|
|
7939
|
-
* @param {
|
|
8114
|
+
* @param {ByteWriter} buf
|
|
7940
8115
|
* @param {Token} _token
|
|
7941
8116
|
*/
|
|
7942
|
-
[Type.array.major](
|
|
7943
|
-
this.prefix(
|
|
8117
|
+
[Type.array.major](buf, _token) {
|
|
8118
|
+
this.prefix(buf);
|
|
7944
8119
|
this.inRecursive.push({ type: Type.array, elements: 0 });
|
|
7945
|
-
|
|
8120
|
+
buf.push([91]);
|
|
7946
8121
|
}
|
|
7947
8122
|
/**
|
|
7948
|
-
* @param {
|
|
8123
|
+
* @param {ByteWriter} buf
|
|
7949
8124
|
* @param {Token} _token
|
|
7950
8125
|
*/
|
|
7951
|
-
[Type.map.major](
|
|
7952
|
-
this.prefix(
|
|
8126
|
+
[Type.map.major](buf, _token) {
|
|
8127
|
+
this.prefix(buf);
|
|
7953
8128
|
this.inRecursive.push({ type: Type.map, elements: 0 });
|
|
7954
|
-
|
|
8129
|
+
buf.push([123]);
|
|
7955
8130
|
}
|
|
7956
8131
|
/**
|
|
7957
|
-
* @param {
|
|
8132
|
+
* @param {ByteWriter} _buf
|
|
7958
8133
|
* @param {Token} _token
|
|
7959
8134
|
*/
|
|
7960
8135
|
[Type.tag.major](_buf, _token) {
|
|
7961
8136
|
}
|
|
7962
8137
|
/**
|
|
7963
|
-
* @param {
|
|
8138
|
+
* @param {ByteWriter} buf
|
|
7964
8139
|
* @param {Token} token
|
|
7965
8140
|
*/
|
|
7966
|
-
[Type.float.major](
|
|
8141
|
+
[Type.float.major](buf, token) {
|
|
7967
8142
|
if (token.type.name === "break") {
|
|
7968
8143
|
const recurs = this.inRecursive.pop();
|
|
7969
8144
|
if (recurs) {
|
|
7970
|
-
if (recurs.type
|
|
7971
|
-
|
|
7972
|
-
} else if (recurs.type
|
|
7973
|
-
|
|
8145
|
+
if (Type.equals(recurs.type, Type.array)) {
|
|
8146
|
+
buf.push([93]);
|
|
8147
|
+
} else if (Type.equals(recurs.type, Type.map)) {
|
|
8148
|
+
buf.push([125]);
|
|
7974
8149
|
} else {
|
|
7975
8150
|
throw new Error("Unexpected recursive type; this should not happen!");
|
|
7976
8151
|
}
|
|
@@ -7981,15 +8156,15 @@ var JSONEncoder = class extends Array {
|
|
|
7981
8156
|
if (token.value === void 0) {
|
|
7982
8157
|
throw new Error(`${encodeErrPrefix} unsupported type: undefined`);
|
|
7983
8158
|
}
|
|
7984
|
-
this.prefix(
|
|
8159
|
+
this.prefix(buf);
|
|
7985
8160
|
if (token.type.name === "true") {
|
|
7986
|
-
|
|
8161
|
+
buf.push([116, 114, 117, 101]);
|
|
7987
8162
|
return;
|
|
7988
8163
|
} else if (token.type.name === "false") {
|
|
7989
|
-
|
|
8164
|
+
buf.push([102, 97, 108, 115, 101]);
|
|
7990
8165
|
return;
|
|
7991
8166
|
} else if (token.type.name === "null") {
|
|
7992
|
-
|
|
8167
|
+
buf.push([110, 117, 108, 108]);
|
|
7993
8168
|
return;
|
|
7994
8169
|
}
|
|
7995
8170
|
const is2 = String(token.value);
|
|
@@ -8005,10 +8180,10 @@ var JSONEncoder = class extends Array {
|
|
|
8005
8180
|
isa.push(46);
|
|
8006
8181
|
isa.push(48);
|
|
8007
8182
|
}
|
|
8008
|
-
|
|
8183
|
+
buf.push(isa);
|
|
8009
8184
|
}
|
|
8010
8185
|
};
|
|
8011
|
-
function
|
|
8186
|
+
function mapSorter2(e1, e2) {
|
|
8012
8187
|
if (Array.isArray(e1[0]) || Array.isArray(e2[0])) {
|
|
8013
8188
|
throw new Error(`${encodeErrPrefix} complex map keys are not supported`);
|
|
8014
8189
|
}
|
|
@@ -8025,13 +8200,13 @@ function mapSorter(e1, e2) {
|
|
|
8025
8200
|
}
|
|
8026
8201
|
throw new Error(`${encodeErrPrefix} unexpected duplicate map keys, this is not supported`);
|
|
8027
8202
|
}
|
|
8028
|
-
var
|
|
8203
|
+
var defaultEncodeOptions2 = { addBreakTokens: true, mapSorter: mapSorter2 };
|
|
8029
8204
|
function encode2(data, options) {
|
|
8030
|
-
options = Object.assign({},
|
|
8205
|
+
options = Object.assign({}, defaultEncodeOptions2, options);
|
|
8031
8206
|
return encodeCustom(data, new JSONEncoder(), options);
|
|
8032
8207
|
}
|
|
8033
8208
|
|
|
8034
|
-
// ../../../node_modules/.pnpm/cborg@4.
|
|
8209
|
+
// ../../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/json/decode.js
|
|
8035
8210
|
var Tokenizer = class {
|
|
8036
8211
|
/**
|
|
8037
8212
|
* @param {Uint8Array} data
|
|
@@ -8431,7 +8606,7 @@ function decode2(data, options) {
|
|
|
8431
8606
|
return decode(data, options);
|
|
8432
8607
|
}
|
|
8433
8608
|
|
|
8434
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8609
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bytes.js
|
|
8435
8610
|
var empty = new Uint8Array(0);
|
|
8436
8611
|
function equals(aa, bb) {
|
|
8437
8612
|
if (aa === bb) {
|
|
@@ -8460,7 +8635,7 @@ function coerce(o) {
|
|
|
8460
8635
|
throw new Error("Unknown type, must be binary type");
|
|
8461
8636
|
}
|
|
8462
8637
|
|
|
8463
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8638
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/vendor/base-x.js
|
|
8464
8639
|
function base(ALPHABET, name2) {
|
|
8465
8640
|
if (ALPHABET.length >= 255) {
|
|
8466
8641
|
throw new TypeError("Alphabet too long");
|
|
@@ -8481,7 +8656,7 @@ function base(ALPHABET, name2) {
|
|
|
8481
8656
|
var LEADER = ALPHABET.charAt(0);
|
|
8482
8657
|
var FACTOR = Math.log(BASE) / Math.log(256);
|
|
8483
8658
|
var iFACTOR = Math.log(256) / Math.log(BASE);
|
|
8484
|
-
function
|
|
8659
|
+
function encode9(source) {
|
|
8485
8660
|
if (source instanceof Uint8Array)
|
|
8486
8661
|
;
|
|
8487
8662
|
else if (ArrayBuffer.isView(source)) {
|
|
@@ -8496,7 +8671,7 @@ function base(ALPHABET, name2) {
|
|
|
8496
8671
|
return "";
|
|
8497
8672
|
}
|
|
8498
8673
|
var zeroes = 0;
|
|
8499
|
-
var
|
|
8674
|
+
var length3 = 0;
|
|
8500
8675
|
var pbegin = 0;
|
|
8501
8676
|
var pend = source.length;
|
|
8502
8677
|
while (pbegin !== pend && source[pbegin] === 0) {
|
|
@@ -8508,7 +8683,7 @@ function base(ALPHABET, name2) {
|
|
|
8508
8683
|
while (pbegin !== pend) {
|
|
8509
8684
|
var carry = source[pbegin];
|
|
8510
8685
|
var i2 = 0;
|
|
8511
|
-
for (var it1 = size - 1; (carry !== 0 || i2 <
|
|
8686
|
+
for (var it1 = size - 1; (carry !== 0 || i2 < length3) && it1 !== -1; it1--, i2++) {
|
|
8512
8687
|
carry += 256 * b58[it1] >>> 0;
|
|
8513
8688
|
b58[it1] = carry % BASE >>> 0;
|
|
8514
8689
|
carry = carry / BASE >>> 0;
|
|
@@ -8516,10 +8691,10 @@ function base(ALPHABET, name2) {
|
|
|
8516
8691
|
if (carry !== 0) {
|
|
8517
8692
|
throw new Error("Non-zero carry");
|
|
8518
8693
|
}
|
|
8519
|
-
|
|
8694
|
+
length3 = i2;
|
|
8520
8695
|
pbegin++;
|
|
8521
8696
|
}
|
|
8522
|
-
var it2 = size -
|
|
8697
|
+
var it2 = size - length3;
|
|
8523
8698
|
while (it2 !== size && b58[it2] === 0) {
|
|
8524
8699
|
it2++;
|
|
8525
8700
|
}
|
|
@@ -8541,7 +8716,7 @@ function base(ALPHABET, name2) {
|
|
|
8541
8716
|
return;
|
|
8542
8717
|
}
|
|
8543
8718
|
var zeroes = 0;
|
|
8544
|
-
var
|
|
8719
|
+
var length3 = 0;
|
|
8545
8720
|
while (source[psz] === LEADER) {
|
|
8546
8721
|
zeroes++;
|
|
8547
8722
|
psz++;
|
|
@@ -8554,7 +8729,7 @@ function base(ALPHABET, name2) {
|
|
|
8554
8729
|
return;
|
|
8555
8730
|
}
|
|
8556
8731
|
var i2 = 0;
|
|
8557
|
-
for (var it3 = size - 1; (carry !== 0 || i2 <
|
|
8732
|
+
for (var it3 = size - 1; (carry !== 0 || i2 < length3) && it3 !== -1; it3--, i2++) {
|
|
8558
8733
|
carry += BASE * b256[it3] >>> 0;
|
|
8559
8734
|
b256[it3] = carry % 256 >>> 0;
|
|
8560
8735
|
carry = carry / 256 >>> 0;
|
|
@@ -8562,13 +8737,13 @@ function base(ALPHABET, name2) {
|
|
|
8562
8737
|
if (carry !== 0) {
|
|
8563
8738
|
throw new Error("Non-zero carry");
|
|
8564
8739
|
}
|
|
8565
|
-
|
|
8740
|
+
length3 = i2;
|
|
8566
8741
|
psz++;
|
|
8567
8742
|
}
|
|
8568
8743
|
if (source[psz] === " ") {
|
|
8569
8744
|
return;
|
|
8570
8745
|
}
|
|
8571
|
-
var it4 = size -
|
|
8746
|
+
var it4 = size - length3;
|
|
8572
8747
|
while (it4 !== size && b256[it4] === 0) {
|
|
8573
8748
|
it4++;
|
|
8574
8749
|
}
|
|
@@ -8579,7 +8754,7 @@ function base(ALPHABET, name2) {
|
|
|
8579
8754
|
}
|
|
8580
8755
|
return vch;
|
|
8581
8756
|
}
|
|
8582
|
-
function
|
|
8757
|
+
function decode12(string) {
|
|
8583
8758
|
var buffer2 = decodeUnsafe(string);
|
|
8584
8759
|
if (buffer2) {
|
|
8585
8760
|
return buffer2;
|
|
@@ -8587,16 +8762,16 @@ function base(ALPHABET, name2) {
|
|
|
8587
8762
|
throw new Error(`Non-${name2} character`);
|
|
8588
8763
|
}
|
|
8589
8764
|
return {
|
|
8590
|
-
encode:
|
|
8765
|
+
encode: encode9,
|
|
8591
8766
|
decodeUnsafe,
|
|
8592
|
-
decode:
|
|
8767
|
+
decode: decode12
|
|
8593
8768
|
};
|
|
8594
8769
|
}
|
|
8595
8770
|
var src = base;
|
|
8596
8771
|
var _brrp__multiformats_scope_baseX = src;
|
|
8597
8772
|
var base_x_default = _brrp__multiformats_scope_baseX;
|
|
8598
8773
|
|
|
8599
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8774
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base.js
|
|
8600
8775
|
var Encoder = class {
|
|
8601
8776
|
name;
|
|
8602
8777
|
prefix;
|
|
@@ -8689,16 +8864,16 @@ var Codec = class {
|
|
|
8689
8864
|
return this.decoder.decode(input);
|
|
8690
8865
|
}
|
|
8691
8866
|
};
|
|
8692
|
-
function from({ name: name2, prefix, encode:
|
|
8693
|
-
return new Codec(name2, prefix,
|
|
8867
|
+
function from({ name: name2, prefix, encode: encode9, decode: decode12 }) {
|
|
8868
|
+
return new Codec(name2, prefix, encode9, decode12);
|
|
8694
8869
|
}
|
|
8695
8870
|
function baseX({ name: name2, prefix, alphabet }) {
|
|
8696
|
-
const { encode:
|
|
8871
|
+
const { encode: encode9, decode: decode12 } = base_x_default(alphabet, name2);
|
|
8697
8872
|
return from({
|
|
8698
8873
|
prefix,
|
|
8699
8874
|
name: name2,
|
|
8700
|
-
encode:
|
|
8701
|
-
decode: (text) => coerce(
|
|
8875
|
+
encode: encode9,
|
|
8876
|
+
decode: (text) => coerce(decode12(text))
|
|
8702
8877
|
});
|
|
8703
8878
|
}
|
|
8704
8879
|
function decode3(string, alphabetIdx, bitsPerChar, name2) {
|
|
@@ -8772,7 +8947,7 @@ function rfc4648({ name: name2, prefix, bitsPerChar, alphabet }) {
|
|
|
8772
8947
|
});
|
|
8773
8948
|
}
|
|
8774
8949
|
|
|
8775
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8950
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base32.js
|
|
8776
8951
|
var base32 = rfc4648({
|
|
8777
8952
|
prefix: "b",
|
|
8778
8953
|
name: "base32",
|
|
@@ -8828,7 +9003,7 @@ var base32z = rfc4648({
|
|
|
8828
9003
|
bitsPerChar: 5
|
|
8829
9004
|
});
|
|
8830
9005
|
|
|
8831
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
9006
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base36.js
|
|
8832
9007
|
var base36 = baseX({
|
|
8833
9008
|
prefix: "k",
|
|
8834
9009
|
name: "base36",
|
|
@@ -8840,7 +9015,7 @@ var base36upper = baseX({
|
|
|
8840
9015
|
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
8841
9016
|
});
|
|
8842
9017
|
|
|
8843
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
9018
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base58.js
|
|
8844
9019
|
var base58btc = baseX({
|
|
8845
9020
|
name: "base58btc",
|
|
8846
9021
|
prefix: "z",
|
|
@@ -8852,17 +9027,7 @@ var base58flickr = baseX({
|
|
|
8852
9027
|
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
8853
9028
|
});
|
|
8854
9029
|
|
|
8855
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8856
|
-
var digest_exports = {};
|
|
8857
|
-
__export(digest_exports, {
|
|
8858
|
-
Digest: () => Digest,
|
|
8859
|
-
create: () => create,
|
|
8860
|
-
decode: () => decode6,
|
|
8861
|
-
equals: () => equals2,
|
|
8862
|
-
hasCode: () => hasCode
|
|
8863
|
-
});
|
|
8864
|
-
|
|
8865
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/vendor/varint.js
|
|
9030
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/vendor/varint.js
|
|
8866
9031
|
var encode_1 = encode4;
|
|
8867
9032
|
var MSB = 128;
|
|
8868
9033
|
var REST = 127;
|
|
@@ -8887,14 +9052,14 @@ function encode4(num, out, offset) {
|
|
|
8887
9052
|
var decode4 = read;
|
|
8888
9053
|
var MSB$1 = 128;
|
|
8889
9054
|
var REST$1 = 127;
|
|
8890
|
-
function read(
|
|
8891
|
-
var res = 0, offset = offset || 0, shift = 0, counter = offset, b2, l2 =
|
|
9055
|
+
function read(buf, offset) {
|
|
9056
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b2, l2 = buf.length;
|
|
8892
9057
|
do {
|
|
8893
9058
|
if (counter >= l2) {
|
|
8894
9059
|
read.bytes = 0;
|
|
8895
9060
|
throw new RangeError("Could not decode varint");
|
|
8896
9061
|
}
|
|
8897
|
-
b2 =
|
|
9062
|
+
b2 = buf[counter++];
|
|
8898
9063
|
res += shift < 28 ? (b2 & REST$1) << shift : (b2 & REST$1) * Math.pow(2, shift);
|
|
8899
9064
|
shift += 7;
|
|
8900
9065
|
} while (b2 >= MSB$1);
|
|
@@ -8921,7 +9086,7 @@ var varint = {
|
|
|
8921
9086
|
var _brrp_varint = varint;
|
|
8922
9087
|
var varint_default = _brrp_varint;
|
|
8923
9088
|
|
|
8924
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
9089
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/varint.js
|
|
8925
9090
|
function decode5(data, offset = 0) {
|
|
8926
9091
|
const code2 = varint_default.decode(data, offset);
|
|
8927
9092
|
return [code2, varint_default.decode.bytes];
|
|
@@ -8934,7 +9099,7 @@ function encodingLength(int) {
|
|
|
8934
9099
|
return varint_default.encodingLength(int);
|
|
8935
9100
|
}
|
|
8936
9101
|
|
|
8937
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
9102
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/hashes/digest.js
|
|
8938
9103
|
function create(code2, digest) {
|
|
8939
9104
|
const size = digest.byteLength;
|
|
8940
9105
|
const sizeOffset = encodingLength(code2);
|
|
@@ -8978,29 +9143,26 @@ var Digest = class {
|
|
|
8978
9143
|
this.bytes = bytes;
|
|
8979
9144
|
}
|
|
8980
9145
|
};
|
|
8981
|
-
function hasCode(digest, code2) {
|
|
8982
|
-
return digest.code === code2;
|
|
8983
|
-
}
|
|
8984
9146
|
|
|
8985
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
8986
|
-
function format(link,
|
|
9147
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/cid.js
|
|
9148
|
+
function format(link, base3) {
|
|
8987
9149
|
const { bytes, version } = link;
|
|
8988
9150
|
switch (version) {
|
|
8989
9151
|
case 0:
|
|
8990
|
-
return toStringV0(bytes, baseCache(link),
|
|
9152
|
+
return toStringV0(bytes, baseCache(link), base3 ?? base58btc.encoder);
|
|
8991
9153
|
default:
|
|
8992
|
-
return toStringV1(bytes, baseCache(link),
|
|
9154
|
+
return toStringV1(bytes, baseCache(link), base3 ?? base32.encoder);
|
|
8993
9155
|
}
|
|
8994
9156
|
}
|
|
8995
9157
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
8996
9158
|
function baseCache(cid) {
|
|
8997
|
-
const
|
|
8998
|
-
if (
|
|
8999
|
-
const
|
|
9000
|
-
cache.set(cid,
|
|
9001
|
-
return
|
|
9159
|
+
const baseCache3 = cache.get(cid);
|
|
9160
|
+
if (baseCache3 == null) {
|
|
9161
|
+
const baseCache4 = /* @__PURE__ */ new Map();
|
|
9162
|
+
cache.set(cid, baseCache4);
|
|
9163
|
+
return baseCache4;
|
|
9002
9164
|
}
|
|
9003
|
-
return
|
|
9165
|
+
return baseCache3;
|
|
9004
9166
|
}
|
|
9005
9167
|
var CID = class _CID {
|
|
9006
9168
|
code;
|
|
@@ -9079,8 +9241,8 @@ var CID = class _CID {
|
|
|
9079
9241
|
const unknown = other;
|
|
9080
9242
|
return unknown != null && self2.code === unknown.code && self2.version === unknown.version && equals2(self2.multihash, unknown.multihash);
|
|
9081
9243
|
}
|
|
9082
|
-
toString(
|
|
9083
|
-
return format(this,
|
|
9244
|
+
toString(base3) {
|
|
9245
|
+
return format(this, base3);
|
|
9084
9246
|
}
|
|
9085
9247
|
toJSON() {
|
|
9086
9248
|
return { "/": format(this) };
|
|
@@ -9212,8 +9374,8 @@ var CID = class _CID {
|
|
|
9212
9374
|
static inspectBytes(initialBytes) {
|
|
9213
9375
|
let offset = 0;
|
|
9214
9376
|
const next = () => {
|
|
9215
|
-
const [i,
|
|
9216
|
-
offset +=
|
|
9377
|
+
const [i, length3] = decode5(initialBytes.subarray(offset));
|
|
9378
|
+
offset += length3;
|
|
9217
9379
|
return i;
|
|
9218
9380
|
};
|
|
9219
9381
|
let version = next();
|
|
@@ -9240,8 +9402,8 @@ var CID = class _CID {
|
|
|
9240
9402
|
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
9241
9403
|
* a default decoder).
|
|
9242
9404
|
*/
|
|
9243
|
-
static parse(source,
|
|
9244
|
-
const [prefix, bytes] = parseCIDtoBytes(source,
|
|
9405
|
+
static parse(source, base3) {
|
|
9406
|
+
const [prefix, bytes] = parseCIDtoBytes(source, base3);
|
|
9245
9407
|
const cid = _CID.decode(bytes);
|
|
9246
9408
|
if (cid.version === 0 && source[0] !== "Q") {
|
|
9247
9409
|
throw Error("Version 0 CID string must not include multibase prefix");
|
|
@@ -9250,56 +9412,56 @@ var CID = class _CID {
|
|
|
9250
9412
|
return cid;
|
|
9251
9413
|
}
|
|
9252
9414
|
};
|
|
9253
|
-
function parseCIDtoBytes(source,
|
|
9415
|
+
function parseCIDtoBytes(source, base3) {
|
|
9254
9416
|
switch (source[0]) {
|
|
9255
9417
|
// CIDv0 is parsed differently
|
|
9256
9418
|
case "Q": {
|
|
9257
|
-
const decoder =
|
|
9419
|
+
const decoder = base3 ?? base58btc;
|
|
9258
9420
|
return [
|
|
9259
9421
|
base58btc.prefix,
|
|
9260
9422
|
decoder.decode(`${base58btc.prefix}${source}`)
|
|
9261
9423
|
];
|
|
9262
9424
|
}
|
|
9263
9425
|
case base58btc.prefix: {
|
|
9264
|
-
const decoder =
|
|
9426
|
+
const decoder = base3 ?? base58btc;
|
|
9265
9427
|
return [base58btc.prefix, decoder.decode(source)];
|
|
9266
9428
|
}
|
|
9267
9429
|
case base32.prefix: {
|
|
9268
|
-
const decoder =
|
|
9430
|
+
const decoder = base3 ?? base32;
|
|
9269
9431
|
return [base32.prefix, decoder.decode(source)];
|
|
9270
9432
|
}
|
|
9271
9433
|
case base36.prefix: {
|
|
9272
|
-
const decoder =
|
|
9434
|
+
const decoder = base3 ?? base36;
|
|
9273
9435
|
return [base36.prefix, decoder.decode(source)];
|
|
9274
9436
|
}
|
|
9275
9437
|
default: {
|
|
9276
|
-
if (
|
|
9438
|
+
if (base3 == null) {
|
|
9277
9439
|
throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
|
|
9278
9440
|
}
|
|
9279
|
-
return [source[0],
|
|
9441
|
+
return [source[0], base3.decode(source)];
|
|
9280
9442
|
}
|
|
9281
9443
|
}
|
|
9282
9444
|
}
|
|
9283
|
-
function toStringV0(bytes,
|
|
9284
|
-
const { prefix } =
|
|
9445
|
+
function toStringV0(bytes, cache3, base3) {
|
|
9446
|
+
const { prefix } = base3;
|
|
9285
9447
|
if (prefix !== base58btc.prefix) {
|
|
9286
|
-
throw Error(`Cannot string encode V0 in ${
|
|
9448
|
+
throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
|
|
9287
9449
|
}
|
|
9288
|
-
const cid =
|
|
9450
|
+
const cid = cache3.get(prefix);
|
|
9289
9451
|
if (cid == null) {
|
|
9290
|
-
const cid2 =
|
|
9291
|
-
|
|
9452
|
+
const cid2 = base3.encode(bytes).slice(1);
|
|
9453
|
+
cache3.set(prefix, cid2);
|
|
9292
9454
|
return cid2;
|
|
9293
9455
|
} else {
|
|
9294
9456
|
return cid;
|
|
9295
9457
|
}
|
|
9296
9458
|
}
|
|
9297
|
-
function toStringV1(bytes,
|
|
9298
|
-
const { prefix } =
|
|
9299
|
-
const cid =
|
|
9459
|
+
function toStringV1(bytes, cache3, base3) {
|
|
9460
|
+
const { prefix } = base3;
|
|
9461
|
+
const cid = cache3.get(prefix);
|
|
9300
9462
|
if (cid == null) {
|
|
9301
|
-
const cid2 =
|
|
9302
|
-
|
|
9463
|
+
const cid2 = base3.encode(bytes);
|
|
9464
|
+
cache3.set(prefix, cid2);
|
|
9303
9465
|
return cid2;
|
|
9304
9466
|
} else {
|
|
9305
9467
|
return cid;
|
|
@@ -9318,55 +9480,7 @@ function encodeCID(version, code2, multihash) {
|
|
|
9318
9480
|
}
|
|
9319
9481
|
var cidSymbol = Symbol.for("@ipld/js-cid/CID");
|
|
9320
9482
|
|
|
9321
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.
|
|
9322
|
-
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
9323
|
-
function from2({ name: name2, code: code2, encode: encode7, minDigestLength, maxDigestLength }) {
|
|
9324
|
-
return new Hasher(name2, code2, encode7, minDigestLength, maxDigestLength);
|
|
9325
|
-
}
|
|
9326
|
-
var Hasher = class {
|
|
9327
|
-
name;
|
|
9328
|
-
code;
|
|
9329
|
-
encode;
|
|
9330
|
-
minDigestLength;
|
|
9331
|
-
maxDigestLength;
|
|
9332
|
-
constructor(name2, code2, encode7, minDigestLength, maxDigestLength) {
|
|
9333
|
-
this.name = name2;
|
|
9334
|
-
this.code = code2;
|
|
9335
|
-
this.encode = encode7;
|
|
9336
|
-
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
9337
|
-
this.maxDigestLength = maxDigestLength;
|
|
9338
|
-
}
|
|
9339
|
-
digest(input, options) {
|
|
9340
|
-
if (options?.truncate != null) {
|
|
9341
|
-
if (options.truncate < this.minDigestLength) {
|
|
9342
|
-
throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
9343
|
-
}
|
|
9344
|
-
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
|
|
9345
|
-
throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
9346
|
-
}
|
|
9347
|
-
}
|
|
9348
|
-
if (input instanceof Uint8Array) {
|
|
9349
|
-
const result = this.encode(input);
|
|
9350
|
-
if (result instanceof Uint8Array) {
|
|
9351
|
-
return createDigest(result, this.code, options?.truncate);
|
|
9352
|
-
}
|
|
9353
|
-
return result.then((digest) => createDigest(digest, this.code, options?.truncate));
|
|
9354
|
-
} else {
|
|
9355
|
-
throw Error("Unknown type, must be binary type");
|
|
9356
|
-
}
|
|
9357
|
-
}
|
|
9358
|
-
};
|
|
9359
|
-
function createDigest(digest, code2, truncate) {
|
|
9360
|
-
if (truncate != null && truncate !== digest.byteLength) {
|
|
9361
|
-
if (truncate > digest.byteLength) {
|
|
9362
|
-
throw new Error(`Invalid truncate option, must be less than or equal to ${digest.byteLength}`);
|
|
9363
|
-
}
|
|
9364
|
-
digest = digest.subarray(0, truncate);
|
|
9365
|
-
}
|
|
9366
|
-
return create(code2, digest);
|
|
9367
|
-
}
|
|
9368
|
-
|
|
9369
|
-
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base64.js
|
|
9483
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base64.js
|
|
9370
9484
|
var base64 = rfc4648({
|
|
9371
9485
|
prefix: "m",
|
|
9372
9486
|
name: "base64",
|
|
@@ -9393,11 +9507,11 @@ var base64urlpad = rfc4648({
|
|
|
9393
9507
|
});
|
|
9394
9508
|
|
|
9395
9509
|
// ../../../node_modules/.pnpm/@ipld+dag-json@10.2.5/node_modules/@ipld/dag-json/src/index.js
|
|
9396
|
-
function toByteView(
|
|
9397
|
-
if (
|
|
9398
|
-
return new Uint8Array(
|
|
9510
|
+
function toByteView(buf) {
|
|
9511
|
+
if (buf instanceof ArrayBuffer) {
|
|
9512
|
+
return new Uint8Array(buf, 0, buf.byteLength);
|
|
9399
9513
|
}
|
|
9400
|
-
return
|
|
9514
|
+
return buf;
|
|
9401
9515
|
}
|
|
9402
9516
|
function cidEncoder(obj) {
|
|
9403
9517
|
if (obj.asCID !== obj && obj["/"] !== obj.bytes) {
|
|
@@ -9559,9 +9673,9 @@ var name = "dag-json";
|
|
|
9559
9673
|
var code = 297;
|
|
9560
9674
|
var encode5 = (node) => encode2(node, encodeOptions);
|
|
9561
9675
|
var decode7 = (data) => {
|
|
9562
|
-
const
|
|
9563
|
-
const options = Object.assign(decodeOptions, { tokenizer: new DagJsonTokenizer(
|
|
9564
|
-
return decode2(
|
|
9676
|
+
const buf = toByteView(data);
|
|
9677
|
+
const options = Object.assign(decodeOptions, { tokenizer: new DagJsonTokenizer(buf, decodeOptions) });
|
|
9678
|
+
return decode2(buf, options);
|
|
9565
9679
|
};
|
|
9566
9680
|
var format2 = (node) => utf8Decoder.decode(encode5(node));
|
|
9567
9681
|
var utf8Decoder = new TextDecoder();
|
|
@@ -9572,13 +9686,13 @@ var utf8Encoder = new TextEncoder();
|
|
|
9572
9686
|
function isBytes(a) {
|
|
9573
9687
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
9574
9688
|
}
|
|
9575
|
-
function abytes(value,
|
|
9689
|
+
function abytes(value, length3, title = "") {
|
|
9576
9690
|
const bytes = isBytes(value);
|
|
9577
9691
|
const len = value?.length;
|
|
9578
|
-
const needsLen =
|
|
9579
|
-
if (!bytes || needsLen && len !==
|
|
9692
|
+
const needsLen = length3 !== void 0;
|
|
9693
|
+
if (!bytes || needsLen && len !== length3) {
|
|
9580
9694
|
const prefix = title && `"${title}" `;
|
|
9581
|
-
const ofLen = needsLen ? ` of length ${
|
|
9695
|
+
const ofLen = needsLen ? ` of length ${length3}` : "";
|
|
9582
9696
|
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
9583
9697
|
throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
|
|
9584
9698
|
}
|
|
@@ -9710,12 +9824,12 @@ var HashMD = class {
|
|
|
9710
9824
|
_cloneInto(to) {
|
|
9711
9825
|
to ||= new this.constructor();
|
|
9712
9826
|
to.set(...this.get());
|
|
9713
|
-
const { blockLen, buffer: buffer2, length:
|
|
9827
|
+
const { blockLen, buffer: buffer2, length: length3, finished, destroyed, pos } = this;
|
|
9714
9828
|
to.destroyed = destroyed;
|
|
9715
9829
|
to.finished = finished;
|
|
9716
|
-
to.length =
|
|
9830
|
+
to.length = length3;
|
|
9717
9831
|
to.pos = pos;
|
|
9718
|
-
if (
|
|
9832
|
+
if (length3 % blockLen)
|
|
9719
9833
|
to.buffer.set(buffer2);
|
|
9720
9834
|
return to;
|
|
9721
9835
|
}
|
|
@@ -9884,6 +9998,941 @@ var sha256 = /* @__PURE__ */ createHasher(
|
|
|
9884
9998
|
/* @__PURE__ */ oidNist(1)
|
|
9885
9999
|
);
|
|
9886
10000
|
|
|
10001
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bytes.js
|
|
10002
|
+
var empty2 = new Uint8Array(0);
|
|
10003
|
+
function equals3(aa, bb) {
|
|
10004
|
+
if (aa === bb) {
|
|
10005
|
+
return true;
|
|
10006
|
+
}
|
|
10007
|
+
if (aa.byteLength !== bb.byteLength) {
|
|
10008
|
+
return false;
|
|
10009
|
+
}
|
|
10010
|
+
for (let ii = 0; ii < aa.byteLength; ii++) {
|
|
10011
|
+
if (aa[ii] !== bb[ii]) {
|
|
10012
|
+
return false;
|
|
10013
|
+
}
|
|
10014
|
+
}
|
|
10015
|
+
return true;
|
|
10016
|
+
}
|
|
10017
|
+
function coerce2(o) {
|
|
10018
|
+
if (o instanceof Uint8Array && o.constructor.name === "Uint8Array") {
|
|
10019
|
+
return o;
|
|
10020
|
+
}
|
|
10021
|
+
if (o instanceof ArrayBuffer) {
|
|
10022
|
+
return new Uint8Array(o);
|
|
10023
|
+
}
|
|
10024
|
+
if (ArrayBuffer.isView(o)) {
|
|
10025
|
+
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
|
|
10026
|
+
}
|
|
10027
|
+
throw new Error("Unknown type, must be binary type");
|
|
10028
|
+
}
|
|
10029
|
+
|
|
10030
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/vendor/base-x.js
|
|
10031
|
+
function base2(ALPHABET, name2) {
|
|
10032
|
+
if (ALPHABET.length >= 255) {
|
|
10033
|
+
throw new TypeError("Alphabet too long");
|
|
10034
|
+
}
|
|
10035
|
+
var BASE_MAP = new Uint8Array(256);
|
|
10036
|
+
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
10037
|
+
BASE_MAP[j] = 255;
|
|
10038
|
+
}
|
|
10039
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
10040
|
+
var x2 = ALPHABET.charAt(i);
|
|
10041
|
+
var xc = x2.charCodeAt(0);
|
|
10042
|
+
if (BASE_MAP[xc] !== 255) {
|
|
10043
|
+
throw new TypeError(x2 + " is ambiguous");
|
|
10044
|
+
}
|
|
10045
|
+
BASE_MAP[xc] = i;
|
|
10046
|
+
}
|
|
10047
|
+
var BASE = ALPHABET.length;
|
|
10048
|
+
var LEADER = ALPHABET.charAt(0);
|
|
10049
|
+
var FACTOR = Math.log(BASE) / Math.log(256);
|
|
10050
|
+
var iFACTOR = Math.log(256) / Math.log(BASE);
|
|
10051
|
+
function encode9(source) {
|
|
10052
|
+
if (source instanceof Uint8Array)
|
|
10053
|
+
;
|
|
10054
|
+
else if (ArrayBuffer.isView(source)) {
|
|
10055
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
10056
|
+
} else if (Array.isArray(source)) {
|
|
10057
|
+
source = Uint8Array.from(source);
|
|
10058
|
+
}
|
|
10059
|
+
if (!(source instanceof Uint8Array)) {
|
|
10060
|
+
throw new TypeError("Expected Uint8Array");
|
|
10061
|
+
}
|
|
10062
|
+
if (source.length === 0) {
|
|
10063
|
+
return "";
|
|
10064
|
+
}
|
|
10065
|
+
var zeroes = 0;
|
|
10066
|
+
var length3 = 0;
|
|
10067
|
+
var pbegin = 0;
|
|
10068
|
+
var pend = source.length;
|
|
10069
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
10070
|
+
pbegin++;
|
|
10071
|
+
zeroes++;
|
|
10072
|
+
}
|
|
10073
|
+
var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
10074
|
+
var b58 = new Uint8Array(size);
|
|
10075
|
+
while (pbegin !== pend) {
|
|
10076
|
+
var carry = source[pbegin];
|
|
10077
|
+
var i2 = 0;
|
|
10078
|
+
for (var it1 = size - 1; (carry !== 0 || i2 < length3) && it1 !== -1; it1--, i2++) {
|
|
10079
|
+
carry += 256 * b58[it1] >>> 0;
|
|
10080
|
+
b58[it1] = carry % BASE >>> 0;
|
|
10081
|
+
carry = carry / BASE >>> 0;
|
|
10082
|
+
}
|
|
10083
|
+
if (carry !== 0) {
|
|
10084
|
+
throw new Error("Non-zero carry");
|
|
10085
|
+
}
|
|
10086
|
+
length3 = i2;
|
|
10087
|
+
pbegin++;
|
|
10088
|
+
}
|
|
10089
|
+
var it2 = size - length3;
|
|
10090
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
10091
|
+
it2++;
|
|
10092
|
+
}
|
|
10093
|
+
var str = LEADER.repeat(zeroes);
|
|
10094
|
+
for (; it2 < size; ++it2) {
|
|
10095
|
+
str += ALPHABET.charAt(b58[it2]);
|
|
10096
|
+
}
|
|
10097
|
+
return str;
|
|
10098
|
+
}
|
|
10099
|
+
function decodeUnsafe(source) {
|
|
10100
|
+
if (typeof source !== "string") {
|
|
10101
|
+
throw new TypeError("Expected String");
|
|
10102
|
+
}
|
|
10103
|
+
if (source.length === 0) {
|
|
10104
|
+
return new Uint8Array();
|
|
10105
|
+
}
|
|
10106
|
+
var psz = 0;
|
|
10107
|
+
if (source[psz] === " ") {
|
|
10108
|
+
return;
|
|
10109
|
+
}
|
|
10110
|
+
var zeroes = 0;
|
|
10111
|
+
var length3 = 0;
|
|
10112
|
+
while (source[psz] === LEADER) {
|
|
10113
|
+
zeroes++;
|
|
10114
|
+
psz++;
|
|
10115
|
+
}
|
|
10116
|
+
var size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
10117
|
+
var b256 = new Uint8Array(size);
|
|
10118
|
+
while (source[psz]) {
|
|
10119
|
+
var carry = BASE_MAP[source.charCodeAt(psz)];
|
|
10120
|
+
if (carry === 255) {
|
|
10121
|
+
return;
|
|
10122
|
+
}
|
|
10123
|
+
var i2 = 0;
|
|
10124
|
+
for (var it3 = size - 1; (carry !== 0 || i2 < length3) && it3 !== -1; it3--, i2++) {
|
|
10125
|
+
carry += BASE * b256[it3] >>> 0;
|
|
10126
|
+
b256[it3] = carry % 256 >>> 0;
|
|
10127
|
+
carry = carry / 256 >>> 0;
|
|
10128
|
+
}
|
|
10129
|
+
if (carry !== 0) {
|
|
10130
|
+
throw new Error("Non-zero carry");
|
|
10131
|
+
}
|
|
10132
|
+
length3 = i2;
|
|
10133
|
+
psz++;
|
|
10134
|
+
}
|
|
10135
|
+
if (source[psz] === " ") {
|
|
10136
|
+
return;
|
|
10137
|
+
}
|
|
10138
|
+
var it4 = size - length3;
|
|
10139
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
10140
|
+
it4++;
|
|
10141
|
+
}
|
|
10142
|
+
var vch = new Uint8Array(zeroes + (size - it4));
|
|
10143
|
+
var j2 = zeroes;
|
|
10144
|
+
while (it4 !== size) {
|
|
10145
|
+
vch[j2++] = b256[it4++];
|
|
10146
|
+
}
|
|
10147
|
+
return vch;
|
|
10148
|
+
}
|
|
10149
|
+
function decode12(string) {
|
|
10150
|
+
var buffer2 = decodeUnsafe(string);
|
|
10151
|
+
if (buffer2) {
|
|
10152
|
+
return buffer2;
|
|
10153
|
+
}
|
|
10154
|
+
throw new Error(`Non-${name2} character`);
|
|
10155
|
+
}
|
|
10156
|
+
return {
|
|
10157
|
+
encode: encode9,
|
|
10158
|
+
decodeUnsafe,
|
|
10159
|
+
decode: decode12
|
|
10160
|
+
};
|
|
10161
|
+
}
|
|
10162
|
+
var src2 = base2;
|
|
10163
|
+
var _brrp__multiformats_scope_baseX2 = src2;
|
|
10164
|
+
var base_x_default2 = _brrp__multiformats_scope_baseX2;
|
|
10165
|
+
|
|
10166
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base.js
|
|
10167
|
+
var Encoder2 = class {
|
|
10168
|
+
name;
|
|
10169
|
+
prefix;
|
|
10170
|
+
baseEncode;
|
|
10171
|
+
constructor(name2, prefix, baseEncode) {
|
|
10172
|
+
this.name = name2;
|
|
10173
|
+
this.prefix = prefix;
|
|
10174
|
+
this.baseEncode = baseEncode;
|
|
10175
|
+
}
|
|
10176
|
+
encode(bytes) {
|
|
10177
|
+
if (bytes instanceof Uint8Array) {
|
|
10178
|
+
return `${this.prefix}${this.baseEncode(bytes)}`;
|
|
10179
|
+
} else {
|
|
10180
|
+
throw Error("Unknown type, must be binary type");
|
|
10181
|
+
}
|
|
10182
|
+
}
|
|
10183
|
+
};
|
|
10184
|
+
var Decoder2 = class {
|
|
10185
|
+
name;
|
|
10186
|
+
prefix;
|
|
10187
|
+
baseDecode;
|
|
10188
|
+
prefixCodePoint;
|
|
10189
|
+
constructor(name2, prefix, baseDecode) {
|
|
10190
|
+
this.name = name2;
|
|
10191
|
+
this.prefix = prefix;
|
|
10192
|
+
const prefixCodePoint = prefix.codePointAt(0);
|
|
10193
|
+
if (prefixCodePoint === void 0) {
|
|
10194
|
+
throw new Error("Invalid prefix character");
|
|
10195
|
+
}
|
|
10196
|
+
this.prefixCodePoint = prefixCodePoint;
|
|
10197
|
+
this.baseDecode = baseDecode;
|
|
10198
|
+
}
|
|
10199
|
+
decode(text) {
|
|
10200
|
+
if (typeof text === "string") {
|
|
10201
|
+
if (text.codePointAt(0) !== this.prefixCodePoint) {
|
|
10202
|
+
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
|
10203
|
+
}
|
|
10204
|
+
return this.baseDecode(text.slice(this.prefix.length));
|
|
10205
|
+
} else {
|
|
10206
|
+
throw Error("Can only multibase decode strings");
|
|
10207
|
+
}
|
|
10208
|
+
}
|
|
10209
|
+
or(decoder) {
|
|
10210
|
+
return or2(this, decoder);
|
|
10211
|
+
}
|
|
10212
|
+
};
|
|
10213
|
+
var ComposedDecoder2 = class {
|
|
10214
|
+
decoders;
|
|
10215
|
+
constructor(decoders) {
|
|
10216
|
+
this.decoders = decoders;
|
|
10217
|
+
}
|
|
10218
|
+
or(decoder) {
|
|
10219
|
+
return or2(this, decoder);
|
|
10220
|
+
}
|
|
10221
|
+
decode(input) {
|
|
10222
|
+
const prefix = input[0];
|
|
10223
|
+
const decoder = this.decoders[prefix];
|
|
10224
|
+
if (decoder != null) {
|
|
10225
|
+
return decoder.decode(input);
|
|
10226
|
+
} else {
|
|
10227
|
+
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
|
10228
|
+
}
|
|
10229
|
+
}
|
|
10230
|
+
};
|
|
10231
|
+
function or2(left, right) {
|
|
10232
|
+
return new ComposedDecoder2({
|
|
10233
|
+
...left.decoders ?? { [left.prefix]: left },
|
|
10234
|
+
...right.decoders ?? { [right.prefix]: right }
|
|
10235
|
+
});
|
|
10236
|
+
}
|
|
10237
|
+
var Codec2 = class {
|
|
10238
|
+
name;
|
|
10239
|
+
prefix;
|
|
10240
|
+
baseEncode;
|
|
10241
|
+
baseDecode;
|
|
10242
|
+
encoder;
|
|
10243
|
+
decoder;
|
|
10244
|
+
constructor(name2, prefix, baseEncode, baseDecode) {
|
|
10245
|
+
this.name = name2;
|
|
10246
|
+
this.prefix = prefix;
|
|
10247
|
+
this.baseEncode = baseEncode;
|
|
10248
|
+
this.baseDecode = baseDecode;
|
|
10249
|
+
this.encoder = new Encoder2(name2, prefix, baseEncode);
|
|
10250
|
+
this.decoder = new Decoder2(name2, prefix, baseDecode);
|
|
10251
|
+
}
|
|
10252
|
+
encode(input) {
|
|
10253
|
+
return this.encoder.encode(input);
|
|
10254
|
+
}
|
|
10255
|
+
decode(input) {
|
|
10256
|
+
return this.decoder.decode(input);
|
|
10257
|
+
}
|
|
10258
|
+
};
|
|
10259
|
+
function from2({ name: name2, prefix, encode: encode9, decode: decode12 }) {
|
|
10260
|
+
return new Codec2(name2, prefix, encode9, decode12);
|
|
10261
|
+
}
|
|
10262
|
+
function baseX2({ name: name2, prefix, alphabet }) {
|
|
10263
|
+
const { encode: encode9, decode: decode12 } = base_x_default2(alphabet, name2);
|
|
10264
|
+
return from2({
|
|
10265
|
+
prefix,
|
|
10266
|
+
name: name2,
|
|
10267
|
+
encode: encode9,
|
|
10268
|
+
decode: (text) => coerce2(decode12(text))
|
|
10269
|
+
});
|
|
10270
|
+
}
|
|
10271
|
+
function decode8(string, alphabetIdx, bitsPerChar, name2) {
|
|
10272
|
+
let end = string.length;
|
|
10273
|
+
while (string[end - 1] === "=") {
|
|
10274
|
+
--end;
|
|
10275
|
+
}
|
|
10276
|
+
const out = new Uint8Array(end * bitsPerChar / 8 | 0);
|
|
10277
|
+
let bits = 0;
|
|
10278
|
+
let buffer2 = 0;
|
|
10279
|
+
let written = 0;
|
|
10280
|
+
for (let i = 0; i < end; ++i) {
|
|
10281
|
+
const value = alphabetIdx[string[i]];
|
|
10282
|
+
if (value === void 0) {
|
|
10283
|
+
throw new SyntaxError(`Non-${name2} character`);
|
|
10284
|
+
}
|
|
10285
|
+
buffer2 = buffer2 << bitsPerChar | value;
|
|
10286
|
+
bits += bitsPerChar;
|
|
10287
|
+
if (bits >= 8) {
|
|
10288
|
+
bits -= 8;
|
|
10289
|
+
out[written++] = 255 & buffer2 >> bits;
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
if (bits >= bitsPerChar || (255 & buffer2 << 8 - bits) !== 0) {
|
|
10293
|
+
throw new SyntaxError("Unexpected end of data");
|
|
10294
|
+
}
|
|
10295
|
+
return out;
|
|
10296
|
+
}
|
|
10297
|
+
function encode6(data, alphabet, bitsPerChar) {
|
|
10298
|
+
const pad = alphabet[alphabet.length - 1] === "=";
|
|
10299
|
+
const mask = (1 << bitsPerChar) - 1;
|
|
10300
|
+
let out = "";
|
|
10301
|
+
let bits = 0;
|
|
10302
|
+
let buffer2 = 0;
|
|
10303
|
+
for (let i = 0; i < data.length; ++i) {
|
|
10304
|
+
buffer2 = buffer2 << 8 | data[i];
|
|
10305
|
+
bits += 8;
|
|
10306
|
+
while (bits > bitsPerChar) {
|
|
10307
|
+
bits -= bitsPerChar;
|
|
10308
|
+
out += alphabet[mask & buffer2 >> bits];
|
|
10309
|
+
}
|
|
10310
|
+
}
|
|
10311
|
+
if (bits !== 0) {
|
|
10312
|
+
out += alphabet[mask & buffer2 << bitsPerChar - bits];
|
|
10313
|
+
}
|
|
10314
|
+
if (pad) {
|
|
10315
|
+
while ((out.length * bitsPerChar & 7) !== 0) {
|
|
10316
|
+
out += "=";
|
|
10317
|
+
}
|
|
10318
|
+
}
|
|
10319
|
+
return out;
|
|
10320
|
+
}
|
|
10321
|
+
function createAlphabetIdx2(alphabet) {
|
|
10322
|
+
const alphabetIdx = {};
|
|
10323
|
+
for (let i = 0; i < alphabet.length; ++i) {
|
|
10324
|
+
alphabetIdx[alphabet[i]] = i;
|
|
10325
|
+
}
|
|
10326
|
+
return alphabetIdx;
|
|
10327
|
+
}
|
|
10328
|
+
function rfc46482({ name: name2, prefix, bitsPerChar, alphabet }) {
|
|
10329
|
+
const alphabetIdx = createAlphabetIdx2(alphabet);
|
|
10330
|
+
return from2({
|
|
10331
|
+
prefix,
|
|
10332
|
+
name: name2,
|
|
10333
|
+
encode(input) {
|
|
10334
|
+
return encode6(input, alphabet, bitsPerChar);
|
|
10335
|
+
},
|
|
10336
|
+
decode(input) {
|
|
10337
|
+
return decode8(input, alphabetIdx, bitsPerChar, name2);
|
|
10338
|
+
}
|
|
10339
|
+
});
|
|
10340
|
+
}
|
|
10341
|
+
|
|
10342
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base32.js
|
|
10343
|
+
var base322 = rfc46482({
|
|
10344
|
+
prefix: "b",
|
|
10345
|
+
name: "base32",
|
|
10346
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567",
|
|
10347
|
+
bitsPerChar: 5
|
|
10348
|
+
});
|
|
10349
|
+
var base32upper2 = rfc46482({
|
|
10350
|
+
prefix: "B",
|
|
10351
|
+
name: "base32upper",
|
|
10352
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
|
|
10353
|
+
bitsPerChar: 5
|
|
10354
|
+
});
|
|
10355
|
+
var base32pad2 = rfc46482({
|
|
10356
|
+
prefix: "c",
|
|
10357
|
+
name: "base32pad",
|
|
10358
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
|
|
10359
|
+
bitsPerChar: 5
|
|
10360
|
+
});
|
|
10361
|
+
var base32padupper2 = rfc46482({
|
|
10362
|
+
prefix: "C",
|
|
10363
|
+
name: "base32padupper",
|
|
10364
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
|
|
10365
|
+
bitsPerChar: 5
|
|
10366
|
+
});
|
|
10367
|
+
var base32hex2 = rfc46482({
|
|
10368
|
+
prefix: "v",
|
|
10369
|
+
name: "base32hex",
|
|
10370
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv",
|
|
10371
|
+
bitsPerChar: 5
|
|
10372
|
+
});
|
|
10373
|
+
var base32hexupper2 = rfc46482({
|
|
10374
|
+
prefix: "V",
|
|
10375
|
+
name: "base32hexupper",
|
|
10376
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
|
|
10377
|
+
bitsPerChar: 5
|
|
10378
|
+
});
|
|
10379
|
+
var base32hexpad2 = rfc46482({
|
|
10380
|
+
prefix: "t",
|
|
10381
|
+
name: "base32hexpad",
|
|
10382
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv=",
|
|
10383
|
+
bitsPerChar: 5
|
|
10384
|
+
});
|
|
10385
|
+
var base32hexpadupper2 = rfc46482({
|
|
10386
|
+
prefix: "T",
|
|
10387
|
+
name: "base32hexpadupper",
|
|
10388
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=",
|
|
10389
|
+
bitsPerChar: 5
|
|
10390
|
+
});
|
|
10391
|
+
var base32z2 = rfc46482({
|
|
10392
|
+
prefix: "h",
|
|
10393
|
+
name: "base32z",
|
|
10394
|
+
alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769",
|
|
10395
|
+
bitsPerChar: 5
|
|
10396
|
+
});
|
|
10397
|
+
|
|
10398
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base36.js
|
|
10399
|
+
var base362 = baseX2({
|
|
10400
|
+
prefix: "k",
|
|
10401
|
+
name: "base36",
|
|
10402
|
+
alphabet: "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
10403
|
+
});
|
|
10404
|
+
var base36upper2 = baseX2({
|
|
10405
|
+
prefix: "K",
|
|
10406
|
+
name: "base36upper",
|
|
10407
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
10408
|
+
});
|
|
10409
|
+
|
|
10410
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base58.js
|
|
10411
|
+
var base58btc2 = baseX2({
|
|
10412
|
+
name: "base58btc",
|
|
10413
|
+
prefix: "z",
|
|
10414
|
+
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
10415
|
+
});
|
|
10416
|
+
var base58flickr2 = baseX2({
|
|
10417
|
+
name: "base58flickr",
|
|
10418
|
+
prefix: "Z",
|
|
10419
|
+
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
10420
|
+
});
|
|
10421
|
+
|
|
10422
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/hashes/digest.js
|
|
10423
|
+
var digest_exports2 = {};
|
|
10424
|
+
__export(digest_exports2, {
|
|
10425
|
+
Digest: () => Digest2,
|
|
10426
|
+
create: () => create2,
|
|
10427
|
+
decode: () => decode11,
|
|
10428
|
+
equals: () => equals4,
|
|
10429
|
+
hasCode: () => hasCode
|
|
10430
|
+
});
|
|
10431
|
+
|
|
10432
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/vendor/varint.js
|
|
10433
|
+
var encode_12 = encode7;
|
|
10434
|
+
var MSB2 = 128;
|
|
10435
|
+
var REST2 = 127;
|
|
10436
|
+
var MSBALL2 = ~REST2;
|
|
10437
|
+
var INT2 = Math.pow(2, 31);
|
|
10438
|
+
function encode7(num, out, offset) {
|
|
10439
|
+
out = out || [];
|
|
10440
|
+
offset = offset || 0;
|
|
10441
|
+
var oldOffset = offset;
|
|
10442
|
+
while (num >= INT2) {
|
|
10443
|
+
out[offset++] = num & 255 | MSB2;
|
|
10444
|
+
num /= 128;
|
|
10445
|
+
}
|
|
10446
|
+
while (num & MSBALL2) {
|
|
10447
|
+
out[offset++] = num & 255 | MSB2;
|
|
10448
|
+
num >>>= 7;
|
|
10449
|
+
}
|
|
10450
|
+
out[offset] = num | 0;
|
|
10451
|
+
encode7.bytes = offset - oldOffset + 1;
|
|
10452
|
+
return out;
|
|
10453
|
+
}
|
|
10454
|
+
var decode9 = read2;
|
|
10455
|
+
var MSB$12 = 128;
|
|
10456
|
+
var REST$12 = 127;
|
|
10457
|
+
function read2(buf, offset) {
|
|
10458
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b2, l2 = buf.length;
|
|
10459
|
+
do {
|
|
10460
|
+
if (counter >= l2) {
|
|
10461
|
+
read2.bytes = 0;
|
|
10462
|
+
throw new RangeError("Could not decode varint");
|
|
10463
|
+
}
|
|
10464
|
+
b2 = buf[counter++];
|
|
10465
|
+
res += shift < 28 ? (b2 & REST$12) << shift : (b2 & REST$12) * Math.pow(2, shift);
|
|
10466
|
+
shift += 7;
|
|
10467
|
+
} while (b2 >= MSB$12);
|
|
10468
|
+
read2.bytes = counter - offset;
|
|
10469
|
+
return res;
|
|
10470
|
+
}
|
|
10471
|
+
var N12 = Math.pow(2, 7);
|
|
10472
|
+
var N22 = Math.pow(2, 14);
|
|
10473
|
+
var N32 = Math.pow(2, 21);
|
|
10474
|
+
var N42 = Math.pow(2, 28);
|
|
10475
|
+
var N52 = Math.pow(2, 35);
|
|
10476
|
+
var N62 = Math.pow(2, 42);
|
|
10477
|
+
var N72 = Math.pow(2, 49);
|
|
10478
|
+
var N82 = Math.pow(2, 56);
|
|
10479
|
+
var N92 = Math.pow(2, 63);
|
|
10480
|
+
var length2 = function(value) {
|
|
10481
|
+
return value < N12 ? 1 : value < N22 ? 2 : value < N32 ? 3 : value < N42 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
|
|
10482
|
+
};
|
|
10483
|
+
var varint2 = {
|
|
10484
|
+
encode: encode_12,
|
|
10485
|
+
decode: decode9,
|
|
10486
|
+
encodingLength: length2
|
|
10487
|
+
};
|
|
10488
|
+
var _brrp_varint2 = varint2;
|
|
10489
|
+
var varint_default2 = _brrp_varint2;
|
|
10490
|
+
|
|
10491
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/varint.js
|
|
10492
|
+
function decode10(data, offset = 0) {
|
|
10493
|
+
const code2 = varint_default2.decode(data, offset);
|
|
10494
|
+
return [code2, varint_default2.decode.bytes];
|
|
10495
|
+
}
|
|
10496
|
+
function encodeTo2(int, target, offset = 0) {
|
|
10497
|
+
varint_default2.encode(int, target, offset);
|
|
10498
|
+
return target;
|
|
10499
|
+
}
|
|
10500
|
+
function encodingLength2(int) {
|
|
10501
|
+
return varint_default2.encodingLength(int);
|
|
10502
|
+
}
|
|
10503
|
+
|
|
10504
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/hashes/digest.js
|
|
10505
|
+
function create2(code2, digest) {
|
|
10506
|
+
const size = digest.byteLength;
|
|
10507
|
+
const sizeOffset = encodingLength2(code2);
|
|
10508
|
+
const digestOffset = sizeOffset + encodingLength2(size);
|
|
10509
|
+
const bytes = new Uint8Array(digestOffset + size);
|
|
10510
|
+
encodeTo2(code2, bytes, 0);
|
|
10511
|
+
encodeTo2(size, bytes, sizeOffset);
|
|
10512
|
+
bytes.set(digest, digestOffset);
|
|
10513
|
+
return new Digest2(code2, size, digest, bytes);
|
|
10514
|
+
}
|
|
10515
|
+
function decode11(multihash) {
|
|
10516
|
+
const bytes = coerce2(multihash);
|
|
10517
|
+
const [code2, sizeOffset] = decode10(bytes);
|
|
10518
|
+
const [size, digestOffset] = decode10(bytes.subarray(sizeOffset));
|
|
10519
|
+
const digest = bytes.subarray(sizeOffset + digestOffset);
|
|
10520
|
+
if (digest.byteLength !== size) {
|
|
10521
|
+
throw new Error("Incorrect length");
|
|
10522
|
+
}
|
|
10523
|
+
return new Digest2(code2, size, digest, bytes);
|
|
10524
|
+
}
|
|
10525
|
+
function equals4(a, b2) {
|
|
10526
|
+
if (a === b2) {
|
|
10527
|
+
return true;
|
|
10528
|
+
} else {
|
|
10529
|
+
const data = b2;
|
|
10530
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals3(a.bytes, data.bytes);
|
|
10531
|
+
}
|
|
10532
|
+
}
|
|
10533
|
+
var Digest2 = class {
|
|
10534
|
+
code;
|
|
10535
|
+
size;
|
|
10536
|
+
digest;
|
|
10537
|
+
bytes;
|
|
10538
|
+
/**
|
|
10539
|
+
* Creates a multihash digest.
|
|
10540
|
+
*/
|
|
10541
|
+
constructor(code2, size, digest, bytes) {
|
|
10542
|
+
this.code = code2;
|
|
10543
|
+
this.size = size;
|
|
10544
|
+
this.digest = digest;
|
|
10545
|
+
this.bytes = bytes;
|
|
10546
|
+
}
|
|
10547
|
+
};
|
|
10548
|
+
function hasCode(digest, code2) {
|
|
10549
|
+
return digest.code === code2;
|
|
10550
|
+
}
|
|
10551
|
+
|
|
10552
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/cid.js
|
|
10553
|
+
function format3(link, base3) {
|
|
10554
|
+
const { bytes, version } = link;
|
|
10555
|
+
switch (version) {
|
|
10556
|
+
case 0:
|
|
10557
|
+
return toStringV02(bytes, baseCache2(link), base3 ?? base58btc2.encoder);
|
|
10558
|
+
default:
|
|
10559
|
+
return toStringV12(bytes, baseCache2(link), base3 ?? base322.encoder);
|
|
10560
|
+
}
|
|
10561
|
+
}
|
|
10562
|
+
var cache2 = /* @__PURE__ */ new WeakMap();
|
|
10563
|
+
function baseCache2(cid) {
|
|
10564
|
+
const baseCache3 = cache2.get(cid);
|
|
10565
|
+
if (baseCache3 == null) {
|
|
10566
|
+
const baseCache4 = /* @__PURE__ */ new Map();
|
|
10567
|
+
cache2.set(cid, baseCache4);
|
|
10568
|
+
return baseCache4;
|
|
10569
|
+
}
|
|
10570
|
+
return baseCache3;
|
|
10571
|
+
}
|
|
10572
|
+
var CID2 = class _CID {
|
|
10573
|
+
code;
|
|
10574
|
+
version;
|
|
10575
|
+
multihash;
|
|
10576
|
+
bytes;
|
|
10577
|
+
"/";
|
|
10578
|
+
/**
|
|
10579
|
+
* @param version - Version of the CID
|
|
10580
|
+
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
10581
|
+
* @param multihash - (Multi)hash of the of the content.
|
|
10582
|
+
*/
|
|
10583
|
+
constructor(version, code2, multihash, bytes) {
|
|
10584
|
+
this.code = code2;
|
|
10585
|
+
this.version = version;
|
|
10586
|
+
this.multihash = multihash;
|
|
10587
|
+
this.bytes = bytes;
|
|
10588
|
+
this["/"] = bytes;
|
|
10589
|
+
}
|
|
10590
|
+
/**
|
|
10591
|
+
* Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
|
|
10592
|
+
* please either use `CID.asCID(cid)` or switch to new signalling mechanism
|
|
10593
|
+
*
|
|
10594
|
+
* @deprecated
|
|
10595
|
+
*/
|
|
10596
|
+
get asCID() {
|
|
10597
|
+
return this;
|
|
10598
|
+
}
|
|
10599
|
+
// ArrayBufferView
|
|
10600
|
+
get byteOffset() {
|
|
10601
|
+
return this.bytes.byteOffset;
|
|
10602
|
+
}
|
|
10603
|
+
// ArrayBufferView
|
|
10604
|
+
get byteLength() {
|
|
10605
|
+
return this.bytes.byteLength;
|
|
10606
|
+
}
|
|
10607
|
+
toV0() {
|
|
10608
|
+
switch (this.version) {
|
|
10609
|
+
case 0: {
|
|
10610
|
+
return this;
|
|
10611
|
+
}
|
|
10612
|
+
case 1: {
|
|
10613
|
+
const { code: code2, multihash } = this;
|
|
10614
|
+
if (code2 !== DAG_PB_CODE2) {
|
|
10615
|
+
throw new Error("Cannot convert a non dag-pb CID to CIDv0");
|
|
10616
|
+
}
|
|
10617
|
+
if (multihash.code !== SHA_256_CODE2) {
|
|
10618
|
+
throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");
|
|
10619
|
+
}
|
|
10620
|
+
return _CID.createV0(multihash);
|
|
10621
|
+
}
|
|
10622
|
+
default: {
|
|
10623
|
+
throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
|
|
10624
|
+
}
|
|
10625
|
+
}
|
|
10626
|
+
}
|
|
10627
|
+
toV1() {
|
|
10628
|
+
switch (this.version) {
|
|
10629
|
+
case 0: {
|
|
10630
|
+
const { code: code2, digest } = this.multihash;
|
|
10631
|
+
const multihash = create2(code2, digest);
|
|
10632
|
+
return _CID.createV1(this.code, multihash);
|
|
10633
|
+
}
|
|
10634
|
+
case 1: {
|
|
10635
|
+
return this;
|
|
10636
|
+
}
|
|
10637
|
+
default: {
|
|
10638
|
+
throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
|
|
10639
|
+
}
|
|
10640
|
+
}
|
|
10641
|
+
}
|
|
10642
|
+
equals(other) {
|
|
10643
|
+
return _CID.equals(this, other);
|
|
10644
|
+
}
|
|
10645
|
+
static equals(self2, other) {
|
|
10646
|
+
const unknown = other;
|
|
10647
|
+
return unknown != null && self2.code === unknown.code && self2.version === unknown.version && equals4(self2.multihash, unknown.multihash);
|
|
10648
|
+
}
|
|
10649
|
+
toString(base3) {
|
|
10650
|
+
return format3(this, base3);
|
|
10651
|
+
}
|
|
10652
|
+
toJSON() {
|
|
10653
|
+
return { "/": format3(this) };
|
|
10654
|
+
}
|
|
10655
|
+
link() {
|
|
10656
|
+
return this;
|
|
10657
|
+
}
|
|
10658
|
+
[Symbol.toStringTag] = "CID";
|
|
10659
|
+
// Legacy
|
|
10660
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
10661
|
+
return `CID(${this.toString()})`;
|
|
10662
|
+
}
|
|
10663
|
+
/**
|
|
10664
|
+
* Takes any input `value` and returns a `CID` instance if it was
|
|
10665
|
+
* a `CID` otherwise returns `null`. If `value` is instanceof `CID`
|
|
10666
|
+
* it will return value back. If `value` is not instance of this CID
|
|
10667
|
+
* class, but is compatible CID it will return new instance of this
|
|
10668
|
+
* `CID` class. Otherwise returns null.
|
|
10669
|
+
*
|
|
10670
|
+
* This allows two different incompatible versions of CID library to
|
|
10671
|
+
* co-exist and interop as long as binary interface is compatible.
|
|
10672
|
+
*/
|
|
10673
|
+
static asCID(input) {
|
|
10674
|
+
if (input == null) {
|
|
10675
|
+
return null;
|
|
10676
|
+
}
|
|
10677
|
+
const value = input;
|
|
10678
|
+
if (value instanceof _CID) {
|
|
10679
|
+
return value;
|
|
10680
|
+
} else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
|
|
10681
|
+
const { version, code: code2, multihash, bytes } = value;
|
|
10682
|
+
return new _CID(version, code2, multihash, bytes ?? encodeCID2(version, code2, multihash.bytes));
|
|
10683
|
+
} else if (value[cidSymbol2] === true) {
|
|
10684
|
+
const { version, multihash, code: code2 } = value;
|
|
10685
|
+
const digest = decode11(multihash);
|
|
10686
|
+
return _CID.create(version, code2, digest);
|
|
10687
|
+
} else {
|
|
10688
|
+
return null;
|
|
10689
|
+
}
|
|
10690
|
+
}
|
|
10691
|
+
/**
|
|
10692
|
+
* @param version - Version of the CID
|
|
10693
|
+
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
10694
|
+
* @param digest - (Multi)hash of the of the content.
|
|
10695
|
+
*/
|
|
10696
|
+
static create(version, code2, digest) {
|
|
10697
|
+
if (typeof code2 !== "number") {
|
|
10698
|
+
throw new Error("String codecs are no longer supported");
|
|
10699
|
+
}
|
|
10700
|
+
if (!(digest.bytes instanceof Uint8Array)) {
|
|
10701
|
+
throw new Error("Invalid digest");
|
|
10702
|
+
}
|
|
10703
|
+
switch (version) {
|
|
10704
|
+
case 0: {
|
|
10705
|
+
if (code2 !== DAG_PB_CODE2) {
|
|
10706
|
+
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE2}) block encoding`);
|
|
10707
|
+
} else {
|
|
10708
|
+
return new _CID(version, code2, digest, digest.bytes);
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
case 1: {
|
|
10712
|
+
const bytes = encodeCID2(version, code2, digest.bytes);
|
|
10713
|
+
return new _CID(version, code2, digest, bytes);
|
|
10714
|
+
}
|
|
10715
|
+
default: {
|
|
10716
|
+
throw new Error("Invalid version");
|
|
10717
|
+
}
|
|
10718
|
+
}
|
|
10719
|
+
}
|
|
10720
|
+
/**
|
|
10721
|
+
* Simplified version of `create` for CIDv0.
|
|
10722
|
+
*/
|
|
10723
|
+
static createV0(digest) {
|
|
10724
|
+
return _CID.create(0, DAG_PB_CODE2, digest);
|
|
10725
|
+
}
|
|
10726
|
+
/**
|
|
10727
|
+
* Simplified version of `create` for CIDv1.
|
|
10728
|
+
*
|
|
10729
|
+
* @param code - Content encoding format code.
|
|
10730
|
+
* @param digest - Multihash of the content.
|
|
10731
|
+
*/
|
|
10732
|
+
static createV1(code2, digest) {
|
|
10733
|
+
return _CID.create(1, code2, digest);
|
|
10734
|
+
}
|
|
10735
|
+
/**
|
|
10736
|
+
* Decoded a CID from its binary representation. The byte array must contain
|
|
10737
|
+
* only the CID with no additional bytes.
|
|
10738
|
+
*
|
|
10739
|
+
* An error will be thrown if the bytes provided do not contain a valid
|
|
10740
|
+
* binary representation of a CID.
|
|
10741
|
+
*/
|
|
10742
|
+
static decode(bytes) {
|
|
10743
|
+
const [cid, remainder] = _CID.decodeFirst(bytes);
|
|
10744
|
+
if (remainder.length !== 0) {
|
|
10745
|
+
throw new Error("Incorrect length");
|
|
10746
|
+
}
|
|
10747
|
+
return cid;
|
|
10748
|
+
}
|
|
10749
|
+
/**
|
|
10750
|
+
* Decoded a CID from its binary representation at the beginning of a byte
|
|
10751
|
+
* array.
|
|
10752
|
+
*
|
|
10753
|
+
* Returns an array with the first element containing the CID and the second
|
|
10754
|
+
* element containing the remainder of the original byte array. The remainder
|
|
10755
|
+
* will be a zero-length byte array if the provided bytes only contained a
|
|
10756
|
+
* binary CID representation.
|
|
10757
|
+
*/
|
|
10758
|
+
static decodeFirst(bytes) {
|
|
10759
|
+
const specs = _CID.inspectBytes(bytes);
|
|
10760
|
+
const prefixSize = specs.size - specs.multihashSize;
|
|
10761
|
+
const multihashBytes = coerce2(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
|
|
10762
|
+
if (multihashBytes.byteLength !== specs.multihashSize) {
|
|
10763
|
+
throw new Error("Incorrect length");
|
|
10764
|
+
}
|
|
10765
|
+
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
10766
|
+
const digest = new Digest2(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
|
10767
|
+
const cid = specs.version === 0 ? _CID.createV0(digest) : _CID.createV1(specs.codec, digest);
|
|
10768
|
+
return [cid, bytes.subarray(specs.size)];
|
|
10769
|
+
}
|
|
10770
|
+
/**
|
|
10771
|
+
* Inspect the initial bytes of a CID to determine its properties.
|
|
10772
|
+
*
|
|
10773
|
+
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
|
10774
|
+
* bytes but for larger multicodec code values and larger multihash digest
|
|
10775
|
+
* lengths these varints can be quite large. It is recommended that at least
|
|
10776
|
+
* 10 bytes be made available in the `initialBytes` argument for a complete
|
|
10777
|
+
* inspection.
|
|
10778
|
+
*/
|
|
10779
|
+
static inspectBytes(initialBytes) {
|
|
10780
|
+
let offset = 0;
|
|
10781
|
+
const next = () => {
|
|
10782
|
+
const [i, length3] = decode10(initialBytes.subarray(offset));
|
|
10783
|
+
offset += length3;
|
|
10784
|
+
return i;
|
|
10785
|
+
};
|
|
10786
|
+
let version = next();
|
|
10787
|
+
let codec = DAG_PB_CODE2;
|
|
10788
|
+
if (version === 18) {
|
|
10789
|
+
version = 0;
|
|
10790
|
+
offset = 0;
|
|
10791
|
+
} else {
|
|
10792
|
+
codec = next();
|
|
10793
|
+
}
|
|
10794
|
+
if (version !== 0 && version !== 1) {
|
|
10795
|
+
throw new RangeError(`Invalid CID version ${version}`);
|
|
10796
|
+
}
|
|
10797
|
+
const prefixSize = offset;
|
|
10798
|
+
const multihashCode = next();
|
|
10799
|
+
const digestSize = next();
|
|
10800
|
+
const size = offset + digestSize;
|
|
10801
|
+
const multihashSize = size - prefixSize;
|
|
10802
|
+
return { version, codec, multihashCode, digestSize, multihashSize, size };
|
|
10803
|
+
}
|
|
10804
|
+
/**
|
|
10805
|
+
* Takes cid in a string representation and creates an instance. If `base`
|
|
10806
|
+
* decoder is not provided will use a default from the configuration. It will
|
|
10807
|
+
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
10808
|
+
* a default decoder).
|
|
10809
|
+
*/
|
|
10810
|
+
static parse(source, base3) {
|
|
10811
|
+
const [prefix, bytes] = parseCIDtoBytes2(source, base3);
|
|
10812
|
+
const cid = _CID.decode(bytes);
|
|
10813
|
+
if (cid.version === 0 && source[0] !== "Q") {
|
|
10814
|
+
throw Error("Version 0 CID string must not include multibase prefix");
|
|
10815
|
+
}
|
|
10816
|
+
baseCache2(cid).set(prefix, source);
|
|
10817
|
+
return cid;
|
|
10818
|
+
}
|
|
10819
|
+
};
|
|
10820
|
+
function parseCIDtoBytes2(source, base3) {
|
|
10821
|
+
switch (source[0]) {
|
|
10822
|
+
// CIDv0 is parsed differently
|
|
10823
|
+
case "Q": {
|
|
10824
|
+
const decoder = base3 ?? base58btc2;
|
|
10825
|
+
return [
|
|
10826
|
+
base58btc2.prefix,
|
|
10827
|
+
decoder.decode(`${base58btc2.prefix}${source}`)
|
|
10828
|
+
];
|
|
10829
|
+
}
|
|
10830
|
+
case base58btc2.prefix: {
|
|
10831
|
+
const decoder = base3 ?? base58btc2;
|
|
10832
|
+
return [base58btc2.prefix, decoder.decode(source)];
|
|
10833
|
+
}
|
|
10834
|
+
case base322.prefix: {
|
|
10835
|
+
const decoder = base3 ?? base322;
|
|
10836
|
+
return [base322.prefix, decoder.decode(source)];
|
|
10837
|
+
}
|
|
10838
|
+
case base362.prefix: {
|
|
10839
|
+
const decoder = base3 ?? base362;
|
|
10840
|
+
return [base362.prefix, decoder.decode(source)];
|
|
10841
|
+
}
|
|
10842
|
+
default: {
|
|
10843
|
+
if (base3 == null) {
|
|
10844
|
+
throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
|
|
10845
|
+
}
|
|
10846
|
+
return [source[0], base3.decode(source)];
|
|
10847
|
+
}
|
|
10848
|
+
}
|
|
10849
|
+
}
|
|
10850
|
+
function toStringV02(bytes, cache3, base3) {
|
|
10851
|
+
const { prefix } = base3;
|
|
10852
|
+
if (prefix !== base58btc2.prefix) {
|
|
10853
|
+
throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
|
|
10854
|
+
}
|
|
10855
|
+
const cid = cache3.get(prefix);
|
|
10856
|
+
if (cid == null) {
|
|
10857
|
+
const cid2 = base3.encode(bytes).slice(1);
|
|
10858
|
+
cache3.set(prefix, cid2);
|
|
10859
|
+
return cid2;
|
|
10860
|
+
} else {
|
|
10861
|
+
return cid;
|
|
10862
|
+
}
|
|
10863
|
+
}
|
|
10864
|
+
function toStringV12(bytes, cache3, base3) {
|
|
10865
|
+
const { prefix } = base3;
|
|
10866
|
+
const cid = cache3.get(prefix);
|
|
10867
|
+
if (cid == null) {
|
|
10868
|
+
const cid2 = base3.encode(bytes);
|
|
10869
|
+
cache3.set(prefix, cid2);
|
|
10870
|
+
return cid2;
|
|
10871
|
+
} else {
|
|
10872
|
+
return cid;
|
|
10873
|
+
}
|
|
10874
|
+
}
|
|
10875
|
+
var DAG_PB_CODE2 = 112;
|
|
10876
|
+
var SHA_256_CODE2 = 18;
|
|
10877
|
+
function encodeCID2(version, code2, multihash) {
|
|
10878
|
+
const codeOffset = encodingLength2(version);
|
|
10879
|
+
const hashOffset = codeOffset + encodingLength2(code2);
|
|
10880
|
+
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
|
10881
|
+
encodeTo2(version, bytes, 0);
|
|
10882
|
+
encodeTo2(code2, bytes, codeOffset);
|
|
10883
|
+
bytes.set(multihash, hashOffset);
|
|
10884
|
+
return bytes;
|
|
10885
|
+
}
|
|
10886
|
+
var cidSymbol2 = Symbol.for("@ipld/js-cid/CID");
|
|
10887
|
+
|
|
10888
|
+
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/hashes/hasher.js
|
|
10889
|
+
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
10890
|
+
function from3({ name: name2, code: code2, encode: encode9, minDigestLength, maxDigestLength }) {
|
|
10891
|
+
return new Hasher(name2, code2, encode9, minDigestLength, maxDigestLength);
|
|
10892
|
+
}
|
|
10893
|
+
var Hasher = class {
|
|
10894
|
+
name;
|
|
10895
|
+
code;
|
|
10896
|
+
encode;
|
|
10897
|
+
minDigestLength;
|
|
10898
|
+
maxDigestLength;
|
|
10899
|
+
constructor(name2, code2, encode9, minDigestLength, maxDigestLength) {
|
|
10900
|
+
this.name = name2;
|
|
10901
|
+
this.code = code2;
|
|
10902
|
+
this.encode = encode9;
|
|
10903
|
+
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
10904
|
+
this.maxDigestLength = maxDigestLength;
|
|
10905
|
+
}
|
|
10906
|
+
digest(input, options) {
|
|
10907
|
+
if (options?.truncate != null) {
|
|
10908
|
+
if (options.truncate < this.minDigestLength) {
|
|
10909
|
+
throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
10910
|
+
}
|
|
10911
|
+
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
|
|
10912
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
10913
|
+
}
|
|
10914
|
+
}
|
|
10915
|
+
if (input instanceof Uint8Array) {
|
|
10916
|
+
const result = this.encode(input);
|
|
10917
|
+
if (result instanceof Uint8Array) {
|
|
10918
|
+
return createDigest(result, this.code, options?.truncate);
|
|
10919
|
+
}
|
|
10920
|
+
return result.then((digest) => createDigest(digest, this.code, options?.truncate));
|
|
10921
|
+
} else {
|
|
10922
|
+
throw Error("Unknown type, must be binary type");
|
|
10923
|
+
}
|
|
10924
|
+
}
|
|
10925
|
+
};
|
|
10926
|
+
function createDigest(digest, code2, truncate) {
|
|
10927
|
+
if (truncate != null && truncate !== digest.byteLength) {
|
|
10928
|
+
if (truncate > digest.byteLength) {
|
|
10929
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${digest.byteLength}`);
|
|
10930
|
+
}
|
|
10931
|
+
digest = digest.subarray(0, truncate);
|
|
10932
|
+
}
|
|
10933
|
+
return create2(code2, digest);
|
|
10934
|
+
}
|
|
10935
|
+
|
|
9887
10936
|
// ../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/block.js
|
|
9888
10937
|
function readonly({ enumerable = true, configurable = false } = {}) {
|
|
9889
10938
|
return { enumerable, configurable, writable: false };
|
|
@@ -9893,7 +10942,7 @@ function* linksWithin(path, value) {
|
|
|
9893
10942
|
if (Array.isArray(value)) {
|
|
9894
10943
|
for (const [index, element] of value.entries()) {
|
|
9895
10944
|
const elementPath = [...path, index];
|
|
9896
|
-
const cid =
|
|
10945
|
+
const cid = CID2.asCID(element);
|
|
9897
10946
|
if (cid != null) {
|
|
9898
10947
|
yield [elementPath.join("/"), cid];
|
|
9899
10948
|
} else if (typeof element === "object") {
|
|
@@ -9901,7 +10950,7 @@ function* linksWithin(path, value) {
|
|
|
9901
10950
|
}
|
|
9902
10951
|
}
|
|
9903
10952
|
} else {
|
|
9904
|
-
const cid =
|
|
10953
|
+
const cid = CID2.asCID(value);
|
|
9905
10954
|
if (cid != null) {
|
|
9906
10955
|
yield [path.join("/"), cid];
|
|
9907
10956
|
} else {
|
|
@@ -9910,16 +10959,16 @@ function* linksWithin(path, value) {
|
|
|
9910
10959
|
}
|
|
9911
10960
|
}
|
|
9912
10961
|
}
|
|
9913
|
-
function* links(source,
|
|
10962
|
+
function* links(source, base3) {
|
|
9914
10963
|
if (source == null || source instanceof Uint8Array) {
|
|
9915
10964
|
return;
|
|
9916
10965
|
}
|
|
9917
|
-
const cid =
|
|
10966
|
+
const cid = CID2.asCID(source);
|
|
9918
10967
|
if (cid != null) {
|
|
9919
|
-
yield [
|
|
10968
|
+
yield [base3.join("/"), cid];
|
|
9920
10969
|
}
|
|
9921
10970
|
for (const [key, value] of Object.entries(source)) {
|
|
9922
|
-
const path = [...
|
|
10971
|
+
const path = [...base3, key];
|
|
9923
10972
|
yield* linksWithin(path, value);
|
|
9924
10973
|
}
|
|
9925
10974
|
}
|
|
@@ -9928,7 +10977,7 @@ function* treeWithin(path, value) {
|
|
|
9928
10977
|
for (const [index, element] of value.entries()) {
|
|
9929
10978
|
const elementPath = [...path, index];
|
|
9930
10979
|
yield elementPath.join("/");
|
|
9931
|
-
if (typeof element === "object" &&
|
|
10980
|
+
if (typeof element === "object" && CID2.asCID(element) == null) {
|
|
9932
10981
|
yield* tree(element, elementPath);
|
|
9933
10982
|
}
|
|
9934
10983
|
}
|
|
@@ -9936,14 +10985,14 @@ function* treeWithin(path, value) {
|
|
|
9936
10985
|
yield* tree(value, path);
|
|
9937
10986
|
}
|
|
9938
10987
|
}
|
|
9939
|
-
function* tree(source,
|
|
10988
|
+
function* tree(source, base3) {
|
|
9940
10989
|
if (source == null || typeof source !== "object") {
|
|
9941
10990
|
return;
|
|
9942
10991
|
}
|
|
9943
10992
|
for (const [key, value] of Object.entries(source)) {
|
|
9944
|
-
const path = [...
|
|
10993
|
+
const path = [...base3, key];
|
|
9945
10994
|
yield path.join("/");
|
|
9946
|
-
if (value != null && !(value instanceof Uint8Array) && typeof value === "object" &&
|
|
10995
|
+
if (value != null && !(value instanceof Uint8Array) && typeof value === "object" && CID2.asCID(value) == null) {
|
|
9947
10996
|
yield* treeWithin(path, value);
|
|
9948
10997
|
}
|
|
9949
10998
|
}
|
|
@@ -9955,7 +11004,7 @@ function get2(source, path) {
|
|
|
9955
11004
|
if (node == null) {
|
|
9956
11005
|
throw new Error(`Object has no property at ${path.slice(0, index + 1).map((part) => `[${JSON.stringify(part)}]`).join("")}`);
|
|
9957
11006
|
}
|
|
9958
|
-
const cid =
|
|
11007
|
+
const cid = CID2.asCID(node);
|
|
9959
11008
|
if (cid != null) {
|
|
9960
11009
|
return { value: cid, remaining: path.slice(index + 1).join("/") };
|
|
9961
11010
|
}
|
|
@@ -9992,7 +11041,7 @@ var Block = class {
|
|
|
9992
11041
|
return get2(this.value, path.split("/").filter(Boolean));
|
|
9993
11042
|
}
|
|
9994
11043
|
};
|
|
9995
|
-
async function
|
|
11044
|
+
async function encode8({ value, codec, hasher }) {
|
|
9996
11045
|
if (typeof value === "undefined") {
|
|
9997
11046
|
throw new Error('Missing required argument "value"');
|
|
9998
11047
|
}
|
|
@@ -10001,7 +11050,7 @@ async function encode6({ value, codec, hasher }) {
|
|
|
10001
11050
|
}
|
|
10002
11051
|
const bytes = codec.encode(value);
|
|
10003
11052
|
const hash = await hasher.digest(bytes);
|
|
10004
|
-
const cid =
|
|
11053
|
+
const cid = CID2.create(1, codec.code, hash);
|
|
10005
11054
|
return new Block({ value, bytes, cid });
|
|
10006
11055
|
}
|
|
10007
11056
|
|
|
@@ -10051,12 +11100,12 @@ var isValidApplog = AppLogTBC.Check.bind(AppLogTBC);
|
|
|
10051
11100
|
function sha(name2) {
|
|
10052
11101
|
return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
|
|
10053
11102
|
}
|
|
10054
|
-
var sha2562 =
|
|
11103
|
+
var sha2562 = from3({
|
|
10055
11104
|
name: "sha2-256",
|
|
10056
11105
|
code: 18,
|
|
10057
11106
|
encode: sha("SHA-256")
|
|
10058
11107
|
});
|
|
10059
|
-
var sha512 =
|
|
11108
|
+
var sha512 = from3({
|
|
10060
11109
|
name: "sha2-512",
|
|
10061
11110
|
code: 19,
|
|
10062
11111
|
encode: sha("SHA-512")
|
|
@@ -10095,8 +11144,8 @@ function encodeApplog(log) {
|
|
|
10095
11144
|
}
|
|
10096
11145
|
function getCidSync(bytes) {
|
|
10097
11146
|
const hash = sha256(bytes);
|
|
10098
|
-
const digest =
|
|
10099
|
-
const cid =
|
|
11147
|
+
const digest = digest_exports2.create(sha2562.code, hash);
|
|
11148
|
+
const cid = CID2.create(1, code, digest);
|
|
10100
11149
|
VERBOSE3(`[getCidSync]`, { bytes, hash, digest, cid });
|
|
10101
11150
|
return cid;
|
|
10102
11151
|
}
|
|
@@ -10106,7 +11155,7 @@ function encodeBlock(jsonObject) {
|
|
|
10106
11155
|
return { bytes: byteView, cid: getCidSync(byteView) };
|
|
10107
11156
|
}
|
|
10108
11157
|
async function encodeBlockOriginal(jsonObject) {
|
|
10109
|
-
const encoded = await
|
|
11158
|
+
const encoded = await encode8({ value: jsonObject, codec: src_exports, hasher: sha2562 });
|
|
10110
11159
|
const syncVariant = encodeBlock(jsonObject);
|
|
10111
11160
|
if (syncVariant.cid.toString() !== encoded.cid.toString()) {
|
|
10112
11161
|
ERROR3(`[encodeBlockOriginal] sync cid mismatch`, { jsonObject, encoded, syncVariant });
|
|
@@ -10117,14 +11166,14 @@ function tryParseCID(cidString) {
|
|
|
10117
11166
|
let cid = null;
|
|
10118
11167
|
let errors = [];
|
|
10119
11168
|
try {
|
|
10120
|
-
cid =
|
|
11169
|
+
cid = CID2.parse(cidString);
|
|
10121
11170
|
} catch (err) {
|
|
10122
11171
|
VERBOSE3(`[retrieveThread] couldn't parse pubID with default base`);
|
|
10123
11172
|
errors.push(err);
|
|
10124
11173
|
}
|
|
10125
11174
|
if (!cid) {
|
|
10126
11175
|
try {
|
|
10127
|
-
cid =
|
|
11176
|
+
cid = CID2.parse(cidString, base362);
|
|
10128
11177
|
} catch (err) {
|
|
10129
11178
|
VERBOSE3(`[retrieveThread] couldn't parse pubID with base36`);
|
|
10130
11179
|
errors.push(err);
|
|
@@ -10149,10 +11198,10 @@ function cidToString(cid) {
|
|
|
10149
11198
|
}
|
|
10150
11199
|
function toIpnsString(cid) {
|
|
10151
11200
|
if (cid.code !== MULTICODEC_IPNS_KEY) throw ERROR3(`Not an IPNS cid (${cid.code}):`, cid.toString());
|
|
10152
|
-
return cid.toString(
|
|
11201
|
+
return cid.toString(base362);
|
|
10153
11202
|
}
|
|
10154
11203
|
function ensureValidCIDinstance(cidOrStringA) {
|
|
10155
|
-
return typeof cidOrStringA === "string" ?
|
|
11204
|
+
return typeof cidOrStringA === "string" ? CID2.parse(cidOrStringA) : typeof cidOrStringA.toV1 != "function" ? CID2.decode(cidOrStringA.bytes) : cidOrStringA;
|
|
10156
11205
|
}
|
|
10157
11206
|
function areCidsEqual(cidOrStringA, cidOrStringB) {
|
|
10158
11207
|
if (!cidOrStringA || !cidOrStringB) throw new Error(`[areCidsEqual] invalid params: ${cidOrStringA}, ${cidOrStringB}`);
|
|
@@ -11156,9 +12205,16 @@ var excludeApplogsContainedIn = (applogs, exclude) => {
|
|
|
11156
12205
|
|
|
11157
12206
|
export {
|
|
11158
12207
|
g,
|
|
12208
|
+
Type,
|
|
12209
|
+
Token,
|
|
12210
|
+
makeCborEncoders,
|
|
12211
|
+
encode,
|
|
12212
|
+
decode,
|
|
12213
|
+
decode6 as decode2,
|
|
11159
12214
|
CID,
|
|
11160
|
-
decode7 as
|
|
12215
|
+
decode7 as decode3,
|
|
11161
12216
|
src_exports,
|
|
12217
|
+
CID2,
|
|
11162
12218
|
Nullable,
|
|
11163
12219
|
EntityID_LENGTH,
|
|
11164
12220
|
EntityID,
|
|
@@ -11276,4 +12332,4 @@ lodash-es/lodash.js:
|
|
|
11276
12332
|
@noble/hashes/utils.js:
|
|
11277
12333
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
11278
12334
|
*/
|
|
11279
|
-
//# sourceMappingURL=chunk-
|
|
12335
|
+
//# sourceMappingURL=chunk-R7EMHBM3.min.js.map
|