@loaders.gl/flatgeobuf 3.1.0-beta.5 → 3.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/dist/bundle.js +5 -4346
- package/dist/dist.min.js +9452 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/flatgeobuf-loader.js +3 -3
- package/dist/es5/flatgeobuf-loader.js.map +1 -1
- package/dist/es5/index.js +39 -9
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/binary-geometries.js +156 -0
- package/dist/es5/lib/binary-geometries.js.map +1 -0
- package/dist/es5/lib/parse-flatgeobuf.js +212 -9
- package/dist/es5/lib/parse-flatgeobuf.js.map +1 -1
- package/dist/esm/flatgeobuf-loader.js +1 -1
- package/dist/esm/flatgeobuf-loader.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/binary-geometries.js +144 -0
- package/dist/esm/lib/binary-geometries.js.map +1 -0
- package/dist/esm/lib/parse-flatgeobuf.js +99 -6
- package/dist/esm/lib/parse-flatgeobuf.js.map +1 -1
- package/dist/flatgeobuf-worker.js +8706 -4237
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -22
- package/dist/lib/binary-geometries.d.ts +20 -0
- package/dist/lib/binary-geometries.d.ts.map +1 -0
- package/dist/lib/binary-geometries.js +120 -0
- package/dist/lib/parse-flatgeobuf.d.ts +2 -2
- package/dist/lib/parse-flatgeobuf.d.ts.map +1 -1
- package/dist/lib/parse-flatgeobuf.js +95 -12
- package/package.json +7 -8
- package/src/index.ts +1 -1
- package/src/lib/binary-geometries.ts +144 -0
- package/src/lib/parse-flatgeobuf.ts +112 -9
package/dist/bundle.js
CHANGED
|
@@ -1,4346 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
9
|
-
var __esm = (fn, res) => function __init() {
|
|
10
|
-
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
|
|
11
|
-
};
|
|
12
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
-
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
-
};
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
__markAsModule(target);
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, module, desc) => {
|
|
21
|
-
if (module && typeof module === "object" || typeof module === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(module))
|
|
23
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
24
|
-
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return target;
|
|
27
|
-
};
|
|
28
|
-
var __toModule = (module) => {
|
|
29
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// src/flatgeobuf-loader.ts
|
|
33
|
-
var VERSION, FlatGeobufLoader;
|
|
34
|
-
var init_flatgeobuf_loader = __esm({
|
|
35
|
-
"src/flatgeobuf-loader.ts"() {
|
|
36
|
-
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
37
|
-
FlatGeobufLoader = {
|
|
38
|
-
id: "flatgeobuf",
|
|
39
|
-
name: "FlatGeobuf",
|
|
40
|
-
module: "flatgeobuf",
|
|
41
|
-
version: VERSION,
|
|
42
|
-
worker: true,
|
|
43
|
-
extensions: ["fgb"],
|
|
44
|
-
mimeTypes: ["application/octet-stream"],
|
|
45
|
-
category: "geometry",
|
|
46
|
-
options: {
|
|
47
|
-
flatgeobuf: {}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// ../../node_modules/flatgeobuf/node_modules/web-streams-polyfill/dist/ponyfill.js
|
|
54
|
-
var require_ponyfill = __commonJS({
|
|
55
|
-
"../../node_modules/flatgeobuf/node_modules/web-streams-polyfill/dist/ponyfill.js"(exports, module) {
|
|
56
|
-
(function(global, factory) {
|
|
57
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = global || self, factory(global.WebStreamsPolyfill = {}));
|
|
58
|
-
})(exports, function(exports2) {
|
|
59
|
-
"use strict";
|
|
60
|
-
var SymbolPolyfill = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol : function(description) {
|
|
61
|
-
return "Symbol(" + description + ")";
|
|
62
|
-
};
|
|
63
|
-
function noop() {
|
|
64
|
-
}
|
|
65
|
-
var NumberIsNaN = Number.isNaN || function(x) {
|
|
66
|
-
return x !== x;
|
|
67
|
-
};
|
|
68
|
-
var rethrowAssertionErrorRejection = noop;
|
|
69
|
-
function typeIsObject(x) {
|
|
70
|
-
return typeof x === "object" && x !== null || typeof x === "function";
|
|
71
|
-
}
|
|
72
|
-
function createArrayFromList(elements) {
|
|
73
|
-
return elements.slice();
|
|
74
|
-
}
|
|
75
|
-
function ArrayBufferCopy(dest, destOffset, src, srcOffset, n) {
|
|
76
|
-
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
77
|
-
}
|
|
78
|
-
function IsFiniteNonNegativeNumber(v) {
|
|
79
|
-
if (IsNonNegativeNumber(v) === false) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
if (v === Infinity) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
function IsNonNegativeNumber(v) {
|
|
88
|
-
if (typeof v !== "number") {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
if (NumberIsNaN(v)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
if (v < 0) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
function Call(F, V, args) {
|
|
100
|
-
if (typeof F !== "function") {
|
|
101
|
-
throw new TypeError("Argument is not a function");
|
|
102
|
-
}
|
|
103
|
-
return Function.prototype.apply.call(F, V, args);
|
|
104
|
-
}
|
|
105
|
-
function CreateAlgorithmFromUnderlyingMethod(underlyingObject, methodName, algoArgCount, extraArgs) {
|
|
106
|
-
var method = underlyingObject[methodName];
|
|
107
|
-
if (method !== void 0) {
|
|
108
|
-
if (typeof method !== "function") {
|
|
109
|
-
throw new TypeError(method + " is not a method");
|
|
110
|
-
}
|
|
111
|
-
switch (algoArgCount) {
|
|
112
|
-
case 0: {
|
|
113
|
-
return function() {
|
|
114
|
-
return PromiseCall(method, underlyingObject, extraArgs);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
case 1: {
|
|
118
|
-
return function(arg) {
|
|
119
|
-
var fullArgs = [arg].concat(extraArgs);
|
|
120
|
-
return PromiseCall(method, underlyingObject, fullArgs);
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return function() {
|
|
126
|
-
return promiseResolvedWith(void 0);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function InvokeOrNoop(O, P, args) {
|
|
130
|
-
var method = O[P];
|
|
131
|
-
if (method === void 0) {
|
|
132
|
-
return void 0;
|
|
133
|
-
}
|
|
134
|
-
return Call(method, O, args);
|
|
135
|
-
}
|
|
136
|
-
function PromiseCall(F, V, args) {
|
|
137
|
-
try {
|
|
138
|
-
return promiseResolvedWith(Call(F, V, args));
|
|
139
|
-
} catch (value) {
|
|
140
|
-
return promiseRejectedWith(value);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function TransferArrayBuffer(O) {
|
|
144
|
-
return O;
|
|
145
|
-
}
|
|
146
|
-
function IsDetachedBuffer(O) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
function ValidateAndNormalizeHighWaterMark(highWaterMark) {
|
|
150
|
-
highWaterMark = Number(highWaterMark);
|
|
151
|
-
if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {
|
|
152
|
-
throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");
|
|
153
|
-
}
|
|
154
|
-
return highWaterMark;
|
|
155
|
-
}
|
|
156
|
-
function MakeSizeAlgorithmFromSizeFunction(size) {
|
|
157
|
-
if (size === void 0) {
|
|
158
|
-
return function() {
|
|
159
|
-
return 1;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
if (typeof size !== "function") {
|
|
163
|
-
throw new TypeError("size property of a queuing strategy must be a function");
|
|
164
|
-
}
|
|
165
|
-
return function(chunk) {
|
|
166
|
-
return size(chunk);
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
var originalPromise = Promise;
|
|
170
|
-
var originalPromiseThen = Promise.prototype.then;
|
|
171
|
-
var originalPromiseResolve = Promise.resolve.bind(originalPromise);
|
|
172
|
-
var originalPromiseReject = Promise.reject.bind(originalPromise);
|
|
173
|
-
function newPromise(executor) {
|
|
174
|
-
return new originalPromise(executor);
|
|
175
|
-
}
|
|
176
|
-
function promiseResolvedWith(value) {
|
|
177
|
-
return originalPromiseResolve(value);
|
|
178
|
-
}
|
|
179
|
-
function promiseRejectedWith(reason) {
|
|
180
|
-
return originalPromiseReject(reason);
|
|
181
|
-
}
|
|
182
|
-
function PerformPromiseThen(promise, onFulfilled, onRejected) {
|
|
183
|
-
return originalPromiseThen.call(promise, onFulfilled, onRejected);
|
|
184
|
-
}
|
|
185
|
-
function uponPromise(promise, onFulfilled, onRejected) {
|
|
186
|
-
PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), void 0, rethrowAssertionErrorRejection);
|
|
187
|
-
}
|
|
188
|
-
function uponFulfillment(promise, onFulfilled) {
|
|
189
|
-
uponPromise(promise, onFulfilled);
|
|
190
|
-
}
|
|
191
|
-
function uponRejection(promise, onRejected) {
|
|
192
|
-
uponPromise(promise, void 0, onRejected);
|
|
193
|
-
}
|
|
194
|
-
function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
|
|
195
|
-
return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);
|
|
196
|
-
}
|
|
197
|
-
function setPromiseIsHandledToTrue(promise) {
|
|
198
|
-
PerformPromiseThen(promise, void 0, rethrowAssertionErrorRejection);
|
|
199
|
-
}
|
|
200
|
-
var QUEUE_MAX_ARRAY_SIZE = 16384;
|
|
201
|
-
var SimpleQueue = function() {
|
|
202
|
-
function SimpleQueue2() {
|
|
203
|
-
this._cursor = 0;
|
|
204
|
-
this._size = 0;
|
|
205
|
-
this._front = {
|
|
206
|
-
_elements: [],
|
|
207
|
-
_next: void 0
|
|
208
|
-
};
|
|
209
|
-
this._back = this._front;
|
|
210
|
-
this._cursor = 0;
|
|
211
|
-
this._size = 0;
|
|
212
|
-
}
|
|
213
|
-
Object.defineProperty(SimpleQueue2.prototype, "length", {
|
|
214
|
-
get: function() {
|
|
215
|
-
return this._size;
|
|
216
|
-
},
|
|
217
|
-
enumerable: true,
|
|
218
|
-
configurable: true
|
|
219
|
-
});
|
|
220
|
-
SimpleQueue2.prototype.push = function(element) {
|
|
221
|
-
var oldBack = this._back;
|
|
222
|
-
var newBack = oldBack;
|
|
223
|
-
if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {
|
|
224
|
-
newBack = {
|
|
225
|
-
_elements: [],
|
|
226
|
-
_next: void 0
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
oldBack._elements.push(element);
|
|
230
|
-
if (newBack !== oldBack) {
|
|
231
|
-
this._back = newBack;
|
|
232
|
-
oldBack._next = newBack;
|
|
233
|
-
}
|
|
234
|
-
++this._size;
|
|
235
|
-
};
|
|
236
|
-
SimpleQueue2.prototype.shift = function() {
|
|
237
|
-
var oldFront = this._front;
|
|
238
|
-
var newFront = oldFront;
|
|
239
|
-
var oldCursor = this._cursor;
|
|
240
|
-
var newCursor = oldCursor + 1;
|
|
241
|
-
var elements = oldFront._elements;
|
|
242
|
-
var element = elements[oldCursor];
|
|
243
|
-
if (newCursor === QUEUE_MAX_ARRAY_SIZE) {
|
|
244
|
-
newFront = oldFront._next;
|
|
245
|
-
newCursor = 0;
|
|
246
|
-
}
|
|
247
|
-
--this._size;
|
|
248
|
-
this._cursor = newCursor;
|
|
249
|
-
if (oldFront !== newFront) {
|
|
250
|
-
this._front = newFront;
|
|
251
|
-
}
|
|
252
|
-
elements[oldCursor] = void 0;
|
|
253
|
-
return element;
|
|
254
|
-
};
|
|
255
|
-
SimpleQueue2.prototype.forEach = function(callback) {
|
|
256
|
-
var i = this._cursor;
|
|
257
|
-
var node = this._front;
|
|
258
|
-
var elements = node._elements;
|
|
259
|
-
while (i !== elements.length || node._next !== void 0) {
|
|
260
|
-
if (i === elements.length) {
|
|
261
|
-
node = node._next;
|
|
262
|
-
elements = node._elements;
|
|
263
|
-
i = 0;
|
|
264
|
-
if (elements.length === 0) {
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
callback(elements[i]);
|
|
269
|
-
++i;
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
SimpleQueue2.prototype.peek = function() {
|
|
273
|
-
var front = this._front;
|
|
274
|
-
var cursor = this._cursor;
|
|
275
|
-
return front._elements[cursor];
|
|
276
|
-
};
|
|
277
|
-
return SimpleQueue2;
|
|
278
|
-
}();
|
|
279
|
-
function ReadableStreamCreateReadResult(value, done, forAuthorCode) {
|
|
280
|
-
var prototype = null;
|
|
281
|
-
if (forAuthorCode === true) {
|
|
282
|
-
prototype = Object.prototype;
|
|
283
|
-
}
|
|
284
|
-
var obj = Object.create(prototype);
|
|
285
|
-
obj.value = value;
|
|
286
|
-
obj.done = done;
|
|
287
|
-
return obj;
|
|
288
|
-
}
|
|
289
|
-
function ReadableStreamReaderGenericInitialize(reader, stream) {
|
|
290
|
-
reader._forAuthorCode = true;
|
|
291
|
-
reader._ownerReadableStream = stream;
|
|
292
|
-
stream._reader = reader;
|
|
293
|
-
if (stream._state === "readable") {
|
|
294
|
-
defaultReaderClosedPromiseInitialize(reader);
|
|
295
|
-
} else if (stream._state === "closed") {
|
|
296
|
-
defaultReaderClosedPromiseInitializeAsResolved(reader);
|
|
297
|
-
} else {
|
|
298
|
-
defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function ReadableStreamReaderGenericCancel(reader, reason) {
|
|
302
|
-
var stream = reader._ownerReadableStream;
|
|
303
|
-
return ReadableStreamCancel(stream, reason);
|
|
304
|
-
}
|
|
305
|
-
function ReadableStreamReaderGenericRelease(reader) {
|
|
306
|
-
if (reader._ownerReadableStream._state === "readable") {
|
|
307
|
-
defaultReaderClosedPromiseReject(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
308
|
-
} else {
|
|
309
|
-
defaultReaderClosedPromiseResetToRejected(reader, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));
|
|
310
|
-
}
|
|
311
|
-
reader._ownerReadableStream._reader = void 0;
|
|
312
|
-
reader._ownerReadableStream = void 0;
|
|
313
|
-
}
|
|
314
|
-
function readerLockException(name) {
|
|
315
|
-
return new TypeError("Cannot " + name + " a stream using a released reader");
|
|
316
|
-
}
|
|
317
|
-
function defaultReaderClosedPromiseInitialize(reader) {
|
|
318
|
-
reader._closedPromise = newPromise(function(resolve, reject) {
|
|
319
|
-
reader._closedPromise_resolve = resolve;
|
|
320
|
-
reader._closedPromise_reject = reject;
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
|
|
324
|
-
defaultReaderClosedPromiseInitialize(reader);
|
|
325
|
-
defaultReaderClosedPromiseReject(reader, reason);
|
|
326
|
-
}
|
|
327
|
-
function defaultReaderClosedPromiseInitializeAsResolved(reader) {
|
|
328
|
-
defaultReaderClosedPromiseInitialize(reader);
|
|
329
|
-
defaultReaderClosedPromiseResolve(reader);
|
|
330
|
-
}
|
|
331
|
-
function defaultReaderClosedPromiseReject(reader, reason) {
|
|
332
|
-
setPromiseIsHandledToTrue(reader._closedPromise);
|
|
333
|
-
reader._closedPromise_reject(reason);
|
|
334
|
-
reader._closedPromise_resolve = void 0;
|
|
335
|
-
reader._closedPromise_reject = void 0;
|
|
336
|
-
}
|
|
337
|
-
function defaultReaderClosedPromiseResetToRejected(reader, reason) {
|
|
338
|
-
defaultReaderClosedPromiseInitializeAsRejected(reader, reason);
|
|
339
|
-
}
|
|
340
|
-
function defaultReaderClosedPromiseResolve(reader) {
|
|
341
|
-
reader._closedPromise_resolve(void 0);
|
|
342
|
-
reader._closedPromise_resolve = void 0;
|
|
343
|
-
reader._closedPromise_reject = void 0;
|
|
344
|
-
}
|
|
345
|
-
var CancelSteps = SymbolPolyfill("[[CancelSteps]]");
|
|
346
|
-
var PullSteps = SymbolPolyfill("[[PullSteps]]");
|
|
347
|
-
function AcquireReadableStreamDefaultReader(stream, forAuthorCode) {
|
|
348
|
-
if (forAuthorCode === void 0) {
|
|
349
|
-
forAuthorCode = false;
|
|
350
|
-
}
|
|
351
|
-
var reader = new ReadableStreamDefaultReader(stream);
|
|
352
|
-
reader._forAuthorCode = forAuthorCode;
|
|
353
|
-
return reader;
|
|
354
|
-
}
|
|
355
|
-
function ReadableStreamAddReadRequest(stream) {
|
|
356
|
-
var promise = newPromise(function(resolve, reject) {
|
|
357
|
-
var readRequest = {
|
|
358
|
-
_resolve: resolve,
|
|
359
|
-
_reject: reject
|
|
360
|
-
};
|
|
361
|
-
stream._reader._readRequests.push(readRequest);
|
|
362
|
-
});
|
|
363
|
-
return promise;
|
|
364
|
-
}
|
|
365
|
-
function ReadableStreamFulfillReadRequest(stream, chunk, done) {
|
|
366
|
-
var reader = stream._reader;
|
|
367
|
-
var readRequest = reader._readRequests.shift();
|
|
368
|
-
readRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
|
|
369
|
-
}
|
|
370
|
-
function ReadableStreamGetNumReadRequests(stream) {
|
|
371
|
-
return stream._reader._readRequests.length;
|
|
372
|
-
}
|
|
373
|
-
function ReadableStreamHasDefaultReader(stream) {
|
|
374
|
-
var reader = stream._reader;
|
|
375
|
-
if (reader === void 0) {
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
if (!IsReadableStreamDefaultReader(reader)) {
|
|
379
|
-
return false;
|
|
380
|
-
}
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
var ReadableStreamDefaultReader = function() {
|
|
384
|
-
function ReadableStreamDefaultReader2(stream) {
|
|
385
|
-
if (IsReadableStream(stream) === false) {
|
|
386
|
-
throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");
|
|
387
|
-
}
|
|
388
|
-
if (IsReadableStreamLocked(stream) === true) {
|
|
389
|
-
throw new TypeError("This stream has already been locked for exclusive reading by another reader");
|
|
390
|
-
}
|
|
391
|
-
ReadableStreamReaderGenericInitialize(this, stream);
|
|
392
|
-
this._readRequests = new SimpleQueue();
|
|
393
|
-
}
|
|
394
|
-
Object.defineProperty(ReadableStreamDefaultReader2.prototype, "closed", {
|
|
395
|
-
get: function() {
|
|
396
|
-
if (!IsReadableStreamDefaultReader(this)) {
|
|
397
|
-
return promiseRejectedWith(defaultReaderBrandCheckException("closed"));
|
|
398
|
-
}
|
|
399
|
-
return this._closedPromise;
|
|
400
|
-
},
|
|
401
|
-
enumerable: true,
|
|
402
|
-
configurable: true
|
|
403
|
-
});
|
|
404
|
-
ReadableStreamDefaultReader2.prototype.cancel = function(reason) {
|
|
405
|
-
if (!IsReadableStreamDefaultReader(this)) {
|
|
406
|
-
return promiseRejectedWith(defaultReaderBrandCheckException("cancel"));
|
|
407
|
-
}
|
|
408
|
-
if (this._ownerReadableStream === void 0) {
|
|
409
|
-
return promiseRejectedWith(readerLockException("cancel"));
|
|
410
|
-
}
|
|
411
|
-
return ReadableStreamReaderGenericCancel(this, reason);
|
|
412
|
-
};
|
|
413
|
-
ReadableStreamDefaultReader2.prototype.read = function() {
|
|
414
|
-
if (!IsReadableStreamDefaultReader(this)) {
|
|
415
|
-
return promiseRejectedWith(defaultReaderBrandCheckException("read"));
|
|
416
|
-
}
|
|
417
|
-
if (this._ownerReadableStream === void 0) {
|
|
418
|
-
return promiseRejectedWith(readerLockException("read from"));
|
|
419
|
-
}
|
|
420
|
-
return ReadableStreamDefaultReaderRead(this);
|
|
421
|
-
};
|
|
422
|
-
ReadableStreamDefaultReader2.prototype.releaseLock = function() {
|
|
423
|
-
if (!IsReadableStreamDefaultReader(this)) {
|
|
424
|
-
throw defaultReaderBrandCheckException("releaseLock");
|
|
425
|
-
}
|
|
426
|
-
if (this._ownerReadableStream === void 0) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (this._readRequests.length > 0) {
|
|
430
|
-
throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
|
|
431
|
-
}
|
|
432
|
-
ReadableStreamReaderGenericRelease(this);
|
|
433
|
-
};
|
|
434
|
-
return ReadableStreamDefaultReader2;
|
|
435
|
-
}();
|
|
436
|
-
function IsReadableStreamDefaultReader(x) {
|
|
437
|
-
if (!typeIsObject(x)) {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_readRequests")) {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
function ReadableStreamDefaultReaderRead(reader) {
|
|
446
|
-
var stream = reader._ownerReadableStream;
|
|
447
|
-
stream._disturbed = true;
|
|
448
|
-
if (stream._state === "closed") {
|
|
449
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(void 0, true, reader._forAuthorCode));
|
|
450
|
-
}
|
|
451
|
-
if (stream._state === "errored") {
|
|
452
|
-
return promiseRejectedWith(stream._storedError);
|
|
453
|
-
}
|
|
454
|
-
return stream._readableStreamController[PullSteps]();
|
|
455
|
-
}
|
|
456
|
-
function defaultReaderBrandCheckException(name) {
|
|
457
|
-
return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader");
|
|
458
|
-
}
|
|
459
|
-
var _a;
|
|
460
|
-
var AsyncIteratorPrototype;
|
|
461
|
-
if (typeof SymbolPolyfill.asyncIterator === "symbol") {
|
|
462
|
-
AsyncIteratorPrototype = (_a = {}, _a[SymbolPolyfill.asyncIterator] = function() {
|
|
463
|
-
return this;
|
|
464
|
-
}, _a);
|
|
465
|
-
Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false });
|
|
466
|
-
}
|
|
467
|
-
var ReadableStreamAsyncIteratorPrototype = {
|
|
468
|
-
next: function() {
|
|
469
|
-
if (IsReadableStreamAsyncIterator(this) === false) {
|
|
470
|
-
return promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"));
|
|
471
|
-
}
|
|
472
|
-
var reader = this._asyncIteratorReader;
|
|
473
|
-
if (reader._ownerReadableStream === void 0) {
|
|
474
|
-
return promiseRejectedWith(readerLockException("iterate"));
|
|
475
|
-
}
|
|
476
|
-
return transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function(result) {
|
|
477
|
-
var done = result.done;
|
|
478
|
-
if (done) {
|
|
479
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
480
|
-
}
|
|
481
|
-
var value = result.value;
|
|
482
|
-
return ReadableStreamCreateReadResult(value, done, true);
|
|
483
|
-
});
|
|
484
|
-
},
|
|
485
|
-
return: function(value) {
|
|
486
|
-
if (IsReadableStreamAsyncIterator(this) === false) {
|
|
487
|
-
return promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"));
|
|
488
|
-
}
|
|
489
|
-
var reader = this._asyncIteratorReader;
|
|
490
|
-
if (reader._ownerReadableStream === void 0) {
|
|
491
|
-
return promiseRejectedWith(readerLockException("finish iterating"));
|
|
492
|
-
}
|
|
493
|
-
if (reader._readRequests.length > 0) {
|
|
494
|
-
return promiseRejectedWith(new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled"));
|
|
495
|
-
}
|
|
496
|
-
if (this._preventCancel === false) {
|
|
497
|
-
var result = ReadableStreamReaderGenericCancel(reader, value);
|
|
498
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
499
|
-
return transformPromiseWith(result, function() {
|
|
500
|
-
return ReadableStreamCreateReadResult(value, true, true);
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
504
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(value, true, true));
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
if (AsyncIteratorPrototype !== void 0) {
|
|
508
|
-
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
509
|
-
}
|
|
510
|
-
Object.defineProperty(ReadableStreamAsyncIteratorPrototype, "next", { enumerable: false });
|
|
511
|
-
Object.defineProperty(ReadableStreamAsyncIteratorPrototype, "return", { enumerable: false });
|
|
512
|
-
function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
|
|
513
|
-
if (preventCancel === void 0) {
|
|
514
|
-
preventCancel = false;
|
|
515
|
-
}
|
|
516
|
-
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
517
|
-
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype);
|
|
518
|
-
iterator._asyncIteratorReader = reader;
|
|
519
|
-
iterator._preventCancel = Boolean(preventCancel);
|
|
520
|
-
return iterator;
|
|
521
|
-
}
|
|
522
|
-
function IsReadableStreamAsyncIterator(x) {
|
|
523
|
-
if (!typeIsObject(x)) {
|
|
524
|
-
return false;
|
|
525
|
-
}
|
|
526
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_asyncIteratorReader")) {
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
return true;
|
|
530
|
-
}
|
|
531
|
-
function streamAsyncIteratorBrandCheckException(name) {
|
|
532
|
-
return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator");
|
|
533
|
-
}
|
|
534
|
-
function DequeueValue(container) {
|
|
535
|
-
var pair = container._queue.shift();
|
|
536
|
-
container._queueTotalSize -= pair.size;
|
|
537
|
-
if (container._queueTotalSize < 0) {
|
|
538
|
-
container._queueTotalSize = 0;
|
|
539
|
-
}
|
|
540
|
-
return pair.value;
|
|
541
|
-
}
|
|
542
|
-
function EnqueueValueWithSize(container, value, size) {
|
|
543
|
-
size = Number(size);
|
|
544
|
-
if (!IsFiniteNonNegativeNumber(size)) {
|
|
545
|
-
throw new RangeError("Size must be a finite, non-NaN, non-negative number.");
|
|
546
|
-
}
|
|
547
|
-
container._queue.push({ value, size });
|
|
548
|
-
container._queueTotalSize += size;
|
|
549
|
-
}
|
|
550
|
-
function PeekQueueValue(container) {
|
|
551
|
-
var pair = container._queue.peek();
|
|
552
|
-
return pair.value;
|
|
553
|
-
}
|
|
554
|
-
function ResetQueue(container) {
|
|
555
|
-
container._queue = new SimpleQueue();
|
|
556
|
-
container._queueTotalSize = 0;
|
|
557
|
-
}
|
|
558
|
-
var AbortSteps = SymbolPolyfill("[[AbortSteps]]");
|
|
559
|
-
var ErrorSteps = SymbolPolyfill("[[ErrorSteps]]");
|
|
560
|
-
var WritableStream = function() {
|
|
561
|
-
function WritableStream2(underlyingSink, strategy) {
|
|
562
|
-
if (underlyingSink === void 0) {
|
|
563
|
-
underlyingSink = {};
|
|
564
|
-
}
|
|
565
|
-
if (strategy === void 0) {
|
|
566
|
-
strategy = {};
|
|
567
|
-
}
|
|
568
|
-
InitializeWritableStream(this);
|
|
569
|
-
var size = strategy.size;
|
|
570
|
-
var highWaterMark = strategy.highWaterMark;
|
|
571
|
-
var type = underlyingSink.type;
|
|
572
|
-
if (type !== void 0) {
|
|
573
|
-
throw new RangeError("Invalid type is specified");
|
|
574
|
-
}
|
|
575
|
-
var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
|
|
576
|
-
if (highWaterMark === void 0) {
|
|
577
|
-
highWaterMark = 1;
|
|
578
|
-
}
|
|
579
|
-
highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
|
|
580
|
-
SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);
|
|
581
|
-
}
|
|
582
|
-
Object.defineProperty(WritableStream2.prototype, "locked", {
|
|
583
|
-
get: function() {
|
|
584
|
-
if (IsWritableStream(this) === false) {
|
|
585
|
-
throw streamBrandCheckException("locked");
|
|
586
|
-
}
|
|
587
|
-
return IsWritableStreamLocked(this);
|
|
588
|
-
},
|
|
589
|
-
enumerable: true,
|
|
590
|
-
configurable: true
|
|
591
|
-
});
|
|
592
|
-
WritableStream2.prototype.abort = function(reason) {
|
|
593
|
-
if (IsWritableStream(this) === false) {
|
|
594
|
-
return promiseRejectedWith(streamBrandCheckException("abort"));
|
|
595
|
-
}
|
|
596
|
-
if (IsWritableStreamLocked(this) === true) {
|
|
597
|
-
return promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer"));
|
|
598
|
-
}
|
|
599
|
-
return WritableStreamAbort(this, reason);
|
|
600
|
-
};
|
|
601
|
-
WritableStream2.prototype.close = function() {
|
|
602
|
-
if (IsWritableStream(this) === false) {
|
|
603
|
-
return promiseRejectedWith(streamBrandCheckException("close"));
|
|
604
|
-
}
|
|
605
|
-
if (IsWritableStreamLocked(this) === true) {
|
|
606
|
-
return promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer"));
|
|
607
|
-
}
|
|
608
|
-
if (WritableStreamCloseQueuedOrInFlight(this) === true) {
|
|
609
|
-
return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"));
|
|
610
|
-
}
|
|
611
|
-
return WritableStreamClose(this);
|
|
612
|
-
};
|
|
613
|
-
WritableStream2.prototype.getWriter = function() {
|
|
614
|
-
if (IsWritableStream(this) === false) {
|
|
615
|
-
throw streamBrandCheckException("getWriter");
|
|
616
|
-
}
|
|
617
|
-
return AcquireWritableStreamDefaultWriter(this);
|
|
618
|
-
};
|
|
619
|
-
return WritableStream2;
|
|
620
|
-
}();
|
|
621
|
-
function AcquireWritableStreamDefaultWriter(stream) {
|
|
622
|
-
return new WritableStreamDefaultWriter(stream);
|
|
623
|
-
}
|
|
624
|
-
function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
625
|
-
if (highWaterMark === void 0) {
|
|
626
|
-
highWaterMark = 1;
|
|
627
|
-
}
|
|
628
|
-
if (sizeAlgorithm === void 0) {
|
|
629
|
-
sizeAlgorithm = function() {
|
|
630
|
-
return 1;
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
var stream = Object.create(WritableStream.prototype);
|
|
634
|
-
InitializeWritableStream(stream);
|
|
635
|
-
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
636
|
-
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
637
|
-
return stream;
|
|
638
|
-
}
|
|
639
|
-
function InitializeWritableStream(stream) {
|
|
640
|
-
stream._state = "writable";
|
|
641
|
-
stream._storedError = void 0;
|
|
642
|
-
stream._writer = void 0;
|
|
643
|
-
stream._writableStreamController = void 0;
|
|
644
|
-
stream._writeRequests = new SimpleQueue();
|
|
645
|
-
stream._inFlightWriteRequest = void 0;
|
|
646
|
-
stream._closeRequest = void 0;
|
|
647
|
-
stream._inFlightCloseRequest = void 0;
|
|
648
|
-
stream._pendingAbortRequest = void 0;
|
|
649
|
-
stream._backpressure = false;
|
|
650
|
-
}
|
|
651
|
-
function IsWritableStream(x) {
|
|
652
|
-
if (!typeIsObject(x)) {
|
|
653
|
-
return false;
|
|
654
|
-
}
|
|
655
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_writableStreamController")) {
|
|
656
|
-
return false;
|
|
657
|
-
}
|
|
658
|
-
return true;
|
|
659
|
-
}
|
|
660
|
-
function IsWritableStreamLocked(stream) {
|
|
661
|
-
if (stream._writer === void 0) {
|
|
662
|
-
return false;
|
|
663
|
-
}
|
|
664
|
-
return true;
|
|
665
|
-
}
|
|
666
|
-
function WritableStreamAbort(stream, reason) {
|
|
667
|
-
var state = stream._state;
|
|
668
|
-
if (state === "closed" || state === "errored") {
|
|
669
|
-
return promiseResolvedWith(void 0);
|
|
670
|
-
}
|
|
671
|
-
if (stream._pendingAbortRequest !== void 0) {
|
|
672
|
-
return stream._pendingAbortRequest._promise;
|
|
673
|
-
}
|
|
674
|
-
var wasAlreadyErroring = false;
|
|
675
|
-
if (state === "erroring") {
|
|
676
|
-
wasAlreadyErroring = true;
|
|
677
|
-
reason = void 0;
|
|
678
|
-
}
|
|
679
|
-
var promise = newPromise(function(resolve, reject) {
|
|
680
|
-
stream._pendingAbortRequest = {
|
|
681
|
-
_promise: void 0,
|
|
682
|
-
_resolve: resolve,
|
|
683
|
-
_reject: reject,
|
|
684
|
-
_reason: reason,
|
|
685
|
-
_wasAlreadyErroring: wasAlreadyErroring
|
|
686
|
-
};
|
|
687
|
-
});
|
|
688
|
-
stream._pendingAbortRequest._promise = promise;
|
|
689
|
-
if (wasAlreadyErroring === false) {
|
|
690
|
-
WritableStreamStartErroring(stream, reason);
|
|
691
|
-
}
|
|
692
|
-
return promise;
|
|
693
|
-
}
|
|
694
|
-
function WritableStreamClose(stream) {
|
|
695
|
-
var state = stream._state;
|
|
696
|
-
if (state === "closed" || state === "errored") {
|
|
697
|
-
return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed"));
|
|
698
|
-
}
|
|
699
|
-
var promise = newPromise(function(resolve, reject) {
|
|
700
|
-
var closeRequest = {
|
|
701
|
-
_resolve: resolve,
|
|
702
|
-
_reject: reject
|
|
703
|
-
};
|
|
704
|
-
stream._closeRequest = closeRequest;
|
|
705
|
-
});
|
|
706
|
-
var writer = stream._writer;
|
|
707
|
-
if (writer !== void 0 && stream._backpressure === true && state === "writable") {
|
|
708
|
-
defaultWriterReadyPromiseResolve(writer);
|
|
709
|
-
}
|
|
710
|
-
WritableStreamDefaultControllerClose(stream._writableStreamController);
|
|
711
|
-
return promise;
|
|
712
|
-
}
|
|
713
|
-
function WritableStreamAddWriteRequest(stream) {
|
|
714
|
-
var promise = newPromise(function(resolve, reject) {
|
|
715
|
-
var writeRequest = {
|
|
716
|
-
_resolve: resolve,
|
|
717
|
-
_reject: reject
|
|
718
|
-
};
|
|
719
|
-
stream._writeRequests.push(writeRequest);
|
|
720
|
-
});
|
|
721
|
-
return promise;
|
|
722
|
-
}
|
|
723
|
-
function WritableStreamDealWithRejection(stream, error) {
|
|
724
|
-
var state = stream._state;
|
|
725
|
-
if (state === "writable") {
|
|
726
|
-
WritableStreamStartErroring(stream, error);
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
WritableStreamFinishErroring(stream);
|
|
730
|
-
}
|
|
731
|
-
function WritableStreamStartErroring(stream, reason) {
|
|
732
|
-
var controller = stream._writableStreamController;
|
|
733
|
-
stream._state = "erroring";
|
|
734
|
-
stream._storedError = reason;
|
|
735
|
-
var writer = stream._writer;
|
|
736
|
-
if (writer !== void 0) {
|
|
737
|
-
WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
|
|
738
|
-
}
|
|
739
|
-
if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
|
|
740
|
-
WritableStreamFinishErroring(stream);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
function WritableStreamFinishErroring(stream) {
|
|
744
|
-
stream._state = "errored";
|
|
745
|
-
stream._writableStreamController[ErrorSteps]();
|
|
746
|
-
var storedError = stream._storedError;
|
|
747
|
-
stream._writeRequests.forEach(function(writeRequest) {
|
|
748
|
-
writeRequest._reject(storedError);
|
|
749
|
-
});
|
|
750
|
-
stream._writeRequests = new SimpleQueue();
|
|
751
|
-
if (stream._pendingAbortRequest === void 0) {
|
|
752
|
-
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
var abortRequest = stream._pendingAbortRequest;
|
|
756
|
-
stream._pendingAbortRequest = void 0;
|
|
757
|
-
if (abortRequest._wasAlreadyErroring === true) {
|
|
758
|
-
abortRequest._reject(storedError);
|
|
759
|
-
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
var promise = stream._writableStreamController[AbortSteps](abortRequest._reason);
|
|
763
|
-
uponPromise(promise, function() {
|
|
764
|
-
abortRequest._resolve();
|
|
765
|
-
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
766
|
-
}, function(reason) {
|
|
767
|
-
abortRequest._reject(reason);
|
|
768
|
-
WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
function WritableStreamFinishInFlightWrite(stream) {
|
|
772
|
-
stream._inFlightWriteRequest._resolve(void 0);
|
|
773
|
-
stream._inFlightWriteRequest = void 0;
|
|
774
|
-
}
|
|
775
|
-
function WritableStreamFinishInFlightWriteWithError(stream, error) {
|
|
776
|
-
stream._inFlightWriteRequest._reject(error);
|
|
777
|
-
stream._inFlightWriteRequest = void 0;
|
|
778
|
-
WritableStreamDealWithRejection(stream, error);
|
|
779
|
-
}
|
|
780
|
-
function WritableStreamFinishInFlightClose(stream) {
|
|
781
|
-
stream._inFlightCloseRequest._resolve(void 0);
|
|
782
|
-
stream._inFlightCloseRequest = void 0;
|
|
783
|
-
var state = stream._state;
|
|
784
|
-
if (state === "erroring") {
|
|
785
|
-
stream._storedError = void 0;
|
|
786
|
-
if (stream._pendingAbortRequest !== void 0) {
|
|
787
|
-
stream._pendingAbortRequest._resolve();
|
|
788
|
-
stream._pendingAbortRequest = void 0;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
stream._state = "closed";
|
|
792
|
-
var writer = stream._writer;
|
|
793
|
-
if (writer !== void 0) {
|
|
794
|
-
defaultWriterClosedPromiseResolve(writer);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function WritableStreamFinishInFlightCloseWithError(stream, error) {
|
|
798
|
-
stream._inFlightCloseRequest._reject(error);
|
|
799
|
-
stream._inFlightCloseRequest = void 0;
|
|
800
|
-
if (stream._pendingAbortRequest !== void 0) {
|
|
801
|
-
stream._pendingAbortRequest._reject(error);
|
|
802
|
-
stream._pendingAbortRequest = void 0;
|
|
803
|
-
}
|
|
804
|
-
WritableStreamDealWithRejection(stream, error);
|
|
805
|
-
}
|
|
806
|
-
function WritableStreamCloseQueuedOrInFlight(stream) {
|
|
807
|
-
if (stream._closeRequest === void 0 && stream._inFlightCloseRequest === void 0) {
|
|
808
|
-
return false;
|
|
809
|
-
}
|
|
810
|
-
return true;
|
|
811
|
-
}
|
|
812
|
-
function WritableStreamHasOperationMarkedInFlight(stream) {
|
|
813
|
-
if (stream._inFlightWriteRequest === void 0 && stream._inFlightCloseRequest === void 0) {
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
return true;
|
|
817
|
-
}
|
|
818
|
-
function WritableStreamMarkCloseRequestInFlight(stream) {
|
|
819
|
-
stream._inFlightCloseRequest = stream._closeRequest;
|
|
820
|
-
stream._closeRequest = void 0;
|
|
821
|
-
}
|
|
822
|
-
function WritableStreamMarkFirstWriteRequestInFlight(stream) {
|
|
823
|
-
stream._inFlightWriteRequest = stream._writeRequests.shift();
|
|
824
|
-
}
|
|
825
|
-
function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
|
|
826
|
-
if (stream._closeRequest !== void 0) {
|
|
827
|
-
stream._closeRequest._reject(stream._storedError);
|
|
828
|
-
stream._closeRequest = void 0;
|
|
829
|
-
}
|
|
830
|
-
var writer = stream._writer;
|
|
831
|
-
if (writer !== void 0) {
|
|
832
|
-
defaultWriterClosedPromiseReject(writer, stream._storedError);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
function WritableStreamUpdateBackpressure(stream, backpressure) {
|
|
836
|
-
var writer = stream._writer;
|
|
837
|
-
if (writer !== void 0 && backpressure !== stream._backpressure) {
|
|
838
|
-
if (backpressure === true) {
|
|
839
|
-
defaultWriterReadyPromiseReset(writer);
|
|
840
|
-
} else {
|
|
841
|
-
defaultWriterReadyPromiseResolve(writer);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
stream._backpressure = backpressure;
|
|
845
|
-
}
|
|
846
|
-
var WritableStreamDefaultWriter = function() {
|
|
847
|
-
function WritableStreamDefaultWriter2(stream) {
|
|
848
|
-
if (IsWritableStream(stream) === false) {
|
|
849
|
-
throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");
|
|
850
|
-
}
|
|
851
|
-
if (IsWritableStreamLocked(stream) === true) {
|
|
852
|
-
throw new TypeError("This stream has already been locked for exclusive writing by another writer");
|
|
853
|
-
}
|
|
854
|
-
this._ownerWritableStream = stream;
|
|
855
|
-
stream._writer = this;
|
|
856
|
-
var state = stream._state;
|
|
857
|
-
if (state === "writable") {
|
|
858
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
|
|
859
|
-
defaultWriterReadyPromiseInitialize(this);
|
|
860
|
-
} else {
|
|
861
|
-
defaultWriterReadyPromiseInitializeAsResolved(this);
|
|
862
|
-
}
|
|
863
|
-
defaultWriterClosedPromiseInitialize(this);
|
|
864
|
-
} else if (state === "erroring") {
|
|
865
|
-
defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
|
|
866
|
-
defaultWriterClosedPromiseInitialize(this);
|
|
867
|
-
} else if (state === "closed") {
|
|
868
|
-
defaultWriterReadyPromiseInitializeAsResolved(this);
|
|
869
|
-
defaultWriterClosedPromiseInitializeAsResolved(this);
|
|
870
|
-
} else {
|
|
871
|
-
var storedError = stream._storedError;
|
|
872
|
-
defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
|
|
873
|
-
defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
Object.defineProperty(WritableStreamDefaultWriter2.prototype, "closed", {
|
|
877
|
-
get: function() {
|
|
878
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
879
|
-
return promiseRejectedWith(defaultWriterBrandCheckException("closed"));
|
|
880
|
-
}
|
|
881
|
-
return this._closedPromise;
|
|
882
|
-
},
|
|
883
|
-
enumerable: true,
|
|
884
|
-
configurable: true
|
|
885
|
-
});
|
|
886
|
-
Object.defineProperty(WritableStreamDefaultWriter2.prototype, "desiredSize", {
|
|
887
|
-
get: function() {
|
|
888
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
889
|
-
throw defaultWriterBrandCheckException("desiredSize");
|
|
890
|
-
}
|
|
891
|
-
if (this._ownerWritableStream === void 0) {
|
|
892
|
-
throw defaultWriterLockException("desiredSize");
|
|
893
|
-
}
|
|
894
|
-
return WritableStreamDefaultWriterGetDesiredSize(this);
|
|
895
|
-
},
|
|
896
|
-
enumerable: true,
|
|
897
|
-
configurable: true
|
|
898
|
-
});
|
|
899
|
-
Object.defineProperty(WritableStreamDefaultWriter2.prototype, "ready", {
|
|
900
|
-
get: function() {
|
|
901
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
902
|
-
return promiseRejectedWith(defaultWriterBrandCheckException("ready"));
|
|
903
|
-
}
|
|
904
|
-
return this._readyPromise;
|
|
905
|
-
},
|
|
906
|
-
enumerable: true,
|
|
907
|
-
configurable: true
|
|
908
|
-
});
|
|
909
|
-
WritableStreamDefaultWriter2.prototype.abort = function(reason) {
|
|
910
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
911
|
-
return promiseRejectedWith(defaultWriterBrandCheckException("abort"));
|
|
912
|
-
}
|
|
913
|
-
if (this._ownerWritableStream === void 0) {
|
|
914
|
-
return promiseRejectedWith(defaultWriterLockException("abort"));
|
|
915
|
-
}
|
|
916
|
-
return WritableStreamDefaultWriterAbort(this, reason);
|
|
917
|
-
};
|
|
918
|
-
WritableStreamDefaultWriter2.prototype.close = function() {
|
|
919
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
920
|
-
return promiseRejectedWith(defaultWriterBrandCheckException("close"));
|
|
921
|
-
}
|
|
922
|
-
var stream = this._ownerWritableStream;
|
|
923
|
-
if (stream === void 0) {
|
|
924
|
-
return promiseRejectedWith(defaultWriterLockException("close"));
|
|
925
|
-
}
|
|
926
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
|
|
927
|
-
return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"));
|
|
928
|
-
}
|
|
929
|
-
return WritableStreamDefaultWriterClose(this);
|
|
930
|
-
};
|
|
931
|
-
WritableStreamDefaultWriter2.prototype.releaseLock = function() {
|
|
932
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
933
|
-
throw defaultWriterBrandCheckException("releaseLock");
|
|
934
|
-
}
|
|
935
|
-
var stream = this._ownerWritableStream;
|
|
936
|
-
if (stream === void 0) {
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
WritableStreamDefaultWriterRelease(this);
|
|
940
|
-
};
|
|
941
|
-
WritableStreamDefaultWriter2.prototype.write = function(chunk) {
|
|
942
|
-
if (IsWritableStreamDefaultWriter(this) === false) {
|
|
943
|
-
return promiseRejectedWith(defaultWriterBrandCheckException("write"));
|
|
944
|
-
}
|
|
945
|
-
if (this._ownerWritableStream === void 0) {
|
|
946
|
-
return promiseRejectedWith(defaultWriterLockException("write to"));
|
|
947
|
-
}
|
|
948
|
-
return WritableStreamDefaultWriterWrite(this, chunk);
|
|
949
|
-
};
|
|
950
|
-
return WritableStreamDefaultWriter2;
|
|
951
|
-
}();
|
|
952
|
-
function IsWritableStreamDefaultWriter(x) {
|
|
953
|
-
if (!typeIsObject(x)) {
|
|
954
|
-
return false;
|
|
955
|
-
}
|
|
956
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_ownerWritableStream")) {
|
|
957
|
-
return false;
|
|
958
|
-
}
|
|
959
|
-
return true;
|
|
960
|
-
}
|
|
961
|
-
function WritableStreamDefaultWriterAbort(writer, reason) {
|
|
962
|
-
var stream = writer._ownerWritableStream;
|
|
963
|
-
return WritableStreamAbort(stream, reason);
|
|
964
|
-
}
|
|
965
|
-
function WritableStreamDefaultWriterClose(writer) {
|
|
966
|
-
var stream = writer._ownerWritableStream;
|
|
967
|
-
return WritableStreamClose(stream);
|
|
968
|
-
}
|
|
969
|
-
function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
|
|
970
|
-
var stream = writer._ownerWritableStream;
|
|
971
|
-
var state = stream._state;
|
|
972
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === "closed") {
|
|
973
|
-
return promiseResolvedWith(void 0);
|
|
974
|
-
}
|
|
975
|
-
if (state === "errored") {
|
|
976
|
-
return promiseRejectedWith(stream._storedError);
|
|
977
|
-
}
|
|
978
|
-
return WritableStreamDefaultWriterClose(writer);
|
|
979
|
-
}
|
|
980
|
-
function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
|
|
981
|
-
if (writer._closedPromiseState === "pending") {
|
|
982
|
-
defaultWriterClosedPromiseReject(writer, error);
|
|
983
|
-
} else {
|
|
984
|
-
defaultWriterClosedPromiseResetToRejected(writer, error);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
|
|
988
|
-
if (writer._readyPromiseState === "pending") {
|
|
989
|
-
defaultWriterReadyPromiseReject(writer, error);
|
|
990
|
-
} else {
|
|
991
|
-
defaultWriterReadyPromiseResetToRejected(writer, error);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
function WritableStreamDefaultWriterGetDesiredSize(writer) {
|
|
995
|
-
var stream = writer._ownerWritableStream;
|
|
996
|
-
var state = stream._state;
|
|
997
|
-
if (state === "errored" || state === "erroring") {
|
|
998
|
-
return null;
|
|
999
|
-
}
|
|
1000
|
-
if (state === "closed") {
|
|
1001
|
-
return 0;
|
|
1002
|
-
}
|
|
1003
|
-
return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
|
|
1004
|
-
}
|
|
1005
|
-
function WritableStreamDefaultWriterRelease(writer) {
|
|
1006
|
-
var stream = writer._ownerWritableStream;
|
|
1007
|
-
var releasedError = new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");
|
|
1008
|
-
WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
|
|
1009
|
-
WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
|
|
1010
|
-
stream._writer = void 0;
|
|
1011
|
-
writer._ownerWritableStream = void 0;
|
|
1012
|
-
}
|
|
1013
|
-
function WritableStreamDefaultWriterWrite(writer, chunk) {
|
|
1014
|
-
var stream = writer._ownerWritableStream;
|
|
1015
|
-
var controller = stream._writableStreamController;
|
|
1016
|
-
var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
|
|
1017
|
-
if (stream !== writer._ownerWritableStream) {
|
|
1018
|
-
return promiseRejectedWith(defaultWriterLockException("write to"));
|
|
1019
|
-
}
|
|
1020
|
-
var state = stream._state;
|
|
1021
|
-
if (state === "errored") {
|
|
1022
|
-
return promiseRejectedWith(stream._storedError);
|
|
1023
|
-
}
|
|
1024
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === "closed") {
|
|
1025
|
-
return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"));
|
|
1026
|
-
}
|
|
1027
|
-
if (state === "erroring") {
|
|
1028
|
-
return promiseRejectedWith(stream._storedError);
|
|
1029
|
-
}
|
|
1030
|
-
var promise = WritableStreamAddWriteRequest(stream);
|
|
1031
|
-
WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
|
|
1032
|
-
return promise;
|
|
1033
|
-
}
|
|
1034
|
-
var WritableStreamDefaultController = function() {
|
|
1035
|
-
function WritableStreamDefaultController2() {
|
|
1036
|
-
throw new TypeError("WritableStreamDefaultController cannot be constructed explicitly");
|
|
1037
|
-
}
|
|
1038
|
-
WritableStreamDefaultController2.prototype.error = function(e) {
|
|
1039
|
-
if (IsWritableStreamDefaultController(this) === false) {
|
|
1040
|
-
throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");
|
|
1041
|
-
}
|
|
1042
|
-
var state = this._controlledWritableStream._state;
|
|
1043
|
-
if (state !== "writable") {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
WritableStreamDefaultControllerError(this, e);
|
|
1047
|
-
};
|
|
1048
|
-
WritableStreamDefaultController2.prototype[AbortSteps] = function(reason) {
|
|
1049
|
-
var result = this._abortAlgorithm(reason);
|
|
1050
|
-
WritableStreamDefaultControllerClearAlgorithms(this);
|
|
1051
|
-
return result;
|
|
1052
|
-
};
|
|
1053
|
-
WritableStreamDefaultController2.prototype[ErrorSteps] = function() {
|
|
1054
|
-
ResetQueue(this);
|
|
1055
|
-
};
|
|
1056
|
-
return WritableStreamDefaultController2;
|
|
1057
|
-
}();
|
|
1058
|
-
function IsWritableStreamDefaultController(x) {
|
|
1059
|
-
if (!typeIsObject(x)) {
|
|
1060
|
-
return false;
|
|
1061
|
-
}
|
|
1062
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_controlledWritableStream")) {
|
|
1063
|
-
return false;
|
|
1064
|
-
}
|
|
1065
|
-
return true;
|
|
1066
|
-
}
|
|
1067
|
-
function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
1068
|
-
controller._controlledWritableStream = stream;
|
|
1069
|
-
stream._writableStreamController = controller;
|
|
1070
|
-
controller._queue = void 0;
|
|
1071
|
-
controller._queueTotalSize = void 0;
|
|
1072
|
-
ResetQueue(controller);
|
|
1073
|
-
controller._started = false;
|
|
1074
|
-
controller._strategySizeAlgorithm = sizeAlgorithm;
|
|
1075
|
-
controller._strategyHWM = highWaterMark;
|
|
1076
|
-
controller._writeAlgorithm = writeAlgorithm;
|
|
1077
|
-
controller._closeAlgorithm = closeAlgorithm;
|
|
1078
|
-
controller._abortAlgorithm = abortAlgorithm;
|
|
1079
|
-
var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
|
|
1080
|
-
WritableStreamUpdateBackpressure(stream, backpressure);
|
|
1081
|
-
var startResult = startAlgorithm();
|
|
1082
|
-
var startPromise = promiseResolvedWith(startResult);
|
|
1083
|
-
uponPromise(startPromise, function() {
|
|
1084
|
-
controller._started = true;
|
|
1085
|
-
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
1086
|
-
}, function(r) {
|
|
1087
|
-
controller._started = true;
|
|
1088
|
-
WritableStreamDealWithRejection(stream, r);
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
|
|
1092
|
-
var controller = Object.create(WritableStreamDefaultController.prototype);
|
|
1093
|
-
function startAlgorithm() {
|
|
1094
|
-
return InvokeOrNoop(underlyingSink, "start", [controller]);
|
|
1095
|
-
}
|
|
1096
|
-
var writeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, "write", 1, [controller]);
|
|
1097
|
-
var closeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, "close", 0, []);
|
|
1098
|
-
var abortAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, "abort", 1, []);
|
|
1099
|
-
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
|
|
1100
|
-
}
|
|
1101
|
-
function WritableStreamDefaultControllerClearAlgorithms(controller) {
|
|
1102
|
-
controller._writeAlgorithm = void 0;
|
|
1103
|
-
controller._closeAlgorithm = void 0;
|
|
1104
|
-
controller._abortAlgorithm = void 0;
|
|
1105
|
-
controller._strategySizeAlgorithm = void 0;
|
|
1106
|
-
}
|
|
1107
|
-
function WritableStreamDefaultControllerClose(controller) {
|
|
1108
|
-
EnqueueValueWithSize(controller, "close", 0);
|
|
1109
|
-
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
1110
|
-
}
|
|
1111
|
-
function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
|
|
1112
|
-
try {
|
|
1113
|
-
return controller._strategySizeAlgorithm(chunk);
|
|
1114
|
-
} catch (chunkSizeE) {
|
|
1115
|
-
WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
|
|
1116
|
-
return 1;
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
function WritableStreamDefaultControllerGetDesiredSize(controller) {
|
|
1120
|
-
return controller._strategyHWM - controller._queueTotalSize;
|
|
1121
|
-
}
|
|
1122
|
-
function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
|
|
1123
|
-
var writeRecord = { chunk };
|
|
1124
|
-
try {
|
|
1125
|
-
EnqueueValueWithSize(controller, writeRecord, chunkSize);
|
|
1126
|
-
} catch (enqueueE) {
|
|
1127
|
-
WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
var stream = controller._controlledWritableStream;
|
|
1131
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === "writable") {
|
|
1132
|
-
var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
|
|
1133
|
-
WritableStreamUpdateBackpressure(stream, backpressure);
|
|
1134
|
-
}
|
|
1135
|
-
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
1136
|
-
}
|
|
1137
|
-
function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
|
|
1138
|
-
var stream = controller._controlledWritableStream;
|
|
1139
|
-
if (controller._started === false) {
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
if (stream._inFlightWriteRequest !== void 0) {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
var state = stream._state;
|
|
1146
|
-
if (state === "erroring") {
|
|
1147
|
-
WritableStreamFinishErroring(stream);
|
|
1148
|
-
return;
|
|
1149
|
-
}
|
|
1150
|
-
if (controller._queue.length === 0) {
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
var writeRecord = PeekQueueValue(controller);
|
|
1154
|
-
if (writeRecord === "close") {
|
|
1155
|
-
WritableStreamDefaultControllerProcessClose(controller);
|
|
1156
|
-
} else {
|
|
1157
|
-
WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
|
|
1161
|
-
if (controller._controlledWritableStream._state === "writable") {
|
|
1162
|
-
WritableStreamDefaultControllerError(controller, error);
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
function WritableStreamDefaultControllerProcessClose(controller) {
|
|
1166
|
-
var stream = controller._controlledWritableStream;
|
|
1167
|
-
WritableStreamMarkCloseRequestInFlight(stream);
|
|
1168
|
-
DequeueValue(controller);
|
|
1169
|
-
var sinkClosePromise = controller._closeAlgorithm();
|
|
1170
|
-
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
1171
|
-
uponPromise(sinkClosePromise, function() {
|
|
1172
|
-
WritableStreamFinishInFlightClose(stream);
|
|
1173
|
-
}, function(reason) {
|
|
1174
|
-
WritableStreamFinishInFlightCloseWithError(stream, reason);
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1177
|
-
function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
|
|
1178
|
-
var stream = controller._controlledWritableStream;
|
|
1179
|
-
WritableStreamMarkFirstWriteRequestInFlight(stream);
|
|
1180
|
-
var sinkWritePromise = controller._writeAlgorithm(chunk);
|
|
1181
|
-
uponPromise(sinkWritePromise, function() {
|
|
1182
|
-
WritableStreamFinishInFlightWrite(stream);
|
|
1183
|
-
var state = stream._state;
|
|
1184
|
-
DequeueValue(controller);
|
|
1185
|
-
if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === "writable") {
|
|
1186
|
-
var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
|
|
1187
|
-
WritableStreamUpdateBackpressure(stream, backpressure);
|
|
1188
|
-
}
|
|
1189
|
-
WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
|
1190
|
-
}, function(reason) {
|
|
1191
|
-
if (stream._state === "writable") {
|
|
1192
|
-
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
1193
|
-
}
|
|
1194
|
-
WritableStreamFinishInFlightWriteWithError(stream, reason);
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
function WritableStreamDefaultControllerGetBackpressure(controller) {
|
|
1198
|
-
var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
|
|
1199
|
-
return desiredSize <= 0;
|
|
1200
|
-
}
|
|
1201
|
-
function WritableStreamDefaultControllerError(controller, error) {
|
|
1202
|
-
var stream = controller._controlledWritableStream;
|
|
1203
|
-
WritableStreamDefaultControllerClearAlgorithms(controller);
|
|
1204
|
-
WritableStreamStartErroring(stream, error);
|
|
1205
|
-
}
|
|
1206
|
-
function streamBrandCheckException(name) {
|
|
1207
|
-
return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
|
|
1208
|
-
}
|
|
1209
|
-
function defaultWriterBrandCheckException(name) {
|
|
1210
|
-
return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter");
|
|
1211
|
-
}
|
|
1212
|
-
function defaultWriterLockException(name) {
|
|
1213
|
-
return new TypeError("Cannot " + name + " a stream using a released writer");
|
|
1214
|
-
}
|
|
1215
|
-
function defaultWriterClosedPromiseInitialize(writer) {
|
|
1216
|
-
writer._closedPromise = newPromise(function(resolve, reject) {
|
|
1217
|
-
writer._closedPromise_resolve = resolve;
|
|
1218
|
-
writer._closedPromise_reject = reject;
|
|
1219
|
-
writer._closedPromiseState = "pending";
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
|
|
1223
|
-
defaultWriterClosedPromiseInitialize(writer);
|
|
1224
|
-
defaultWriterClosedPromiseReject(writer, reason);
|
|
1225
|
-
}
|
|
1226
|
-
function defaultWriterClosedPromiseInitializeAsResolved(writer) {
|
|
1227
|
-
defaultWriterClosedPromiseInitialize(writer);
|
|
1228
|
-
defaultWriterClosedPromiseResolve(writer);
|
|
1229
|
-
}
|
|
1230
|
-
function defaultWriterClosedPromiseReject(writer, reason) {
|
|
1231
|
-
setPromiseIsHandledToTrue(writer._closedPromise);
|
|
1232
|
-
writer._closedPromise_reject(reason);
|
|
1233
|
-
writer._closedPromise_resolve = void 0;
|
|
1234
|
-
writer._closedPromise_reject = void 0;
|
|
1235
|
-
writer._closedPromiseState = "rejected";
|
|
1236
|
-
}
|
|
1237
|
-
function defaultWriterClosedPromiseResetToRejected(writer, reason) {
|
|
1238
|
-
defaultWriterClosedPromiseInitializeAsRejected(writer, reason);
|
|
1239
|
-
}
|
|
1240
|
-
function defaultWriterClosedPromiseResolve(writer) {
|
|
1241
|
-
writer._closedPromise_resolve(void 0);
|
|
1242
|
-
writer._closedPromise_resolve = void 0;
|
|
1243
|
-
writer._closedPromise_reject = void 0;
|
|
1244
|
-
writer._closedPromiseState = "resolved";
|
|
1245
|
-
}
|
|
1246
|
-
function defaultWriterReadyPromiseInitialize(writer) {
|
|
1247
|
-
writer._readyPromise = newPromise(function(resolve, reject) {
|
|
1248
|
-
writer._readyPromise_resolve = resolve;
|
|
1249
|
-
writer._readyPromise_reject = reject;
|
|
1250
|
-
});
|
|
1251
|
-
writer._readyPromiseState = "pending";
|
|
1252
|
-
}
|
|
1253
|
-
function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
|
|
1254
|
-
defaultWriterReadyPromiseInitialize(writer);
|
|
1255
|
-
defaultWriterReadyPromiseReject(writer, reason);
|
|
1256
|
-
}
|
|
1257
|
-
function defaultWriterReadyPromiseInitializeAsResolved(writer) {
|
|
1258
|
-
defaultWriterReadyPromiseInitialize(writer);
|
|
1259
|
-
defaultWriterReadyPromiseResolve(writer);
|
|
1260
|
-
}
|
|
1261
|
-
function defaultWriterReadyPromiseReject(writer, reason) {
|
|
1262
|
-
setPromiseIsHandledToTrue(writer._readyPromise);
|
|
1263
|
-
writer._readyPromise_reject(reason);
|
|
1264
|
-
writer._readyPromise_resolve = void 0;
|
|
1265
|
-
writer._readyPromise_reject = void 0;
|
|
1266
|
-
writer._readyPromiseState = "rejected";
|
|
1267
|
-
}
|
|
1268
|
-
function defaultWriterReadyPromiseReset(writer) {
|
|
1269
|
-
defaultWriterReadyPromiseInitialize(writer);
|
|
1270
|
-
}
|
|
1271
|
-
function defaultWriterReadyPromiseResetToRejected(writer, reason) {
|
|
1272
|
-
defaultWriterReadyPromiseInitializeAsRejected(writer, reason);
|
|
1273
|
-
}
|
|
1274
|
-
function defaultWriterReadyPromiseResolve(writer) {
|
|
1275
|
-
writer._readyPromise_resolve(void 0);
|
|
1276
|
-
writer._readyPromise_resolve = void 0;
|
|
1277
|
-
writer._readyPromise_reject = void 0;
|
|
1278
|
-
writer._readyPromiseState = "fulfilled";
|
|
1279
|
-
}
|
|
1280
|
-
function isAbortSignal(value) {
|
|
1281
|
-
if (typeof value !== "object" || value === null) {
|
|
1282
|
-
return false;
|
|
1283
|
-
}
|
|
1284
|
-
try {
|
|
1285
|
-
return typeof value.aborted === "boolean";
|
|
1286
|
-
} catch (_a2) {
|
|
1287
|
-
return false;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
var NativeDOMException = typeof DOMException !== "undefined" ? DOMException : void 0;
|
|
1291
|
-
function isDOMExceptionConstructor(ctor) {
|
|
1292
|
-
if (!(typeof ctor === "function" || typeof ctor === "object")) {
|
|
1293
|
-
return false;
|
|
1294
|
-
}
|
|
1295
|
-
try {
|
|
1296
|
-
new ctor();
|
|
1297
|
-
return true;
|
|
1298
|
-
} catch (_a2) {
|
|
1299
|
-
return false;
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
function createDOMExceptionPolyfill() {
|
|
1303
|
-
var ctor = function DOMException2(message, name) {
|
|
1304
|
-
this.message = message || "";
|
|
1305
|
-
this.name = name || "Error";
|
|
1306
|
-
if (Error.captureStackTrace) {
|
|
1307
|
-
Error.captureStackTrace(this, this.constructor);
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
ctor.prototype = Object.create(Error.prototype);
|
|
1311
|
-
Object.defineProperty(ctor.prototype, "constructor", { value: ctor, writable: true, configurable: true });
|
|
1312
|
-
return ctor;
|
|
1313
|
-
}
|
|
1314
|
-
var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
1315
|
-
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
1316
|
-
var reader = AcquireReadableStreamDefaultReader(source);
|
|
1317
|
-
var writer = AcquireWritableStreamDefaultWriter(dest);
|
|
1318
|
-
source._disturbed = true;
|
|
1319
|
-
var shuttingDown = false;
|
|
1320
|
-
var currentWrite = promiseResolvedWith(void 0);
|
|
1321
|
-
return newPromise(function(resolve, reject) {
|
|
1322
|
-
var abortAlgorithm;
|
|
1323
|
-
if (signal !== void 0) {
|
|
1324
|
-
abortAlgorithm = function() {
|
|
1325
|
-
var error = new DOMException$1("Aborted", "AbortError");
|
|
1326
|
-
var actions = [];
|
|
1327
|
-
if (preventAbort === false) {
|
|
1328
|
-
actions.push(function() {
|
|
1329
|
-
if (dest._state === "writable") {
|
|
1330
|
-
return WritableStreamAbort(dest, error);
|
|
1331
|
-
}
|
|
1332
|
-
return promiseResolvedWith(void 0);
|
|
1333
|
-
});
|
|
1334
|
-
}
|
|
1335
|
-
if (preventCancel === false) {
|
|
1336
|
-
actions.push(function() {
|
|
1337
|
-
if (source._state === "readable") {
|
|
1338
|
-
return ReadableStreamCancel(source, error);
|
|
1339
|
-
}
|
|
1340
|
-
return promiseResolvedWith(void 0);
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
shutdownWithAction(function() {
|
|
1344
|
-
return Promise.all(actions.map(function(action) {
|
|
1345
|
-
return action();
|
|
1346
|
-
}));
|
|
1347
|
-
}, true, error);
|
|
1348
|
-
};
|
|
1349
|
-
if (signal.aborted === true) {
|
|
1350
|
-
abortAlgorithm();
|
|
1351
|
-
return;
|
|
1352
|
-
}
|
|
1353
|
-
signal.addEventListener("abort", abortAlgorithm);
|
|
1354
|
-
}
|
|
1355
|
-
function pipeLoop() {
|
|
1356
|
-
return newPromise(function(resolveLoop, rejectLoop) {
|
|
1357
|
-
function next(done) {
|
|
1358
|
-
if (done) {
|
|
1359
|
-
resolveLoop();
|
|
1360
|
-
} else {
|
|
1361
|
-
PerformPromiseThen(pipeStep(), next, rejectLoop);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
next(false);
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
function pipeStep() {
|
|
1368
|
-
if (shuttingDown === true) {
|
|
1369
|
-
return promiseResolvedWith(true);
|
|
1370
|
-
}
|
|
1371
|
-
return PerformPromiseThen(writer._readyPromise, function() {
|
|
1372
|
-
return PerformPromiseThen(ReadableStreamDefaultReaderRead(reader), function(result) {
|
|
1373
|
-
if (result.done === true) {
|
|
1374
|
-
return true;
|
|
1375
|
-
}
|
|
1376
|
-
currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, result.value), void 0, noop);
|
|
1377
|
-
return false;
|
|
1378
|
-
});
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
isOrBecomesErrored(source, reader._closedPromise, function(storedError) {
|
|
1382
|
-
if (preventAbort === false) {
|
|
1383
|
-
shutdownWithAction(function() {
|
|
1384
|
-
return WritableStreamAbort(dest, storedError);
|
|
1385
|
-
}, true, storedError);
|
|
1386
|
-
} else {
|
|
1387
|
-
shutdown(true, storedError);
|
|
1388
|
-
}
|
|
1389
|
-
});
|
|
1390
|
-
isOrBecomesErrored(dest, writer._closedPromise, function(storedError) {
|
|
1391
|
-
if (preventCancel === false) {
|
|
1392
|
-
shutdownWithAction(function() {
|
|
1393
|
-
return ReadableStreamCancel(source, storedError);
|
|
1394
|
-
}, true, storedError);
|
|
1395
|
-
} else {
|
|
1396
|
-
shutdown(true, storedError);
|
|
1397
|
-
}
|
|
1398
|
-
});
|
|
1399
|
-
isOrBecomesClosed(source, reader._closedPromise, function() {
|
|
1400
|
-
if (preventClose === false) {
|
|
1401
|
-
shutdownWithAction(function() {
|
|
1402
|
-
return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
|
|
1403
|
-
});
|
|
1404
|
-
} else {
|
|
1405
|
-
shutdown();
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
|
-
if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === "closed") {
|
|
1409
|
-
var destClosed_1 = new TypeError("the destination writable stream closed before all data could be piped to it");
|
|
1410
|
-
if (preventCancel === false) {
|
|
1411
|
-
shutdownWithAction(function() {
|
|
1412
|
-
return ReadableStreamCancel(source, destClosed_1);
|
|
1413
|
-
}, true, destClosed_1);
|
|
1414
|
-
} else {
|
|
1415
|
-
shutdown(true, destClosed_1);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
setPromiseIsHandledToTrue(pipeLoop());
|
|
1419
|
-
function waitForWritesToFinish() {
|
|
1420
|
-
var oldCurrentWrite = currentWrite;
|
|
1421
|
-
return PerformPromiseThen(currentWrite, function() {
|
|
1422
|
-
return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : void 0;
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
function isOrBecomesErrored(stream, promise, action) {
|
|
1426
|
-
if (stream._state === "errored") {
|
|
1427
|
-
action(stream._storedError);
|
|
1428
|
-
} else {
|
|
1429
|
-
uponRejection(promise, action);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
function isOrBecomesClosed(stream, promise, action) {
|
|
1433
|
-
if (stream._state === "closed") {
|
|
1434
|
-
action();
|
|
1435
|
-
} else {
|
|
1436
|
-
uponFulfillment(promise, action);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
function shutdownWithAction(action, originalIsError, originalError) {
|
|
1440
|
-
if (shuttingDown === true) {
|
|
1441
|
-
return;
|
|
1442
|
-
}
|
|
1443
|
-
shuttingDown = true;
|
|
1444
|
-
if (dest._state === "writable" && WritableStreamCloseQueuedOrInFlight(dest) === false) {
|
|
1445
|
-
uponFulfillment(waitForWritesToFinish(), doTheRest);
|
|
1446
|
-
} else {
|
|
1447
|
-
doTheRest();
|
|
1448
|
-
}
|
|
1449
|
-
function doTheRest() {
|
|
1450
|
-
uponPromise(action(), function() {
|
|
1451
|
-
return finalize(originalIsError, originalError);
|
|
1452
|
-
}, function(newError) {
|
|
1453
|
-
return finalize(true, newError);
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
function shutdown(isError, error) {
|
|
1458
|
-
if (shuttingDown === true) {
|
|
1459
|
-
return;
|
|
1460
|
-
}
|
|
1461
|
-
shuttingDown = true;
|
|
1462
|
-
if (dest._state === "writable" && WritableStreamCloseQueuedOrInFlight(dest) === false) {
|
|
1463
|
-
uponFulfillment(waitForWritesToFinish(), function() {
|
|
1464
|
-
return finalize(isError, error);
|
|
1465
|
-
});
|
|
1466
|
-
} else {
|
|
1467
|
-
finalize(isError, error);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
function finalize(isError, error) {
|
|
1471
|
-
WritableStreamDefaultWriterRelease(writer);
|
|
1472
|
-
ReadableStreamReaderGenericRelease(reader);
|
|
1473
|
-
if (signal !== void 0) {
|
|
1474
|
-
signal.removeEventListener("abort", abortAlgorithm);
|
|
1475
|
-
}
|
|
1476
|
-
if (isError) {
|
|
1477
|
-
reject(error);
|
|
1478
|
-
} else {
|
|
1479
|
-
resolve(void 0);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
var ReadableStreamDefaultController = function() {
|
|
1485
|
-
function ReadableStreamDefaultController2() {
|
|
1486
|
-
throw new TypeError();
|
|
1487
|
-
}
|
|
1488
|
-
Object.defineProperty(ReadableStreamDefaultController2.prototype, "desiredSize", {
|
|
1489
|
-
get: function() {
|
|
1490
|
-
if (IsReadableStreamDefaultController(this) === false) {
|
|
1491
|
-
throw defaultControllerBrandCheckException("desiredSize");
|
|
1492
|
-
}
|
|
1493
|
-
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
1494
|
-
},
|
|
1495
|
-
enumerable: true,
|
|
1496
|
-
configurable: true
|
|
1497
|
-
});
|
|
1498
|
-
ReadableStreamDefaultController2.prototype.close = function() {
|
|
1499
|
-
if (IsReadableStreamDefaultController(this) === false) {
|
|
1500
|
-
throw defaultControllerBrandCheckException("close");
|
|
1501
|
-
}
|
|
1502
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
|
|
1503
|
-
throw new TypeError("The stream is not in a state that permits close");
|
|
1504
|
-
}
|
|
1505
|
-
ReadableStreamDefaultControllerClose(this);
|
|
1506
|
-
};
|
|
1507
|
-
ReadableStreamDefaultController2.prototype.enqueue = function(chunk) {
|
|
1508
|
-
if (IsReadableStreamDefaultController(this) === false) {
|
|
1509
|
-
throw defaultControllerBrandCheckException("enqueue");
|
|
1510
|
-
}
|
|
1511
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
|
|
1512
|
-
throw new TypeError("The stream is not in a state that permits enqueue");
|
|
1513
|
-
}
|
|
1514
|
-
return ReadableStreamDefaultControllerEnqueue(this, chunk);
|
|
1515
|
-
};
|
|
1516
|
-
ReadableStreamDefaultController2.prototype.error = function(e) {
|
|
1517
|
-
if (IsReadableStreamDefaultController(this) === false) {
|
|
1518
|
-
throw defaultControllerBrandCheckException("error");
|
|
1519
|
-
}
|
|
1520
|
-
ReadableStreamDefaultControllerError(this, e);
|
|
1521
|
-
};
|
|
1522
|
-
ReadableStreamDefaultController2.prototype[CancelSteps] = function(reason) {
|
|
1523
|
-
ResetQueue(this);
|
|
1524
|
-
var result = this._cancelAlgorithm(reason);
|
|
1525
|
-
ReadableStreamDefaultControllerClearAlgorithms(this);
|
|
1526
|
-
return result;
|
|
1527
|
-
};
|
|
1528
|
-
ReadableStreamDefaultController2.prototype[PullSteps] = function() {
|
|
1529
|
-
var stream = this._controlledReadableStream;
|
|
1530
|
-
if (this._queue.length > 0) {
|
|
1531
|
-
var chunk = DequeueValue(this);
|
|
1532
|
-
if (this._closeRequested === true && this._queue.length === 0) {
|
|
1533
|
-
ReadableStreamDefaultControllerClearAlgorithms(this);
|
|
1534
|
-
ReadableStreamClose(stream);
|
|
1535
|
-
} else {
|
|
1536
|
-
ReadableStreamDefaultControllerCallPullIfNeeded(this);
|
|
1537
|
-
}
|
|
1538
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(chunk, false, stream._reader._forAuthorCode));
|
|
1539
|
-
}
|
|
1540
|
-
var pendingPromise = ReadableStreamAddReadRequest(stream);
|
|
1541
|
-
ReadableStreamDefaultControllerCallPullIfNeeded(this);
|
|
1542
|
-
return pendingPromise;
|
|
1543
|
-
};
|
|
1544
|
-
return ReadableStreamDefaultController2;
|
|
1545
|
-
}();
|
|
1546
|
-
function IsReadableStreamDefaultController(x) {
|
|
1547
|
-
if (!typeIsObject(x)) {
|
|
1548
|
-
return false;
|
|
1549
|
-
}
|
|
1550
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_controlledReadableStream")) {
|
|
1551
|
-
return false;
|
|
1552
|
-
}
|
|
1553
|
-
return true;
|
|
1554
|
-
}
|
|
1555
|
-
function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
1556
|
-
var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
|
|
1557
|
-
if (shouldPull === false) {
|
|
1558
|
-
return;
|
|
1559
|
-
}
|
|
1560
|
-
if (controller._pulling === true) {
|
|
1561
|
-
controller._pullAgain = true;
|
|
1562
|
-
return;
|
|
1563
|
-
}
|
|
1564
|
-
controller._pulling = true;
|
|
1565
|
-
var pullPromise = controller._pullAlgorithm();
|
|
1566
|
-
uponPromise(pullPromise, function() {
|
|
1567
|
-
controller._pulling = false;
|
|
1568
|
-
if (controller._pullAgain === true) {
|
|
1569
|
-
controller._pullAgain = false;
|
|
1570
|
-
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
1571
|
-
}
|
|
1572
|
-
}, function(e) {
|
|
1573
|
-
ReadableStreamDefaultControllerError(controller, e);
|
|
1574
|
-
});
|
|
1575
|
-
}
|
|
1576
|
-
function ReadableStreamDefaultControllerShouldCallPull(controller) {
|
|
1577
|
-
var stream = controller._controlledReadableStream;
|
|
1578
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) === false) {
|
|
1579
|
-
return false;
|
|
1580
|
-
}
|
|
1581
|
-
if (controller._started === false) {
|
|
1582
|
-
return false;
|
|
1583
|
-
}
|
|
1584
|
-
if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
|
|
1585
|
-
return true;
|
|
1586
|
-
}
|
|
1587
|
-
var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
|
|
1588
|
-
if (desiredSize > 0) {
|
|
1589
|
-
return true;
|
|
1590
|
-
}
|
|
1591
|
-
return false;
|
|
1592
|
-
}
|
|
1593
|
-
function ReadableStreamDefaultControllerClearAlgorithms(controller) {
|
|
1594
|
-
controller._pullAlgorithm = void 0;
|
|
1595
|
-
controller._cancelAlgorithm = void 0;
|
|
1596
|
-
controller._strategySizeAlgorithm = void 0;
|
|
1597
|
-
}
|
|
1598
|
-
function ReadableStreamDefaultControllerClose(controller) {
|
|
1599
|
-
var stream = controller._controlledReadableStream;
|
|
1600
|
-
controller._closeRequested = true;
|
|
1601
|
-
if (controller._queue.length === 0) {
|
|
1602
|
-
ReadableStreamDefaultControllerClearAlgorithms(controller);
|
|
1603
|
-
ReadableStreamClose(stream);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
|
|
1607
|
-
var stream = controller._controlledReadableStream;
|
|
1608
|
-
if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
|
|
1609
|
-
ReadableStreamFulfillReadRequest(stream, chunk, false);
|
|
1610
|
-
} else {
|
|
1611
|
-
var chunkSize = void 0;
|
|
1612
|
-
try {
|
|
1613
|
-
chunkSize = controller._strategySizeAlgorithm(chunk);
|
|
1614
|
-
} catch (chunkSizeE) {
|
|
1615
|
-
ReadableStreamDefaultControllerError(controller, chunkSizeE);
|
|
1616
|
-
throw chunkSizeE;
|
|
1617
|
-
}
|
|
1618
|
-
try {
|
|
1619
|
-
EnqueueValueWithSize(controller, chunk, chunkSize);
|
|
1620
|
-
} catch (enqueueE) {
|
|
1621
|
-
ReadableStreamDefaultControllerError(controller, enqueueE);
|
|
1622
|
-
throw enqueueE;
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
1626
|
-
}
|
|
1627
|
-
function ReadableStreamDefaultControllerError(controller, e) {
|
|
1628
|
-
var stream = controller._controlledReadableStream;
|
|
1629
|
-
if (stream._state !== "readable") {
|
|
1630
|
-
return;
|
|
1631
|
-
}
|
|
1632
|
-
ResetQueue(controller);
|
|
1633
|
-
ReadableStreamDefaultControllerClearAlgorithms(controller);
|
|
1634
|
-
ReadableStreamError(stream, e);
|
|
1635
|
-
}
|
|
1636
|
-
function ReadableStreamDefaultControllerGetDesiredSize(controller) {
|
|
1637
|
-
var stream = controller._controlledReadableStream;
|
|
1638
|
-
var state = stream._state;
|
|
1639
|
-
if (state === "errored") {
|
|
1640
|
-
return null;
|
|
1641
|
-
}
|
|
1642
|
-
if (state === "closed") {
|
|
1643
|
-
return 0;
|
|
1644
|
-
}
|
|
1645
|
-
return controller._strategyHWM - controller._queueTotalSize;
|
|
1646
|
-
}
|
|
1647
|
-
function ReadableStreamDefaultControllerHasBackpressure(controller) {
|
|
1648
|
-
if (ReadableStreamDefaultControllerShouldCallPull(controller) === true) {
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
return true;
|
|
1652
|
-
}
|
|
1653
|
-
function ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) {
|
|
1654
|
-
var state = controller._controlledReadableStream._state;
|
|
1655
|
-
if (controller._closeRequested === false && state === "readable") {
|
|
1656
|
-
return true;
|
|
1657
|
-
}
|
|
1658
|
-
return false;
|
|
1659
|
-
}
|
|
1660
|
-
function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
1661
|
-
controller._controlledReadableStream = stream;
|
|
1662
|
-
controller._queue = void 0;
|
|
1663
|
-
controller._queueTotalSize = void 0;
|
|
1664
|
-
ResetQueue(controller);
|
|
1665
|
-
controller._started = false;
|
|
1666
|
-
controller._closeRequested = false;
|
|
1667
|
-
controller._pullAgain = false;
|
|
1668
|
-
controller._pulling = false;
|
|
1669
|
-
controller._strategySizeAlgorithm = sizeAlgorithm;
|
|
1670
|
-
controller._strategyHWM = highWaterMark;
|
|
1671
|
-
controller._pullAlgorithm = pullAlgorithm;
|
|
1672
|
-
controller._cancelAlgorithm = cancelAlgorithm;
|
|
1673
|
-
stream._readableStreamController = controller;
|
|
1674
|
-
var startResult = startAlgorithm();
|
|
1675
|
-
uponPromise(promiseResolvedWith(startResult), function() {
|
|
1676
|
-
controller._started = true;
|
|
1677
|
-
ReadableStreamDefaultControllerCallPullIfNeeded(controller);
|
|
1678
|
-
}, function(r) {
|
|
1679
|
-
ReadableStreamDefaultControllerError(controller, r);
|
|
1680
|
-
});
|
|
1681
|
-
}
|
|
1682
|
-
function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
|
|
1683
|
-
var controller = Object.create(ReadableStreamDefaultController.prototype);
|
|
1684
|
-
function startAlgorithm() {
|
|
1685
|
-
return InvokeOrNoop(underlyingSource, "start", [controller]);
|
|
1686
|
-
}
|
|
1687
|
-
var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, "pull", 0, [controller]);
|
|
1688
|
-
var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, "cancel", 1, []);
|
|
1689
|
-
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
1690
|
-
}
|
|
1691
|
-
function defaultControllerBrandCheckException(name) {
|
|
1692
|
-
return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
|
|
1693
|
-
}
|
|
1694
|
-
function ReadableStreamTee(stream, cloneForBranch2) {
|
|
1695
|
-
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
1696
|
-
var reading = false;
|
|
1697
|
-
var canceled1 = false;
|
|
1698
|
-
var canceled2 = false;
|
|
1699
|
-
var reason1;
|
|
1700
|
-
var reason2;
|
|
1701
|
-
var branch1;
|
|
1702
|
-
var branch2;
|
|
1703
|
-
var resolveCancelPromise;
|
|
1704
|
-
var cancelPromise = newPromise(function(resolve) {
|
|
1705
|
-
resolveCancelPromise = resolve;
|
|
1706
|
-
});
|
|
1707
|
-
function pullAlgorithm() {
|
|
1708
|
-
if (reading === true) {
|
|
1709
|
-
return promiseResolvedWith(void 0);
|
|
1710
|
-
}
|
|
1711
|
-
reading = true;
|
|
1712
|
-
var readPromise = transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function(result) {
|
|
1713
|
-
reading = false;
|
|
1714
|
-
var done = result.done;
|
|
1715
|
-
if (done === true) {
|
|
1716
|
-
if (canceled1 === false) {
|
|
1717
|
-
ReadableStreamDefaultControllerClose(branch1._readableStreamController);
|
|
1718
|
-
}
|
|
1719
|
-
if (canceled2 === false) {
|
|
1720
|
-
ReadableStreamDefaultControllerClose(branch2._readableStreamController);
|
|
1721
|
-
}
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
var value = result.value;
|
|
1725
|
-
var value1 = value;
|
|
1726
|
-
var value2 = value;
|
|
1727
|
-
if (canceled1 === false) {
|
|
1728
|
-
ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, value1);
|
|
1729
|
-
}
|
|
1730
|
-
if (canceled2 === false) {
|
|
1731
|
-
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2);
|
|
1732
|
-
}
|
|
1733
|
-
});
|
|
1734
|
-
setPromiseIsHandledToTrue(readPromise);
|
|
1735
|
-
return promiseResolvedWith(void 0);
|
|
1736
|
-
}
|
|
1737
|
-
function cancel1Algorithm(reason) {
|
|
1738
|
-
canceled1 = true;
|
|
1739
|
-
reason1 = reason;
|
|
1740
|
-
if (canceled2 === true) {
|
|
1741
|
-
var compositeReason = createArrayFromList([reason1, reason2]);
|
|
1742
|
-
var cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
1743
|
-
resolveCancelPromise(cancelResult);
|
|
1744
|
-
}
|
|
1745
|
-
return cancelPromise;
|
|
1746
|
-
}
|
|
1747
|
-
function cancel2Algorithm(reason) {
|
|
1748
|
-
canceled2 = true;
|
|
1749
|
-
reason2 = reason;
|
|
1750
|
-
if (canceled1 === true) {
|
|
1751
|
-
var compositeReason = createArrayFromList([reason1, reason2]);
|
|
1752
|
-
var cancelResult = ReadableStreamCancel(stream, compositeReason);
|
|
1753
|
-
resolveCancelPromise(cancelResult);
|
|
1754
|
-
}
|
|
1755
|
-
return cancelPromise;
|
|
1756
|
-
}
|
|
1757
|
-
function startAlgorithm() {
|
|
1758
|
-
}
|
|
1759
|
-
branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);
|
|
1760
|
-
branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);
|
|
1761
|
-
uponRejection(reader._closedPromise, function(r) {
|
|
1762
|
-
ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
|
|
1763
|
-
ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
|
|
1764
|
-
});
|
|
1765
|
-
return [branch1, branch2];
|
|
1766
|
-
}
|
|
1767
|
-
var NumberIsInteger = Number.isInteger || function(value) {
|
|
1768
|
-
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
|
1769
|
-
};
|
|
1770
|
-
var ReadableStreamBYOBRequest = function() {
|
|
1771
|
-
function ReadableStreamBYOBRequest2() {
|
|
1772
|
-
throw new TypeError("ReadableStreamBYOBRequest cannot be used directly");
|
|
1773
|
-
}
|
|
1774
|
-
Object.defineProperty(ReadableStreamBYOBRequest2.prototype, "view", {
|
|
1775
|
-
get: function() {
|
|
1776
|
-
if (IsReadableStreamBYOBRequest(this) === false) {
|
|
1777
|
-
throw byobRequestBrandCheckException("view");
|
|
1778
|
-
}
|
|
1779
|
-
return this._view;
|
|
1780
|
-
},
|
|
1781
|
-
enumerable: true,
|
|
1782
|
-
configurable: true
|
|
1783
|
-
});
|
|
1784
|
-
ReadableStreamBYOBRequest2.prototype.respond = function(bytesWritten) {
|
|
1785
|
-
if (IsReadableStreamBYOBRequest(this) === false) {
|
|
1786
|
-
throw byobRequestBrandCheckException("respond");
|
|
1787
|
-
}
|
|
1788
|
-
if (this._associatedReadableByteStreamController === void 0) {
|
|
1789
|
-
throw new TypeError("This BYOB request has been invalidated");
|
|
1790
|
-
}
|
|
1791
|
-
if (IsDetachedBuffer(this._view.buffer) === true)
|
|
1792
|
-
;
|
|
1793
|
-
ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
|
|
1794
|
-
};
|
|
1795
|
-
ReadableStreamBYOBRequest2.prototype.respondWithNewView = function(view) {
|
|
1796
|
-
if (IsReadableStreamBYOBRequest(this) === false) {
|
|
1797
|
-
throw byobRequestBrandCheckException("respond");
|
|
1798
|
-
}
|
|
1799
|
-
if (this._associatedReadableByteStreamController === void 0) {
|
|
1800
|
-
throw new TypeError("This BYOB request has been invalidated");
|
|
1801
|
-
}
|
|
1802
|
-
if (!ArrayBuffer.isView(view)) {
|
|
1803
|
-
throw new TypeError("You can only respond with array buffer views");
|
|
1804
|
-
}
|
|
1805
|
-
if (IsDetachedBuffer(view.buffer) === true)
|
|
1806
|
-
;
|
|
1807
|
-
ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
|
|
1808
|
-
};
|
|
1809
|
-
return ReadableStreamBYOBRequest2;
|
|
1810
|
-
}();
|
|
1811
|
-
var ReadableByteStreamController = function() {
|
|
1812
|
-
function ReadableByteStreamController2() {
|
|
1813
|
-
throw new TypeError("ReadableByteStreamController constructor cannot be used directly");
|
|
1814
|
-
}
|
|
1815
|
-
Object.defineProperty(ReadableByteStreamController2.prototype, "byobRequest", {
|
|
1816
|
-
get: function() {
|
|
1817
|
-
if (IsReadableByteStreamController(this) === false) {
|
|
1818
|
-
throw byteStreamControllerBrandCheckException("byobRequest");
|
|
1819
|
-
}
|
|
1820
|
-
if (this._byobRequest === void 0 && this._pendingPullIntos.length > 0) {
|
|
1821
|
-
var firstDescriptor = this._pendingPullIntos.peek();
|
|
1822
|
-
var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
|
|
1823
|
-
var byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
|
|
1824
|
-
SetUpReadableStreamBYOBRequest(byobRequest, this, view);
|
|
1825
|
-
this._byobRequest = byobRequest;
|
|
1826
|
-
}
|
|
1827
|
-
return this._byobRequest;
|
|
1828
|
-
},
|
|
1829
|
-
enumerable: true,
|
|
1830
|
-
configurable: true
|
|
1831
|
-
});
|
|
1832
|
-
Object.defineProperty(ReadableByteStreamController2.prototype, "desiredSize", {
|
|
1833
|
-
get: function() {
|
|
1834
|
-
if (IsReadableByteStreamController(this) === false) {
|
|
1835
|
-
throw byteStreamControllerBrandCheckException("desiredSize");
|
|
1836
|
-
}
|
|
1837
|
-
return ReadableByteStreamControllerGetDesiredSize(this);
|
|
1838
|
-
},
|
|
1839
|
-
enumerable: true,
|
|
1840
|
-
configurable: true
|
|
1841
|
-
});
|
|
1842
|
-
ReadableByteStreamController2.prototype.close = function() {
|
|
1843
|
-
if (IsReadableByteStreamController(this) === false) {
|
|
1844
|
-
throw byteStreamControllerBrandCheckException("close");
|
|
1845
|
-
}
|
|
1846
|
-
if (this._closeRequested === true) {
|
|
1847
|
-
throw new TypeError("The stream has already been closed; do not close it again!");
|
|
1848
|
-
}
|
|
1849
|
-
var state = this._controlledReadableByteStream._state;
|
|
1850
|
-
if (state !== "readable") {
|
|
1851
|
-
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed");
|
|
1852
|
-
}
|
|
1853
|
-
ReadableByteStreamControllerClose(this);
|
|
1854
|
-
};
|
|
1855
|
-
ReadableByteStreamController2.prototype.enqueue = function(chunk) {
|
|
1856
|
-
if (IsReadableByteStreamController(this) === false) {
|
|
1857
|
-
throw byteStreamControllerBrandCheckException("enqueue");
|
|
1858
|
-
}
|
|
1859
|
-
if (this._closeRequested === true) {
|
|
1860
|
-
throw new TypeError("stream is closed or draining");
|
|
1861
|
-
}
|
|
1862
|
-
var state = this._controlledReadableByteStream._state;
|
|
1863
|
-
if (state !== "readable") {
|
|
1864
|
-
throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to");
|
|
1865
|
-
}
|
|
1866
|
-
if (!ArrayBuffer.isView(chunk)) {
|
|
1867
|
-
throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");
|
|
1868
|
-
}
|
|
1869
|
-
if (IsDetachedBuffer(chunk.buffer) === true)
|
|
1870
|
-
;
|
|
1871
|
-
ReadableByteStreamControllerEnqueue(this, chunk);
|
|
1872
|
-
};
|
|
1873
|
-
ReadableByteStreamController2.prototype.error = function(e) {
|
|
1874
|
-
if (IsReadableByteStreamController(this) === false) {
|
|
1875
|
-
throw byteStreamControllerBrandCheckException("error");
|
|
1876
|
-
}
|
|
1877
|
-
ReadableByteStreamControllerError(this, e);
|
|
1878
|
-
};
|
|
1879
|
-
ReadableByteStreamController2.prototype[CancelSteps] = function(reason) {
|
|
1880
|
-
if (this._pendingPullIntos.length > 0) {
|
|
1881
|
-
var firstDescriptor = this._pendingPullIntos.peek();
|
|
1882
|
-
firstDescriptor.bytesFilled = 0;
|
|
1883
|
-
}
|
|
1884
|
-
ResetQueue(this);
|
|
1885
|
-
var result = this._cancelAlgorithm(reason);
|
|
1886
|
-
ReadableByteStreamControllerClearAlgorithms(this);
|
|
1887
|
-
return result;
|
|
1888
|
-
};
|
|
1889
|
-
ReadableByteStreamController2.prototype[PullSteps] = function() {
|
|
1890
|
-
var stream = this._controlledReadableByteStream;
|
|
1891
|
-
if (this._queueTotalSize > 0) {
|
|
1892
|
-
var entry = this._queue.shift();
|
|
1893
|
-
this._queueTotalSize -= entry.byteLength;
|
|
1894
|
-
ReadableByteStreamControllerHandleQueueDrain(this);
|
|
1895
|
-
var view = void 0;
|
|
1896
|
-
try {
|
|
1897
|
-
view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
|
|
1898
|
-
} catch (viewE) {
|
|
1899
|
-
return promiseRejectedWith(viewE);
|
|
1900
|
-
}
|
|
1901
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(view, false, stream._reader._forAuthorCode));
|
|
1902
|
-
}
|
|
1903
|
-
var autoAllocateChunkSize = this._autoAllocateChunkSize;
|
|
1904
|
-
if (autoAllocateChunkSize !== void 0) {
|
|
1905
|
-
var buffer = void 0;
|
|
1906
|
-
try {
|
|
1907
|
-
buffer = new ArrayBuffer(autoAllocateChunkSize);
|
|
1908
|
-
} catch (bufferE) {
|
|
1909
|
-
return promiseRejectedWith(bufferE);
|
|
1910
|
-
}
|
|
1911
|
-
var pullIntoDescriptor = {
|
|
1912
|
-
buffer,
|
|
1913
|
-
byteOffset: 0,
|
|
1914
|
-
byteLength: autoAllocateChunkSize,
|
|
1915
|
-
bytesFilled: 0,
|
|
1916
|
-
elementSize: 1,
|
|
1917
|
-
ctor: Uint8Array,
|
|
1918
|
-
readerType: "default"
|
|
1919
|
-
};
|
|
1920
|
-
this._pendingPullIntos.push(pullIntoDescriptor);
|
|
1921
|
-
}
|
|
1922
|
-
var promise = ReadableStreamAddReadRequest(stream);
|
|
1923
|
-
ReadableByteStreamControllerCallPullIfNeeded(this);
|
|
1924
|
-
return promise;
|
|
1925
|
-
};
|
|
1926
|
-
return ReadableByteStreamController2;
|
|
1927
|
-
}();
|
|
1928
|
-
function IsReadableByteStreamController(x) {
|
|
1929
|
-
if (!typeIsObject(x)) {
|
|
1930
|
-
return false;
|
|
1931
|
-
}
|
|
1932
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_controlledReadableByteStream")) {
|
|
1933
|
-
return false;
|
|
1934
|
-
}
|
|
1935
|
-
return true;
|
|
1936
|
-
}
|
|
1937
|
-
function IsReadableStreamBYOBRequest(x) {
|
|
1938
|
-
if (!typeIsObject(x)) {
|
|
1939
|
-
return false;
|
|
1940
|
-
}
|
|
1941
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_associatedReadableByteStreamController")) {
|
|
1942
|
-
return false;
|
|
1943
|
-
}
|
|
1944
|
-
return true;
|
|
1945
|
-
}
|
|
1946
|
-
function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
1947
|
-
var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
|
|
1948
|
-
if (shouldPull === false) {
|
|
1949
|
-
return;
|
|
1950
|
-
}
|
|
1951
|
-
if (controller._pulling === true) {
|
|
1952
|
-
controller._pullAgain = true;
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
controller._pulling = true;
|
|
1956
|
-
var pullPromise = controller._pullAlgorithm();
|
|
1957
|
-
uponPromise(pullPromise, function() {
|
|
1958
|
-
controller._pulling = false;
|
|
1959
|
-
if (controller._pullAgain === true) {
|
|
1960
|
-
controller._pullAgain = false;
|
|
1961
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
1962
|
-
}
|
|
1963
|
-
}, function(e) {
|
|
1964
|
-
ReadableByteStreamControllerError(controller, e);
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
function ReadableByteStreamControllerClearPendingPullIntos(controller) {
|
|
1968
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
1969
|
-
controller._pendingPullIntos = new SimpleQueue();
|
|
1970
|
-
}
|
|
1971
|
-
function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
|
|
1972
|
-
var done = false;
|
|
1973
|
-
if (stream._state === "closed") {
|
|
1974
|
-
done = true;
|
|
1975
|
-
}
|
|
1976
|
-
var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
|
|
1977
|
-
if (pullIntoDescriptor.readerType === "default") {
|
|
1978
|
-
ReadableStreamFulfillReadRequest(stream, filledView, done);
|
|
1979
|
-
} else {
|
|
1980
|
-
ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
|
|
1984
|
-
var bytesFilled = pullIntoDescriptor.bytesFilled;
|
|
1985
|
-
var elementSize = pullIntoDescriptor.elementSize;
|
|
1986
|
-
return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
|
|
1987
|
-
}
|
|
1988
|
-
function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
|
|
1989
|
-
controller._queue.push({ buffer, byteOffset, byteLength });
|
|
1990
|
-
controller._queueTotalSize += byteLength;
|
|
1991
|
-
}
|
|
1992
|
-
function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
|
|
1993
|
-
var elementSize = pullIntoDescriptor.elementSize;
|
|
1994
|
-
var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
|
|
1995
|
-
var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
|
|
1996
|
-
var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
|
|
1997
|
-
var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
|
|
1998
|
-
var totalBytesToCopyRemaining = maxBytesToCopy;
|
|
1999
|
-
var ready = false;
|
|
2000
|
-
if (maxAlignedBytes > currentAlignedBytes) {
|
|
2001
|
-
totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
|
|
2002
|
-
ready = true;
|
|
2003
|
-
}
|
|
2004
|
-
var queue = controller._queue;
|
|
2005
|
-
while (totalBytesToCopyRemaining > 0) {
|
|
2006
|
-
var headOfQueue = queue.peek();
|
|
2007
|
-
var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
|
|
2008
|
-
var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
2009
|
-
ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
|
|
2010
|
-
if (headOfQueue.byteLength === bytesToCopy) {
|
|
2011
|
-
queue.shift();
|
|
2012
|
-
} else {
|
|
2013
|
-
headOfQueue.byteOffset += bytesToCopy;
|
|
2014
|
-
headOfQueue.byteLength -= bytesToCopy;
|
|
2015
|
-
}
|
|
2016
|
-
controller._queueTotalSize -= bytesToCopy;
|
|
2017
|
-
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
|
|
2018
|
-
totalBytesToCopyRemaining -= bytesToCopy;
|
|
2019
|
-
}
|
|
2020
|
-
return ready;
|
|
2021
|
-
}
|
|
2022
|
-
function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
|
|
2023
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
2024
|
-
pullIntoDescriptor.bytesFilled += size;
|
|
2025
|
-
}
|
|
2026
|
-
function ReadableByteStreamControllerHandleQueueDrain(controller) {
|
|
2027
|
-
if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
|
|
2028
|
-
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
2029
|
-
ReadableStreamClose(controller._controlledReadableByteStream);
|
|
2030
|
-
} else {
|
|
2031
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
|
|
2035
|
-
if (controller._byobRequest === void 0) {
|
|
2036
|
-
return;
|
|
2037
|
-
}
|
|
2038
|
-
controller._byobRequest._associatedReadableByteStreamController = void 0;
|
|
2039
|
-
controller._byobRequest._view = void 0;
|
|
2040
|
-
controller._byobRequest = void 0;
|
|
2041
|
-
}
|
|
2042
|
-
function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
|
|
2043
|
-
while (controller._pendingPullIntos.length > 0) {
|
|
2044
|
-
if (controller._queueTotalSize === 0) {
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
|
-
var pullIntoDescriptor = controller._pendingPullIntos.peek();
|
|
2048
|
-
if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
|
|
2049
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
2050
|
-
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
function ReadableByteStreamControllerPullInto(controller, view) {
|
|
2055
|
-
var stream = controller._controlledReadableByteStream;
|
|
2056
|
-
var elementSize = 1;
|
|
2057
|
-
if (view.constructor !== DataView) {
|
|
2058
|
-
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
|
2059
|
-
}
|
|
2060
|
-
var ctor = view.constructor;
|
|
2061
|
-
var buffer = TransferArrayBuffer(view.buffer);
|
|
2062
|
-
var pullIntoDescriptor = {
|
|
2063
|
-
buffer,
|
|
2064
|
-
byteOffset: view.byteOffset,
|
|
2065
|
-
byteLength: view.byteLength,
|
|
2066
|
-
bytesFilled: 0,
|
|
2067
|
-
elementSize,
|
|
2068
|
-
ctor,
|
|
2069
|
-
readerType: "byob"
|
|
2070
|
-
};
|
|
2071
|
-
if (controller._pendingPullIntos.length > 0) {
|
|
2072
|
-
controller._pendingPullIntos.push(pullIntoDescriptor);
|
|
2073
|
-
return ReadableStreamAddReadIntoRequest(stream);
|
|
2074
|
-
}
|
|
2075
|
-
if (stream._state === "closed") {
|
|
2076
|
-
var emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
|
|
2077
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(emptyView, true, stream._reader._forAuthorCode));
|
|
2078
|
-
}
|
|
2079
|
-
if (controller._queueTotalSize > 0) {
|
|
2080
|
-
if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
|
|
2081
|
-
var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
|
|
2082
|
-
ReadableByteStreamControllerHandleQueueDrain(controller);
|
|
2083
|
-
return promiseResolvedWith(ReadableStreamCreateReadResult(filledView, false, stream._reader._forAuthorCode));
|
|
2084
|
-
}
|
|
2085
|
-
if (controller._closeRequested === true) {
|
|
2086
|
-
var e = new TypeError("Insufficient bytes to fill elements in the given buffer");
|
|
2087
|
-
ReadableByteStreamControllerError(controller, e);
|
|
2088
|
-
return promiseRejectedWith(e);
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
controller._pendingPullIntos.push(pullIntoDescriptor);
|
|
2092
|
-
var promise = ReadableStreamAddReadIntoRequest(stream);
|
|
2093
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
2094
|
-
return promise;
|
|
2095
|
-
}
|
|
2096
|
-
function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
|
|
2097
|
-
firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
|
|
2098
|
-
var stream = controller._controlledReadableByteStream;
|
|
2099
|
-
if (ReadableStreamHasBYOBReader(stream) === true) {
|
|
2100
|
-
while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
2101
|
-
var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
2102
|
-
ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
|
|
2107
|
-
if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
|
|
2108
|
-
throw new RangeError("bytesWritten out of range");
|
|
2109
|
-
}
|
|
2110
|
-
ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
|
|
2111
|
-
if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
2115
|
-
var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
|
|
2116
|
-
if (remainderSize > 0) {
|
|
2117
|
-
var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
|
|
2118
|
-
var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
|
|
2119
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
|
|
2120
|
-
}
|
|
2121
|
-
pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
|
|
2122
|
-
pullIntoDescriptor.bytesFilled -= remainderSize;
|
|
2123
|
-
ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
|
|
2124
|
-
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
2125
|
-
}
|
|
2126
|
-
function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
|
|
2127
|
-
var firstDescriptor = controller._pendingPullIntos.peek();
|
|
2128
|
-
var stream = controller._controlledReadableByteStream;
|
|
2129
|
-
if (stream._state === "closed") {
|
|
2130
|
-
if (bytesWritten !== 0) {
|
|
2131
|
-
throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");
|
|
2132
|
-
}
|
|
2133
|
-
ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
|
|
2134
|
-
} else {
|
|
2135
|
-
ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
|
|
2136
|
-
}
|
|
2137
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
2138
|
-
}
|
|
2139
|
-
function ReadableByteStreamControllerShiftPendingPullInto(controller) {
|
|
2140
|
-
var descriptor = controller._pendingPullIntos.shift();
|
|
2141
|
-
ReadableByteStreamControllerInvalidateBYOBRequest(controller);
|
|
2142
|
-
return descriptor;
|
|
2143
|
-
}
|
|
2144
|
-
function ReadableByteStreamControllerShouldCallPull(controller) {
|
|
2145
|
-
var stream = controller._controlledReadableByteStream;
|
|
2146
|
-
if (stream._state !== "readable") {
|
|
2147
|
-
return false;
|
|
2148
|
-
}
|
|
2149
|
-
if (controller._closeRequested === true) {
|
|
2150
|
-
return false;
|
|
2151
|
-
}
|
|
2152
|
-
if (controller._started === false) {
|
|
2153
|
-
return false;
|
|
2154
|
-
}
|
|
2155
|
-
if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
|
|
2156
|
-
return true;
|
|
2157
|
-
}
|
|
2158
|
-
if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
|
|
2159
|
-
return true;
|
|
2160
|
-
}
|
|
2161
|
-
var desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);
|
|
2162
|
-
if (desiredSize > 0) {
|
|
2163
|
-
return true;
|
|
2164
|
-
}
|
|
2165
|
-
return false;
|
|
2166
|
-
}
|
|
2167
|
-
function ReadableByteStreamControllerClearAlgorithms(controller) {
|
|
2168
|
-
controller._pullAlgorithm = void 0;
|
|
2169
|
-
controller._cancelAlgorithm = void 0;
|
|
2170
|
-
}
|
|
2171
|
-
function ReadableByteStreamControllerClose(controller) {
|
|
2172
|
-
var stream = controller._controlledReadableByteStream;
|
|
2173
|
-
if (controller._queueTotalSize > 0) {
|
|
2174
|
-
controller._closeRequested = true;
|
|
2175
|
-
return;
|
|
2176
|
-
}
|
|
2177
|
-
if (controller._pendingPullIntos.length > 0) {
|
|
2178
|
-
var firstPendingPullInto = controller._pendingPullIntos.peek();
|
|
2179
|
-
if (firstPendingPullInto.bytesFilled > 0) {
|
|
2180
|
-
var e = new TypeError("Insufficient bytes to fill elements in the given buffer");
|
|
2181
|
-
ReadableByteStreamControllerError(controller, e);
|
|
2182
|
-
throw e;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
2186
|
-
ReadableStreamClose(stream);
|
|
2187
|
-
}
|
|
2188
|
-
function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
2189
|
-
var stream = controller._controlledReadableByteStream;
|
|
2190
|
-
var buffer = chunk.buffer;
|
|
2191
|
-
var byteOffset = chunk.byteOffset;
|
|
2192
|
-
var byteLength = chunk.byteLength;
|
|
2193
|
-
var transferredBuffer = TransferArrayBuffer(buffer);
|
|
2194
|
-
if (ReadableStreamHasDefaultReader(stream) === true) {
|
|
2195
|
-
if (ReadableStreamGetNumReadRequests(stream) === 0) {
|
|
2196
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
2197
|
-
} else {
|
|
2198
|
-
var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
|
|
2199
|
-
ReadableStreamFulfillReadRequest(stream, transferredView, false);
|
|
2200
|
-
}
|
|
2201
|
-
} else if (ReadableStreamHasBYOBReader(stream) === true) {
|
|
2202
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
2203
|
-
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
|
|
2204
|
-
} else {
|
|
2205
|
-
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
2206
|
-
}
|
|
2207
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
2208
|
-
}
|
|
2209
|
-
function ReadableByteStreamControllerError(controller, e) {
|
|
2210
|
-
var stream = controller._controlledReadableByteStream;
|
|
2211
|
-
if (stream._state !== "readable") {
|
|
2212
|
-
return;
|
|
2213
|
-
}
|
|
2214
|
-
ReadableByteStreamControllerClearPendingPullIntos(controller);
|
|
2215
|
-
ResetQueue(controller);
|
|
2216
|
-
ReadableByteStreamControllerClearAlgorithms(controller);
|
|
2217
|
-
ReadableStreamError(stream, e);
|
|
2218
|
-
}
|
|
2219
|
-
function ReadableByteStreamControllerGetDesiredSize(controller) {
|
|
2220
|
-
var stream = controller._controlledReadableByteStream;
|
|
2221
|
-
var state = stream._state;
|
|
2222
|
-
if (state === "errored") {
|
|
2223
|
-
return null;
|
|
2224
|
-
}
|
|
2225
|
-
if (state === "closed") {
|
|
2226
|
-
return 0;
|
|
2227
|
-
}
|
|
2228
|
-
return controller._strategyHWM - controller._queueTotalSize;
|
|
2229
|
-
}
|
|
2230
|
-
function ReadableByteStreamControllerRespond(controller, bytesWritten) {
|
|
2231
|
-
bytesWritten = Number(bytesWritten);
|
|
2232
|
-
if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
|
|
2233
|
-
throw new RangeError("bytesWritten must be a finite");
|
|
2234
|
-
}
|
|
2235
|
-
ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
|
|
2236
|
-
}
|
|
2237
|
-
function ReadableByteStreamControllerRespondWithNewView(controller, view) {
|
|
2238
|
-
var firstDescriptor = controller._pendingPullIntos.peek();
|
|
2239
|
-
if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
|
|
2240
|
-
throw new RangeError("The region specified by view does not match byobRequest");
|
|
2241
|
-
}
|
|
2242
|
-
if (firstDescriptor.byteLength !== view.byteLength) {
|
|
2243
|
-
throw new RangeError("The buffer of view has different capacity than byobRequest");
|
|
2244
|
-
}
|
|
2245
|
-
firstDescriptor.buffer = view.buffer;
|
|
2246
|
-
ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
|
|
2247
|
-
}
|
|
2248
|
-
function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
|
|
2249
|
-
controller._controlledReadableByteStream = stream;
|
|
2250
|
-
controller._pullAgain = false;
|
|
2251
|
-
controller._pulling = false;
|
|
2252
|
-
controller._byobRequest = void 0;
|
|
2253
|
-
controller._queue = controller._queueTotalSize = void 0;
|
|
2254
|
-
ResetQueue(controller);
|
|
2255
|
-
controller._closeRequested = false;
|
|
2256
|
-
controller._started = false;
|
|
2257
|
-
controller._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
|
|
2258
|
-
controller._pullAlgorithm = pullAlgorithm;
|
|
2259
|
-
controller._cancelAlgorithm = cancelAlgorithm;
|
|
2260
|
-
controller._autoAllocateChunkSize = autoAllocateChunkSize;
|
|
2261
|
-
controller._pendingPullIntos = new SimpleQueue();
|
|
2262
|
-
stream._readableStreamController = controller;
|
|
2263
|
-
var startResult = startAlgorithm();
|
|
2264
|
-
uponPromise(promiseResolvedWith(startResult), function() {
|
|
2265
|
-
controller._started = true;
|
|
2266
|
-
ReadableByteStreamControllerCallPullIfNeeded(controller);
|
|
2267
|
-
}, function(r) {
|
|
2268
|
-
ReadableByteStreamControllerError(controller, r);
|
|
2269
|
-
});
|
|
2270
|
-
}
|
|
2271
|
-
function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
|
|
2272
|
-
var controller = Object.create(ReadableByteStreamController.prototype);
|
|
2273
|
-
function startAlgorithm() {
|
|
2274
|
-
return InvokeOrNoop(underlyingByteSource, "start", [controller]);
|
|
2275
|
-
}
|
|
2276
|
-
var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, "pull", 0, [controller]);
|
|
2277
|
-
var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, "cancel", 1, []);
|
|
2278
|
-
var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
|
|
2279
|
-
if (autoAllocateChunkSize !== void 0) {
|
|
2280
|
-
autoAllocateChunkSize = Number(autoAllocateChunkSize);
|
|
2281
|
-
if (NumberIsInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
|
|
2282
|
-
throw new RangeError("autoAllocateChunkSize must be a positive integer");
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
|
|
2286
|
-
}
|
|
2287
|
-
function SetUpReadableStreamBYOBRequest(request, controller, view) {
|
|
2288
|
-
request._associatedReadableByteStreamController = controller;
|
|
2289
|
-
request._view = view;
|
|
2290
|
-
}
|
|
2291
|
-
function byobRequestBrandCheckException(name) {
|
|
2292
|
-
return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest");
|
|
2293
|
-
}
|
|
2294
|
-
function byteStreamControllerBrandCheckException(name) {
|
|
2295
|
-
return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController");
|
|
2296
|
-
}
|
|
2297
|
-
function AcquireReadableStreamBYOBReader(stream, forAuthorCode) {
|
|
2298
|
-
if (forAuthorCode === void 0) {
|
|
2299
|
-
forAuthorCode = false;
|
|
2300
|
-
}
|
|
2301
|
-
var reader = new ReadableStreamBYOBReader(stream);
|
|
2302
|
-
reader._forAuthorCode = forAuthorCode;
|
|
2303
|
-
return reader;
|
|
2304
|
-
}
|
|
2305
|
-
function ReadableStreamAddReadIntoRequest(stream) {
|
|
2306
|
-
var promise = newPromise(function(resolve, reject) {
|
|
2307
|
-
var readIntoRequest = {
|
|
2308
|
-
_resolve: resolve,
|
|
2309
|
-
_reject: reject
|
|
2310
|
-
};
|
|
2311
|
-
stream._reader._readIntoRequests.push(readIntoRequest);
|
|
2312
|
-
});
|
|
2313
|
-
return promise;
|
|
2314
|
-
}
|
|
2315
|
-
function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
|
|
2316
|
-
var reader = stream._reader;
|
|
2317
|
-
var readIntoRequest = reader._readIntoRequests.shift();
|
|
2318
|
-
readIntoRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
|
|
2319
|
-
}
|
|
2320
|
-
function ReadableStreamGetNumReadIntoRequests(stream) {
|
|
2321
|
-
return stream._reader._readIntoRequests.length;
|
|
2322
|
-
}
|
|
2323
|
-
function ReadableStreamHasBYOBReader(stream) {
|
|
2324
|
-
var reader = stream._reader;
|
|
2325
|
-
if (reader === void 0) {
|
|
2326
|
-
return false;
|
|
2327
|
-
}
|
|
2328
|
-
if (!IsReadableStreamBYOBReader(reader)) {
|
|
2329
|
-
return false;
|
|
2330
|
-
}
|
|
2331
|
-
return true;
|
|
2332
|
-
}
|
|
2333
|
-
var ReadableStreamBYOBReader = function() {
|
|
2334
|
-
function ReadableStreamBYOBReader2(stream) {
|
|
2335
|
-
if (!IsReadableStream(stream)) {
|
|
2336
|
-
throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");
|
|
2337
|
-
}
|
|
2338
|
-
if (IsReadableByteStreamController(stream._readableStreamController) === false) {
|
|
2339
|
-
throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");
|
|
2340
|
-
}
|
|
2341
|
-
if (IsReadableStreamLocked(stream)) {
|
|
2342
|
-
throw new TypeError("This stream has already been locked for exclusive reading by another reader");
|
|
2343
|
-
}
|
|
2344
|
-
ReadableStreamReaderGenericInitialize(this, stream);
|
|
2345
|
-
this._readIntoRequests = new SimpleQueue();
|
|
2346
|
-
}
|
|
2347
|
-
Object.defineProperty(ReadableStreamBYOBReader2.prototype, "closed", {
|
|
2348
|
-
get: function() {
|
|
2349
|
-
if (!IsReadableStreamBYOBReader(this)) {
|
|
2350
|
-
return promiseRejectedWith(byobReaderBrandCheckException("closed"));
|
|
2351
|
-
}
|
|
2352
|
-
return this._closedPromise;
|
|
2353
|
-
},
|
|
2354
|
-
enumerable: true,
|
|
2355
|
-
configurable: true
|
|
2356
|
-
});
|
|
2357
|
-
ReadableStreamBYOBReader2.prototype.cancel = function(reason) {
|
|
2358
|
-
if (!IsReadableStreamBYOBReader(this)) {
|
|
2359
|
-
return promiseRejectedWith(byobReaderBrandCheckException("cancel"));
|
|
2360
|
-
}
|
|
2361
|
-
if (this._ownerReadableStream === void 0) {
|
|
2362
|
-
return promiseRejectedWith(readerLockException("cancel"));
|
|
2363
|
-
}
|
|
2364
|
-
return ReadableStreamReaderGenericCancel(this, reason);
|
|
2365
|
-
};
|
|
2366
|
-
ReadableStreamBYOBReader2.prototype.read = function(view) {
|
|
2367
|
-
if (!IsReadableStreamBYOBReader(this)) {
|
|
2368
|
-
return promiseRejectedWith(byobReaderBrandCheckException("read"));
|
|
2369
|
-
}
|
|
2370
|
-
if (this._ownerReadableStream === void 0) {
|
|
2371
|
-
return promiseRejectedWith(readerLockException("read from"));
|
|
2372
|
-
}
|
|
2373
|
-
if (!ArrayBuffer.isView(view)) {
|
|
2374
|
-
return promiseRejectedWith(new TypeError("view must be an array buffer view"));
|
|
2375
|
-
}
|
|
2376
|
-
if (IsDetachedBuffer(view.buffer) === true)
|
|
2377
|
-
;
|
|
2378
|
-
if (view.byteLength === 0) {
|
|
2379
|
-
return promiseRejectedWith(new TypeError("view must have non-zero byteLength"));
|
|
2380
|
-
}
|
|
2381
|
-
return ReadableStreamBYOBReaderRead(this, view);
|
|
2382
|
-
};
|
|
2383
|
-
ReadableStreamBYOBReader2.prototype.releaseLock = function() {
|
|
2384
|
-
if (!IsReadableStreamBYOBReader(this)) {
|
|
2385
|
-
throw byobReaderBrandCheckException("releaseLock");
|
|
2386
|
-
}
|
|
2387
|
-
if (this._ownerReadableStream === void 0) {
|
|
2388
|
-
return;
|
|
2389
|
-
}
|
|
2390
|
-
if (this._readIntoRequests.length > 0) {
|
|
2391
|
-
throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
|
|
2392
|
-
}
|
|
2393
|
-
ReadableStreamReaderGenericRelease(this);
|
|
2394
|
-
};
|
|
2395
|
-
return ReadableStreamBYOBReader2;
|
|
2396
|
-
}();
|
|
2397
|
-
function IsReadableStreamBYOBReader(x) {
|
|
2398
|
-
if (!typeIsObject(x)) {
|
|
2399
|
-
return false;
|
|
2400
|
-
}
|
|
2401
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_readIntoRequests")) {
|
|
2402
|
-
return false;
|
|
2403
|
-
}
|
|
2404
|
-
return true;
|
|
2405
|
-
}
|
|
2406
|
-
function ReadableStreamBYOBReaderRead(reader, view) {
|
|
2407
|
-
var stream = reader._ownerReadableStream;
|
|
2408
|
-
stream._disturbed = true;
|
|
2409
|
-
if (stream._state === "errored") {
|
|
2410
|
-
return promiseRejectedWith(stream._storedError);
|
|
2411
|
-
}
|
|
2412
|
-
return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
|
|
2413
|
-
}
|
|
2414
|
-
function byobReaderBrandCheckException(name) {
|
|
2415
|
-
return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader");
|
|
2416
|
-
}
|
|
2417
|
-
var ReadableStream = function() {
|
|
2418
|
-
function ReadableStream2(underlyingSource, strategy) {
|
|
2419
|
-
if (underlyingSource === void 0) {
|
|
2420
|
-
underlyingSource = {};
|
|
2421
|
-
}
|
|
2422
|
-
if (strategy === void 0) {
|
|
2423
|
-
strategy = {};
|
|
2424
|
-
}
|
|
2425
|
-
InitializeReadableStream(this);
|
|
2426
|
-
var size = strategy.size;
|
|
2427
|
-
var highWaterMark = strategy.highWaterMark;
|
|
2428
|
-
var type = underlyingSource.type;
|
|
2429
|
-
var typeString = String(type);
|
|
2430
|
-
if (typeString === "bytes") {
|
|
2431
|
-
if (size !== void 0) {
|
|
2432
|
-
throw new RangeError("The strategy for a byte stream cannot have a size function");
|
|
2433
|
-
}
|
|
2434
|
-
if (highWaterMark === void 0) {
|
|
2435
|
-
highWaterMark = 0;
|
|
2436
|
-
}
|
|
2437
|
-
highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
|
|
2438
|
-
SetUpReadableByteStreamControllerFromUnderlyingSource(this, underlyingSource, highWaterMark);
|
|
2439
|
-
} else if (type === void 0) {
|
|
2440
|
-
var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
|
|
2441
|
-
if (highWaterMark === void 0) {
|
|
2442
|
-
highWaterMark = 1;
|
|
2443
|
-
}
|
|
2444
|
-
highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
|
|
2445
|
-
SetUpReadableStreamDefaultControllerFromUnderlyingSource(this, underlyingSource, highWaterMark, sizeAlgorithm);
|
|
2446
|
-
} else {
|
|
2447
|
-
throw new RangeError("Invalid type is specified");
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
Object.defineProperty(ReadableStream2.prototype, "locked", {
|
|
2451
|
-
get: function() {
|
|
2452
|
-
if (IsReadableStream(this) === false) {
|
|
2453
|
-
throw streamBrandCheckException$1("locked");
|
|
2454
|
-
}
|
|
2455
|
-
return IsReadableStreamLocked(this);
|
|
2456
|
-
},
|
|
2457
|
-
enumerable: true,
|
|
2458
|
-
configurable: true
|
|
2459
|
-
});
|
|
2460
|
-
ReadableStream2.prototype.cancel = function(reason) {
|
|
2461
|
-
if (IsReadableStream(this) === false) {
|
|
2462
|
-
return promiseRejectedWith(streamBrandCheckException$1("cancel"));
|
|
2463
|
-
}
|
|
2464
|
-
if (IsReadableStreamLocked(this) === true) {
|
|
2465
|
-
return promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader"));
|
|
2466
|
-
}
|
|
2467
|
-
return ReadableStreamCancel(this, reason);
|
|
2468
|
-
};
|
|
2469
|
-
ReadableStream2.prototype.getReader = function(_a2) {
|
|
2470
|
-
var mode = (_a2 === void 0 ? {} : _a2).mode;
|
|
2471
|
-
if (IsReadableStream(this) === false) {
|
|
2472
|
-
throw streamBrandCheckException$1("getReader");
|
|
2473
|
-
}
|
|
2474
|
-
if (mode === void 0) {
|
|
2475
|
-
return AcquireReadableStreamDefaultReader(this, true);
|
|
2476
|
-
}
|
|
2477
|
-
mode = String(mode);
|
|
2478
|
-
if (mode === "byob") {
|
|
2479
|
-
return AcquireReadableStreamBYOBReader(this, true);
|
|
2480
|
-
}
|
|
2481
|
-
throw new RangeError("Invalid mode is specified");
|
|
2482
|
-
};
|
|
2483
|
-
ReadableStream2.prototype.pipeThrough = function(_a2, _b) {
|
|
2484
|
-
var writable = _a2.writable, readable = _a2.readable;
|
|
2485
|
-
var _c = _b === void 0 ? {} : _b, preventClose = _c.preventClose, preventAbort = _c.preventAbort, preventCancel = _c.preventCancel, signal = _c.signal;
|
|
2486
|
-
if (IsReadableStream(this) === false) {
|
|
2487
|
-
throw streamBrandCheckException$1("pipeThrough");
|
|
2488
|
-
}
|
|
2489
|
-
if (IsWritableStream(writable) === false) {
|
|
2490
|
-
throw new TypeError("writable argument to pipeThrough must be a WritableStream");
|
|
2491
|
-
}
|
|
2492
|
-
if (IsReadableStream(readable) === false) {
|
|
2493
|
-
throw new TypeError("readable argument to pipeThrough must be a ReadableStream");
|
|
2494
|
-
}
|
|
2495
|
-
preventClose = Boolean(preventClose);
|
|
2496
|
-
preventAbort = Boolean(preventAbort);
|
|
2497
|
-
preventCancel = Boolean(preventCancel);
|
|
2498
|
-
if (signal !== void 0 && !isAbortSignal(signal)) {
|
|
2499
|
-
throw new TypeError("ReadableStream.prototype.pipeThrough's signal option must be an AbortSignal");
|
|
2500
|
-
}
|
|
2501
|
-
if (IsReadableStreamLocked(this) === true) {
|
|
2502
|
-
throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");
|
|
2503
|
-
}
|
|
2504
|
-
if (IsWritableStreamLocked(writable) === true) {
|
|
2505
|
-
throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");
|
|
2506
|
-
}
|
|
2507
|
-
var promise = ReadableStreamPipeTo(this, writable, preventClose, preventAbort, preventCancel, signal);
|
|
2508
|
-
setPromiseIsHandledToTrue(promise);
|
|
2509
|
-
return readable;
|
|
2510
|
-
};
|
|
2511
|
-
ReadableStream2.prototype.pipeTo = function(dest, _a2) {
|
|
2512
|
-
var _b = _a2 === void 0 ? {} : _a2, preventClose = _b.preventClose, preventAbort = _b.preventAbort, preventCancel = _b.preventCancel, signal = _b.signal;
|
|
2513
|
-
if (IsReadableStream(this) === false) {
|
|
2514
|
-
return promiseRejectedWith(streamBrandCheckException$1("pipeTo"));
|
|
2515
|
-
}
|
|
2516
|
-
if (IsWritableStream(dest) === false) {
|
|
2517
|
-
return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));
|
|
2518
|
-
}
|
|
2519
|
-
preventClose = Boolean(preventClose);
|
|
2520
|
-
preventAbort = Boolean(preventAbort);
|
|
2521
|
-
preventCancel = Boolean(preventCancel);
|
|
2522
|
-
if (signal !== void 0 && !isAbortSignal(signal)) {
|
|
2523
|
-
return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo's signal option must be an AbortSignal"));
|
|
2524
|
-
}
|
|
2525
|
-
if (IsReadableStreamLocked(this) === true) {
|
|
2526
|
-
return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));
|
|
2527
|
-
}
|
|
2528
|
-
if (IsWritableStreamLocked(dest) === true) {
|
|
2529
|
-
return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));
|
|
2530
|
-
}
|
|
2531
|
-
return ReadableStreamPipeTo(this, dest, preventClose, preventAbort, preventCancel, signal);
|
|
2532
|
-
};
|
|
2533
|
-
ReadableStream2.prototype.tee = function() {
|
|
2534
|
-
if (IsReadableStream(this) === false) {
|
|
2535
|
-
throw streamBrandCheckException$1("tee");
|
|
2536
|
-
}
|
|
2537
|
-
var branches = ReadableStreamTee(this);
|
|
2538
|
-
return createArrayFromList(branches);
|
|
2539
|
-
};
|
|
2540
|
-
ReadableStream2.prototype.getIterator = function(_a2) {
|
|
2541
|
-
var _b = (_a2 === void 0 ? {} : _a2).preventCancel, preventCancel = _b === void 0 ? false : _b;
|
|
2542
|
-
if (IsReadableStream(this) === false) {
|
|
2543
|
-
throw streamBrandCheckException$1("getIterator");
|
|
2544
|
-
}
|
|
2545
|
-
return AcquireReadableStreamAsyncIterator(this, preventCancel);
|
|
2546
|
-
};
|
|
2547
|
-
return ReadableStream2;
|
|
2548
|
-
}();
|
|
2549
|
-
if (typeof SymbolPolyfill.asyncIterator === "symbol") {
|
|
2550
|
-
Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, {
|
|
2551
|
-
value: ReadableStream.prototype.getIterator,
|
|
2552
|
-
enumerable: false,
|
|
2553
|
-
writable: true,
|
|
2554
|
-
configurable: true
|
|
2555
|
-
});
|
|
2556
|
-
}
|
|
2557
|
-
function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
2558
|
-
if (highWaterMark === void 0) {
|
|
2559
|
-
highWaterMark = 1;
|
|
2560
|
-
}
|
|
2561
|
-
if (sizeAlgorithm === void 0) {
|
|
2562
|
-
sizeAlgorithm = function() {
|
|
2563
|
-
return 1;
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
var stream = Object.create(ReadableStream.prototype);
|
|
2567
|
-
InitializeReadableStream(stream);
|
|
2568
|
-
var controller = Object.create(ReadableStreamDefaultController.prototype);
|
|
2569
|
-
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
2570
|
-
return stream;
|
|
2571
|
-
}
|
|
2572
|
-
function InitializeReadableStream(stream) {
|
|
2573
|
-
stream._state = "readable";
|
|
2574
|
-
stream._reader = void 0;
|
|
2575
|
-
stream._storedError = void 0;
|
|
2576
|
-
stream._disturbed = false;
|
|
2577
|
-
}
|
|
2578
|
-
function IsReadableStream(x) {
|
|
2579
|
-
if (!typeIsObject(x)) {
|
|
2580
|
-
return false;
|
|
2581
|
-
}
|
|
2582
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_readableStreamController")) {
|
|
2583
|
-
return false;
|
|
2584
|
-
}
|
|
2585
|
-
return true;
|
|
2586
|
-
}
|
|
2587
|
-
function IsReadableStreamLocked(stream) {
|
|
2588
|
-
if (stream._reader === void 0) {
|
|
2589
|
-
return false;
|
|
2590
|
-
}
|
|
2591
|
-
return true;
|
|
2592
|
-
}
|
|
2593
|
-
function ReadableStreamCancel(stream, reason) {
|
|
2594
|
-
stream._disturbed = true;
|
|
2595
|
-
if (stream._state === "closed") {
|
|
2596
|
-
return promiseResolvedWith(void 0);
|
|
2597
|
-
}
|
|
2598
|
-
if (stream._state === "errored") {
|
|
2599
|
-
return promiseRejectedWith(stream._storedError);
|
|
2600
|
-
}
|
|
2601
|
-
ReadableStreamClose(stream);
|
|
2602
|
-
var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
|
|
2603
|
-
return transformPromiseWith(sourceCancelPromise, noop);
|
|
2604
|
-
}
|
|
2605
|
-
function ReadableStreamClose(stream) {
|
|
2606
|
-
stream._state = "closed";
|
|
2607
|
-
var reader = stream._reader;
|
|
2608
|
-
if (reader === void 0) {
|
|
2609
|
-
return;
|
|
2610
|
-
}
|
|
2611
|
-
if (IsReadableStreamDefaultReader(reader)) {
|
|
2612
|
-
reader._readRequests.forEach(function(readRequest) {
|
|
2613
|
-
readRequest._resolve(ReadableStreamCreateReadResult(void 0, true, reader._forAuthorCode));
|
|
2614
|
-
});
|
|
2615
|
-
reader._readRequests = new SimpleQueue();
|
|
2616
|
-
}
|
|
2617
|
-
defaultReaderClosedPromiseResolve(reader);
|
|
2618
|
-
}
|
|
2619
|
-
function ReadableStreamError(stream, e) {
|
|
2620
|
-
stream._state = "errored";
|
|
2621
|
-
stream._storedError = e;
|
|
2622
|
-
var reader = stream._reader;
|
|
2623
|
-
if (reader === void 0) {
|
|
2624
|
-
return;
|
|
2625
|
-
}
|
|
2626
|
-
if (IsReadableStreamDefaultReader(reader)) {
|
|
2627
|
-
reader._readRequests.forEach(function(readRequest) {
|
|
2628
|
-
readRequest._reject(e);
|
|
2629
|
-
});
|
|
2630
|
-
reader._readRequests = new SimpleQueue();
|
|
2631
|
-
} else {
|
|
2632
|
-
reader._readIntoRequests.forEach(function(readIntoRequest) {
|
|
2633
|
-
readIntoRequest._reject(e);
|
|
2634
|
-
});
|
|
2635
|
-
reader._readIntoRequests = new SimpleQueue();
|
|
2636
|
-
}
|
|
2637
|
-
defaultReaderClosedPromiseReject(reader, e);
|
|
2638
|
-
}
|
|
2639
|
-
function streamBrandCheckException$1(name) {
|
|
2640
|
-
return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream");
|
|
2641
|
-
}
|
|
2642
|
-
var ByteLengthQueuingStrategy = function() {
|
|
2643
|
-
function ByteLengthQueuingStrategy2(_a2) {
|
|
2644
|
-
var highWaterMark = _a2.highWaterMark;
|
|
2645
|
-
this.highWaterMark = highWaterMark;
|
|
2646
|
-
}
|
|
2647
|
-
ByteLengthQueuingStrategy2.prototype.size = function(chunk) {
|
|
2648
|
-
return chunk.byteLength;
|
|
2649
|
-
};
|
|
2650
|
-
return ByteLengthQueuingStrategy2;
|
|
2651
|
-
}();
|
|
2652
|
-
var CountQueuingStrategy = function() {
|
|
2653
|
-
function CountQueuingStrategy2(_a2) {
|
|
2654
|
-
var highWaterMark = _a2.highWaterMark;
|
|
2655
|
-
this.highWaterMark = highWaterMark;
|
|
2656
|
-
}
|
|
2657
|
-
CountQueuingStrategy2.prototype.size = function() {
|
|
2658
|
-
return 1;
|
|
2659
|
-
};
|
|
2660
|
-
return CountQueuingStrategy2;
|
|
2661
|
-
}();
|
|
2662
|
-
var TransformStream = function() {
|
|
2663
|
-
function TransformStream2(transformer, writableStrategy, readableStrategy) {
|
|
2664
|
-
if (transformer === void 0) {
|
|
2665
|
-
transformer = {};
|
|
2666
|
-
}
|
|
2667
|
-
if (writableStrategy === void 0) {
|
|
2668
|
-
writableStrategy = {};
|
|
2669
|
-
}
|
|
2670
|
-
if (readableStrategy === void 0) {
|
|
2671
|
-
readableStrategy = {};
|
|
2672
|
-
}
|
|
2673
|
-
var writableSizeFunction = writableStrategy.size;
|
|
2674
|
-
var writableHighWaterMark = writableStrategy.highWaterMark;
|
|
2675
|
-
var readableSizeFunction = readableStrategy.size;
|
|
2676
|
-
var readableHighWaterMark = readableStrategy.highWaterMark;
|
|
2677
|
-
var writableType = transformer.writableType;
|
|
2678
|
-
if (writableType !== void 0) {
|
|
2679
|
-
throw new RangeError("Invalid writable type specified");
|
|
2680
|
-
}
|
|
2681
|
-
var writableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(writableSizeFunction);
|
|
2682
|
-
if (writableHighWaterMark === void 0) {
|
|
2683
|
-
writableHighWaterMark = 1;
|
|
2684
|
-
}
|
|
2685
|
-
writableHighWaterMark = ValidateAndNormalizeHighWaterMark(writableHighWaterMark);
|
|
2686
|
-
var readableType = transformer.readableType;
|
|
2687
|
-
if (readableType !== void 0) {
|
|
2688
|
-
throw new RangeError("Invalid readable type specified");
|
|
2689
|
-
}
|
|
2690
|
-
var readableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(readableSizeFunction);
|
|
2691
|
-
if (readableHighWaterMark === void 0) {
|
|
2692
|
-
readableHighWaterMark = 0;
|
|
2693
|
-
}
|
|
2694
|
-
readableHighWaterMark = ValidateAndNormalizeHighWaterMark(readableHighWaterMark);
|
|
2695
|
-
var startPromise_resolve;
|
|
2696
|
-
var startPromise = newPromise(function(resolve) {
|
|
2697
|
-
startPromise_resolve = resolve;
|
|
2698
|
-
});
|
|
2699
|
-
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
2700
|
-
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
2701
|
-
var startResult = InvokeOrNoop(transformer, "start", [this._transformStreamController]);
|
|
2702
|
-
startPromise_resolve(startResult);
|
|
2703
|
-
}
|
|
2704
|
-
Object.defineProperty(TransformStream2.prototype, "readable", {
|
|
2705
|
-
get: function() {
|
|
2706
|
-
if (IsTransformStream(this) === false) {
|
|
2707
|
-
throw streamBrandCheckException$2("readable");
|
|
2708
|
-
}
|
|
2709
|
-
return this._readable;
|
|
2710
|
-
},
|
|
2711
|
-
enumerable: true,
|
|
2712
|
-
configurable: true
|
|
2713
|
-
});
|
|
2714
|
-
Object.defineProperty(TransformStream2.prototype, "writable", {
|
|
2715
|
-
get: function() {
|
|
2716
|
-
if (IsTransformStream(this) === false) {
|
|
2717
|
-
throw streamBrandCheckException$2("writable");
|
|
2718
|
-
}
|
|
2719
|
-
return this._writable;
|
|
2720
|
-
},
|
|
2721
|
-
enumerable: true,
|
|
2722
|
-
configurable: true
|
|
2723
|
-
});
|
|
2724
|
-
return TransformStream2;
|
|
2725
|
-
}();
|
|
2726
|
-
function InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) {
|
|
2727
|
-
function startAlgorithm() {
|
|
2728
|
-
return startPromise;
|
|
2729
|
-
}
|
|
2730
|
-
function writeAlgorithm(chunk) {
|
|
2731
|
-
return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);
|
|
2732
|
-
}
|
|
2733
|
-
function abortAlgorithm(reason) {
|
|
2734
|
-
return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);
|
|
2735
|
-
}
|
|
2736
|
-
function closeAlgorithm() {
|
|
2737
|
-
return TransformStreamDefaultSinkCloseAlgorithm(stream);
|
|
2738
|
-
}
|
|
2739
|
-
stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);
|
|
2740
|
-
function pullAlgorithm() {
|
|
2741
|
-
return TransformStreamDefaultSourcePullAlgorithm(stream);
|
|
2742
|
-
}
|
|
2743
|
-
function cancelAlgorithm(reason) {
|
|
2744
|
-
TransformStreamErrorWritableAndUnblockWrite(stream, reason);
|
|
2745
|
-
return promiseResolvedWith(void 0);
|
|
2746
|
-
}
|
|
2747
|
-
stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
2748
|
-
stream._backpressure = void 0;
|
|
2749
|
-
stream._backpressureChangePromise = void 0;
|
|
2750
|
-
stream._backpressureChangePromise_resolve = void 0;
|
|
2751
|
-
TransformStreamSetBackpressure(stream, true);
|
|
2752
|
-
stream._transformStreamController = void 0;
|
|
2753
|
-
}
|
|
2754
|
-
function IsTransformStream(x) {
|
|
2755
|
-
if (!typeIsObject(x)) {
|
|
2756
|
-
return false;
|
|
2757
|
-
}
|
|
2758
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_transformStreamController")) {
|
|
2759
|
-
return false;
|
|
2760
|
-
}
|
|
2761
|
-
return true;
|
|
2762
|
-
}
|
|
2763
|
-
function TransformStreamError(stream, e) {
|
|
2764
|
-
ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);
|
|
2765
|
-
TransformStreamErrorWritableAndUnblockWrite(stream, e);
|
|
2766
|
-
}
|
|
2767
|
-
function TransformStreamErrorWritableAndUnblockWrite(stream, e) {
|
|
2768
|
-
TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
|
|
2769
|
-
WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);
|
|
2770
|
-
if (stream._backpressure === true) {
|
|
2771
|
-
TransformStreamSetBackpressure(stream, false);
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
function TransformStreamSetBackpressure(stream, backpressure) {
|
|
2775
|
-
if (stream._backpressureChangePromise !== void 0) {
|
|
2776
|
-
stream._backpressureChangePromise_resolve();
|
|
2777
|
-
}
|
|
2778
|
-
stream._backpressureChangePromise = newPromise(function(resolve) {
|
|
2779
|
-
stream._backpressureChangePromise_resolve = resolve;
|
|
2780
|
-
});
|
|
2781
|
-
stream._backpressure = backpressure;
|
|
2782
|
-
}
|
|
2783
|
-
var TransformStreamDefaultController = function() {
|
|
2784
|
-
function TransformStreamDefaultController2() {
|
|
2785
|
-
throw new TypeError("TransformStreamDefaultController instances cannot be created directly");
|
|
2786
|
-
}
|
|
2787
|
-
Object.defineProperty(TransformStreamDefaultController2.prototype, "desiredSize", {
|
|
2788
|
-
get: function() {
|
|
2789
|
-
if (IsTransformStreamDefaultController(this) === false) {
|
|
2790
|
-
throw defaultControllerBrandCheckException$1("desiredSize");
|
|
2791
|
-
}
|
|
2792
|
-
var readableController = this._controlledTransformStream._readable._readableStreamController;
|
|
2793
|
-
return ReadableStreamDefaultControllerGetDesiredSize(readableController);
|
|
2794
|
-
},
|
|
2795
|
-
enumerable: true,
|
|
2796
|
-
configurable: true
|
|
2797
|
-
});
|
|
2798
|
-
TransformStreamDefaultController2.prototype.enqueue = function(chunk) {
|
|
2799
|
-
if (IsTransformStreamDefaultController(this) === false) {
|
|
2800
|
-
throw defaultControllerBrandCheckException$1("enqueue");
|
|
2801
|
-
}
|
|
2802
|
-
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
2803
|
-
};
|
|
2804
|
-
TransformStreamDefaultController2.prototype.error = function(reason) {
|
|
2805
|
-
if (IsTransformStreamDefaultController(this) === false) {
|
|
2806
|
-
throw defaultControllerBrandCheckException$1("error");
|
|
2807
|
-
}
|
|
2808
|
-
TransformStreamDefaultControllerError(this, reason);
|
|
2809
|
-
};
|
|
2810
|
-
TransformStreamDefaultController2.prototype.terminate = function() {
|
|
2811
|
-
if (IsTransformStreamDefaultController(this) === false) {
|
|
2812
|
-
throw defaultControllerBrandCheckException$1("terminate");
|
|
2813
|
-
}
|
|
2814
|
-
TransformStreamDefaultControllerTerminate(this);
|
|
2815
|
-
};
|
|
2816
|
-
return TransformStreamDefaultController2;
|
|
2817
|
-
}();
|
|
2818
|
-
function IsTransformStreamDefaultController(x) {
|
|
2819
|
-
if (!typeIsObject(x)) {
|
|
2820
|
-
return false;
|
|
2821
|
-
}
|
|
2822
|
-
if (!Object.prototype.hasOwnProperty.call(x, "_controlledTransformStream")) {
|
|
2823
|
-
return false;
|
|
2824
|
-
}
|
|
2825
|
-
return true;
|
|
2826
|
-
}
|
|
2827
|
-
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
|
|
2828
|
-
controller._controlledTransformStream = stream;
|
|
2829
|
-
stream._transformStreamController = controller;
|
|
2830
|
-
controller._transformAlgorithm = transformAlgorithm;
|
|
2831
|
-
controller._flushAlgorithm = flushAlgorithm;
|
|
2832
|
-
}
|
|
2833
|
-
function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
|
|
2834
|
-
var controller = Object.create(TransformStreamDefaultController.prototype);
|
|
2835
|
-
var transformAlgorithm = function(chunk) {
|
|
2836
|
-
try {
|
|
2837
|
-
TransformStreamDefaultControllerEnqueue(controller, chunk);
|
|
2838
|
-
return promiseResolvedWith(void 0);
|
|
2839
|
-
} catch (transformResultE) {
|
|
2840
|
-
return promiseRejectedWith(transformResultE);
|
|
2841
|
-
}
|
|
2842
|
-
};
|
|
2843
|
-
var transformMethod = transformer.transform;
|
|
2844
|
-
if (transformMethod !== void 0) {
|
|
2845
|
-
if (typeof transformMethod !== "function") {
|
|
2846
|
-
throw new TypeError("transform is not a method");
|
|
2847
|
-
}
|
|
2848
|
-
transformAlgorithm = function(chunk) {
|
|
2849
|
-
return PromiseCall(transformMethod, transformer, [chunk, controller]);
|
|
2850
|
-
};
|
|
2851
|
-
}
|
|
2852
|
-
var flushAlgorithm = CreateAlgorithmFromUnderlyingMethod(transformer, "flush", 0, [controller]);
|
|
2853
|
-
SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);
|
|
2854
|
-
}
|
|
2855
|
-
function TransformStreamDefaultControllerClearAlgorithms(controller) {
|
|
2856
|
-
controller._transformAlgorithm = void 0;
|
|
2857
|
-
controller._flushAlgorithm = void 0;
|
|
2858
|
-
}
|
|
2859
|
-
function TransformStreamDefaultControllerEnqueue(controller, chunk) {
|
|
2860
|
-
var stream = controller._controlledTransformStream;
|
|
2861
|
-
var readableController = stream._readable._readableStreamController;
|
|
2862
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === false) {
|
|
2863
|
-
throw new TypeError("Readable side is not in a state that permits enqueue");
|
|
2864
|
-
}
|
|
2865
|
-
try {
|
|
2866
|
-
ReadableStreamDefaultControllerEnqueue(readableController, chunk);
|
|
2867
|
-
} catch (e) {
|
|
2868
|
-
TransformStreamErrorWritableAndUnblockWrite(stream, e);
|
|
2869
|
-
throw stream._readable._storedError;
|
|
2870
|
-
}
|
|
2871
|
-
var backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);
|
|
2872
|
-
if (backpressure !== stream._backpressure) {
|
|
2873
|
-
TransformStreamSetBackpressure(stream, true);
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
function TransformStreamDefaultControllerError(controller, e) {
|
|
2877
|
-
TransformStreamError(controller._controlledTransformStream, e);
|
|
2878
|
-
}
|
|
2879
|
-
function TransformStreamDefaultControllerPerformTransform(controller, chunk) {
|
|
2880
|
-
var transformPromise = controller._transformAlgorithm(chunk);
|
|
2881
|
-
return transformPromiseWith(transformPromise, void 0, function(r) {
|
|
2882
|
-
TransformStreamError(controller._controlledTransformStream, r);
|
|
2883
|
-
throw r;
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
function TransformStreamDefaultControllerTerminate(controller) {
|
|
2887
|
-
var stream = controller._controlledTransformStream;
|
|
2888
|
-
var readableController = stream._readable._readableStreamController;
|
|
2889
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
|
|
2890
|
-
ReadableStreamDefaultControllerClose(readableController);
|
|
2891
|
-
}
|
|
2892
|
-
var error = new TypeError("TransformStream terminated");
|
|
2893
|
-
TransformStreamErrorWritableAndUnblockWrite(stream, error);
|
|
2894
|
-
}
|
|
2895
|
-
function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
|
|
2896
|
-
var controller = stream._transformStreamController;
|
|
2897
|
-
if (stream._backpressure === true) {
|
|
2898
|
-
var backpressureChangePromise = stream._backpressureChangePromise;
|
|
2899
|
-
return transformPromiseWith(backpressureChangePromise, function() {
|
|
2900
|
-
var writable = stream._writable;
|
|
2901
|
-
var state = writable._state;
|
|
2902
|
-
if (state === "erroring") {
|
|
2903
|
-
throw writable._storedError;
|
|
2904
|
-
}
|
|
2905
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
2906
|
-
});
|
|
2907
|
-
}
|
|
2908
|
-
return TransformStreamDefaultControllerPerformTransform(controller, chunk);
|
|
2909
|
-
}
|
|
2910
|
-
function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
|
|
2911
|
-
TransformStreamError(stream, reason);
|
|
2912
|
-
return promiseResolvedWith(void 0);
|
|
2913
|
-
}
|
|
2914
|
-
function TransformStreamDefaultSinkCloseAlgorithm(stream) {
|
|
2915
|
-
var readable = stream._readable;
|
|
2916
|
-
var controller = stream._transformStreamController;
|
|
2917
|
-
var flushPromise = controller._flushAlgorithm();
|
|
2918
|
-
TransformStreamDefaultControllerClearAlgorithms(controller);
|
|
2919
|
-
return transformPromiseWith(flushPromise, function() {
|
|
2920
|
-
if (readable._state === "errored") {
|
|
2921
|
-
throw readable._storedError;
|
|
2922
|
-
}
|
|
2923
|
-
var readableController = readable._readableStreamController;
|
|
2924
|
-
if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
|
|
2925
|
-
ReadableStreamDefaultControllerClose(readableController);
|
|
2926
|
-
}
|
|
2927
|
-
}, function(r) {
|
|
2928
|
-
TransformStreamError(stream, r);
|
|
2929
|
-
throw readable._storedError;
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
2933
|
-
TransformStreamSetBackpressure(stream, false);
|
|
2934
|
-
return stream._backpressureChangePromise;
|
|
2935
|
-
}
|
|
2936
|
-
function defaultControllerBrandCheckException$1(name) {
|
|
2937
|
-
return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
|
|
2938
|
-
}
|
|
2939
|
-
function streamBrandCheckException$2(name) {
|
|
2940
|
-
return new TypeError("TransformStream.prototype." + name + " can only be used on a TransformStream");
|
|
2941
|
-
}
|
|
2942
|
-
exports2.ByteLengthQueuingStrategy = ByteLengthQueuingStrategy;
|
|
2943
|
-
exports2.CountQueuingStrategy = CountQueuingStrategy;
|
|
2944
|
-
exports2.ReadableStream = ReadableStream;
|
|
2945
|
-
exports2.TransformStream = TransformStream;
|
|
2946
|
-
exports2.WritableStream = WritableStream;
|
|
2947
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2950
|
-
});
|
|
2951
|
-
|
|
2952
|
-
// ../../node_modules/flatgeobuf/dist/flatgeobuf-geojson.min.js
|
|
2953
|
-
var require_flatgeobuf_geojson_min = __commonJS({
|
|
2954
|
-
"../../node_modules/flatgeobuf/dist/flatgeobuf-geojson.min.js"(exports, module) {
|
|
2955
|
-
!function(t, e) {
|
|
2956
|
-
typeof exports == "object" && typeof module != "undefined" ? e(exports, require_ponyfill()) : typeof define == "function" && define.amd ? define(["exports", "web-streams-polyfill/ponyfill"], e) : e((t = t || self).flatgeobuf = {}, t.ponyfill);
|
|
2957
|
-
}(exports, function(t, e) {
|
|
2958
|
-
"use strict";
|
|
2959
|
-
class r {
|
|
2960
|
-
constructor(t2, e2) {
|
|
2961
|
-
this.name = t2, this.type = e2;
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
var i;
|
|
2965
|
-
!function(t2) {
|
|
2966
|
-
t2[t2.Byte = 0] = "Byte", t2[t2.UByte = 1] = "UByte", t2[t2.Bool = 2] = "Bool", t2[t2.Short = 3] = "Short", t2[t2.UShort = 4] = "UShort", t2[t2.Int = 5] = "Int", t2[t2.UInt = 6] = "UInt", t2[t2.Long = 7] = "Long", t2[t2.ULong = 8] = "ULong", t2[t2.Float = 9] = "Float", t2[t2.Double = 10] = "Double", t2[t2.String = 11] = "String", t2[t2.Json = 12] = "Json", t2[t2.DateTime = 13] = "DateTime", t2[t2.Binary = 14] = "Binary";
|
|
2967
|
-
}(i || (i = {}));
|
|
2968
|
-
var n = i;
|
|
2969
|
-
class s {
|
|
2970
|
-
constructor(t2, e2, r2) {
|
|
2971
|
-
this.geometryType = t2, this.columns = e2, this.featuresCount = r2;
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
var o, a, b, u, h = {};
|
|
2975
|
-
h.SIZEOF_SHORT = 2, h.SIZEOF_INT = 4, h.FILE_IDENTIFIER_LENGTH = 4, h.SIZE_PREFIX_LENGTH = 4, h.Encoding = { UTF8_BYTES: 1, UTF16_STRING: 2 }, h.int32 = new Int32Array(2), h.float32 = new Float32Array(h.int32.buffer), h.float64 = new Float64Array(h.int32.buffer), h.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1, h.Long = function(t2, e2) {
|
|
2976
|
-
this.low = 0 | t2, this.high = 0 | e2;
|
|
2977
|
-
}, h.Long.create = function(t2, e2) {
|
|
2978
|
-
return t2 == 0 && e2 == 0 ? h.Long.ZERO : new h.Long(t2, e2);
|
|
2979
|
-
}, h.Long.prototype.toFloat64 = function() {
|
|
2980
|
-
return (this.low >>> 0) + 4294967296 * this.high;
|
|
2981
|
-
}, h.Long.prototype.equals = function(t2) {
|
|
2982
|
-
return this.low == t2.low && this.high == t2.high;
|
|
2983
|
-
}, h.Long.ZERO = new h.Long(0, 0), h.Builder = function(t2) {
|
|
2984
|
-
if (t2)
|
|
2985
|
-
e2 = t2;
|
|
2986
|
-
else
|
|
2987
|
-
var e2 = 1024;
|
|
2988
|
-
this.bb = h.ByteBuffer.allocate(e2), this.space = e2, this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = false, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = false;
|
|
2989
|
-
}, h.Builder.prototype.clear = function() {
|
|
2990
|
-
this.bb.clear(), this.space = this.bb.capacity(), this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = false, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = false;
|
|
2991
|
-
}, h.Builder.prototype.forceDefaults = function(t2) {
|
|
2992
|
-
this.force_defaults = t2;
|
|
2993
|
-
}, h.Builder.prototype.dataBuffer = function() {
|
|
2994
|
-
return this.bb;
|
|
2995
|
-
}, h.Builder.prototype.asUint8Array = function() {
|
|
2996
|
-
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
2997
|
-
}, h.Builder.prototype.prep = function(t2, e2) {
|
|
2998
|
-
t2 > this.minalign && (this.minalign = t2);
|
|
2999
|
-
for (var r2 = 1 + ~(this.bb.capacity() - this.space + e2) & t2 - 1; this.space < r2 + t2 + e2; ) {
|
|
3000
|
-
var i2 = this.bb.capacity();
|
|
3001
|
-
this.bb = h.Builder.growByteBuffer(this.bb), this.space += this.bb.capacity() - i2;
|
|
3002
|
-
}
|
|
3003
|
-
this.pad(r2);
|
|
3004
|
-
}, h.Builder.prototype.pad = function(t2) {
|
|
3005
|
-
for (var e2 = 0; e2 < t2; e2++)
|
|
3006
|
-
this.bb.writeInt8(--this.space, 0);
|
|
3007
|
-
}, h.Builder.prototype.writeInt8 = function(t2) {
|
|
3008
|
-
this.bb.writeInt8(this.space -= 1, t2);
|
|
3009
|
-
}, h.Builder.prototype.writeInt16 = function(t2) {
|
|
3010
|
-
this.bb.writeInt16(this.space -= 2, t2);
|
|
3011
|
-
}, h.Builder.prototype.writeInt32 = function(t2) {
|
|
3012
|
-
this.bb.writeInt32(this.space -= 4, t2);
|
|
3013
|
-
}, h.Builder.prototype.writeInt64 = function(t2) {
|
|
3014
|
-
this.bb.writeInt64(this.space -= 8, t2);
|
|
3015
|
-
}, h.Builder.prototype.writeFloat32 = function(t2) {
|
|
3016
|
-
this.bb.writeFloat32(this.space -= 4, t2);
|
|
3017
|
-
}, h.Builder.prototype.writeFloat64 = function(t2) {
|
|
3018
|
-
this.bb.writeFloat64(this.space -= 8, t2);
|
|
3019
|
-
}, h.Builder.prototype.addInt8 = function(t2) {
|
|
3020
|
-
this.prep(1, 0), this.writeInt8(t2);
|
|
3021
|
-
}, h.Builder.prototype.addInt16 = function(t2) {
|
|
3022
|
-
this.prep(2, 0), this.writeInt16(t2);
|
|
3023
|
-
}, h.Builder.prototype.addInt32 = function(t2) {
|
|
3024
|
-
this.prep(4, 0), this.writeInt32(t2);
|
|
3025
|
-
}, h.Builder.prototype.addInt64 = function(t2) {
|
|
3026
|
-
this.prep(8, 0), this.writeInt64(t2);
|
|
3027
|
-
}, h.Builder.prototype.addFloat32 = function(t2) {
|
|
3028
|
-
this.prep(4, 0), this.writeFloat32(t2);
|
|
3029
|
-
}, h.Builder.prototype.addFloat64 = function(t2) {
|
|
3030
|
-
this.prep(8, 0), this.writeFloat64(t2);
|
|
3031
|
-
}, h.Builder.prototype.addFieldInt8 = function(t2, e2, r2) {
|
|
3032
|
-
(this.force_defaults || e2 != r2) && (this.addInt8(e2), this.slot(t2));
|
|
3033
|
-
}, h.Builder.prototype.addFieldInt16 = function(t2, e2, r2) {
|
|
3034
|
-
(this.force_defaults || e2 != r2) && (this.addInt16(e2), this.slot(t2));
|
|
3035
|
-
}, h.Builder.prototype.addFieldInt32 = function(t2, e2, r2) {
|
|
3036
|
-
(this.force_defaults || e2 != r2) && (this.addInt32(e2), this.slot(t2));
|
|
3037
|
-
}, h.Builder.prototype.addFieldInt64 = function(t2, e2, r2) {
|
|
3038
|
-
!this.force_defaults && e2.equals(r2) || (this.addInt64(e2), this.slot(t2));
|
|
3039
|
-
}, h.Builder.prototype.addFieldFloat32 = function(t2, e2, r2) {
|
|
3040
|
-
(this.force_defaults || e2 != r2) && (this.addFloat32(e2), this.slot(t2));
|
|
3041
|
-
}, h.Builder.prototype.addFieldFloat64 = function(t2, e2, r2) {
|
|
3042
|
-
(this.force_defaults || e2 != r2) && (this.addFloat64(e2), this.slot(t2));
|
|
3043
|
-
}, h.Builder.prototype.addFieldOffset = function(t2, e2, r2) {
|
|
3044
|
-
(this.force_defaults || e2 != r2) && (this.addOffset(e2), this.slot(t2));
|
|
3045
|
-
}, h.Builder.prototype.addFieldStruct = function(t2, e2, r2) {
|
|
3046
|
-
e2 != r2 && (this.nested(e2), this.slot(t2));
|
|
3047
|
-
}, h.Builder.prototype.nested = function(t2) {
|
|
3048
|
-
if (t2 != this.offset())
|
|
3049
|
-
throw new Error("FlatBuffers: struct must be serialized inline.");
|
|
3050
|
-
}, h.Builder.prototype.notNested = function() {
|
|
3051
|
-
if (this.isNested)
|
|
3052
|
-
throw new Error("FlatBuffers: object serialization must not be nested.");
|
|
3053
|
-
}, h.Builder.prototype.slot = function(t2) {
|
|
3054
|
-
this.vtable[t2] = this.offset();
|
|
3055
|
-
}, h.Builder.prototype.offset = function() {
|
|
3056
|
-
return this.bb.capacity() - this.space;
|
|
3057
|
-
}, h.Builder.growByteBuffer = function(t2) {
|
|
3058
|
-
var e2 = t2.capacity();
|
|
3059
|
-
if (3221225472 & e2)
|
|
3060
|
-
throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
|
3061
|
-
var r2 = e2 << 1, i2 = h.ByteBuffer.allocate(r2);
|
|
3062
|
-
return i2.setPosition(r2 - e2), i2.bytes().set(t2.bytes(), r2 - e2), i2;
|
|
3063
|
-
}, h.Builder.prototype.addOffset = function(t2) {
|
|
3064
|
-
this.prep(h.SIZEOF_INT, 0), this.writeInt32(this.offset() - t2 + h.SIZEOF_INT);
|
|
3065
|
-
}, h.Builder.prototype.startObject = function(t2) {
|
|
3066
|
-
this.notNested(), this.vtable == null && (this.vtable = []), this.vtable_in_use = t2;
|
|
3067
|
-
for (var e2 = 0; e2 < t2; e2++)
|
|
3068
|
-
this.vtable[e2] = 0;
|
|
3069
|
-
this.isNested = true, this.object_start = this.offset();
|
|
3070
|
-
}, h.Builder.prototype.endObject = function() {
|
|
3071
|
-
if (this.vtable == null || !this.isNested)
|
|
3072
|
-
throw new Error("FlatBuffers: endObject called without startObject");
|
|
3073
|
-
this.addInt32(0);
|
|
3074
|
-
for (var t2 = this.offset(), e2 = this.vtable_in_use - 1; e2 >= 0 && this.vtable[e2] == 0; e2--)
|
|
3075
|
-
;
|
|
3076
|
-
for (var r2 = e2 + 1; e2 >= 0; e2--)
|
|
3077
|
-
this.addInt16(this.vtable[e2] != 0 ? t2 - this.vtable[e2] : 0);
|
|
3078
|
-
this.addInt16(t2 - this.object_start);
|
|
3079
|
-
var i2 = (r2 + 2) * h.SIZEOF_SHORT;
|
|
3080
|
-
this.addInt16(i2);
|
|
3081
|
-
var n2 = 0, s2 = this.space;
|
|
3082
|
-
t:
|
|
3083
|
-
for (e2 = 0; e2 < this.vtables.length; e2++) {
|
|
3084
|
-
var o2 = this.bb.capacity() - this.vtables[e2];
|
|
3085
|
-
if (i2 == this.bb.readInt16(o2)) {
|
|
3086
|
-
for (var a2 = h.SIZEOF_SHORT; a2 < i2; a2 += h.SIZEOF_SHORT)
|
|
3087
|
-
if (this.bb.readInt16(s2 + a2) != this.bb.readInt16(o2 + a2))
|
|
3088
|
-
continue t;
|
|
3089
|
-
n2 = this.vtables[e2];
|
|
3090
|
-
break;
|
|
3091
|
-
}
|
|
3092
|
-
}
|
|
3093
|
-
return n2 ? (this.space = this.bb.capacity() - t2, this.bb.writeInt32(this.space, n2 - t2)) : (this.vtables.push(this.offset()), this.bb.writeInt32(this.bb.capacity() - t2, this.offset() - t2)), this.isNested = false, t2;
|
|
3094
|
-
}, h.Builder.prototype.finish = function(t2, e2, r2) {
|
|
3095
|
-
var i2 = r2 ? h.SIZE_PREFIX_LENGTH : 0;
|
|
3096
|
-
if (e2) {
|
|
3097
|
-
var n2 = e2;
|
|
3098
|
-
if (this.prep(this.minalign, h.SIZEOF_INT + h.FILE_IDENTIFIER_LENGTH + i2), n2.length != h.FILE_IDENTIFIER_LENGTH)
|
|
3099
|
-
throw new Error("FlatBuffers: file identifier must be length " + h.FILE_IDENTIFIER_LENGTH);
|
|
3100
|
-
for (var s2 = h.FILE_IDENTIFIER_LENGTH - 1; s2 >= 0; s2--)
|
|
3101
|
-
this.writeInt8(n2.charCodeAt(s2));
|
|
3102
|
-
}
|
|
3103
|
-
this.prep(this.minalign, h.SIZEOF_INT + i2), this.addOffset(t2), i2 && this.addInt32(this.bb.capacity() - this.space), this.bb.setPosition(this.space);
|
|
3104
|
-
}, h.Builder.prototype.finishSizePrefixed = function(t2, e2) {
|
|
3105
|
-
this.finish(t2, e2, true);
|
|
3106
|
-
}, h.Builder.prototype.requiredField = function(t2, e2) {
|
|
3107
|
-
var r2 = this.bb.capacity() - t2, i2 = r2 - this.bb.readInt32(r2);
|
|
3108
|
-
if (!(this.bb.readInt16(i2 + e2) != 0))
|
|
3109
|
-
throw new Error("FlatBuffers: field " + e2 + " must be set");
|
|
3110
|
-
}, h.Builder.prototype.startVector = function(t2, e2, r2) {
|
|
3111
|
-
this.notNested(), this.vector_num_elems = e2, this.prep(h.SIZEOF_INT, t2 * e2), this.prep(r2, t2 * e2);
|
|
3112
|
-
}, h.Builder.prototype.endVector = function() {
|
|
3113
|
-
return this.writeInt32(this.vector_num_elems), this.offset();
|
|
3114
|
-
}, h.Builder.prototype.createString = function(t2) {
|
|
3115
|
-
if (t2 instanceof Uint8Array)
|
|
3116
|
-
var e2 = t2;
|
|
3117
|
-
else {
|
|
3118
|
-
e2 = [];
|
|
3119
|
-
for (var r2 = 0; r2 < t2.length; ) {
|
|
3120
|
-
var i2, n2 = t2.charCodeAt(r2++);
|
|
3121
|
-
if (n2 < 55296 || n2 >= 56320)
|
|
3122
|
-
i2 = n2;
|
|
3123
|
-
else
|
|
3124
|
-
i2 = (n2 << 10) + t2.charCodeAt(r2++) + -56613888;
|
|
3125
|
-
i2 < 128 ? e2.push(i2) : (i2 < 2048 ? e2.push(i2 >> 6 & 31 | 192) : (i2 < 65536 ? e2.push(i2 >> 12 & 15 | 224) : e2.push(i2 >> 18 & 7 | 240, i2 >> 12 & 63 | 128), e2.push(i2 >> 6 & 63 | 128)), e2.push(63 & i2 | 128));
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
this.addInt8(0), this.startVector(1, e2.length, 1), this.bb.setPosition(this.space -= e2.length);
|
|
3129
|
-
r2 = 0;
|
|
3130
|
-
for (var s2 = this.space, o2 = this.bb.bytes(); r2 < e2.length; r2++)
|
|
3131
|
-
o2[s2++] = e2[r2];
|
|
3132
|
-
return this.endVector();
|
|
3133
|
-
}, h.Builder.prototype.createLong = function(t2, e2) {
|
|
3134
|
-
return h.Long.create(t2, e2);
|
|
3135
|
-
}, h.ByteBuffer = function(t2) {
|
|
3136
|
-
this.bytes_ = t2, this.position_ = 0;
|
|
3137
|
-
}, h.ByteBuffer.allocate = function(t2) {
|
|
3138
|
-
return new h.ByteBuffer(new Uint8Array(t2));
|
|
3139
|
-
}, h.ByteBuffer.prototype.clear = function() {
|
|
3140
|
-
this.position_ = 0;
|
|
3141
|
-
}, h.ByteBuffer.prototype.bytes = function() {
|
|
3142
|
-
return this.bytes_;
|
|
3143
|
-
}, h.ByteBuffer.prototype.position = function() {
|
|
3144
|
-
return this.position_;
|
|
3145
|
-
}, h.ByteBuffer.prototype.setPosition = function(t2) {
|
|
3146
|
-
this.position_ = t2;
|
|
3147
|
-
}, h.ByteBuffer.prototype.capacity = function() {
|
|
3148
|
-
return this.bytes_.length;
|
|
3149
|
-
}, h.ByteBuffer.prototype.readInt8 = function(t2) {
|
|
3150
|
-
return this.readUint8(t2) << 24 >> 24;
|
|
3151
|
-
}, h.ByteBuffer.prototype.readUint8 = function(t2) {
|
|
3152
|
-
return this.bytes_[t2];
|
|
3153
|
-
}, h.ByteBuffer.prototype.readInt16 = function(t2) {
|
|
3154
|
-
return this.readUint16(t2) << 16 >> 16;
|
|
3155
|
-
}, h.ByteBuffer.prototype.readUint16 = function(t2) {
|
|
3156
|
-
return this.bytes_[t2] | this.bytes_[t2 + 1] << 8;
|
|
3157
|
-
}, h.ByteBuffer.prototype.readInt32 = function(t2) {
|
|
3158
|
-
return this.bytes_[t2] | this.bytes_[t2 + 1] << 8 | this.bytes_[t2 + 2] << 16 | this.bytes_[t2 + 3] << 24;
|
|
3159
|
-
}, h.ByteBuffer.prototype.readUint32 = function(t2) {
|
|
3160
|
-
return this.readInt32(t2) >>> 0;
|
|
3161
|
-
}, h.ByteBuffer.prototype.readInt64 = function(t2) {
|
|
3162
|
-
return new h.Long(this.readInt32(t2), this.readInt32(t2 + 4));
|
|
3163
|
-
}, h.ByteBuffer.prototype.readUint64 = function(t2) {
|
|
3164
|
-
return new h.Long(this.readUint32(t2), this.readUint32(t2 + 4));
|
|
3165
|
-
}, h.ByteBuffer.prototype.readFloat32 = function(t2) {
|
|
3166
|
-
return h.int32[0] = this.readInt32(t2), h.float32[0];
|
|
3167
|
-
}, h.ByteBuffer.prototype.readFloat64 = function(t2) {
|
|
3168
|
-
return h.int32[h.isLittleEndian ? 0 : 1] = this.readInt32(t2), h.int32[h.isLittleEndian ? 1 : 0] = this.readInt32(t2 + 4), h.float64[0];
|
|
3169
|
-
}, h.ByteBuffer.prototype.writeInt8 = function(t2, e2) {
|
|
3170
|
-
this.bytes_[t2] = e2;
|
|
3171
|
-
}, h.ByteBuffer.prototype.writeUint8 = function(t2, e2) {
|
|
3172
|
-
this.bytes_[t2] = e2;
|
|
3173
|
-
}, h.ByteBuffer.prototype.writeInt16 = function(t2, e2) {
|
|
3174
|
-
this.bytes_[t2] = e2, this.bytes_[t2 + 1] = e2 >> 8;
|
|
3175
|
-
}, h.ByteBuffer.prototype.writeUint16 = function(t2, e2) {
|
|
3176
|
-
this.bytes_[t2] = e2, this.bytes_[t2 + 1] = e2 >> 8;
|
|
3177
|
-
}, h.ByteBuffer.prototype.writeInt32 = function(t2, e2) {
|
|
3178
|
-
this.bytes_[t2] = e2, this.bytes_[t2 + 1] = e2 >> 8, this.bytes_[t2 + 2] = e2 >> 16, this.bytes_[t2 + 3] = e2 >> 24;
|
|
3179
|
-
}, h.ByteBuffer.prototype.writeUint32 = function(t2, e2) {
|
|
3180
|
-
this.bytes_[t2] = e2, this.bytes_[t2 + 1] = e2 >> 8, this.bytes_[t2 + 2] = e2 >> 16, this.bytes_[t2 + 3] = e2 >> 24;
|
|
3181
|
-
}, h.ByteBuffer.prototype.writeInt64 = function(t2, e2) {
|
|
3182
|
-
this.writeInt32(t2, e2.low), this.writeInt32(t2 + 4, e2.high);
|
|
3183
|
-
}, h.ByteBuffer.prototype.writeUint64 = function(t2, e2) {
|
|
3184
|
-
this.writeUint32(t2, e2.low), this.writeUint32(t2 + 4, e2.high);
|
|
3185
|
-
}, h.ByteBuffer.prototype.writeFloat32 = function(t2, e2) {
|
|
3186
|
-
h.float32[0] = e2, this.writeInt32(t2, h.int32[0]);
|
|
3187
|
-
}, h.ByteBuffer.prototype.writeFloat64 = function(t2, e2) {
|
|
3188
|
-
h.float64[0] = e2, this.writeInt32(t2, h.int32[h.isLittleEndian ? 0 : 1]), this.writeInt32(t2 + 4, h.int32[h.isLittleEndian ? 1 : 0]);
|
|
3189
|
-
}, h.ByteBuffer.prototype.getBufferIdentifier = function() {
|
|
3190
|
-
if (this.bytes_.length < this.position_ + h.SIZEOF_INT + h.FILE_IDENTIFIER_LENGTH)
|
|
3191
|
-
throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
|
|
3192
|
-
for (var t2 = "", e2 = 0; e2 < h.FILE_IDENTIFIER_LENGTH; e2++)
|
|
3193
|
-
t2 += String.fromCharCode(this.readInt8(this.position_ + h.SIZEOF_INT + e2));
|
|
3194
|
-
return t2;
|
|
3195
|
-
}, h.ByteBuffer.prototype.__offset = function(t2, e2) {
|
|
3196
|
-
var r2 = t2 - this.readInt32(t2);
|
|
3197
|
-
return e2 < this.readInt16(r2) ? this.readInt16(r2 + e2) : 0;
|
|
3198
|
-
}, h.ByteBuffer.prototype.__union = function(t2, e2) {
|
|
3199
|
-
return t2.bb_pos = e2 + this.readInt32(e2), t2.bb = this, t2;
|
|
3200
|
-
}, h.ByteBuffer.prototype.__string = function(t2, e2) {
|
|
3201
|
-
t2 += this.readInt32(t2);
|
|
3202
|
-
var r2 = this.readInt32(t2), i2 = "", n2 = 0;
|
|
3203
|
-
if (t2 += h.SIZEOF_INT, e2 === h.Encoding.UTF8_BYTES)
|
|
3204
|
-
return this.bytes_.subarray(t2, t2 + r2);
|
|
3205
|
-
for (; n2 < r2; ) {
|
|
3206
|
-
var s2, o2 = this.readUint8(t2 + n2++);
|
|
3207
|
-
if (o2 < 192)
|
|
3208
|
-
s2 = o2;
|
|
3209
|
-
else {
|
|
3210
|
-
var a2 = this.readUint8(t2 + n2++);
|
|
3211
|
-
if (o2 < 224)
|
|
3212
|
-
s2 = (31 & o2) << 6 | 63 & a2;
|
|
3213
|
-
else {
|
|
3214
|
-
var b2 = this.readUint8(t2 + n2++);
|
|
3215
|
-
if (o2 < 240)
|
|
3216
|
-
s2 = (15 & o2) << 12 | (63 & a2) << 6 | 63 & b2;
|
|
3217
|
-
else
|
|
3218
|
-
s2 = (7 & o2) << 18 | (63 & a2) << 12 | (63 & b2) << 6 | 63 & this.readUint8(t2 + n2++);
|
|
3219
|
-
}
|
|
3220
|
-
}
|
|
3221
|
-
s2 < 65536 ? i2 += String.fromCharCode(s2) : (s2 -= 65536, i2 += String.fromCharCode(55296 + (s2 >> 10), 56320 + (1023 & s2)));
|
|
3222
|
-
}
|
|
3223
|
-
return i2;
|
|
3224
|
-
}, h.ByteBuffer.prototype.__indirect = function(t2) {
|
|
3225
|
-
return t2 + this.readInt32(t2);
|
|
3226
|
-
}, h.ByteBuffer.prototype.__vector = function(t2) {
|
|
3227
|
-
return t2 + this.readInt32(t2) + h.SIZEOF_INT;
|
|
3228
|
-
}, h.ByteBuffer.prototype.__vector_len = function(t2) {
|
|
3229
|
-
return this.readInt32(t2 + this.readInt32(t2));
|
|
3230
|
-
}, h.ByteBuffer.prototype.__has_identifier = function(t2) {
|
|
3231
|
-
if (t2.length != h.FILE_IDENTIFIER_LENGTH)
|
|
3232
|
-
throw new Error("FlatBuffers: file identifier must be length " + h.FILE_IDENTIFIER_LENGTH);
|
|
3233
|
-
for (var e2 = 0; e2 < h.FILE_IDENTIFIER_LENGTH; e2++)
|
|
3234
|
-
if (t2.charCodeAt(e2) != this.readInt8(this.position_ + h.SIZEOF_INT + e2))
|
|
3235
|
-
return false;
|
|
3236
|
-
return true;
|
|
3237
|
-
}, h.ByteBuffer.prototype.createLong = function(t2, e2) {
|
|
3238
|
-
return h.Long.create(t2, e2);
|
|
3239
|
-
}, function(t2) {
|
|
3240
|
-
t2[t2.Unknown = 0] = "Unknown", t2[t2.Point = 1] = "Point", t2[t2.LineString = 2] = "LineString", t2[t2.Polygon = 3] = "Polygon", t2[t2.MultiPoint = 4] = "MultiPoint", t2[t2.MultiLineString = 5] = "MultiLineString", t2[t2.MultiPolygon = 6] = "MultiPolygon", t2[t2.GeometryCollection = 7] = "GeometryCollection", t2[t2.CircularString = 8] = "CircularString", t2[t2.CompoundCurve = 9] = "CompoundCurve", t2[t2.CurvePolygon = 10] = "CurvePolygon", t2[t2.MultiCurve = 11] = "MultiCurve", t2[t2.MultiSurface = 12] = "MultiSurface", t2[t2.Curve = 13] = "Curve", t2[t2.Surface = 14] = "Surface", t2[t2.PolyhedralSurface = 15] = "PolyhedralSurface", t2[t2.TIN = 16] = "TIN", t2[t2.Triangle = 17] = "Triangle";
|
|
3241
|
-
}(o || (o = {})), function(t2) {
|
|
3242
|
-
t2[t2.Byte = 0] = "Byte", t2[t2.UByte = 1] = "UByte", t2[t2.Bool = 2] = "Bool", t2[t2.Short = 3] = "Short", t2[t2.UShort = 4] = "UShort", t2[t2.Int = 5] = "Int", t2[t2.UInt = 6] = "UInt", t2[t2.Long = 7] = "Long", t2[t2.ULong = 8] = "ULong", t2[t2.Float = 9] = "Float", t2[t2.Double = 10] = "Double", t2[t2.String = 11] = "String", t2[t2.Json = 12] = "Json", t2[t2.DateTime = 13] = "DateTime", t2[t2.Binary = 14] = "Binary";
|
|
3243
|
-
}(a || (a = {}));
|
|
3244
|
-
class f {
|
|
3245
|
-
constructor() {
|
|
3246
|
-
this.bb = null, this.bb_pos = 0;
|
|
3247
|
-
}
|
|
3248
|
-
__init(t2, e2) {
|
|
3249
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3250
|
-
}
|
|
3251
|
-
static getRoot(t2, e2) {
|
|
3252
|
-
return (e2 || new f()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3253
|
-
}
|
|
3254
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3255
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new f()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3256
|
-
}
|
|
3257
|
-
name(t2) {
|
|
3258
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3259
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3260
|
-
}
|
|
3261
|
-
type() {
|
|
3262
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3263
|
-
return t2 ? this.bb.readUint8(this.bb_pos + t2) : a.Byte;
|
|
3264
|
-
}
|
|
3265
|
-
static start(t2) {
|
|
3266
|
-
t2.startObject(2);
|
|
3267
|
-
}
|
|
3268
|
-
static addName(t2, e2) {
|
|
3269
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3270
|
-
}
|
|
3271
|
-
static addType(t2, e2) {
|
|
3272
|
-
t2.addFieldInt8(1, e2, a.Byte);
|
|
3273
|
-
}
|
|
3274
|
-
static end(t2) {
|
|
3275
|
-
var e2 = t2.endObject();
|
|
3276
|
-
return t2.requiredField(e2, 4), e2;
|
|
3277
|
-
}
|
|
3278
|
-
static create(t2, e2, r2) {
|
|
3279
|
-
return f.start(t2), f.addName(t2, e2), f.addType(t2, r2), f.end(t2);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
class c {
|
|
3283
|
-
constructor() {
|
|
3284
|
-
this.bb = null, this.bb_pos = 0;
|
|
3285
|
-
}
|
|
3286
|
-
__init(t2, e2) {
|
|
3287
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3288
|
-
}
|
|
3289
|
-
static getRoot(t2, e2) {
|
|
3290
|
-
return (e2 || new c()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3291
|
-
}
|
|
3292
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3293
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new c()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3294
|
-
}
|
|
3295
|
-
ends(t2) {
|
|
3296
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3297
|
-
return e2 ? this.bb.readUint32(this.bb.__vector(this.bb_pos + e2) + 4 * t2) : 0;
|
|
3298
|
-
}
|
|
3299
|
-
endsLength() {
|
|
3300
|
-
var t2 = this.bb.__offset(this.bb_pos, 4);
|
|
3301
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3302
|
-
}
|
|
3303
|
-
endsArray() {
|
|
3304
|
-
var t2 = this.bb.__offset(this.bb_pos, 4);
|
|
3305
|
-
return t2 ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3306
|
-
}
|
|
3307
|
-
xy(t2) {
|
|
3308
|
-
var e2 = this.bb.__offset(this.bb_pos, 6);
|
|
3309
|
-
return e2 ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : 0;
|
|
3310
|
-
}
|
|
3311
|
-
xyLength() {
|
|
3312
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3313
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3314
|
-
}
|
|
3315
|
-
xyArray() {
|
|
3316
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3317
|
-
return t2 ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3318
|
-
}
|
|
3319
|
-
z(t2) {
|
|
3320
|
-
var e2 = this.bb.__offset(this.bb_pos, 8);
|
|
3321
|
-
return e2 ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : 0;
|
|
3322
|
-
}
|
|
3323
|
-
zLength() {
|
|
3324
|
-
var t2 = this.bb.__offset(this.bb_pos, 8);
|
|
3325
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3326
|
-
}
|
|
3327
|
-
zArray() {
|
|
3328
|
-
var t2 = this.bb.__offset(this.bb_pos, 8);
|
|
3329
|
-
return t2 ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3330
|
-
}
|
|
3331
|
-
m(t2) {
|
|
3332
|
-
var e2 = this.bb.__offset(this.bb_pos, 10);
|
|
3333
|
-
return e2 ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : 0;
|
|
3334
|
-
}
|
|
3335
|
-
mLength() {
|
|
3336
|
-
var t2 = this.bb.__offset(this.bb_pos, 10);
|
|
3337
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3338
|
-
}
|
|
3339
|
-
mArray() {
|
|
3340
|
-
var t2 = this.bb.__offset(this.bb_pos, 10);
|
|
3341
|
-
return t2 ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3342
|
-
}
|
|
3343
|
-
t(t2) {
|
|
3344
|
-
var e2 = this.bb.__offset(this.bb_pos, 12);
|
|
3345
|
-
return e2 ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : 0;
|
|
3346
|
-
}
|
|
3347
|
-
tLength() {
|
|
3348
|
-
var t2 = this.bb.__offset(this.bb_pos, 12);
|
|
3349
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3350
|
-
}
|
|
3351
|
-
tArray() {
|
|
3352
|
-
var t2 = this.bb.__offset(this.bb_pos, 12);
|
|
3353
|
-
return t2 ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3354
|
-
}
|
|
3355
|
-
tm(t2) {
|
|
3356
|
-
var e2 = this.bb.__offset(this.bb_pos, 14);
|
|
3357
|
-
return e2 ? this.bb.readUint64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : this.bb.createLong(0, 0);
|
|
3358
|
-
}
|
|
3359
|
-
tmLength() {
|
|
3360
|
-
var t2 = this.bb.__offset(this.bb_pos, 14);
|
|
3361
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3362
|
-
}
|
|
3363
|
-
type() {
|
|
3364
|
-
var t2 = this.bb.__offset(this.bb_pos, 16);
|
|
3365
|
-
return t2 ? this.bb.readUint8(this.bb_pos + t2) : o.Unknown;
|
|
3366
|
-
}
|
|
3367
|
-
parts(t2, e2) {
|
|
3368
|
-
var r2 = this.bb.__offset(this.bb_pos, 18);
|
|
3369
|
-
return r2 ? (e2 || new c()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r2) + 4 * t2), this.bb) : null;
|
|
3370
|
-
}
|
|
3371
|
-
partsLength() {
|
|
3372
|
-
var t2 = this.bb.__offset(this.bb_pos, 18);
|
|
3373
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3374
|
-
}
|
|
3375
|
-
static start(t2) {
|
|
3376
|
-
t2.startObject(8);
|
|
3377
|
-
}
|
|
3378
|
-
static addEnds(t2, e2) {
|
|
3379
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3380
|
-
}
|
|
3381
|
-
static createEndsVector(t2, e2) {
|
|
3382
|
-
t2.startVector(4, e2.length, 4);
|
|
3383
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3384
|
-
t2.addInt32(e2[r2]);
|
|
3385
|
-
return t2.endVector();
|
|
3386
|
-
}
|
|
3387
|
-
static startEndsVector(t2, e2) {
|
|
3388
|
-
t2.startVector(4, e2, 4);
|
|
3389
|
-
}
|
|
3390
|
-
static addXy(t2, e2) {
|
|
3391
|
-
t2.addFieldOffset(1, e2, 0);
|
|
3392
|
-
}
|
|
3393
|
-
static createXyVector(t2, e2) {
|
|
3394
|
-
t2.startVector(8, e2.length, 8);
|
|
3395
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3396
|
-
t2.addFloat64(e2[r2]);
|
|
3397
|
-
return t2.endVector();
|
|
3398
|
-
}
|
|
3399
|
-
static startXyVector(t2, e2) {
|
|
3400
|
-
t2.startVector(8, e2, 8);
|
|
3401
|
-
}
|
|
3402
|
-
static addZ(t2, e2) {
|
|
3403
|
-
t2.addFieldOffset(2, e2, 0);
|
|
3404
|
-
}
|
|
3405
|
-
static createZVector(t2, e2) {
|
|
3406
|
-
t2.startVector(8, e2.length, 8);
|
|
3407
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3408
|
-
t2.addFloat64(e2[r2]);
|
|
3409
|
-
return t2.endVector();
|
|
3410
|
-
}
|
|
3411
|
-
static startZVector(t2, e2) {
|
|
3412
|
-
t2.startVector(8, e2, 8);
|
|
3413
|
-
}
|
|
3414
|
-
static addM(t2, e2) {
|
|
3415
|
-
t2.addFieldOffset(3, e2, 0);
|
|
3416
|
-
}
|
|
3417
|
-
static createMVector(t2, e2) {
|
|
3418
|
-
t2.startVector(8, e2.length, 8);
|
|
3419
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3420
|
-
t2.addFloat64(e2[r2]);
|
|
3421
|
-
return t2.endVector();
|
|
3422
|
-
}
|
|
3423
|
-
static startMVector(t2, e2) {
|
|
3424
|
-
t2.startVector(8, e2, 8);
|
|
3425
|
-
}
|
|
3426
|
-
static addT(t2, e2) {
|
|
3427
|
-
t2.addFieldOffset(4, e2, 0);
|
|
3428
|
-
}
|
|
3429
|
-
static createTVector(t2, e2) {
|
|
3430
|
-
t2.startVector(8, e2.length, 8);
|
|
3431
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3432
|
-
t2.addFloat64(e2[r2]);
|
|
3433
|
-
return t2.endVector();
|
|
3434
|
-
}
|
|
3435
|
-
static startTVector(t2, e2) {
|
|
3436
|
-
t2.startVector(8, e2, 8);
|
|
3437
|
-
}
|
|
3438
|
-
static addTm(t2, e2) {
|
|
3439
|
-
t2.addFieldOffset(5, e2, 0);
|
|
3440
|
-
}
|
|
3441
|
-
static createTmVector(t2, e2) {
|
|
3442
|
-
t2.startVector(8, e2.length, 8);
|
|
3443
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3444
|
-
t2.addInt64(e2[r2]);
|
|
3445
|
-
return t2.endVector();
|
|
3446
|
-
}
|
|
3447
|
-
static startTmVector(t2, e2) {
|
|
3448
|
-
t2.startVector(8, e2, 8);
|
|
3449
|
-
}
|
|
3450
|
-
static addType(t2, e2) {
|
|
3451
|
-
t2.addFieldInt8(6, e2, o.Unknown);
|
|
3452
|
-
}
|
|
3453
|
-
static addParts(t2, e2) {
|
|
3454
|
-
t2.addFieldOffset(7, e2, 0);
|
|
3455
|
-
}
|
|
3456
|
-
static createPartsVector(t2, e2) {
|
|
3457
|
-
t2.startVector(4, e2.length, 4);
|
|
3458
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3459
|
-
t2.addOffset(e2[r2]);
|
|
3460
|
-
return t2.endVector();
|
|
3461
|
-
}
|
|
3462
|
-
static startPartsVector(t2, e2) {
|
|
3463
|
-
t2.startVector(4, e2, 4);
|
|
3464
|
-
}
|
|
3465
|
-
static end(t2) {
|
|
3466
|
-
return t2.endObject();
|
|
3467
|
-
}
|
|
3468
|
-
static create(t2, e2, r2, i2, n2, s2, o2, a2, b2) {
|
|
3469
|
-
return c.start(t2), c.addEnds(t2, e2), c.addXy(t2, r2), c.addZ(t2, i2), c.addM(t2, n2), c.addT(t2, s2), c.addTm(t2, o2), c.addType(t2, a2), c.addParts(t2, b2), c.end(t2);
|
|
3470
|
-
}
|
|
3471
|
-
}
|
|
3472
|
-
class d {
|
|
3473
|
-
constructor() {
|
|
3474
|
-
this.bb = null, this.bb_pos = 0;
|
|
3475
|
-
}
|
|
3476
|
-
__init(t2, e2) {
|
|
3477
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3478
|
-
}
|
|
3479
|
-
static getRoot(t2, e2) {
|
|
3480
|
-
return (e2 || new d()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3481
|
-
}
|
|
3482
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3483
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new d()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3484
|
-
}
|
|
3485
|
-
geometry(t2) {
|
|
3486
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3487
|
-
return e2 ? (t2 || new c()).__init(this.bb.__indirect(this.bb_pos + e2), this.bb) : null;
|
|
3488
|
-
}
|
|
3489
|
-
properties(t2) {
|
|
3490
|
-
var e2 = this.bb.__offset(this.bb_pos, 6);
|
|
3491
|
-
return e2 ? this.bb.readUint8(this.bb.__vector(this.bb_pos + e2) + t2) : 0;
|
|
3492
|
-
}
|
|
3493
|
-
propertiesLength() {
|
|
3494
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3495
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3496
|
-
}
|
|
3497
|
-
propertiesArray() {
|
|
3498
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3499
|
-
return t2 ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3500
|
-
}
|
|
3501
|
-
columns(t2, e2) {
|
|
3502
|
-
var r2 = this.bb.__offset(this.bb_pos, 8);
|
|
3503
|
-
return r2 ? (e2 || new f()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r2) + 4 * t2), this.bb) : null;
|
|
3504
|
-
}
|
|
3505
|
-
columnsLength() {
|
|
3506
|
-
var t2 = this.bb.__offset(this.bb_pos, 8);
|
|
3507
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3508
|
-
}
|
|
3509
|
-
static start(t2) {
|
|
3510
|
-
t2.startObject(3);
|
|
3511
|
-
}
|
|
3512
|
-
static addGeometry(t2, e2) {
|
|
3513
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3514
|
-
}
|
|
3515
|
-
static addProperties(t2, e2) {
|
|
3516
|
-
t2.addFieldOffset(1, e2, 0);
|
|
3517
|
-
}
|
|
3518
|
-
static createPropertiesVector(t2, e2) {
|
|
3519
|
-
t2.startVector(1, e2.length, 1);
|
|
3520
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3521
|
-
t2.addInt8(e2[r2]);
|
|
3522
|
-
return t2.endVector();
|
|
3523
|
-
}
|
|
3524
|
-
static startPropertiesVector(t2, e2) {
|
|
3525
|
-
t2.startVector(1, e2, 1);
|
|
3526
|
-
}
|
|
3527
|
-
static addColumns(t2, e2) {
|
|
3528
|
-
t2.addFieldOffset(2, e2, 0);
|
|
3529
|
-
}
|
|
3530
|
-
static createColumnsVector(t2, e2) {
|
|
3531
|
-
t2.startVector(4, e2.length, 4);
|
|
3532
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3533
|
-
t2.addOffset(e2[r2]);
|
|
3534
|
-
return t2.endVector();
|
|
3535
|
-
}
|
|
3536
|
-
static startColumnsVector(t2, e2) {
|
|
3537
|
-
t2.startVector(4, e2, 4);
|
|
3538
|
-
}
|
|
3539
|
-
static end(t2) {
|
|
3540
|
-
return t2.endObject();
|
|
3541
|
-
}
|
|
3542
|
-
static finishBuffer(t2, e2) {
|
|
3543
|
-
t2.finish(e2);
|
|
3544
|
-
}
|
|
3545
|
-
static finishSizePrefixedBuffer(t2, e2) {
|
|
3546
|
-
t2.finish(e2, void 0, true);
|
|
3547
|
-
}
|
|
3548
|
-
static create(t2, e2, r2, i2) {
|
|
3549
|
-
return d.start(t2), d.addGeometry(t2, e2), d.addProperties(t2, r2), d.addColumns(t2, i2), d.end(t2);
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
!function(t2) {
|
|
3553
|
-
t2[t2.Unknown = 0] = "Unknown", t2[t2.Point = 1] = "Point", t2[t2.LineString = 2] = "LineString", t2[t2.Polygon = 3] = "Polygon", t2[t2.MultiPoint = 4] = "MultiPoint", t2[t2.MultiLineString = 5] = "MultiLineString", t2[t2.MultiPolygon = 6] = "MultiPolygon", t2[t2.GeometryCollection = 7] = "GeometryCollection", t2[t2.CircularString = 8] = "CircularString", t2[t2.CompoundCurve = 9] = "CompoundCurve", t2[t2.CurvePolygon = 10] = "CurvePolygon", t2[t2.MultiCurve = 11] = "MultiCurve", t2[t2.MultiSurface = 12] = "MultiSurface", t2[t2.Curve = 13] = "Curve", t2[t2.Surface = 14] = "Surface", t2[t2.PolyhedralSurface = 15] = "PolyhedralSurface", t2[t2.TIN = 16] = "TIN", t2[t2.Triangle = 17] = "Triangle";
|
|
3554
|
-
}(b || (b = {})), function(t2) {
|
|
3555
|
-
t2[t2.Byte = 0] = "Byte", t2[t2.UByte = 1] = "UByte", t2[t2.Bool = 2] = "Bool", t2[t2.Short = 3] = "Short", t2[t2.UShort = 4] = "UShort", t2[t2.Int = 5] = "Int", t2[t2.UInt = 6] = "UInt", t2[t2.Long = 7] = "Long", t2[t2.ULong = 8] = "ULong", t2[t2.Float = 9] = "Float", t2[t2.Double = 10] = "Double", t2[t2.String = 11] = "String", t2[t2.Json = 12] = "Json", t2[t2.DateTime = 13] = "DateTime", t2[t2.Binary = 14] = "Binary";
|
|
3556
|
-
}(u || (u = {}));
|
|
3557
|
-
class l {
|
|
3558
|
-
constructor() {
|
|
3559
|
-
this.bb = null, this.bb_pos = 0;
|
|
3560
|
-
}
|
|
3561
|
-
__init(t2, e2) {
|
|
3562
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3563
|
-
}
|
|
3564
|
-
static getRoot(t2, e2) {
|
|
3565
|
-
return (e2 || new l()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3566
|
-
}
|
|
3567
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3568
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new l()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3569
|
-
}
|
|
3570
|
-
name(t2) {
|
|
3571
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3572
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3573
|
-
}
|
|
3574
|
-
type() {
|
|
3575
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3576
|
-
return t2 ? this.bb.readUint8(this.bb_pos + t2) : u.Byte;
|
|
3577
|
-
}
|
|
3578
|
-
static start(t2) {
|
|
3579
|
-
t2.startObject(2);
|
|
3580
|
-
}
|
|
3581
|
-
static addName(t2, e2) {
|
|
3582
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3583
|
-
}
|
|
3584
|
-
static addType(t2, e2) {
|
|
3585
|
-
t2.addFieldInt8(1, e2, u.Byte);
|
|
3586
|
-
}
|
|
3587
|
-
static end(t2) {
|
|
3588
|
-
var e2 = t2.endObject();
|
|
3589
|
-
return t2.requiredField(e2, 4), e2;
|
|
3590
|
-
}
|
|
3591
|
-
static create(t2, e2, r2) {
|
|
3592
|
-
return l.start(t2), l.addName(t2, e2), l.addType(t2, r2), l.end(t2);
|
|
3593
|
-
}
|
|
3594
|
-
}
|
|
3595
|
-
class p {
|
|
3596
|
-
constructor() {
|
|
3597
|
-
this.bb = null, this.bb_pos = 0;
|
|
3598
|
-
}
|
|
3599
|
-
__init(t2, e2) {
|
|
3600
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3601
|
-
}
|
|
3602
|
-
static getRoot(t2, e2) {
|
|
3603
|
-
return (e2 || new p()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3604
|
-
}
|
|
3605
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3606
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new p()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3607
|
-
}
|
|
3608
|
-
org(t2) {
|
|
3609
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3610
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3611
|
-
}
|
|
3612
|
-
code() {
|
|
3613
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3614
|
-
return t2 ? this.bb.readInt32(this.bb_pos + t2) : 0;
|
|
3615
|
-
}
|
|
3616
|
-
name(t2) {
|
|
3617
|
-
var e2 = this.bb.__offset(this.bb_pos, 8);
|
|
3618
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3619
|
-
}
|
|
3620
|
-
description(t2) {
|
|
3621
|
-
var e2 = this.bb.__offset(this.bb_pos, 10);
|
|
3622
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3623
|
-
}
|
|
3624
|
-
wkt(t2) {
|
|
3625
|
-
var e2 = this.bb.__offset(this.bb_pos, 12);
|
|
3626
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3627
|
-
}
|
|
3628
|
-
static start(t2) {
|
|
3629
|
-
t2.startObject(5);
|
|
3630
|
-
}
|
|
3631
|
-
static addOrg(t2, e2) {
|
|
3632
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3633
|
-
}
|
|
3634
|
-
static addCode(t2, e2) {
|
|
3635
|
-
t2.addFieldInt32(1, e2, 0);
|
|
3636
|
-
}
|
|
3637
|
-
static addName(t2, e2) {
|
|
3638
|
-
t2.addFieldOffset(2, e2, 0);
|
|
3639
|
-
}
|
|
3640
|
-
static addDescription(t2, e2) {
|
|
3641
|
-
t2.addFieldOffset(3, e2, 0);
|
|
3642
|
-
}
|
|
3643
|
-
static addWkt(t2, e2) {
|
|
3644
|
-
t2.addFieldOffset(4, e2, 0);
|
|
3645
|
-
}
|
|
3646
|
-
static end(t2) {
|
|
3647
|
-
return t2.endObject();
|
|
3648
|
-
}
|
|
3649
|
-
static create(t2, e2, r2, i2, n2, s2) {
|
|
3650
|
-
return p.start(t2), p.addOrg(t2, e2), p.addCode(t2, r2), p.addName(t2, i2), p.addDescription(t2, n2), p.addWkt(t2, s2), p.end(t2);
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
|
-
class _ {
|
|
3654
|
-
constructor() {
|
|
3655
|
-
this.bb = null, this.bb_pos = 0;
|
|
3656
|
-
}
|
|
3657
|
-
__init(t2, e2) {
|
|
3658
|
-
return this.bb_pos = t2, this.bb = e2, this;
|
|
3659
|
-
}
|
|
3660
|
-
static getRoot(t2, e2) {
|
|
3661
|
-
return (e2 || new _()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3662
|
-
}
|
|
3663
|
-
static getSizePrefixedRoot(t2, e2) {
|
|
3664
|
-
return t2.setPosition(t2.position() + h.SIZE_PREFIX_LENGTH), (e2 || new _()).__init(t2.readInt32(t2.position()) + t2.position(), t2);
|
|
3665
|
-
}
|
|
3666
|
-
name(t2) {
|
|
3667
|
-
var e2 = this.bb.__offset(this.bb_pos, 4);
|
|
3668
|
-
return e2 ? this.bb.__string(this.bb_pos + e2, t2) : null;
|
|
3669
|
-
}
|
|
3670
|
-
envelope(t2) {
|
|
3671
|
-
var e2 = this.bb.__offset(this.bb_pos, 6);
|
|
3672
|
-
return e2 ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e2) + 8 * t2) : 0;
|
|
3673
|
-
}
|
|
3674
|
-
envelopeLength() {
|
|
3675
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3676
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3677
|
-
}
|
|
3678
|
-
envelopeArray() {
|
|
3679
|
-
var t2 = this.bb.__offset(this.bb_pos, 6);
|
|
3680
|
-
return t2 ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t2), this.bb.__vector_len(this.bb_pos + t2)) : null;
|
|
3681
|
-
}
|
|
3682
|
-
geometryType() {
|
|
3683
|
-
var t2 = this.bb.__offset(this.bb_pos, 8);
|
|
3684
|
-
return t2 ? this.bb.readUint8(this.bb_pos + t2) : b.Unknown;
|
|
3685
|
-
}
|
|
3686
|
-
hasZ() {
|
|
3687
|
-
var t2 = this.bb.__offset(this.bb_pos, 10);
|
|
3688
|
-
return !!t2 && !!this.bb.readInt8(this.bb_pos + t2);
|
|
3689
|
-
}
|
|
3690
|
-
hasM() {
|
|
3691
|
-
var t2 = this.bb.__offset(this.bb_pos, 12);
|
|
3692
|
-
return !!t2 && !!this.bb.readInt8(this.bb_pos + t2);
|
|
3693
|
-
}
|
|
3694
|
-
hasT() {
|
|
3695
|
-
var t2 = this.bb.__offset(this.bb_pos, 14);
|
|
3696
|
-
return !!t2 && !!this.bb.readInt8(this.bb_pos + t2);
|
|
3697
|
-
}
|
|
3698
|
-
hasTM() {
|
|
3699
|
-
var t2 = this.bb.__offset(this.bb_pos, 16);
|
|
3700
|
-
return !!t2 && !!this.bb.readInt8(this.bb_pos + t2);
|
|
3701
|
-
}
|
|
3702
|
-
columns(t2, e2) {
|
|
3703
|
-
var r2 = this.bb.__offset(this.bb_pos, 18);
|
|
3704
|
-
return r2 ? (e2 || new l()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r2) + 4 * t2), this.bb) : null;
|
|
3705
|
-
}
|
|
3706
|
-
columnsLength() {
|
|
3707
|
-
var t2 = this.bb.__offset(this.bb_pos, 18);
|
|
3708
|
-
return t2 ? this.bb.__vector_len(this.bb_pos + t2) : 0;
|
|
3709
|
-
}
|
|
3710
|
-
featuresCount() {
|
|
3711
|
-
var t2 = this.bb.__offset(this.bb_pos, 20);
|
|
3712
|
-
return t2 ? this.bb.readUint64(this.bb_pos + t2) : this.bb.createLong(0, 0);
|
|
3713
|
-
}
|
|
3714
|
-
indexNodeSize() {
|
|
3715
|
-
var t2 = this.bb.__offset(this.bb_pos, 22);
|
|
3716
|
-
return t2 ? this.bb.readUint16(this.bb_pos + t2) : 16;
|
|
3717
|
-
}
|
|
3718
|
-
crs(t2) {
|
|
3719
|
-
var e2 = this.bb.__offset(this.bb_pos, 24);
|
|
3720
|
-
return e2 ? (t2 || new p()).__init(this.bb.__indirect(this.bb_pos + e2), this.bb) : null;
|
|
3721
|
-
}
|
|
3722
|
-
static start(t2) {
|
|
3723
|
-
t2.startObject(11);
|
|
3724
|
-
}
|
|
3725
|
-
static addName(t2, e2) {
|
|
3726
|
-
t2.addFieldOffset(0, e2, 0);
|
|
3727
|
-
}
|
|
3728
|
-
static addEnvelope(t2, e2) {
|
|
3729
|
-
t2.addFieldOffset(1, e2, 0);
|
|
3730
|
-
}
|
|
3731
|
-
static createEnvelopeVector(t2, e2) {
|
|
3732
|
-
t2.startVector(8, e2.length, 8);
|
|
3733
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3734
|
-
t2.addFloat64(e2[r2]);
|
|
3735
|
-
return t2.endVector();
|
|
3736
|
-
}
|
|
3737
|
-
static startEnvelopeVector(t2, e2) {
|
|
3738
|
-
t2.startVector(8, e2, 8);
|
|
3739
|
-
}
|
|
3740
|
-
static addGeometryType(t2, e2) {
|
|
3741
|
-
t2.addFieldInt8(2, e2, b.Unknown);
|
|
3742
|
-
}
|
|
3743
|
-
static addHasZ(t2, e2) {
|
|
3744
|
-
t2.addFieldInt8(3, +e2, 0);
|
|
3745
|
-
}
|
|
3746
|
-
static addHasM(t2, e2) {
|
|
3747
|
-
t2.addFieldInt8(4, +e2, 0);
|
|
3748
|
-
}
|
|
3749
|
-
static addHasT(t2, e2) {
|
|
3750
|
-
t2.addFieldInt8(5, +e2, 0);
|
|
3751
|
-
}
|
|
3752
|
-
static addHasTM(t2, e2) {
|
|
3753
|
-
t2.addFieldInt8(6, +e2, 0);
|
|
3754
|
-
}
|
|
3755
|
-
static addColumns(t2, e2) {
|
|
3756
|
-
t2.addFieldOffset(7, e2, 0);
|
|
3757
|
-
}
|
|
3758
|
-
static createColumnsVector(t2, e2) {
|
|
3759
|
-
t2.startVector(4, e2.length, 4);
|
|
3760
|
-
for (var r2 = e2.length - 1; r2 >= 0; r2--)
|
|
3761
|
-
t2.addOffset(e2[r2]);
|
|
3762
|
-
return t2.endVector();
|
|
3763
|
-
}
|
|
3764
|
-
static startColumnsVector(t2, e2) {
|
|
3765
|
-
t2.startVector(4, e2, 4);
|
|
3766
|
-
}
|
|
3767
|
-
static addFeaturesCount(t2, e2) {
|
|
3768
|
-
t2.addFieldInt64(8, e2, t2.createLong(0, 0));
|
|
3769
|
-
}
|
|
3770
|
-
static addIndexNodeSize(t2, e2) {
|
|
3771
|
-
t2.addFieldInt16(9, e2, 16);
|
|
3772
|
-
}
|
|
3773
|
-
static addCrs(t2, e2) {
|
|
3774
|
-
t2.addFieldOffset(10, e2, 0);
|
|
3775
|
-
}
|
|
3776
|
-
static end(t2) {
|
|
3777
|
-
return t2.endObject();
|
|
3778
|
-
}
|
|
3779
|
-
static finishBuffer(t2, e2) {
|
|
3780
|
-
t2.finish(e2);
|
|
3781
|
-
}
|
|
3782
|
-
static finishSizePrefixedBuffer(t2, e2) {
|
|
3783
|
-
t2.finish(e2, void 0, true);
|
|
3784
|
-
}
|
|
3785
|
-
static create(t2, e2, r2, i2, n2, s2, o2, a2, b2, u2, h2, f2) {
|
|
3786
|
-
return _.start(t2), _.addName(t2, e2), _.addEnvelope(t2, r2), _.addGeometryType(t2, i2), _.addHasZ(t2, n2), _.addHasM(t2, s2), _.addHasT(t2, o2), _.addHasTM(t2, a2), _.addColumns(t2, b2), _.addFeaturesCount(t2, u2), _.addIndexNodeSize(t2, h2), _.addCrs(t2, f2), _.end(t2);
|
|
3787
|
-
}
|
|
3788
|
-
}
|
|
3789
|
-
function y(t2) {
|
|
3790
|
-
return t2.reduce((t3, e2) => Array.isArray(e2) ? t3.concat(y(e2)) : t3.concat(e2), []);
|
|
3791
|
-
}
|
|
3792
|
-
function g(t2) {
|
|
3793
|
-
const e2 = [];
|
|
3794
|
-
for (let r2 = 0; r2 < t2.length; r2 += 2)
|
|
3795
|
-
e2.push([t2[r2], t2[r2 + 1]]);
|
|
3796
|
-
return e2;
|
|
3797
|
-
}
|
|
3798
|
-
function v(t2) {
|
|
3799
|
-
return b[t2];
|
|
3800
|
-
}
|
|
3801
|
-
function I(t2) {
|
|
3802
|
-
const e2 = t2.coordinates;
|
|
3803
|
-
let r2 = null, i2 = null, n2 = null, s2 = v(t2.type), o2 = 0;
|
|
3804
|
-
switch (t2.type) {
|
|
3805
|
-
case "Point":
|
|
3806
|
-
r2 = e2;
|
|
3807
|
-
break;
|
|
3808
|
-
case "MultiPoint":
|
|
3809
|
-
case "LineString":
|
|
3810
|
-
r2 = y(e2);
|
|
3811
|
-
break;
|
|
3812
|
-
case "MultiLineString":
|
|
3813
|
-
case "Polygon":
|
|
3814
|
-
const s3 = e2;
|
|
3815
|
-
r2 = y(s3), s3.length > 1 && (i2 = s3.map((t3) => o2 += t3.length));
|
|
3816
|
-
break;
|
|
3817
|
-
case "MultiPolygon":
|
|
3818
|
-
n2 = e2.map((t3) => ({ type: "Polygon", coordinates: t3 })).map(I);
|
|
3819
|
-
break;
|
|
3820
|
-
case "GeometryCollection":
|
|
3821
|
-
n2 = t2.geometries.map(I);
|
|
3822
|
-
}
|
|
3823
|
-
return { xy: r2, ends: i2, type: s2, parts: n2 };
|
|
3824
|
-
}
|
|
3825
|
-
function w(t2, e2) {
|
|
3826
|
-
if (!e2 || e2.length === 0)
|
|
3827
|
-
return [g(t2)];
|
|
3828
|
-
let r2 = 0;
|
|
3829
|
-
return Array.from(e2).map((e3) => t2.slice(r2, r2 = e3 << 1)).map((t3) => g(t3));
|
|
3830
|
-
}
|
|
3831
|
-
function B(t2, e2) {
|
|
3832
|
-
if (e2 == b.GeometryCollection) {
|
|
3833
|
-
const r3 = [];
|
|
3834
|
-
for (let e3 = 0; e3 < t2.partsLength(); e3++) {
|
|
3835
|
-
const i2 = t2.parts(e3), n2 = i2.type();
|
|
3836
|
-
r3.push(B(i2, n2));
|
|
3837
|
-
}
|
|
3838
|
-
return { type: b[e2], geometries: r3 };
|
|
3839
|
-
}
|
|
3840
|
-
if (e2 == b.MultiPolygon) {
|
|
3841
|
-
const r3 = [];
|
|
3842
|
-
for (let e3 = 0; e3 < t2.partsLength(); e3++) {
|
|
3843
|
-
const i2 = t2.parts(e3);
|
|
3844
|
-
r3.push(B(i2, b.Polygon));
|
|
3845
|
-
}
|
|
3846
|
-
return { type: b[e2], coordinates: r3.map((t3) => t3.coordinates) };
|
|
3847
|
-
}
|
|
3848
|
-
const r2 = function(t3, e3) {
|
|
3849
|
-
const r3 = t3.xyArray();
|
|
3850
|
-
switch (e3) {
|
|
3851
|
-
case b.Point:
|
|
3852
|
-
return Array.from(r3);
|
|
3853
|
-
case b.MultiPoint:
|
|
3854
|
-
case b.LineString:
|
|
3855
|
-
return g(r3);
|
|
3856
|
-
case b.MultiLineString:
|
|
3857
|
-
case b.Polygon:
|
|
3858
|
-
return w(r3, t3.endsArray());
|
|
3859
|
-
}
|
|
3860
|
-
}(t2, e2);
|
|
3861
|
-
return { type: b[e2], coordinates: r2 };
|
|
3862
|
-
}
|
|
3863
|
-
function m(t2, e2) {
|
|
3864
|
-
const r2 = e2.columns, i2 = new h.Builder(0), s2 = new Uint8Array(1e5);
|
|
3865
|
-
let o2 = 0;
|
|
3866
|
-
if (r2) {
|
|
3867
|
-
const e3 = new DataView(s2.buffer);
|
|
3868
|
-
for (let i3 = 0; i3 < r2.length; i3++) {
|
|
3869
|
-
const a3 = r2[i3], b3 = t2.properties[a3.name];
|
|
3870
|
-
if (b3 !== null)
|
|
3871
|
-
switch (e3.setUint16(o2, i3, true), o2 += 2, a3.type) {
|
|
3872
|
-
case n.Bool:
|
|
3873
|
-
e3.setUint8(o2, b3), o2 += 1;
|
|
3874
|
-
break;
|
|
3875
|
-
case n.Short:
|
|
3876
|
-
e3.setInt16(o2, b3, true), o2 += 2;
|
|
3877
|
-
break;
|
|
3878
|
-
case n.UShort:
|
|
3879
|
-
e3.setUint16(o2, b3, true), o2 += 2;
|
|
3880
|
-
break;
|
|
3881
|
-
case n.Int:
|
|
3882
|
-
e3.setInt32(o2, b3, true), o2 += 4;
|
|
3883
|
-
break;
|
|
3884
|
-
case n.UInt:
|
|
3885
|
-
e3.setUint32(o2, b3, true), o2 += 4;
|
|
3886
|
-
break;
|
|
3887
|
-
case n.Long:
|
|
3888
|
-
e3.setBigInt64(o2, BigInt(b3), true), o2 += 8;
|
|
3889
|
-
break;
|
|
3890
|
-
case n.Long:
|
|
3891
|
-
e3.setBigUint64(o2, BigInt(b3), true), o2 += 8;
|
|
3892
|
-
break;
|
|
3893
|
-
case n.Double:
|
|
3894
|
-
e3.setFloat64(o2, b3, true), o2 += 8;
|
|
3895
|
-
break;
|
|
3896
|
-
case n.String:
|
|
3897
|
-
const t3 = b3, r3 = new TextEncoder().encode(t3);
|
|
3898
|
-
e3.setUint32(o2, r3.length, true), o2 += 4, s2.set(r3, o2), o2 += r3.length;
|
|
3899
|
-
break;
|
|
3900
|
-
default:
|
|
3901
|
-
throw new Error("Unknown type");
|
|
3902
|
-
}
|
|
3903
|
-
}
|
|
3904
|
-
}
|
|
3905
|
-
let a2 = null;
|
|
3906
|
-
o2 > 0 && (a2 = d.createPropertiesVector(i2, s2.slice(0, o2)));
|
|
3907
|
-
const b2 = function t3(e3, r3) {
|
|
3908
|
-
const { xy: i3, ends: n2, parts: s3, type: o3 } = r3;
|
|
3909
|
-
if (s3) {
|
|
3910
|
-
const r4 = s3.map((r5) => t3(e3, r5)), i4 = c.createPartsVector(e3, r4);
|
|
3911
|
-
return c.start(e3), c.addParts(e3, i4), c.end(e3);
|
|
3912
|
-
}
|
|
3913
|
-
const a3 = c.createXyVector(e3, i3);
|
|
3914
|
-
let b3 = null;
|
|
3915
|
-
return n2 && (b3 = c.createEndsVector(e3, n2)), c.start(e3), b3 && c.addEnds(e3, b3), c.addXy(e3, a3), c.addType(e3, o3), c.end(e3);
|
|
3916
|
-
}(i2, I(t2.geometry));
|
|
3917
|
-
d.start(i2), d.addGeometry(i2, b2), a2 && d.addProperties(i2, a2);
|
|
3918
|
-
const u2 = d.end(i2);
|
|
3919
|
-
return i2.finishSizePrefixed(u2), i2.asUint8Array();
|
|
3920
|
-
}
|
|
3921
|
-
function F(t2, e2) {
|
|
3922
|
-
const r2 = e2.columns;
|
|
3923
|
-
let i2;
|
|
3924
|
-
i2 = B(t2.geometry(), e2.geometryType);
|
|
3925
|
-
const s2 = function(t3, e3) {
|
|
3926
|
-
if (!e3 || e3.length === 0)
|
|
3927
|
-
return;
|
|
3928
|
-
const r3 = t3.propertiesArray(), i3 = new DataView(r3.buffer, r3.byteOffset), s3 = t3.propertiesLength();
|
|
3929
|
-
let o3 = 0;
|
|
3930
|
-
const a2 = {};
|
|
3931
|
-
for (; o3 < s3; ) {
|
|
3932
|
-
const t4 = i3.getUint16(o3, true);
|
|
3933
|
-
o3 += 2;
|
|
3934
|
-
const s4 = e3[t4];
|
|
3935
|
-
switch (s4.type) {
|
|
3936
|
-
case n.Bool:
|
|
3937
|
-
a2[s4.name] = !!i3.getUint8(o3), o3 += 1;
|
|
3938
|
-
break;
|
|
3939
|
-
case n.Byte:
|
|
3940
|
-
a2[s4.name] = i3.getInt8(o3), o3 += 1;
|
|
3941
|
-
break;
|
|
3942
|
-
case n.UByte:
|
|
3943
|
-
a2[s4.name] = i3.getUint8(o3), o3 += 1;
|
|
3944
|
-
break;
|
|
3945
|
-
case n.Short:
|
|
3946
|
-
a2[s4.name] = i3.getInt16(o3, true), o3 += 2;
|
|
3947
|
-
break;
|
|
3948
|
-
case n.UShort:
|
|
3949
|
-
a2[s4.name] = i3.getUint16(o3, true), o3 += 2;
|
|
3950
|
-
break;
|
|
3951
|
-
case n.Int:
|
|
3952
|
-
a2[s4.name] = i3.getInt32(o3, true), o3 += 4;
|
|
3953
|
-
break;
|
|
3954
|
-
case n.UInt:
|
|
3955
|
-
a2[s4.name] = i3.getUint32(o3, true), o3 += 4;
|
|
3956
|
-
break;
|
|
3957
|
-
case n.Long:
|
|
3958
|
-
a2[s4.name] = Number(i3.getBigInt64(o3, true)), o3 += 8;
|
|
3959
|
-
break;
|
|
3960
|
-
case n.ULong:
|
|
3961
|
-
a2[s4.name] = Number(i3.getBigUint64(o3, true)), o3 += 8;
|
|
3962
|
-
break;
|
|
3963
|
-
case n.Double:
|
|
3964
|
-
a2[s4.name] = i3.getFloat64(o3, true), o3 += 8;
|
|
3965
|
-
break;
|
|
3966
|
-
case n.DateTime:
|
|
3967
|
-
case n.String: {
|
|
3968
|
-
const t5 = i3.getUint32(o3, true);
|
|
3969
|
-
o3 += 4;
|
|
3970
|
-
const e4 = new TextDecoder();
|
|
3971
|
-
a2[s4.name] = e4.decode(r3.subarray(o3, o3 + t5)), o3 += t5;
|
|
3972
|
-
break;
|
|
3973
|
-
}
|
|
3974
|
-
default:
|
|
3975
|
-
throw new Error("Unknown type " + s4.type);
|
|
3976
|
-
}
|
|
3977
|
-
}
|
|
3978
|
-
return a2;
|
|
3979
|
-
}(t2, r2), o2 = { type: "Feature", geometry: i2 };
|
|
3980
|
-
return s2 && (o2.properties = s2), o2;
|
|
3981
|
-
}
|
|
3982
|
-
function E(t2) {
|
|
3983
|
-
var e2;
|
|
3984
|
-
if (typeof Symbol != "undefined") {
|
|
3985
|
-
if (Symbol.asyncIterator && (e2 = t2[Symbol.asyncIterator]) != null)
|
|
3986
|
-
return e2.call(t2);
|
|
3987
|
-
if (Symbol.iterator && (e2 = t2[Symbol.iterator]) != null)
|
|
3988
|
-
return e2.call(t2);
|
|
3989
|
-
}
|
|
3990
|
-
throw new TypeError("Object is not async iterable");
|
|
3991
|
-
}
|
|
3992
|
-
function S(t2) {
|
|
3993
|
-
this.wrapped = t2;
|
|
3994
|
-
}
|
|
3995
|
-
function U(t2) {
|
|
3996
|
-
var e2, r2;
|
|
3997
|
-
function i2(e3, r3) {
|
|
3998
|
-
try {
|
|
3999
|
-
var s2 = t2[e3](r3), o2 = s2.value, a2 = o2 instanceof S;
|
|
4000
|
-
Promise.resolve(a2 ? o2.wrapped : o2).then(function(t3) {
|
|
4001
|
-
a2 ? i2(e3 === "return" ? "return" : "next", t3) : n2(s2.done ? "return" : "normal", t3);
|
|
4002
|
-
}, function(t3) {
|
|
4003
|
-
i2("throw", t3);
|
|
4004
|
-
});
|
|
4005
|
-
} catch (t3) {
|
|
4006
|
-
n2("throw", t3);
|
|
4007
|
-
}
|
|
4008
|
-
}
|
|
4009
|
-
function n2(t3, n3) {
|
|
4010
|
-
switch (t3) {
|
|
4011
|
-
case "return":
|
|
4012
|
-
e2.resolve({ value: n3, done: true });
|
|
4013
|
-
break;
|
|
4014
|
-
case "throw":
|
|
4015
|
-
e2.reject(n3);
|
|
4016
|
-
break;
|
|
4017
|
-
default:
|
|
4018
|
-
e2.resolve({ value: n3, done: false });
|
|
4019
|
-
}
|
|
4020
|
-
(e2 = e2.next) ? i2(e2.key, e2.arg) : r2 = null;
|
|
4021
|
-
}
|
|
4022
|
-
this._invoke = function(t3, n3) {
|
|
4023
|
-
return new Promise(function(s2, o2) {
|
|
4024
|
-
var a2 = { key: t3, arg: n3, resolve: s2, reject: o2, next: null };
|
|
4025
|
-
r2 ? r2 = r2.next = a2 : (e2 = r2 = a2, i2(t3, n3));
|
|
4026
|
-
});
|
|
4027
|
-
}, typeof t2.return != "function" && (this.return = void 0);
|
|
4028
|
-
}
|
|
4029
|
-
function T(t2) {
|
|
4030
|
-
return function() {
|
|
4031
|
-
return new U(t2.apply(this, arguments));
|
|
4032
|
-
};
|
|
4033
|
-
}
|
|
4034
|
-
function L(t2) {
|
|
4035
|
-
return new S(t2);
|
|
4036
|
-
}
|
|
4037
|
-
typeof Symbol == "function" && Symbol.asyncIterator && (U.prototype[Symbol.asyncIterator] = function() {
|
|
4038
|
-
return this;
|
|
4039
|
-
}), U.prototype.next = function(t2) {
|
|
4040
|
-
return this._invoke("next", t2);
|
|
4041
|
-
}, U.prototype.throw = function(t2) {
|
|
4042
|
-
return this._invoke("throw", t2);
|
|
4043
|
-
}, U.prototype.return = function(t2) {
|
|
4044
|
-
return this._invoke("return", t2);
|
|
4045
|
-
};
|
|
4046
|
-
var P = new Uint8Array(0);
|
|
4047
|
-
function O(t2, e2) {
|
|
4048
|
-
if (!t2.length)
|
|
4049
|
-
return e2;
|
|
4050
|
-
if (!e2.length)
|
|
4051
|
-
return t2;
|
|
4052
|
-
var r2 = new Uint8Array(t2.length + e2.length);
|
|
4053
|
-
return r2.set(t2), r2.set(e2, t2.length), r2;
|
|
4054
|
-
}
|
|
4055
|
-
function N(t2) {
|
|
4056
|
-
this._source = t2, this._array = P, this._index = 0;
|
|
4057
|
-
}
|
|
4058
|
-
N.prototype.read = function() {
|
|
4059
|
-
var t2 = this, e2 = t2._array.subarray(t2._index);
|
|
4060
|
-
return t2._source.read().then(function(r2) {
|
|
4061
|
-
return t2._array = P, t2._index = 0, r2.done ? e2.length > 0 ? { done: false, value: e2 } : { done: true, value: void 0 } : { done: false, value: O(e2, r2.value) };
|
|
4062
|
-
});
|
|
4063
|
-
}, N.prototype.slice = function(t2) {
|
|
4064
|
-
if ((t2 |= 0) < 0)
|
|
4065
|
-
throw new Error("invalid length");
|
|
4066
|
-
var e2 = this, r2 = this._array.length - this._index;
|
|
4067
|
-
if (this._index + t2 <= this._array.length)
|
|
4068
|
-
return Promise.resolve(this._array.subarray(this._index, this._index += t2));
|
|
4069
|
-
var i2 = new Uint8Array(t2);
|
|
4070
|
-
return i2.set(this._array.subarray(this._index)), function n2() {
|
|
4071
|
-
return e2._source.read().then(function(s2) {
|
|
4072
|
-
return s2.done ? (e2._array = P, e2._index = 0, r2 > 0 ? i2.subarray(0, r2) : null) : r2 + s2.value.length >= t2 ? (e2._array = s2.value, e2._index = t2 - r2, i2.set(s2.value.subarray(0, t2 - r2), r2), i2) : (i2.set(s2.value, r2), r2 += s2.value.length, n2());
|
|
4073
|
-
});
|
|
4074
|
-
}();
|
|
4075
|
-
}, N.prototype.cancel = function() {
|
|
4076
|
-
return this._source.cancel();
|
|
4077
|
-
};
|
|
4078
|
-
function V(t2, e2) {
|
|
4079
|
-
e2 = Math.min(Math.max(+e2, 2), 65535);
|
|
4080
|
-
let r2 = t2, i2 = r2;
|
|
4081
|
-
do {
|
|
4082
|
-
r2 = Math.ceil(r2 / e2), i2 += r2;
|
|
4083
|
-
} while (r2 !== 1);
|
|
4084
|
-
return 40 * i2;
|
|
4085
|
-
}
|
|
4086
|
-
function C(t2, e2) {
|
|
4087
|
-
if (e2 < 2)
|
|
4088
|
-
throw new Error("Node size must be at least 2");
|
|
4089
|
-
if (t2 === 0)
|
|
4090
|
-
throw new Error("Number of items must be greater than 0");
|
|
4091
|
-
let r2 = t2, i2 = r2;
|
|
4092
|
-
const n2 = [r2];
|
|
4093
|
-
do {
|
|
4094
|
-
r2 = Math.ceil(r2 / e2), i2 += r2, n2.push(r2);
|
|
4095
|
-
} while (r2 !== 1);
|
|
4096
|
-
const s2 = [];
|
|
4097
|
-
r2 = i2;
|
|
4098
|
-
for (let t3 of n2)
|
|
4099
|
-
s2.push(r2 - t3), r2 -= t3;
|
|
4100
|
-
s2.reverse(), n2.reverse();
|
|
4101
|
-
const o2 = [];
|
|
4102
|
-
for (let t3 = 0; t3 < n2.length; t3++)
|
|
4103
|
-
o2.push([s2[t3], s2[t3] + n2[t3]]);
|
|
4104
|
-
return o2.reverse(), o2;
|
|
4105
|
-
}
|
|
4106
|
-
function A(t2, e2, r2, i2) {
|
|
4107
|
-
return x.apply(this, arguments);
|
|
4108
|
-
}
|
|
4109
|
-
function x() {
|
|
4110
|
-
return (x = T(function* (t2, e2, r2, i2) {
|
|
4111
|
-
const { minX: n2, minY: s2, maxX: o2, maxY: a2 } = r2, b2 = C(t2, e2), [[u2, h2]] = b2, f2 = [];
|
|
4112
|
-
for (f2.push([0, b2.length - 1]); f2.length !== 0; ) {
|
|
4113
|
-
const [r3, c2] = f2.pop(), d2 = r3 >= h2 - t2, [, l2] = b2[c2], p2 = Math.min(r3 + e2, l2), _2 = p2 - r3, y2 = yield L(i2(40 * r3, 40 * _2)), g2 = new Float64Array(y2), v2 = new Uint32Array(y2);
|
|
4114
|
-
for (let t3 = r3; t3 < p2; t3++) {
|
|
4115
|
-
const e3 = 5 * (t3 - r3);
|
|
4116
|
-
if (o2 < g2[e3 + 0])
|
|
4117
|
-
continue;
|
|
4118
|
-
if (a2 < g2[e3 + 1])
|
|
4119
|
-
continue;
|
|
4120
|
-
if (n2 > g2[e3 + 2])
|
|
4121
|
-
continue;
|
|
4122
|
-
if (s2 > g2[e3 + 3])
|
|
4123
|
-
continue;
|
|
4124
|
-
const i3 = v2[8 + (e3 << 1)];
|
|
4125
|
-
d2 ? yield [i3, t3 - u2] : f2.push([i3, c2 - 1]);
|
|
4126
|
-
}
|
|
4127
|
-
f2.sort((t3, e3) => e3[0] - t3[0]);
|
|
4128
|
-
}
|
|
4129
|
-
})).apply(this, arguments);
|
|
4130
|
-
}
|
|
4131
|
-
const k = new Uint8Array([102, 103, 98, 3, 102, 103, 98, 0]);
|
|
4132
|
-
function R(t2, e2) {
|
|
4133
|
-
const r2 = typeof (i2 = t2).slice == "function" ? i2 : new N(typeof i2.read == "function" ? i2 : i2.getReader());
|
|
4134
|
-
var i2;
|
|
4135
|
-
return M(async (t3) => await r2.slice(t3), void 0, void 0, e2);
|
|
4136
|
-
}
|
|
4137
|
-
function M(t2, e2, r2, i2) {
|
|
4138
|
-
return G.apply(this, arguments);
|
|
4139
|
-
}
|
|
4140
|
-
function G() {
|
|
4141
|
-
return (G = T(function* (t2, e2, i2, n2) {
|
|
4142
|
-
let o2 = 0, a2 = new Uint8Array(yield L(t2(8)));
|
|
4143
|
-
if (o2 += 8, !a2.every((t3, e3) => k[e3] === t3))
|
|
4144
|
-
throw new Error("Not a FlatGeobuf file");
|
|
4145
|
-
a2 = new Uint8Array(yield L(t2(4))), o2 += 4;
|
|
4146
|
-
let b2 = new h.ByteBuffer(a2);
|
|
4147
|
-
const u2 = b2.readUint32(0);
|
|
4148
|
-
a2 = new Uint8Array(yield L(t2(u2))), o2 += u2, b2 = new h.ByteBuffer(a2);
|
|
4149
|
-
const f2 = _.getRoot(b2), c2 = f2.featuresCount().toFloat64(), d2 = [];
|
|
4150
|
-
for (let t3 = 0; t3 < f2.columnsLength(); t3++) {
|
|
4151
|
-
const e3 = f2.columns(t3);
|
|
4152
|
-
d2.push(new r(e3.name(), e3.type()));
|
|
4153
|
-
}
|
|
4154
|
-
const l2 = new s(f2.geometryType(), d2, c2), p2 = f2.indexNodeSize();
|
|
4155
|
-
if (p2 > 0) {
|
|
4156
|
-
const r2 = V(c2, p2);
|
|
4157
|
-
if (i2) {
|
|
4158
|
-
const s2 = async (r3, i3) => (await e2(o2 + r3), await t2(i3)), a3 = [];
|
|
4159
|
-
var y2, g2 = true, v2 = false;
|
|
4160
|
-
try {
|
|
4161
|
-
for (var I2, w2, B2 = E(A(c2, p2, i2, s2)); g2 = (I2 = yield L(B2.next())).done, w2 = yield L(I2.value), !g2; g2 = true) {
|
|
4162
|
-
let [t3] = w2;
|
|
4163
|
-
a3.push(t3);
|
|
4164
|
-
}
|
|
4165
|
-
} catch (t3) {
|
|
4166
|
-
v2 = true, y2 = t3;
|
|
4167
|
-
} finally {
|
|
4168
|
-
try {
|
|
4169
|
-
g2 || B2.return == null || (yield L(B2.return()));
|
|
4170
|
-
} finally {
|
|
4171
|
-
if (v2)
|
|
4172
|
-
throw y2;
|
|
4173
|
-
}
|
|
4174
|
-
}
|
|
4175
|
-
o2 += r2;
|
|
4176
|
-
var m2, F2 = true, S2 = false;
|
|
4177
|
-
try {
|
|
4178
|
-
for (var U2, T2, P2 = E(a3); F2 = (U2 = yield L(P2.next())).done, T2 = yield L(U2.value), !F2; F2 = true) {
|
|
4179
|
-
let r3 = T2;
|
|
4180
|
-
yield L(e2(o2 + r3)), yield D(t2, l2, n2);
|
|
4181
|
-
}
|
|
4182
|
-
} catch (t3) {
|
|
4183
|
-
S2 = true, m2 = t3;
|
|
4184
|
-
} finally {
|
|
4185
|
-
try {
|
|
4186
|
-
F2 || P2.return == null || (yield L(P2.return()));
|
|
4187
|
-
} finally {
|
|
4188
|
-
if (S2)
|
|
4189
|
-
throw m2;
|
|
4190
|
-
}
|
|
4191
|
-
}
|
|
4192
|
-
return;
|
|
4193
|
-
}
|
|
4194
|
-
e2 ? yield L(e2(o2 + r2)) : yield L(t2(r2)), o2 += r2;
|
|
4195
|
-
}
|
|
4196
|
-
let O2;
|
|
4197
|
-
for (; O2 = yield L(D(t2, l2, n2)); )
|
|
4198
|
-
yield O2;
|
|
4199
|
-
})).apply(this, arguments);
|
|
4200
|
-
}
|
|
4201
|
-
async function D(t2, e2, r2) {
|
|
4202
|
-
let i2 = new Uint8Array(await t2(4));
|
|
4203
|
-
if (i2.byteLength === 0)
|
|
4204
|
-
return null;
|
|
4205
|
-
let n2 = new h.ByteBuffer(i2);
|
|
4206
|
-
const s2 = n2.readUint32(0);
|
|
4207
|
-
i2 = new Uint8Array(await t2(s2));
|
|
4208
|
-
const o2 = new Uint8Array(s2 + 4);
|
|
4209
|
-
return o2.set(i2, 4), n2 = new h.ByteBuffer(o2), n2.setPosition(4), r2(d.getRoot(n2), e2);
|
|
4210
|
-
}
|
|
4211
|
-
function Z(t2) {
|
|
4212
|
-
const e2 = new h.Builder(0);
|
|
4213
|
-
let r2 = null;
|
|
4214
|
-
t2.columns && (r2 = _.createColumnsVector(e2, t2.columns.map((t3) => function(t4, e3) {
|
|
4215
|
-
const r3 = t4.createString(e3.name);
|
|
4216
|
-
return l.start(t4), l.addName(t4, r3), l.addType(t4, e3.type), l.end(t4);
|
|
4217
|
-
}(e2, t3))));
|
|
4218
|
-
const i2 = e2.createString("L1");
|
|
4219
|
-
_.start(e2), _.addFeaturesCount(e2, new h.Long(t2.featuresCount, 0)), _.addGeometryType(e2, t2.geometryType), _.addIndexNodeSize(e2, 0), r2 && _.addColumns(e2, r2), _.addName(e2, i2);
|
|
4220
|
-
const n2 = _.end(e2);
|
|
4221
|
-
return e2.finishSizePrefixed(n2), e2.asUint8Array();
|
|
4222
|
-
}
|
|
4223
|
-
function H(t2) {
|
|
4224
|
-
const e2 = function(t3) {
|
|
4225
|
-
const e3 = t3.features[0], i3 = e3.properties;
|
|
4226
|
-
let o3 = null;
|
|
4227
|
-
i3 && (o3 = Object.keys(i3).map((t4) => new r(t4, function(t5) {
|
|
4228
|
-
if (typeof t5 == "boolean")
|
|
4229
|
-
return n.Bool;
|
|
4230
|
-
if (typeof t5 == "number")
|
|
4231
|
-
return t5 % 1 == 0 ? n.Int : n.Double;
|
|
4232
|
-
if (typeof t5 == "string")
|
|
4233
|
-
return n.String;
|
|
4234
|
-
if (t5 === null)
|
|
4235
|
-
return n.String;
|
|
4236
|
-
throw new Error(`Unknown type (value '${t5}')`);
|
|
4237
|
-
}(i3[t4]))));
|
|
4238
|
-
const a3 = new Set();
|
|
4239
|
-
for (const r2 of t3.features)
|
|
4240
|
-
a3.add(e3.geometry.type);
|
|
4241
|
-
return new s(v(e3.geometry.type), o3, t3.features.length);
|
|
4242
|
-
}(t2), i2 = Z(e2), o2 = t2.features.map((t3) => m(t3, e2)), a2 = o2.map((t3) => t3.length).reduce((t3, e3) => t3 + e3), b2 = new Uint8Array(k.length + i2.length + a2);
|
|
4243
|
-
b2.set(i2, k.length);
|
|
4244
|
-
let u2 = k.length + i2.length;
|
|
4245
|
-
for (const t3 of o2)
|
|
4246
|
-
b2.set(t3, u2), u2 += t3.length;
|
|
4247
|
-
return b2.set(k), b2;
|
|
4248
|
-
}
|
|
4249
|
-
function j(t2) {
|
|
4250
|
-
return { type: "FeatureCollection", features: function(t3, e2) {
|
|
4251
|
-
if (!t3.subarray(0, 7).every((t4, e3) => k[e3] === t4))
|
|
4252
|
-
throw new Error("Not a FlatGeobuf file");
|
|
4253
|
-
const i2 = new h.ByteBuffer(t3), n2 = i2.readUint32(k.length);
|
|
4254
|
-
i2.setPosition(k.length + 4);
|
|
4255
|
-
const o2 = _.getRoot(i2), a2 = o2.featuresCount().toFloat64(), b2 = [];
|
|
4256
|
-
for (let t4 = 0; t4 < o2.columnsLength(); t4++) {
|
|
4257
|
-
const e3 = o2.columns(t4);
|
|
4258
|
-
b2.push(new r(e3.name(), e3.type()));
|
|
4259
|
-
}
|
|
4260
|
-
const u2 = new s(o2.geometryType(), b2, 0);
|
|
4261
|
-
let f2 = k.length + 4 + n2;
|
|
4262
|
-
const c2 = o2.indexNodeSize();
|
|
4263
|
-
c2 > 0 && (f2 += V(a2, c2));
|
|
4264
|
-
const l2 = [];
|
|
4265
|
-
for (; f2 < i2.capacity(); ) {
|
|
4266
|
-
const t4 = i2.readUint32(f2);
|
|
4267
|
-
i2.setPosition(f2 + 4);
|
|
4268
|
-
const r2 = d.getRoot(i2);
|
|
4269
|
-
l2.push(e2(r2, u2)), f2 += 4 + t4;
|
|
4270
|
-
}
|
|
4271
|
-
return l2;
|
|
4272
|
-
}(t2, (t3, e2) => F(t3, e2)) };
|
|
4273
|
-
}
|
|
4274
|
-
function z(t2, e2) {
|
|
4275
|
-
return function(t3, e3, r2) {
|
|
4276
|
-
let i2 = 0;
|
|
4277
|
-
return M(async (e4) => {
|
|
4278
|
-
const r3 = await fetch(t3, { headers: { Range: `bytes=${i2}-${i2 + e4 - 1}` } });
|
|
4279
|
-
return i2 += e4, await r3.arrayBuffer();
|
|
4280
|
-
}, async (t4) => {
|
|
4281
|
-
i2 = t4;
|
|
4282
|
-
}, e3, r2);
|
|
4283
|
-
}(t2, e2, (t3, e3) => F(t3, e3));
|
|
4284
|
-
}
|
|
4285
|
-
t.deserialize = function(t2, r2) {
|
|
4286
|
-
return t2 instanceof Uint8Array ? j(t2) : t2 instanceof e.ReadableStream ? R(t2, (t3, e2) => F(t3, e2)) : z(t2, r2);
|
|
4287
|
-
}, t.serialize = function(t2) {
|
|
4288
|
-
return H(t2);
|
|
4289
|
-
}, Object.defineProperty(t, "__esModule", { value: true });
|
|
4290
|
-
});
|
|
4291
|
-
}
|
|
4292
|
-
});
|
|
4293
|
-
|
|
4294
|
-
// src/lib/parse-flatgeobuf.ts
|
|
4295
|
-
function parseFlatGeobuf(input, options) {
|
|
4296
|
-
if (input.byteLength === 0) {
|
|
4297
|
-
return [];
|
|
4298
|
-
}
|
|
4299
|
-
const arr = new Uint8Array(input);
|
|
4300
|
-
const { features } = (0, import_flatgeobuf_geojson.deserialize)(arr);
|
|
4301
|
-
return features;
|
|
4302
|
-
}
|
|
4303
|
-
function parseFlatGeobufInBatches(stream, options) {
|
|
4304
|
-
const iterator = (0, import_flatgeobuf_geojson.deserializeStream)(stream);
|
|
4305
|
-
return iterator;
|
|
4306
|
-
}
|
|
4307
|
-
var import_flatgeobuf_geojson;
|
|
4308
|
-
var init_parse_flatgeobuf = __esm({
|
|
4309
|
-
"src/lib/parse-flatgeobuf.ts"() {
|
|
4310
|
-
import_flatgeobuf_geojson = __toModule(require_flatgeobuf_geojson_min());
|
|
4311
|
-
}
|
|
4312
|
-
});
|
|
4313
|
-
|
|
4314
|
-
// src/index.ts
|
|
4315
|
-
var src_exports = {};
|
|
4316
|
-
__export(src_exports, {
|
|
4317
|
-
FlatGeobufLoader: () => FlatGeobufLoader2,
|
|
4318
|
-
FlatGeobufWorkerLoader: () => FlatGeobufLoader,
|
|
4319
|
-
_typecheckFlatGeobufLoader: () => _typecheckFlatGeobufLoader
|
|
4320
|
-
});
|
|
4321
|
-
var FlatGeobufLoader2, _typecheckFlatGeobufLoader;
|
|
4322
|
-
var init_src = __esm({
|
|
4323
|
-
"src/index.ts"() {
|
|
4324
|
-
init_flatgeobuf_loader();
|
|
4325
|
-
init_parse_flatgeobuf();
|
|
4326
|
-
FlatGeobufLoader2 = {
|
|
4327
|
-
...FlatGeobufLoader,
|
|
4328
|
-
parse: async (arrayBuffer, options) => parseFlatGeobuf(arrayBuffer, options),
|
|
4329
|
-
parseSync: parseFlatGeobuf,
|
|
4330
|
-
parseInBatchesFromStream: parseFlatGeobufInBatches,
|
|
4331
|
-
binary: true
|
|
4332
|
-
};
|
|
4333
|
-
_typecheckFlatGeobufLoader = FlatGeobufLoader2;
|
|
4334
|
-
}
|
|
4335
|
-
});
|
|
4336
|
-
|
|
4337
|
-
// src/bundle.ts
|
|
4338
|
-
var require_bundle = __commonJS({
|
|
4339
|
-
"src/bundle.ts"(exports, module) {
|
|
4340
|
-
var moduleExports = (init_src(), src_exports);
|
|
4341
|
-
globalThis.loaders = globalThis.loaders || {};
|
|
4342
|
-
module.exports = Object.assign(globalThis.loaders, moduleExports);
|
|
4343
|
-
}
|
|
4344
|
-
});
|
|
4345
|
-
require_bundle();
|
|
4346
|
-
})();
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
const moduleExports = require('./index');
|
|
4
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
5
|
+
module.exports = Object.assign(globalThis.loaders, moduleExports);
|