@nika-js/onlymap 0.5.3 → 0.5.6
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 +16 -4
- package/THIRD-PARTY-LICENSES.md +93 -0
- package/dist/{Arrow.dom-BNjbQ9jb.js → Arrow.dom-BFGShwSA.js} +854 -1427
- package/dist/{LercDecode.es-S6KKhkuA.js → LercDecode.es-5mr_B7pP.js} +1 -1
- package/dist/{basemap-BSCq9hHZ.js → basemap-DJjFEgA9.js} +1 -1
- package/dist/builder-CqJZRFaq.js +580 -0
- package/dist/date-format.d.ts +18 -0
- package/dist/flatgeobuf-Cx0IwxhV.js +6332 -0
- package/dist/geoparquet-AL10HAyd.js +35 -0
- package/dist/geoparquet.d.ts +33 -0
- package/dist/{index-DfNGlG_k.js → index-BQaxwlV3.js} +1 -1
- package/dist/index-BYbMtNVH.js +2301 -0
- package/dist/{index-BTcRCrfX.js → index-BtPO4p2v.js} +2 -2
- package/dist/index-CgPV7QlM.js +4019 -0
- package/dist/{index-BCgjJcZn.js → index-DqE9di9E.js} +1 -1
- package/dist/{index-BoAq5XsU.js → index-G3hmIs2P.js} +11389 -11196
- package/dist/{index-D1swbykc.js → index-iwo3R3LT.js} +1 -1
- package/dist/{lerc-n0GaWEmL.js → lerc-Dx3uB2j-.js} +2 -2
- package/dist/onlymap.standalone.js +57118 -44241
- package/dist/onlymapjs.js +28 -28
- package/dist/{raster-DO-Ex2Lb.js → raster-BPn_dJpK.js} +2 -2
- package/dist/validation.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/llms.txt +6 -4
- package/onlymapjs.html-data.json +95 -61
- package/package.json +4 -1
- package/skills/onlymapjs/SKILL.md +3 -1
- package/skills/onlymapjs/references/syntax.md +101 -18
- package/skills/onlymapjs/references/testing.md +11 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-
|
|
1
|
+
import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-G3hmIs2P.js";
|
|
2
2
|
const Cd = Math.PI / 180, gy = 180 / Math.PI;
|
|
3
3
|
function em(Pe, Q = 0) {
|
|
4
4
|
const me = Math.min(180, Pe) * Cd;
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
const p = 4, n = new Int32Array(2), I = new Float32Array(n.buffer), _ = new Float64Array(n.buffer), c = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
|
|
2
|
+
var l;
|
|
3
|
+
(function(a) {
|
|
4
|
+
a[a.UTF8_BYTES = 1] = "UTF8_BYTES", a[a.UTF16_STRING = 2] = "UTF16_STRING";
|
|
5
|
+
})(l || (l = {}));
|
|
6
|
+
class b {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
|
|
9
|
+
*/
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this.bytes_ = t, this.position_ = 0, this.text_decoder_ = new TextDecoder();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create and allocate a new ByteBuffer with a given size.
|
|
15
|
+
*/
|
|
16
|
+
static allocate(t) {
|
|
17
|
+
return new b(new Uint8Array(t));
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.position_ = 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the underlying `Uint8Array`.
|
|
24
|
+
*/
|
|
25
|
+
bytes() {
|
|
26
|
+
return this.bytes_;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the buffer's position.
|
|
30
|
+
*/
|
|
31
|
+
position() {
|
|
32
|
+
return this.position_;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Set the buffer's position.
|
|
36
|
+
*/
|
|
37
|
+
setPosition(t) {
|
|
38
|
+
this.position_ = t;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the buffer's capacity.
|
|
42
|
+
*/
|
|
43
|
+
capacity() {
|
|
44
|
+
return this.bytes_.length;
|
|
45
|
+
}
|
|
46
|
+
readInt8(t) {
|
|
47
|
+
return this.readUint8(t) << 24 >> 24;
|
|
48
|
+
}
|
|
49
|
+
readUint8(t) {
|
|
50
|
+
return this.bytes_[t];
|
|
51
|
+
}
|
|
52
|
+
readInt16(t) {
|
|
53
|
+
return this.readUint16(t) << 16 >> 16;
|
|
54
|
+
}
|
|
55
|
+
readUint16(t) {
|
|
56
|
+
return this.bytes_[t] | this.bytes_[t + 1] << 8;
|
|
57
|
+
}
|
|
58
|
+
readInt32(t) {
|
|
59
|
+
return this.bytes_[t] | this.bytes_[t + 1] << 8 | this.bytes_[t + 2] << 16 | this.bytes_[t + 3] << 24;
|
|
60
|
+
}
|
|
61
|
+
readUint32(t) {
|
|
62
|
+
return this.readInt32(t) >>> 0;
|
|
63
|
+
}
|
|
64
|
+
readInt64(t) {
|
|
65
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(t)) + (BigInt(this.readUint32(t + 4)) << BigInt(32)));
|
|
66
|
+
}
|
|
67
|
+
readUint64(t) {
|
|
68
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(t)) + (BigInt(this.readUint32(t + 4)) << BigInt(32)));
|
|
69
|
+
}
|
|
70
|
+
readFloat32(t) {
|
|
71
|
+
return n[0] = this.readInt32(t), I[0];
|
|
72
|
+
}
|
|
73
|
+
readFloat64(t) {
|
|
74
|
+
return n[c ? 0 : 1] = this.readInt32(t), n[c ? 1 : 0] = this.readInt32(t + 4), _[0];
|
|
75
|
+
}
|
|
76
|
+
writeInt8(t, i) {
|
|
77
|
+
this.bytes_[t] = i;
|
|
78
|
+
}
|
|
79
|
+
writeUint8(t, i) {
|
|
80
|
+
this.bytes_[t] = i;
|
|
81
|
+
}
|
|
82
|
+
writeInt16(t, i) {
|
|
83
|
+
this.bytes_[t] = i, this.bytes_[t + 1] = i >> 8;
|
|
84
|
+
}
|
|
85
|
+
writeUint16(t, i) {
|
|
86
|
+
this.bytes_[t] = i, this.bytes_[t + 1] = i >> 8;
|
|
87
|
+
}
|
|
88
|
+
writeInt32(t, i) {
|
|
89
|
+
this.bytes_[t] = i, this.bytes_[t + 1] = i >> 8, this.bytes_[t + 2] = i >> 16, this.bytes_[t + 3] = i >> 24;
|
|
90
|
+
}
|
|
91
|
+
writeUint32(t, i) {
|
|
92
|
+
this.bytes_[t] = i, this.bytes_[t + 1] = i >> 8, this.bytes_[t + 2] = i >> 16, this.bytes_[t + 3] = i >> 24;
|
|
93
|
+
}
|
|
94
|
+
writeInt64(t, i) {
|
|
95
|
+
this.writeInt32(t, Number(BigInt.asIntN(32, i))), this.writeInt32(t + 4, Number(BigInt.asIntN(32, i >> BigInt(32))));
|
|
96
|
+
}
|
|
97
|
+
writeUint64(t, i) {
|
|
98
|
+
this.writeUint32(t, Number(BigInt.asUintN(32, i))), this.writeUint32(t + 4, Number(BigInt.asUintN(32, i >> BigInt(32))));
|
|
99
|
+
}
|
|
100
|
+
writeFloat32(t, i) {
|
|
101
|
+
I[0] = i, this.writeInt32(t, n[0]);
|
|
102
|
+
}
|
|
103
|
+
writeFloat64(t, i) {
|
|
104
|
+
_[0] = i, this.writeInt32(t, n[c ? 0 : 1]), this.writeInt32(t + 4, n[c ? 1 : 0]);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Return the file identifier. Behavior is undefined for FlatBuffers whose
|
|
108
|
+
* schema does not include a file_identifier (likely points at padding or the
|
|
109
|
+
* start of a the root vtable).
|
|
110
|
+
*/
|
|
111
|
+
getBufferIdentifier() {
|
|
112
|
+
if (this.bytes_.length < this.position_ + 4 + 4)
|
|
113
|
+
throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
|
|
114
|
+
let t = "";
|
|
115
|
+
for (let i = 0; i < 4; i++)
|
|
116
|
+
t += String.fromCharCode(this.readInt8(this.position_ + 4 + i));
|
|
117
|
+
return t;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Look up a field in the vtable, return an offset into the object, or 0 if the
|
|
121
|
+
* field is not present.
|
|
122
|
+
*/
|
|
123
|
+
__offset(t, i) {
|
|
124
|
+
const e = t - this.readInt32(t);
|
|
125
|
+
return i < this.readInt16(e) ? this.readInt16(e + i) : 0;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Initialize any Table-derived type to point to the union at the given offset.
|
|
129
|
+
*/
|
|
130
|
+
__union(t, i) {
|
|
131
|
+
return t.bb_pos = i + this.readInt32(i), t.bb = this, t;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
|
|
135
|
+
* This allocates a new string and converts to wide chars upon each access.
|
|
136
|
+
*
|
|
137
|
+
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
|
|
138
|
+
* "optionalEncoding" argument. This is useful for avoiding conversion when
|
|
139
|
+
* the data will just be packaged back up in another FlatBuffer later on.
|
|
140
|
+
*
|
|
141
|
+
* @param offset
|
|
142
|
+
* @param opt_encoding Defaults to UTF16_STRING
|
|
143
|
+
*/
|
|
144
|
+
__string(t, i) {
|
|
145
|
+
t += this.readInt32(t);
|
|
146
|
+
const e = this.readInt32(t);
|
|
147
|
+
t += 4;
|
|
148
|
+
const s = this.bytes_.subarray(t, t + e);
|
|
149
|
+
return i === l.UTF8_BYTES ? s : this.text_decoder_.decode(s);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
|
|
153
|
+
* if a string then return a new one
|
|
154
|
+
*
|
|
155
|
+
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
|
|
156
|
+
* makes the behaviour of __union_with_string different compared to __union
|
|
157
|
+
*/
|
|
158
|
+
__union_with_string(t, i) {
|
|
159
|
+
return typeof t == "string" ? this.__string(i) : this.__union(t, i);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Retrieve the relative offset stored at "offset"
|
|
163
|
+
*/
|
|
164
|
+
__indirect(t) {
|
|
165
|
+
return t + this.readInt32(t);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the start of data of a vector whose offset is stored at "offset" in this object.
|
|
169
|
+
*/
|
|
170
|
+
__vector(t) {
|
|
171
|
+
return t + this.readInt32(t) + 4;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get the length of a vector whose offset is stored at "offset" in this object.
|
|
175
|
+
*/
|
|
176
|
+
__vector_len(t) {
|
|
177
|
+
return this.readInt32(t + this.readInt32(t));
|
|
178
|
+
}
|
|
179
|
+
__has_identifier(t) {
|
|
180
|
+
if (t.length != 4)
|
|
181
|
+
throw new Error("FlatBuffers: file identifier must be length 4");
|
|
182
|
+
for (let i = 0; i < 4; i++)
|
|
183
|
+
if (t.charCodeAt(i) != this.readInt8(this.position() + 4 + i))
|
|
184
|
+
return !1;
|
|
185
|
+
return !0;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A helper function for generating list for obj api
|
|
189
|
+
*/
|
|
190
|
+
createScalarList(t, i) {
|
|
191
|
+
const e = [];
|
|
192
|
+
for (let s = 0; s < i; ++s) {
|
|
193
|
+
const r = t(s);
|
|
194
|
+
r !== null && e.push(r);
|
|
195
|
+
}
|
|
196
|
+
return e;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A helper function for generating list for obj api
|
|
200
|
+
* @param listAccessor function that accepts an index and return data at that index
|
|
201
|
+
* @param listLength listLength
|
|
202
|
+
* @param res result list
|
|
203
|
+
*/
|
|
204
|
+
createObjList(t, i) {
|
|
205
|
+
const e = [];
|
|
206
|
+
for (let s = 0; s < i; ++s) {
|
|
207
|
+
const r = t(s);
|
|
208
|
+
r !== null && e.push(r.unpack());
|
|
209
|
+
}
|
|
210
|
+
return e;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
class f {
|
|
214
|
+
/**
|
|
215
|
+
* Create a FlatBufferBuilder.
|
|
216
|
+
*/
|
|
217
|
+
constructor(t) {
|
|
218
|
+
this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1, this.string_maps = null, this.text_encoder = new TextEncoder();
|
|
219
|
+
let i;
|
|
220
|
+
t ? i = t : i = 1024, this.bb = b.allocate(i), this.space = i;
|
|
221
|
+
}
|
|
222
|
+
clear() {
|
|
223
|
+
this.bb.clear(), this.space = this.bb.capacity(), this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1, this.string_maps = null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* In order to save space, fields that are set to their default value
|
|
227
|
+
* don't get serialized into the buffer. Forcing defaults provides a
|
|
228
|
+
* way to manually disable this optimization.
|
|
229
|
+
*
|
|
230
|
+
* @param forceDefaults true always serializes default values
|
|
231
|
+
*/
|
|
232
|
+
forceDefaults(t) {
|
|
233
|
+
this.force_defaults = t;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
|
237
|
+
* called finish(). The actual data starts at the ByteBuffer's current position,
|
|
238
|
+
* not necessarily at 0.
|
|
239
|
+
*/
|
|
240
|
+
dataBuffer() {
|
|
241
|
+
return this.bb;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get the bytes representing the FlatBuffer. Only call this after you've
|
|
245
|
+
* called finish().
|
|
246
|
+
*/
|
|
247
|
+
asUint8Array() {
|
|
248
|
+
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Prepare to write an element of `size` after `additional_bytes` have been
|
|
252
|
+
* written, e.g. if you write a string, you need to align such the int length
|
|
253
|
+
* field is aligned to 4 bytes, and the string data follows it directly. If all
|
|
254
|
+
* you need to do is alignment, `additional_bytes` will be 0.
|
|
255
|
+
*
|
|
256
|
+
* @param size This is the of the new element to write
|
|
257
|
+
* @param additional_bytes The padding size
|
|
258
|
+
*/
|
|
259
|
+
prep(t, i) {
|
|
260
|
+
t > this.minalign && (this.minalign = t);
|
|
261
|
+
const e = ~(this.bb.capacity() - this.space + i) + 1 & t - 1;
|
|
262
|
+
for (; this.space < e + t + i; ) {
|
|
263
|
+
const s = this.bb.capacity();
|
|
264
|
+
this.bb = f.growByteBuffer(this.bb), this.space += this.bb.capacity() - s;
|
|
265
|
+
}
|
|
266
|
+
this.pad(e);
|
|
267
|
+
}
|
|
268
|
+
pad(t) {
|
|
269
|
+
for (let i = 0; i < t; i++)
|
|
270
|
+
this.bb.writeInt8(--this.space, 0);
|
|
271
|
+
}
|
|
272
|
+
writeInt8(t) {
|
|
273
|
+
this.bb.writeInt8(this.space -= 1, t);
|
|
274
|
+
}
|
|
275
|
+
writeInt16(t) {
|
|
276
|
+
this.bb.writeInt16(this.space -= 2, t);
|
|
277
|
+
}
|
|
278
|
+
writeInt32(t) {
|
|
279
|
+
this.bb.writeInt32(this.space -= 4, t);
|
|
280
|
+
}
|
|
281
|
+
writeInt64(t) {
|
|
282
|
+
this.bb.writeInt64(this.space -= 8, t);
|
|
283
|
+
}
|
|
284
|
+
writeFloat32(t) {
|
|
285
|
+
this.bb.writeFloat32(this.space -= 4, t);
|
|
286
|
+
}
|
|
287
|
+
writeFloat64(t) {
|
|
288
|
+
this.bb.writeFloat64(this.space -= 8, t);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
292
|
+
* @param value The `int8` to add the buffer.
|
|
293
|
+
*/
|
|
294
|
+
addInt8(t) {
|
|
295
|
+
this.prep(1, 0), this.writeInt8(t);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
299
|
+
* @param value The `int16` to add the buffer.
|
|
300
|
+
*/
|
|
301
|
+
addInt16(t) {
|
|
302
|
+
this.prep(2, 0), this.writeInt16(t);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
306
|
+
* @param value The `int32` to add the buffer.
|
|
307
|
+
*/
|
|
308
|
+
addInt32(t) {
|
|
309
|
+
this.prep(4, 0), this.writeInt32(t);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
313
|
+
* @param value The `int64` to add the buffer.
|
|
314
|
+
*/
|
|
315
|
+
addInt64(t) {
|
|
316
|
+
this.prep(8, 0), this.writeInt64(t);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
320
|
+
* @param value The `float32` to add the buffer.
|
|
321
|
+
*/
|
|
322
|
+
addFloat32(t) {
|
|
323
|
+
this.prep(4, 0), this.writeFloat32(t);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
327
|
+
* @param value The `float64` to add the buffer.
|
|
328
|
+
*/
|
|
329
|
+
addFloat64(t) {
|
|
330
|
+
this.prep(8, 0), this.writeFloat64(t);
|
|
331
|
+
}
|
|
332
|
+
addFieldInt8(t, i, e) {
|
|
333
|
+
(this.force_defaults || i != e) && (this.addInt8(i), this.slot(t));
|
|
334
|
+
}
|
|
335
|
+
addFieldInt16(t, i, e) {
|
|
336
|
+
(this.force_defaults || i != e) && (this.addInt16(i), this.slot(t));
|
|
337
|
+
}
|
|
338
|
+
addFieldInt32(t, i, e) {
|
|
339
|
+
(this.force_defaults || i != e) && (this.addInt32(i), this.slot(t));
|
|
340
|
+
}
|
|
341
|
+
addFieldInt64(t, i, e) {
|
|
342
|
+
(this.force_defaults || i !== e) && (this.addInt64(i), this.slot(t));
|
|
343
|
+
}
|
|
344
|
+
addFieldFloat32(t, i, e) {
|
|
345
|
+
(this.force_defaults || i != e) && (this.addFloat32(i), this.slot(t));
|
|
346
|
+
}
|
|
347
|
+
addFieldFloat64(t, i, e) {
|
|
348
|
+
(this.force_defaults || i != e) && (this.addFloat64(i), this.slot(t));
|
|
349
|
+
}
|
|
350
|
+
addFieldOffset(t, i, e) {
|
|
351
|
+
(this.force_defaults || i != e) && (this.addOffset(i), this.slot(t));
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Structs are stored inline, so nothing additional is being added. `d` is always 0.
|
|
355
|
+
*/
|
|
356
|
+
addFieldStruct(t, i, e) {
|
|
357
|
+
i != e && (this.nested(i), this.slot(t));
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Structures are always stored inline, they need to be created right
|
|
361
|
+
* where they're used. You'll get this assertion failure if you
|
|
362
|
+
* created it elsewhere.
|
|
363
|
+
*/
|
|
364
|
+
nested(t) {
|
|
365
|
+
if (t != this.offset())
|
|
366
|
+
throw new TypeError("FlatBuffers: struct must be serialized inline.");
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Should not be creating any other object, string or vector
|
|
370
|
+
* while an object is being constructed
|
|
371
|
+
*/
|
|
372
|
+
notNested() {
|
|
373
|
+
if (this.isNested)
|
|
374
|
+
throw new TypeError("FlatBuffers: object serialization must not be nested.");
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Set the current vtable at `voffset` to the current location in the buffer.
|
|
378
|
+
*/
|
|
379
|
+
slot(t) {
|
|
380
|
+
this.vtable !== null && (this.vtable[t] = this.offset());
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* @returns Offset relative to the end of the buffer.
|
|
384
|
+
*/
|
|
385
|
+
offset() {
|
|
386
|
+
return this.bb.capacity() - this.space;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Doubles the size of the backing ByteBuffer and copies the old data towards
|
|
390
|
+
* the end of the new buffer (since we build the buffer backwards).
|
|
391
|
+
*
|
|
392
|
+
* @param bb The current buffer with the existing data
|
|
393
|
+
* @returns A new byte buffer with the old data copied
|
|
394
|
+
* to it. The data is located at the end of the buffer.
|
|
395
|
+
*
|
|
396
|
+
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
|
|
397
|
+
* it a uint8Array we need to suppress the type check:
|
|
398
|
+
* @suppress {checkTypes}
|
|
399
|
+
*/
|
|
400
|
+
static growByteBuffer(t) {
|
|
401
|
+
const i = t.capacity();
|
|
402
|
+
if (i & 3221225472)
|
|
403
|
+
throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
|
404
|
+
const e = i << 1, s = b.allocate(e);
|
|
405
|
+
return s.setPosition(e - i), s.bytes().set(t.bytes(), e - i), s;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Adds on offset, relative to where it will be written.
|
|
409
|
+
*
|
|
410
|
+
* @param offset The offset to add.
|
|
411
|
+
*/
|
|
412
|
+
addOffset(t) {
|
|
413
|
+
this.prep(4, 0), this.writeInt32(this.offset() - t + 4);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Start encoding a new object in the buffer. Users will not usually need to
|
|
417
|
+
* call this directly. The FlatBuffers compiler will generate helper methods
|
|
418
|
+
* that call this method internally.
|
|
419
|
+
*/
|
|
420
|
+
startObject(t) {
|
|
421
|
+
this.notNested(), this.vtable == null && (this.vtable = []), this.vtable_in_use = t;
|
|
422
|
+
for (let i = 0; i < t; i++)
|
|
423
|
+
this.vtable[i] = 0;
|
|
424
|
+
this.isNested = !0, this.object_start = this.offset();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Finish off writing the object that is under construction.
|
|
428
|
+
*
|
|
429
|
+
* @returns The offset to the object inside `dataBuffer`
|
|
430
|
+
*/
|
|
431
|
+
endObject() {
|
|
432
|
+
if (this.vtable == null || !this.isNested)
|
|
433
|
+
throw new Error("FlatBuffers: endObject called without startObject");
|
|
434
|
+
this.addInt32(0);
|
|
435
|
+
const t = this.offset();
|
|
436
|
+
let i = this.vtable_in_use - 1;
|
|
437
|
+
for (; i >= 0 && this.vtable[i] == 0; i--)
|
|
438
|
+
;
|
|
439
|
+
const e = i + 1;
|
|
440
|
+
for (; i >= 0; i--)
|
|
441
|
+
this.addInt16(this.vtable[i] != 0 ? t - this.vtable[i] : 0);
|
|
442
|
+
const s = 2;
|
|
443
|
+
this.addInt16(t - this.object_start);
|
|
444
|
+
const r = (e + s) * 2;
|
|
445
|
+
this.addInt16(r);
|
|
446
|
+
let h = 0;
|
|
447
|
+
const u = this.space;
|
|
448
|
+
t: for (i = 0; i < this.vtables.length; i++) {
|
|
449
|
+
const d = this.bb.capacity() - this.vtables[i];
|
|
450
|
+
if (r == this.bb.readInt16(d)) {
|
|
451
|
+
for (let o = 2; o < r; o += 2)
|
|
452
|
+
if (this.bb.readInt16(u + o) != this.bb.readInt16(d + o))
|
|
453
|
+
continue t;
|
|
454
|
+
h = this.vtables[i];
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return h ? (this.space = this.bb.capacity() - t, this.bb.writeInt32(this.space, h - t)) : (this.vtables.push(this.offset()), this.bb.writeInt32(this.bb.capacity() - t, this.offset() - t)), this.isNested = !1, t;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Finalize a buffer, poiting to the given `root_table`.
|
|
462
|
+
*/
|
|
463
|
+
finish(t, i, e) {
|
|
464
|
+
const s = e ? 4 : 0;
|
|
465
|
+
if (i) {
|
|
466
|
+
const r = i;
|
|
467
|
+
if (this.prep(this.minalign, 8 + s), r.length != 4)
|
|
468
|
+
throw new TypeError("FlatBuffers: file identifier must be length 4");
|
|
469
|
+
for (let h = 3; h >= 0; h--)
|
|
470
|
+
this.writeInt8(r.charCodeAt(h));
|
|
471
|
+
}
|
|
472
|
+
this.prep(this.minalign, 4 + s), this.addOffset(t), s && this.addInt32(this.bb.capacity() - this.space), this.bb.setPosition(this.space);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Finalize a size prefixed buffer, pointing to the given `root_table`.
|
|
476
|
+
*/
|
|
477
|
+
finishSizePrefixed(t, i) {
|
|
478
|
+
this.finish(t, i, !0);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* This checks a required field has been set in a given table that has
|
|
482
|
+
* just been constructed.
|
|
483
|
+
*/
|
|
484
|
+
requiredField(t, i) {
|
|
485
|
+
const e = this.bb.capacity() - t, s = e - this.bb.readInt32(e);
|
|
486
|
+
if (!(i < this.bb.readInt16(s) && this.bb.readInt16(s + i) != 0))
|
|
487
|
+
throw new TypeError("FlatBuffers: field " + i + " must be set");
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Start a new array/vector of objects. Users usually will not call
|
|
491
|
+
* this directly. The FlatBuffers compiler will create a start/end
|
|
492
|
+
* method for vector types in generated code.
|
|
493
|
+
*
|
|
494
|
+
* @param elem_size The size of each element in the array
|
|
495
|
+
* @param num_elems The number of elements in the array
|
|
496
|
+
* @param alignment The alignment of the array
|
|
497
|
+
*/
|
|
498
|
+
startVector(t, i, e) {
|
|
499
|
+
this.notNested(), this.vector_num_elems = i, this.prep(4, t * i), this.prep(e, t * i);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Finish off the creation of an array and all its elements. The array must be
|
|
503
|
+
* created with `startVector`.
|
|
504
|
+
*
|
|
505
|
+
* @returns The offset at which the newly created array
|
|
506
|
+
* starts.
|
|
507
|
+
*/
|
|
508
|
+
endVector() {
|
|
509
|
+
return this.writeInt32(this.vector_num_elems), this.offset();
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Encode the string `s` in the buffer using UTF-8. If the string passed has
|
|
513
|
+
* already been seen, we return the offset of the already written string
|
|
514
|
+
*
|
|
515
|
+
* @param s The string to encode
|
|
516
|
+
* @return The offset in the buffer where the encoded string starts
|
|
517
|
+
*/
|
|
518
|
+
createSharedString(t) {
|
|
519
|
+
if (!t)
|
|
520
|
+
return 0;
|
|
521
|
+
if (this.string_maps || (this.string_maps = /* @__PURE__ */ new Map()), this.string_maps.has(t))
|
|
522
|
+
return this.string_maps.get(t);
|
|
523
|
+
const i = this.createString(t);
|
|
524
|
+
return this.string_maps.set(t, i), i;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
|
|
528
|
+
* instead of a string, it is assumed to contain valid UTF-8 encoded data.
|
|
529
|
+
*
|
|
530
|
+
* @param s The string to encode
|
|
531
|
+
* @return The offset in the buffer where the encoded string starts
|
|
532
|
+
*/
|
|
533
|
+
createString(t) {
|
|
534
|
+
if (t == null)
|
|
535
|
+
return 0;
|
|
536
|
+
let i;
|
|
537
|
+
return t instanceof Uint8Array ? i = t : i = this.text_encoder.encode(t), this.addInt8(0), this.startVector(1, i.length, 1), this.bb.setPosition(this.space -= i.length), this.bb.bytes().set(i, this.space), this.endVector();
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Create a byte vector.
|
|
541
|
+
*
|
|
542
|
+
* @param v The bytes to add
|
|
543
|
+
* @returns The offset in the buffer where the byte vector starts
|
|
544
|
+
*/
|
|
545
|
+
createByteVector(t) {
|
|
546
|
+
return t == null ? 0 : (this.startVector(1, t.length, 1), this.bb.setPosition(this.space -= t.length), this.bb.bytes().set(t, this.space), this.endVector());
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* A helper function to pack an object
|
|
550
|
+
*
|
|
551
|
+
* @returns offset of obj
|
|
552
|
+
*/
|
|
553
|
+
createObjectOffset(t) {
|
|
554
|
+
return t === null ? 0 : typeof t == "string" ? this.createString(t) : t.pack(this);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* A helper function to pack a list of object
|
|
558
|
+
*
|
|
559
|
+
* @returns list of offsets of each non null object
|
|
560
|
+
*/
|
|
561
|
+
createObjectOffsetList(t) {
|
|
562
|
+
const i = [];
|
|
563
|
+
for (let e = 0; e < t.length; ++e) {
|
|
564
|
+
const s = t[e];
|
|
565
|
+
if (s !== null)
|
|
566
|
+
i.push(this.createObjectOffset(s));
|
|
567
|
+
else
|
|
568
|
+
throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");
|
|
569
|
+
}
|
|
570
|
+
return i;
|
|
571
|
+
}
|
|
572
|
+
createStructOffsetList(t, i) {
|
|
573
|
+
return i(this, t.length), this.createObjectOffsetList(t.slice().reverse()), this.endVector();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
export {
|
|
577
|
+
b as B,
|
|
578
|
+
p as S,
|
|
579
|
+
f as a
|
|
580
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date formatting shared by the accessor expression language and built-in
|
|
3
|
+
* widgets. The public surface is intentionally small and deterministic:
|
|
4
|
+
* numeric values are epoch milliseconds, the default zone is UTC, and the
|
|
5
|
+
* locale is fixed so authored maps and snapshots do not vary by viewer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DATE_FORMAT_STYLES: readonly ["date", "datetime", "time", "iso"];
|
|
8
|
+
export type DateFormatStyle = (typeof DATE_FORMAT_STYLES)[number];
|
|
9
|
+
export declare function isDateFormatStyle(value: string): value is DateFormatStyle;
|
|
10
|
+
/** `local` is the explicit opt-in to the viewer's local time zone. */
|
|
11
|
+
export declare function isValidTimeZone(value: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Format an epoch-millisecond number or ISO date string.
|
|
14
|
+
*
|
|
15
|
+
* Invalid values, styles, and time zones return an empty string so one bad
|
|
16
|
+
* datum cannot crash a deck.gl accessor or widget reconciliation pass.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatDate(value: unknown, style?: DateFormatStyle | string, timeZone?: string): string;
|