@openuverse/uvapi 0.0.0-stage → 1.1.2
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/README.md +3871 -3
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/api/RestAPIClient.d.ts +191 -0
- package/dist/api/RestAPIClient.js +328 -0
- package/dist/api/WebSocketClient.d.ts +174 -0
- package/dist/api/WebSocketClient.js +277 -0
- package/dist/api/index.d.ts +6 -0
- package/dist/api/modules/index.d.ts +2 -0
- package/dist/api/modules/task.d.ts +124 -0
- package/dist/api/modules/task.js +121 -0
- package/dist/api/modules/user.d.ts +114 -0
- package/dist/api/modules/user.js +113 -0
- package/dist/config/index.d.ts +120 -0
- package/dist/config/index.js +112 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAttributeMonitor.d.ts +45 -0
- package/dist/hooks/useAttributeMonitor.js +115 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +93 -0
- package/dist/locale/de-DE.d.ts +18 -0
- package/dist/locale/de-DE.js +20 -0
- package/dist/locale/en-US.d.ts +18 -0
- package/dist/locale/en-US.js +20 -0
- package/dist/locale/es-ES.d.ts +18 -0
- package/dist/locale/es-ES.js +20 -0
- package/dist/locale/fr-FR.d.ts +18 -0
- package/dist/locale/fr-FR.js +20 -0
- package/dist/locale/id-ID.d.ts +18 -0
- package/dist/locale/id-ID.js +20 -0
- package/dist/locale/index.d.ts +19 -0
- package/dist/locale/index.js +70 -0
- package/dist/locale/ja-JP.d.ts +18 -0
- package/dist/locale/ja-JP.js +20 -0
- package/dist/locale/ko-KR.d.ts +18 -0
- package/dist/locale/ko-KR.js +20 -0
- package/dist/locale/pl-PL.d.ts +18 -0
- package/dist/locale/pl-PL.js +20 -0
- package/dist/locale/pt-BR.d.ts +18 -0
- package/dist/locale/pt-BR.js +20 -0
- package/dist/locale/ru-RU.d.ts +18 -0
- package/dist/locale/ru-RU.js +20 -0
- package/dist/locale/th-TH.d.ts +18 -0
- package/dist/locale/th-TH.js +20 -0
- package/dist/locale/zh-CN.d.ts +18 -0
- package/dist/locale/zh-CN.js +20 -0
- package/dist/locale/zh-TW.d.ts +18 -0
- package/dist/locale/zh-TW.js +20 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.js +38 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/DecodeError.js +14 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/Decoder.js +474 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/Encoder.js +232 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/ExtData.js +8 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.js +46 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/decode.js +7 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/encode.js +7 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/timestamp.js +66 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/int.js +24 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.js +6 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.js +9 -0
- package/dist/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.js +93 -0
- package/dist/node_modules/axios/index.js +38 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +55 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +169 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +72 -0
- package/dist/node_modules/axios/lib/axios.js +46 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +77 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +11 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/axios/lib/core/Axios.js +136 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +56 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +181 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +58 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +9 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +31 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +70 -0
- package/dist/node_modules/axios/lib/core/settle.js +14 -0
- package/dist/node_modules/axios/lib/core/transformData.js +13 -0
- package/dist/node_modules/axios/lib/defaults/index.js +89 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +8 -0
- package/dist/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +33 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +8 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +23 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +6 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +30 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +32 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +31 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +6 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +8 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +30 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +35 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +33 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +19 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +8 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +15 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +85 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +63 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +54 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +9 -0
- package/dist/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/axios/lib/utils.js +237 -0
- package/dist/node_modules/postcss-pxtorem/index.js +109 -0
- package/dist/node_modules/postcss-pxtorem/lib/filter-prop-list.js +13 -0
- package/dist/node_modules/postcss-pxtorem/lib/pixel-unit-regex.js +7 -0
- package/dist/node_modules/postcss-pxtorem/lib/type.js +14 -0
- package/dist/preload/index.d.ts +125 -0
- package/dist/preload/index.js +79 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/storeFactory.d.ts +584 -0
- package/dist/store/storeFactory.js +216 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +14 -0
- package/dist/types/index.d.ts +57 -0
- package/dist/types/uVerseAPI.d.ts +67 -0
- package/dist/utils/_internal.d.ts +14 -0
- package/dist/utils/_internal.js +72 -0
- package/dist/utils/constance.d.ts +16 -0
- package/dist/utils/constance.js +7 -0
- package/dist/utils/index.d.ts +79 -0
- package/dist/utils/index.js +96 -0
- package/dist/utils/logger.d.ts +118 -0
- package/dist/utils/logger.js +170 -0
- package/dist/utils/px2rem/remAdapter.d.ts +17 -0
- package/dist/utils/px2rem/remAdapter.js +62 -0
- package/dist/utils/px2rem/vite.d.ts +14 -0
- package/dist/utils/px2rem/vite.js +33 -0
- package/package.json +102 -4
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { prettyByte as l } from "./utils/prettyByte.js";
|
|
2
|
+
import { ExtensionCodec as S } from "./ExtensionCodec.js";
|
|
3
|
+
import { UINT32_MAX as h, getUint64 as B, getInt64 as k } from "./utils/int.js";
|
|
4
|
+
import { utf8Decode as E } from "./utils/utf8.js";
|
|
5
|
+
import { ensureUint8Array as x } from "./utils/typedArrays.js";
|
|
6
|
+
import { CachedKeyDecoder as U } from "./CachedKeyDecoder.js";
|
|
7
|
+
import { DecodeError as r } from "./DecodeError.js";
|
|
8
|
+
const f = "array", c = "map_key", p = "map_value", A = (n) => {
|
|
9
|
+
if (typeof n == "string" || typeof n == "number")
|
|
10
|
+
return n;
|
|
11
|
+
throw new r("The type of key must be string or number but " + typeof n);
|
|
12
|
+
};
|
|
13
|
+
class v {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.stack = [], this.stackHeadPosition = -1;
|
|
16
|
+
}
|
|
17
|
+
get length() {
|
|
18
|
+
return this.stackHeadPosition + 1;
|
|
19
|
+
}
|
|
20
|
+
top() {
|
|
21
|
+
return this.stack[this.stackHeadPosition];
|
|
22
|
+
}
|
|
23
|
+
pushArrayState(e) {
|
|
24
|
+
const t = this.getUninitializedStateFromPool();
|
|
25
|
+
t.type = f, t.position = 0, t.size = e, t.array = new Array(e);
|
|
26
|
+
}
|
|
27
|
+
pushMapState(e) {
|
|
28
|
+
const t = this.getUninitializedStateFromPool();
|
|
29
|
+
t.type = c, t.readCount = 0, t.size = e, t.map = {};
|
|
30
|
+
}
|
|
31
|
+
getUninitializedStateFromPool() {
|
|
32
|
+
if (this.stackHeadPosition++, this.stackHeadPosition === this.stack.length) {
|
|
33
|
+
const e = {
|
|
34
|
+
type: void 0,
|
|
35
|
+
size: 0,
|
|
36
|
+
array: void 0,
|
|
37
|
+
position: 0,
|
|
38
|
+
readCount: 0,
|
|
39
|
+
map: void 0,
|
|
40
|
+
key: null
|
|
41
|
+
};
|
|
42
|
+
this.stack.push(e);
|
|
43
|
+
}
|
|
44
|
+
return this.stack[this.stackHeadPosition];
|
|
45
|
+
}
|
|
46
|
+
release(e) {
|
|
47
|
+
if (this.stack[this.stackHeadPosition] !== e)
|
|
48
|
+
throw new Error("Invalid stack state. Released state is not on top of the stack.");
|
|
49
|
+
if (e.type === f) {
|
|
50
|
+
const i = e;
|
|
51
|
+
i.size = 0, i.array = void 0, i.position = 0, i.type = void 0;
|
|
52
|
+
}
|
|
53
|
+
if (e.type === c || e.type === p) {
|
|
54
|
+
const i = e;
|
|
55
|
+
i.size = 0, i.map = void 0, i.readCount = 0, i.type = void 0;
|
|
56
|
+
}
|
|
57
|
+
this.stackHeadPosition--;
|
|
58
|
+
}
|
|
59
|
+
reset() {
|
|
60
|
+
this.stack.length = 0, this.stackHeadPosition = -1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const o = -1, u = new DataView(new ArrayBuffer(0)), I = new Uint8Array(u.buffer);
|
|
64
|
+
try {
|
|
65
|
+
u.getInt8(0);
|
|
66
|
+
} catch (n) {
|
|
67
|
+
if (!(n instanceof RangeError))
|
|
68
|
+
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
|
|
69
|
+
}
|
|
70
|
+
const g = new RangeError("Insufficient data"), L = new U();
|
|
71
|
+
class m {
|
|
72
|
+
constructor(e) {
|
|
73
|
+
this.totalPos = 0, this.pos = 0, this.view = u, this.bytes = I, this.headByte = o, this.stack = new v(), this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? S.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? h, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? h, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? h, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? h, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? h, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : L, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? A;
|
|
74
|
+
}
|
|
75
|
+
clone() {
|
|
76
|
+
return new m({
|
|
77
|
+
extensionCodec: this.extensionCodec,
|
|
78
|
+
context: this.context,
|
|
79
|
+
useBigInt64: this.useBigInt64,
|
|
80
|
+
rawStrings: this.rawStrings,
|
|
81
|
+
maxStrLength: this.maxStrLength,
|
|
82
|
+
maxBinLength: this.maxBinLength,
|
|
83
|
+
maxArrayLength: this.maxArrayLength,
|
|
84
|
+
maxMapLength: this.maxMapLength,
|
|
85
|
+
maxExtLength: this.maxExtLength,
|
|
86
|
+
keyDecoder: this.keyDecoder
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
reinitializeState() {
|
|
90
|
+
this.totalPos = 0, this.headByte = o, this.stack.reset();
|
|
91
|
+
}
|
|
92
|
+
setBuffer(e) {
|
|
93
|
+
const t = x(e);
|
|
94
|
+
this.bytes = t, this.view = new DataView(t.buffer, t.byteOffset, t.byteLength), this.pos = 0;
|
|
95
|
+
}
|
|
96
|
+
appendBuffer(e) {
|
|
97
|
+
if (this.headByte === o && !this.hasRemaining(1))
|
|
98
|
+
this.setBuffer(e);
|
|
99
|
+
else {
|
|
100
|
+
const t = this.bytes.subarray(this.pos), i = x(e), s = new Uint8Array(t.length + i.length);
|
|
101
|
+
s.set(t), s.set(i, t.length), this.setBuffer(s);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
hasRemaining(e) {
|
|
105
|
+
return this.view.byteLength - this.pos >= e;
|
|
106
|
+
}
|
|
107
|
+
createExtraByteError(e) {
|
|
108
|
+
const { view: t, pos: i } = this;
|
|
109
|
+
return new RangeError(`Extra ${t.byteLength - i} of ${t.byteLength} byte(s) found at buffer[${e}]`);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @throws {@link DecodeError}
|
|
113
|
+
* @throws {@link RangeError}
|
|
114
|
+
*/
|
|
115
|
+
decode(e) {
|
|
116
|
+
if (this.entered)
|
|
117
|
+
return this.clone().decode(e);
|
|
118
|
+
try {
|
|
119
|
+
this.entered = !0, this.reinitializeState(), this.setBuffer(e);
|
|
120
|
+
const t = this.doDecodeSync();
|
|
121
|
+
if (this.hasRemaining(1))
|
|
122
|
+
throw this.createExtraByteError(this.pos);
|
|
123
|
+
return t;
|
|
124
|
+
} finally {
|
|
125
|
+
this.entered = !1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
*decodeMulti(e) {
|
|
129
|
+
if (this.entered) {
|
|
130
|
+
yield* this.clone().decodeMulti(e);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
for (this.entered = !0, this.reinitializeState(), this.setBuffer(e); this.hasRemaining(1); )
|
|
135
|
+
yield this.doDecodeSync();
|
|
136
|
+
} finally {
|
|
137
|
+
this.entered = !1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async decodeAsync(e) {
|
|
141
|
+
if (this.entered)
|
|
142
|
+
return this.clone().decodeAsync(e);
|
|
143
|
+
try {
|
|
144
|
+
this.entered = !0;
|
|
145
|
+
let t = !1, i;
|
|
146
|
+
for await (const w of e) {
|
|
147
|
+
if (t)
|
|
148
|
+
throw this.entered = !1, this.createExtraByteError(this.totalPos);
|
|
149
|
+
this.appendBuffer(w);
|
|
150
|
+
try {
|
|
151
|
+
i = this.doDecodeSync(), t = !0;
|
|
152
|
+
} catch (y) {
|
|
153
|
+
if (!(y instanceof RangeError))
|
|
154
|
+
throw y;
|
|
155
|
+
}
|
|
156
|
+
this.totalPos += this.pos;
|
|
157
|
+
}
|
|
158
|
+
if (t) {
|
|
159
|
+
if (this.hasRemaining(1))
|
|
160
|
+
throw this.createExtraByteError(this.totalPos);
|
|
161
|
+
return i;
|
|
162
|
+
}
|
|
163
|
+
const { headByte: s, pos: a, totalPos: d } = this;
|
|
164
|
+
throw new RangeError(`Insufficient data in parsing ${l(s)} at ${d} (${a} in the current buffer)`);
|
|
165
|
+
} finally {
|
|
166
|
+
this.entered = !1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
decodeArrayStream(e) {
|
|
170
|
+
return this.decodeMultiAsync(e, !0);
|
|
171
|
+
}
|
|
172
|
+
decodeStream(e) {
|
|
173
|
+
return this.decodeMultiAsync(e, !1);
|
|
174
|
+
}
|
|
175
|
+
async *decodeMultiAsync(e, t) {
|
|
176
|
+
if (this.entered) {
|
|
177
|
+
yield* this.clone().decodeMultiAsync(e, t);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
this.entered = !0;
|
|
182
|
+
let i = t, s = -1;
|
|
183
|
+
for await (const a of e) {
|
|
184
|
+
if (t && s === 0)
|
|
185
|
+
throw this.createExtraByteError(this.totalPos);
|
|
186
|
+
this.appendBuffer(a), i && (s = this.readArraySize(), i = !1, this.complete());
|
|
187
|
+
try {
|
|
188
|
+
for (; yield this.doDecodeSync(), --s !== 0; )
|
|
189
|
+
;
|
|
190
|
+
} catch (d) {
|
|
191
|
+
if (!(d instanceof RangeError))
|
|
192
|
+
throw d;
|
|
193
|
+
}
|
|
194
|
+
this.totalPos += this.pos;
|
|
195
|
+
}
|
|
196
|
+
} finally {
|
|
197
|
+
this.entered = !1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
doDecodeSync() {
|
|
201
|
+
e: for (; ; ) {
|
|
202
|
+
const e = this.readHeadByte();
|
|
203
|
+
let t;
|
|
204
|
+
if (e >= 224)
|
|
205
|
+
t = e - 256;
|
|
206
|
+
else if (e < 192)
|
|
207
|
+
if (e < 128)
|
|
208
|
+
t = e;
|
|
209
|
+
else if (e < 144) {
|
|
210
|
+
const s = e - 128;
|
|
211
|
+
if (s !== 0) {
|
|
212
|
+
this.pushMapState(s), this.complete();
|
|
213
|
+
continue e;
|
|
214
|
+
} else
|
|
215
|
+
t = {};
|
|
216
|
+
} else if (e < 160) {
|
|
217
|
+
const s = e - 144;
|
|
218
|
+
if (s !== 0) {
|
|
219
|
+
this.pushArrayState(s), this.complete();
|
|
220
|
+
continue e;
|
|
221
|
+
} else
|
|
222
|
+
t = [];
|
|
223
|
+
} else {
|
|
224
|
+
const s = e - 160;
|
|
225
|
+
t = this.decodeString(s, 0);
|
|
226
|
+
}
|
|
227
|
+
else if (e === 192)
|
|
228
|
+
t = null;
|
|
229
|
+
else if (e === 194)
|
|
230
|
+
t = !1;
|
|
231
|
+
else if (e === 195)
|
|
232
|
+
t = !0;
|
|
233
|
+
else if (e === 202)
|
|
234
|
+
t = this.readF32();
|
|
235
|
+
else if (e === 203)
|
|
236
|
+
t = this.readF64();
|
|
237
|
+
else if (e === 204)
|
|
238
|
+
t = this.readU8();
|
|
239
|
+
else if (e === 205)
|
|
240
|
+
t = this.readU16();
|
|
241
|
+
else if (e === 206)
|
|
242
|
+
t = this.readU32();
|
|
243
|
+
else if (e === 207)
|
|
244
|
+
this.useBigInt64 ? t = this.readU64AsBigInt() : t = this.readU64();
|
|
245
|
+
else if (e === 208)
|
|
246
|
+
t = this.readI8();
|
|
247
|
+
else if (e === 209)
|
|
248
|
+
t = this.readI16();
|
|
249
|
+
else if (e === 210)
|
|
250
|
+
t = this.readI32();
|
|
251
|
+
else if (e === 211)
|
|
252
|
+
this.useBigInt64 ? t = this.readI64AsBigInt() : t = this.readI64();
|
|
253
|
+
else if (e === 217) {
|
|
254
|
+
const s = this.lookU8();
|
|
255
|
+
t = this.decodeString(s, 1);
|
|
256
|
+
} else if (e === 218) {
|
|
257
|
+
const s = this.lookU16();
|
|
258
|
+
t = this.decodeString(s, 2);
|
|
259
|
+
} else if (e === 219) {
|
|
260
|
+
const s = this.lookU32();
|
|
261
|
+
t = this.decodeString(s, 4);
|
|
262
|
+
} else if (e === 220) {
|
|
263
|
+
const s = this.readU16();
|
|
264
|
+
if (s !== 0) {
|
|
265
|
+
this.pushArrayState(s), this.complete();
|
|
266
|
+
continue e;
|
|
267
|
+
} else
|
|
268
|
+
t = [];
|
|
269
|
+
} else if (e === 221) {
|
|
270
|
+
const s = this.readU32();
|
|
271
|
+
if (s !== 0) {
|
|
272
|
+
this.pushArrayState(s), this.complete();
|
|
273
|
+
continue e;
|
|
274
|
+
} else
|
|
275
|
+
t = [];
|
|
276
|
+
} else if (e === 222) {
|
|
277
|
+
const s = this.readU16();
|
|
278
|
+
if (s !== 0) {
|
|
279
|
+
this.pushMapState(s), this.complete();
|
|
280
|
+
continue e;
|
|
281
|
+
} else
|
|
282
|
+
t = {};
|
|
283
|
+
} else if (e === 223) {
|
|
284
|
+
const s = this.readU32();
|
|
285
|
+
if (s !== 0) {
|
|
286
|
+
this.pushMapState(s), this.complete();
|
|
287
|
+
continue e;
|
|
288
|
+
} else
|
|
289
|
+
t = {};
|
|
290
|
+
} else if (e === 196) {
|
|
291
|
+
const s = this.lookU8();
|
|
292
|
+
t = this.decodeBinary(s, 1);
|
|
293
|
+
} else if (e === 197) {
|
|
294
|
+
const s = this.lookU16();
|
|
295
|
+
t = this.decodeBinary(s, 2);
|
|
296
|
+
} else if (e === 198) {
|
|
297
|
+
const s = this.lookU32();
|
|
298
|
+
t = this.decodeBinary(s, 4);
|
|
299
|
+
} else if (e === 212)
|
|
300
|
+
t = this.decodeExtension(1, 0);
|
|
301
|
+
else if (e === 213)
|
|
302
|
+
t = this.decodeExtension(2, 0);
|
|
303
|
+
else if (e === 214)
|
|
304
|
+
t = this.decodeExtension(4, 0);
|
|
305
|
+
else if (e === 215)
|
|
306
|
+
t = this.decodeExtension(8, 0);
|
|
307
|
+
else if (e === 216)
|
|
308
|
+
t = this.decodeExtension(16, 0);
|
|
309
|
+
else if (e === 199) {
|
|
310
|
+
const s = this.lookU8();
|
|
311
|
+
t = this.decodeExtension(s, 1);
|
|
312
|
+
} else if (e === 200) {
|
|
313
|
+
const s = this.lookU16();
|
|
314
|
+
t = this.decodeExtension(s, 2);
|
|
315
|
+
} else if (e === 201) {
|
|
316
|
+
const s = this.lookU32();
|
|
317
|
+
t = this.decodeExtension(s, 4);
|
|
318
|
+
} else
|
|
319
|
+
throw new r(`Unrecognized type byte: ${l(e)}`);
|
|
320
|
+
this.complete();
|
|
321
|
+
const i = this.stack;
|
|
322
|
+
for (; i.length > 0; ) {
|
|
323
|
+
const s = i.top();
|
|
324
|
+
if (s.type === f)
|
|
325
|
+
if (s.array[s.position] = t, s.position++, s.position === s.size)
|
|
326
|
+
t = s.array, i.release(s);
|
|
327
|
+
else
|
|
328
|
+
continue e;
|
|
329
|
+
else if (s.type === c) {
|
|
330
|
+
if (t === "__proto__")
|
|
331
|
+
throw new r("The key __proto__ is not allowed");
|
|
332
|
+
s.key = this.mapKeyConverter(t), s.type = p;
|
|
333
|
+
continue e;
|
|
334
|
+
} else if (s.map[s.key] = t, s.readCount++, s.readCount === s.size)
|
|
335
|
+
t = s.map, i.release(s);
|
|
336
|
+
else {
|
|
337
|
+
s.key = null, s.type = c;
|
|
338
|
+
continue e;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return t;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
readHeadByte() {
|
|
345
|
+
return this.headByte === o && (this.headByte = this.readU8()), this.headByte;
|
|
346
|
+
}
|
|
347
|
+
complete() {
|
|
348
|
+
this.headByte = o;
|
|
349
|
+
}
|
|
350
|
+
readArraySize() {
|
|
351
|
+
const e = this.readHeadByte();
|
|
352
|
+
switch (e) {
|
|
353
|
+
case 220:
|
|
354
|
+
return this.readU16();
|
|
355
|
+
case 221:
|
|
356
|
+
return this.readU32();
|
|
357
|
+
default: {
|
|
358
|
+
if (e < 160)
|
|
359
|
+
return e - 144;
|
|
360
|
+
throw new r(`Unrecognized array type byte: ${l(e)}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
pushMapState(e) {
|
|
365
|
+
if (e > this.maxMapLength)
|
|
366
|
+
throw new r(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);
|
|
367
|
+
this.stack.pushMapState(e);
|
|
368
|
+
}
|
|
369
|
+
pushArrayState(e) {
|
|
370
|
+
if (e > this.maxArrayLength)
|
|
371
|
+
throw new r(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);
|
|
372
|
+
this.stack.pushArrayState(e);
|
|
373
|
+
}
|
|
374
|
+
decodeString(e, t) {
|
|
375
|
+
return !this.rawStrings || this.stateIsMapKey() ? this.decodeUtf8String(e, t) : this.decodeBinary(e, t);
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* @throws {@link RangeError}
|
|
379
|
+
*/
|
|
380
|
+
decodeUtf8String(e, t) {
|
|
381
|
+
var a;
|
|
382
|
+
if (e > this.maxStrLength)
|
|
383
|
+
throw new r(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);
|
|
384
|
+
if (this.bytes.byteLength < this.pos + t + e)
|
|
385
|
+
throw g;
|
|
386
|
+
const i = this.pos + t;
|
|
387
|
+
let s;
|
|
388
|
+
return this.stateIsMapKey() && ((a = this.keyDecoder) != null && a.canBeCached(e)) ? s = this.keyDecoder.decode(this.bytes, i, e) : s = E(this.bytes, i, e), this.pos += t + e, s;
|
|
389
|
+
}
|
|
390
|
+
stateIsMapKey() {
|
|
391
|
+
return this.stack.length > 0 ? this.stack.top().type === c : !1;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @throws {@link RangeError}
|
|
395
|
+
*/
|
|
396
|
+
decodeBinary(e, t) {
|
|
397
|
+
if (e > this.maxBinLength)
|
|
398
|
+
throw new r(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);
|
|
399
|
+
if (!this.hasRemaining(e + t))
|
|
400
|
+
throw g;
|
|
401
|
+
const i = this.pos + t, s = this.bytes.subarray(i, i + e);
|
|
402
|
+
return this.pos += t + e, s;
|
|
403
|
+
}
|
|
404
|
+
decodeExtension(e, t) {
|
|
405
|
+
if (e > this.maxExtLength)
|
|
406
|
+
throw new r(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);
|
|
407
|
+
const i = this.view.getInt8(this.pos + t), s = this.decodeBinary(
|
|
408
|
+
e,
|
|
409
|
+
t + 1
|
|
410
|
+
/* extType */
|
|
411
|
+
);
|
|
412
|
+
return this.extensionCodec.decode(s, i, this.context);
|
|
413
|
+
}
|
|
414
|
+
lookU8() {
|
|
415
|
+
return this.view.getUint8(this.pos);
|
|
416
|
+
}
|
|
417
|
+
lookU16() {
|
|
418
|
+
return this.view.getUint16(this.pos);
|
|
419
|
+
}
|
|
420
|
+
lookU32() {
|
|
421
|
+
return this.view.getUint32(this.pos);
|
|
422
|
+
}
|
|
423
|
+
readU8() {
|
|
424
|
+
const e = this.view.getUint8(this.pos);
|
|
425
|
+
return this.pos++, e;
|
|
426
|
+
}
|
|
427
|
+
readI8() {
|
|
428
|
+
const e = this.view.getInt8(this.pos);
|
|
429
|
+
return this.pos++, e;
|
|
430
|
+
}
|
|
431
|
+
readU16() {
|
|
432
|
+
const e = this.view.getUint16(this.pos);
|
|
433
|
+
return this.pos += 2, e;
|
|
434
|
+
}
|
|
435
|
+
readI16() {
|
|
436
|
+
const e = this.view.getInt16(this.pos);
|
|
437
|
+
return this.pos += 2, e;
|
|
438
|
+
}
|
|
439
|
+
readU32() {
|
|
440
|
+
const e = this.view.getUint32(this.pos);
|
|
441
|
+
return this.pos += 4, e;
|
|
442
|
+
}
|
|
443
|
+
readI32() {
|
|
444
|
+
const e = this.view.getInt32(this.pos);
|
|
445
|
+
return this.pos += 4, e;
|
|
446
|
+
}
|
|
447
|
+
readU64() {
|
|
448
|
+
const e = B(this.view, this.pos);
|
|
449
|
+
return this.pos += 8, e;
|
|
450
|
+
}
|
|
451
|
+
readI64() {
|
|
452
|
+
const e = k(this.view, this.pos);
|
|
453
|
+
return this.pos += 8, e;
|
|
454
|
+
}
|
|
455
|
+
readU64AsBigInt() {
|
|
456
|
+
const e = this.view.getBigUint64(this.pos);
|
|
457
|
+
return this.pos += 8, e;
|
|
458
|
+
}
|
|
459
|
+
readI64AsBigInt() {
|
|
460
|
+
const e = this.view.getBigInt64(this.pos);
|
|
461
|
+
return this.pos += 8, e;
|
|
462
|
+
}
|
|
463
|
+
readF32() {
|
|
464
|
+
const e = this.view.getFloat32(this.pos);
|
|
465
|
+
return this.pos += 4, e;
|
|
466
|
+
}
|
|
467
|
+
readF64() {
|
|
468
|
+
const e = this.view.getFloat64(this.pos);
|
|
469
|
+
return this.pos += 8, e;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
export {
|
|
473
|
+
m as Decoder
|
|
474
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { utf8Count as f, utf8Encode as w } from "./utils/utf8.js";
|
|
2
|
+
import { ExtensionCodec as o } from "./ExtensionCodec.js";
|
|
3
|
+
import { setUint64 as l, setInt64 as a } from "./utils/int.js";
|
|
4
|
+
import { ensureUint8Array as d } from "./utils/typedArrays.js";
|
|
5
|
+
const U = 100, u = 2048;
|
|
6
|
+
class n {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? o.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? U, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? u, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
|
|
9
|
+
}
|
|
10
|
+
clone() {
|
|
11
|
+
return new n({
|
|
12
|
+
extensionCodec: this.extensionCodec,
|
|
13
|
+
context: this.context,
|
|
14
|
+
useBigInt64: this.useBigInt64,
|
|
15
|
+
maxDepth: this.maxDepth,
|
|
16
|
+
initialBufferSize: this.initialBufferSize,
|
|
17
|
+
sortKeys: this.sortKeys,
|
|
18
|
+
forceFloat32: this.forceFloat32,
|
|
19
|
+
ignoreUndefined: this.ignoreUndefined,
|
|
20
|
+
forceIntegerToFloat: this.forceIntegerToFloat
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
reinitializeState() {
|
|
24
|
+
this.pos = 0;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This is almost equivalent to {@link Encoder#encode}, but it returns an reference of the encoder's internal buffer and thus much faster than {@link Encoder#encode}.
|
|
28
|
+
*
|
|
29
|
+
* @returns Encodes the object and returns a shared reference the encoder's internal buffer.
|
|
30
|
+
*/
|
|
31
|
+
encodeSharedRef(e) {
|
|
32
|
+
if (this.entered)
|
|
33
|
+
return this.clone().encodeSharedRef(e);
|
|
34
|
+
try {
|
|
35
|
+
return this.entered = !0, this.reinitializeState(), this.doEncode(e, 1), this.bytes.subarray(0, this.pos);
|
|
36
|
+
} finally {
|
|
37
|
+
this.entered = !1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @returns Encodes the object and returns a copy of the encoder's internal buffer.
|
|
42
|
+
*/
|
|
43
|
+
encode(e) {
|
|
44
|
+
if (this.entered)
|
|
45
|
+
return this.clone().encode(e);
|
|
46
|
+
try {
|
|
47
|
+
return this.entered = !0, this.reinitializeState(), this.doEncode(e, 1), this.bytes.slice(0, this.pos);
|
|
48
|
+
} finally {
|
|
49
|
+
this.entered = !1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
doEncode(e, i) {
|
|
53
|
+
if (i > this.maxDepth)
|
|
54
|
+
throw new Error(`Too deep objects in depth ${i}`);
|
|
55
|
+
e == null ? this.encodeNil() : typeof e == "boolean" ? this.encodeBoolean(e) : typeof e == "number" ? this.forceIntegerToFloat ? this.encodeNumberAsFloat(e) : this.encodeNumber(e) : typeof e == "string" ? this.encodeString(e) : this.useBigInt64 && typeof e == "bigint" ? this.encodeBigInt64(e) : this.encodeObject(e, i);
|
|
56
|
+
}
|
|
57
|
+
ensureBufferSizeToWrite(e) {
|
|
58
|
+
const i = this.pos + e;
|
|
59
|
+
this.view.byteLength < i && this.resizeBuffer(i * 2);
|
|
60
|
+
}
|
|
61
|
+
resizeBuffer(e) {
|
|
62
|
+
const i = new ArrayBuffer(e), t = new Uint8Array(i), s = new DataView(i);
|
|
63
|
+
t.set(this.bytes), this.view = s, this.bytes = t;
|
|
64
|
+
}
|
|
65
|
+
encodeNil() {
|
|
66
|
+
this.writeU8(192);
|
|
67
|
+
}
|
|
68
|
+
encodeBoolean(e) {
|
|
69
|
+
e === !1 ? this.writeU8(194) : this.writeU8(195);
|
|
70
|
+
}
|
|
71
|
+
encodeNumber(e) {
|
|
72
|
+
!this.forceIntegerToFloat && Number.isSafeInteger(e) ? e >= 0 ? e < 128 ? this.writeU8(e) : e < 256 ? (this.writeU8(204), this.writeU8(e)) : e < 65536 ? (this.writeU8(205), this.writeU16(e)) : e < 4294967296 ? (this.writeU8(206), this.writeU32(e)) : this.useBigInt64 ? this.encodeNumberAsFloat(e) : (this.writeU8(207), this.writeU64(e)) : e >= -32 ? this.writeU8(224 | e + 32) : e >= -128 ? (this.writeU8(208), this.writeI8(e)) : e >= -32768 ? (this.writeU8(209), this.writeI16(e)) : e >= -2147483648 ? (this.writeU8(210), this.writeI32(e)) : this.useBigInt64 ? this.encodeNumberAsFloat(e) : (this.writeU8(211), this.writeI64(e)) : this.encodeNumberAsFloat(e);
|
|
73
|
+
}
|
|
74
|
+
encodeNumberAsFloat(e) {
|
|
75
|
+
this.forceFloat32 ? (this.writeU8(202), this.writeF32(e)) : (this.writeU8(203), this.writeF64(e));
|
|
76
|
+
}
|
|
77
|
+
encodeBigInt64(e) {
|
|
78
|
+
e >= BigInt(0) ? (this.writeU8(207), this.writeBigUint64(e)) : (this.writeU8(211), this.writeBigInt64(e));
|
|
79
|
+
}
|
|
80
|
+
writeStringHeader(e) {
|
|
81
|
+
if (e < 32)
|
|
82
|
+
this.writeU8(160 + e);
|
|
83
|
+
else if (e < 256)
|
|
84
|
+
this.writeU8(217), this.writeU8(e);
|
|
85
|
+
else if (e < 65536)
|
|
86
|
+
this.writeU8(218), this.writeU16(e);
|
|
87
|
+
else if (e < 4294967296)
|
|
88
|
+
this.writeU8(219), this.writeU32(e);
|
|
89
|
+
else
|
|
90
|
+
throw new Error(`Too long string: ${e} bytes in UTF-8`);
|
|
91
|
+
}
|
|
92
|
+
encodeString(e) {
|
|
93
|
+
const t = f(e);
|
|
94
|
+
this.ensureBufferSizeToWrite(5 + t), this.writeStringHeader(t), w(e, this.bytes, this.pos), this.pos += t;
|
|
95
|
+
}
|
|
96
|
+
encodeObject(e, i) {
|
|
97
|
+
const t = this.extensionCodec.tryToEncode(e, this.context);
|
|
98
|
+
if (t != null)
|
|
99
|
+
this.encodeExtension(t);
|
|
100
|
+
else if (Array.isArray(e))
|
|
101
|
+
this.encodeArray(e, i);
|
|
102
|
+
else if (ArrayBuffer.isView(e))
|
|
103
|
+
this.encodeBinary(e);
|
|
104
|
+
else if (typeof e == "object")
|
|
105
|
+
this.encodeMap(e, i);
|
|
106
|
+
else
|
|
107
|
+
throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`);
|
|
108
|
+
}
|
|
109
|
+
encodeBinary(e) {
|
|
110
|
+
const i = e.byteLength;
|
|
111
|
+
if (i < 256)
|
|
112
|
+
this.writeU8(196), this.writeU8(i);
|
|
113
|
+
else if (i < 65536)
|
|
114
|
+
this.writeU8(197), this.writeU16(i);
|
|
115
|
+
else if (i < 4294967296)
|
|
116
|
+
this.writeU8(198), this.writeU32(i);
|
|
117
|
+
else
|
|
118
|
+
throw new Error(`Too large binary: ${i}`);
|
|
119
|
+
const t = d(e);
|
|
120
|
+
this.writeU8a(t);
|
|
121
|
+
}
|
|
122
|
+
encodeArray(e, i) {
|
|
123
|
+
const t = e.length;
|
|
124
|
+
if (t < 16)
|
|
125
|
+
this.writeU8(144 + t);
|
|
126
|
+
else if (t < 65536)
|
|
127
|
+
this.writeU8(220), this.writeU16(t);
|
|
128
|
+
else if (t < 4294967296)
|
|
129
|
+
this.writeU8(221), this.writeU32(t);
|
|
130
|
+
else
|
|
131
|
+
throw new Error(`Too large array: ${t}`);
|
|
132
|
+
for (const s of e)
|
|
133
|
+
this.doEncode(s, i + 1);
|
|
134
|
+
}
|
|
135
|
+
countWithoutUndefined(e, i) {
|
|
136
|
+
let t = 0;
|
|
137
|
+
for (const s of i)
|
|
138
|
+
e[s] !== void 0 && t++;
|
|
139
|
+
return t;
|
|
140
|
+
}
|
|
141
|
+
encodeMap(e, i) {
|
|
142
|
+
const t = Object.keys(e);
|
|
143
|
+
this.sortKeys && t.sort();
|
|
144
|
+
const s = this.ignoreUndefined ? this.countWithoutUndefined(e, t) : t.length;
|
|
145
|
+
if (s < 16)
|
|
146
|
+
this.writeU8(128 + s);
|
|
147
|
+
else if (s < 65536)
|
|
148
|
+
this.writeU8(222), this.writeU16(s);
|
|
149
|
+
else if (s < 4294967296)
|
|
150
|
+
this.writeU8(223), this.writeU32(s);
|
|
151
|
+
else
|
|
152
|
+
throw new Error(`Too large map object: ${s}`);
|
|
153
|
+
for (const r of t) {
|
|
154
|
+
const h = e[r];
|
|
155
|
+
this.ignoreUndefined && h === void 0 || (this.encodeString(r), this.doEncode(h, i + 1));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
encodeExtension(e) {
|
|
159
|
+
if (typeof e.data == "function") {
|
|
160
|
+
const t = e.data(this.pos + 6), s = t.length;
|
|
161
|
+
if (s >= 4294967296)
|
|
162
|
+
throw new Error(`Too large extension object: ${s}`);
|
|
163
|
+
this.writeU8(201), this.writeU32(s), this.writeI8(e.type), this.writeU8a(t);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const i = e.data.length;
|
|
167
|
+
if (i === 1)
|
|
168
|
+
this.writeU8(212);
|
|
169
|
+
else if (i === 2)
|
|
170
|
+
this.writeU8(213);
|
|
171
|
+
else if (i === 4)
|
|
172
|
+
this.writeU8(214);
|
|
173
|
+
else if (i === 8)
|
|
174
|
+
this.writeU8(215);
|
|
175
|
+
else if (i === 16)
|
|
176
|
+
this.writeU8(216);
|
|
177
|
+
else if (i < 256)
|
|
178
|
+
this.writeU8(199), this.writeU8(i);
|
|
179
|
+
else if (i < 65536)
|
|
180
|
+
this.writeU8(200), this.writeU16(i);
|
|
181
|
+
else if (i < 4294967296)
|
|
182
|
+
this.writeU8(201), this.writeU32(i);
|
|
183
|
+
else
|
|
184
|
+
throw new Error(`Too large extension object: ${i}`);
|
|
185
|
+
this.writeI8(e.type), this.writeU8a(e.data);
|
|
186
|
+
}
|
|
187
|
+
writeU8(e) {
|
|
188
|
+
this.ensureBufferSizeToWrite(1), this.view.setUint8(this.pos, e), this.pos++;
|
|
189
|
+
}
|
|
190
|
+
writeU8a(e) {
|
|
191
|
+
const i = e.length;
|
|
192
|
+
this.ensureBufferSizeToWrite(i), this.bytes.set(e, this.pos), this.pos += i;
|
|
193
|
+
}
|
|
194
|
+
writeI8(e) {
|
|
195
|
+
this.ensureBufferSizeToWrite(1), this.view.setInt8(this.pos, e), this.pos++;
|
|
196
|
+
}
|
|
197
|
+
writeU16(e) {
|
|
198
|
+
this.ensureBufferSizeToWrite(2), this.view.setUint16(this.pos, e), this.pos += 2;
|
|
199
|
+
}
|
|
200
|
+
writeI16(e) {
|
|
201
|
+
this.ensureBufferSizeToWrite(2), this.view.setInt16(this.pos, e), this.pos += 2;
|
|
202
|
+
}
|
|
203
|
+
writeU32(e) {
|
|
204
|
+
this.ensureBufferSizeToWrite(4), this.view.setUint32(this.pos, e), this.pos += 4;
|
|
205
|
+
}
|
|
206
|
+
writeI32(e) {
|
|
207
|
+
this.ensureBufferSizeToWrite(4), this.view.setInt32(this.pos, e), this.pos += 4;
|
|
208
|
+
}
|
|
209
|
+
writeF32(e) {
|
|
210
|
+
this.ensureBufferSizeToWrite(4), this.view.setFloat32(this.pos, e), this.pos += 4;
|
|
211
|
+
}
|
|
212
|
+
writeF64(e) {
|
|
213
|
+
this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
|
|
214
|
+
}
|
|
215
|
+
writeU64(e) {
|
|
216
|
+
this.ensureBufferSizeToWrite(8), l(this.view, this.pos, e), this.pos += 8;
|
|
217
|
+
}
|
|
218
|
+
writeI64(e) {
|
|
219
|
+
this.ensureBufferSizeToWrite(8), a(this.view, this.pos, e), this.pos += 8;
|
|
220
|
+
}
|
|
221
|
+
writeBigUint64(e) {
|
|
222
|
+
this.ensureBufferSizeToWrite(8), this.view.setBigUint64(this.pos, e), this.pos += 8;
|
|
223
|
+
}
|
|
224
|
+
writeBigInt64(e) {
|
|
225
|
+
this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, e), this.pos += 8;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export {
|
|
229
|
+
u as DEFAULT_INITIAL_BUFFER_SIZE,
|
|
230
|
+
U as DEFAULT_MAX_DEPTH,
|
|
231
|
+
n as Encoder
|
|
232
|
+
};
|