@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
@@ -316,6 +316,7 @@ async function loadLibraryInWorker(libraryUrl, moduleLibraryUrl = libraryUrl) {
316
316
  } catch {
317
317
  const moduleUrl = new URL(moduleLibraryUrl, globalThis.location.href).href;
318
318
  const library = await import(
319
+ /* webpackIgnore: true */
319
320
  /* @vite-ignore */
320
321
  moduleUrl
321
322
  );
@@ -376,12 +377,10 @@ var init_library_utils = __esm({
376
377
  });
377
378
 
378
379
  // ../core/src/worker-utils/index.ts
379
- var import_tasks;
380
380
  var init_worker_utils = __esm({
381
381
  "../core/src/worker-utils/index.ts"() {
382
382
  "use strict";
383
383
  init_globals2();
384
- import_tasks = require("@math.gl/core/tasks");
385
384
  init_library_utils();
386
385
  }
387
386
  });
@@ -5406,7 +5405,7 @@ __export(KHR_gaussian_splatting_exports, {
5406
5405
  name: () => name6
5407
5406
  });
5408
5407
  async function decode6(gltfData, options, context) {
5409
- var _a, _b, _c, _d, _e;
5408
+ var _a, _b, _c, _d, _e, _f, _g;
5410
5409
  const loader = (_a = context == null ? void 0 : context.loaders) == null ? void 0 : _a.find((candidate) => {
5411
5410
  var _a2;
5412
5411
  return (_a2 = candidate.extensions) == null ? void 0 : _a2.includes("spz");
@@ -5417,22 +5416,29 @@ async function decode6(gltfData, options, context) {
5417
5416
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
5418
5417
  const extension = (_b = primitive.extensions) == null ? void 0 : _b[name6];
5419
5418
  if (!extension) continue;
5419
+ const descriptor = descriptors.find(
5420
+ (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
5421
+ );
5422
+ const legacyColorSpace = (_c = options == null ? void 0 : options.gltf) == null ? void 0 : _c.legacyGaussianSplatColorSpace;
5423
+ const normalizedExtension = legacyColorSpace && ((_d = extension.extensions) == null ? void 0 : _d[SPZ_COMPRESSION_EXTENSION_NAME]) ? {
5424
+ ...extension,
5425
+ kernel: extension.kernel ?? "ellipse",
5426
+ colorSpace: extension.colorSpace ?? legacyColorSpace
5427
+ } : extension;
5428
+ if (descriptor) descriptor.extension = normalizedExtension;
5420
5429
  validateGaussianSplatPrimitive(
5421
5430
  gltfData.json,
5422
5431
  primitive,
5423
- extension,
5432
+ normalizedExtension,
5424
5433
  meshIndex,
5425
5434
  primitiveIndex,
5426
5435
  iterator
5427
5436
  );
5428
- const compression = (_c = extension.extensions) == null ? void 0 : _c[SPZ_COMPRESSION_EXTENSION_NAME];
5437
+ const compression = (_e = extension.extensions) == null ? void 0 : _e[SPZ_COMPRESSION_EXTENSION_NAME];
5429
5438
  if (compression) {
5430
- const descriptor = descriptors.find(
5431
- (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
5432
- );
5433
5439
  if (descriptor) {
5434
- const decoder = (_d = options == null ? void 0 : options.gltf) == null ? void 0 : _d.splatDecoder;
5435
- const bufferView = (_e = gltfData.json.bufferViews) == null ? void 0 : _e[compression.bufferView];
5440
+ const decoder = (_f = options == null ? void 0 : options.gltf) == null ? void 0 : _f.splatDecoder;
5441
+ const bufferView = (_g = gltfData.json.bufferViews) == null ? void 0 : _g[compression.bufferView];
5436
5442
  if (bufferView && gltfData.buffers[bufferView.buffer]) {
5437
5443
  descriptor.compressedBytes = getBufferViewBytes(gltfData, compression.bufferView);
5438
5444
  } else if (decoder || loader) {
@@ -6603,7 +6609,7 @@ var init_EXT_feature_metadata = __esm({
6603
6609
  });
6604
6610
 
6605
6611
  // ../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts
6606
- var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema;
6612
+ var import_zod, indexSchema, propertyShape, GLTFKHRMaterialVariantSchema, GLTFKHRMaterialsVariantsSchema, GLTFKHRMaterialVariantMappingSchema, GLTFKHRMaterialsVariantsPrimitiveSchema, GLTFEXTMeshGPUInstancingSchema, GLTFKHRAnimationPointerSchema, GLTFKHRNodeVisibilitySchema, GLTFKHRNodeSelectabilitySchema, GLTFKHRNodeHoverabilitySchema, GLTFKHRXMPPacketSchema, GLTFKHRXMPJSONLDSchema, GLTFKHRXMPJSONLDReferenceSchema, GLTFKHRMaterialsEmissiveStrengthSchema, GLTFFBGeometryMetadataSchema;
6607
6613
  var init_gltf_additional_extension_schemas = __esm({
6608
6614
  "../scene/src/gltf/lib/types/gltf-additional-extension-schemas.ts"() {
6609
6615
  "use strict";
@@ -6678,6 +6684,24 @@ var init_gltf_additional_extension_schemas = __esm({
6678
6684
  /** Index into the document-level packets array. */
6679
6685
  packet: indexSchema
6680
6686
  });
6687
+ GLTFKHRMaterialsEmissiveStrengthSchema = import_zod.z.looseObject({
6688
+ ...propertyShape,
6689
+ /** Unitless multiplier; defaults to one when omitted. */
6690
+ emissiveStrength: import_zod.z.number().nonnegative().optional()
6691
+ });
6692
+ GLTFFBGeometryMetadataSchema = import_zod.z.looseObject({
6693
+ ...propertyShape,
6694
+ /** Authored count of vertices. */
6695
+ vertexCount: import_zod.z.number().nonnegative().optional(),
6696
+ /** Authored count of primitives. */
6697
+ primitiveCount: import_zod.z.number().nonnegative().optional(),
6698
+ /** Static scene-space bounding box. */
6699
+ sceneBounds: import_zod.z.looseObject({
6700
+ ...propertyShape,
6701
+ min: import_zod.z.array(import_zod.z.number()).length(3),
6702
+ max: import_zod.z.array(import_zod.z.number()).length(3)
6703
+ }).optional()
6704
+ });
6681
6705
  }
6682
6706
  });
6683
6707
 
@@ -6829,7 +6853,7 @@ var init_gltf_audio_extension_schemas = __esm({
6829
6853
  });
6830
6854
 
6831
6855
  // ../scene/src/gltf/lib/types/gltf-extension-schemas.ts
6832
- var import_zod3, GLTFPropertyExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
6856
+ var import_zod3, GLTFPropertyExtensionsSchema, GLTFMaterialExtensionsSchema, GLTFRootExtensionsSchema, GLTFNodeExtensionsSchema, GLTFSceneExtensionsSchema, GLTFMeshPrimitiveExtensionsSchema, GLTFAnimationTargetExtensionsSchema;
6833
6857
  var init_gltf_extension_schemas = __esm({
6834
6858
  "../scene/src/gltf/lib/types/gltf-extension-schemas.ts"() {
6835
6859
  "use strict";
@@ -6840,6 +6864,10 @@ var init_gltf_extension_schemas = __esm({
6840
6864
  /** Shared XMP packet reference. */
6841
6865
  KHR_xmp_json_ld: GLTFKHRXMPJSONLDReferenceSchema.optional()
6842
6866
  });
6867
+ GLTFMaterialExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
6868
+ /** Emissive intensity multiplier. */
6869
+ KHR_materials_emissive_strength: GLTFKHRMaterialsEmissiveStrengthSchema.optional()
6870
+ });
6843
6871
  GLTFRootExtensionsSchema = import_zod3.z.looseObject({
6844
6872
  /** Shared material variant declarations. */
6845
6873
  KHR_materials_variants: GLTFKHRMaterialsVariantsSchema.optional(),
@@ -6865,6 +6893,8 @@ var init_gltf_extension_schemas = __esm({
6865
6893
  MPEG_audio_spatial: GLTFMPEGAudioSpatialSchema.optional()
6866
6894
  });
6867
6895
  GLTFSceneExtensionsSchema = GLTFPropertyExtensionsSchema.extend({
6896
+ /** Authored static geometry summary. */
6897
+ FB_geometry_metadata: GLTFFBGeometryMetadataSchema.optional(),
6868
6898
  /** Attached global KHR audio emitters. */
6869
6899
  KHR_audio_emitter: GLTFKHRAudioAttachmentSchema.optional()
6870
6900
  });
@@ -7769,985 +7799,827 @@ var init_KHR_texture_basisu = __esm({
7769
7799
  }
7770
7800
  });
7771
7801
 
7772
- // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
7773
- function serializeArrowSchema(arrowSchema) {
7802
+ // ../core/src/arrow-worker-transport.ts
7803
+ function serializeArrowWorkerResult(result, options) {
7804
+ var _a;
7805
+ if (!isArrowTableWrapper(result)) {
7806
+ return result;
7807
+ }
7808
+ const workerOptions = options;
7809
+ const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
7774
7810
  return {
7775
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
7776
- metadata: serializeArrowMetadata(arrowSchema.metadata)
7811
+ ...result,
7812
+ data: (0, import_arrow.dehydrateArrowTable)(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
7777
7813
  };
7778
7814
  }
7779
- function deserializeArrowSchema(schema, options) {
7780
- return new arrow.Schema(
7781
- schema.fields.map((field) => deserializeArrowField(field, options)),
7782
- deserializeArrowMetadata(schema.metadata)
7783
- );
7784
- }
7785
- function serializeArrowMetadata(arrowMetadata) {
7786
- return Object.fromEntries(arrowMetadata);
7787
- }
7788
- function deserializeArrowMetadata(metadata) {
7789
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
7815
+ function deserializeArrowWorkerResult(result) {
7816
+ if (!isDehydratedArrowTableWrapper(result)) {
7817
+ return result;
7818
+ }
7819
+ return { ...result, data: (0, import_arrow.hydrateArrowTable)(result.data) };
7790
7820
  }
7791
- function serializeArrowField(field) {
7792
- return {
7793
- name: field.name,
7794
- type: serializeArrowType(field.type),
7795
- nullable: field.nullable,
7796
- metadata: serializeArrowMetadata(field.metadata)
7797
- };
7821
+ function isArrowTableWrapper(value) {
7822
+ const table = value;
7823
+ return Boolean(
7824
+ table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
7825
+ );
7798
7826
  }
7799
- function deserializeArrowField(field, options) {
7800
- return new arrow.Field(
7801
- field.name,
7802
- deserializeArrowType(field.type, options),
7803
- field.nullable,
7804
- deserializeArrowMetadata(field.metadata)
7827
+ function isDehydratedArrowTableWrapper(value) {
7828
+ const table = value;
7829
+ return Boolean(
7830
+ table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
7805
7831
  );
7806
7832
  }
7807
- function serializeArrowType(arrowType) {
7808
- if (isArrowViewType(arrowType, "BinaryView")) {
7809
- return "binary-view";
7833
+ var import_arrow;
7834
+ var init_arrow_worker_transport = __esm({
7835
+ "../core/src/arrow-worker-transport.ts"() {
7836
+ "use strict";
7837
+ import_arrow = require("@math.gl/arrow");
7810
7838
  }
7811
- if (isArrowViewType(arrowType, "Utf8View")) {
7812
- return "utf8-view";
7839
+ });
7840
+
7841
+ // ../scene/src/draco/lib/utils/version.ts
7842
+ var VERSION4;
7843
+ var init_version4 = __esm({
7844
+ "../scene/src/draco/lib/utils/version.ts"() {
7845
+ "use strict";
7846
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
7813
7847
  }
7814
- if (isOptionalArrowType(arrowType, "LargeList")) {
7815
- const largeListType = arrowType;
7816
- return {
7817
- type: "large-list",
7818
- children: [serializeArrowField(largeListType.valueField)]
7848
+ });
7849
+
7850
+ // ../scene/src/draco/draco-format.ts
7851
+ var DracoFormat;
7852
+ var init_draco_format = __esm({
7853
+ "../scene/src/draco/draco-format.ts"() {
7854
+ "use strict";
7855
+ DracoFormat = {
7856
+ name: "Draco",
7857
+ id: "draco",
7858
+ module: "scene",
7859
+ encoding: "binary",
7860
+ format: "draco",
7861
+ extensions: ["drc"],
7862
+ mimeTypes: ["application/octet-stream"],
7863
+ binary: true,
7864
+ tests: ["DRACO"]
7819
7865
  };
7820
7866
  }
7821
- switch (arrowType.constructor) {
7822
- case arrow.Null:
7823
- return "null";
7824
- case arrow.Binary:
7825
- return "binary";
7826
- case arrow.FixedSizeBinary:
7827
- return {
7828
- type: "fixed-size-binary",
7829
- byteWidth: arrowType.byteWidth
7830
- };
7831
- case arrow.Bool:
7832
- return "bool";
7833
- case arrow.Int:
7834
- const intType = arrowType;
7835
- return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
7836
- case arrow.Int8:
7837
- return "int8";
7838
- case arrow.Int16:
7839
- return "int16";
7840
- case arrow.Int32:
7841
- return "int32";
7842
- case arrow.Int64:
7843
- return "int64";
7844
- case arrow.Uint8:
7845
- return "uint8";
7846
- case arrow.Uint16:
7847
- return "uint16";
7848
- case arrow.Uint32:
7849
- return "uint32";
7850
- case arrow.Uint64:
7851
- return "uint64";
7852
- case arrow.Float:
7853
- const precision = arrowType.precision;
7854
- switch (precision) {
7855
- case arrow.Precision.HALF:
7856
- return "float16";
7857
- case arrow.Precision.SINGLE:
7858
- return "float32";
7859
- case arrow.Precision.DOUBLE:
7860
- return "float64";
7861
- default:
7862
- return "float16";
7863
- }
7864
- case arrow.Float16:
7865
- return "float16";
7866
- case arrow.Float32:
7867
- return "float32";
7868
- case arrow.Float64:
7869
- return "float64";
7870
- case arrow.Utf8:
7871
- return "utf8";
7872
- case arrow.Decimal:
7873
- const decimal = arrowType;
7874
- return {
7875
- type: "decimal",
7876
- bitWidth: decimal.bitWidth,
7877
- precision: decimal.precision,
7878
- scale: decimal.scale
7879
- };
7880
- case arrow.Date_:
7881
- const dateUnit = arrowType.unit;
7882
- return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
7883
- case arrow.DateDay:
7884
- return "date-day";
7885
- case arrow.DateMillisecond:
7886
- return "date-millisecond";
7887
- case arrow.Time:
7888
- const timeUnit = arrowType.unit;
7889
- switch (timeUnit) {
7890
- case arrow.TimeUnit.SECOND:
7891
- return "time-second";
7892
- case arrow.TimeUnit.MILLISECOND:
7893
- return "time-millisecond";
7894
- case arrow.TimeUnit.MICROSECOND:
7895
- return "time-microsecond";
7896
- case arrow.TimeUnit.NANOSECOND:
7897
- return "time-nanosecond";
7898
- default:
7899
- return "time-second";
7900
- }
7901
- case arrow.TimeMillisecond:
7902
- return "time-millisecond";
7903
- case arrow.TimeSecond:
7904
- return "time-second";
7905
- case arrow.TimeMicrosecond:
7906
- return "time-microsecond";
7907
- case arrow.TimeNanosecond:
7908
- return "time-nanosecond";
7909
- case arrow.Timestamp:
7910
- const timeStampUnit = arrowType.unit;
7911
- switch (timeStampUnit) {
7912
- case arrow.TimeUnit.SECOND:
7913
- return "timestamp-second";
7914
- case arrow.TimeUnit.MILLISECOND:
7915
- return "timestamp-millisecond";
7916
- case arrow.TimeUnit.MICROSECOND:
7917
- return "timestamp-microsecond";
7918
- case arrow.TimeUnit.NANOSECOND:
7919
- return "timestamp-nanosecond";
7920
- default:
7921
- return "timestamp-second";
7922
- }
7923
- case arrow.TimestampSecond:
7924
- return "timestamp-second";
7925
- case arrow.TimestampMillisecond:
7926
- return "timestamp-millisecond";
7927
- case arrow.TimestampMicrosecond:
7928
- return "timestamp-microsecond";
7929
- case arrow.TimestampNanosecond:
7930
- return "timestamp-nanosecond";
7931
- case arrow.Interval:
7932
- const intervalUnit = arrowType.unit;
7933
- switch (intervalUnit) {
7934
- case arrow.IntervalUnit.DAY_TIME:
7935
- return "interval-daytime";
7936
- case arrow.IntervalUnit.YEAR_MONTH:
7937
- return "interval-yearmonth";
7938
- default:
7939
- return "interval-daytime";
7867
+ });
7868
+
7869
+ // ../scene/src/draco/draco-loader-options.ts
7870
+ var DRACO_LOADER_DEFAULT_OPTIONS;
7871
+ var init_draco_loader_options = __esm({
7872
+ "../scene/src/draco/draco-loader-options.ts"() {
7873
+ "use strict";
7874
+ DRACO_LOADER_DEFAULT_OPTIONS = {
7875
+ backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
7876
+ extraAttributes: {},
7877
+ attributeNameEntry: void 0,
7878
+ shape: "arrow-table",
7879
+ decoderProfile: "full"
7880
+ };
7881
+ }
7882
+ });
7883
+
7884
+ // ../scene/src/draco/lib/draco-library-loader.ts
7885
+ async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
7886
+ var _a;
7887
+ if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
7888
+ const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
7889
+ options = {
7890
+ ...options,
7891
+ modules: {
7892
+ [libraryName]: `${directory}/${libraryName}`,
7893
+ ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
7894
+ ...options.modules
7940
7895
  }
7941
- case arrow.IntervalDayTime:
7942
- return "interval-daytime";
7943
- case arrow.IntervalYearMonth:
7944
- return "interval-yearmonth";
7945
- case arrow.Map_:
7946
- const mapType = arrowType;
7947
- return {
7948
- type: "map",
7949
- keysSorted: mapType.keysSorted,
7950
- children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
7951
- };
7952
- case arrow.List:
7953
- const listType = arrowType;
7954
- const listField = listType.valueField;
7955
- return {
7956
- type: "list",
7957
- children: [serializeArrowField(listField)]
7958
- };
7959
- case arrow.FixedSizeList:
7960
- const fixedSizeList = arrowType;
7961
- return {
7962
- type: "fixed-size-list",
7963
- listSize: fixedSizeList.listSize,
7964
- children: [serializeArrowField(fixedSizeList.children[0])]
7965
- };
7966
- case arrow.Struct:
7967
- const structType = arrowType;
7968
- return {
7969
- type: "struct",
7970
- children: structType.children.map((arrowField) => serializeArrowField(arrowField))
7971
- };
7972
- case arrow.SparseUnion:
7973
- case arrow.DenseUnion:
7974
- const unionType = arrowType;
7975
- return {
7976
- type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
7977
- typeIds: unionType.typeIds,
7978
- children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
7979
- typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
7980
- };
7981
- case arrow.Dictionary:
7982
- const dictionaryType = arrowType;
7983
- return {
7984
- type: "dictionary",
7985
- id: dictionaryType.id,
7986
- indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
7987
- dictionary: serializeArrowType(dictionaryType.dictionary),
7988
- isOrdered: dictionaryType.isOrdered
7989
- };
7990
- default:
7991
- throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
7896
+ };
7992
7897
  }
7898
+ return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
7993
7899
  }
7994
- function deserializeArrowType(dataType, options) {
7995
- if (typeof dataType === "object") {
7996
- switch (dataType.type) {
7997
- case "decimal":
7998
- return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
7999
- case "map": {
8000
- const children = dataType.children.map(
8001
- (arrowField) => deserializeArrowField(arrowField, options)
8002
- );
8003
- return new arrow.Map_(children[0], dataType.keysSorted);
8004
- }
8005
- case "list": {
8006
- const field = deserializeArrowField(dataType.children[0], options);
8007
- return new arrow.List(field);
8008
- }
8009
- case "large-list": {
8010
- const field = deserializeArrowField(dataType.children[0], options);
8011
- const LargeList = getOptionalArrowConstructor("LargeList");
8012
- if (!LargeList) {
8013
- throw new Error(
8014
- "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
8015
- );
8016
- }
8017
- return new LargeList(field);
8018
- }
8019
- case "fixed-size-list": {
8020
- const child = deserializeArrowField(dataType.children[0], options);
8021
- return new arrow.FixedSizeList(dataType.listSize, child);
8022
- }
8023
- case "fixed-size-binary":
8024
- return new arrow.FixedSizeBinary(dataType.byteWidth);
8025
- case "struct": {
8026
- const children = dataType.children.map(
8027
- (arrowField) => deserializeArrowField(arrowField, options)
8028
- );
8029
- return new arrow.Struct(children);
8030
- }
8031
- case "sparse-union":
8032
- case "dense-union": {
8033
- const children = dataType.children.map(
8034
- (arrowField) => deserializeArrowField(arrowField, options)
8035
- );
8036
- return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
8037
- }
8038
- case "dictionary": {
8039
- return new arrow.Dictionary(
8040
- deserializeArrowType(dataType.dictionary, options),
8041
- deserializeArrowDictionaryKeyType(dataType.indices),
8042
- dataType.id,
8043
- dataType.isOrdered
8044
- );
8045
- }
8046
- default:
8047
- throw new Error("array type not supported");
8048
- }
7900
+ var init_draco_library_loader = __esm({
7901
+ "../scene/src/draco/lib/draco-library-loader.ts"() {
7902
+ "use strict";
7903
+ init_worker_utils();
8049
7904
  }
8050
- switch (dataType) {
8051
- case "null":
8052
- return new arrow.Null();
8053
- case "binary":
8054
- return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
8055
- case "binary-view":
8056
- return makeRequiredArrowViewType("BinaryView");
8057
- case "bool":
8058
- return new arrow.Bool();
8059
- case "int8":
8060
- return new arrow.Int8();
8061
- case "int16":
8062
- return new arrow.Int16();
8063
- case "int32":
8064
- return new arrow.Int32();
8065
- case "int64":
8066
- return new arrow.Int64();
8067
- case "uint8":
8068
- return new arrow.Uint8();
8069
- case "uint16":
8070
- return new arrow.Uint16();
8071
- case "uint32":
8072
- return new arrow.Uint32();
8073
- case "uint64":
8074
- return new arrow.Uint64();
8075
- case "float16":
8076
- return new arrow.Float16();
8077
- case "float32":
8078
- return new arrow.Float32();
8079
- case "float64":
8080
- return new arrow.Float64();
8081
- case "utf8":
8082
- return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
8083
- case "utf8-view":
8084
- return makeRequiredArrowViewType("Utf8View");
8085
- case "date-day":
8086
- return new arrow.DateDay();
8087
- case "date-millisecond":
8088
- return new arrow.DateMillisecond();
8089
- case "time-second":
8090
- return new arrow.TimeSecond();
8091
- case "time-millisecond":
8092
- return new arrow.TimeMillisecond();
8093
- case "time-microsecond":
8094
- return new arrow.TimeMicrosecond();
8095
- case "time-nanosecond":
8096
- return new arrow.TimeNanosecond();
8097
- case "timestamp-second":
8098
- return new arrow.TimestampSecond();
8099
- case "timestamp-millisecond":
8100
- return new arrow.TimestampMillisecond();
8101
- case "timestamp-microsecond":
8102
- return new arrow.TimestampMicrosecond();
8103
- case "timestamp-nanosecond":
8104
- return new arrow.TimestampNanosecond();
8105
- case "interval-daytime":
8106
- return new arrow.IntervalDayTime();
8107
- case "interval-yearmonth":
8108
- return new arrow.IntervalYearMonth();
8109
- default:
8110
- throw new Error("array type not supported");
7905
+ });
7906
+
7907
+ // ../scene/src/draco/draco-libraries.ts
7908
+ var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
7909
+ var init_draco_libraries = __esm({
7910
+ "../scene/src/draco/draco-libraries.ts"() {
7911
+ "use strict";
7912
+ DRACO_VERSION = "1.5.7";
7913
+ DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
7914
+ STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
7915
+ STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
7916
+ DRACO_EXTERNAL_LIBRARIES = {
7917
+ /** WebAssembly decoder JavaScript wrapper. */
7918
+ DECODER: "draco_wasm_wrapper.js",
7919
+ /** WebAssembly decoder binary. */
7920
+ DECODER_WASM: "draco_decoder.wasm",
7921
+ /** glTF-profile WebAssembly decoder JavaScript wrapper. */
7922
+ GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
7923
+ /** glTF-profile WebAssembly decoder binary. */
7924
+ GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
7925
+ /** JavaScript decoder fallback. */
7926
+ FALLBACK_DECODER: "draco_decoder.js",
7927
+ /** WebAssembly encoder JavaScript wrapper. */
7928
+ ENCODER: "draco_encoder.js",
7929
+ /** WebAssembly encoder binary. */
7930
+ ENCODER_WASM: "draco_encoder.wasm"
7931
+ };
7932
+ DRACO_EXTERNAL_LIBRARY_URLS = {
7933
+ [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
7934
+ [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
7935
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
7936
+ [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
7937
+ [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
7938
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
7939
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
7940
+ };
8111
7941
  }
8112
- }
8113
- function getOptionalArrowConstructor(typeName) {
8114
- return arrow[typeName];
8115
- }
8116
- function isArrowViewType(arrowType, viewTypeName) {
8117
- const constructor = getOptionalArrowConstructor(viewTypeName);
8118
- if (constructor && arrowType instanceof constructor) {
8119
- return true;
7942
+ });
7943
+
7944
+ // ../scene/src/draco/lib/draco-module-loader.ts
7945
+ async function loadDracoDecoderModule(options = {}, type, profile = "full") {
7946
+ const draco3DModule = getInjectedDraco3DModule(options);
7947
+ if (draco3DModule) {
7948
+ return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
8120
7949
  }
8121
- const guards = arrow.DataType;
8122
- const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
8123
- return Boolean(guard == null ? void 0 : guard(arrowType));
8124
- }
8125
- function isOptionalArrowType(arrowType, typeName) {
8126
- const constructor = getOptionalArrowConstructor(typeName);
8127
- return Boolean(constructor && arrowType instanceof constructor);
7950
+ return await loadDracoDecoderModuleFromLibrary(
7951
+ options,
7952
+ type === "js" ? "javascript" : type,
7953
+ profile
7954
+ );
8128
7955
  }
8129
- function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
8130
- const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
8131
- if (viewTypeMode === "never") {
8132
- return fallbackType;
8133
- }
8134
- const constructor = getOptionalArrowConstructor(viewTypeName);
8135
- if (constructor) {
8136
- return new constructor();
8137
- }
8138
- if (viewTypeMode === "require") {
8139
- throw new Error(
8140
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
8141
- );
7956
+ async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
7957
+ const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
7958
+ let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
7959
+ if (!decoderPromise2) {
7960
+ decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
7961
+ libraryDecoderPromises.set(cacheKey, decoderPromise2);
8142
7962
  }
8143
- return fallbackType;
7963
+ return await decoderPromise2;
8144
7964
  }
8145
- function makeRequiredArrowViewType(viewTypeName) {
8146
- const constructor = getOptionalArrowConstructor(viewTypeName);
8147
- if (!constructor) {
8148
- throw new Error(
8149
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
7965
+ async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
7966
+ const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
7967
+ let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
7968
+ if (!decoderPromise2) {
7969
+ decoderPromise2 = initializeWasmModule(
7970
+ () => typedDraco3DModule.createDecoderModule({}),
7971
+ (draco) => ({ draco })
8150
7972
  );
7973
+ injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
8151
7974
  }
8152
- return new constructor();
7975
+ return await decoderPromise2;
8153
7976
  }
8154
- function serializeArrowDictionaryKeyType(arrowType) {
8155
- if (arrowType instanceof arrow.Int) {
8156
- const prefix = arrowType.isSigned ? "int" : "uint";
8157
- const keyType = `${prefix}${arrowType.bitWidth}`;
8158
- if (isSchemaDictionaryKeyType(keyType)) {
8159
- return keyType;
7977
+ async function loadDracoDecoderWithFallback(options, type, profile) {
7978
+ try {
7979
+ return await loadDracoDecoder(options, type, profile);
7980
+ } catch (wasmError) {
7981
+ if (type === "javascript") {
7982
+ throw wasmError;
7983
+ }
7984
+ try {
7985
+ return await loadDracoDecoder(options, "javascript", "full");
7986
+ } catch (javascriptError) {
7987
+ throw new AggregateError(
7988
+ [wasmError, javascriptError],
7989
+ "Draco decoder could not load either the WebAssembly or JavaScript backend"
7990
+ );
8160
7991
  }
8161
7992
  }
8162
- switch (arrowType.constructor) {
8163
- case arrow.Int8:
8164
- return "int8";
8165
- case arrow.Int16:
8166
- return "int16";
8167
- case arrow.Int32:
8168
- return "int32";
8169
- case arrow.Uint8:
8170
- return "uint8";
8171
- case arrow.Uint16:
8172
- return "uint16";
8173
- case arrow.Uint32:
8174
- return "uint32";
8175
- default:
8176
- throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
7993
+ }
7994
+ async function loadDracoDecoder(options, type, profile) {
7995
+ const initialization = decoderInitializationQueue.then(
7996
+ () => loadDracoDecoderInternal(options, type, profile)
7997
+ );
7998
+ decoderInitializationQueue = initialization.then(
7999
+ () => void 0,
8000
+ () => void 0
8001
+ );
8002
+ return await initialization;
8003
+ }
8004
+ async function loadDracoDecoderInternal(options, type, profile) {
8005
+ if (type === "javascript") {
8006
+ let decoderLibrary2;
8007
+ try {
8008
+ decoderLibrary2 = await loadLibrary2(
8009
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
8010
+ "scene",
8011
+ options,
8012
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
8013
+ "draco_decoder.mjs"
8014
+ );
8015
+ } catch (error) {
8016
+ if (isBrowser2 || options.useLocalLibraries) {
8017
+ throw error;
8018
+ }
8019
+ decoderLibrary2 = await loadLibrary2(
8020
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
8021
+ "scene",
8022
+ { ...options, useLocalLibraries: true },
8023
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
8024
+ "draco_decoder.mjs"
8025
+ );
8026
+ }
8027
+ const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
8028
+ return await initializeDracoModule(decoderInitializer2);
8029
+ }
8030
+ let decoderLibrary;
8031
+ let wasmBinary;
8032
+ try {
8033
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
8034
+ } catch (error) {
8035
+ if (isBrowser2 || options.useLocalLibraries) {
8036
+ throw error;
8037
+ }
8038
+ [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
8039
+ { ...options, useLocalLibraries: true },
8040
+ profile
8041
+ );
8177
8042
  }
8043
+ const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
8044
+ return await initializeDracoModule(decoderInitializer, wasmBinary);
8178
8045
  }
8179
- function isSchemaDictionaryKeyType(keyType) {
8180
- return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
8046
+ async function loadDecoderWasmAssets(options, profile) {
8047
+ const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
8048
+ const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
8049
+ return await Promise.all([
8050
+ loadLibrary2(
8051
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
8052
+ "scene",
8053
+ options,
8054
+ decoderLibrary,
8055
+ profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
8056
+ ),
8057
+ loadLibrary2(
8058
+ DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
8059
+ "scene",
8060
+ options,
8061
+ decoderWasm
8062
+ )
8063
+ ]);
8181
8064
  }
8182
- function deserializeArrowDictionaryKeyType(keyType) {
8183
- switch (keyType) {
8184
- case "int8":
8185
- return new arrow.Int8();
8186
- case "int16":
8187
- return new arrow.Int16();
8188
- case "int32":
8189
- return new arrow.Int32();
8190
- case "uint8":
8191
- return new arrow.Uint8();
8192
- case "uint16":
8193
- return new arrow.Uint16();
8194
- case "uint32":
8195
- return new arrow.Uint32();
8196
- default:
8197
- throw new Error(`schema dictionary index type not supported: ${keyType}`);
8065
+ function initializeDracoModule(initializer, wasmBinary) {
8066
+ if (typeof initializer !== "function") {
8067
+ throw new Error("Draco module initializer could not be loaded");
8068
+ }
8069
+ return initializeWasmModule(
8070
+ (onInitialized) => initializer({
8071
+ ...wasmBinary ? { wasmBinary } : {},
8072
+ onModuleLoaded: onInitialized
8073
+ }),
8074
+ (draco) => ({ draco })
8075
+ );
8076
+ }
8077
+ function getLibraryExport(library, exportName) {
8078
+ if (typeof library === "function") {
8079
+ return library;
8080
+ }
8081
+ if (library && typeof library === "object") {
8082
+ const exports = library;
8083
+ const exportedInitializer = exports[exportName] || exports.default;
8084
+ return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
8198
8085
  }
8086
+ return void 0;
8199
8087
  }
8200
- var arrow;
8201
- var init_convert_arrow_schema = __esm({
8202
- "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
8088
+ function getInjectedDraco3DModule(options) {
8089
+ var _a;
8090
+ const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
8091
+ if (!module2) {
8092
+ return void 0;
8093
+ }
8094
+ if (typeof module2 !== "object" && typeof module2 !== "function") {
8095
+ throw new Error("Invalid draco3d module");
8096
+ }
8097
+ return module2;
8098
+ }
8099
+ function validateDracoDecoderModule(module2) {
8100
+ const typedModule = module2;
8101
+ if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
8102
+ throw new Error("Invalid draco3d decoder module");
8103
+ }
8104
+ return typedModule;
8105
+ }
8106
+ function getLibraryCacheKey2(type, options) {
8107
+ const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
8108
+ return [
8109
+ type,
8110
+ options.useLocalLibraries ? "local" : "remote",
8111
+ options.CDN || "",
8112
+ libraryOverrides
8113
+ ].join("|");
8114
+ }
8115
+ var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
8116
+ var init_draco_module_loader = __esm({
8117
+ "../scene/src/draco/lib/draco-module-loader.ts"() {
8203
8118
  "use strict";
8204
- arrow = __toESM(require("apache-arrow"), 1);
8119
+ init_loader_utils();
8120
+ init_draco_library_loader();
8121
+ init_draco_libraries();
8122
+ libraryDecoderPromises = /* @__PURE__ */ new Map();
8123
+ injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
8124
+ decoderInitializationQueue = Promise.resolve();
8205
8125
  }
8206
8126
  });
8207
8127
 
8208
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
8209
- function splitArrowBuffers(input, options = {}) {
8210
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
8211
- if (isArrowTable(input)) {
8212
- return splitArrowTableBuffersInternal(input, context);
8128
+ // ../core/src/schema-utils/lib/schema/data-type.ts
8129
+ function getDataTypeFromValue(value, defaultNumberType = "float32") {
8130
+ if (value instanceof Date) {
8131
+ return "date-millisecond";
8213
8132
  }
8214
- if (isArrowRecordBatch(input)) {
8215
- return splitArrowRecordBatchBuffers(input, context);
8133
+ if (typeof value === "number") {
8134
+ return defaultNumberType;
8216
8135
  }
8217
- if (isArrowVector(input)) {
8218
- return splitArrowVectorBuffers(input, context);
8136
+ if (typeof value === "boolean") {
8137
+ return "bool";
8219
8138
  }
8220
- return splitArrowDataBuffers(input, context);
8221
- }
8222
- function isArrowTable(input) {
8223
- return "batches" in input;
8224
- }
8225
- function isArrowRecordBatch(input) {
8226
- return "schema" in input && "data" in input && !Array.isArray(input.data);
8227
- }
8228
- function isArrowVector(input) {
8229
- return "data" in input && Array.isArray(input.data);
8230
- }
8231
- function splitArrowTableBuffersInternal(table, options) {
8232
- const recordBatches = table.batches.map(
8233
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
8234
- );
8235
- return new arrow2.Table(table.schema, recordBatches);
8236
- }
8237
- function splitArrowRecordBatchBuffers(recordBatch, options) {
8238
- return new arrow2.RecordBatch(
8239
- recordBatch.schema,
8240
- splitArrowDataBuffers(recordBatch.data, options)
8241
- );
8242
- }
8243
- function splitArrowDataBuffers(data, options) {
8244
- const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
8245
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
8246
- const buffers = {
8247
- [arrow2.BufferType.OFFSET]: splitArrowBuffer(data.buffers[arrow2.BufferType.OFFSET], options),
8248
- [arrow2.BufferType.DATA]: splitArrowBuffer(data.buffers[arrow2.BufferType.DATA], options),
8249
- [arrow2.BufferType.VALIDITY]: splitArrowBuffer(data.buffers[arrow2.BufferType.VALIDITY], options),
8250
- [arrow2.BufferType.TYPE]: splitArrowBuffer(data.buffers[arrow2.BufferType.TYPE], options)
8251
- };
8252
- return new arrow2.Data(
8253
- data.type,
8254
- data.offset,
8255
- data.length,
8256
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
8257
- data._nullCount,
8258
- buffers,
8259
- children,
8260
- dictionary
8261
- );
8262
- }
8263
- function splitArrowVectorBuffers(vector, options) {
8264
- return new arrow2.Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
8265
- }
8266
- function splitArrowBuffer(array, options) {
8267
- if (!isArrowTypedArray(array)) {
8268
- return array;
8139
+ if (typeof value === "string") {
8140
+ return "utf8";
8269
8141
  }
8270
- if (options.copy === "none") {
8271
- return array;
8142
+ if (value === null || value === "undefined") {
8143
+ return "null";
8272
8144
  }
8273
- if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
8274
- return array;
8145
+ return "null";
8146
+ }
8147
+ function getDataTypeFromArray(array) {
8148
+ let type = getDataTypeFromTypedArray(array);
8149
+ if (type !== "null") {
8150
+ return { type, nullable: false };
8275
8151
  }
8276
- let copy = options.copies.get(array);
8277
- if (!copy) {
8278
- copy = array.slice();
8279
- options.copies.set(array, copy);
8152
+ if (array.length > 0) {
8153
+ type = getDataTypeFromValue(array[0]);
8154
+ return { type, nullable: true };
8280
8155
  }
8281
- return copy;
8156
+ return { type: "null", nullable: true };
8282
8157
  }
8283
- function isArrowTypedArray(value) {
8284
- return ArrayBuffer.isView(value) && !(value instanceof DataView);
8158
+ function getDataTypeFromTypedArray(array) {
8159
+ if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
8160
+ return "float16";
8161
+ }
8162
+ switch (array.constructor) {
8163
+ case Int8Array:
8164
+ return "int8";
8165
+ case Uint8Array:
8166
+ case Uint8ClampedArray:
8167
+ return "uint8";
8168
+ case Int16Array:
8169
+ return "int16";
8170
+ case Uint16Array:
8171
+ return "uint16";
8172
+ case Int32Array:
8173
+ return "int32";
8174
+ case Uint32Array:
8175
+ return "uint32";
8176
+ case BigInt64Array:
8177
+ return "int64";
8178
+ case BigUint64Array:
8179
+ return "uint64";
8180
+ case Float32Array:
8181
+ return "float32";
8182
+ case Float64Array:
8183
+ return "float64";
8184
+ default:
8185
+ return "null";
8186
+ }
8285
8187
  }
8286
- var arrow2;
8287
- var init_split_arrow_buffers = __esm({
8288
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
8188
+ var import_core;
8189
+ var init_data_type = __esm({
8190
+ "../core/src/schema-utils/lib/schema/data-type.ts"() {
8289
8191
  "use strict";
8290
- arrow2 = __toESM(require("apache-arrow"), 1);
8192
+ import_core = require("@math.gl/core");
8291
8193
  }
8292
8194
  });
8293
8195
 
8294
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
8295
- function dehydrateArrowTable(table, options) {
8296
- const splitTable = splitArrowBuffers(table, options);
8196
+ // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
8197
+ function serializeArrowSchema(arrowSchema) {
8297
8198
  return {
8298
- shape: "arrow-table",
8299
- transport: "arrow-js",
8300
- schema: serializeArrowSchema(splitTable.schema),
8301
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
8199
+ fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
8200
+ metadata: serializeArrowMetadata(arrowSchema.metadata)
8302
8201
  };
8303
8202
  }
8304
- function hydrateArrowTable(table) {
8305
- const schema = deserializeArrowSchema(table.schema);
8306
- const recordBatches = table.batches.map(
8307
- (recordBatch) => new arrow3.RecordBatch(schema, hydrateArrowData(recordBatch.data))
8308
- );
8309
- return new arrow3.Table(schema, recordBatches);
8310
- }
8311
- function serializeArrowWorkerResult(result, options) {
8312
- var _a;
8313
- if (!isArrowTableWrapper(result)) {
8314
- return result;
8315
- }
8316
- const workerOptions = options;
8317
- const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
8318
- return {
8319
- ...result,
8320
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
8321
- };
8322
- }
8323
- function deserializeArrowWorkerResult(result) {
8324
- if (!isDehydratedArrowTableWrapper(result)) {
8325
- return result;
8326
- }
8327
- return { ...result, data: hydrateArrowTable(result.data) };
8328
- }
8329
- function isArrowTableWrapper(value) {
8330
- const table = value;
8331
- return Boolean(
8332
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
8333
- );
8334
- }
8335
- function isDehydratedArrowTableWrapper(value) {
8336
- const table = value;
8337
- return Boolean(
8338
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
8339
- );
8203
+ function serializeArrowMetadata(arrowMetadata) {
8204
+ return Object.fromEntries(arrowMetadata);
8340
8205
  }
8341
- function dehydrateArrowRecordBatch(recordBatch) {
8342
- return { data: dehydrateArrowData(recordBatch.data) };
8206
+ function deserializeArrowMetadata(metadata) {
8207
+ return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
8343
8208
  }
8344
- function dehydrateArrowData(data) {
8209
+ function serializeArrowField(field) {
8345
8210
  return {
8346
- type: serializeArrowType(data.type),
8347
- offset: data.offset,
8348
- length: data.length,
8349
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
8350
- nullCount: data._nullCount,
8351
- buffers: {
8352
- [arrow3.BufferType.OFFSET]: data.buffers[arrow3.BufferType.OFFSET],
8353
- [arrow3.BufferType.DATA]: data.buffers[arrow3.BufferType.DATA],
8354
- [arrow3.BufferType.VALIDITY]: data.buffers[arrow3.BufferType.VALIDITY],
8355
- [arrow3.BufferType.TYPE]: data.buffers[arrow3.BufferType.TYPE]
8356
- },
8357
- children: data.children.map((childData) => dehydrateArrowData(childData)),
8358
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
8211
+ name: field.name,
8212
+ type: serializeArrowType(field.type),
8213
+ nullable: field.nullable,
8214
+ metadata: serializeArrowMetadata(field.metadata)
8359
8215
  };
8360
8216
  }
8361
- function dehydrateArrowVector(vector) {
8362
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
8363
- }
8364
- function hydrateArrowData(data) {
8365
- const children = data.children.map((childData) => hydrateArrowData(childData));
8366
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
8367
- return new arrow3.Data(
8368
- deserializeArrowType(data.type),
8369
- data.offset,
8370
- data.length,
8371
- data.nullCount,
8372
- data.buffers,
8373
- children,
8374
- dictionary
8217
+ function deserializeArrowField(field, options) {
8218
+ return new arrow.Field(
8219
+ field.name,
8220
+ deserializeArrowType(field.type, options),
8221
+ field.nullable,
8222
+ deserializeArrowMetadata(field.metadata)
8375
8223
  );
8376
8224
  }
8377
- function hydrateArrowVector(vector) {
8378
- return new arrow3.Vector(vector.data.map((data) => hydrateArrowData(data)));
8379
- }
8380
- var arrow3;
8381
- var init_arrow_table_transport = __esm({
8382
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
8383
- "use strict";
8384
- arrow3 = __toESM(require("apache-arrow"), 1);
8385
- init_convert_arrow_schema();
8386
- init_split_arrow_buffers();
8387
- }
8388
- });
8389
-
8390
- // ../core/src/schema-utils/arrow-transport.ts
8391
- var init_arrow_transport = __esm({
8392
- "../core/src/schema-utils/arrow-transport.ts"() {
8393
- "use strict";
8394
- init_arrow_table_transport();
8395
- init_split_arrow_buffers();
8396
- }
8397
- });
8398
-
8399
- // ../scene/src/draco/lib/utils/version.ts
8400
- var VERSION4;
8401
- var init_version4 = __esm({
8402
- "../scene/src/draco/lib/utils/version.ts"() {
8403
- "use strict";
8404
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8225
+ function serializeArrowType(arrowType) {
8226
+ if (isArrowViewType(arrowType, "BinaryView")) {
8227
+ return "binary-view";
8405
8228
  }
8406
- });
8407
-
8408
- // ../scene/src/draco/draco-format.ts
8409
- var DracoFormat;
8410
- var init_draco_format = __esm({
8411
- "../scene/src/draco/draco-format.ts"() {
8412
- "use strict";
8413
- DracoFormat = {
8414
- name: "Draco",
8415
- id: "draco",
8416
- module: "scene",
8417
- encoding: "binary",
8418
- format: "draco",
8419
- extensions: ["drc"],
8420
- mimeTypes: ["application/octet-stream"],
8421
- binary: true,
8422
- tests: ["DRACO"]
8423
- };
8229
+ if (isArrowViewType(arrowType, "Utf8View")) {
8230
+ return "utf8-view";
8424
8231
  }
8425
- });
8426
-
8427
- // ../scene/src/draco/draco-loader-options.ts
8428
- var DRACO_LOADER_DEFAULT_OPTIONS;
8429
- var init_draco_loader_options = __esm({
8430
- "../scene/src/draco/draco-loader-options.ts"() {
8431
- "use strict";
8432
- DRACO_LOADER_DEFAULT_OPTIONS = {
8433
- backend: typeof WebAssembly === "object" ? "wasm" : "javascript",
8434
- extraAttributes: {},
8435
- attributeNameEntry: void 0,
8436
- shape: "arrow-table",
8437
- decoderProfile: "full"
8232
+ if (isOptionalArrowType(arrowType, "LargeList")) {
8233
+ const largeListType = arrowType;
8234
+ return {
8235
+ type: "large-list",
8236
+ children: [serializeArrowField(largeListType.valueField)]
8438
8237
  };
8439
8238
  }
8440
- });
8441
-
8442
- // ../scene/src/draco/lib/draco-library-loader.ts
8443
- async function loadLibrary2(libraryUrl, moduleName = null, options = {}, libraryName = null, moduleLibraryName = null) {
8444
- var _a;
8445
- if (isBrowser2 && options.useLocalLibraries && !options.CDN && libraryName && ((_a = options.modules) == null ? void 0 : _a[libraryName]) === void 0) {
8446
- const directory = isWorker ? "./libs" : `modules/${moduleName}/dist/libs`;
8447
- options = {
8448
- ...options,
8449
- modules: {
8450
- [libraryName]: `${directory}/${libraryName}`,
8451
- ...moduleLibraryName ? { [moduleLibraryName]: `${directory}/${moduleLibraryName}` } : {},
8452
- ...options.modules
8239
+ switch (arrowType.constructor) {
8240
+ case arrow.Null:
8241
+ return "null";
8242
+ case arrow.Binary:
8243
+ return "binary";
8244
+ case arrow.FixedSizeBinary:
8245
+ return {
8246
+ type: "fixed-size-binary",
8247
+ byteWidth: arrowType.byteWidth
8248
+ };
8249
+ case arrow.Bool:
8250
+ return "bool";
8251
+ case arrow.Int:
8252
+ const intType = arrowType;
8253
+ return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
8254
+ case arrow.Int8:
8255
+ return "int8";
8256
+ case arrow.Int16:
8257
+ return "int16";
8258
+ case arrow.Int32:
8259
+ return "int32";
8260
+ case arrow.Int64:
8261
+ return "int64";
8262
+ case arrow.Uint8:
8263
+ return "uint8";
8264
+ case arrow.Uint16:
8265
+ return "uint16";
8266
+ case arrow.Uint32:
8267
+ return "uint32";
8268
+ case arrow.Uint64:
8269
+ return "uint64";
8270
+ case arrow.Float:
8271
+ const precision = arrowType.precision;
8272
+ switch (precision) {
8273
+ case arrow.Precision.HALF:
8274
+ return "float16";
8275
+ case arrow.Precision.SINGLE:
8276
+ return "float32";
8277
+ case arrow.Precision.DOUBLE:
8278
+ return "float64";
8279
+ default:
8280
+ return "float16";
8453
8281
  }
8454
- };
8455
- }
8456
- return await loadLibrary(libraryUrl, moduleName, options, libraryName, moduleLibraryName);
8457
- }
8458
- var init_draco_library_loader = __esm({
8459
- "../scene/src/draco/lib/draco-library-loader.ts"() {
8460
- "use strict";
8461
- init_worker_utils();
8462
- }
8463
- });
8464
-
8465
- // ../scene/src/draco/draco-libraries.ts
8466
- var DRACO_VERSION, DRACO_RELEASE_COMMIT, STATIC_DECODER_URL, STATIC_ENCODER_URL, DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS;
8467
- var init_draco_libraries = __esm({
8468
- "../scene/src/draco/draco-libraries.ts"() {
8469
- "use strict";
8470
- DRACO_VERSION = "1.5.7";
8471
- DRACO_RELEASE_COMMIT = "8786740086a9f4d83f44aa83badfbea4dce7a1b5";
8472
- STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}`;
8473
- STATIC_ENCODER_URL = `https://cdn.jsdelivr.net/gh/google/draco@${DRACO_RELEASE_COMMIT}/javascript`;
8474
- DRACO_EXTERNAL_LIBRARIES = {
8475
- /** WebAssembly decoder JavaScript wrapper. */
8476
- DECODER: "draco_wasm_wrapper.js",
8477
- /** WebAssembly decoder binary. */
8478
- DECODER_WASM: "draco_decoder.wasm",
8479
- /** glTF-profile WebAssembly decoder JavaScript wrapper. */
8480
- GLTF_DECODER: "draco_wasm_wrapper_gltf.js",
8481
- /** glTF-profile WebAssembly decoder binary. */
8482
- GLTF_DECODER_WASM: "draco_decoder_gltf.wasm",
8483
- /** JavaScript decoder fallback. */
8484
- FALLBACK_DECODER: "draco_decoder.js",
8485
- /** WebAssembly encoder JavaScript wrapper. */
8486
- ENCODER: "draco_encoder.js",
8487
- /** WebAssembly encoder binary. */
8488
- ENCODER_WASM: "draco_encoder.wasm"
8489
- };
8490
- DRACO_EXTERNAL_LIBRARY_URLS = {
8491
- [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
8492
- [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
8493
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER}`,
8494
- [DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM}`,
8495
- [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
8496
- [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`,
8497
- [DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM]: `${STATIC_ENCODER_URL}/${DRACO_EXTERNAL_LIBRARIES.ENCODER_WASM}`
8498
- };
8499
- }
8500
- });
8501
-
8502
- // ../scene/src/draco/lib/draco-module-loader.ts
8503
- async function loadDracoDecoderModule(options = {}, type, profile = "full") {
8504
- const draco3DModule = getInjectedDraco3DModule(options);
8505
- if (draco3DModule) {
8506
- return await loadDracoDecoderModuleFromDraco3D(draco3DModule);
8507
- }
8508
- return await loadDracoDecoderModuleFromLibrary(
8509
- options,
8510
- type === "js" ? "javascript" : type,
8511
- profile
8512
- );
8513
- }
8514
- async function loadDracoDecoderModuleFromLibrary(options = {}, type, profile = "full") {
8515
- const cacheKey = getLibraryCacheKey2(`${type}:${profile}`, options);
8516
- let decoderPromise2 = libraryDecoderPromises.get(cacheKey);
8517
- if (!decoderPromise2) {
8518
- decoderPromise2 = loadDracoDecoderWithFallback(options, type, profile);
8519
- libraryDecoderPromises.set(cacheKey, decoderPromise2);
8520
- }
8521
- return await decoderPromise2;
8522
- }
8523
- async function loadDracoDecoderModuleFromDraco3D(draco3DModule) {
8524
- const typedDraco3DModule = validateDracoDecoderModule(draco3DModule);
8525
- let decoderPromise2 = injectedDecoderPromises.get(typedDraco3DModule);
8526
- if (!decoderPromise2) {
8527
- decoderPromise2 = initializeWasmModule(
8528
- () => typedDraco3DModule.createDecoderModule({}),
8529
- (draco) => ({ draco })
8530
- );
8531
- injectedDecoderPromises.set(typedDraco3DModule, decoderPromise2);
8532
- }
8533
- return await decoderPromise2;
8534
- }
8535
- async function loadDracoDecoderWithFallback(options, type, profile) {
8536
- try {
8537
- return await loadDracoDecoder(options, type, profile);
8538
- } catch (wasmError) {
8539
- if (type === "javascript") {
8540
- throw wasmError;
8541
- }
8542
- try {
8543
- return await loadDracoDecoder(options, "javascript", "full");
8544
- } catch (javascriptError) {
8545
- throw new AggregateError(
8546
- [wasmError, javascriptError],
8547
- "Draco decoder could not load either the WebAssembly or JavaScript backend"
8548
- );
8549
- }
8550
- }
8551
- }
8552
- async function loadDracoDecoder(options, type, profile) {
8553
- const initialization = decoderInitializationQueue.then(
8554
- () => loadDracoDecoderInternal(options, type, profile)
8555
- );
8556
- decoderInitializationQueue = initialization.then(
8557
- () => void 0,
8558
- () => void 0
8559
- );
8560
- return await initialization;
8561
- }
8562
- async function loadDracoDecoderInternal(options, type, profile) {
8563
- if (type === "javascript") {
8564
- let decoderLibrary2;
8565
- try {
8566
- decoderLibrary2 = await loadLibrary2(
8567
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
8568
- "scene",
8569
- options,
8570
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
8571
- "draco_decoder.mjs"
8572
- );
8573
- } catch (error) {
8574
- if (isBrowser2 || options.useLocalLibraries) {
8575
- throw error;
8282
+ case arrow.Float16:
8283
+ return "float16";
8284
+ case arrow.Float32:
8285
+ return "float32";
8286
+ case arrow.Float64:
8287
+ return "float64";
8288
+ case arrow.Utf8:
8289
+ return "utf8";
8290
+ case arrow.Decimal:
8291
+ const decimal = arrowType;
8292
+ return {
8293
+ type: "decimal",
8294
+ bitWidth: decimal.bitWidth,
8295
+ precision: decimal.precision,
8296
+ scale: decimal.scale
8297
+ };
8298
+ case arrow.Date_:
8299
+ const dateUnit = arrowType.unit;
8300
+ return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
8301
+ case arrow.DateDay:
8302
+ return "date-day";
8303
+ case arrow.DateMillisecond:
8304
+ return "date-millisecond";
8305
+ case arrow.Time:
8306
+ const timeUnit = arrowType.unit;
8307
+ switch (timeUnit) {
8308
+ case arrow.TimeUnit.SECOND:
8309
+ return "time-second";
8310
+ case arrow.TimeUnit.MILLISECOND:
8311
+ return "time-millisecond";
8312
+ case arrow.TimeUnit.MICROSECOND:
8313
+ return "time-microsecond";
8314
+ case arrow.TimeUnit.NANOSECOND:
8315
+ return "time-nanosecond";
8316
+ default:
8317
+ return "time-second";
8576
8318
  }
8577
- decoderLibrary2 = await loadLibrary2(
8578
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
8579
- "scene",
8580
- { ...options, useLocalLibraries: true },
8581
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,
8582
- "draco_decoder.mjs"
8583
- );
8584
- }
8585
- const decoderInitializer2 = getLibraryExport(decoderLibrary2, "DracoDecoderModule") || globalThis.DracoDecoderModule;
8586
- return await initializeDracoModule(decoderInitializer2);
8587
- }
8588
- let decoderLibrary;
8589
- let wasmBinary;
8590
- try {
8591
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(options, profile);
8592
- } catch (error) {
8593
- if (isBrowser2 || options.useLocalLibraries) {
8594
- throw error;
8595
- }
8596
- [decoderLibrary, wasmBinary] = await loadDecoderWasmAssets(
8597
- { ...options, useLocalLibraries: true },
8598
- profile
8599
- );
8600
- }
8601
- const decoderInitializer = getLibraryExport(decoderLibrary, "DracoDecoderModule") || globalThis.DracoDecoderModule;
8602
- return await initializeDracoModule(decoderInitializer, wasmBinary);
8603
- }
8604
- async function loadDecoderWasmAssets(options, profile) {
8605
- const decoderLibrary = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER : DRACO_EXTERNAL_LIBRARIES.DECODER;
8606
- const decoderWasm = profile === "gltf" ? DRACO_EXTERNAL_LIBRARIES.GLTF_DECODER_WASM : DRACO_EXTERNAL_LIBRARIES.DECODER_WASM;
8607
- return await Promise.all([
8608
- loadLibrary2(
8609
- DRACO_EXTERNAL_LIBRARY_URLS[decoderLibrary],
8610
- "scene",
8611
- options,
8612
- decoderLibrary,
8613
- profile === "gltf" ? "draco_wasm_wrapper_gltf.mjs" : "draco_wasm_wrapper.mjs"
8614
- ),
8615
- loadLibrary2(
8616
- DRACO_EXTERNAL_LIBRARY_URLS[decoderWasm],
8617
- "scene",
8618
- options,
8619
- decoderWasm
8620
- )
8621
- ]);
8622
- }
8623
- function initializeDracoModule(initializer, wasmBinary) {
8624
- if (typeof initializer !== "function") {
8625
- throw new Error("Draco module initializer could not be loaded");
8319
+ case arrow.TimeMillisecond:
8320
+ return "time-millisecond";
8321
+ case arrow.TimeSecond:
8322
+ return "time-second";
8323
+ case arrow.TimeMicrosecond:
8324
+ return "time-microsecond";
8325
+ case arrow.TimeNanosecond:
8326
+ return "time-nanosecond";
8327
+ case arrow.Timestamp:
8328
+ const timeStampUnit = arrowType.unit;
8329
+ switch (timeStampUnit) {
8330
+ case arrow.TimeUnit.SECOND:
8331
+ return "timestamp-second";
8332
+ case arrow.TimeUnit.MILLISECOND:
8333
+ return "timestamp-millisecond";
8334
+ case arrow.TimeUnit.MICROSECOND:
8335
+ return "timestamp-microsecond";
8336
+ case arrow.TimeUnit.NANOSECOND:
8337
+ return "timestamp-nanosecond";
8338
+ default:
8339
+ return "timestamp-second";
8340
+ }
8341
+ case arrow.TimestampSecond:
8342
+ return "timestamp-second";
8343
+ case arrow.TimestampMillisecond:
8344
+ return "timestamp-millisecond";
8345
+ case arrow.TimestampMicrosecond:
8346
+ return "timestamp-microsecond";
8347
+ case arrow.TimestampNanosecond:
8348
+ return "timestamp-nanosecond";
8349
+ case arrow.Interval:
8350
+ const intervalUnit = arrowType.unit;
8351
+ switch (intervalUnit) {
8352
+ case arrow.IntervalUnit.DAY_TIME:
8353
+ return "interval-daytime";
8354
+ case arrow.IntervalUnit.YEAR_MONTH:
8355
+ return "interval-yearmonth";
8356
+ default:
8357
+ return "interval-daytime";
8358
+ }
8359
+ case arrow.IntervalDayTime:
8360
+ return "interval-daytime";
8361
+ case arrow.IntervalYearMonth:
8362
+ return "interval-yearmonth";
8363
+ case arrow.Map_:
8364
+ const mapType = arrowType;
8365
+ return {
8366
+ type: "map",
8367
+ keysSorted: mapType.keysSorted,
8368
+ children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
8369
+ };
8370
+ case arrow.List:
8371
+ const listType = arrowType;
8372
+ const listField = listType.valueField;
8373
+ return {
8374
+ type: "list",
8375
+ children: [serializeArrowField(listField)]
8376
+ };
8377
+ case arrow.FixedSizeList:
8378
+ const fixedSizeList = arrowType;
8379
+ return {
8380
+ type: "fixed-size-list",
8381
+ listSize: fixedSizeList.listSize,
8382
+ children: [serializeArrowField(fixedSizeList.children[0])]
8383
+ };
8384
+ case arrow.Struct:
8385
+ const structType = arrowType;
8386
+ return {
8387
+ type: "struct",
8388
+ children: structType.children.map((arrowField) => serializeArrowField(arrowField))
8389
+ };
8390
+ case arrow.SparseUnion:
8391
+ case arrow.DenseUnion:
8392
+ const unionType = arrowType;
8393
+ return {
8394
+ type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
8395
+ typeIds: unionType.typeIds,
8396
+ children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
8397
+ typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
8398
+ };
8399
+ case arrow.Dictionary:
8400
+ const dictionaryType = arrowType;
8401
+ return {
8402
+ type: "dictionary",
8403
+ id: dictionaryType.id,
8404
+ indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
8405
+ dictionary: serializeArrowType(dictionaryType.dictionary),
8406
+ isOrdered: dictionaryType.isOrdered
8407
+ };
8408
+ default:
8409
+ throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
8626
8410
  }
8627
- return initializeWasmModule(
8628
- (onInitialized) => initializer({
8629
- ...wasmBinary ? { wasmBinary } : {},
8630
- onModuleLoaded: onInitialized
8631
- }),
8632
- (draco) => ({ draco })
8633
- );
8634
8411
  }
8635
- function getLibraryExport(library, exportName) {
8636
- if (typeof library === "function") {
8637
- return library;
8412
+ function deserializeArrowType(dataType, options) {
8413
+ if (typeof dataType === "object") {
8414
+ switch (dataType.type) {
8415
+ case "decimal":
8416
+ return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
8417
+ case "map": {
8418
+ const children = dataType.children.map(
8419
+ (arrowField) => deserializeArrowField(arrowField, options)
8420
+ );
8421
+ return new arrow.Map_(children[0], dataType.keysSorted);
8422
+ }
8423
+ case "list": {
8424
+ const field = deserializeArrowField(dataType.children[0], options);
8425
+ return new arrow.List(field);
8426
+ }
8427
+ case "large-list": {
8428
+ const field = deserializeArrowField(dataType.children[0], options);
8429
+ const LargeList = getOptionalArrowConstructor("LargeList");
8430
+ if (!LargeList) {
8431
+ throw new Error(
8432
+ "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
8433
+ );
8434
+ }
8435
+ return new LargeList(field);
8436
+ }
8437
+ case "fixed-size-list": {
8438
+ const child = deserializeArrowField(dataType.children[0], options);
8439
+ return new arrow.FixedSizeList(dataType.listSize, child);
8440
+ }
8441
+ case "fixed-size-binary":
8442
+ return new arrow.FixedSizeBinary(dataType.byteWidth);
8443
+ case "struct": {
8444
+ const children = dataType.children.map(
8445
+ (arrowField) => deserializeArrowField(arrowField, options)
8446
+ );
8447
+ return new arrow.Struct(children);
8448
+ }
8449
+ case "sparse-union":
8450
+ case "dense-union": {
8451
+ const children = dataType.children.map(
8452
+ (arrowField) => deserializeArrowField(arrowField, options)
8453
+ );
8454
+ return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
8455
+ }
8456
+ case "dictionary": {
8457
+ return new arrow.Dictionary(
8458
+ deserializeArrowType(dataType.dictionary, options),
8459
+ deserializeArrowDictionaryKeyType(dataType.indices),
8460
+ dataType.id,
8461
+ dataType.isOrdered
8462
+ );
8463
+ }
8464
+ default:
8465
+ throw new Error("array type not supported");
8466
+ }
8638
8467
  }
8639
- if (library && typeof library === "object") {
8640
- const exports = library;
8641
- const exportedInitializer = exports[exportName] || exports.default;
8642
- return typeof exportedInitializer === "function" ? exportedInitializer : void 0;
8468
+ switch (dataType) {
8469
+ case "null":
8470
+ return new arrow.Null();
8471
+ case "binary":
8472
+ return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
8473
+ case "binary-view":
8474
+ return makeRequiredArrowViewType("BinaryView");
8475
+ case "bool":
8476
+ return new arrow.Bool();
8477
+ case "int8":
8478
+ return new arrow.Int8();
8479
+ case "int16":
8480
+ return new arrow.Int16();
8481
+ case "int32":
8482
+ return new arrow.Int32();
8483
+ case "int64":
8484
+ return new arrow.Int64();
8485
+ case "uint8":
8486
+ return new arrow.Uint8();
8487
+ case "uint16":
8488
+ return new arrow.Uint16();
8489
+ case "uint32":
8490
+ return new arrow.Uint32();
8491
+ case "uint64":
8492
+ return new arrow.Uint64();
8493
+ case "float16":
8494
+ return new arrow.Float16();
8495
+ case "float32":
8496
+ return new arrow.Float32();
8497
+ case "float64":
8498
+ return new arrow.Float64();
8499
+ case "utf8":
8500
+ return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
8501
+ case "utf8-view":
8502
+ return makeRequiredArrowViewType("Utf8View");
8503
+ case "date-day":
8504
+ return new arrow.DateDay();
8505
+ case "date-millisecond":
8506
+ return new arrow.DateMillisecond();
8507
+ case "time-second":
8508
+ return new arrow.TimeSecond();
8509
+ case "time-millisecond":
8510
+ return new arrow.TimeMillisecond();
8511
+ case "time-microsecond":
8512
+ return new arrow.TimeMicrosecond();
8513
+ case "time-nanosecond":
8514
+ return new arrow.TimeNanosecond();
8515
+ case "timestamp-second":
8516
+ return new arrow.TimestampSecond();
8517
+ case "timestamp-millisecond":
8518
+ return new arrow.TimestampMillisecond();
8519
+ case "timestamp-microsecond":
8520
+ return new arrow.TimestampMicrosecond();
8521
+ case "timestamp-nanosecond":
8522
+ return new arrow.TimestampNanosecond();
8523
+ case "interval-daytime":
8524
+ return new arrow.IntervalDayTime();
8525
+ case "interval-yearmonth":
8526
+ return new arrow.IntervalYearMonth();
8527
+ default:
8528
+ throw new Error("array type not supported");
8643
8529
  }
8644
- return void 0;
8645
8530
  }
8646
- function getInjectedDraco3DModule(options) {
8647
- var _a;
8648
- const module2 = (_a = options.modules) == null ? void 0 : _a.draco3d;
8649
- if (!module2) {
8650
- return void 0;
8651
- }
8652
- if (typeof module2 !== "object" && typeof module2 !== "function") {
8653
- throw new Error("Invalid draco3d module");
8654
- }
8655
- return module2;
8531
+ function getOptionalArrowConstructor(typeName) {
8532
+ return arrow[typeName];
8656
8533
  }
8657
- function validateDracoDecoderModule(module2) {
8658
- const typedModule = module2;
8659
- if (typeof (typedModule == null ? void 0 : typedModule.createDecoderModule) !== "function") {
8660
- throw new Error("Invalid draco3d decoder module");
8534
+ function isArrowViewType(arrowType, viewTypeName) {
8535
+ const constructor = getOptionalArrowConstructor(viewTypeName);
8536
+ if (constructor && arrowType instanceof constructor) {
8537
+ return true;
8661
8538
  }
8662
- return typedModule;
8539
+ const guards = arrow.DataType;
8540
+ const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
8541
+ return Boolean(guard == null ? void 0 : guard(arrowType));
8663
8542
  }
8664
- function getLibraryCacheKey2(type, options) {
8665
- const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
8666
- return [
8667
- type,
8668
- options.useLocalLibraries ? "local" : "remote",
8669
- options.CDN || "",
8670
- libraryOverrides
8671
- ].join("|");
8543
+ function isOptionalArrowType(arrowType, typeName) {
8544
+ const constructor = getOptionalArrowConstructor(typeName);
8545
+ return Boolean(constructor && arrowType instanceof constructor);
8672
8546
  }
8673
- var libraryDecoderPromises, injectedDecoderPromises, decoderInitializationQueue;
8674
- var init_draco_module_loader = __esm({
8675
- "../scene/src/draco/lib/draco-module-loader.ts"() {
8676
- "use strict";
8677
- init_loader_utils();
8678
- init_draco_library_loader();
8679
- init_draco_libraries();
8680
- libraryDecoderPromises = /* @__PURE__ */ new Map();
8681
- injectedDecoderPromises = /* @__PURE__ */ new WeakMap();
8682
- decoderInitializationQueue = Promise.resolve();
8683
- }
8684
- });
8685
-
8686
- // ../core/src/schema-utils/lib/schema/data-type.ts
8687
- function getDataTypeFromValue(value, defaultNumberType = "float32") {
8688
- if (value instanceof Date) {
8689
- return "date-millisecond";
8690
- }
8691
- if (typeof value === "number") {
8692
- return defaultNumberType;
8693
- }
8694
- if (typeof value === "boolean") {
8695
- return "bool";
8547
+ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
8548
+ const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
8549
+ if (viewTypeMode === "never") {
8550
+ return fallbackType;
8696
8551
  }
8697
- if (typeof value === "string") {
8698
- return "utf8";
8552
+ const constructor = getOptionalArrowConstructor(viewTypeName);
8553
+ if (constructor) {
8554
+ return new constructor();
8699
8555
  }
8700
- if (value === null || value === "undefined") {
8701
- return "null";
8556
+ if (viewTypeMode === "require") {
8557
+ throw new Error(
8558
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
8559
+ );
8702
8560
  }
8703
- return "null";
8561
+ return fallbackType;
8704
8562
  }
8705
- function getDataTypeFromArray(array) {
8706
- let type = getDataTypeFromTypedArray(array);
8707
- if (type !== "null") {
8708
- return { type, nullable: false };
8709
- }
8710
- if (array.length > 0) {
8711
- type = getDataTypeFromValue(array[0]);
8712
- return { type, nullable: true };
8563
+ function makeRequiredArrowViewType(viewTypeName) {
8564
+ const constructor = getOptionalArrowConstructor(viewTypeName);
8565
+ if (!constructor) {
8566
+ throw new Error(
8567
+ `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
8568
+ );
8713
8569
  }
8714
- return { type: "null", nullable: true };
8570
+ return new constructor();
8715
8571
  }
8716
- function getDataTypeFromTypedArray(array) {
8717
- if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
8718
- return "float16";
8572
+ function serializeArrowDictionaryKeyType(arrowType) {
8573
+ if (arrowType instanceof arrow.Int) {
8574
+ const prefix = arrowType.isSigned ? "int" : "uint";
8575
+ const keyType = `${prefix}${arrowType.bitWidth}`;
8576
+ if (isSchemaDictionaryKeyType(keyType)) {
8577
+ return keyType;
8578
+ }
8719
8579
  }
8720
- switch (array.constructor) {
8721
- case Int8Array:
8580
+ switch (arrowType.constructor) {
8581
+ case arrow.Int8:
8722
8582
  return "int8";
8723
- case Uint8Array:
8724
- case Uint8ClampedArray:
8725
- return "uint8";
8726
- case Int16Array:
8583
+ case arrow.Int16:
8727
8584
  return "int16";
8728
- case Uint16Array:
8729
- return "uint16";
8730
- case Int32Array:
8585
+ case arrow.Int32:
8731
8586
  return "int32";
8732
- case Uint32Array:
8587
+ case arrow.Uint8:
8588
+ return "uint8";
8589
+ case arrow.Uint16:
8590
+ return "uint16";
8591
+ case arrow.Uint32:
8733
8592
  return "uint32";
8734
- case BigInt64Array:
8735
- return "int64";
8736
- case BigUint64Array:
8737
- return "uint64";
8738
- case Float32Array:
8739
- return "float32";
8740
- case Float64Array:
8741
- return "float64";
8742
8593
  default:
8743
- return "null";
8594
+ throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
8744
8595
  }
8745
8596
  }
8746
- var import_core;
8747
- var init_data_type = __esm({
8748
- "../core/src/schema-utils/lib/schema/data-type.ts"() {
8597
+ function isSchemaDictionaryKeyType(keyType) {
8598
+ return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
8599
+ }
8600
+ function deserializeArrowDictionaryKeyType(keyType) {
8601
+ switch (keyType) {
8602
+ case "int8":
8603
+ return new arrow.Int8();
8604
+ case "int16":
8605
+ return new arrow.Int16();
8606
+ case "int32":
8607
+ return new arrow.Int32();
8608
+ case "uint8":
8609
+ return new arrow.Uint8();
8610
+ case "uint16":
8611
+ return new arrow.Uint16();
8612
+ case "uint32":
8613
+ return new arrow.Uint32();
8614
+ default:
8615
+ throw new Error(`schema dictionary index type not supported: ${keyType}`);
8616
+ }
8617
+ }
8618
+ var arrow;
8619
+ var init_convert_arrow_schema = __esm({
8620
+ "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
8749
8621
  "use strict";
8750
- import_core = require("@math.gl/core");
8622
+ arrow = __toESM(require("apache-arrow"), 1);
8751
8623
  }
8752
8624
  });
8753
8625
 
@@ -8847,23 +8719,23 @@ var init_float16 = __esm({
8847
8719
  });
8848
8720
 
8849
8721
  // ../core/src/schema/categories/category-mesh.ts
8850
- var arrow4, meshArrowSchema, indexedMeshArrowSchema;
8722
+ var arrow2, meshArrowSchema, indexedMeshArrowSchema;
8851
8723
  var init_category_mesh = __esm({
8852
8724
  "../core/src/schema/categories/category-mesh.ts"() {
8853
8725
  "use strict";
8854
- arrow4 = __toESM(require("apache-arrow"), 1);
8855
- meshArrowSchema = new arrow4.Schema([
8856
- new arrow4.Field(
8726
+ arrow2 = __toESM(require("apache-arrow"), 1);
8727
+ meshArrowSchema = new arrow2.Schema([
8728
+ new arrow2.Field(
8857
8729
  "POSITION",
8858
- new arrow4.FixedSizeList(3, new arrow4.Field("value", new arrow4.Float32(), false)),
8730
+ new arrow2.FixedSizeList(3, new arrow2.Field("value", new arrow2.Float32(), false)),
8859
8731
  false
8860
8732
  )
8861
8733
  ]);
8862
- indexedMeshArrowSchema = new arrow4.Schema([
8734
+ indexedMeshArrowSchema = new arrow2.Schema([
8863
8735
  ...meshArrowSchema.fields,
8864
- new arrow4.Field(
8736
+ new arrow2.Field(
8865
8737
  "indices",
8866
- new arrow4.List(new arrow4.Field("item", new arrow4.Uint32(), false)),
8738
+ new arrow2.List(new arrow2.Field("item", new arrow2.Uint32(), false)),
8867
8739
  true
8868
8740
  )
8869
8741
  ]);
@@ -8882,7 +8754,7 @@ var init_schema = __esm({
8882
8754
  // ../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts
8883
8755
  function getFixedSizeListVector(typedArray, stride, logicalType) {
8884
8756
  const data = getFixedSizeListData(typedArray, stride, logicalType);
8885
- return new arrow5.Vector([data]);
8757
+ return new arrow3.Vector([data]);
8886
8758
  }
8887
8759
  function getFixedSizeListData(typedArray, stride, logicalType) {
8888
8760
  const listType = getFixedSizeListType(typedArray, stride, logicalType);
@@ -8890,13 +8762,13 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
8890
8762
  const storage = logicalType === "float16" && isNativeFloat16Array(typedArray) ? getFloat16Storage(typedArray) : typedArray;
8891
8763
  const buffers = {
8892
8764
  // valueOffsets: undefined,
8893
- [arrow5.BufferType.DATA]: storage
8765
+ [arrow3.BufferType.DATA]: storage
8894
8766
  // values
8895
8767
  // nullBitmap: undefined,
8896
8768
  // typeIds: undefined
8897
8769
  };
8898
- const nestedData = new arrow5.Data(nestedType, 0, storage.length, 0, buffers);
8899
- const data = new arrow5.Data(
8770
+ const nestedData = new arrow3.Data(nestedType, 0, storage.length, 0, buffers);
8771
+ const data = new arrow3.Data(
8900
8772
  listType,
8901
8773
  0,
8902
8774
  storage.length / stride,
@@ -8909,15 +8781,15 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
8909
8781
  function getFixedSizeListType(typedArray, stride, logicalType) {
8910
8782
  const type = logicalType || getDataTypeFromArray(typedArray).type;
8911
8783
  const arrowType = deserializeArrowType(type);
8912
- const listType = new arrow5.FixedSizeList(stride, new arrow5.Field("value", arrowType, false));
8784
+ const listType = new arrow3.FixedSizeList(stride, new arrow3.Field("value", arrowType, false));
8913
8785
  return listType;
8914
8786
  }
8915
- var arrow5;
8787
+ var arrow3;
8916
8788
  var init_arrow_fixed_size_list_utils = __esm({
8917
8789
  "../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts"() {
8918
8790
  "use strict";
8919
8791
  init_schema();
8920
- arrow5 = __toESM(require("apache-arrow"), 1);
8792
+ arrow3 = __toESM(require("apache-arrow"), 1);
8921
8793
  init_data_type();
8922
8794
  init_convert_arrow_schema();
8923
8795
  }
@@ -8977,8 +8849,8 @@ function makeMeshArrowTable(attributes, options = {}) {
8977
8849
  fields.push(indicesField);
8978
8850
  }
8979
8851
  }
8980
- const arrowSchema = new arrow6.Schema(fields, getMeshArrowMetadata(options));
8981
- const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow6.Table(arrowSchema) : new arrow6.Table(arrowSchema, columns);
8852
+ const arrowSchema = new arrow4.Schema(fields, getMeshArrowMetadata(options));
8853
+ const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow4.Table(arrowSchema) : new arrow4.Table(arrowSchema, columns);
8982
8854
  const schema = serializeArrowSchema(table.schema);
8983
8855
  return {
8984
8856
  shape: "arrow-table",
@@ -8992,14 +8864,14 @@ function getAttributeArrowVector(value, size, componentType) {
8992
8864
  if (componentType === "float16") {
8993
8865
  const storage = isNativeFloat16Array(value) ? getFloat16Storage(value) : value;
8994
8866
  if (size === 1) {
8995
- const data = new arrow6.Data(new arrow6.Float16(), 0, storage.length, 0, {
8996
- [arrow6.BufferType.DATA]: storage
8867
+ const data = new arrow4.Data(new arrow4.Float16(), 0, storage.length, 0, {
8868
+ [arrow4.BufferType.DATA]: storage
8997
8869
  });
8998
- return new arrow6.Vector([data]);
8870
+ return new arrow4.Vector([data]);
8999
8871
  }
9000
8872
  return getFixedSizeListVector(value, size, componentType);
9001
8873
  }
9002
- return size === 1 ? arrow6.makeVector(value) : getFixedSizeListVector(value, size);
8874
+ return size === 1 ? arrow4.makeVector(value) : getFixedSizeListVector(value, size);
9003
8875
  }
9004
8876
  function getOrderedAttributeNames(attributes) {
9005
8877
  const attributeNames = Object.keys(attributes);
@@ -9026,7 +8898,7 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
9026
8898
  for (const [key, value] of Object.entries(suppliedField.metadata)) {
9027
8899
  metadata.set(key, value);
9028
8900
  }
9029
- return new arrow6.Field(
8901
+ return new arrow4.Field(
9030
8902
  canonicalField.name,
9031
8903
  canonicalField.type,
9032
8904
  canonicalField.nullable,
@@ -9037,21 +8909,21 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
9037
8909
  if (componentType === "float16") {
9038
8910
  const metadata = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
9039
8911
  metadata.set("componentType", "float16");
9040
- return new arrow6.Field(attributeName, column.type, false, metadata);
8912
+ return new arrow4.Field(attributeName, column.type, false, metadata);
9041
8913
  }
9042
8914
  if (field && field.type.toString() !== column.type.toString()) {
9043
8915
  const deserializedField = deserializeArrowField(field);
9044
- return new arrow6.Field(
8916
+ return new arrow4.Field(
9045
8917
  attributeName,
9046
8918
  column.type,
9047
8919
  deserializedField.nullable,
9048
8920
  deserializedField.metadata
9049
8921
  );
9050
8922
  }
9051
- return field ? deserializeArrowField(field) : new arrow6.Field(attributeName, column.type, false);
8923
+ return field ? deserializeArrowField(field) : new arrow4.Field(attributeName, column.type, false);
9052
8924
  }
9053
8925
  function isMeshPositionColumn(column) {
9054
- return column.type instanceof arrow6.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow6.Float32;
8926
+ return column.type instanceof arrow4.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow4.Float32;
9055
8927
  }
9056
8928
  function getIndicesVector(indices, vertexCount, type) {
9057
8929
  const indicesType = type;
@@ -9064,25 +8936,25 @@ function getIndicesVector(indices, vertexCount, type) {
9064
8936
  if (vertexCount > 0) {
9065
8937
  nullBitmap[0] = 1;
9066
8938
  }
9067
- const valuesData = new arrow6.Data(
8939
+ const valuesData = new arrow4.Data(
9068
8940
  indicesType.children[0].type,
9069
8941
  0,
9070
8942
  values.length,
9071
8943
  0,
9072
- { [arrow6.BufferType.DATA]: values }
8944
+ { [arrow4.BufferType.DATA]: values }
9073
8945
  );
9074
- const indicesData = new arrow6.Data(
8946
+ const indicesData = new arrow4.Data(
9075
8947
  indicesType,
9076
8948
  0,
9077
8949
  vertexCount,
9078
8950
  Math.max(0, vertexCount - 1),
9079
8951
  {
9080
- [arrow6.BufferType.OFFSET]: valueOffsets,
9081
- [arrow6.BufferType.VALIDITY]: nullBitmap
8952
+ [arrow4.BufferType.OFFSET]: valueOffsets,
8953
+ [arrow4.BufferType.VALIDITY]: nullBitmap
9082
8954
  },
9083
8955
  [valuesData]
9084
8956
  );
9085
- return new arrow6.Vector([indicesData]);
8957
+ return new arrow4.Vector([indicesData]);
9086
8958
  }
9087
8959
  function getMeshArrowMetadata(options) {
9088
8960
  var _a;
@@ -9098,13 +8970,13 @@ function getMeshArrowMetadata(options) {
9098
8970
  }
9099
8971
  return deserializeArrowMetadata(metadata);
9100
8972
  }
9101
- var arrow6, MESH_ARROW_ATTRIBUTE_ORDER;
8973
+ var arrow4, MESH_ARROW_ATTRIBUTE_ORDER;
9102
8974
  var init_convert_mesh_to_table = __esm({
9103
8975
  "../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts"() {
9104
8976
  "use strict";
9105
8977
  init_schema();
9106
8978
  init_schema();
9107
- arrow6 = __toESM(require("apache-arrow"), 1);
8979
+ arrow4 = __toESM(require("apache-arrow"), 1);
9108
8980
  init_arrow_fixed_size_list_utils();
9109
8981
  init_convert_arrow_schema();
9110
8982
  MESH_ARROW_ATTRIBUTE_ORDER = ["POSITION"];
@@ -9968,7 +9840,7 @@ var DracoLoader;
9968
9840
  var init_draco_loader_types = __esm({
9969
9841
  "../scene/src/draco/draco-loader-types.ts"() {
9970
9842
  "use strict";
9971
- init_arrow_transport();
9843
+ init_arrow_worker_transport();
9972
9844
  init_version4();
9973
9845
  init_draco_format();
9974
9846
  init_draco_loader_options();
@@ -15750,6 +15622,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
15750
15622
  function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
15751
15623
  const instances = new Array(instancesLength);
15752
15624
  const instancePosition = new import_core10.Vector3();
15625
+ const instanceFramePosition = new import_core10.Vector3();
15753
15626
  const instanceNormalRight = new import_core10.Vector3();
15754
15627
  const instanceNormalUp = new import_core10.Vector3();
15755
15628
  const instanceNormalForward = new import_core10.Vector3();
@@ -15812,7 +15685,10 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
15812
15685
  tile.hasCustomOrientation = true;
15813
15686
  hasCustomOrientation = true;
15814
15687
  } else if (tile.eastNorthUp) {
15815
- (0, import_geospatial4.eastNorthUpToFixedFrame)(import_geospatial3.Ellipsoid.WGS84, instancePosition, instanceTransform);
15688
+ instanceFramePosition.copy(instancePosition);
15689
+ if (tile.rtcCenter)
15690
+ instanceFramePosition.add(tile.rtcCenter);
15691
+ (0, import_geospatial4.eastNorthUpToFixedFrame)(import_geospatial3.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
15816
15692
  instanceTransform.getRotationMatrix3(instanceRotation);
15817
15693
  } else {
15818
15694
  instanceRotation.identity();
@@ -16374,7 +16250,7 @@ var VERSION5;
16374
16250
  var init_version5 = __esm({
16375
16251
  "dist/3d-tiles/lib/utils/version.js"() {
16376
16252
  "use strict";
16377
- VERSION5 = true ? "5.0.0-beta.4" : "latest";
16253
+ VERSION5 = true ? "5.0.0-beta.6" : "latest";
16378
16254
  }
16379
16255
  });
16380
16256
 
@@ -19155,6 +19031,7 @@ function parseInstancedModel2(tile, arrayBuffer, byteOffset, options, context) {
19155
19031
  function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLength) {
19156
19032
  const instances = new Array(instancesLength);
19157
19033
  const instancePosition = new import_core16.Vector3();
19034
+ const instanceFramePosition = new import_core16.Vector3();
19158
19035
  const instanceNormalRight = new import_core16.Vector3();
19159
19036
  const instanceNormalUp = new import_core16.Vector3();
19160
19037
  const instanceNormalForward = new import_core16.Vector3();
@@ -19249,7 +19126,9 @@ function extractInstancedAttributes2(tile, featureTable, batchTable, instancesLe
19249
19126
  tile.hasCustomOrientation = true;
19250
19127
  hasCustomOrientation = true;
19251
19128
  } else if (tile.eastNorthUp) {
19252
- (0, import_geospatial7.eastNorthUpToFixedFrame)(import_geospatial6.Ellipsoid.WGS84, instancePosition, instanceTransform);
19129
+ instanceFramePosition.copy(instancePosition);
19130
+ if (tile.rtcCenter) instanceFramePosition.add(tile.rtcCenter);
19131
+ (0, import_geospatial7.eastNorthUpToFixedFrame)(import_geospatial6.Ellipsoid.WGS84, instanceFramePosition, instanceTransform);
19253
19132
  instanceTransform.getRotationMatrix3(instanceRotation);
19254
19133
  } else {
19255
19134
  instanceRotation.identity();