@loaders.gl/tiles-3d 5.0.0-beta.2 → 5.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +1393 -962
- package/dist/3d-tiles/dist.min.js +37 -37
- package/dist/3d-tiles/index.cjs +989 -987
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js +12 -8
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/cesium-ion-loader-with-parser.cjs +983 -981
- package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
- package/dist/copc/copc-source-loader.js +2 -2
- package/dist/copc/copc-source-loader.js.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/index.cjs +365 -170
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +231 -38
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +6591 -1184
- package/dist/i3s/dist.min.js +55 -47
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +4763 -1136
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +1148 -391
- package/dist/i3s-lepcc-worker-node.js +609 -44
- package/dist/i3s-lepcc-worker-node.js.map +4 -4
- package/dist/i3s-lepcc-worker.js +575 -40
- package/dist/i3s-mesh-writer.cjs +8880 -5253
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/point-cloud-tile-source-loader-types.js +1 -1
- package/dist/point-cloud-tile-source-loader.cjs +1 -1
- package/dist/potree/dist.dev.js +310 -110
- package/dist/potree/dist.min.js +31 -31
- package/dist/potree/index.cjs +19 -166
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-source-loader.js +1 -1
- package/dist/potree/potree-writer.js +1 -1
- package/dist/potree-loader.cjs +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/classes/tile-3d-batch-table.ts +12 -8
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
- package/src/copc/copc-source-loader.ts +1 -1
package/dist/copc/index.cjs
CHANGED
|
@@ -139,6 +139,38 @@ var init_merge_options = __esm({
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
// ../core/src/constants/index.ts
|
|
143
|
+
var LOADERS_GL_FIXTURE_BRANCH, LOADERS_GL_RAW_FIXTURE_URL, LOADERS_GL_REDIRECTING_FIXTURE_URL, NPM_TAG;
|
|
144
|
+
var init_constants = __esm({
|
|
145
|
+
"../core/src/constants/index.ts"() {
|
|
146
|
+
"use strict";
|
|
147
|
+
LOADERS_GL_FIXTURE_BRANCH = "master";
|
|
148
|
+
LOADERS_GL_RAW_FIXTURE_URL = `https://raw.githubusercontent.com/visgl/loaders.gl/${LOADERS_GL_FIXTURE_BRANCH}/`;
|
|
149
|
+
LOADERS_GL_REDIRECTING_FIXTURE_URL = `https://github.com/visgl/loaders.gl/raw/${LOADERS_GL_FIXTURE_BRANCH}/`;
|
|
150
|
+
NPM_TAG = "beta";
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// ../core/src/worker-utils/lib/npm-tag.ts
|
|
155
|
+
var init_npm_tag = __esm({
|
|
156
|
+
"../core/src/worker-utils/lib/npm-tag.ts"() {
|
|
157
|
+
"use strict";
|
|
158
|
+
init_constants();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// ../core/src/worker-utils/lib/env-utils/assert.ts
|
|
163
|
+
function assert(condition, message) {
|
|
164
|
+
if (!condition) {
|
|
165
|
+
throw new Error(message || "loaders.gl assertion failed.");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
var init_assert = __esm({
|
|
169
|
+
"../core/src/worker-utils/lib/env-utils/assert.ts"() {
|
|
170
|
+
"use strict";
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
142
174
|
// ../core/src/worker-utils/lib/env-utils/globals.ts
|
|
143
175
|
var globals2, self_2, window_2, global_2, document_2, isBrowser2, isMobile, matches2, nodeVersion2;
|
|
144
176
|
var init_globals2 = __esm({
|
|
@@ -162,12 +194,318 @@ var init_globals2 = __esm({
|
|
|
162
194
|
}
|
|
163
195
|
});
|
|
164
196
|
|
|
165
|
-
// ../core/src/worker-utils/lib/worker-api/
|
|
197
|
+
// ../core/src/worker-utils/lib/worker-api/get-worker-url.ts
|
|
198
|
+
function getCustomWorkerURL(worker, options = {}) {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
201
|
+
let url = getConfiguredWorkerURL(worker, options);
|
|
202
|
+
const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
|
|
203
|
+
if (!url && workerType === "test") {
|
|
204
|
+
if (isBrowser2) {
|
|
205
|
+
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
206
|
+
} else {
|
|
207
|
+
const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
|
|
208
|
+
const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
|
|
209
|
+
url = `modules/${worker.module}/src/${workerSourceNode}`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return url || null;
|
|
213
|
+
}
|
|
214
|
+
function getConfiguredWorkerURL(worker, options = {}) {
|
|
215
|
+
const workerOptions = options[worker.id] || {};
|
|
216
|
+
return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
|
|
217
|
+
}
|
|
218
|
+
function getWorkerURL(worker, options = {}) {
|
|
219
|
+
const customWorkerUrl = getCustomWorkerURL(worker, options);
|
|
220
|
+
const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
|
|
221
|
+
const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
|
|
222
|
+
assert(url);
|
|
223
|
+
return url;
|
|
224
|
+
}
|
|
225
|
+
function getDefaultWorkerURL(worker, warn = false) {
|
|
226
|
+
const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
227
|
+
let version2 = worker.version;
|
|
228
|
+
if (version2 === "latest") {
|
|
229
|
+
version2 = NPM_TAG;
|
|
230
|
+
}
|
|
231
|
+
const versionTag = version2 ? `@${version2}` : "";
|
|
232
|
+
const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
|
|
233
|
+
if (warn) {
|
|
234
|
+
warnIfUsingNpmTagFallback(worker, url);
|
|
235
|
+
}
|
|
236
|
+
return url;
|
|
237
|
+
}
|
|
238
|
+
function warnIfUsingNpmTagFallback(worker, url) {
|
|
239
|
+
if (worker.version !== "latest") {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const workerId = `${worker.module}:${worker.id}`;
|
|
243
|
+
if (warnedWorkerVersionFallbacks.has(workerId)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
warnedWorkerVersionFallbacks.add(workerId);
|
|
247
|
+
console.warn(
|
|
248
|
+
`loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
var warnedWorkerVersionFallbacks;
|
|
252
|
+
var init_get_worker_url = __esm({
|
|
253
|
+
"../core/src/worker-utils/lib/worker-api/get-worker-url.ts"() {
|
|
254
|
+
"use strict";
|
|
255
|
+
init_assert();
|
|
256
|
+
init_globals2();
|
|
257
|
+
init_npm_tag();
|
|
258
|
+
warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
263
|
+
function normalizeTaskProgress(progress) {
|
|
264
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
265
|
+
}
|
|
166
266
|
var import_tasks;
|
|
267
|
+
var init_task_runtime = __esm({
|
|
268
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
269
|
+
"use strict";
|
|
270
|
+
import_tasks = require("@math.gl/tasks");
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
275
|
+
function getTransferList(object, recursive = true, transfers) {
|
|
276
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
277
|
+
if (!object) {
|
|
278
|
+
} else if (isTransferable(object)) {
|
|
279
|
+
transfersSet.add(object);
|
|
280
|
+
} else if (isTransferable(object.buffer)) {
|
|
281
|
+
transfersSet.add(object.buffer);
|
|
282
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
283
|
+
} else if (recursive && typeof object === "object") {
|
|
284
|
+
for (const key in object) {
|
|
285
|
+
getTransferList(object[key], recursive, transfersSet);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
289
|
+
}
|
|
290
|
+
function isTransferable(object) {
|
|
291
|
+
if (!object) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
if (object instanceof ArrayBuffer) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
function getTransferListForWriter(object) {
|
|
309
|
+
if (object === null) {
|
|
310
|
+
return {};
|
|
311
|
+
}
|
|
312
|
+
const clone = Object.assign({}, object);
|
|
313
|
+
Object.keys(clone).forEach((key) => {
|
|
314
|
+
if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
|
|
315
|
+
clone[key] = getTransferListForWriter(object[key]);
|
|
316
|
+
} else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
|
|
317
|
+
clone[key] = {};
|
|
318
|
+
} else {
|
|
319
|
+
clone[key] = object[key];
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
return clone;
|
|
323
|
+
}
|
|
324
|
+
var init_get_transfer_list = __esm({
|
|
325
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
326
|
+
"use strict";
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// ../core/src/worker-utils/lib/worker-api/process-on-worker.ts
|
|
331
|
+
function canProcessOnWorker(worker, options = {}) {
|
|
332
|
+
const supported = isBrowser2 ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
|
|
333
|
+
return Boolean(
|
|
334
|
+
supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options))
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
|
|
338
|
+
const session = await openSession(worker, options, context, jobContext);
|
|
339
|
+
try {
|
|
340
|
+
const result = await session.handle.runTask(
|
|
341
|
+
{ value: data },
|
|
342
|
+
{
|
|
343
|
+
...getControls(options),
|
|
344
|
+
options: getParserOptions(options)
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
return result.value;
|
|
348
|
+
} finally {
|
|
349
|
+
await session.close();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function getTask(worker, options) {
|
|
353
|
+
var _a;
|
|
354
|
+
if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
|
|
355
|
+
throw new Error(
|
|
356
|
+
"Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory"
|
|
357
|
+
);
|
|
358
|
+
const create = !getCustomWorkerURL(worker, options) && isBrowser2 ? worker.loadWorker : void 0;
|
|
359
|
+
const url = getWorkerURL(worker, options);
|
|
360
|
+
return {
|
|
361
|
+
id: `${worker.module}:${worker.id}`,
|
|
362
|
+
initialize: (state) => state,
|
|
363
|
+
worker: {
|
|
364
|
+
...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
|
|
365
|
+
capabilities: { atomic: true, streaming: true }
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function getControls(options) {
|
|
370
|
+
return {
|
|
371
|
+
execution: "worker",
|
|
372
|
+
signal: options.signal,
|
|
373
|
+
inputOwnership: options.inputOwnership ?? "transfer",
|
|
374
|
+
outputOwnership: options.outputOwnership ?? "transfer",
|
|
375
|
+
onProgress: options.onProgress ? (progress) => {
|
|
376
|
+
var _a;
|
|
377
|
+
return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
|
|
378
|
+
} : void 0
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function getParserOptions(options) {
|
|
382
|
+
const { signal, onProgress, ...parserOptions } = options;
|
|
383
|
+
return getTransferListForWriter(parserOptions);
|
|
384
|
+
}
|
|
385
|
+
async function openSession(worker, options, context, jobContext) {
|
|
386
|
+
var _a, _b;
|
|
387
|
+
(_a = options.signal) == null ? void 0 : _a.throwIfAborted();
|
|
388
|
+
const task = getTask(worker, options);
|
|
389
|
+
let state = runners.get(worker);
|
|
390
|
+
if (!state) {
|
|
391
|
+
state = {
|
|
392
|
+
runner: new import_tasks2.TaskRunner({
|
|
393
|
+
maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
|
|
394
|
+
}),
|
|
395
|
+
requests: 0
|
|
396
|
+
};
|
|
397
|
+
runners.set(worker, state);
|
|
398
|
+
}
|
|
399
|
+
const runnerState = state;
|
|
400
|
+
const channel = context.process ? new MessageChannel() : void 0;
|
|
401
|
+
const callbackController = new AbortController();
|
|
402
|
+
let channelClosed = false;
|
|
403
|
+
const abortCallbacks = () => {
|
|
404
|
+
var _a2;
|
|
405
|
+
return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
406
|
+
};
|
|
407
|
+
(_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
|
|
408
|
+
const closeChannel = () => {
|
|
409
|
+
var _a2;
|
|
410
|
+
channelClosed = true;
|
|
411
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
|
|
412
|
+
callbackController.abort();
|
|
413
|
+
channel == null ? void 0 : channel.port1.close();
|
|
414
|
+
channel == null ? void 0 : channel.port2.close();
|
|
415
|
+
};
|
|
416
|
+
if (channel) {
|
|
417
|
+
channel.port1.onmessage = async ({ data }) => {
|
|
418
|
+
try {
|
|
419
|
+
const value = await context.process(
|
|
420
|
+
data.input,
|
|
421
|
+
data.options,
|
|
422
|
+
{
|
|
423
|
+
signal: callbackController.signal,
|
|
424
|
+
throwIfAborted: () => callbackController.signal.throwIfAborted()
|
|
425
|
+
},
|
|
426
|
+
data.context
|
|
427
|
+
);
|
|
428
|
+
if (!channelClosed && !callbackController.signal.aborted)
|
|
429
|
+
channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
|
|
430
|
+
} catch (error) {
|
|
431
|
+
if (channelClosed || callbackController.signal.aborted) return;
|
|
432
|
+
channel.port1.postMessage({
|
|
433
|
+
identifier: data.identifier,
|
|
434
|
+
error: {
|
|
435
|
+
name: error instanceof Error ? error.name : "Error",
|
|
436
|
+
message: error instanceof Error ? error.message : String(error)
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
channel.port1.start();
|
|
442
|
+
}
|
|
443
|
+
runnerState.requests++;
|
|
444
|
+
activeRunners.add(runnerState);
|
|
445
|
+
let released = false;
|
|
446
|
+
const releaseRunner = () => {
|
|
447
|
+
if (released) return;
|
|
448
|
+
released = true;
|
|
449
|
+
runnerState.requests--;
|
|
450
|
+
if (!runnerState.requests) activeRunners.delete(runnerState);
|
|
451
|
+
};
|
|
452
|
+
let handle;
|
|
453
|
+
try {
|
|
454
|
+
handle = await runnerState.runner.initializeTask(
|
|
455
|
+
task,
|
|
456
|
+
{
|
|
457
|
+
context: structuredClone(jobContext),
|
|
458
|
+
...channel ? { port: channel.port2 } : {}
|
|
459
|
+
},
|
|
460
|
+
// The callback port is setup state, independent of the caller's payload ownership.
|
|
461
|
+
{ ...getControls(options), inputOwnership: "transfer" }
|
|
462
|
+
);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
releaseRunner();
|
|
465
|
+
closeChannel();
|
|
466
|
+
throw error;
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
handle,
|
|
470
|
+
/** Releases the worker and callback channel on success, failure, and early stream return. */
|
|
471
|
+
async close() {
|
|
472
|
+
try {
|
|
473
|
+
await handle.close();
|
|
474
|
+
} finally {
|
|
475
|
+
closeChannel();
|
|
476
|
+
releaseRunner();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function createModuleWorker(url) {
|
|
482
|
+
var _a;
|
|
483
|
+
const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
|
|
484
|
+
let workerUrl = resolved.href;
|
|
485
|
+
if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
|
|
486
|
+
let shimUrl = moduleWorkerUrls.get(resolved.href);
|
|
487
|
+
if (!shimUrl) {
|
|
488
|
+
shimUrl = URL.createObjectURL(
|
|
489
|
+
new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" })
|
|
490
|
+
);
|
|
491
|
+
moduleWorkerUrls.set(resolved.href, shimUrl);
|
|
492
|
+
}
|
|
493
|
+
workerUrl = shimUrl;
|
|
494
|
+
}
|
|
495
|
+
return new Worker(workerUrl, { type: "module" });
|
|
496
|
+
}
|
|
497
|
+
var import_tasks2, runners, activeRunners, moduleWorkerUrls;
|
|
167
498
|
var init_process_on_worker = __esm({
|
|
168
499
|
"../core/src/worker-utils/lib/worker-api/process-on-worker.ts"() {
|
|
169
500
|
"use strict";
|
|
170
|
-
|
|
501
|
+
import_tasks2 = require("@math.gl/tasks");
|
|
502
|
+
init_get_worker_url();
|
|
503
|
+
init_task_runtime();
|
|
504
|
+
init_get_transfer_list();
|
|
505
|
+
init_globals2();
|
|
506
|
+
runners = /* @__PURE__ */ new WeakMap();
|
|
507
|
+
activeRunners = /* @__PURE__ */ new Set();
|
|
508
|
+
moduleWorkerUrls = /* @__PURE__ */ new Map();
|
|
171
509
|
}
|
|
172
510
|
});
|
|
173
511
|
|
|
@@ -200,11 +538,11 @@ function canParseWithWorker(loader, options) {
|
|
|
200
538
|
if (loader.id === "csv" && !shouldParseCSVWithWorker(options)) {
|
|
201
539
|
return false;
|
|
202
540
|
}
|
|
203
|
-
return Boolean(
|
|
541
|
+
return Boolean(canProcessOnWorker(loader, workerOptions));
|
|
204
542
|
}
|
|
205
543
|
async function parseWithWorker(loader, data, options, context, parseOnMainThread, signal) {
|
|
206
544
|
const workerSignal = signal || getWorkerAbortSignal(options) || (context == null ? void 0 : context.signal);
|
|
207
|
-
const result = await
|
|
545
|
+
const result = await processOnWorker(
|
|
208
546
|
loader,
|
|
209
547
|
data,
|
|
210
548
|
{
|
|
@@ -213,12 +551,16 @@ async function parseWithWorker(loader, data, options, context, parseOnMainThread
|
|
|
213
551
|
onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
|
|
214
552
|
},
|
|
215
553
|
{
|
|
216
|
-
process: async (input, processOptions,
|
|
554
|
+
process: async (input, processOptions, workerContext, parseContext) => {
|
|
217
555
|
if (!parseOnMainThread) {
|
|
218
556
|
throw new Error("Worker not set up to parse on main thread");
|
|
219
557
|
}
|
|
220
558
|
const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
|
|
221
|
-
const mainThreadContext = context || parseContext
|
|
559
|
+
const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
|
|
560
|
+
...context,
|
|
561
|
+
...workerParseContext,
|
|
562
|
+
signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
|
|
563
|
+
} : void 0;
|
|
222
564
|
return await callParseOnMainThread(
|
|
223
565
|
parseOnMainThread,
|
|
224
566
|
input,
|
|
@@ -10547,7 +10889,12 @@ function populateLASTypedExtraBytes(rawExtraBytes, pointCount, extraByteCount, a
|
|
|
10547
10889
|
}
|
|
10548
10890
|
}
|
|
10549
10891
|
function readLASString(bytes, offset, length) {
|
|
10550
|
-
|
|
10892
|
+
const decoded = new TextDecoder().decode(bytes.subarray(offset, offset + length));
|
|
10893
|
+
let end = decoded.length;
|
|
10894
|
+
while (end > 0 && decoded[end - 1] === "\0") {
|
|
10895
|
+
end--;
|
|
10896
|
+
}
|
|
10897
|
+
return decoded.slice(0, end).trim();
|
|
10551
10898
|
}
|
|
10552
10899
|
function sanitizeExtraBytesName(name) {
|
|
10553
10900
|
return name.trim().replace(/[^A-Za-z0-9_]+/g, "_");
|
|
@@ -10687,109 +11034,7 @@ var init_las_loader_shared = __esm({
|
|
|
10687
11034
|
}
|
|
10688
11035
|
});
|
|
10689
11036
|
|
|
10690
|
-
// ../core/src/
|
|
10691
|
-
function splitArrowBuffers(input, options = {}) {
|
|
10692
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
10693
|
-
if (isArrowTable(input)) {
|
|
10694
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
10695
|
-
}
|
|
10696
|
-
if (isArrowRecordBatch(input)) {
|
|
10697
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
10698
|
-
}
|
|
10699
|
-
if (isArrowVector(input)) {
|
|
10700
|
-
return splitArrowVectorBuffers(input, context);
|
|
10701
|
-
}
|
|
10702
|
-
return splitArrowDataBuffers(input, context);
|
|
10703
|
-
}
|
|
10704
|
-
function isArrowTable(input) {
|
|
10705
|
-
return "batches" in input;
|
|
10706
|
-
}
|
|
10707
|
-
function isArrowRecordBatch(input) {
|
|
10708
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
10709
|
-
}
|
|
10710
|
-
function isArrowVector(input) {
|
|
10711
|
-
return "data" in input && Array.isArray(input.data);
|
|
10712
|
-
}
|
|
10713
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
10714
|
-
const recordBatches = table.batches.map(
|
|
10715
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
10716
|
-
);
|
|
10717
|
-
return new arrow7.Table(table.schema, recordBatches);
|
|
10718
|
-
}
|
|
10719
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
10720
|
-
return new arrow7.RecordBatch(
|
|
10721
|
-
recordBatch.schema,
|
|
10722
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
10723
|
-
);
|
|
10724
|
-
}
|
|
10725
|
-
function splitArrowDataBuffers(data, options) {
|
|
10726
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
10727
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
10728
|
-
const buffers = {
|
|
10729
|
-
[arrow7.BufferType.OFFSET]: splitArrowBuffer(data.buffers[arrow7.BufferType.OFFSET], options),
|
|
10730
|
-
[arrow7.BufferType.DATA]: splitArrowBuffer(data.buffers[arrow7.BufferType.DATA], options),
|
|
10731
|
-
[arrow7.BufferType.VALIDITY]: splitArrowBuffer(data.buffers[arrow7.BufferType.VALIDITY], options),
|
|
10732
|
-
[arrow7.BufferType.TYPE]: splitArrowBuffer(data.buffers[arrow7.BufferType.TYPE], options)
|
|
10733
|
-
};
|
|
10734
|
-
return new arrow7.Data(
|
|
10735
|
-
data.type,
|
|
10736
|
-
data.offset,
|
|
10737
|
-
data.length,
|
|
10738
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
10739
|
-
data._nullCount,
|
|
10740
|
-
buffers,
|
|
10741
|
-
children,
|
|
10742
|
-
dictionary
|
|
10743
|
-
);
|
|
10744
|
-
}
|
|
10745
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
10746
|
-
return new arrow7.Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
10747
|
-
}
|
|
10748
|
-
function splitArrowBuffer(array, options) {
|
|
10749
|
-
if (!isArrowTypedArray(array)) {
|
|
10750
|
-
return array;
|
|
10751
|
-
}
|
|
10752
|
-
if (options.copy === "none") {
|
|
10753
|
-
return array;
|
|
10754
|
-
}
|
|
10755
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
10756
|
-
return array;
|
|
10757
|
-
}
|
|
10758
|
-
let copy = options.copies.get(array);
|
|
10759
|
-
if (!copy) {
|
|
10760
|
-
copy = array.slice();
|
|
10761
|
-
options.copies.set(array, copy);
|
|
10762
|
-
}
|
|
10763
|
-
return copy;
|
|
10764
|
-
}
|
|
10765
|
-
function isArrowTypedArray(value) {
|
|
10766
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
10767
|
-
}
|
|
10768
|
-
var arrow7;
|
|
10769
|
-
var init_split_arrow_buffers = __esm({
|
|
10770
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
10771
|
-
"use strict";
|
|
10772
|
-
arrow7 = __toESM(require("apache-arrow"), 1);
|
|
10773
|
-
}
|
|
10774
|
-
});
|
|
10775
|
-
|
|
10776
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
10777
|
-
function dehydrateArrowTable(table, options) {
|
|
10778
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
10779
|
-
return {
|
|
10780
|
-
shape: "arrow-table",
|
|
10781
|
-
transport: "arrow-js",
|
|
10782
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
10783
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
10784
|
-
};
|
|
10785
|
-
}
|
|
10786
|
-
function hydrateArrowTable(table) {
|
|
10787
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
10788
|
-
const recordBatches = table.batches.map(
|
|
10789
|
-
(recordBatch) => new arrow8.RecordBatch(schema, hydrateArrowData(recordBatch.data))
|
|
10790
|
-
);
|
|
10791
|
-
return new arrow8.Table(schema, recordBatches);
|
|
10792
|
-
}
|
|
11037
|
+
// ../core/src/arrow-worker-transport.ts
|
|
10793
11038
|
function serializeArrowWorkerTable(result) {
|
|
10794
11039
|
if (!isArrowTableWrapper(result)) {
|
|
10795
11040
|
throw new Error("Workers require Arrow table output");
|
|
@@ -10797,14 +11042,14 @@ function serializeArrowWorkerTable(result) {
|
|
|
10797
11042
|
const { data, ...metadata } = result;
|
|
10798
11043
|
return {
|
|
10799
11044
|
...structuredClone(metadata),
|
|
10800
|
-
data: dehydrateArrowTable(data, { copy: "all" })
|
|
11045
|
+
data: (0, import_arrow.dehydrateArrowTable)(data, { copy: "all" })
|
|
10801
11046
|
};
|
|
10802
11047
|
}
|
|
10803
11048
|
function deserializeArrowWorkerTable(result) {
|
|
10804
11049
|
if (!isDehydratedArrowTableWrapper(result)) {
|
|
10805
11050
|
throw new Error("Workers require Arrow column transport");
|
|
10806
11051
|
}
|
|
10807
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
11052
|
+
return { ...result, data: (0, import_arrow.hydrateArrowTable)(result.data) };
|
|
10808
11053
|
}
|
|
10809
11054
|
function isArrowTableWrapper(value) {
|
|
10810
11055
|
const table = value;
|
|
@@ -10818,61 +11063,11 @@ function isDehydratedArrowTableWrapper(value) {
|
|
|
10818
11063
|
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
10819
11064
|
);
|
|
10820
11065
|
}
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
function dehydrateArrowData(data) {
|
|
10825
|
-
return {
|
|
10826
|
-
type: serializeArrowType(data.type),
|
|
10827
|
-
offset: data.offset,
|
|
10828
|
-
length: data.length,
|
|
10829
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
10830
|
-
nullCount: data._nullCount,
|
|
10831
|
-
buffers: {
|
|
10832
|
-
[arrow8.BufferType.OFFSET]: data.buffers[arrow8.BufferType.OFFSET],
|
|
10833
|
-
[arrow8.BufferType.DATA]: data.buffers[arrow8.BufferType.DATA],
|
|
10834
|
-
[arrow8.BufferType.VALIDITY]: data.buffers[arrow8.BufferType.VALIDITY],
|
|
10835
|
-
[arrow8.BufferType.TYPE]: data.buffers[arrow8.BufferType.TYPE]
|
|
10836
|
-
},
|
|
10837
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
10838
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
10839
|
-
};
|
|
10840
|
-
}
|
|
10841
|
-
function dehydrateArrowVector(vector) {
|
|
10842
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
10843
|
-
}
|
|
10844
|
-
function hydrateArrowData(data) {
|
|
10845
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
10846
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
10847
|
-
return new arrow8.Data(
|
|
10848
|
-
deserializeArrowType(data.type),
|
|
10849
|
-
data.offset,
|
|
10850
|
-
data.length,
|
|
10851
|
-
data.nullCount,
|
|
10852
|
-
data.buffers,
|
|
10853
|
-
children,
|
|
10854
|
-
dictionary
|
|
10855
|
-
);
|
|
10856
|
-
}
|
|
10857
|
-
function hydrateArrowVector(vector) {
|
|
10858
|
-
return new arrow8.Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
10859
|
-
}
|
|
10860
|
-
var arrow8;
|
|
10861
|
-
var init_arrow_table_transport = __esm({
|
|
10862
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
10863
|
-
"use strict";
|
|
10864
|
-
arrow8 = __toESM(require("apache-arrow"), 1);
|
|
10865
|
-
init_convert_arrow_schema();
|
|
10866
|
-
init_split_arrow_buffers();
|
|
10867
|
-
}
|
|
10868
|
-
});
|
|
10869
|
-
|
|
10870
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
10871
|
-
var init_arrow_transport = __esm({
|
|
10872
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
11066
|
+
var import_arrow;
|
|
11067
|
+
var init_arrow_worker_transport = __esm({
|
|
11068
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
10873
11069
|
"use strict";
|
|
10874
|
-
|
|
10875
|
-
init_split_arrow_buffers();
|
|
11070
|
+
import_arrow = require("@math.gl/arrow");
|
|
10876
11071
|
}
|
|
10877
11072
|
});
|
|
10878
11073
|
|
|
@@ -13740,7 +13935,7 @@ var init_las_loader = __esm({
|
|
|
13740
13935
|
"use strict";
|
|
13741
13936
|
init_schema_utils();
|
|
13742
13937
|
init_las_loader_shared();
|
|
13743
|
-
|
|
13938
|
+
init_arrow_worker_transport();
|
|
13744
13939
|
init_parse_las();
|
|
13745
13940
|
LASLoaderWithParser = {
|
|
13746
13941
|
...LAS_LOADER_METADATA,
|
|
@@ -15233,7 +15428,7 @@ function isValidCOPCKey(key) {
|
|
|
15233
15428
|
// dist/copc/copc-source-loader.js
|
|
15234
15429
|
init_schema();
|
|
15235
15430
|
init_schema_utils();
|
|
15236
|
-
|
|
15431
|
+
init_arrow_worker_transport();
|
|
15237
15432
|
init_loader_utils();
|
|
15238
15433
|
init_loader_utils();
|
|
15239
15434
|
var import_projection = require("@math.gl/geospatial/projection");
|
|
@@ -15279,7 +15474,7 @@ function normalizeCOPCProjectionDefinition(projectionData) {
|
|
|
15279
15474
|
}
|
|
15280
15475
|
|
|
15281
15476
|
// dist/copc/copc-source-loader.js
|
|
15282
|
-
var VERSION4 = true ? "5.0.0-beta.
|
|
15477
|
+
var VERSION4 = true ? "5.0.0-beta.5" : "latest";
|
|
15283
15478
|
var COPC_PREFIX_CACHE_LENGTH = 65536;
|
|
15284
15479
|
var COORDINATE_SYSTEM = {
|
|
15285
15480
|
CARTESIAN: "cartesian",
|
|
@@ -16617,7 +16812,7 @@ function createCachedCOPCRangeReader(readableFile) {
|
|
|
16617
16812
|
|
|
16618
16813
|
// dist/copc/copc-writer.js
|
|
16619
16814
|
init_loader_utils();
|
|
16620
|
-
var VERSION5 = true ? "5.0.0-beta.
|
|
16815
|
+
var VERSION5 = true ? "5.0.0-beta.5" : "latest";
|
|
16621
16816
|
var LAS_1_4_HEADER_LENGTH3 = 375;
|
|
16622
16817
|
var COPC_INFO_PAYLOAD_LENGTH = 160;
|
|
16623
16818
|
var VLR_HEADER_LENGTH3 = 54;
|