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

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