@loaders.gl/tiles-3d 5.0.0-beta.4 → 5.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  3. package/dist/3d-tiles/dist.dev.js +941 -621
  4. package/dist/3d-tiles/dist.min.js +37 -37
  5. package/dist/3d-tiles/index.cjs +876 -947
  6. package/dist/3d-tiles/index.cjs.map +3 -3
  7. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
  8. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  9. package/dist/3d-tiles/lib/utils/version.js +1 -1
  10. package/dist/3d-tiles-archive-writer.cjs +1 -1
  11. package/dist/cesium-ion-loader-with-parser.cjs +821 -942
  12. package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
  13. package/dist/copc/copc-source-loader.js +2 -2
  14. package/dist/copc/copc-source-loader.js.map +1 -1
  15. package/dist/copc/copc-writer.js +1 -1
  16. package/dist/copc/index.cjs +121 -181
  17. package/dist/copc/index.cjs.map +3 -3
  18. package/dist/dist.dev.js +323 -40
  19. package/dist/dist.min.js +10 -10
  20. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  21. package/dist/i3s/dist.dev.js +3173 -712
  22. package/dist/i3s/dist.min.js +47 -47
  23. package/dist/i3s/i3s-attribute-loader.js +1 -1
  24. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  25. package/dist/i3s/i3s-content-loader.js +1 -1
  26. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  27. package/dist/i3s/i3s-loader.js +1 -1
  28. package/dist/i3s/i3s-node-page-loader.js +1 -1
  29. package/dist/i3s/i3s-slpk-loader.js +1 -1
  30. package/dist/i3s/i3s-slpk-writer.js +1 -1
  31. package/dist/i3s/index.cjs +2097 -544
  32. package/dist/i3s/index.cjs.map +3 -3
  33. package/dist/i3s-content-worker-node.js +11 -11
  34. package/dist/i3s-content-worker-node.js.map +4 -4
  35. package/dist/i3s-content-worker.js +768 -346
  36. package/dist/i3s-lepcc-worker-node.js +245 -12
  37. package/dist/i3s-lepcc-worker-node.js.map +4 -4
  38. package/dist/i3s-lepcc-worker.js +240 -12
  39. package/dist/i3s-mesh-writer.cjs +1749 -290
  40. package/dist/i3s-mesh-writer.cjs.map +3 -3
  41. package/dist/i3s-slpk-writer.cjs +1 -1
  42. package/dist/index.cjs +98 -4
  43. package/dist/index.cjs.map +2 -2
  44. package/dist/point-cloud-tile-source-loader-types.js +1 -1
  45. package/dist/point-cloud-tile-source-loader.cjs +46 -2
  46. package/dist/point-cloud-tile-source-loader.cjs.map +2 -2
  47. package/dist/point-cloud-tile-source.cjs +45 -1
  48. package/dist/point-cloud-tile-source.cjs.map +1 -1
  49. package/dist/potree/dist.dev.js +325 -91
  50. package/dist/potree/dist.min.js +30 -30
  51. package/dist/potree/index.cjs +115 -176
  52. package/dist/potree/index.cjs.map +3 -3
  53. package/dist/potree/potree-bin-loader.js +1 -1
  54. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  55. package/dist/potree/potree-loader-types.js +1 -1
  56. package/dist/potree/potree-source-loader.js +1 -1
  57. package/dist/potree/potree-writer.js +1 -1
  58. package/dist/potree/potree2-source.d.ts.map +1 -1
  59. package/dist/potree/potree2-source.js +3 -13
  60. package/dist/potree/potree2-source.js.map +1 -1
  61. package/dist/potree-loader.cjs +1 -1
  62. package/package.json +13 -13
  63. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
  64. package/src/copc/copc-source-loader.ts +1 -1
  65. package/src/potree/potree2-source.ts +3 -14
