@loaders.gl/tiles-3d 5.0.0-beta.10 → 5.0.0-beta.11

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 (154) hide show
  1. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  2. package/dist/3d-tiles/dist.dev.js +169 -581
  3. package/dist/3d-tiles/dist.min.js +16 -16
  4. package/dist/3d-tiles/index.cjs +115 -390
  5. package/dist/3d-tiles/index.cjs.map +3 -3
  6. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
  7. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
  8. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
  9. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  10. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
  11. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
  12. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
  13. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
  14. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
  15. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
  16. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  17. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
  18. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
  19. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
  20. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
  21. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
  22. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
  23. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
  24. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
  25. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  26. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
  27. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
  28. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
  29. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  30. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
  31. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
  32. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  33. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
  34. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
  35. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  36. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
  37. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  38. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
  39. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
  40. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  41. package/dist/3d-tiles/lib/utils/version.js +1 -1
  42. package/dist/3d-tiles/types.d.ts +7 -3
  43. package/dist/3d-tiles/types.d.ts.map +1 -1
  44. package/dist/3d-tiles-archive-writer.cjs +1 -1
  45. package/dist/copc/copc-loader.d.ts.map +1 -1
  46. package/dist/copc/copc-loader.js +10 -7
  47. package/dist/copc/copc-loader.js.map +1 -1
  48. package/dist/copc/copc-writer.d.ts +5 -4
  49. package/dist/copc/copc-writer.d.ts.map +1 -1
  50. package/dist/copc/copc-writer.js +1 -1
  51. package/dist/copc/copc-writer.js.map +1 -1
  52. package/dist/copc/index.cjs +809 -124
  53. package/dist/copc/index.cjs.map +3 -3
  54. package/dist/dist.dev.js +45 -77
  55. package/dist/dist.min.js +10 -10
  56. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  57. package/dist/i3s/dist.dev.js +11915 -12119
  58. package/dist/i3s/dist.min.js +25 -25
  59. package/dist/i3s/i3s-attribute-loader.js +1 -1
  60. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  61. package/dist/i3s/i3s-content-loader.js +1 -1
  62. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  63. package/dist/i3s/i3s-loader.js +1 -1
  64. package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
  65. package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
  66. package/dist/i3s/i3s-mesh-attributes.js +6 -11
  67. package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
  68. package/dist/i3s/i3s-mesh-writer.js +2 -3
  69. package/dist/i3s/i3s-mesh-writer.js.map +1 -1
  70. package/dist/i3s/i3s-node-page-loader.js +1 -1
  71. package/dist/i3s/i3s-slpk-loader.js +1 -1
  72. package/dist/i3s/i3s-slpk-writer.js +1 -1
  73. package/dist/i3s/index.cjs +314 -442
  74. package/dist/i3s/index.cjs.map +3 -3
  75. package/dist/i3s/lib/parsers/constants.d.ts +0 -3
  76. package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
  77. package/dist/i3s/lib/parsers/constants.js +0 -8
  78. package/dist/i3s/lib/parsers/constants.js.map +1 -1
  79. package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  80. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
  81. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  82. package/dist/i3s/types.d.ts +0 -1
  83. package/dist/i3s/types.d.ts.map +1 -1
  84. package/dist/i3s-content-worker-node.js +11 -11
  85. package/dist/i3s-content-worker-node.js.map +4 -4
  86. package/dist/i3s-content-worker.js +485 -879
  87. package/dist/i3s-lepcc-worker-node.js +2 -2
  88. package/dist/i3s-lepcc-worker.js +2 -2
  89. package/dist/i3s-mesh-writer.cjs +87 -206
  90. package/dist/i3s-mesh-writer.cjs.map +3 -3
  91. package/dist/i3s-slpk-writer.cjs +1 -1
  92. package/dist/index.cjs +44 -41
  93. package/dist/index.cjs.map +1 -1
  94. package/dist/point-cloud-tile-loader-types.js +1 -1
  95. package/dist/point-cloud-tile-loader.cjs +17 -28
  96. package/dist/point-cloud-tile-loader.cjs.map +1 -1
  97. package/dist/point-cloud-tile-source.cjs +16 -27
  98. package/dist/point-cloud-tile-source.cjs.map +1 -1
  99. package/dist/point-cloud-tile-source.js +2 -2
  100. package/dist/point-cloud-tile-source.js.map +1 -1
  101. package/dist/potree/dist.dev.js +985 -139
  102. package/dist/potree/dist.min.js +28 -28
  103. package/dist/potree/index.cjs +813 -140
  104. package/dist/potree/index.cjs.map +3 -3
  105. package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
  106. package/dist/potree/lib/potree-node-source.js +2 -14
  107. package/dist/potree/lib/potree-node-source.js.map +1 -1
  108. package/dist/potree/parsers/parse-potree-bin.js +3 -3
  109. package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
  110. package/dist/potree/potree-bin-loader.js +1 -1
  111. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  112. package/dist/potree/potree-loader-types.js +1 -1
  113. package/dist/potree/potree-writer.d.ts +3 -3
  114. package/dist/potree/potree-writer.d.ts.map +1 -1
  115. package/dist/potree/potree-writer.js +2 -2
  116. package/dist/potree/potree-writer.js.map +1 -1
  117. package/dist/potree/potree2-source.d.ts +1 -1
  118. package/dist/potree/potree2-source.d.ts.map +1 -1
  119. package/dist/potree/potree2-source.js +6 -3
  120. package/dist/potree/potree2-source.js.map +1 -1
  121. package/dist/potree-loader.cjs +817 -153
  122. package/dist/potree-loader.cjs.map +3 -3
  123. package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
  124. package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
  125. package/dist/tileset-3d/helpers/frame-state.js +41 -15
  126. package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
  127. package/dist/types.d.ts +15 -0
  128. package/dist/types.d.ts.map +1 -1
  129. package/package.json +13 -13
  130. package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
  131. package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
  132. package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
  133. package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
  134. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
  135. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
  136. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
  137. package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
  138. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
  139. package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
  140. package/src/3d-tiles/types.ts +4 -3
  141. package/src/copc/copc-loader.ts +8 -8
  142. package/src/copc/copc-writer.ts +6 -5
  143. package/src/i3s/i3s-mesh-attributes.ts +9 -17
  144. package/src/i3s/i3s-mesh-writer.ts +4 -3
  145. package/src/i3s/lib/parsers/constants.ts +0 -9
  146. package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
  147. package/src/i3s/types.ts +0 -1
  148. package/src/point-cloud-tile-source.ts +2 -2
  149. package/src/potree/lib/potree-node-source.ts +2 -15
  150. package/src/potree/parsers/parse-potree-bin.ts +3 -3
  151. package/src/potree/potree-writer.ts +6 -11
  152. package/src/potree/potree2-source.ts +6 -3
  153. package/src/tileset-3d/helpers/frame-state.ts +43 -15
  154. package/src/types.ts +15 -0
@@ -228,18 +228,10 @@ function sizeOf(dataType) {
228
228
  throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
229
229
  }
230
230
  }