@@ -767,6 +767,7 @@ async function loadLibraryInWorker(libraryUrl, moduleLibraryUrl = libraryUrl) {
767
767
  } catch {
768
768
  const moduleUrl = new URL(moduleLibraryUrl, globalThis.location.href).href;
769
769
  const library = await import(
770
+ /* webpackIgnore: true */
770
771
  /* @vite-ignore */
771
772
  moduleUrl
772
773
  );
@@ -827,12 +828,10 @@ var init_library_utils = __esm({
827
828
  });
828
829
 
829
830
  // ../core/src/worker-utils/index.ts
830
- var import_tasks;
831
831
  var init_worker_utils = __esm({
832
832
  "../core/src/worker-utils/index.ts"() {
833
833
  "use strict";
834
834
  init_globals2();
835
- import_tasks = require("@math.gl/core/tasks");
836
835
  init_library_utils();
837
836
  }
838
837
  });
@@ -2644,6 +2643,8 @@ var init_http_file_transport = __esm({
2644
2643
  identityHints;
2645
2644
  /** Failure objects already included in telemetry. */
2646
2645
  countedFailures = /* @__PURE__ */ new WeakSet();
2646
+ /** Observer for cumulative transport counters, including asynchronous cancellation. */
2647
+ onTelemetry;
2647
2648
  /** Mutable counters backing immutable telemetry snapshots. */
2648
2649
  telemetry = {
2649
2650
  requestedBytes: 0,
@@ -2657,6 +2658,7 @@ var init_http_file_transport = __esm({
2657
2658
  constructor(url, options) {
2658
2659
  validateKnownByteLength(options.byteLength);
2659
2660
  this.url = url;
2661
+ this.onTelemetry = options.onTelemetry;
2660
2662
  this.fetchFunction = options.fetch || ((input, init) => globalThis.fetch(input, init));
2661
2663
  this.fetchOptions = options.fetchOptions ? { ...options.fetchOptions, headers: new Headers(options.fetchOptions.headers) } : void 0;
2662
2664
  this.consistency = options.consistency || "best-effort";
@@ -2683,6 +2685,7 @@ var init_http_file_transport = __esm({
2683
2685
  }
2684
2686
  /** Counts each failure object once even when it passes through several async layers. */
2685
2687
  trackFailure(error) {
2688
+ var _a;
2686
2689
  if (typeof error === "object" && error !== null) {
2687
2690
  if (this.countedFailures.has(error)) {
2688
2691
  return;
@@ -2694,10 +2697,11 @@ var init_http_file_transport = __esm({
2694
2697
  } else {
2695
2698
  this.telemetry.errorCount++;
2696
2699
  }
2700
+ (_a = this.onTelemetry) == null ? void 0 : _a.call(this, this.getTelemetry(), error);
2697
2701
  }
2698
2702
  /** Performs and validates one exact HTTP range request. */
2699
2703
  async requestRange(offset, length, signal, expectedIdentity) {
2700
- var _a;
2704
+ var _a, _b;
2701
2705
  const requestStartTime = getTimestamp2();
2702
2706
  const abortContext = createCombinedAbortContext(signal, (_a = this.fetchOptions) == null ? void 0 : _a.signal);
2703
2707
  this.telemetry.requestCount++;
@@ -2714,7 +2718,13 @@ var init_http_file_transport = __esm({
2714
2718
  await cancelResponse(response);
2715
2719
  throw new Error(`HTTP byte-range request expected 206, received ${response.status}`);
2716
2720
  }
2717
- const contentRange = await readContentRange(response);
2721
+ const contentRange = response.headers.has("Content-Range") ? await readContentRange(response) : await this.inferContentRange(
2722
+ response,
2723
+ offset,
2724
+ length,
2725
+ expectedIdentity,
2726
+ abortContext.signal
2727
+ );
2718
2728
  const responseIdentity = getResponseIdentity(response, contentRange.byteLength);
2719
2729
  const responseError = getIdentityError(
2720
2730
  expectedIdentity,
@@ -2748,6 +2758,45 @@ var init_http_file_transport = __esm({
2748
2758
  } finally {
2749
2759
  abortContext.removeAbortListeners();
2750
2760
  this.telemetry.networkTimeMs += getTimestamp2() - requestStartTime;
2761
+ (_b = this.onTelemetry) == null ? void 0 : _b.call(this, this.getTelemetry());
2762
+ }
2763
+ }
2764
+ /** Infers bounds for a CORS-filtered 206; the caller still validates the body length. */
2765
+ async inferContentRange(response, offset, length, expectedIdentity, signal) {
2766
+ var _a;
2767
+ try {
2768
+ let byteLength = (expectedIdentity == null ? void 0 : expectedIdentity.byteLength) ?? this.identityHints.byteLength;
2769
+ if (byteLength === void 0) {
2770
+ const headers = new Headers((_a = this.fetchOptions) == null ? void 0 : _a.headers);
2771
+ headers.delete("Range");
2772
+ this.telemetry.requestCount++;
2773
+ const metadata = await this.fetchFunction(this.url, {
2774
+ ...this.fetchOptions,
2775
+ method: "HEAD",
2776
+ body: void 0,
2777
+ headers,
2778
+ signal
2779
+ });
2780
+ await cancelResponse(metadata);
2781
+ const value = metadata.headers.get("Content-Length");
2782
+ byteLength = value && /^\d+$/.test(value) ? Number(value) : NaN;
2783
+ if (metadata.status !== 200 || !Number.isSafeInteger(byteLength) || byteLength < offset + length) {
2784
+ throw new Error(
2785
+ "HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length"
2786
+ );
2787
+ }
2788
+ const identityError = getIdentityError(
2789
+ getResponseIdentity(metadata, byteLength),
2790
+ getResponseIdentity(response, byteLength),
2791
+ this.identityHints,
2792
+ this.consistency
2793
+ );
2794
+ if (identityError) throw new Error(identityError);
2795
+ }
2796
+ return { offset, endOffset: offset + length - 1, byteLength };
2797
+ } catch (error) {
2798
+ await cancelResponse(response);
2799
+ throw error;
2751
2800
  }
2752
2801
  }
2753
2802
  /** Validates and consumes the special empty-object identity response. */
@@ -6956,7 +7005,7 @@ __export(KHR_gaussian_splatting_exports, {
6956
7005
  name: () => name6
6957
7006
  });
6958
7007
  async function decode6(gltfData, options, context) {
6959
- var _a, _b, _c, _d, _e;
7008
+ var _a, _b, _c, _d, _e, _f, _g;
6960
7009
  const loader = (_a = context == null ? void 0 : context.loaders) == null ? void 0 : _a.find((candidate) => {
6961
7010
  var _a2;
6962
7011
  return (_a2 = candidate.extensions) == null ? void 0 : _a2.includes("spz");
@@ -6967,22 +7016,29 @@ async function decode6(gltfData, options, context) {
6967
7016
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
6968
7017
  const extension = (_b = primitive.extensions) == null ? void 0 : _b[name6];
6969
7018
  if (!extension) continue;
7019
+ const descriptor = descriptors.find(
7020
+ (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
7021
+ );
7022
+ const legacyColorSpace = (_c = options == null ? void 0 : options.gltf) == null ? void 0 : _c.legacyGaussianSplatColorSpace;
7023
+ const normalizedExtension = legacyColorSpace && ((_d = extension.extensions) == null ? void 0 : _d[SPZ_COMPRESSION_EXTENSION_NAME]) ? {
7024
+ ...extension,
7025
+ kernel: extension.kernel ?? "ellipse",
7026
+ colorSpace: extension.colorSpace ?? legacyColorSpace
7027
+ } : extension;
7028
+ if (descriptor) descriptor.extension = normalizedExtension;
6970
7029
  validateGaussianSplatPrimitive(
6971
7030
  gltfData.json,
6972
7031
  primitive,
6973
- extension,
7032
+ normalizedExtension,
6974
7033
  meshIndex,
6975
7034
  primitiveIndex,
6976
7035
  iterator
6977
7036
  );
6978
- const compression = (_c = extension.extensions) == null ? void 0 : _c[SPZ_COMPRESSION_EXTENSION_NAME];
7037
+ const compression = (_e = extension.extensions) == null ? void 0 : _e[SPZ_COMPRESSION_EXTENSION_NAME];
6979
7038
  if (compression) {
6980
- const descriptor = descriptors.find(
6981
- (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
6982
- );
6983
7039
  if (descriptor) {
6984
- const decoder = (_d = options == null ? void 0 : options.gltf) == null ? void 0 : _d.splatDecoder;
6985
- const bufferView = (_e = gltfData.json.bufferViews) == null ? void 0 : _e[compression.bufferView];
7040
+ const decoder = (_f = options == null ? void 0 : options.gltf) == null ? void 0 : _f.splatDecoder;
7041
+ const bufferView = (_g = gltfData.json.bufferViews) == null ? void 0 : _g[compression.bufferView];
6986
7042
  if (bufferView && gltfData.buffers[bufferView.buffer]) {
6987
7043
  descriptor.compressedBytes = getBufferViewBytes(gltfData, compression.bufferView);
6988
7044
  } else if (decoder || loader) {
@@ -8153,7 +8209,7 @@ var init_EXT_feature_metadata = __esm({
8153
8209
  });
8154
8210
 
8155
8211
  // ../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts
8156
- var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema;
8212
+ var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema, GLTFKHRMaterialsEmissiveStrengthSchema, GLTFFBGeometryMetadataSchema;
8157
8213
  var init_gltf_additional_extension_schemas = __esm({
8158
8214
  "../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts"() {
8159
8215
  "use strict";
@@ -8228,6 +8284,24 @@ var init_gltf_additional_extension_schemas = __esm({
8228
8284
  /** Index into the document-level packets array. */
8229
8285
  packet: indexSchema
8230
8286
  });
8287
+ GLTFKHRMaterialsEmissiveStrengthSchema = import_zod.z.looseObject({
8288
+ ...propertyShape,
8289
+ /** Unitless multiplier; defaults to one when omitted. */
8290
+ emissiveStrength: import_zod.z.number().nonnegative().optional()
8291
+ });
8292
+ GLTFFBGeometryMetadataSchema = import_zod.z.looseObject({
8293
+ ...propertyShape,
8294
+ /** Authored count of vertices. */
8295
+ vertexCount: import_zod.z.number().nonnegative().optional(),
8296
+ /** Authored count of primitives. */
8297
+ primitiveCount: import_zod.z.number().nonnegative().optional(),
8298
+ /** Static scene-space bounding box. */
8299
+ sceneBounds: import_zod.z.looseObject({
8300
+ ...propertyShape,
8301
+ min: import_zod.z.array(import_zod.z.number()).length(3),
8302
+ max: import_zod.z.array(import_zod.z.number()).length(3)
8303
+ }).optional()
8304
+ });
8231
8305
  }
8232
8306
  });
8233
8307
 
@@ -8379,7 +8453,7 @@ var init_gltf_audio_extension_schemas = __esm({
8379
8453
  });
8380
8454
 
8381
8455
  // ../scene/src/gltf/lib/types/gltf-extension-schemas.ts
8382
- var import_zod3, GLTFPropertyExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
8456
+ var import_zod3, GLTFPropertyExtensionsSchema, GLTFMaterialExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
8383
8457
  var init_gltf_extension_schemas = __esm({
8384
8458
  "../scene/src/gltf/lib/types/gltf-extension-schemas.ts"() {
8385
8459
  "use strict";
@@ -8390,6 +8464,10 @@ var init_gltf_extension_schemas = __esm({
8390
8464
  /** Shared XMP packet reference. */
8391
8465
  KHR_xmp_json_ld: GLTFKHRXMPJSONLDReferenceSchema.optional()
8392
8466
  });
8467
+ GLTFMaterialExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
8468
+ /** Emissive intensity multiplier. */
8469
+ KHR_materials_emissive_strength: GLTFKHRMaterialsEmissiveStrengthSchema.optional()
8470
+ });
8393
8471
  GLTFRootExtensionsSchema = import_zod3.z.looseObject({
8394
8472
  /** Shared material variant declarations. */
8395
8473
  KHR_materials_variants: GLTFKHRMaterialsVariantsSchema.optional(),
@@ -8415,6 +8493,8 @@ var init_gltf_extension_schemas = __esm({
8415
8493
  MPEG_audio_spatial: GLTFMPEGAudioSpatialSchema.optional()
8416
8494
  });
8417
8495
  GLTFSceneExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
8496
+ /** Authored static geometry summary. */
8497
+ FB_geometry_metadata: GLTFFBGeometryMetadataSchema.optional(),
8418
8498
  /** Attached global KHR audio emitters. */
8419
8499
  KHR_audio_emitter: GLTFKHRAudioAttachmentSchema.optional()
8420
8500
  });
@@ -9319,985 +9399,827 @@ var init_KHR_texture_basisu = __esm({
9319
9399
  }
9320
9400
  });
9321
9401
 
9322
- // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
9323
- function serializeArrowSchema(arrowSchema) {
9402
+ // ../core/src/arrow-worker-transport.ts
9403
+ function serializeArrowWorkerResult(result, options) {
9404
+ var _a;
9405
+ if (!isArrowTableWrapper(result)) {
9406
+ return result;
9407
+ }
9408
+ const workerOptions = options;
9409
+ const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
9324
9410
  return {
9325
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
9326
- metadata: serializeArrowMetadata(arrowSchema.metadata)
9411
+ ...result,
9412
+ data: (0, import_arrow.dehydrateArrowTable)(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
9327
9413
  };
9328
9414
  }
9329
- function deserializeArrowSchema(schema, options) {
9330
- return new arrow.Schema(
9331
- schema.fields.map((field) => deserializeArrowField(field, options)),
9332
- deserializeArrowMetadata(schema.metadata)
9333
- );
9334
- }
9335
- function serializeArrowMetadata(arrowMetadata) {
9336
- return Object.fromEntries(arrowMetadata);
9337
- }
9338
- function deserializeArrowMetadata(metadata) {
9339
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
9415
+ function deserializeArrowWorkerResult(result) {
9416
+ if (!isDehydratedArrowTableWrapper(result)) {
9417
+ return result;
9418
+ }
9419
+ return { ...result, data: (0, import_arrow.hydrateArrowTable)(result.data) };
9340
9420
  }
9341
- function serializeArrowField(field) {
9342
- return {
9343
- name: field.name,
9344
- type: serializeArrowType(field.type),
9345
- nullable: field.nullable,
9346
- metadata: serializeArrowMetadata(field.metadata)
9347
- };
9421
+ function isArrowTableWrapper(value) {
9422
+ const table = value;
9423
+ return Boolean(
9424
+ table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
9425
+ );
9348
9426
  }
9349
- function deserializeArrowField(field, options) {
9350
- return new arrow.Field(
9351
- field.name,
9352
- deserializeArrowType(field.type, options),
9353
- field.nullable,
9354
- deserializeArrowMetadata(field.metadata)
9427
+ function isDehydratedArrowTableWrapper(value) {
9428
+ const table = value;
9429
+ return Boolean(
9430
+ table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
9355
9431
  );
9356
9432
  }
9357
- function serializeArrowType(arrowType) {
9358
- if (isArrowViewType(arrowType, "BinaryView")) {
9359
- return "binary-view";
9433
+ var import_arrow;
9434
+ var init_arrow_worker_transport = __esm({
9435
+ "../core/src/arrow-worker-transport.ts"() {
9436
+ "use strict";
9437
+ import_arrow = require("@math.gl/arrow");
9360
9438
  }
9361
- if (isArrowViewType(arrowType, "Utf8View")) {
9362
- return "utf8-view";
9439
+ });
9440
+
9441
+ // ../scene/src/draco/lib/utils/version.ts
9442
+ var VERSION4;
9443
+ var init_version4 = __esm({
9444
+ "../scene/src/draco/lib/utils/version.ts"() {
9445
+ "use strict";
9446
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9363
9447
  }
9364
- if (isOptionalArrowType(arrowType, "LargeList")) {
9365
- const largeListType = arrowType;
9366
- return {
9367
- type: "large-list",
9368
- children: [serializeArrowField(largeListType.valueField)]
9448
+ });
9449
+
9450
+ // ../scene/src/draco/draco-format.ts
9451
+ var DracoFormat;
9452
+ var init_draco_format = __esm({
9453
+ "../scene/src/draco/draco-format.ts"() {
9454
+ "use strict";
9455
+ DracoFormat = {
9456
+ name: "Draco",
9457
+ id: "draco",
9458
+ module: "scene",
9459
+ encoding: "binary",
9460
+ format: "draco",
9461
+ extensions: ["drc"],
9462
+ mimeTypes: ["application/octet-stream"],
9463
+ binary: true,
9464
+ tests: ["DRACO"]
9369
9465
  };
9370
9466
  }
9371
- switch (arrowType.constructor) {
9372
- case arrow.Null:
9373
- return "null";
9374
- case arrow.Binary:
9375
- return "binary";
9376
- case arrow.FixedSizeBinary:
9377
- return {
9378
- type: "fixed-size-binary",
9379
- byteWidth: arrowType.byteWidth
9380
- };
9381
- case arrow.Bool:
9382
- return "bool";
9383
- case arrow.Int:
9384
- const intType = arrowType;
9385
- return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
9386
- case arrow.Int8:
9387
- return "int8";
9388
- case arrow.Int16:
9389
- return "int16";
9390
- case arrow.Int32:
9391
- return "int32";
9392
- case arrow.Int64:
9393
- return "int64";
9394
- case arrow.Uint8:
9395
- return "uint8";
9396
- case arrow.Uint16:
9397
- return "uint16";
9398
- case arrow.Uint32:
9399
- return "uint32";
9400
- case arrow.Uint64:
9401
- return "uint64";
9402
- case arrow.Float:
9403
- const precision = arrowType.precision;
9404
- switch (precision) {
9405
- case arrow.Precision.HALF:
9406
- return "float16";
9407
- case arrow.Precision.SINGLE:
9408
- return "float32";
9409
- case arrow.Precision.DOUBLE:
9410
- return "float64";
9411
- default:
9412
- return "float16";
9413
- }
9414
- case arrow.Float16:
9415
- return "float16";
9416
- case arrow.Float32:
9417
- return "float32";
9418
- case arrow.Float64:
9419
- return "float64";
9420
- case arrow.Utf8:
9421
- return "utf8";
9422
- case arrow.Decimal:
9423
- const decimal = arrowType;
9424
- return {
9425
- type: "decimal",
9426
- bitWidth: decimal.bitWidth,
9427
- precision: decimal.precision,
9428
- scale: decimal.scale
9429
- };
9430
- case arrow.Date_:
9431
- const dateUnit = arrowType.unit;
9432
- return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
9433
- case arrow.DateDay:
9434
- return "date-day";
9435
- case arrow.DateMillisecond:
9436
- return "date-millisecond";
9437
- case arrow.Time:
9438
- const timeUnit = arrowType.unit;
9439
- switch (timeUnit) {
9440
- case arrow.TimeUnit.SECOND:
9441
- return "time-second";
9442
- case arrow.TimeUnit.MILLISECOND:
9443
- return "time-millisecond";
9444
- case arrow.TimeUnit.MICROSECOND:
9445
- return "time-microsecond";
9446
- case arrow.TimeUnit.NANOSECOND:
9447
- return "time-nanosecond";
9448
- default:
9449
- return "time-second";
9450
- }
9451
- case arrow.TimeMillisecond:
9452
- return "time-millisecond";
9453
- case arrow.TimeSecond:
9454
- return "time-second";
9455
- case arrow.TimeMicrosecond:
9456
- return "time-microsecond";
9457
- case arrow.TimeNanosecond:
9458
- return "time-nanosecond";
9459
- case arrow.Timestamp:
9460
- const timeStampUnit = arrowType.unit;
9461
- switch (timeStampUnit) {
9462
- case arrow.TimeUnit.SECOND:
9463
- return "timestamp-second";
9464
- case arrow.TimeUnit.MILLISECOND:
9465
- return "timestamp-millisecond";
9466
- case arrow.TimeUnit.MICROSECOND:
9467
- return "timestamp-microsecond";
9468
- case arrow.TimeUnit.NANOSECOND:
9469
- return "timestamp-nanosecond";
9470
- default:
9471
- return "timestamp-second";
9467
+ });
9468
+
9469
+ // ../scene/src/draco/draco-loader-options.ts
9470
+ var DRACO_LOADER_DEFAULT_OPTIONS;
9471
+ var init_draco_loader_options = __esm({
9472
+ "../scene/src/draco/draco-loader-options.ts"() {
9473
+ "use strict";
9474
+ DRACO_LOADER_DEFAULT_OPTIONS = {
9475
+ backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
9476
+ extraAttributes: {},
9477
+ attributeNameEntry: void 0,
9478
+ shape: "arrow-table",
9479
+ decoderProfile: "full"
9480
+ };
9481
+ }
9482
+ });
9483
+
9484
+ // ../scene/src/draco/lib/draco-library-loader.ts
9485
+ async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
9486
+ var _a;
9487
+ if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
9488
+ const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
9489
+ options = {
9490
+ ...options,
9491
+ modules: {
9492
+ [libraryName]: `${directory}/${libraryName}`,
9493
+ ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
9494
+ ...options.modules
9472
9495
  }
9473
- case arrow.TimestampSecond:
9474
- return "timestamp-second";
9475
- case arrow.TimestampMillisecond:
9476
- return "timestamp-millisecond";
9477
- case arrow.TimestampMicrosecond:
9478
- return "timestamp-microsecond";
9479
- case arrow.TimestampNanosecond:
9480
- return "timestamp-nanosecond";
9481
- case arrow.Interval:
9482
- const intervalUnit = arrowType.unit;
9483
- switch (intervalUnit) {
9484
- case arrow.IntervalUnit.DAY_TIME:
9485
- return "interval-daytime";
9486
- case arrow.IntervalUnit.YEAR_MONTH:
9487
- return "interval-yearmonth";
9488
- default:
9489
- return "interval-daytime";
9490
- }
9491
- case arrow.IntervalDayTime:
9492
- return "interval-daytime";
9493
- case arrow.IntervalYearMonth:
9494
- return "interval-yearmonth";
9495
- case arrow.Map_:
9496
- const mapType = arrowType;
9497
- return {
9498
- type: "map",
9499
- keysSorted: mapType.keysSorted,
9500
- children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
9501
- };
9502
- case arrow.List:
9503
- const listType = arrowType;
9504
- const listField = listType.valueField;
9505
- return {
9506
- type: "list",
9507
- children: [serializeArrowField(listField)]
9508
- };
9509
- case arrow.FixedSizeList:
9510
- const fixedSizeList = arrowType;
9511
- return {
9512
- type: "fixed-size-list",
9513
- listSize: fixedSizeList.listSize,
9514
- children: [serializeArrowField(fixedSizeList.children[0])]
9515
- };
9516
- case arrow.Struct:
9517
- const structType = arrowType;
9518
- return {
9519
- type: "struct",
9520
- children: structType.children.map((arrowField) => serializeArrowField(arrowField))
9521
- };
9522
- case arrow.SparseUnion:
9523
- case arrow.DenseUnion:
9524
- const unionType = arrowType;
9525
- return {
9526
- type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
9527
- typeIds: unionType.typeIds,
9528
- children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
9529
- typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
9530
- };
9531
- case arrow.Dictionary:
9532
- const dictionaryType = arrowType;
9533
- return {
9534
- type: "dictionary",
9535
- id: dictionaryType.id,
9536
- indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
9537
- dictionary: serializeArrowType(dictionaryType.dictionary),
9538
- isOrdered: dictionaryType.isOrdered
9539
- };
9540
- default:
9541
- throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
9496
+ };
9542
9497
  }
9498
+ return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
9543
9499
  }
9544
- function deserializeArrowType(dataType, options) {
9545
- if (typeof dataType === "object") {
9546
- switch (dataType.type) {
9547
- case "decimal":
9548
- return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
9549
- case "map": {
9550
- const children = dataType.children.map(
9551
- (arrowField) => deserializeArrowField(arrowField, options)
9552
- );
9553
- return new arrow.Map_(children[0], dataType.keysSorted);
9554
- }
9555
- case "list": {
9556
- const field = deserializeArrowField(dataType.children[0], options);
9557
- return new arrow.List(field);
9558
- }
9559
- case "large-list": {
9560
- const field = deserializeArrowField(dataType.children[0], options);
9561
- const LargeList = getOptionalArrowConstructor("LargeList");
9562
- if (!LargeList) {
9563
- throw new Error(
9564
- "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
9565
- );
9566
- }
9567
- return new LargeList(field);
9568
- }
9569
- case "fixed-size-list": {
9570
- const child = deserializeArrowField(dataType.children[0], options);
9571
- return new arrow.FixedSizeList(dataType.listSize, child);
9572
- }
9573
- case "fixed-size-binary":
9574
- return new arrow.FixedSizeBinary(dataType.byteWidth);
9575
- case "struct": {
9576
- const children = dataType.children.map(
9577
- (arrowField) => deserializeArrowField(arrowField, options)
9578
- );
9579
- return new arrow.Struct(children);
9580
- }
9581
- case "sparse-union":
9582
- case "dense-union": {
9583
- const children = dataType.children.map(
9584
- (arrowField) => deserializeArrowField(arrowField, options)
9585
- );
9586
- return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
9587
- }
9588
- case "dictionary": {
9589
- return new arrow.Dictionary(
9590
- deserializeArrowType(dataType.dictionary, options),
9591
- deserializeArrowDictionaryKeyType(dataType.indices),
9592
- dataType.id,
9593
- dataType.isOrdered
9594
- );
9595
- }
9596
- default:
9597
- throw new Error("array type not supported");
9598
- }
9500
+ var init_draco_library_loader = __esm({
9501
+ "../scene/src/draco/lib/draco-library-loader.ts"() {
9502
+ "use strict";
9503
+ init_worker_utils();
9599
9504
  }
9600
- switch (dataType) {
9601
- case "null":
9602
- return new arrow.Null();
9603
- case "binary":
9604
- return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
9605
- case "binary-view":
9606
- return makeRequiredArrowViewType("BinaryView");
9607
- case "bool":
9608
- return new arrow.Bool();
9609
- case "int8":
9610
- return new arrow.Int8();
9611
- case "int16":
9612
- return new arrow.Int16();
9613
- case "int32":
9614
- return new arrow.Int32();
9615
- case "int64":
9616
- return new arrow.Int64();
9617
- case "uint8":
9618
- return new arrow.Uint8();
9619
- case "uint16":
9620
- return new arrow.Uint16();
9621
- case "uint32":
9622
- return new arrow.Uint32();
9623
- case "uint64":
9624
- return new arrow.Uint64();
9625
- case "float16":
9626
- return new arrow.Float16();
9627
- case "float32":
9628
- return new arrow.Float32();
9629
- case "float64":
9630
- return new arrow.Float64();
9631
- case "utf8":
9632
- return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
9633
- case "utf8-view":
9634
- return makeRequiredArrowViewType("Utf8View");
9635
- case "date-day":
9636
- return new arrow.DateDay();
9637
- case "date-millisecond":
9638
- return new arrow.DateMillisecond();
9639
- case "time-second":
9640
- return new arrow.TimeSecond();
9641
- case "time-millisecond":
9642
- return new arrow.TimeMillisecond();
9643
- case "time-microsecond":
9644
- return new arrow.TimeMicrosecond();
9645
- case "time-nanosecond":
9646
- return new arrow.TimeNanosecond();
9647
- case "timestamp-second":
9648
- return new arrow.TimestampSecond();
9649
- case "timestamp-millisecond":
9650
- return new arrow.TimestampMillisecond();
9651
- case "timestamp-microsecond":
9652
- return new arrow.TimestampMicrosecond();
9653
- case "timestamp-nanosecond":
9654
- return new arrow.TimestampNanosecond();
9655
- case "interval-daytime":
9656
- return new arrow.IntervalDayTime();
9657
- case "interval-yearmonth":
9658
- return new arrow.IntervalYearMonth();
9659
- default:
9660
- throw new Error("array type not supported");
9505
+ });
9506
+
9507
+ // ../scene/src/draco/draco-libraries.ts
9508
+ var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
9509
+ var init_draco_libraries = __esm({
9510
+ "../scene/src/draco/draco-libraries.ts"() {
9511
+ "use strict";
9512
+ DRACO_VERSION = "1.5.7";
9513
+ DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
9514
+ STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
9515
+ STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
9516
+ DRACO_EXTERNAL_LIBRARIES = {
9517
+ /** WebAssembly decoder JavaScript wrapper. */
9518
+ DECODER: "draco_wasm_wrapper.js",
9519
+ /** WebAssembly decoder binary. */
9520
+ DECODER_WASM: "draco_decoder.wasm",
9521
+ /** glTF-profile WebAssembly decoder JavaScript wrapper. */
9522
+ GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
9523
+ /** glTF-profile WebAssembly decoder binary. */
9524
+ GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
9525
+ /** JavaScript decoder fallback. */
9526
+ FALLBACK_DECODER: "draco_decoder.js",
9527
+ /** WebAssembly encoder JavaScript wrapper. */
9528
+ ENCODER: "draco_encoder.js",
9529
+ /** WebAssembly encoder binary. */
9530
+ ENCODER_WASM: "draco_encoder.wasm"
9531
+ };
9532
+ DRACO_EXTERNAL_LIBRARY_URLS = {
9533
+ [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
9534
+ [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
9535
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
9536
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
9537
+ [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
9538
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
9539
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
9540
+ };
9661
9541
  }
9542
+ });
9543
+
9544
+ // ../scene/src/draco/lib/draco-module-loader.ts
9545
+ async function loadDracoDecoderModule(options = {}, type, profile = "full") {
9546
+ const draco3DModule = getInjectedDraco3DModule(options);
9547
+ if (draco3DModule) {
9548
+ return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
9549
+ }
9550
+ return await loadDracoDecoderModuleFromLibrary(
9551
+ options,
9552
+ type === "js" ? "javascript" : type,
9553
+ profile
9554
+ );
9662
9555
  }
9663
- function getOptionalArrowConstructor(typeName) {
9664
- return arrow[typeName];
9665
- }
9666
- function isArrowViewType(arrowType, viewTypeName) {
9667
- const constructor = getOptionalArrowConstructor(viewTypeName);
9668
- if (constructor && arrowType instanceof constructor) {
9669
- return true;
9556
+ async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
9557
+ const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
9558
+ let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
9559
+ if (!decoderPromise2) {
9560
+ decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
9561
+ libraryDecoderPromises.set(cacheKey, decoderPromise2);
9670
9562
  }
9671
- const guards = arrow.DataType;
9672
- const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
9673
- return Boolean(guard == null ? void 0 : guard(arrowType));
9563
+ return await decoderPromise2;
9674
9564
  }
9675
- function isOptionalArrowType(arrowType, typeName) {
9676
- const constructor = getOptionalArrowConstructor(typeName);
9677
- return Boolean(constructor && arrowType instanceof constructor);
9565
+ async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
9566
+ const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
9567
+ let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
9568
+ if (!decoderPromise2) {
9569
+ decoderPromise2 = initializeWasmModule(
9570
+ () => typedDraco3DModule.createDecoderModule({}),
9571
+ (draco) => ({ draco })
9572
+ );
9573
+ injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
9574
+ }
9575
+ return await decoderPromise2;
9678
9576
  }
9679
- function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
9680
- const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
9681
- if (viewTypeMode === "never") {
9682
- return fallbackType;
9683
- }
9684
- const constructor = getOptionalArrowConstructor(viewTypeName);
9685
- if (constructor) {
9686
- return new constructor();
9687
- }
9688
- if (viewTypeMode === "require") {
9689
- throw new Error(
9690
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
9691
- );
9577
+ async function loadDracoDecoderWithFallback(options, type, profile) {
9578
+ try {
9579
+ return await loadDracoDecoder(options, type, profile);
9580
+ } catch (wasmError) {
9581
+ if (type === "javascript") {
9582
+ throw wasmError;
9583
+ }
9584
+ try {
9585
+ return await loadDracoDecoder(options, "javascript", "full");
9586
+ } catch (javascriptError) {
9587
+ throw new AggregateError(
9588
+ [wasmError, javascriptError],
9589
+ "Draco decoder could not load either the WebAssembly or JavaScript backend"
9590
+ );
9591
+ }
9692
9592
  }
9693
- return fallbackType;
9694
9593
  }
9695
- function makeRequiredArrowViewType(viewTypeName) {
9696
- const constructor = getOptionalArrowConstructor(viewTypeName);
9697
- if (!constructor) {
9698
- throw new Error(
9699
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
9700
- );
9701
- }
9702
- return new constructor();
9594
+ async function loadDracoDecoder(options, type, profile) {
9595
+ const initialization = decoderInitializationQueue.then(
9596
+ () => loadDracoDecoderInternal(options, type, profile)
9597
+ );
9598
+ decoderInitializationQueue = initialization.then(
9599
+ () => void 0,
9600
+ () => void 0
9601
+ );
9602
+ return await initialization;
9703
9603
  }
9704
- function serializeArrowDictionaryKeyType(arrowType) {
9705
- if (arrowType instanceof arrow.Int) {
9706
- const prefix = arrowType.isSigned ? "int" : "uint";
9707
- const keyType = `${prefix}${arrowType.bitWidth}`;
9708
- if (isSchemaDictionaryKeyType(keyType)) {
9709
- return keyType;
9604
+ async function loadDracoDecoderInternal(options, type, profile) {
9605
+ if (type === "javascript") {
9606
+ let decoderLibrary2;
9607
+ try {
9608
+ decoderLibrary2 = await loadLibrary2(
9609
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
9610
+ "scene",
9611
+ options,
9612
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
9613
+ "draco_decoder.mjs"
9614
+ );
9615
+ } catch (error) {
9616
+ if (isBrowser2 || options.useLocalLibraries) {
9617
+ throw error;
9618
+ }
9619
+ decoderLibrary2 = await loadLibrary2(
9620
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
9621
+ "scene",
9622
+ { ...options, useLocalLibraries: true },
9623
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
9624
+ "draco_decoder.mjs"
9625
+ );
9710
9626
  }
9627
+ const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
9628
+ return await initializeDracoModule(decoderInitializer2);
9711
9629
  }
9712
- switch (arrowType.constructor) {
9713
- case arrow.Int8:
9714
- return "int8";
9715
- case arrow.Int16:
9716
- return "int16";
9717
- case arrow.Int32:
9718
- return "int32";
9719
- case arrow.Uint8:
9720
- return "uint8";
9721
- case arrow.Uint16:
9722
- return "uint16";
9723
- case arrow.Uint32:
9724
- return "uint32";
9725
- default:
9726
- throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
9630
+ let decoderLibrary;
9631
+ let wasmBinary;
9632
+ try {
9633
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
9634
+ } catch (error) {
9635
+ if (isBrowser2 || options.useLocalLibraries) {
9636
+ throw error;
9637
+ }
9638
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
9639
+ { ...options, useLocalLibraries: true },
9640
+ profile
9641
+ );
9727
9642
  }
9643
+ const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
9644
+ return await initializeDracoModule(decoderInitializer, wasmBinary);
9728
9645
  }
9729
- function isSchemaDictionaryKeyType(keyType) {
9730
- return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
9646
+ async function loadDecoderWasmAssets(options, profile) {
9647
+ const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
9648
+ const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
9649
+ return await Promise.all([
9650
+ loadLibrary2(
9651
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
9652
+ "scene",
9653
+ options,
9654
+ decoderLibrary,
9655
+ profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
9656
+ ),
9657
+ loadLibrary2(
9658
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
9659
+ "scene",
9660
+ options,
9661
+ decoderWasm
9662
+ )
9663
+ ]);
9731
9664
  }
9732
- function deserializeArrowDictionaryKeyType(keyType) {
9733
- switch (keyType) {
9734
- case "int8":
9735
- return new arrow.Int8();
9736
- case "int16":
9737
- return new arrow.Int16();
9738
- case "int32":
9739
- return new arrow.Int32();
9740
- case "uint8":
9741
- return new arrow.Uint8();
9742
- case "uint16":
9743
- return new arrow.Uint16();
9744
- case "uint32":
9745
- return new arrow.Uint32();
9746
- default:
9747
- throw new Error(`schema dictionary index type not supported: ${keyType}`);
9665
+ function initializeDracoModule(initializer, wasmBinary) {
9666
+ if (typeof initializer !== "function") {
9667
+ throw new Error("Draco module initializer could not be loaded");
9748
9668
  }
9669
+ return initializeWasmModule(
9670
+ (onInitialized) => initializer({
9671
+ ...wasmBinary ? { wasmBinary } : {},
9672
+ onModuleLoaded: onInitialized
9673
+ }),
9674
+ (draco) => ({ draco })
9675
+ );
9749
9676
  }
9750
- var arrow;
9751
- var init_convert_arrow_schema = __esm({
9752
- "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
9753
- "use strict";
9754
- arrow = __toESM(require("apache-arrow"), 1);
9755
- }
9756
- });
9757
-
9758
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
9759
- function splitArrowBuffers(input, options = {}) {
9760
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
9761
- if (isArrowTable(input)) {
9762
- return splitArrowTableBuffersInternal(input, context);
9763
- }
9764
- if (isArrowRecordBatch(input)) {
9765
- return splitArrowRecordBatchBuffers(input, context);
9677
+ function getLibraryExport(library, exportName) {
9678
+ if (typeof library === "function") {
9679
+ return library;
9766
9680
  }
9767
- if (isArrowVector(input)) {
9768
- return splitArrowVectorBuffers(input, context);
9681
+ if (library && typeof library === "object") {
9682
+ const exports = library;
9683
+ const exportedInitializer = exports[exportName] || exports.default;
9684
+ return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
9769
9685
  }
9770
- return splitArrowDataBuffers(input, context);
9771
- }
9772
- function isArrowTable(input) {
9773
- return "batches" in input;
9774
- }
9775
- function isArrowRecordBatch(input) {
9776
- return "schema" in input && "data" in input && !Array.isArray(input.data);
9777
- }
9778
- function isArrowVector(input) {
9779
- return "data" in input && Array.isArray(input.data);
9780
- }
9781
- function splitArrowTableBuffersInternal(table, options) {
9782
- const recordBatches = table.batches.map(
9783
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
9784
- );
9785
- return new arrow2.Table(table.schema, recordBatches);
9786
- }
9787
- function splitArrowRecordBatchBuffers(recordBatch, options) {
9788
- return new arrow2.RecordBatch(
9789
- recordBatch.schema,
9790
- splitArrowDataBuffers(recordBatch.data, options)
9791
- );
9792
- }
9793
- function splitArrowDataBuffers(data, options) {
9794
- const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
9795
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
9796
- const buffers = {
9797
- [arrow2.BufferType.OFFSET]: splitArrowBuffer(data.buffers[arrow2.BufferType.OFFSET], options),
9798
- [arrow2.BufferType.DATA]: splitArrowBuffer(data.buffers[arrow2.BufferType.DATA], options),
9799
- [arrow2.BufferType.VALIDITY]: splitArrowBuffer(data.buffers[arrow2.BufferType.VALIDITY], options),
9800
- [arrow2.BufferType.TYPE]: splitArrowBuffer(data.buffers[arrow2.BufferType.TYPE], options)
9801
- };
9802
- return new arrow2.Data(
9803
- data.type,
9804
- data.offset,
9805
- data.length,
9806
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
9807
- data._nullCount,
9808
- buffers,
9809
- children,
9810
- dictionary
9811
- );
9812
- }
9813
- function splitArrowVectorBuffers(vector, options) {
9814
- return new arrow2.Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
9686
+ return void 0;
9815
9687
  }
9816
- function splitArrowBuffer(array, options) {
9817
- if (!isArrowTypedArray(array)) {
9818
- return array;
9819
- }
9820
- if (options.copy === "none") {
9821
- return array;
9688
+ function getInjectedDraco3DModule(options) {
9689
+ var _a;
9690
+ const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
9691
+ if (!module2) {
9692
+ return void 0;
9822
9693
  }
9823
- if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
9824
- return array;
9694
+ if (typeof module2 !== "object" && typeof module2 !== "function") {
9695
+ throw new Error("Invalid draco3d module");
9825
9696
  }
9826
- let copy = options.copies.get(array);
9827
- if (!copy) {
9828
- copy = array.slice();
9829
- options.copies.set(array, copy);
9697
+ return module2;
9698
+ }
9699
+ function validateDracoDecoderModule(module2) {
9700
+ const typedModule = module2;
9701
+ if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
9702
+ throw new Error("Invalid draco3d decoder module");
9830
9703
  }
9831
- return copy;
9704
+ return typedModule;
9832
9705
  }
9833
- function isArrowTypedArray(value) {
9834
- return ArrayBuffer.isView(value) && !(value instanceof DataView);
9706
+ function getLibraryCacheKey2(type, options) {
9707
+ const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
9708
+ return [
9709
+ type,
9710
+ options.useLocalLibraries ? "local" : "remote",
9711
+ options.CDN || "",
9712
+ libraryOverrides
9713
+ ].join("|");
9835
9714
  }
9836
- var arrow2;
9837
- var init_split_arrow_buffers = __esm({
9838
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
9715
+ var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
9716
+ var init_draco_module_loader = __esm({
9717
+ "../scene/src/draco/lib/draco-module-loader.ts"() {
9839
9718
  "use strict";
9840
- arrow2 = __toESM(require("apache-arrow"), 1);
9719
+ init_loader_utils();
9720
+ init_draco_library_loader();
9721
+ init_draco_libraries();
9722
+ libraryDecoderPromises = /* @__PURE__ */ new Map();
9723
+ injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
9724
+ decoderInitializationQueue = Promise.resolve();
9841
9725
  }
9842
9726
  });
9843
9727
 
9844
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
9845
- function dehydrateArrowTable(table, options) {
9846
- const splitTable = splitArrowBuffers(table, options);
9847
- return {
9848
- shape: "arrow-table",
9849
- transport: "arrow-js",
9850
- schema: serializeArrowSchema(splitTable.schema),
9851
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
9852
- };
9853
- }
9854
- function hydrateArrowTable(table) {
9855
- const schema = deserializeArrowSchema(table.schema);
9856
- const recordBatches = table.batches.map(
9857
- (recordBatch) => new arrow3.RecordBatch(schema, hydrateArrowData(recordBatch.data))
9858
- );
9859
- return new arrow3.Table(schema, recordBatches);
9860
- }
9861
- function serializeArrowWorkerResult(result, options) {
9862
- var _a;
9863
- if (!isArrowTableWrapper(result)) {
9864
- return result;
9728
+ // ../core/src/schema-utils/lib/schema/data-type.ts
9729
+ function getDataTypeFromValue(value, defaultNumberType = "float32") {
9730
+ if (value instanceof Date) {
9731
+ return "date-millisecond";
9865
9732
  }
9866
- const workerOptions = options;
9867
- const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
9868
- return {
9869
- ...result,
9870
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
9871
- };
9733
+ if (typeof value === "number") {
9734
+ return defaultNumberType;
9735
+ }
9736
+ if (typeof value === "boolean") {
9737
+ return "bool";
9738
+ }
9739
+ if (typeof value === "string") {
9740
+ return "utf8";
9741
+ }
9742
+ if (value === null || value === "undefined") {
9743
+ return "null";
9744
+ }
9745
+ return "null";
9872
9746
  }
9873
- function deserializeArrowWorkerResult(result) {
9874
- if (!isDehydratedArrowTableWrapper(result)) {
9875
- return result;
9747
+ function getDataTypeFromArray(array) {
9748
+ let type = getDataTypeFromTypedArray(array);
9749
+ if (type !== "null") {
9750
+ return { type, nullable: false };
9751
+ }
9752
+ if (array.length > 0) {
9753
+ type = getDataTypeFromValue(array[0]);
9754
+ return { type, nullable: true };
9876
9755
  }
9877
- return { ...result, data: hydrateArrowTable(result.data) };
9756
+ return { type: "null", nullable: true };
9878
9757
  }
9879
- function isArrowTableWrapper(value) {
9880
- const table = value;
9881
- return Boolean(
9882
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
9883
- );
9884
- }
9885
- function isDehydratedArrowTableWrapper(value) {
9886
- const table = value;
9887
- return Boolean(
9888
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
9889
- );
9890
- }
9891
- function dehydrateArrowRecordBatch(recordBatch) {
9892
- return { data: dehydrateArrowData(recordBatch.data) };
9893
- }
9894
- function dehydrateArrowData(data) {
9895
- return {
9896
- type: serializeArrowType(data.type),
9897
- offset: data.offset,
9898
- length: data.length,
9899
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
9900
- nullCount: data._nullCount,
9901
- buffers: {
9902
- [arrow3.BufferType.OFFSET]: data.buffers[arrow3.BufferType.OFFSET],
9903
- [arrow3.BufferType.DATA]: data.buffers[arrow3.BufferType.DATA],
9904
- [arrow3.BufferType.VALIDITY]: data.buffers[arrow3.BufferType.VALIDITY],
9905
- [arrow3.BufferType.TYPE]: data.buffers[arrow3.BufferType.TYPE]
9906
- },
9907
- children: data.children.map((childData) => dehydrateArrowData(childData)),
9908
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
9909
- };
9910
- }
9911
- function dehydrateArrowVector(vector) {
9912
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
9913
- }
9914
- function hydrateArrowData(data) {
9915
- const children = data.children.map((childData) => hydrateArrowData(childData));
9916
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
9917
- return new arrow3.Data(
9918
- deserializeArrowType(data.type),
9919
- data.offset,
9920
- data.length,
9921
- data.nullCount,
9922
- data.buffers,
9923
- children,
9924
- dictionary
9925
- );
9926
- }
9927
- function hydrateArrowVector(vector) {
9928
- return new arrow3.Vector(vector.data.map((data) => hydrateArrowData(data)));
9929
- }
9930
- var arrow3;
9931
- var init_arrow_table_transport = __esm({
9932
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
9933
- "use strict";
9934
- arrow3 = __toESM(require("apache-arrow"), 1);
9935
- init_convert_arrow_schema();
9936
- init_split_arrow_buffers();
9937
- }
9938
- });
9939
-
9940
- // ../core/src/schema-utils/arrow-transport.ts
9941
- var init_arrow_transport = __esm({
9942
- "../core/src/schema-utils/arrow-transport.ts"() {
9943
- "use strict";
9944
- init_arrow_table_transport();
9945
- init_split_arrow_buffers();
9946
- }
9947
- });
9948
-
9949
- // ../scene/src/draco/lib/utils/version.ts
9950
- var VERSION4;
9951
- var init_version4 = __esm({
9952
- "../scene/src/draco/lib/utils/version.ts"() {
9953
- "use strict";
9954
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9955
- }
9956
- });
9957
-
9958
- // ../scene/src/draco/draco-format.ts
9959
- var DracoFormat;
9960
- var init_draco_format = __esm({
9961
- "../scene/src/draco/draco-format.ts"() {
9962
- "use strict";
9963
- DracoFormat = {
9964
- name: "Draco",
9965
- id: "draco",
9966
- module: "scene",
9967
- encoding: "binary",
9968
- format: "draco",
9969
- extensions: ["drc"],
9970
- mimeTypes: ["application/octet-stream"],
9971
- binary: true,
9972
- tests: ["DRACO"]
9973
- };
9974
- }
9975
- });
9976
-
9977
- // ../scene/src/draco/draco-loader-options.ts
9978
- var DRACO_LOADER_DEFAULT_OPTIONS;
9979
- var init_draco_loader_options = __esm({
9980
- "../scene/src/draco/draco-loader-options.ts"() {
9981
- "use strict";
9982
- DRACO_LOADER_DEFAULT_OPTIONS = {
9983
- backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
9984
- extraAttributes: {},
9985
- attributeNameEntry: void 0,
9986
- shape: "arrow-table",
9987
- decoderProfile: "full"
9988
- };
9758
+ function getDataTypeFromTypedArray(array) {
9759
+ if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
9760
+ return "float16";
9989
9761
  }
9990
- });
9991
-
9992
- // ../scene/src/draco/lib/draco-library-loader.ts
9993
- async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
9994
- var _a;
9995
- if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
9996
- const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
9997
- options = {
9998
- ...options,
9999
- modules: {
10000
- [libraryName]: `${directory}/${libraryName}`,
10001
- ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
10002
- ...options.modules
10003
- }
10004
- };
9762
+ switch (array.constructor) {
9763
+ case Int8Array:
9764
+ return "int8";
9765
+ case Uint8Array:
9766
+ case Uint8ClampedArray:
9767
+ return "uint8";
9768
+ case Int16Array:
9769
+ return "int16";
9770
+ case Uint16Array:
9771
+ return "uint16";
9772
+ case Int32Array:
9773
+ return "int32";
9774
+ case Uint32Array:
9775
+ return "uint32";
9776
+ case BigInt64Array:
9777
+ return "int64";
9778
+ case BigUint64Array:
9779
+ return "uint64";
9780
+ case Float32Array:
9781
+ return "float32";
9782
+ case Float64Array:
9783
+ return "float64";
9784
+ default:
9785
+ return "null";
10005
9786
  }
10006
- return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
10007
9787
  }
10008
- var init_draco_library_loader = __esm({
10009
- "../scene/src/draco/lib/draco-library-loader.ts"() {
10010
- "use strict";
10011
- init_worker_utils();
10012
- }
10013
- });
10014
-
10015
- // ../scene/src/draco/draco-libraries.ts
10016
- var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
10017
- var init_draco_libraries = __esm({
10018
- "../scene/src/draco/draco-libraries.ts"() {
9788
+ var import_core;
9789
+ var init_data_type = __esm({
9790
+ "../core/src/schema-utils/lib/schema/data-type.ts"() {
10019
9791
  "use strict";
10020
- DRACO_VERSION = "1.5.7";
10021
- DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
10022
- STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
10023
- STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
10024
- DRACO_EXTERNAL_LIBRARIES = {
10025
- /** WebAssembly decoder JavaScript wrapper. */
10026
- DECODER: "draco_wasm_wrapper.js",
10027
- /** WebAssembly decoder binary. */
10028
- DECODER_WASM: "draco_decoder.wasm",
10029
- /** glTF-profile WebAssembly decoder JavaScript wrapper. */
10030
- GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
10031
- /** glTF-profile WebAssembly decoder binary. */
10032
- GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
10033
- /** JavaScript decoder fallback. */
10034
- FALLBACK_DECODER: "draco_decoder.js",
10035
- /** WebAssembly encoder JavaScript wrapper. */
10036
- ENCODER: "draco_encoder.js",
10037
- /** WebAssembly encoder binary. */
10038
- ENCODER_WASM: "draco_encoder.wasm"
10039
- };
10040
- DRACO_EXTERNAL_LIBRARY_URLS = {
10041
- [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
10042
- [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
10043
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
10044
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
10045
- [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
10046
- [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
10047
- [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
10048
- };
9792
+ import_core = require("@math.gl/core");
10049
9793
  }
10050
9794
  });
10051
9795
 
10052
- // ../scene/src/draco/lib/draco-module-loader.ts
10053
- async function loadDracoDecoderModule(options = {}, type, profile = "full") {
10054
- const draco3DModule = getInjectedDraco3DModule(options);
10055
- if (draco3DModule) {
10056
- return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
10057
- }
10058
- return await loadDracoDecoderModuleFromLibrary(
10059
- options,
10060
- type === "js" ? "javascript" : type,
10061
- profile
10062
- );
9796
+ // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
9797
+ function serializeArrowSchema(arrowSchema) {
9798
+ return {
9799
+ fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
9800
+ metadata: serializeArrowMetadata(arrowSchema.metadata)
9801
+ };
10063
9802
  }
10064
- async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
10065
- const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
10066
- let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
10067
- if (!decoderPromise2) {
10068
- decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
10069
- libraryDecoderPromises.set(cacheKey, decoderPromise2);
10070
- }
10071
- return await decoderPromise2;
9803
+ function serializeArrowMetadata(arrowMetadata) {
9804
+ return Object.fromEntries(arrowMetadata);
10072
9805
  }
10073
- async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
10074
- const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
10075
- let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
10076
- if (!decoderPromise2) {
10077
- decoderPromise2 = initializeWasmModule(
10078
- () => typedDraco3DModule.createDecoderModule({}),
10079
- (draco) => ({ draco })
10080
- );
10081
- injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
10082
- }
10083
- return await decoderPromise2;
9806
+ function deserializeArrowMetadata(metadata) {
9807
+ return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
10084
9808
  }
10085
- async function loadDracoDecoderWithFallback(options, type, profile) {
10086
- try {
10087
- return await loadDracoDecoder(options, type, profile);
10088
- } catch (wasmError) {
10089
- if (type === "javascript") {
10090
- throw wasmError;
10091
- }
10092
- try {
10093
- return await loadDracoDecoder(options, "javascript", "full");
10094
- } catch (javascriptError) {
10095
- throw new AggregateError(
10096
- [wasmError, javascriptError],
10097
- "Draco decoder could not load either the WebAssembly or JavaScript backend"
10098
- );
10099
- }
10100
- }
9809
+ function serializeArrowField(field) {
9810
+ return {
9811
+ name: field.name,
9812
+ type: serializeArrowType(field.type),
9813
+ nullable: field.nullable,
9814
+ metadata: serializeArrowMetadata(field.metadata)
9815
+ };
10101
9816
  }
10102
- async function loadDracoDecoder(options, type, profile) {
10103
- const initialization = decoderInitializationQueue.then(
10104
- () => loadDracoDecoderInternal(options, type, profile)
10105
- );
10106
- decoderInitializationQueue = initialization.then(
10107
- () => void 0,
10108
- () => void 0
9817
+ function deserializeArrowField(field, options) {
9818
+ return new arrow.Field(
9819
+ field.name,
9820
+ deserializeArrowType(field.type, options),
9821
+ field.nullable,
9822
+ deserializeArrowMetadata(field.metadata)
10109
9823
  );
10110
- return await initialization;
10111
9824
  }
10112
- async function loadDracoDecoderInternal(options, type, profile) {
10113
- if (type === "javascript") {
10114
- let decoderLibrary2;
10115
- try {
10116
- decoderLibrary2 = await loadLibrary2(
10117
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
10118
- "scene",
10119
- options,
10120
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
10121
- "draco_decoder.mjs"
10122
- );
10123
- } catch (error) {
10124
- if (isBrowser2 || options.useLocalLibraries) {
10125
- throw error;
10126
- }
10127
- decoderLibrary2 = await loadLibrary2(
10128
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
10129
- "scene",
10130
- { ...options, useLocalLibraries: true },
10131
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
10132
- "draco_decoder.mjs"
10133
- );
10134
- }
10135
- const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
10136
- return await initializeDracoModule(decoderInitializer2);
9825
+ function serializeArrowType(arrowType) {
9826
+ if (isArrowViewType(arrowType, "BinaryView")) {
9827
+ return "binary-view";
10137
9828
  }
10138
- let decoderLibrary;
10139
- let wasmBinary;
10140
- try {
10141
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
10142
- } catch (error) {
10143
- if (isBrowser2 || options.useLocalLibraries) {
10144
- throw error;
10145
- }
10146
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
10147
- { ...options, useLocalLibraries: true },
10148
- profile
10149
- );
9829
+ if (isArrowViewType(arrowType, "Utf8View")) {
9830
+ return "utf8-view";
10150
9831
  }
10151
- const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
10152
- return await initializeDracoModule(decoderInitializer, wasmBinary);
10153
- }
10154
- async function loadDecoderWasmAssets(options, profile) {
10155
- const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
10156
- const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
10157
- return await Promise.all([
10158
- loadLibrary2(
10159
- DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
10160
- "scene",
10161
- options,
10162
- decoderLibrary,
10163
- profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
10164
- ),
10165
- loadLibrary2(
10166
- DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
10167
- "scene",
10168
- options,
10169
- decoderWasm
10170
- )
10171
- ]);
10172
- }
10173
- function initializeDracoModule(initializer, wasmBinary) {
10174
- if (typeof initializer !== "function") {
10175
- throw new Error("Draco module initializer could not be loaded");
9832
+ if (isOptionalArrowType(arrowType, "LargeList")) {
9833
+ const largeListType = arrowType;
9834
+ return {
9835
+ type: "large-list",
9836
+ children: [serializeArrowField(largeListType.valueField)]
9837
+ };
9838
+ }
9839
+ switch (arrowType.constructor) {
9840
+ case arrow.Null:
9841
+ return "null";
9842
+ case arrow.Binary:
9843
+ return "binary";
9844
+ case arrow.FixedSizeBinary:
9845
+ return {
9846
+ type: "fixed-size-binary",
9847
+ byteWidth: arrowType.byteWidth
9848
+ };
9849
+ case arrow.Bool:
9850
+ return "bool";
9851
+ case arrow.Int:
9852
+ const intType = arrowType;
9853
+ return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
9854
+ case arrow.Int8:
9855
+ return "int8";
9856
+ case arrow.Int16:
9857
+ return "int16";
9858
+ case arrow.Int32:
9859
+ return "int32";
9860
+ case arrow.Int64:
9861
+ return "int64";
9862
+ case arrow.Uint8:
9863
+ return "uint8";
9864
+ case arrow.Uint16:
9865
+ return "uint16";
9866
+ case arrow.Uint32:
9867
+ return "uint32";
9868
+ case arrow.Uint64:
9869
+ return "uint64";
9870
+ case arrow.Float:
9871
+ const precision = arrowType.precision;
9872
+ switch (precision) {
9873
+ case arrow.Precision.HALF:
9874
+ return "float16";
9875
+ case arrow.Precision.SINGLE:
9876
+ return "float32";
9877
+ case arrow.Precision.DOUBLE:
9878
+ return "float64";
9879
+ default:
9880
+ return "float16";
9881
+ }
9882
+ case arrow.Float16:
9883
+ return "float16";
9884
+ case arrow.Float32:
9885
+ return "float32";
9886
+ case arrow.Float64:
9887
+ return "float64";
9888
+ case arrow.Utf8:
9889
+ return "utf8";
9890
+ case arrow.Decimal:
9891
+ const decimal = arrowType;
9892
+ return {
9893
+ type: "decimal",
9894
+ bitWidth: decimal.bitWidth,
9895
+ precision: decimal.precision,
9896
+ scale: decimal.scale
9897
+ };
9898
+ case arrow.Date_:
9899
+ const dateUnit = arrowType.unit;
9900
+ return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
9901
+ case arrow.DateDay:
9902
+ return "date-day";
9903
+ case arrow.DateMillisecond:
9904
+ return "date-millisecond";
9905
+ case arrow.Time:
9906
+ const timeUnit = arrowType.unit;
9907
+ switch (timeUnit) {
9908
+ case arrow.TimeUnit.SECOND:
9909
+ return "time-second";
9910
+ case arrow.TimeUnit.MILLISECOND:
9911
+ return "time-millisecond";
9912
+ case arrow.TimeUnit.MICROSECOND:
9913
+ return "time-microsecond";
9914
+ case arrow.TimeUnit.NANOSECOND:
9915
+ return "time-nanosecond";
9916
+ default:
9917
+ return "time-second";
9918
+ }
9919
+ case arrow.TimeMillisecond:
9920
+ return "time-millisecond";
9921
+ case arrow.TimeSecond:
9922
+ return "time-second";
9923
+ case arrow.TimeMicrosecond:
9924
+ return "time-microsecond";
9925
+ case arrow.TimeNanosecond:
9926
+ return "time-nanosecond";
9927
+ case arrow.Timestamp:
9928
+ const timeStampUnit = arrowType.unit;
9929
+ switch (timeStampUnit) {
9930
+ case arrow.TimeUnit.SECOND:
9931
+ return "timestamp-second";
9932
+ case arrow.TimeUnit.MILLISECOND:
9933
+ return "timestamp-millisecond";
9934
+ case arrow.TimeUnit.MICROSECOND:
9935
+ return "timestamp-microsecond";
9936
+ case arrow.TimeUnit.NANOSECOND:
9937
+ return "timestamp-nanosecond";
9938
+ default:
9939
+ return "timestamp-second";
9940
+ }
9941
+ case arrow.TimestampSecond:
9942
+ return "timestamp-second";
9943
+ case arrow.TimestampMillisecond:
9944
+ return "timestamp-millisecond";
9945
+ case arrow.TimestampMicrosecond:
9946
+ return "timestamp-microsecond";
9947
+ case arrow.TimestampNanosecond:
9948
+ return "timestamp-nanosecond";
9949
+ case arrow.Interval:
9950
+ const intervalUnit = arrowType.unit;
9951
+ switch (intervalUnit) {
9952
+ case arrow.IntervalUnit.DAY_TIME:
9953
+ return "interval-daytime";
9954
+ case arrow.IntervalUnit.YEAR_MONTH:
9955
+ return "interval-yearmonth";
9956
+ default:
9957
+ return "interval-daytime";
9958
+ }
9959
+ case arrow.IntervalDayTime:
9960
+ return "interval-daytime";
9961
+ case arrow.IntervalYearMonth:
9962
+ return "interval-yearmonth";
9963
+ case arrow.Map_:
9964
+ const mapType = arrowType;
9965
+ return {
9966
+ type: "map",
9967
+ keysSorted: mapType.keysSorted,
9968
+ children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
9969
+ };
9970
+ case arrow.List:
9971
+ const listType = arrowType;
9972
+ const listField = listType.valueField;
9973
+ return {
9974
+ type: "list",
9975
+ children: [serializeArrowField(listField)]
9976
+ };
9977
+ case arrow.FixedSizeList:
9978
+ const fixedSizeList = arrowType;
9979
+ return {
9980
+ type: "fixed-size-list",
9981
+ listSize: fixedSizeList.listSize,
9982
+ children: [serializeArrowField(fixedSizeList.children[0])]
9983
+ };
9984
+ case arrow.Struct:
9985
+ const structType = arrowType;
9986
+ return {
9987
+ type: "struct",
9988
+ children: structType.children.map((arrowField) => serializeArrowField(arrowField))
9989
+ };
9990
+ case arrow.SparseUnion:
9991
+ case arrow.DenseUnion:
9992
+ const unionType = arrowType;
9993
+ return {
9994
+ type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
9995
+ typeIds: unionType.typeIds,
9996
+ children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
9997
+ typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
9998
+ };
9999
+ case arrow.Dictionary:
10000
+ const dictionaryType = arrowType;
10001
+ return {
10002
+ type: "dictionary",
10003
+ id: dictionaryType.id,
10004
+ indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
10005
+ dictionary: serializeArrowType(dictionaryType.dictionary),
10006
+ isOrdered: dictionaryType.isOrdered
10007
+ };
10008
+ default:
10009
+ throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
10176
10010
  }
10177
- return initializeWasmModule(
10178
- (onInitialized) => initializer({
10179
- ...wasmBinary ? { wasmBinary } : {},
10180
- onModuleLoaded: onInitialized
10181
- }),
10182
- (draco) => ({ draco })
10183
- );
10184
10011
  }
10185
- function getLibraryExport(library, exportName) {
10186
- if (typeof library === "function") {
10187
- return library;
10012
+ function deserializeArrowType(dataType, options) {
10013
+ if (typeof dataType === "object") {
10014
+ switch (dataType.type) {
10015
+ case "decimal":
10016
+ return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
10017
+ case "map": {
10018
+ const children = dataType.children.map(
10019
+ (arrowField) => deserializeArrowField(arrowField, options)
10020
+ );
10021
+ return new arrow.Map_(children[0], dataType.keysSorted);
10022
+ }
10023
+ case "list": {
10024
+ const field = deserializeArrowField(dataType.children[0], options);
10025
+ return new arrow.List(field);
10026
+ }
10027
+ case "large-list": {
10028
+ const field = deserializeArrowField(dataType.children[0], options);
10029
+ const LargeList = getOptionalArrowConstructor("LargeList");
10030
+ if (!LargeList) {
10031
+ throw new Error(
10032
+ "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
10033
+ );
10034
+ }
10035
+ return new LargeList(field);
10036
+ }
10037
+ case "fixed-size-list": {
10038
+ const child = deserializeArrowField(dataType.children[0], options);
10039
+ return new arrow.FixedSizeList(dataType.listSize, child);
10040
+ }
10041
+ case "fixed-size-binary":
10042
+ return new arrow.FixedSizeBinary(dataType.byteWidth);
10043
+ case "struct": {
10044
+ const children = dataType.children.map(
10045
+ (arrowField) => deserializeArrowField(arrowField, options)
10046
+ );
10047
+ return new arrow.Struct(children);
10048
+ }
10049
+ case "sparse-union":
10050
+ case "dense-union": {
10051
+ const children = dataType.children.map(
10052
+ (arrowField) => deserializeArrowField(arrowField, options)
10053
+ );
10054
+ return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
10055
+ }
10056
+ case "dictionary": {
10057
+ return new arrow.Dictionary(
10058
+ deserializeArrowType(dataType.dictionary, options),
10059
+ deserializeArrowDictionaryKeyType(dataType.indices),
10060
+ dataType.id,
10061
+ dataType.isOrdered
10062
+ );
10063
+ }
10064
+ default:
10065
+ throw new Error("array type not supported");
10066
+ }
10188
10067
  }
10189
- if (library && typeof library === "object") {
10190
- const exports = library;
10191
- const exportedInitializer = exports[exportName] || exports.default;
10192
- return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
10068
+ switch (dataType) {
10069
+ case "null":
10070
+ return new arrow.Null();
10071
+ case "binary":
10072
+ return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
10073
+ case "binary-view":
10074
+ return makeRequiredArrowViewType("BinaryView");
10075
+ case "bool":
10076
+ return new arrow.Bool();
10077
+ case "int8":
10078
+ return new arrow.Int8();
10079
+ case "int16":
10080
+ return new arrow.Int16();
10081
+ case "int32":
10082
+ return new arrow.Int32();
10083
+ case "int64":
10084
+ return new arrow.Int64();
10085
+ case "uint8":
10086
+ return new arrow.Uint8();
10087
+ case "uint16":
10088
+ return new arrow.Uint16();
10089
+ case "uint32":
10090
+ return new arrow.Uint32();
10091
+ case "uint64":
10092
+ return new arrow.Uint64();
10093
+ case "float16":
10094
+ return new arrow.Float16();
10095
+ case "float32":
10096
+ return new arrow.Float32();
10097
+ case "float64":
10098
+ return new arrow.Float64();
10099
+ case "utf8":
10100
+ return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
10101
+ case "utf8-view":
10102
+ return makeRequiredArrowViewType("Utf8View");
10103
+ case "date-day":
10104
+ return new arrow.DateDay();
10105
+ case "date-millisecond":
10106
+ return new arrow.DateMillisecond();
10107
+ case "time-second":
10108
+ return new arrow.TimeSecond();
10109
+ case "time-millisecond":
10110
+ return new arrow.TimeMillisecond();
10111
+ case "time-microsecond":
10112
+ return new arrow.TimeMicrosecond();
10113
+ case "time-nanosecond":
10114
+ return new arrow.TimeNanosecond();
10115
+ case "timestamp-second":
10116
+ return new arrow.TimestampSecond();
10117
+ case "timestamp-millisecond":
10118
+ return new arrow.TimestampMillisecond();
10119
+ case "timestamp-microsecond":
10120
+ return new arrow.TimestampMicrosecond();
10121
+ case "timestamp-nanosecond":
10122
+ return new arrow.TimestampNanosecond();
10123
+ case "interval-daytime":
10124
+ return new arrow.IntervalDayTime();
10125
+ case "interval-yearmonth":
10126
+ return new arrow.IntervalYearMonth();
10127
+ default:
10128
+ throw new Error("array type not supported");
10193
10129
  }
10194
- return void 0;
10195
10130
  }
10196
- function getInjectedDraco3DModule(options) {
10197
- var _a;
10198
- const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
10199
- if (!module2) {
10200
- return void 0;
10201
- }
10202
- if (typeof module2 !== "object" && typeof module2 !== "function") {
10203
- throw new Error("Invalid draco3d module");
10204
- }
10205
- return module2;
10131
+ function getOptionalArrowConstructor(typeName) {
10132
+ return arrow[typeName];
10206
10133
  }
10207
- function validateDracoDecoderModule(module2) {
10208
- const typedModule = module2;
10209
- if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
10210
- throw new Error("Invalid draco3d decoder module");
10134
+ function isArrowViewType(arrowType, viewTypeName) {
10135
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10136
+ if (constructor && arrowType instanceof constructor) {
10137
+ return true;
10211
10138
  }
10212
- return typedModule;
10139
+ const guards = arrow.DataType;
10140
+ const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
10141
+ return Boolean(guard == null ? void 0 : guard(arrowType));
10213
10142
  }
10214
- function getLibraryCacheKey2(type, options) {
10215
- const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
10216
- return [
10217
- type,
10218
- options.useLocalLibraries ? "local" : "remote",
10219
- options.CDN || "",
10220
- libraryOverrides
10221
- ].join("|");
10143
+ function isOptionalArrowType(arrowType, typeName) {
10144
+ const constructor = getOptionalArrowConstructor(typeName);
10145
+ return Boolean(constructor && arrowType instanceof constructor);
10222
10146
  }
10223
- var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
10224
- var init_draco_module_loader = __esm({
10225
- "../scene/src/draco/lib/draco-module-loader.ts"() {
10226
- "use strict";
10227
- init_loader_utils();
10228
- init_draco_library_loader();
10229
- init_draco_libraries();
10230
- libraryDecoderPromises = /* @__PURE__ */ new Map();
10231
- injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
10232
- decoderInitializationQueue = Promise.resolve();
10233
- }
10234
- });
10235
-
10236
- // ../core/src/schema-utils/lib/schema/data-type.ts
10237
- function getDataTypeFromValue(value, defaultNumberType = "float32") {
10238
- if (value instanceof Date) {
10239
- return "date-millisecond";
10240
- }
10241
- if (typeof value === "number") {
10242
- return defaultNumberType;
10243
- }
10244
- if (typeof value === "boolean") {
10245
- return "bool";
10147
+ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
10148
+ const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
10149
+ if (viewTypeMode === "never") {
10150
+ return fallbackType;
10246
10151
  }
10247
- if (typeof value === "string") {
10248
- return "utf8";
10152
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10153
+ if (constructor) {
10154
+ return new constructor();
10249
10155
  }
10250
- if (value === null || value === "undefined") {
10251
- return "null";
10156
+ if (viewTypeMode === "require") {
10157
+ throw new Error(
10158
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
10159
+ );
10252
10160
  }
10253
- return "null";
10161
+ return fallbackType;
10254
10162
  }
10255
- function getDataTypeFromArray(array) {
10256
- let type = getDataTypeFromTypedArray(array);
10257
- if (type !== "null") {
10258
- return { type, nullable: false };
10259
- }
10260
- if (array.length > 0) {
10261
- type = getDataTypeFromValue(array[0]);
10262
- return { type, nullable: true };
10163
+ function makeRequiredArrowViewType(viewTypeName) {
10164
+ const constructor = getOptionalArrowConstructor(viewTypeName);
10165
+ if (!constructor) {
10166
+ throw new Error(
10167
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
10168
+ );
10263
10169
  }
10264
- return { type: "null", nullable: true };
10170
+ return new constructor();
10265
10171
  }
10266
- function getDataTypeFromTypedArray(array) {
10267
- if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
10268
- return "float16";
10172
+ function serializeArrowDictionaryKeyType(arrowType) {
10173
+ if (arrowType instanceof arrow.Int) {
10174
+ const prefix = arrowType.isSigned ? "int" : "uint";
10175
+ const keyType = `${prefix}${arrowType.bitWidth}`;
10176
+ if (isSchemaDictionaryKeyType(keyType)) {
10177
+ return keyType;
10178
+ }
10269
10179
  }
10270
- switch (array.constructor) {
10271
- case Int8Array:
10180
+ switch (arrowType.constructor) {
10181
+ case arrow.Int8:
10272
10182
  return "int8";
10273
- case Uint8Array:
10274
- case Uint8ClampedArray:
10275
- return "uint8";
10276
- case Int16Array:
10183
+ case arrow.Int16:
10277
10184
  return "int16";
10278
- case Uint16Array:
10279
- return "uint16";
10280
- case Int32Array:
10185
+ case arrow.Int32:
10281
10186
  return "int32";
10282
- case Uint32Array:
10187
+ case arrow.Uint8:
10188
+ return "uint8";
10189
+ case arrow.Uint16:
10190
+ return "uint16";
10191
+ case arrow.Uint32:
10283
10192
  return "uint32";
10284
- case BigInt64Array:
10285
- return "int64";
10286
- case BigUint64Array:
10287
- return "uint64";
10288
- case Float32Array:
10289
- return "float32";
10290
- case Float64Array:
10291
- return "float64";
10292
10193
  default:
10293
- return "null";
10194
+ throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
10294
10195
  }
10295
10196
  }
10296
- var import_core;
10297
- var init_data_type = __esm({
10298
- "../core/src/schema-utils/lib/schema/data-type.ts"() {
10197
+ function isSchemaDictionaryKeyType(keyType) {
10198
+ return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
10199
+ }
10200
+ function deserializeArrowDictionaryKeyType(keyType) {
10201
+ switch (keyType) {
10202
+ case "int8":
10203
+ return new arrow.Int8();
10204
+ case "int16":
10205
+ return new arrow.Int16();
10206
+ case "int32":
10207
+ return new arrow.Int32();
10208
+ case "uint8":
10209
+ return new arrow.Uint8();
10210
+ case "uint16":
10211
+ return new arrow.Uint16();
10212
+ case "uint32":
10213
+ return new arrow.Uint32();
10214
+ default:
10215
+ throw new Error(`schema dictionary index type not supported: ${keyType}`);
10216
+ }
10217
+ }
10218
+ var arrow;
10219
+ var init_convert_arrow_schema = __esm({
10220
+ "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
10299
10221
  "use strict";
10300
- import_core = require("@math.gl/core");
10222
+ arrow = __toESM(require("apache-arrow"), 1);
10301
10223
  }
10302
10224
  });
10303
10225
 
@@ -10397,23 +10319,23 @@ var init_float16 = __esm({
10397
10319
  });
10398
10320
 
10399
10321
  // ../core/src/schema/categories/category-mesh.ts
10400
- var arrow4, meshArrowSchema, indexedMeshArrowSchema;
10322
+ var arrow2, meshArrowSchema, indexedMeshArrowSchema;
10401
10323
  var init_category_mesh = __esm({
10402
10324
  "../core/src/schema/categories/category-mesh.ts"() {
10403
10325
  "use strict";
10404
- arrow4 = __toESM(require("apache-arrow"), 1);
10405
- meshArrowSchema = new arrow4.Schema([
10406
- new arrow4.Field(
10326
+ arrow2 = __toESM(require("apache-arrow"), 1);
10327
+ meshArrowSchema = new arrow2.Schema([
10328
+ new arrow2.Field(
10407
10329
  "POSITION",
10408
- new arrow4.FixedSizeList(3, new arrow4.Field("value", new arrow4.Float32(), false)),
10330
+ new arrow2.FixedSizeList(3, new arrow2.Field("value", new arrow2.Float32(), false)),
10409
10331
  false
10410
10332
  )
10411
10333
  ]);
10412
- indexedMeshArrowSchema = new arrow4.Schema([
10334
+ indexedMeshArrowSchema = new arrow2.Schema([
10413
10335
  ...meshArrowSchema.fields,
10414
- new arrow4.Field(
10336
+ new arrow2.Field(
10415
10337
  "indices",
10416
- new arrow4.List(new arrow4.Field("item", new arrow4.Uint32(), false)),
10338
+ new arrow2.List(new arrow2.Field("item", new arrow2.Uint32(), false)),
10417
10339
  true
10418
10340
  )
10419
10341
  ]);
@@ -10432,7 +10354,7 @@ var init_schema = __esm({
10432
10354
  // ../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts
10433
10355
  function getFixedSizeListVector(typedArray, stride, logicalType) {
10434
10356
  const data = getFixedSizeListData(typedArray, stride, logicalType);
10435
- return new arrow5.Vector([data]);
10357
+ return new arrow3.Vector([data]);
10436
10358
  }
10437
10359
  function getFixedSizeListData(typedArray, stride, logicalType) {
10438
10360
  const listType = getFixedSizeListType(typedArray, stride, logicalType);
@@ -10440,13 +10362,13 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
10440
10362
  const storage = logicalType === "float16" && isNativeFloat16Array(typedArray) ? getFloat16Storage(typedArray) : typedArray;
10441
10363
  const buffers = {
10442
10364
  // valueOffsets: undefined,
10443
- [arrow5.BufferType.DATA]: storage
10365
+ [arrow3.BufferType.DATA]: storage
10444
10366
  // values
10445
10367
  // nullBitmap: undefined,
10446
10368
  // typeIds: undefined
10447
10369
  };
10448
- const nestedData = new arrow5.Data(nestedType, 0, storage.length, 0, buffers);
10449
- const data = new arrow5.Data(
10370
+ const nestedData = new arrow3.Data(nestedType, 0, storage.length, 0, buffers);
10371
+ const data = new arrow3.Data(
10450
10372
  listType,
10451
10373
  0,
10452
10374
  storage.length / stride,
@@ -10459,15 +10381,15 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
10459
10381
  function getFixedSizeListType(typedArray, stride, logicalType) {
10460
10382
  const type = logicalType || getDataTypeFromArray(typedArray).type;
10461
10383
  const arrowType = deserializeArrowType(type);
10462
- const listType = new arrow5.FixedSizeList(stride, new arrow5.Field("value", arrowType, false));
10384
+ const listType = new arrow3.FixedSizeList(stride, new arrow3.Field("value", arrowType, false));
10463
10385
  return listType;
10464
10386
  }
10465
- var arrow5;
10387
+ var arrow3;
10466
10388
  var init_arrow_fixed_size_list_utils = __esm({
10467
10389
  "../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts"() {
10468
10390
  "use strict";
10469
10391
  init_schema();
10470
- arrow5 = __toESM(require("apache-arrow"), 1);
10392
+ arrow3 = __toESM(require("apache-arrow"), 1);
10471
10393
  init_data_type();
10472
10394
  init_convert_arrow_schema();
10473
10395
  }
@@ -10527,8 +10449,8 @@ function makeMeshArrowTable(attributes, options = {}) {
10527
10449
  fields.push(indicesField);
10528
10450
  }
10529
10451
  }
10530
- const arrowSchema = new arrow6.Schema(fields, getMeshArrowMetadata(options));
10531
- const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow6.Table(arrowSchema) : new arrow6.Table(arrowSchema, columns);
10452
+ const arrowSchema = new arrow4.Schema(fields, getMeshArrowMetadata(options));
10453
+ const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow4.Table(arrowSchema) : new arrow4.Table(arrowSchema, columns);
10532
10454
  const schema = serializeArrowSchema(table.schema);
10533
10455
  return {
10534
10456
  shape: "arrow-table",
@@ -10542,14 +10464,14 @@ function getAttributeArrowVector(value, size, componentType) {
10542
10464
  if (componentType === "float16") {
10543
10465
  const storage = isNativeFloat16Array(value) ? getFloat16Storage(value) : value;
10544
10466
  if (size === 1) {
10545
- const data = new arrow6.Data(new arrow6.Float16(), 0, storage.length, 0, {
10546
- [arrow6.BufferType.DATA]: storage
10467
+ const data = new arrow4.Data(new arrow4.Float16(), 0, storage.length, 0, {
10468
+ [arrow4.BufferType.DATA]: storage
10547
10469
  });
10548
- return new arrow6.Vector([data]);
10470
+ return new arrow4.Vector([data]);
10549
10471
  }
10550
10472
  return getFixedSizeListVector(value, size, componentType);
10551
10473
  }
10552
- return size === 1 ? arrow6.makeVector(value) : getFixedSizeListVector(value, size);
10474
+ return size === 1 ? arrow4.makeVector(value) : getFixedSizeListVector(value, size);
10553
10475
  }
10554
10476
  function getOrderedAttributeNames(attributes) {
10555
10477
  const attributeNames = Object.keys(attributes);
@@ -10576,7 +10498,7 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
10576
10498
  for (const [key, value] of Object.entries(suppliedField.metadata)) {
10577
10499
  metadata.set(key, value);
10578
10500
  }
10579
- return new arrow6.Field(
10501
+ return new arrow4.Field(
10580
10502
  canonicalField.name,
10581
10503
  canonicalField.type,
10582
10504
  canonicalField.nullable,
@@ -10587,21 +10509,21 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
10587
10509
  if (componentType === "float16") {
10588
10510
  const metadata = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
10589
10511
  metadata.set("componentType", "float16");
10590
- return new arrow6.Field(attributeName, column.type, false, metadata);
10512
+ return new arrow4.Field(attributeName, column.type, false, metadata);
10591
10513
  }
10592
10514
  if (field && field.type.toString() !== column.type.toString()) {
10593
10515
  const deserializedField = deserializeArrowField(field);
10594
- return new arrow6.Field(
10516
+ return new arrow4.Field(
10595
10517
  attributeName,
10596
10518
  column.type,
10597
10519
  deserializedField.nullable,
10598
10520
  deserializedField.metadata
10599
10521
  );
10600
10522
  }
10601
- return field ? deserializeArrowField(field) : new arrow6.Field(attributeName, column.type, false);
10523
+ return field ? deserializeArrowField(field) : new arrow4.Field(attributeName, column.type, false);
10602
10524
  }
10603
10525
  function isMeshPositionColumn(column) {
10604
- return column.type instanceof arrow6.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow6.Float32;
10526
+ return column.type instanceof arrow4.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow4.Float32;
10605
10527
  }
10606
10528
  function getIndicesVector(indices, vertexCount, type) {
10607
10529
  const indicesType = type;
@@ -10614,25 +10536,25 @@ function getIndicesVector(indices, vertexCount, type) {
10614
10536
  if (vertexCount > 0) {
10615
10537
  nullBitmap[0] = 1;
10616
10538
  }
10617
- const valuesData = new arrow6.Data(
10539
+ const valuesData = new arrow4.Data(
10618
10540
  indicesType.children[0].type,
10619
10541
  0,
10620
10542
  values.length,
10621
10543
  0,
10622
- { [arrow6.BufferType.DATA]: values }
10544
+ { [arrow4.BufferType.DATA]: values }
10623
10545
  );
10624
- const indicesData = new arrow6.Data(
10546
+ const indicesData = new arrow4.Data(
10625
10547
  indicesType,
10626
10548
  0,
10627
10549
  vertexCount,
10628
10550
  Math.max(0, vertexCount - 1),
10629
10551
  {
10630
- [arrow6.BufferType.OFFSET]: valueOffsets,
10631
- [arrow6.BufferType.VALIDITY]: nullBitmap
10552
+ [arrow4.BufferType.OFFSET]: valueOffsets,
10553
+ [arrow4.BufferType.VALIDITY]: nullBitmap
10632
10554
  },
10633
10555
  [valuesData]
10634
10556
  );
10635
- return new arrow6.Vector([indicesData]);
10557
+ return new arrow4.Vector([indicesData]);
10636
10558
  }
10637
10559
  function getMeshArrowMetadata(options) {
10638
10560
  var _a;
@@ -10648,13 +10570,13 @@ function getMeshArrowMetadata(options) {
10648
10570
  }
10649
10571
  return deserializeArrowMetadata(metadata);
10650
10572
  }
10651
- var arrow6, MESH_ARROW_ATTRIBUTE_ORDER;
10573
+ var arrow4, MESH_ARROW_ATTRIBUTE_ORDER;
10652
10574
  var init_convert_mesh_to_table = __esm({
10653
10575
  "../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts"() {
10654
10576
  "use strict";
10655
10577
  init_schema();
10656
10578
  init_schema();
10657
- arrow6 = __toESM(require("apache-arrow"), 1);
10579
+ arrow4 = __toESM(require("apache-arrow"), 1);
10658
10580
  init_arrow_fixed_size_list_utils();
10659
10581
  init_convert_arrow_schema();
10660
10582
  MESH_ARROW_ATTRIBUTE_ORDER = ["POSITION"];
@@ -11518,7 +11440,7 @@ var DracoLoader;
11518
11440
  var init_draco_loader_types = __esm({
11519
11441
  "../scene/src/draco/draco-loader-types.ts"() {
11520
11442
  "use strict";
11521
- init_arrow_transport();
11443
+ init_arrow_worker_transport();
11522
11444
  init_version4();
11523
11445
  init_draco_format();
11524
11446
  init_draco_loader_options();
@@ -15014,7 +14936,7 @@ var VERSION5;
15014
14936
  var init_version5 = __esm({
15015
14937
  "dist/3d-tiles/lib/utils/version.js"() {
15016
14938
  "use strict";
15017
- VERSION5 = true ? "5.0.0-beta.4" : "latest";
14939
+ VERSION5 = true ? "5.0.0-beta.6" : "latest";
15018
14940
  }
15019
14941
  });
15020
14942
 
@@ -21080,6 +21002,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
21080
21002
  function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
21081
21003
  const instances = new Array(instancesLength);
21082
21004
  const instancePosition = new import_core17.Vector3();
21005
+ const instanceFramePosition = new import_core17.Vector3();
21083
21006
  const instanceNormalRight = new import_core17.Vector3();
21084
21007
  const instanceNormalUp = new import_core17.Vector3();
21085
21008
  const instanceNormalForward = new import_core17.Vector3();
@@ -21142,7 +21065,10 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
21142
21065
  tile.hasCustomOrientation = true;
21143
21066
  hasCustomOrientation = true;
21144
21067
  } else if (tile.eastNorthUp) {
21145
- (0, import_geospatial9.eastNorthUpToFixedFrame)(import_geospatial8.Ellipsoid.WGS84, instancePosition, instanceTransform);
21068
+ instanceFramePosition.copy(instancePosition);
21069
+ if (tile.rtcCenter)
21070
+ instanceFramePosition.add(tile.rtcCenter);
21071
+ (0, import_geospatial9.eastNorthUpToFixedFrame)(import_geospatial8.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
21146
21072
  instanceTransform.getRotationMatrix3(instanceRotation);
21147
21073
  } else {
21148
21074
  instanceRotation.identity();
@@ -24437,6 +24363,7 @@ function parseInstancedModel2(tile, arrayBuffer, byteOffset, options, context) {
24437
24363
  function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLength) {
24438
24364
  const instances = new Array(instancesLength);
24439
24365
  const instancePosition = new import_core23.Vector3();
24366
+ const instanceFramePosition = new import_core23.Vector3();
24440
24367
  const instanceNormalRight = new import_core23.Vector3();
24441
24368
  const instanceNormalUp = new import_core23.Vector3();
24442
24369
  const instanceNormalForward = new import_core23.Vector3();
@@ -24531,7 +24458,9 @@ function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLe
24531
24458
  tile.hasCustomOrientation = true;
24532
24459
  hasCustomOrientation = true;
24533
24460
  } else if (tile.eastNorthUp) {
24534
- (0, import_geospatial12.eastNorthUpToFixedFrame)(import_geospatial11.Ellipsoid.WGS84, instancePosition, instanceTransform);
24461
+ instanceFramePosition.copy(instancePosition);
24462
+ if (tile.rtcCenter) instanceFramePosition.add(tile.rtcCenter);
24463
+ (0, import_geospatial12.eastNorthUpToFixedFrame)(import_geospatial11.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
24535
24464
  instanceTransform.getRotationMatrix3(instanceRotation);
24536
24465
  } else {
24537
24466
  instanceRotation.identity();
@@ -29472,7 +29401,7 @@ var init_d_tiles_archive_loader = __esm({
29472
29401
  "dist/3d-tiles/3d-tiles-archive-loader.js"() {
29473
29402
  "use strict";
29474
29403
  init_tiles_3d_format();
29475
- VERSION7 = true ? "5.0.0-beta.4" : "latest";
29404
+ VERSION7 = true ? "5.0.0-beta.6" : "latest";
29476
29405
  Tiles3DArchiveFileLoader = {
29477
29406
  dataType: null,
29478
29407
  batchType: null,