231
- var import_geometry, GL_TYPE_MAP, STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE, COORDINATE_SYSTEM;
231
+ var STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE, COORDINATE_SYSTEM;
232
232
  var init_constants = __esm({
233
233
  "dist/i3s/lib/parsers/constants.js"() {
234
234
  "use strict";
235
- import_geometry = require("@math.gl/geometry");
236
- GL_TYPE_MAP = {
237
- UInt8: import_geometry.GL.UNSIGNED_BYTE,
238
- UInt16: import_geometry.GL.UNSIGNED_SHORT,
239
- Float32: import_geometry.GL.FLOAT,
240
- UInt32: import_geometry.GL.UNSIGNED_INT,
241
- UInt64: import_geometry.GL.DOUBLE
242
- };
243
235
  STRING_ATTRIBUTE_TYPE = "String";
244
236
  OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
245
237
  FLOAT_64_TYPE = "Float64";
@@ -3440,16 +3432,6 @@ var init_data_source = __esm({
3440
3432
  }
3441
3433
  });
3442
3434
 
3443
- // ../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts
3444
- function makeTableScanBatch(table) {
3445
- return { ...table, batchType: "data", length: table.data.numRows };
3446
- }
3447
- var init_table_scan_batch = __esm({
3448
- "../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts"() {
3449
- "use strict";
3450
- }
3451
- });
3452
-
3453
3435
  // ../core/src/loader-utils/index.ts
3454
3436
  var init_loader_utils = __esm({
3455
3437
  "../core/src/loader-utils/index.ts"() {
@@ -3477,7 +3459,6 @@ var init_loader_utils = __esm({
3477
3459
  init_http_file();
3478
3460
  init_data_source();
3479
3461
  init_data_source();
3480
- init_table_scan_batch();
3481
3462
  }
3482
3463
  });
3483
3464
 
@@ -7862,140 +7843,6 @@ var init_obj_format = __esm({
7862
7843
  }
7863
7844
  });
7864
7845
 
7865
- // ../core/src/arrow-worker-transport.ts
7866
- function serializeArrowWorkerTable(result) {
7867
- if (!isArrowTableWrapper(result)) {
7868
- throw new Error("Workers require Arrow table output");
7869
- }
7870
- const { data, shape: _shape, ...metadata3 } = result;
7871
- return {
7872
- transport: "arrow-column-envelope",
7873
- metadata: structuredClone(metadata3),
7874
- ...serializeWorkerColumns(data, { copy: "all" })
7875
- };
7876
- }
7877
- function deserializeArrowWorkerTable(result) {
7878
- if (isArrowWorkerEnvelope(result)) {
7879
- return { ...result.metadata, shape: "arrow-table", data: hydrateWorkerTable(result) };
7880
- }
7881
- if (isLegacyArrowWorkerEnvelope(result)) {
7882
- const { arrowBatchMetadata: _snapshots, data: _columns, ...metadata3 } = result;
7883
- return { ...metadata3, data: hydrateWorkerTable(result) };
7884
- }
7885
- throw new Error("Workers require Arrow column transport");
7886
- }
7887
- function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
7888
- const batch = result instanceof arrow.RecordBatch;
7889
- if (!batch && !(result instanceof arrow.Table)) {
7890
- throw new Error("Workers require Arrow table output");
7891
- }
7892
- return {
7893
- transport: batch ? "arrow-record-batch" : "arrow-table-columns",
7894
- columns: batch ? { data: (0, import_arrow.dehydrateArrowRecordBatch)(result, options) } : serializeWorkerColumns(result, options)
7895
- };
7896
- }
7897
- function deserializeNativeArrowWorkerResult(result) {
7898
- const payload = result;
7899
- if ((payload == null ? void 0 : payload.transport) !== "arrow-table-columns" && (payload == null ? void 0 : payload.transport) !== "arrow-record-batch" || !hasArrowWorkerColumns(payload.columns)) {
7900
- throw new Error("Workers require Arrow column transport");
7901
- }
7902
- if (payload.transport === "arrow-record-batch" && !payload.columns.arrowBatchMetadata) {
7903
- return (0, import_arrow.hydrateArrowRecordBatch)(payload.columns.data);
7904
- }
7905
- const data = hydrateWorkerTable(payload.columns);
7906
- return payload.transport === "arrow-record-batch" ? data.batches[0] : data;
7907
- }
7908
- function serializeArrowWorkerResult(result, options) {
7909
- var _a;
7910
- const workerOptions = options;
7911
- const bufferCopyMode = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
7912
- if (result instanceof arrow.Table || result instanceof arrow.RecordBatch) {
7913
- return serializeNativeArrowWorkerResult(result, { copy: bufferCopyMode ?? "all" });
7914
- }
7915
- if (!isArrowTableWrapper(result)) {
7916
- return result;
7917
- }
7918
- const { data, shape: _shape, ...metadata3 } = result;
7919
- return {
7920
- transport: "arrow-column-envelope",
7921
- metadata: structuredClone(metadata3),
7922
- ...serializeWorkerColumns(data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
7923
- };
7924
- }
7925
- function deserializeArrowWorkerResult(result) {
7926
- const transport = result == null ? void 0 : result.transport;
7927
- if (transport === "arrow-table-columns" || transport === "arrow-record-batch") {
7928
- return deserializeNativeArrowWorkerResult(result);
7929
- }
7930
- return isArrowWorkerEnvelope(result) || isLegacyArrowWorkerEnvelope(result) ? deserializeArrowWorkerTable(result) : result;
7931
- }
7932
- function isArrowTableWrapper(value) {
7933
- const table = value;
7934
- return Boolean(
7935
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
7936
- );
7937
- }
7938
- function hasArrowWorkerColumns(value) {
7939
- var _a;
7940
- const columns = value;
7941
- return ((_a = columns == null ? void 0 : columns.data) == null ? void 0 : _a.transport) === "arrow-js" && Array.isArray(columns.data.batches);
7942
- }
7943
- function isArrowWorkerEnvelope(value) {
7944
- return (value == null ? void 0 : value.transport) === "arrow-column-envelope" && hasArrowWorkerColumns(value);
7945
- }
7946
- function isLegacyArrowWorkerEnvelope(value) {
7947
- return (value == null ? void 0 : value.shape) === "arrow-table" && hasArrowWorkerColumns(value);
7948
- }
7949
- function serializeWorkerColumns(table, options) {
7950
- return {
7951
- arrowBatchMetadata: snapshotBatchMetadata(table),
7952
- data: dehydrateWorkerTable(table, options)
7953
- };
7954
- }
7955
- function dehydrateWorkerTable(table, options) {
7956
- const payload = (0, import_arrow.dehydrateArrowTable)(table, options);
7957
- if (table.numCols === 0) {
7958
- for (const [index, batch] of table.batches.entries()) {
7959
- payload.batches[index].length = batch.numRows;
7960
- }
7961
- }
7962
- return payload;
7963
- }
7964
- function snapshotBatchMetadata(table) {
7965
- return table.batches.map((batch) => ({
7966
- schema: arrow.tableToIPC(new arrow.Table(batch.schema, [])),
7967
- metadata: Array.from(batch.metadata)
7968
- }));
7969
- }
7970
- function hydrateWorkerTable(result) {
7971
- const { arrowBatchMetadata, data } = result;
7972
- const table = (0, import_arrow.hydrateArrowTable)(data);
7973
- const batches = table.batches.map((batch, index) => {
7974
- const snapshot = arrowBatchMetadata == null ? void 0 : arrowBatchMetadata[index];
7975
- const restored = snapshot ? new arrow.RecordBatch(
7976
- arrow.tableFromIPC(snapshot.schema).schema,
7977
- batch.data,
7978
- new Map(snapshot.metadata)
7979
- ) : batch;
7980
- const rowCount = data.batches[index].length;
7981
- if (restored.numCols === 0 && restored.numRows !== rowCount) {
7982
- Object.defineProperty(restored, "data", {
7983
- value: new arrow.Data(new arrow.Struct([]), 0, rowCount, 0, void 0, [])
7984
- });
7985
- }
7986
- return restored;
7987
- });
7988
- return new arrow.Table(table.schema, batches);
7989
- }
7990
- var arrow, import_arrow;
7991
- var init_arrow_worker_transport = __esm({
7992
- "../core/src/arrow-worker-transport.ts"() {
7993
- "use strict";
7994
- arrow = __toESM(require("apache-arrow"), 1);
7995
- import_arrow = require("@math.gl/arrow");
7996
- }
7997
- });
7998
-
7999
7846
  // ../core/src/schema-utils/lib/schema/data-type.ts
8000
7847
  function getDataTypeFromValue(value, defaultNumberType = "float32") {
8001
7848
  if (value instanceof Date) {
@@ -8075,7 +7922,7 @@ function serializeArrowSchema(arrowSchema) {
8075
7922
  };
8076
7923
  }
8077
7924
  function deserializeArrowSchema(schema, options) {
8078
- return new arrow2.Schema(
7925
+ return new arrow.Schema(
8079
7926
  schema.fields.map((field) => deserializeArrowField(field, options)),
8080
7927
  deserializeArrowMetadata(schema.metadata)
8081
7928
  );
@@ -8095,7 +7942,7 @@ function serializeArrowField(field) {
8095
7942
  };
8096
7943
  }
8097
7944
  function deserializeArrowField(field, options) {
8098
- return new arrow2.Field(
7945
+ return new arrow.Field(
8099
7946
  field.name,
8100
7947
  deserializeArrowType(field.type, options),
8101
7948
  field.nullable,
@@ -8117,57 +7964,57 @@ function serializeArrowType(arrowType) {
8117
7964
  };
8118
7965
  }
8119
7966
  switch (arrowType.constructor) {
8120
- case arrow2.Null:
7967
+ case arrow.Null:
8121
7968
  return "null";
8122
- case arrow2.Binary:
7969
+ case arrow.Binary:
8123
7970
  return "binary";
8124
- case arrow2.FixedSizeBinary:
7971
+ case arrow.FixedSizeBinary:
8125
7972
  return {
8126
7973
  type: "fixed-size-binary",
8127
7974
  byteWidth: arrowType.byteWidth
8128
7975
  };
8129
- case arrow2.Bool:
7976
+ case arrow.Bool:
8130
7977
  return "bool";
8131
- case arrow2.Int:
7978
+ case arrow.Int:
8132
7979
  const intType = arrowType;
8133
7980
  return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
8134
- case arrow2.Int8:
7981
+ case arrow.Int8:
8135
7982
  return "int8";
8136
- case arrow2.Int16:
7983
+ case arrow.Int16:
8137
7984
  return "int16";
8138
- case arrow2.Int32:
7985
+ case arrow.Int32:
8139
7986
  return "int32";
8140
- case arrow2.Int64:
7987
+ case arrow.Int64:
8141
7988
  return "int64";
8142
- case arrow2.Uint8:
7989
+ case arrow.Uint8:
8143
7990
  return "uint8";
8144
- case arrow2.Uint16:
7991
+ case arrow.Uint16:
8145
7992
  return "uint16";
8146
- case arrow2.Uint32:
7993
+ case arrow.Uint32:
8147
7994
  return "uint32";
8148
- case arrow2.Uint64:
7995
+ case arrow.Uint64:
8149
7996
  return "uint64";
8150
- case arrow2.Float:
7997
+ case arrow.Float:
8151
7998
  const precision = arrowType.precision;
8152
7999
  switch (precision) {
8153
- case arrow2.Precision.HALF:
8000
+ case arrow.Precision.HALF:
8154
8001
  return "float16";
8155
- case arrow2.Precision.SINGLE:
8002
+ case arrow.Precision.SINGLE:
8156
8003
  return "float32";
8157
- case arrow2.Precision.DOUBLE:
8004
+ case arrow.Precision.DOUBLE:
8158
8005
  return "float64";
8159
8006
  default:
8160
8007
  return "float16";
8161
8008
  }
8162
- case arrow2.Float16:
8009
+ case arrow.Float16:
8163
8010
  return "float16";
8164
- case arrow2.Float32:
8011
+ case arrow.Float32:
8165
8012
  return "float32";
8166
- case arrow2.Float64:
8013
+ case arrow.Float64:
8167
8014
  return "float64";
8168
- case arrow2.Utf8:
8015
+ case arrow.Utf8:
8169
8016
  return "utf8";
8170
- case arrow2.Decimal:
8017
+ case arrow.Decimal:
8171
8018
  const decimal = arrowType;
8172
8019
  return {
8173
8020
  type: "decimal",
@@ -8175,108 +8022,108 @@ function serializeArrowType(arrowType) {
8175
8022
  precision: decimal.precision,
8176
8023
  scale: decimal.scale
8177
8024
  };
8178
- case arrow2.Date_:
8025
+ case arrow.Date_:
8179
8026
  const dateUnit = arrowType.unit;
8180
- return dateUnit === arrow2.DateUnit.DAY ? "date-day" : "date-millisecond";
8181
- case arrow2.DateDay:
8027
+ return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
8028
+ case arrow.DateDay:
8182
8029
  return "date-day";
8183
- case arrow2.DateMillisecond:
8030
+ case arrow.DateMillisecond:
8184
8031
  return "date-millisecond";
8185
- case arrow2.Time:
8032
+ case arrow.Time:
8186
8033
  const timeUnit = arrowType.unit;
8187
8034
  switch (timeUnit) {
8188
- case arrow2.TimeUnit.SECOND:
8035
+ case arrow.TimeUnit.SECOND:
8189
8036
  return "time-second";
8190
- case arrow2.TimeUnit.MILLISECOND:
8037
+ case arrow.TimeUnit.MILLISECOND:
8191
8038
  return "time-millisecond";
8192
- case arrow2.TimeUnit.MICROSECOND:
8039
+ case arrow.TimeUnit.MICROSECOND:
8193
8040
  return "time-microsecond";
8194
- case arrow2.TimeUnit.NANOSECOND:
8041
+ case arrow.TimeUnit.NANOSECOND:
8195
8042
  return "time-nanosecond";
8196
8043
  default:
8197
8044
  return "time-second";
8198
8045
  }
8199
- case arrow2.TimeMillisecond:
8046
+ case arrow.TimeMillisecond:
8200
8047
  return "time-millisecond";
8201
- case arrow2.TimeSecond:
8048
+ case arrow.TimeSecond:
8202
8049
  return "time-second";
8203
- case arrow2.TimeMicrosecond:
8050
+ case arrow.TimeMicrosecond:
8204
8051
  return "time-microsecond";
8205
- case arrow2.TimeNanosecond:
8052
+ case arrow.TimeNanosecond:
8206
8053
  return "time-nanosecond";
8207
- case arrow2.Timestamp:
8054
+ case arrow.Timestamp:
8208
8055
  const timeStampUnit = arrowType.unit;
8209
8056
  switch (timeStampUnit) {
8210
- case arrow2.TimeUnit.SECOND:
8057
+ case arrow.TimeUnit.SECOND:
8211
8058
  return "timestamp-second";
8212
- case arrow2.TimeUnit.MILLISECOND:
8059
+ case arrow.TimeUnit.MILLISECOND:
8213
8060
  return "timestamp-millisecond";
8214
- case arrow2.TimeUnit.MICROSECOND:
8061
+ case arrow.TimeUnit.MICROSECOND:
8215
8062
  return "timestamp-microsecond";
8216
- case arrow2.TimeUnit.NANOSECOND:
8063
+ case arrow.TimeUnit.NANOSECOND:
8217
8064
  return "timestamp-nanosecond";
8218
8065
  default:
8219
8066
  return "timestamp-second";
8220
8067
  }
8221
- case arrow2.TimestampSecond:
8068
+ case arrow.TimestampSecond:
8222
8069
  return "timestamp-second";
8223
- case arrow2.TimestampMillisecond:
8070
+ case arrow.TimestampMillisecond:
8224
8071
  return "timestamp-millisecond";
8225
- case arrow2.TimestampMicrosecond:
8072
+ case arrow.TimestampMicrosecond:
8226
8073
  return "timestamp-microsecond";
8227
- case arrow2.TimestampNanosecond:
8074
+ case arrow.TimestampNanosecond:
8228
8075
  return "timestamp-nanosecond";
8229
- case arrow2.Interval:
8076
+ case arrow.Interval:
8230
8077
  const intervalUnit = arrowType.unit;
8231
8078
  switch (intervalUnit) {
8232
- case arrow2.IntervalUnit.DAY_TIME:
8079
+ case arrow.IntervalUnit.DAY_TIME:
8233
8080
  return "interval-daytime";
8234
- case arrow2.IntervalUnit.YEAR_MONTH:
8081
+ case arrow.IntervalUnit.YEAR_MONTH:
8235
8082
  return "interval-yearmonth";
8236
8083
  default:
8237
8084
  return "interval-daytime";
8238
8085
  }
8239
- case arrow2.IntervalDayTime:
8086
+ case arrow.IntervalDayTime:
8240
8087
  return "interval-daytime";
8241
- case arrow2.IntervalYearMonth:
8088
+ case arrow.IntervalYearMonth:
8242
8089
  return "interval-yearmonth";
8243
- case arrow2.Map_:
8090
+ case arrow.Map_:
8244
8091
  const mapType = arrowType;
8245
8092
  return {
8246
8093
  type: "map",
8247
8094
  keysSorted: mapType.keysSorted,
8248
8095
  children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
8249
8096
  };
8250
- case arrow2.List:
8097
+ case arrow.List:
8251
8098
  const listType = arrowType;
8252
8099
  const listField = listType.valueField;
8253
8100
  return {
8254
8101
  type: "list",
8255
8102
  children: [serializeArrowField(listField)]
8256
8103
  };
8257
- case arrow2.FixedSizeList:
8104
+ case arrow.FixedSizeList:
8258
8105
  const fixedSizeList = arrowType;
8259
8106
  return {
8260
8107
  type: "fixed-size-list",
8261
8108
  listSize: fixedSizeList.listSize,
8262
8109
  children: [serializeArrowField(fixedSizeList.children[0])]
8263
8110
  };
8264
- case arrow2.Struct:
8111
+ case arrow.Struct:
8265
8112
  const structType = arrowType;
8266
8113
  return {
8267
8114
  type: "struct",
8268
8115
  children: structType.children.map((arrowField) => serializeArrowField(arrowField))
8269
8116
  };
8270
- case arrow2.SparseUnion:
8271
- case arrow2.DenseUnion:
8117
+ case arrow.SparseUnion:
8118
+ case arrow.DenseUnion:
8272
8119
  const unionType = arrowType;
8273
8120
  return {
8274
- type: unionType instanceof arrow2.DenseUnion ? "dense-union" : "sparse-union",
8121
+ type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
8275
8122
  typeIds: unionType.typeIds,
8276
8123
  children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
8277
8124
  typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
8278
8125
  };
8279
- case arrow2.Dictionary:
8126
+ case arrow.Dictionary:
8280
8127
  const dictionaryType = arrowType;
8281
8128
  return {
8282
8129
  type: "dictionary",
@@ -8293,16 +8140,16 @@ function deserializeArrowType(dataType, options) {
8293
8140
  if (typeof dataType === "object") {
8294
8141
  switch (dataType.type) {
8295
8142
  case "decimal":
8296
- return new arrow2.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
8143
+ return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
8297
8144
  case "map": {
8298
8145
  const children = dataType.children.map(
8299
8146
  (arrowField) => deserializeArrowField(arrowField, options)
8300
8147
  );
8301
- return new arrow2.Map_(children[0], dataType.keysSorted);
8148
+ return new arrow.Map_(children[0], dataType.keysSorted);
8302
8149
  }
8303
8150
  case "list": {
8304
8151
  const field = deserializeArrowField(dataType.children[0], options);
8305
- return new arrow2.List(field);
8152
+ return new arrow.List(field);
8306
8153
  }
8307
8154
  case "large-list": {
8308
8155
  const field = deserializeArrowField(dataType.children[0], options);
@@ -8316,25 +8163,25 @@ function deserializeArrowType(dataType, options) {
8316
8163
  }
8317
8164
  case "fixed-size-list": {
8318
8165
  const child = deserializeArrowField(dataType.children[0], options);
8319
- return new arrow2.FixedSizeList(dataType.listSize, child);
8166
+ return new arrow.FixedSizeList(dataType.listSize, child);
8320
8167
  }
8321
8168
  case "fixed-size-binary":
8322
- return new arrow2.FixedSizeBinary(dataType.byteWidth);
8169
+ return new arrow.FixedSizeBinary(dataType.byteWidth);
8323
8170
  case "struct": {
8324
8171
  const children = dataType.children.map(
8325
8172
  (arrowField) => deserializeArrowField(arrowField, options)
8326
8173
  );
8327
- return new arrow2.Struct(children);
8174
+ return new arrow.Struct(children);
8328
8175
  }
8329
8176
  case "sparse-union":
8330
8177
  case "dense-union": {
8331
8178
  const children = dataType.children.map(
8332
8179
  (arrowField) => deserializeArrowField(arrowField, options)
8333
8180
  );
8334
- return dataType.type === "dense-union" ? new arrow2.DenseUnion(dataType.typeIds, children) : new arrow2.SparseUnion(dataType.typeIds, children);
8181
+ return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
8335
8182
  }
8336
8183
  case "dictionary": {
8337
- return new arrow2.Dictionary(
8184
+ return new arrow.Dictionary(
8338
8185
  deserializeArrowType(dataType.dictionary, options),
8339
8186
  deserializeArrowDictionaryKeyType(dataType.indices),
8340
8187
  dataType.id,
@@ -8347,76 +8194,76 @@ function deserializeArrowType(dataType, options) {
8347
8194
  }
8348
8195
  switch (dataType) {
8349
8196
  case "null":
8350
- return new arrow2.Null();
8197
+ return new arrow.Null();
8351
8198
  case "binary":
8352
- return makeVariableWidthArrowType("BinaryView", new arrow2.Binary(), options);
8199
+ return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
8353
8200
  case "binary-view":
8354
8201
  return makeRequiredArrowViewType("BinaryView");
8355
8202
  case "bool":
8356
- return new arrow2.Bool();
8203
+ return new arrow.Bool();
8357
8204
  case "int8":
8358
- return new arrow2.Int8();
8205
+ return new arrow.Int8();
8359
8206
  case "int16":
8360
- return new arrow2.Int16();
8207
+ return new arrow.Int16();
8361
8208
  case "int32":
8362
- return new arrow2.Int32();
8209
+ return new arrow.Int32();
8363
8210
  case "int64":
8364
- return new arrow2.Int64();
8211
+ return new arrow.Int64();
8365
8212
  case "uint8":
8366
- return new arrow2.Uint8();
8213
+ return new arrow.Uint8();
8367
8214
  case "uint16":
8368
- return new arrow2.Uint16();
8215
+ return new arrow.Uint16();
8369
8216
  case "uint32":
8370
- return new arrow2.Uint32();
8217
+ return new arrow.Uint32();
8371
8218
  case "uint64":
8372
- return new arrow2.Uint64();
8219
+ return new arrow.Uint64();
8373
8220
  case "float16":
8374
- return new arrow2.Float16();
8221
+ return new arrow.Float16();
8375
8222
  case "float32":
8376
- return new arrow2.Float32();
8223
+ return new arrow.Float32();
8377
8224
  case "float64":
8378
- return new arrow2.Float64();
8225
+ return new arrow.Float64();
8379
8226
  case "utf8":
8380
- return makeVariableWidthArrowType("Utf8View", new arrow2.Utf8(), options);
8227
+ return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
8381
8228
  case "utf8-view":
8382
8229
  return makeRequiredArrowViewType("Utf8View");
8383
8230
  case "date-day":
8384
- return new arrow2.DateDay();
8231
+ return new arrow.DateDay();
8385
8232
  case "date-millisecond":
8386
- return new arrow2.DateMillisecond();
8233
+ return new arrow.DateMillisecond();
8387
8234
  case "time-second":
8388
- return new arrow2.TimeSecond();
8235
+ return new arrow.TimeSecond();
8389
8236
  case "time-millisecond":
8390
- return new arrow2.TimeMillisecond();
8237
+ return new arrow.TimeMillisecond();
8391
8238
  case "time-microsecond":
8392
- return new arrow2.TimeMicrosecond();
8239
+ return new arrow.TimeMicrosecond();
8393
8240
  case "time-nanosecond":
8394
- return new arrow2.TimeNanosecond();
8241
+ return new arrow.TimeNanosecond();
8395
8242
  case "timestamp-second":
8396
- return new arrow2.TimestampSecond();
8243
+ return new arrow.TimestampSecond();
8397
8244
  case "timestamp-millisecond":
8398
- return new arrow2.TimestampMillisecond();
8245
+ return new arrow.TimestampMillisecond();
8399
8246
  case "timestamp-microsecond":
8400
- return new arrow2.TimestampMicrosecond();
8247
+ return new arrow.TimestampMicrosecond();
8401
8248
  case "timestamp-nanosecond":
8402
- return new arrow2.TimestampNanosecond();
8249
+ return new arrow.TimestampNanosecond();
8403
8250
  case "interval-daytime":
8404
- return new arrow2.IntervalDayTime();
8251
+ return new arrow.IntervalDayTime();
8405
8252
  case "interval-yearmonth":
8406
- return new arrow2.IntervalYearMonth();
8253
+ return new arrow.IntervalYearMonth();
8407
8254
  default:
8408
8255
  throw new Error("array type not supported");
8409
8256
  }
8410
8257
  }
8411
8258
  function getOptionalArrowConstructor(typeName) {
8412
- return arrow2[typeName];
8259
+ return arrow[typeName];
8413
8260
  }
8414
8261
  function isArrowViewType(arrowType, viewTypeName) {
8415
8262
  const constructor = getOptionalArrowConstructor(viewTypeName);
8416
8263
  if (constructor && arrowType instanceof constructor) {
8417
8264
  return true;
8418
8265
  }
8419
- const guards = arrow2.DataType;
8266
+ const guards = arrow.DataType;
8420
8267
  const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
8421
8268
  return Boolean(guard == null ? void 0 : guard(arrowType));
8422
8269
  }
@@ -8450,7 +8297,7 @@ function makeRequiredArrowViewType(viewTypeName) {
8450
8297
  return new constructor();
8451
8298
  }
8452
8299
  function serializeArrowDictionaryKeyType(arrowType) {
8453
- if (arrowType instanceof arrow2.Int) {
8300
+ if (arrowType instanceof arrow.Int) {
8454
8301
  const prefix = arrowType.isSigned ? "int" : "uint";
8455
8302
  const keyType = `${prefix}${arrowType.bitWidth}`;
8456
8303
  if (isSchemaDictionaryKeyType(keyType)) {
@@ -8458,17 +8305,17 @@ function serializeArrowDictionaryKeyType(arrowType) {
8458
8305
  }
8459
8306
  }
8460
8307
  switch (arrowType.constructor) {
8461
- case arrow2.Int8:
8308
+ case arrow.Int8:
8462
8309
  return "int8";
8463
- case arrow2.Int16:
8310
+ case arrow.Int16:
8464
8311
  return "int16";
8465
- case arrow2.Int32:
8312
+ case arrow.Int32:
8466
8313
  return "int32";
8467
- case arrow2.Uint8:
8314
+ case arrow.Uint8:
8468
8315
  return "uint8";
8469
- case arrow2.Uint16:
8316
+ case arrow.Uint16:
8470
8317
  return "uint16";
8471
- case arrow2.Uint32:
8318
+ case arrow.Uint32:
8472
8319
  return "uint32";
8473
8320
  default:
8474
8321
  throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
@@ -8480,31 +8327,31 @@ function isSchemaDictionaryKeyType(keyType) {
8480
8327
  function deserializeArrowDictionaryKeyType(keyType) {
8481
8328
  switch (keyType) {
8482
8329
  case "int8":
8483
- return new arrow2.Int8();
8330
+ return new arrow.Int8();
8484
8331
  case "int16":
8485
- return new arrow2.Int16();
8332
+ return new arrow.Int16();
8486
8333
  case "int32":
8487
- return new arrow2.Int32();
8334
+ return new arrow.Int32();
8488
8335
  case "uint8":
8489
- return new arrow2.Uint8();
8336
+ return new arrow.Uint8();
8490
8337
  case "uint16":
8491
- return new arrow2.Uint16();
8338
+ return new arrow.Uint16();
8492
8339
  case "uint32":
8493
- return new arrow2.Uint32();
8340
+ return new arrow.Uint32();
8494
8341
  default:
8495
8342
  throw new Error(`schema dictionary index type not supported: ${keyType}`);
8496
8343
  }
8497
8344
  }
8498
- var arrow2;
8345
+ var arrow;
8499
8346
  var init_convert_arrow_schema = __esm({
8500
8347
  "../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
8501
8348
  "use strict";
8502
- arrow2 = __toESM(require("apache-arrow"), 1);
8349
+ arrow = __toESM(require("apache-arrow"), 1);
8503
8350
  }
8504
8351
  });
8505
8352
 
8506
8353
  // ../core/src/lib/loader-utils/native-arrow.ts
8507
- function isNativeArrowTable(value) {
8354
+ function isArrowTable(value) {
8508
8355
  return Boolean(
8509
8356
  value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function"
8510
8357
  );
@@ -8521,7 +8368,7 @@ function snapshotArrowSchema(schema) {
8521
8368
  }
8522
8369
  function mergeArrowSchemas(previous, next) {
8523
8370
  if (!previous) return snapshotArrowSchema(next);
8524
- new arrow3.Table(previous, [new arrow3.RecordBatch(next, void 0)]);
8371
+ new arrow2.Table(previous, [new arrow2.RecordBatch(next, void 0)]);
8525
8372
  const earlier = serializeArrowSchema(previous);
8526
8373
  const later = serializeArrowSchema(next);
8527
8374
  return deserializeArrowSchema({
@@ -8553,30 +8400,34 @@ function mergeTypeMetadata(previous, next) {
8553
8400
  }
8554
8401
  return next;
8555
8402
  }
8403
+ function snapshotArrowBatch(batch, schema) {
8404
+ const snapshot = new arrow2.RecordBatch(
8405
+ snapshotArrowSchema(schema),
8406
+ batch.data,
8407
+ new Map(batch.metadata)
8408
+ );
8409
+ if (snapshot.numRows !== batch.numRows) {
8410
+ Object.defineProperty(snapshot, "data", { value: batch.data });
8411
+ }
8412
+ return snapshot;
8413
+ }
8556
8414
  function updateArrowTableSchema(table, schema) {
8557
8415
  const snapshot = snapshotArrowSchema(schema);
8558
- const batches = table.batches.map(
8559
- (batch) => new arrow3.RecordBatch(snapshotArrowSchema(snapshot), batch.data, new Map(batch.metadata))
8560
- );
8561
- return new arrow3.Table(
8416
+ const batches = table.batches.map((batch) => snapshotArrowBatch(batch, snapshot));
8417
+ return new arrow2.Table(
8562
8418
  snapshot,
8563
- batches.length ? batches : [new arrow3.RecordBatch(snapshotArrowSchema(snapshot), void 0)]
8419
+ batches.length ? batches : [new arrow2.RecordBatch(snapshotArrowSchema(snapshot), void 0)]
8564
8420
  );
8565
8421
  }
8566
8422
  function makeArrowMetadataBatch(schema) {
8567
- return new arrow3.RecordBatch(snapshotArrowSchema(schema), void 0);
8423
+ return new arrow2.RecordBatch(snapshotArrowSchema(schema), void 0);
8568
8424
  }
8569
8425
  async function* refineArrowTableBatches(batches) {
8570
8426
  let schema;
8571
8427
  let bounds;
8572
- for await (const batch of batches) {
8573
- const table = batch;
8574
- if ((table == null ? void 0 : table.shape) !== "arrow-table") {
8575
- yield batch;
8576
- continue;
8577
- }
8578
- const localBounds = table.data.schema.metadata.get("boundingBox");
8579
- const nextSchema = snapshotArrowSchema(table.data.schema);
8428
+ for await (const table of batches) {
8429
+ const localBounds = table.schema.metadata.get("boundingBox");
8430
+ const nextSchema = snapshotArrowSchema(table.schema);
8580
8431
  if (localBounds) {
8581
8432
  const nextBounds = JSON.parse(localBounds);
8582
8433
  bounds = bounds ? [
@@ -8586,18 +8437,18 @@ async function* refineArrowTableBatches(batches) {
8586
8437
  nextSchema.metadata.set("boundingBox", JSON.stringify(bounds));
8587
8438
  }
8588
8439
  schema = mergeArrowSchemas(schema, nextSchema);
8589
- const data = updateArrowTableSchema(table.data, schema);
8440
+ const data = updateArrowTableSchema(table, schema);
8590
8441
  if (localBounds) {
8591
8442
  for (const recordBatch of data.batches) recordBatch.metadata.set("boundingBox", localBounds);
8592
8443
  }
8593
- yield { ...table, data, schema: serializeArrowSchema(data.schema) };
8444
+ yield data;
8594
8445
  }
8595
8446
  }
8596
- var arrow3;
8447
+ var arrow2;
8597
8448
  var init_arrow_metadata = __esm({
8598
8449
  "../core/src/schema-utils/lib/arrow/arrow-metadata.ts"() {
8599
8450
  "use strict";
8600
- arrow3 = __toESM(require("apache-arrow"), 1);
8451
+ arrow2 = __toESM(require("apache-arrow"), 1);
8601
8452
  init_convert_arrow_schema();
8602
8453
  }
8603
8454
  });
@@ -8724,23 +8575,23 @@ var init_float16 = __esm({
8724
8575
  });
8725
8576
 
8726
8577
  // ../core/src/schema/categories/category-mesh.ts
8727
- var arrow4, meshArrowSchema, indexedMeshArrowSchema;
8578
+ var arrow3, meshArrowSchema, indexedMeshArrowSchema;
8728
8579
  var init_category_mesh = __esm({
8729
8580
  "../core/src/schema/categories/category-mesh.ts"() {
8730
8581
  "use strict";
8731
- arrow4 = __toESM(require("apache-arrow"), 1);
8732
- meshArrowSchema = new arrow4.Schema([
8733
- new arrow4.Field(
8582
+ arrow3 = __toESM(require("apache-arrow"), 1);
8583
+ meshArrowSchema = new arrow3.Schema([
8584
+ new arrow3.Field(
8734
8585
  "POSITION",
8735
- new arrow4.FixedSizeList(3, new arrow4.Field("value", new arrow4.Float32(), false)),
8586
+ new arrow3.FixedSizeList(3, new arrow3.Field("value", new arrow3.Float32(), false)),
8736
8587
  false
8737
8588
  )
8738
8589
  ]);
8739
- indexedMeshArrowSchema = new arrow4.Schema([
8590
+ indexedMeshArrowSchema = new arrow3.Schema([
8740
8591
  ...meshArrowSchema.fields,
8741
- new arrow4.Field(
8592
+ new arrow3.Field(
8742
8593
  "indices",
8743
- new arrow4.List(new arrow4.Field("item", new arrow4.Uint32(), false)),
8594
+ new arrow3.List(new arrow3.Field("item", new arrow3.Uint32(), false)),
8744
8595
  true
8745
8596
  )
8746
8597
  ]);
@@ -8758,11 +8609,11 @@ var init_schema = __esm({
8758
8609
 
8759
8610
  // ../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts
8760
8611
  function getFixedSizeListSize(vector) {
8761
- return vector.type instanceof arrow5.FixedSizeList ? vector.type.listSize : 1;
8612
+ return vector.type instanceof arrow4.FixedSizeList ? vector.type.listSize : 1;
8762
8613
  }
8763
8614
  function getFixedSizeListVector(typedArray, stride, logicalType) {
8764
8615
  const data = getFixedSizeListData(typedArray, stride, logicalType);
8765
- return new arrow5.Vector([data]);
8616
+ return new arrow4.Vector([data]);
8766
8617
  }
8767
8618
  function getFixedSizeListData(typedArray, stride, logicalType) {
8768
8619
  const listType = getFixedSizeListType(typedArray, stride, logicalType);
@@ -8770,13 +8621,13 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
8770
8621
  const storage = logicalType === "float16" && isNativeFloat16Array(typedArray) ? getFloat16Storage(typedArray) : typedArray;
8771
8622
  const buffers = {
8772
8623
  // valueOffsets: undefined,
8773
- [arrow5.BufferType.DATA]: storage
8624
+ [arrow4.BufferType.DATA]: storage
8774
8625
  // values
8775
8626
  // nullBitmap: undefined,
8776
8627
  // typeIds: undefined
8777
8628
  };
8778
- const nestedData = new arrow5.Data(nestedType, 0, storage.length, 0, buffers);
8779
- const data = new arrow5.Data(
8629
+ const nestedData = new arrow4.Data(nestedType, 0, storage.length, 0, buffers);
8630
+ const data = new arrow4.Data(
8780
8631
  listType,
8781
8632
  0,
8782
8633
  storage.length / stride,
@@ -8789,22 +8640,22 @@ function getFixedSizeListData(typedArray, stride, logicalType) {
8789
8640
  function getFixedSizeListType(typedArray, stride, logicalType) {
8790
8641
  const type = logicalType || getDataTypeFromArray(typedArray).type;
8791
8642
  const arrowType = deserializeArrowType(type);
8792
- const listType = new arrow5.FixedSizeList(stride, new arrow5.Field("value", arrowType, false));
8643
+ const listType = new arrow4.FixedSizeList(stride, new arrow4.Field("value", arrowType, false));
8793
8644
  return listType;
8794
8645
  }
8795
- var arrow5;
8646
+ var arrow4;
8796
8647
  var init_arrow_fixed_size_list_utils = __esm({
8797
8648
  "../core/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts"() {
8798
8649
  "use strict";
8799
8650
  init_schema();
8800
- arrow5 = __toESM(require("apache-arrow"), 1);
8651
+ arrow4 = __toESM(require("apache-arrow"), 1);
8801
8652
  init_data_type();
8802
8653
  init_convert_arrow_schema();
8803
8654
  }
8804
8655
  });
8805
8656
 
8806
8657
  // ../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts
8807
- function convertMeshToArrowTableWrapper(mesh, batchSize) {
8658
+ function convertMeshToArrowTable(mesh) {
8808
8659
  var _a;
8809
8660
  return makeMeshArrowTable(mesh.attributes, {
8810
8661
  schema: mesh.schema,
@@ -8827,35 +8678,27 @@ function makeMeshArrowTable(attributes, options = {}) {
8827
8678
  fields.push(
8828
8679
  getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
8829
8680
  );
8830
- if (attributeName === "POSITION" && ((_b = (_a = options.indices) == null ? void 0 : _a.value) == null ? void 0 : _b.length)) {
8681
+ if (attributeName === attributeNames[0] && ((_b = (_a = options.indices) == null ? void 0 : _a.value) == null ? void 0 : _b.length)) {
8831
8682
  const indicesField = indexedMeshArrowSchema.fields.find((field) => field.name === "indices");
8832
8683
  columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
8833
8684
  fields.push(indicesField);
8834
8685
  }
8835
8686
  }
8836
- const arrowSchema = new arrow6.Schema(fields, getMeshArrowMetadata(options));
8837
- const table = ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow6.Table(arrowSchema) : new arrow6.Table(arrowSchema, columns);
8838
- const schema = serializeArrowSchema(table.schema);
8839
- return {
8840
- shape: "arrow-table",
8841
- schema,
8842
- data: table,
8843
- topology: options.topology || "point-list",
8844
- indices: options.indices
8845
- };
8687
+ const arrowSchema = new arrow5.Schema(fields, getMeshArrowMetadata(options));
8688
+ return ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow5.Table(arrowSchema) : new arrow5.Table(arrowSchema, columns);
8846
8689
  }
8847
8690
  function getAttributeArrowVector(value, size, componentType) {
8848
8691
  if (componentType === "float16") {
8849
8692
  const storage = isNativeFloat16Array(value) ? getFloat16Storage(value) : value;
8850
8693
  if (size === 1) {
8851
- const data = new arrow6.Data(new arrow6.Float16(), 0, storage.length, 0, {
8852
- [arrow6.BufferType.DATA]: storage
8694
+ const data = new arrow5.Data(new arrow5.Float16(), 0, storage.length, 0, {
8695
+ [arrow5.BufferType.DATA]: storage
8853
8696
  });
8854
- return new arrow6.Vector([data]);
8697
+ return new arrow5.Vector([data]);
8855
8698
  }
8856
8699
  return getFixedSizeListVector(value, size, componentType);
8857
8700
  }
8858
- return size === 1 ? arrow6.makeVector(value) : getFixedSizeListVector(value, size);
8701
+ return size === 1 ? arrow5.makeVector(value) : getFixedSizeListVector(value, size);
8859
8702
  }
8860
8703
  function getOrderedAttributeNames(attributes) {
8861
8704
  const attributeNames = Object.keys(attributes);
@@ -8882,7 +8725,7 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
8882
8725
  for (const [key, value] of Object.entries(suppliedField.metadata)) {
8883
8726
  metadata3.set(key, value);
8884
8727
  }
8885
- return new arrow6.Field(
8728
+ return new arrow5.Field(
8886
8729
  canonicalField.name,
8887
8730
  canonicalField.type,
8888
8731
  canonicalField.nullable,
@@ -8893,21 +8736,21 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
8893
8736
  if (componentType === "float16") {
8894
8737
  const metadata3 = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
8895
8738
  metadata3.set("componentType", "float16");
8896
- return new arrow6.Field(attributeName, column.type, false, metadata3);
8739
+ return new arrow5.Field(attributeName, column.type, false, metadata3);
8897
8740
  }
8898
8741
  if (field && field.type.toString() !== column.type.toString()) {
8899
8742
  const deserializedField = deserializeArrowField(field);
8900
- return new arrow6.Field(
8743
+ return new arrow5.Field(
8901
8744
  attributeName,
8902
8745
  column.type,
8903
8746
  deserializedField.nullable,
8904
8747
  deserializedField.metadata
8905
8748
  );
8906
8749
  }
8907
- return field ? deserializeArrowField(field) : new arrow6.Field(attributeName, column.type, false);
8750
+ return field ? deserializeArrowField(field) : new arrow5.Field(attributeName, column.type, false);
8908
8751
  }
8909
8752
  function isMeshPositionColumn(column) {
8910
- return column.type instanceof arrow6.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow6.Float32;
8753
+ return column.type instanceof arrow5.FixedSizeList && column.type.listSize === 3 && column.type.children[0].type instanceof arrow5.Float32;
8911
8754
  }
8912
8755
  function getIndicesVector(indices, vertexCount, type) {
8913
8756
  const indicesType = type;
@@ -8920,25 +8763,25 @@ function getIndicesVector(indices, vertexCount, type) {
8920
8763
  if (vertexCount > 0) {
8921
8764
  nullBitmap[0] = 1;
8922
8765
  }
8923
- const valuesData = new arrow6.Data(
8766
+ const valuesData = new arrow5.Data(
8924
8767
  indicesType.children[0].type,
8925
8768
  0,
8926
8769
  values.length,
8927
8770
  0,
8928
- { [arrow6.BufferType.DATA]: values }
8771
+ { [arrow5.BufferType.DATA]: values }
8929
8772
  );
8930
- const indicesData = new arrow6.Data(
8773
+ const indicesData = new arrow5.Data(
8931
8774
  indicesType,
8932
8775
  0,
8933
8776
  vertexCount,
8934
8777
  Math.max(0, vertexCount - 1),
8935
8778
  {
8936
- [arrow6.BufferType.OFFSET]: valueOffsets,
8937
- [arrow6.BufferType.VALIDITY]: nullBitmap
8779
+ [arrow5.BufferType.OFFSET]: valueOffsets,
8780
+ [arrow5.BufferType.VALIDITY]: nullBitmap
8938
8781
  },
8939
8782
  [valuesData]
8940
8783
  );
8941
- return new arrow6.Vector([indicesData]);
8784
+ return new arrow5.Vector([indicesData]);
8942
8785
  }
8943
8786
  function getMeshArrowMetadata(options) {
8944
8787
  var _a;
@@ -8954,13 +8797,13 @@ function getMeshArrowMetadata(options) {
8954
8797
  }
8955
8798
  return deserializeArrowMetadata(metadata3);
8956
8799
  }
8957
- var arrow6, MESH_ARROW_ATTRIBUTE_ORDER;
8800
+ var arrow5, MESH_ARROW_ATTRIBUTE_ORDER;
8958
8801
  var init_convert_mesh_to_table = __esm({
8959
8802
  "../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts"() {
8960
8803
  "use strict";
8961
8804
  init_schema();
8962
8805
  init_schema();
8963
- arrow6 = __toESM(require("apache-arrow"), 1);
8806
+ arrow5 = __toESM(require("apache-arrow"), 1);
8964
8807
  init_arrow_fixed_size_list_utils();
8965
8808
  init_convert_arrow_schema();
8966
8809
  MESH_ARROW_ATTRIBUTE_ORDER = ["POSITION"];
@@ -8969,19 +8812,11 @@ var init_convert_mesh_to_table = __esm({
8969
8812
 
8970
8813
  // ../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts
8971
8814
  function convertTableToMesh(table) {
8972
- if (isNativeArrowTable(table)) return convertArrowTableToMesh(table);
8973
- switch (table.shape) {
8974
- // case 'columnar-table':
8975
- // return convertColumnarTableToMesh(table);
8976
- case "arrow-table":
8977
- return convertArrowTableToMesh(table);
8978
- default:
8979
- throw new Error(table.shape);
8980
- }
8815
+ if (isArrowTable(table)) return convertArrowTableToMesh(table);
8816
+ throw new Error(table.shape);
8981
8817
  }
8982
- function convertArrowTableToMesh(table) {
8818
+ function convertArrowTableToMesh(arrowTable) {
8983
8819
  var _a, _b;
8984
- const arrowTable = isNativeArrowTable(table) ? table : table.data;
8985
8820
  const schema = serializeArrowSchema(arrowTable.schema);
8986
8821
  const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
8987
8822
  if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
@@ -9083,16 +8918,21 @@ function fixMetadata(schema) {
9083
8918
  schema.metadata.mode ||= "0";
9084
8919
  }
9085
8920
  function getAttributeTypedArray(attributeData, size) {
9086
- if (!(attributeData.type instanceof arrow7.FixedSizeList)) {
8921
+ if (!(attributeData.type instanceof arrow6.FixedSizeList)) {
9087
8922
  return attributeData.toArray();
9088
8923
  }
9089
- const values = attributeData.data[0].children[0].values;
8924
+ if (attributeData.length === 0) {
8925
+ const EmptyStorage = attributeData.type.valueType.ArrayType;
8926
+ return new EmptyStorage(0);
8927
+ }
8928
+ const values = attributeData.data.find((chunk) => chunk.length > 0).children[0].values;
9090
8929
  const TypedArrayConstructor = values.constructor;
9091
8930
  const typedArray = new TypedArrayConstructor(attributeData.length * size);
9092
8931
  let targetOffset = 0;
9093
8932
  for (const data of attributeData.data) {
9094
- const child = data.children[0];
9095
8933
  const sourceLength = data.length * size;
8934
+ if (sourceLength === 0) continue;
8935
+ const child = data.children[0];
9096
8936
  const sourceOffset = child.offset || data.offset * size;
9097
8937
  const sourceStart = sourceOffset + sourceLength <= child.values.length ? sourceOffset : 0;
9098
8938
  const source = child.values.subarray(sourceStart, sourceStart + sourceLength);
@@ -9134,12 +8974,12 @@ function shareArrowStorage(left, right) {
9134
8974
  );
9135
8975
  }) && left.children.length === right.children.length && left.children.every((child, index) => shareArrowStorage(child, right.children[index]));
9136
8976
  }
9137
- var arrow7;
8977
+ var arrow6;
9138
8978
  var init_convert_table_to_mesh = __esm({
9139
8979
  "../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts"() {
9140
8980
  "use strict";
9141
8981
  init_schema();
9142
- arrow7 = __toESM(require("apache-arrow"), 1);
8982
+ arrow6 = __toESM(require("apache-arrow"), 1);
9143
8983
  init_arrow_fixed_size_list_utils();
9144
8984
  init_convert_arrow_schema();
9145
8985
  init_native_arrow();
@@ -9213,6 +9053,76 @@ var init_schema_utils = __esm({
9213
9053
  }
9214
9054
  });
9215
9055
 
9056
+ // ../core/src/arrow-worker-transport.ts
9057
+ function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
9058
+ const batch = result instanceof arrow7.RecordBatch;
9059
+ if (!batch && !(result instanceof arrow7.Table)) {
9060
+ throw new Error("Workers require Arrow table output");
9061
+ }
9062
+ return {
9063
+ transport: batch ? "arrow-record-batch" : "arrow-table-columns",
9064
+ columns: batch ? { data: (0, import_arrow.dehydrateArrowRecordBatch)(result, options) } : serializeWorkerColumns(result, options)
9065
+ };
9066
+ }
9067
+ function deserializeNativeArrowWorkerResult(result) {
9068
+ const payload = result;
9069
+ if ((payload == null ? void 0 : payload.transport) !== "arrow-table-columns" && (payload == null ? void 0 : payload.transport) !== "arrow-record-batch" || !hasArrowWorkerColumns(payload.columns)) {
9070
+ throw new Error("Workers require Arrow column transport");
9071
+ }
9072
+ if (payload.transport === "arrow-record-batch" && !payload.columns.arrowBatchMetadata) {
9073
+ return (0, import_arrow.hydrateArrowRecordBatch)(payload.columns.data);
9074
+ }
9075
+ const data = hydrateWorkerTable(payload.columns);
9076
+ return payload.transport === "arrow-record-batch" ? data.batches[0] : data;
9077
+ }
9078
+ function serializeArrowWorkerResult(result, options) {
9079
+ var _a;
9080
+ const workerOptions = options;
9081
+ const copy = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
9082
+ return result instanceof arrow7.Table || result instanceof arrow7.RecordBatch ? serializeNativeArrowWorkerResult(result, { copy: copy ?? "all" }) : result;
9083
+ }
9084
+ function deserializeArrowWorkerResult(result) {
9085
+ const transport = result == null ? void 0 : result.transport;
9086
+ return transport === "arrow-table-columns" || transport === "arrow-record-batch" ? deserializeNativeArrowWorkerResult(result) : result;
9087
+ }
9088
+ function hasArrowWorkerColumns(value) {
9089
+ var _a;
9090
+ const columns = value;
9091
+ return ((_a = columns == null ? void 0 : columns.data) == null ? void 0 : _a.transport) === "arrow-js" && Array.isArray(columns.data.batches);
9092
+ }
9093
+ function serializeWorkerColumns(table, options) {
9094
+ return {
9095
+ arrowBatchMetadata: snapshotBatchMetadata(table),
9096
+ data: (0, import_arrow.dehydrateArrowTable)(table, options)
9097
+ };
9098
+ }
9099
+ function snapshotBatchMetadata(table) {
9100
+ return table.batches.map((batch) => ({
9101
+ schema: arrow7.tableToIPC(new arrow7.Table(batch.schema, []))
9102
+ }));
9103
+ }
9104
+ function hydrateWorkerTable(result) {
9105
+ const { arrowBatchMetadata, data } = result;
9106
+ const table = (0, import_arrow.hydrateArrowTable)(data);
9107
+ const batches = table.batches.map((batch, index) => {
9108
+ const snapshot = arrowBatchMetadata == null ? void 0 : arrowBatchMetadata[index];
9109
+ return snapshot ? (0, import_arrow.createRecordBatchWithMetadata)(
9110
+ arrow7.tableFromIPC(snapshot.schema).schema,
9111
+ batch.data,
9112
+ snapshot.metadata ? new Map(snapshot.metadata) : (0, import_arrow.getRecordBatchMetadata)(batch)
9113
+ ) : batch;
9114
+ });
9115
+ return new arrow7.Table(table.schema, batches);
9116
+ }
9117
+ var arrow7, import_arrow;
9118
+ var init_arrow_worker_transport = __esm({
9119
+ "../core/src/arrow-worker-transport.ts"() {
9120
+ "use strict";
9121
+ arrow7 = __toESM(require("apache-arrow"), 1);
9122
+ import_arrow = require("@math.gl/arrow");
9123
+ }
9124
+ });
9125
+
9216
9126
  // ../scene/src/obj/lib/get-obj-schema.ts
9217
9127
  function getOBJSchema(attributes, metadata3 = {}) {
9218
9128
  const stringMetadata = {};
@@ -9693,12 +9603,11 @@ var init_parse_obj = __esm({
9693
9603
  // ../scene/src/obj/obj-loader.ts
9694
9604
  var obj_loader_exports = {};
9695
9605
  __export(obj_loader_exports, {
9696
- OBJColumnLoader: () => OBJColumnLoader,
9697
9606
  OBJLoaderWithParser: () => OBJLoaderWithParser
9698
9607
  });
9699
9608
  function convertOBJMesh(mesh, options) {
9700
9609
  var _a;
9701
- const table = convertMeshToArrowTableWrapper(mesh);
9610
+ const table = convertMeshToArrowTable(mesh);
9702
9611
  return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertTableToMesh(table) : table;
9703
9612
  }
9704
9613
  function getNumericBatchSize(options) {
@@ -9712,11 +9621,11 @@ function hasOBJGeometryRecords(text) {
9712
9621
  return trimmedLine.startsWith("f ") || trimmedLine.startsWith("l ");
9713
9622
  });
9714
9623
  }
9715
- function* parseOBJPointCloudInBatches(text, options, batchSize) {
9624
+ function* parseOBJPointCloudInBatches(text, batchSize) {
9716
9625
  const vertexLines = text.split(/\r?\n/).filter((line) => line.trimStart().startsWith("v "));
9717
- yield* makeOBJPointCloudBatches(vertexLines, options, batchSize);
9626
+ yield* makeOBJPointCloudBatches(vertexLines, batchSize);
9718
9627
  }
9719
- async function* parseOBJPointCloudLinesInBatches(lines, options, batchSize) {
9628
+ async function* parseOBJPointCloudLinesInBatches(lines, batchSize) {
9720
9629
  const normalizedBatchSize = batchSize || 1e3;
9721
9630
  let vertexLines = [];
9722
9631
  for await (const line of lines) {
@@ -9725,21 +9634,21 @@ async function* parseOBJPointCloudLinesInBatches(lines, options, batchSize) {
9725
9634
  }
9726
9635
  vertexLines.push(line);
9727
9636
  if (vertexLines.length >= normalizedBatchSize) {
9728
- yield makeOBJBatch(parseOBJPointCloudMesh(vertexLines), options);
9637
+ yield convertMeshToArrowTable(parseOBJPointCloudMesh(vertexLines));
9729
9638
  vertexLines = [];
9730
9639
  }
9731
9640
  }
9732
9641
  if (vertexLines.length > 0) {
9733
- yield makeOBJBatch(parseOBJPointCloudMesh(vertexLines), options);
9642
+ yield convertMeshToArrowTable(parseOBJPointCloudMesh(vertexLines));
9734
9643
  }
9735
9644
  }
9736
- function* makeOBJPointCloudBatches(vertexLines, options, batchSize) {
9645
+ function* makeOBJPointCloudBatches(vertexLines, batchSize) {
9737
9646
  const normalizedBatchSize = batchSize || vertexLines.length || 1;
9738
9647
  for (let rowIndex = 0; rowIndex < vertexLines.length; rowIndex += normalizedBatchSize) {
9739
9648
  const mesh = parseOBJPointCloudMesh(
9740
9649
  vertexLines.slice(rowIndex, rowIndex + normalizedBatchSize)
9741
9650
  );
9742
- yield makeOBJBatch(mesh, options);
9651
+ yield convertMeshToArrowTable(mesh);
9743
9652
  }
9744
9653
  }
9745
9654
  function parseOBJPointCloudMesh(vertexLines) {
@@ -9774,31 +9683,20 @@ function parseOBJPointCloudMesh(vertexLines) {
9774
9683
  attributes
9775
9684
  };
9776
9685
  }
9777
- function makeOBJBatch(mesh, options) {
9778
- var _a, _b;
9779
- const table = convertMeshToArrowTableWrapper(mesh);
9780
- if (((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh") {
9781
- const convertedMesh = convertTableToMesh(table);
9782
- return {
9783
- shape: "mesh",
9784
- batchType: "data",
9785
- data: convertedMesh,
9786
- length: ((_b = convertedMesh.header) == null ? void 0 : _b.vertexCount) || 0
9787
- };
9788
- }
9789
- return makeTableScanBatch(table);
9686
+ function convertOBJBatchToMesh(table) {
9687
+ return { shape: "mesh", batchType: "data", data: convertTableToMesh(table), length: table.numRows };
9790
9688
  }
9791
9689
  function deserializeOBJWorkerResult(result, options) {
9792
9690
  var _a;
9793
- const table = deserializeArrowWorkerTable(result);
9691
+ const table = deserializeNativeArrowWorkerResult(result);
9692
+ if (!isArrowTable(table)) throw new Error("OBJ worker requires an Arrow table");
9794
9693
  return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertTableToMesh(table) : table;
9795
9694
  }
9796
9695
  function deserializeOBJWorkerBatch(result, options) {
9797
9696
  var _a;
9798
- const table = deserializeArrowWorkerTable(result);
9799
- if (((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) !== "mesh") return table;
9800
- const mesh = convertTableToMesh(table);
9801
- return { shape: "mesh", batchType: "data", data: mesh, length: table.length };
9697
+ const chunk = deserializeNativeArrowWorkerResult(result);
9698
+ const batch = isArrowTable(chunk) ? chunk.batches[0] ?? makeArrowMetadataBatch(chunk.schema) : chunk;
9699
+ return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertOBJBatchToMesh(new import_apache_arrow.Table(batch.schema, [batch])) : batch;
9802
9700
  }
9803
9701
  async function* parseOBJWithMetadataInBatches(arrayBuffer, options) {
9804
9702
  var _a;
@@ -9806,28 +9704,23 @@ async function* parseOBJWithMetadataInBatches(arrayBuffer, options) {
9806
9704
  if ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.pointCloud) {
9807
9705
  const textIterator = makeTextDecoderIterator(arrayBuffer);
9808
9706
  const lineIterator = makeLineIterator(textIterator);
9809
- yield* parseOBJPointCloudLinesInBatches(lineIterator, options, batchSize);
9707
+ yield* parseOBJPointCloudLinesInBatches(lineIterator, batchSize);
9810
9708
  return;
9811
9709
  }
9812
9710
  const data = await concatenateArrayBuffersAsync(arrayBuffer);
9813
9711
  const text = new TextDecoder().decode(data);
9814
9712
  if (hasOBJGeometryRecords(text)) {
9815
- yield makeOBJBatch(parseOBJ(text, options), options);
9713
+ yield convertMeshToArrowTable(parseOBJ(text, options));
9816
9714
  return;
9817
9715
  }
9818
- yield* parseOBJPointCloudInBatches(text, options, batchSize);
9819
- }
9820
- function unwrapOBJTable(result) {
9821
- if ("shape" in result && result.shape === "arrow-table") {
9822
- return result.data;
9823
- }
9824
- return result;
9716
+ yield* parseOBJPointCloudInBatches(text, batchSize);
9825
9717
  }
9826
- var _OBJLoaderPreload, OBJLoaderMetadataWithoutPreload, OBJColumnLoader, OBJLoaderWithParser;
9718
+ var import_apache_arrow, _OBJLoaderPreload, OBJLoaderMetadataWithoutPreload, OBJLoaderWithParser;
9827
9719
  var init_obj_loader = __esm({
9828
9720
  "../scene/src/obj/obj-loader.ts"() {
9829
9721
  "use strict";
9830
9722
  init_schema_utils();
9723
+ import_apache_arrow = require("apache-arrow");
9831
9724
  init_loader_utils();
9832
9725
  init_arrow_worker_transport();
9833
9726
  init_schema_utils();
@@ -9835,37 +9728,24 @@ var init_obj_loader = __esm({
9835
9728
  init_parse_obj();
9836
9729
  init_obj_loader_types();
9837
9730
  ({ preload: _OBJLoaderPreload, ...OBJLoaderMetadataWithoutPreload } = OBJLoader);
9838
- OBJColumnLoader = {
9731
+ OBJLoaderWithParser = {
9839
9732
  ...OBJLoaderMetadataWithoutPreload,
9840
- dataType: null,
9841
- batchType: null,
9842
9733
  parse: async (arrayBuffer, options) => convertOBJMesh(parseOBJ(new TextDecoder().decode(arrayBuffer), options), options),
9843
9734
  parseTextSync: (text, options) => convertOBJMesh(parseOBJ(text, options), options),
9844
- parseInBatches: (input, options) => refineArrowTableBatches(parseOBJWithMetadataInBatches(input, options)),
9845
- serializeWorkerResult: serializeArrowWorkerTable,
9846
- deserializeWorkerResult: deserializeOBJWorkerResult,
9847
- serializeWorkerBatch: serializeArrowWorkerTable,
9848
- deserializeWorkerBatch: deserializeOBJWorkerBatch
9849
- };
9850
- OBJLoaderWithParser = {
9851
- ...OBJColumnLoader,
9852
- dataType: OBJLoader.dataType,
9853
- batchType: OBJLoader.batchType,
9854
- parse: async (input, options) => unwrapOBJTable(await OBJColumnLoader.parse(input, options)),
9855
- parseTextSync: (input, options) => unwrapOBJTable(OBJColumnLoader.parseTextSync(input, options)),
9856
9735
  async *parseInBatches(input, options) {
9857
- for await (const batch of OBJColumnLoader.parseInBatches(input, options)) {
9858
- if ("shape" in batch && batch.shape === "arrow-table") {
9859
- if (batch.data.batches.length) yield* batch.data.batches;
9860
- else yield makeArrowMetadataBatch(batch.data.schema);
9861
- } else yield batch;
9736
+ var _a;
9737
+ for await (const chunk of refineArrowTableBatches(
9738
+ parseOBJWithMetadataInBatches(input, options)
9739
+ )) {
9740
+ if (((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh") yield convertOBJBatchToMesh(chunk);
9741
+ else if (chunk.batches.length) yield* chunk.batches;
9742
+ else yield makeArrowMetadataBatch(chunk.schema);
9862
9743
  }
9863
9744
  },
9864
- deserializeWorkerResult: (result, options) => unwrapOBJTable(OBJColumnLoader.deserializeWorkerResult(result, options)),
9865
- deserializeWorkerBatch(result, options) {
9866
- const batch = OBJColumnLoader.deserializeWorkerBatch(result, options);
9867
- return "shape" in batch && batch.shape === "arrow-table" ? batch.data.batches[0] ?? makeArrowMetadataBatch(batch.data.schema) : batch;
9868
- }
9745
+ serializeWorkerResult: (result) => serializeNativeArrowWorkerResult(result),
9746
+ deserializeWorkerResult: deserializeOBJWorkerResult,
9747
+ serializeWorkerBatch: (batch) => serializeNativeArrowWorkerResult(batch),
9748
+ deserializeWorkerBatch: deserializeOBJWorkerBatch
9869
9749
  };
9870
9750
  }
9871
9751
  });
@@ -9883,7 +9763,6 @@ var init_obj_loader_types = __esm({
9883
9763
  "../scene/src/obj/obj-loader-types.ts"() {
9884
9764
  "use strict";
9885
9765
  init_obj_format();
9886
- init_arrow_worker_transport();
9887
9766
  VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9888
9767
  OBJLoader = {
9889
9768
  defaultShape: "arrow",
@@ -9895,7 +9774,6 @@ var init_obj_loader_types = __esm({
9895
9774
  worker: true,
9896
9775
  /** Enables the stateful input/output batch protocol on the built-in worker. */
9897
9776
  workerInBatches: true,
9898
- serializeWorkerResult: serializeArrowWorkerTable,
9899
9777
  text: true,
9900
9778
  testText: testOBJFile,
9901
9779
  options: {
@@ -10129,7 +10007,7 @@ function normalizeMeshArrowTable(data) {
10129
10007
  if (!("attributes" in data)) {
10130
10008
  return data;
10131
10009
  }
10132
- return convertMeshToArrowTableWrapper(data);
10010
+ return convertMeshToArrowTable(data);
10133
10011
  }
10134
10012
  function getRequiredAttribute(mesh, attributeName) {
10135
10013
  const attribute = mesh.attributes[attributeName];
@@ -15770,7 +15648,7 @@ async function parseDraco(arrayBuffer, options, loadDecoderModule, context) {
15770
15648
  const mesh = dracoParser.parseSync(arrayBuffer, options == null ? void 0 : options.draco);
15771
15649
  reportProgress == null ? void 0 : reportProgress({ phase: "decode", completed: 1, total: 1, unit: "tasks" });
15772
15650
  if (((_b = options == null ? void 0 : options.draco) == null ? void 0 : _b.shape) === "arrow") {
15773
- return convertMeshToArrowTableWrapper(mesh).data;
15651
+ return convertMeshToArrowTable(mesh);
15774
15652
  }
15775
15653
  return mesh;
15776
15654
  } finally {
@@ -20436,7 +20314,7 @@ function throwIfAborted(signal) {
20436
20314
  throw error;
20437
20315
  }
20438
20316
  function normalizeDracoMesh(data) {
20439
- if (isMeshArrowTable(data) || isNativeArrowTable(data)) {
20317
+ if (isArrowTable(data)) {
20440
20318
  return convertTableToMesh(data);
20441
20319
  }
20442
20320
  if (isDracoBuilderMesh(data)) {
@@ -20445,9 +20323,6 @@ function normalizeDracoMesh(data) {
20445
20323
  const { indices, ...attributes } = data;
20446
20324
  return { attributes, ...indices ? { indices } : {} };
20447
20325
  }
20448
- function isMeshArrowTable(data) {
20449
- return typeof data === "object" && data !== null && "shape" in data && data.shape === "arrow-table";
20450
- }
20451
20326
  function isDracoBuilderMesh(data) {
20452
20327
  return typeof data === "object" && data !== null && "attributes" in data && typeof data.attributes === "object" && data.attributes !== null && !ArrayBuffer.isView(data.attributes);
20453
20328
  }
@@ -27501,7 +27376,6 @@ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attribut
27501
27376
  }
27502
27377
  attributes[attribute] = {
27503
27378
  value,
27504
- type: GL_TYPE_MAP[valueType],
27505
27379
  size: valuesPerElement
27506
27380
  };
27507
27381
  switch (attribute) {
@@ -27805,7 +27679,7 @@ var init_i3s_content_loader = __esm({
27805
27679
  "use strict";
27806
27680
  init_i3s_format();
27807
27681
  init_i3s_loader_options();
27808
- VERSION11 = true ? "5.0.0-beta.10" : "latest";
27682
+ VERSION11 = true ? "5.0.0-beta.11" : "latest";
27809
27683
  I3SContentLoader = {
27810
27684
  ...I3SContentFormat,
27811
27685
  dataType: null,
@@ -27834,7 +27708,7 @@ var init_i3s_node_page_loader = __esm({
27834
27708
  "dist/i3s/i3s-node-page-loader.js"() {
27835
27709
  "use strict";
27836
27710
  init_i3s_format();
27837
- VERSION12 = true ? "5.0.0-beta.10" : "latest";
27711
+ VERSION12 = true ? "5.0.0-beta.11" : "latest";
27838
27712
  I3SNodePageLoader = {
27839
27713
  ...I3SNodePageFormat,
27840
27714
  dataType: null,
@@ -28531,7 +28405,7 @@ var init_i3s_loader = __esm({
28531
28405
  init_i3s_format();
28532
28406
  init_i3s_content_loader();
28533
28407
  init_i3s_loader_options();
28534
- VERSION13 = true ? "5.0.0-beta.10" : "latest";
28408
+ VERSION13 = true ? "5.0.0-beta.11" : "latest";
28535
28409
  I3SLoader = {
28536
28410
  ...I3SFormat,
28537
28411
  dataType: null,
@@ -31499,7 +31373,7 @@ var init_i3s_slpk_loader = __esm({
31499
31373
  "dist/i3s/i3s-slpk-loader.js"() {
31500
31374
  "use strict";
31501
31375
  init_i3s_format();
31502
- VERSION15 = true ? "5.0.0-beta.10" : "latest";
31376
+ VERSION15 = true ? "5.0.0-beta.11" : "latest";
31503
31377
  SLPKLoader = {
31504
31378
  ...SLPKFormat,
31505
31379
  dataType: null,
@@ -31841,7 +31715,7 @@ var init_i3s_attribute_loader = __esm({
31841
31715
  "dist/i3s/i3s-attribute-loader.js"() {
31842
31716
  "use strict";
31843
31717
  init_i3s_format();
31844
- VERSION17 = true ? "5.0.0-beta.10" : "latest";
31718
+ VERSION17 = true ? "5.0.0-beta.11" : "latest";
31845
31719
  I3SAttributeLoader = {
31846
31720
  ...I3SAttributeFormat,
31847
31721
  dataType: null,
@@ -31933,7 +31807,7 @@ var init_i3s_building_scene_layer_loader = __esm({
31933
31807
  "dist/i3s/i3s-building-scene-layer-loader.js"() {
31934
31808
  "use strict";
31935
31809
  init_i3s_format();
31936
- VERSION18 = true ? "5.0.0-beta.10" : "latest";
31810
+ VERSION18 = true ? "5.0.0-beta.11" : "latest";
31937
31811
  I3SBuildingSceneLayerLoader = {
31938
31812
  ...I3SBuildingSceneLayerFormat,
31939
31813
  dataType: null,
@@ -32071,7 +31945,7 @@ var init_arcgis_webscene_loader = __esm({
32071
31945
  "dist/i3s/arcgis-webscene-loader.js"() {
32072
31946
  "use strict";
32073
31947
  init_i3s_format();
32074
- VERSION19 = true ? "5.0.0-beta.10" : "latest";
31948
+ VERSION19 = true ? "5.0.0-beta.11" : "latest";
32075
31949
  ArcGISWebSceneLoader = {
32076
31950
  ...ArcGISWebSceneFormat,
32077
31951
  dataType: null,
@@ -32251,7 +32125,7 @@ init_i3s_loader();
32251
32125
  // dist/i3s/i3s-slpk-writer.js
32252
32126
  init_indexed_zip_writer();
32253
32127
  init_i3s_format();
32254
- var VERSION14 = true ? "5.0.0-beta.10" : "latest";
32128
+ var VERSION14 = true ? "5.0.0-beta.11" : "latest";
32255
32129
  var MAX_ARCHIVE_BYTES = 2147483647;
32256
32130
  var SLPKWriter = {
32257
32131
  ...SLPKFormat,
@@ -32323,7 +32197,7 @@ init_i3s_content_loader();
32323
32197
 
32324
32198
  // dist/i3s/i3s-lepcc-loader-types.js
32325
32199
  init_i3s_format();
32326
- var VERSION16 = true ? "5.0.0-beta.10" : "latest";
32200
+ var VERSION16 = true ? "5.0.0-beta.11" : "latest";
32327
32201
  var I3SLEPCCLoader = {
32328
32202
  ...I3SLEPCCFormat,
32329
32203
  dataType: null,
@@ -33645,8 +33519,8 @@ init_schema_utils();
33645
33519
  function encodeI3SMeshAttributes(features, maxResourceBytes) {
33646
33520
  var _a;
33647
33521
  const batches = (features == null ? void 0 : features.batches) || [];
33648
- const schema = (_a = batches[0]) == null ? void 0 : _a.schema;
33649
- const count = batches.reduce((total, batch) => total + batch.data.numRows, 0);
33522
+ const schema = ((_a = batches[0]) == null ? void 0 : _a.schema) && convertArrowToSchema(batches[0].schema);
33523
+ const count = batches.reduce((total, batch) => total + batch.numRows, 0);
33650
33524
  if (features && (!schema || count === 0 || !schema.fields.length)) {
33651
33525
  throw new Error("I3S features require nonempty explicit-schema Arrow batches");
33652
33526
  }
@@ -33667,13 +33541,10 @@ function encodeI3SMeshAttributes(features, maxResourceBytes) {
33667
33541
  }
33668
33542
  const identifiers = /* @__PURE__ */ new Set();
33669
33543
  for (const batch of batches) {
33670
- if (JSON.stringify(batch.schema) !== JSON.stringify(schema) || batch.length !== batch.data.numRows) {
33671
- throw new Error("I3S feature batches must share an explicit schema and correct row counts");
33544
+ if (JSON.stringify(convertArrowToSchema(batch.schema)) !== JSON.stringify(schema)) {
33545
+ throw new Error("I3S feature batches must share an explicit schema");
33672
33546
  }
33673
- const actualFields = convertArrowToSchema(batch.data.schema).fields;
33674
- if (JSON.stringify(actualFields.map((field) => [field.name, field.type])) !== JSON.stringify(schema.fields.map((field) => [field.name, field.type])))
33675
- throw new Error("I3S declared feature schema must match the Arrow column types");
33676
- const column = batch.data.getChild(features.featureIdField);
33547
+ const column = batch.getChild(features.featureIdField);
33677
33548
  if (!column)
33678
33549
  throw new Error("Missing Arrow feature identifier column");
33679
33550
  for (let index = 0; index < column.length; index++) {
@@ -33689,7 +33560,7 @@ function encodeI3SMeshAttributes(features, maxResourceBytes) {
33689
33560
  throw new Error("I3S fields require unique identifiers other than reserved OBJECTID");
33690
33561
  }
33691
33562
  const values = batches.flatMap((batch) => {
33692
- const column = batch.data.getChild(field.name);
33563
+ const column = batch.getChild(field.name);
33693
33564
  if (!column)
33694
33565
  throw new Error(`Missing Arrow column ${field.name}`);
33695
33566
  return Array.from({ length: column.length }, (_, index) => column.get(index));
@@ -33871,7 +33742,7 @@ async function encodeI3SMeshLayerWithDraco(mesh, options, libraryOptions = {}) {
33871
33742
  return compressMeshLayer(prepared, maxResourceBytes);
33872
33743
  }
33873
33744
  function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
33874
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
33745
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
33875
33746
  if (!Number.isFinite(options.maxPositionError) || options.maxPositionError < 0 || !Number.isSafeInteger(options.maxResourceBytes) || options.maxResourceBytes < 1 || options.maxResourceBytes > 4294967294) {
33876
33747
  throw new Error("I3S mesh writing requires valid maxPositionError and maxResourceBytes");
33877
33748
  }
@@ -34023,11 +33894,12 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34023
33894
  }
34024
33895
  };
34025
33896
  const material = encodeMaterial(options.material);
33897
+ const featureClass = (_e = (_d = options.features) == null ? void 0 : _d.batches[0]) == null ? void 0 : _e.schema.metadata.get("loaders.gl:feature-class");
34026
33898
  const layer = {
34027
33899
  id: 0,
34028
33900
  version: "1",
34029
33901
  name: options.name || "Converted mesh",
34030
- description: ((_g = (_f = (_e = (_d = options.features) == null ? void 0 : _d.batches[0]) == null ? void 0 : _e.schema) == null ? void 0 : _f.metadata) == null ? void 0 : _g["loaders.gl:feature-class"]) ? `Source feature metadata class: ${options.features.batches[0].schema.metadata["loaders.gl:feature-class"]}` : void 0,
33902
+ description: featureClass ? `Source feature metadata class: ${featureClass}` : void 0,
34031
33903
  layerType: "3DObject",
34032
33904
  spatialReference: { wkid: 4326 },
34033
33905
  heightModelInfo: { heightModel: "ellipsoidal", heightUnit: "meter" },
@@ -34043,7 +33915,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34043
33915
  "3dNodeIndexDocument",
34044
33916
  "Geometry",
34045
33917
  "Attributes",
34046
- ...((_h = options.material) == null ? void 0 : _h.baseColorTexture) ? ["Texture"] : []
33918
+ ...((_f = options.material) == null ? void 0 : _f.baseColorTexture) ? ["Texture"] : []
34047
33919
  ],
34048
33920
  extent,
34049
33921
  indexCRS: "http://www.opengis.net/def/crs/EPSG/0/4326",
@@ -34054,7 +33926,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34054
33926
  nodePages: { rootIndex: 0, nodesPerPage: 64, lodSelectionMetricType: "maxScreenThresholdSQ" },
34055
33927
  geometryDefinitions: [{ topology: "triangle", geometryBuffers: [geometryBuffer] }],
34056
33928
  materialDefinitions: [material],
34057
- ...((_i = options.material) == null ? void 0 : _i.baseColorTexture) ? {
33929
+ ...((_g = options.material) == null ? void 0 : _g.baseColorTexture) ? {
34058
33930
  textureSetDefinitions: [
34059
33931
  {
34060
33932
  formats: [
@@ -34077,7 +33949,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34077
33949
  children: [],
34078
33950
  parentNode: { id: "root", href: "../root", mbs, obb },
34079
33951
  geometryData: [{ href: "./geometries/0" }],
34080
- ...((_j = options.material) == null ? void 0 : _j.baseColorTexture) ? { textureData: [{ href: "./textures/0" }] } : {},
33952
+ ...((_h = options.material) == null ? void 0 : _h.baseColorTexture) ? { textureData: [{ href: "./textures/0" }] } : {},
34081
33953
  attributeData: attributes.buffers.map((_, index) => ({ href: `./attributes/f_${index}/0` }))
34082
33954
  };
34083
33955
  const root = {
@@ -34099,7 +33971,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34099
33971
  lodThreshold: 0,
34100
33972
  children: [],
34101
33973
  mesh: {
34102
- material: { definition: 0, ...((_k = options.material) == null ? void 0 : _k.baseColorTexture) ? { resource: 1 } : {} },
33974
+ material: { definition: 0, ...((_i = options.material) == null ? void 0 : _i.baseColorTexture) ? { resource: 1 } : {} },
34103
33975
  geometry: { definition: 0, resource: 1, vertexCount: outputVertexCount, featureCount },
34104
33976
  attribute: { resource: 1 }
34105
33977
  }
@@ -34126,7 +33998,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
34126
33998
  const objectIdView = new DataView(objectIds);
34127
33999
  for (let index = 0; index < featureCount; index++)
34128
34000
  objectIdView.setUint32(4 + index * 4, objectIdOffset + index, true);
34129
- if ((_l = options.material) == null ? void 0 : _l.baseColorTexture) {
34001
+ if ((_j = options.material) == null ? void 0 : _j.baseColorTexture) {
34130
34002
  const texture = options.material.baseColorTexture;
34131
34003
  rawFiles[`nodes/1/textures/0.${texture.mimeType === "image/png" ? "png" : "jpg"}`] = new Uint8Array(texture.data).buffer;
34132
34004
  }