@molcrafts/molrs 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/molrs_bg.js CHANGED
@@ -28,7 +28,6 @@
28
28
  */
29
29
  export class Block {
30
30
  static __wrap(ptr) {
31
- ptr = ptr >>> 0;
32
31
  const obj = Object.create(Block.prototype);
33
32
  obj.__wbg_ptr = ptr;
34
33
  BlockFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -368,7 +367,7 @@ export class Block {
368
367
  if (ret[2]) {
369
368
  throw takeFromExternrefTable0(ret[1]);
370
369
  }
371
- this.__wbg_ptr = ret[0] >>> 0;
370
+ this.__wbg_ptr = ret[0];
372
371
  BlockFinalization.register(this, this.__wbg_ptr, this);
373
372
  return this;
374
373
  }
@@ -555,6 +554,71 @@ export class Block {
555
554
  throw takeFromExternrefTable0(ret[0]);
556
555
  }
557
556
  }
557
+ /**
558
+ * Declare this block as N-dimensional with the given `shape`.
559
+ *
560
+ * `shape.iter().product()` must equal the block's current `nrows`
561
+ * when the block has columns. Pass an empty array to clear the
562
+ * shape and revert to plain row-table semantics.
563
+ *
564
+ * This does **not** reshape column storage — columns remain
565
+ * row-major 1D buffers of length `product(shape)`. `shape` is
566
+ * structural metadata; consumers (e.g. the volumetric renderer in
567
+ * MolVis) use it to unflatten the row index back into N-D
568
+ * coordinates.
569
+ *
570
+ * # Errors
571
+ *
572
+ * Throws if `shape.iter().product()` does not match the block's
573
+ * existing `nrows`, or if the block handle has been invalidated.
574
+ *
575
+ * # Example (JavaScript)
576
+ *
577
+ * ```js
578
+ * const grid = frame.createBlock("grid");
579
+ * grid.setColF("electron_density", values); // values.length === 32*32*32
580
+ * grid.setShape(new Uint32Array([32, 32, 32]));
581
+ * ```
582
+ * @param {Uint32Array} shape
583
+ */
584
+ setShape(shape) {
585
+ const ret = wasm.block_setShape(this.__wbg_ptr, shape);
586
+ if (ret[1]) {
587
+ throw takeFromExternrefTable0(ret[0]);
588
+ }
589
+ }
590
+ /**
591
+ * Return the structural shape of the block as a `Uint32Array`.
592
+ *
593
+ * - Plain row tables (atoms, bonds): `[nrows]` — single-axis.
594
+ * - Volumetric grids: `[Nx, Ny, Nz]` — explicitly declared via
595
+ * [`setShape`](Self::set_shape).
596
+ * - Empty blocks: `[]`.
597
+ *
598
+ * `block.shape()` is uniform across all block kinds — the rank of
599
+ * the returned array is what distinguishes a plain table from a
600
+ * volumetric grid. The product of the shape always equals
601
+ * `block.nrows()`.
602
+ *
603
+ * # Errors
604
+ *
605
+ * Throws if the block handle has been invalidated.
606
+ *
607
+ * # Example (JavaScript)
608
+ *
609
+ * ```js
610
+ * const atomsShape = atoms.shape(); // Uint32Array([1000])
611
+ * const gridShape = grid.shape(); // Uint32Array([32, 32, 32])
612
+ * ```
613
+ * @returns {Uint32Array}
614
+ */
615
+ shape() {
616
+ const ret = wasm.block_shape(this.__wbg_ptr);
617
+ if (ret[2]) {
618
+ throw takeFromExternrefTable0(ret[1]);
619
+ }
620
+ return takeFromExternrefTable0(ret[0]);
621
+ }
558
622
  /**
559
623
  * Zero-copy JS float typed-array view into WASM linear memory.
560
624
  *
@@ -681,7 +745,6 @@ if (Symbol.dispose) Block.prototype[Symbol.dispose] = Block.prototype.free;
681
745
  */
682
746
  export class Box {
683
747
  static __wrap(ptr) {
684
- ptr = ptr >>> 0;
685
748
  const obj = Object.create(Box.prototype);
686
749
  obj.__wbg_ptr = ptr;
687
750
  BoxFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -845,22 +908,32 @@ export class Box {
845
908
  return WasmArray.__wrap(ret);
846
909
  }
847
910
  /**
848
- * Return the box edge lengths as a `WasmArray` with shape `[3]`.
849
- *
850
- * For orthorhombic boxes these are `[lx, ly, lz]`. For triclinic
851
- * boxes these are the lengths of the three cell vectors.
911
+ * Return the box's 3×3 cell matrix `h` as a `WasmArray` with shape
912
+ * `[9]`, **column-major** (column j of `h` is the j-th lattice
913
+ * vector). Suitable for direct consumption by `marchingCubes` and
914
+ * other code that expects the cell as a flat 3×3 column-major
915
+ * `Float64Array`.
852
916
  *
853
917
  * # Returns
854
918
  *
855
- * `WasmArray` containing `[lx, ly, lz]` in angstrom (A).
919
+ * `WasmArray` of length 9: `[h00, h10, h20, h01, h11, h21, h02, h12, h22]`,
920
+ * in angstrom (A).
856
921
  *
857
922
  * # Example (JavaScript)
858
923
  *
859
924
  * ```js
860
- * const L = box.lengths().toCopy(); // Float32Array or Float64Array [10, 10, 10]
925
+ * const cell = box.hMatrix().toCopy(); // Float64Array, length 9
926
+ * // col0 = a-vector = cell[0..3]
861
927
  * ```
862
928
  * @returns {WasmArray}
863
929
  */
930
+ hMatrix() {
931
+ const ret = wasm.box_hMatrix(this.__wbg_ptr);
932
+ return WasmArray.__wrap(ret);
933
+ }
934
+ /**
935
+ * @returns {WasmArray}
936
+ */
864
937
  lengths() {
865
938
  const ret = wasm.box_lengths(this.__wbg_ptr);
866
939
  return WasmArray.__wrap(ret);
@@ -907,7 +980,7 @@ export class Box {
907
980
  if (ret[2]) {
908
981
  throw takeFromExternrefTable0(ret[1]);
909
982
  }
910
- this.__wbg_ptr = ret[0] >>> 0;
983
+ this.__wbg_ptr = ret[0];
911
984
  BoxFinalization.register(this, this.__wbg_ptr, this);
912
985
  return this;
913
986
  }
@@ -973,6 +1046,40 @@ export class Box {
973
1046
  }
974
1047
  return Box.__wrap(ret[0]);
975
1048
  }
1049
+ /**
1050
+ * Return the box edge lengths as a `WasmArray` with shape `[3]`.
1051
+ *
1052
+ * For orthorhombic boxes these are `[lx, ly, lz]`. For triclinic
1053
+ * boxes these are the lengths of the three cell vectors.
1054
+ *
1055
+ * # Returns
1056
+ *
1057
+ * `WasmArray` containing `[lx, ly, lz]` in angstrom (A).
1058
+ *
1059
+ * # Example (JavaScript)
1060
+ *
1061
+ * ```js
1062
+ * const L = box.lengths().toCopy(); // Float32Array or Float64Array [10, 10, 10]
1063
+ * ```
1064
+ * Return the per-axis periodic boundary flags as a `Uint8Array`
1065
+ * of length 3 (`[px, py, pz]`, 1 = periodic, 0 = open).
1066
+ *
1067
+ * Renderers that respect PBC (isosurface marching cubes,
1068
+ * bond minimum-image, atom wrap-around) need this to decide
1069
+ * whether to wrap coordinates across the cell.
1070
+ *
1071
+ * # Example (JavaScript)
1072
+ *
1073
+ * ```js
1074
+ * const pbc = box.pbc(); // Uint8Array [1, 1, 1] for fully periodic
1075
+ * const fullyPeriodic = pbc[0] === 1 && pbc[1] === 1 && pbc[2] === 1;
1076
+ * ```
1077
+ * @returns {Uint8Array}
1078
+ */
1079
+ pbc() {
1080
+ const ret = wasm.box_pbc(this.__wbg_ptr);
1081
+ return ret;
1082
+ }
976
1083
  /**
977
1084
  * Return the box tilt factors as a `WasmArray` with shape `[3]`.
978
1085
  *
@@ -1227,6 +1334,212 @@ export class Box {
1227
1334
  }
1228
1335
  if (Symbol.dispose) Box.prototype[Symbol.dispose] = Box.prototype.free;
1229
1336
 
1337
+ /**
1338
+ * VASP CHGCAR / CHGDIF volumetric data reader.
1339
+ *
1340
+ * Reads VASP-format charge density files (extension-less canonical name
1341
+ * `CHGCAR` or `CHGCAR_*`). Produces a [`Frame`] with:
1342
+ * - `"atoms"` block: `element` (string), `x`/`y`/`z` (F, Cartesian Å).
1343
+ * - `"grid"` block: structural shape `[nx, ny, nz]`, columns
1344
+ * `total` (always) and `diff` (when ISPIN=2).
1345
+ * - `simbox`: triclinic POSCAR lattice in Å, fully periodic.
1346
+ *
1347
+ * CHGCAR is single-frame; only `step = 0` is valid.
1348
+ *
1349
+ * # Example (JavaScript)
1350
+ *
1351
+ * ```js
1352
+ * const content = await file.text();
1353
+ * const reader = new CHGCARReader(content);
1354
+ * const frame = reader.read(0);
1355
+ * const grid = frame.getBlock("grid");
1356
+ * const total = grid.copyColF("total");
1357
+ * ```
1358
+ */
1359
+ export class CHGCARReader {
1360
+ __destroy_into_raw() {
1361
+ const ptr = this.__wbg_ptr;
1362
+ this.__wbg_ptr = 0;
1363
+ CHGCARReaderFinalization.unregister(this);
1364
+ return ptr;
1365
+ }
1366
+ free() {
1367
+ const ptr = this.__destroy_into_raw();
1368
+ wasm.__wbg_chgcarreader_free(ptr, 0);
1369
+ }
1370
+ /**
1371
+ * @returns {boolean}
1372
+ */
1373
+ isEmpty() {
1374
+ const ret = wasm.chgcarreader_isEmpty(this.__wbg_ptr);
1375
+ if (ret[2]) {
1376
+ throw takeFromExternrefTable0(ret[1]);
1377
+ }
1378
+ return ret[0] !== 0;
1379
+ }
1380
+ /**
1381
+ * @returns {number}
1382
+ */
1383
+ len() {
1384
+ const ret = wasm.chgcarreader_len(this.__wbg_ptr);
1385
+ if (ret[2]) {
1386
+ throw takeFromExternrefTable0(ret[1]);
1387
+ }
1388
+ return ret[0] >>> 0;
1389
+ }
1390
+ /**
1391
+ * Create a new CHGCAR reader from the file's text content.
1392
+ * @param {string} content
1393
+ */
1394
+ constructor(content) {
1395
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1396
+ const len0 = WASM_VECTOR_LEN;
1397
+ const ret = wasm.chgcarreader_new(ptr0, len0);
1398
+ this.__wbg_ptr = ret;
1399
+ CHGCARReaderFinalization.register(this, this.__wbg_ptr, this);
1400
+ return this;
1401
+ }
1402
+ /**
1403
+ * Read the frame at `step`. CHGCAR is single-frame.
1404
+ *
1405
+ * # Errors
1406
+ *
1407
+ * Throws a `JsValue` string on parse errors.
1408
+ * @param {number} step
1409
+ * @returns {Frame | undefined}
1410
+ */
1411
+ read(step) {
1412
+ const ret = wasm.chgcarreader_read(this.__wbg_ptr, step);
1413
+ if (ret[2]) {
1414
+ throw takeFromExternrefTable0(ret[1]);
1415
+ }
1416
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
1417
+ }
1418
+ }
1419
+ if (Symbol.dispose) CHGCARReader.prototype[Symbol.dispose] = CHGCARReader.prototype.free;
1420
+
1421
+ /**
1422
+ * Crystallographic Information File (CIF / mmCIF) reader.
1423
+ *
1424
+ * Each `data_*` block in the file becomes one [`Frame`]. Most CIF files
1425
+ * contain a single block (one structure), but multi-block files (e.g.
1426
+ * polymorphs of the same compound) are also supported and are exposed
1427
+ * as a multi-frame sequence. The unit cell parameters
1428
+ * (`_cell_length_a`, `_b`, `_c`, `_cell_angle_alpha`, `_beta`,
1429
+ * `_gamma`) are converted to a 3x3 h-matrix on the Rust side and
1430
+ * surface on the JS side as `frame.simbox`.
1431
+ *
1432
+ * Produces a [`Frame`] with an `"atoms"` block containing
1433
+ * `element` (string), `x`, `y`, `z` (F, angstrom in Cartesian
1434
+ * coordinates) and (when present in the file) `label`, `occupancy`,
1435
+ * `bfactor` columns.
1436
+ *
1437
+ * CIF parsing reads the entire file on each `read(step)` call --
1438
+ * random access is therefore O(file_size), but typical CIF files are
1439
+ * small (< 1 MB) and the molvis lazy trajectory caches frames at the
1440
+ * JS level, so this is rarely a bottleneck.
1441
+ *
1442
+ * # Example (JavaScript)
1443
+ *
1444
+ * ```js
1445
+ * const content = await file.text();
1446
+ * const reader = new CIFReader(content);
1447
+ * const frame = reader.read(0);
1448
+ * const atoms = frame.getBlock("atoms");
1449
+ * const box = frame.simbox; // populated from the unit cell
1450
+ * ```
1451
+ */
1452
+ export class CIFReader {
1453
+ __destroy_into_raw() {
1454
+ const ptr = this.__wbg_ptr;
1455
+ this.__wbg_ptr = 0;
1456
+ CIFReaderFinalization.unregister(this);
1457
+ return ptr;
1458
+ }
1459
+ free() {
1460
+ const ptr = this.__destroy_into_raw();
1461
+ wasm.__wbg_cifreader_free(ptr, 0);
1462
+ }
1463
+ /**
1464
+ * Check whether the file contains no valid blocks.
1465
+ *
1466
+ * # Errors
1467
+ *
1468
+ * Throws a `JsValue` string on parse errors.
1469
+ * @returns {boolean}
1470
+ */
1471
+ isEmpty() {
1472
+ const ret = wasm.cifreader_isEmpty(this.__wbg_ptr);
1473
+ if (ret[2]) {
1474
+ throw takeFromExternrefTable0(ret[1]);
1475
+ }
1476
+ return ret[0] !== 0;
1477
+ }
1478
+ /**
1479
+ * Return the number of `data_*` blocks in the file.
1480
+ *
1481
+ * # Errors
1482
+ *
1483
+ * Throws a `JsValue` string on parse errors.
1484
+ * @returns {number}
1485
+ */
1486
+ len() {
1487
+ const ret = wasm.cifreader_len(this.__wbg_ptr);
1488
+ if (ret[2]) {
1489
+ throw takeFromExternrefTable0(ret[1]);
1490
+ }
1491
+ return ret[0] >>> 0;
1492
+ }
1493
+ /**
1494
+ * Create a new CIF reader from a string containing the file content.
1495
+ *
1496
+ * # Arguments
1497
+ *
1498
+ * * `content` - The full text content of a CIF file
1499
+ *
1500
+ * # Example (JavaScript)
1501
+ *
1502
+ * ```js
1503
+ * const reader = new CIFReader(cifString);
1504
+ * ```
1505
+ * @param {string} content
1506
+ */
1507
+ constructor(content) {
1508
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1509
+ const len0 = WASM_VECTOR_LEN;
1510
+ const ret = wasm.cifreader_new(ptr0, len0);
1511
+ this.__wbg_ptr = ret;
1512
+ CIFReaderFinalization.register(this, this.__wbg_ptr, this);
1513
+ return this;
1514
+ }
1515
+ /**
1516
+ * Read the frame at the given block index.
1517
+ *
1518
+ * # Arguments
1519
+ *
1520
+ * * `step` - 0-based index of the `data_*` block to return
1521
+ *
1522
+ * # Returns
1523
+ *
1524
+ * A [`Frame`] for the requested block, or `undefined` when
1525
+ * `step >= len()`.
1526
+ *
1527
+ * # Errors
1528
+ *
1529
+ * Throws a `JsValue` string on parse errors.
1530
+ * @param {number} step
1531
+ * @returns {Frame | undefined}
1532
+ */
1533
+ read(step) {
1534
+ const ret = wasm.cifreader_read(this.__wbg_ptr, step);
1535
+ if (ret[2]) {
1536
+ throw takeFromExternrefTable0(ret[1]);
1537
+ }
1538
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
1539
+ }
1540
+ }
1541
+ if (Symbol.dispose) CIFReader.prototype[Symbol.dispose] = CIFReader.prototype.free;
1542
+
1230
1543
  /**
1231
1544
  * Mass-weighted cluster center calculator.
1232
1545
  */
@@ -1266,7 +1579,7 @@ export class CenterOfMass {
1266
1579
  var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
1267
1580
  var len0 = WASM_VECTOR_LEN;
1268
1581
  const ret = wasm.centerofmass_new(ptr0, len0);
1269
- this.__wbg_ptr = ret >>> 0;
1582
+ this.__wbg_ptr = ret;
1270
1583
  CenterOfMassFinalization.register(this, this.__wbg_ptr, this);
1271
1584
  return this;
1272
1585
  }
@@ -1286,7 +1599,6 @@ if (Symbol.dispose) CenterOfMass.prototype[Symbol.dispose] = CenterOfMass.protot
1286
1599
  */
1287
1600
  export class CenterOfMassResult {
1288
1601
  static __wrap(ptr) {
1289
- ptr = ptr >>> 0;
1290
1602
  const obj = Object.create(CenterOfMassResult.prototype);
1291
1603
  obj.__wbg_ptr = ptr;
1292
1604
  CenterOfMassResultFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -1416,7 +1728,7 @@ export class Cluster {
1416
1728
  */
1417
1729
  constructor(min_cluster_size) {
1418
1730
  const ret = wasm.cluster_new(min_cluster_size);
1419
- this.__wbg_ptr = ret >>> 0;
1731
+ this.__wbg_ptr = ret;
1420
1732
  ClusterFinalization.register(this, this.__wbg_ptr, this);
1421
1733
  return this;
1422
1734
  }
@@ -1463,7 +1775,7 @@ export class ClusterCenters {
1463
1775
  }
1464
1776
  constructor() {
1465
1777
  const ret = wasm.clustercenters_new();
1466
- this.__wbg_ptr = ret >>> 0;
1778
+ this.__wbg_ptr = ret;
1467
1779
  ClusterCentersFinalization.register(this, this.__wbg_ptr, this);
1468
1780
  return this;
1469
1781
  }
@@ -1490,7 +1802,6 @@ if (Symbol.dispose) ClusterCenters.prototype[Symbol.dispose] = ClusterCenters.pr
1490
1802
  */
1491
1803
  export class ClusterResult {
1492
1804
  static __wrap(ptr) {
1493
- ptr = ptr >>> 0;
1494
1805
  const obj = Object.create(ClusterResult.prototype);
1495
1806
  obj.__wbg_ptr = ptr;
1496
1807
  ClusterResultFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -1547,64 +1858,293 @@ export class ClusterResult {
1547
1858
  if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prototype.free;
1548
1859
 
1549
1860
  /**
1550
- * Hierarchical data container mapping string keys to typed [`Block`]s.
1551
- *
1552
- * A `Frame` owns a set of named blocks (column stores) and an optional
1553
- * simulation box ([`Box`](super::region::simbox::Box)). This is the
1554
- * primary interchange type for molecular data in the WASM API.
1861
+ * Gaussian Cube file reader.
1555
1862
  *
1556
- * # Conventions
1863
+ * Cube files describe a single voxel grid with embedded atom geometry.
1864
+ * The reader produces a [`Frame`] with:
1865
+ * - `"atoms"` block: `element` (string), `atomic_number` (i32),
1866
+ * `charge` (F), `x`/`y`/`z` (F, **always Å** — Bohr files are converted
1867
+ * on read).
1868
+ * - `"grid"` block: structural shape `[nx, ny, nz]` and one f64 column
1869
+ * per scalar field — `density` for single-density files,
1870
+ * `mo_<idx>` for negative-natoms multi-orbital files.
1871
+ * - `simbox`: voxel cell × dims in Å.
1557
1872
  *
1558
- * - The `"atoms"` block should contain per-atom properties: `symbol`
1559
- * (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
1560
- * `mass` (F, atomic mass units) and `charge` (F, elementary charges).
1561
- * - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
1562
- * zero-based atom indices) and `order` (F, bond order: 1.0 = single,
1563
- * 1.5 = aromatic, 2.0 = double, 3.0 = triple).
1873
+ * Cube is inherently single-frame (only `step = 0` is valid).
1564
1874
  *
1565
1875
  * # Example (JavaScript)
1566
1876
  *
1567
1877
  * ```js
1568
- * const frame = new Frame();
1569
- * const atoms = frame.createBlock("atoms");
1570
- * atoms.setColF("x", xCoords);
1878
+ * const content = await file.text();
1879
+ * const reader = new CubeReader(content);
1880
+ * const frame = reader.read(0);
1881
+ * const grid = frame.getBlock("grid"); // shape [nx, ny, nz]
1882
+ * const density = grid.copyColF("density"); // owned Float64Array
1571
1883
  * ```
1572
1884
  */
1573
- export class Frame {
1574
- static __wrap(ptr) {
1575
- ptr = ptr >>> 0;
1576
- const obj = Object.create(Frame.prototype);
1577
- obj.__wbg_ptr = ptr;
1578
- FrameFinalization.register(obj, obj.__wbg_ptr, obj);
1579
- return obj;
1580
- }
1885
+ export class CubeReader {
1581
1886
  __destroy_into_raw() {
1582
1887
  const ptr = this.__wbg_ptr;
1583
1888
  this.__wbg_ptr = 0;
1584
- FrameFinalization.unregister(this);
1889
+ CubeReaderFinalization.unregister(this);
1585
1890
  return ptr;
1586
1891
  }
1587
1892
  free() {
1588
1893
  const ptr = this.__destroy_into_raw();
1589
- wasm.__wbg_frame_free(ptr, 0);
1894
+ wasm.__wbg_cubereader_free(ptr, 0);
1590
1895
  }
1591
1896
  /**
1592
- * Remove all blocks from this frame (but keep the frame alive).
1593
- *
1594
- * # Errors
1595
- *
1596
- * Throws a `JsValue` string if the frame has already been dropped.
1597
- *
1598
- * # Example (JavaScript)
1599
- *
1600
- * ```js
1601
- * frame.clear();
1602
- * ```
1897
+ * @returns {boolean}
1603
1898
  */
1604
- clear() {
1605
- const ret = wasm.frame_clear(this.__wbg_ptr);
1606
- if (ret[1]) {
1607
- throw takeFromExternrefTable0(ret[0]);
1899
+ isEmpty() {
1900
+ const ret = wasm.cubereader_isEmpty(this.__wbg_ptr);
1901
+ if (ret[2]) {
1902
+ throw takeFromExternrefTable0(ret[1]);
1903
+ }
1904
+ return ret[0] !== 0;
1905
+ }
1906
+ /**
1907
+ * Return the number of frames (always 0 or 1).
1908
+ * @returns {number}
1909
+ */
1910
+ len() {
1911
+ const ret = wasm.cubereader_len(this.__wbg_ptr);
1912
+ if (ret[2]) {
1913
+ throw takeFromExternrefTable0(ret[1]);
1914
+ }
1915
+ return ret[0] >>> 0;
1916
+ }
1917
+ /**
1918
+ * Create a new Cube reader from the file's text content.
1919
+ * @param {string} content
1920
+ */
1921
+ constructor(content) {
1922
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1923
+ const len0 = WASM_VECTOR_LEN;
1924
+ const ret = wasm.cubereader_new(ptr0, len0);
1925
+ this.__wbg_ptr = ret;
1926
+ CubeReaderFinalization.register(this, this.__wbg_ptr, this);
1927
+ return this;
1928
+ }
1929
+ /**
1930
+ * Read the frame at `step`. Cube files are single-frame, so any
1931
+ * `step != 0` returns `undefined`.
1932
+ *
1933
+ * # Errors
1934
+ *
1935
+ * Throws a `JsValue` string on parse errors.
1936
+ * @param {number} step
1937
+ * @returns {Frame | undefined}
1938
+ */
1939
+ read(step) {
1940
+ const ret = wasm.cubereader_read(this.__wbg_ptr, step);
1941
+ if (ret[2]) {
1942
+ throw takeFromExternrefTable0(ret[1]);
1943
+ }
1944
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
1945
+ }
1946
+ }
1947
+ if (Symbol.dispose) CubeReader.prototype[Symbol.dispose] = CubeReader.prototype.free;
1948
+
1949
+ /**
1950
+ * DCD trajectory file reader.
1951
+ *
1952
+ * DCD is a binary multi-frame trajectory format originally used by
1953
+ * CHARMM and now widely produced by NAMD / OpenMM / GROMACS-via-VMD.
1954
+ * This wrapper accepts the file as raw bytes (`Uint8Array`) since
1955
+ * DCD is not text-encoded — passing a JS string would corrupt the
1956
+ * fixed-width Fortran record markers.
1957
+ *
1958
+ * Each frame produces a [`Frame`] with an `"atoms"` block carrying
1959
+ * `x`, `y`, `z` (F, angstrom). Box/cell information, when the DCD
1960
+ * header declares it present, is attached as the frame's `simbox`.
1961
+ *
1962
+ * # Example (JavaScript)
1963
+ *
1964
+ * ```js
1965
+ * const bytes = new Uint8Array(await blob.arrayBuffer());
1966
+ * const reader = new DCDReader(bytes);
1967
+ * console.log(reader.len()); // number of frames
1968
+ *
1969
+ * const frame = reader.read(0); // first frame
1970
+ * const atoms = frame.getBlock("atoms");
1971
+ * const x = atoms.copyColF("x");
1972
+ * ```
1973
+ */
1974
+ export class DCDReader {
1975
+ __destroy_into_raw() {
1976
+ const ptr = this.__wbg_ptr;
1977
+ this.__wbg_ptr = 0;
1978
+ DCDReaderFinalization.unregister(this);
1979
+ return ptr;
1980
+ }
1981
+ free() {
1982
+ const ptr = this.__destroy_into_raw();
1983
+ wasm.__wbg_dcdreader_free(ptr, 0);
1984
+ }
1985
+ /**
1986
+ * Check whether the file contains no frames.
1987
+ *
1988
+ * # Errors
1989
+ *
1990
+ * Throws a `JsValue` string if the header cannot be parsed.
1991
+ * @returns {boolean}
1992
+ */
1993
+ isEmpty() {
1994
+ const ret = wasm.dcdreader_isEmpty(this.__wbg_ptr);
1995
+ if (ret[2]) {
1996
+ throw takeFromExternrefTable0(ret[1]);
1997
+ }
1998
+ return ret[0] !== 0;
1999
+ }
2000
+ /**
2001
+ * Return the number of frames in the DCD file.
2002
+ *
2003
+ * # Errors
2004
+ *
2005
+ * Throws a `JsValue` string if the header cannot be parsed.
2006
+ * @returns {number}
2007
+ */
2008
+ len() {
2009
+ const ret = wasm.dcdreader_len(this.__wbg_ptr);
2010
+ if (ret[2]) {
2011
+ throw takeFromExternrefTable0(ret[1]);
2012
+ }
2013
+ return ret[0] >>> 0;
2014
+ }
2015
+ /**
2016
+ * Create a new DCD reader from the file's raw bytes.
2017
+ *
2018
+ * # Arguments
2019
+ *
2020
+ * * `bytes` - The full binary content of a DCD file. The reader
2021
+ * takes ownership of an internal copy, so the caller is free
2022
+ * to discard the buffer immediately after this returns.
2023
+ *
2024
+ * # Example (JavaScript)
2025
+ *
2026
+ * ```js
2027
+ * const bytes = new Uint8Array(await file.arrayBuffer());
2028
+ * const reader = new DCDReader(bytes);
2029
+ * ```
2030
+ * @param {Uint8Array} bytes
2031
+ */
2032
+ constructor(bytes) {
2033
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
2034
+ const len0 = WASM_VECTOR_LEN;
2035
+ const ret = wasm.dcdreader_new(ptr0, len0);
2036
+ this.__wbg_ptr = ret;
2037
+ DCDReaderFinalization.register(this, this.__wbg_ptr, this);
2038
+ return this;
2039
+ }
2040
+ /**
2041
+ * Read a frame at the given step index.
2042
+ *
2043
+ * # Arguments
2044
+ *
2045
+ * * `step` - Zero-based frame index
2046
+ *
2047
+ * # Returns
2048
+ *
2049
+ * A [`Frame`] if the step exists, or `undefined` if `step` is
2050
+ * out of range.
2051
+ *
2052
+ * # Errors
2053
+ *
2054
+ * Throws a `JsValue` string on parse errors (truncated record,
2055
+ * malformed header, byte-order mismatch).
2056
+ * @param {number} step
2057
+ * @returns {Frame | undefined}
2058
+ */
2059
+ read(step) {
2060
+ const ret = wasm.dcdreader_read(this.__wbg_ptr, step);
2061
+ if (ret[2]) {
2062
+ throw takeFromExternrefTable0(ret[1]);
2063
+ }
2064
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
2065
+ }
2066
+ }
2067
+ if (Symbol.dispose) DCDReader.prototype[Symbol.dispose] = DCDReader.prototype.free;
2068
+
2069
+ /**
2070
+ * Hierarchical data container mapping string keys to typed [`Block`]s.
2071
+ *
2072
+ * A `Frame` owns a set of named blocks (column stores) and an optional
2073
+ * simulation box ([`Box`](super::region::simbox::Box)). This is the
2074
+ * primary interchange type for molecular data in the WASM API.
2075
+ *
2076
+ * # Conventions
2077
+ *
2078
+ * - The `"atoms"` block should contain per-atom properties: `symbol`
2079
+ * (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
2080
+ * `mass` (F, atomic mass units) and `charge` (F, elementary charges).
2081
+ * - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
2082
+ * zero-based atom indices) and `order` (F, bond order: 1.0 = single,
2083
+ * 1.5 = aromatic, 2.0 = double, 3.0 = triple).
2084
+ *
2085
+ * # Example (JavaScript)
2086
+ *
2087
+ * ```js
2088
+ * const frame = new Frame();
2089
+ * const atoms = frame.createBlock("atoms");
2090
+ * atoms.setColF("x", xCoords);
2091
+ * ```
2092
+ */
2093
+ export class Frame {
2094
+ static __wrap(ptr) {
2095
+ const obj = Object.create(Frame.prototype);
2096
+ obj.__wbg_ptr = ptr;
2097
+ FrameFinalization.register(obj, obj.__wbg_ptr, obj);
2098
+ return obj;
2099
+ }
2100
+ __destroy_into_raw() {
2101
+ const ptr = this.__wbg_ptr;
2102
+ this.__wbg_ptr = 0;
2103
+ FrameFinalization.unregister(this);
2104
+ return ptr;
2105
+ }
2106
+ free() {
2107
+ const ptr = this.__destroy_into_raw();
2108
+ wasm.__wbg_frame_free(ptr, 0);
2109
+ }
2110
+ /**
2111
+ * Return the names of all blocks attached to this frame.
2112
+ *
2113
+ * Iteration order matches the underlying `HashMap` and is therefore
2114
+ * not stable across runs — callers that need a deterministic order
2115
+ * must sort on the JS side. Returns an empty array if the frame
2116
+ * has been dropped.
2117
+ *
2118
+ * # Example (JavaScript)
2119
+ *
2120
+ * ```js
2121
+ * const names = frame.blockNames(); // e.g. ["atoms", "bonds"]
2122
+ * ```
2123
+ * @returns {string[]}
2124
+ */
2125
+ blockNames() {
2126
+ const ret = wasm.frame_blockNames(this.__wbg_ptr);
2127
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2128
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2129
+ return v1;
2130
+ }
2131
+ /**
2132
+ * Remove all blocks from this frame (but keep the frame alive).
2133
+ *
2134
+ * # Errors
2135
+ *
2136
+ * Throws a `JsValue` string if the frame has already been dropped.
2137
+ *
2138
+ * # Example (JavaScript)
2139
+ *
2140
+ * ```js
2141
+ * frame.clear();
2142
+ * ```
2143
+ */
2144
+ clear() {
2145
+ const ret = wasm.frame_clear(this.__wbg_ptr);
2146
+ if (ret[1]) {
2147
+ throw takeFromExternrefTable0(ret[0]);
1608
2148
  }
1609
2149
  }
1610
2150
  /**
@@ -1696,38 +2236,6 @@ export class Frame {
1696
2236
  const ret = wasm.frame_getBlock(this.__wbg_ptr, ptr0, len0);
1697
2237
  return ret === 0 ? undefined : Block.__wrap(ret);
1698
2238
  }
1699
- /**
1700
- * Retrieve a named grid attached to this frame.
1701
- *
1702
- * Returns a cloned [`Grid`] wrapper, or `undefined` if the grid does
1703
- * not exist. The returned object is independent of the frame — mutations
1704
- * to it are not reflected in the frame without a subsequent
1705
- * [`insertGrid`](Frame::insert_grid) call.
1706
- *
1707
- * # Arguments
1708
- *
1709
- * * `name` — Grid name to retrieve.
1710
- *
1711
- * # Example (JavaScript)
1712
- *
1713
- * ```js
1714
- * const g = frame.getGrid("chgcar");
1715
- * if (g) {
1716
- * const arr = g.getArray("rho");
1717
- * }
1718
- * ```
1719
- * @param {string} name
1720
- * @returns {Grid | undefined}
1721
- */
1722
- getGrid(name) {
1723
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1724
- const len0 = WASM_VECTOR_LEN;
1725
- const ret = wasm.frame_getGrid(this.__wbg_ptr, ptr0, len0);
1726
- if (ret[2]) {
1727
- throw takeFromExternrefTable0(ret[1]);
1728
- }
1729
- return ret[0] === 0 ? undefined : Grid.__wrap(ret[0]);
1730
- }
1731
2239
  /**
1732
2240
  * Read a per-frame metadata value as a numeric scalar.
1733
2241
  *
@@ -1760,47 +2268,6 @@ export class Frame {
1760
2268
  const ret = wasm.frame_getMetaScalar(this.__wbg_ptr, ptr0, len0);
1761
2269
  return ret[0] === 0 ? undefined : ret[1];
1762
2270
  }
1763
- /**
1764
- * Return the names of all grids attached to this frame.
1765
- *
1766
- * # Example (JavaScript)
1767
- *
1768
- * ```js
1769
- * const names = frame.gridNames(); // e.g. ["chgcar", "spin"]
1770
- * ```
1771
- * @returns {Array<any>}
1772
- */
1773
- gridNames() {
1774
- const ret = wasm.frame_gridNames(this.__wbg_ptr);
1775
- if (ret[2]) {
1776
- throw takeFromExternrefTable0(ret[1]);
1777
- }
1778
- return takeFromExternrefTable0(ret[0]);
1779
- }
1780
- /**
1781
- * Returns `true` if a named grid is attached to this frame.
1782
- *
1783
- * # Arguments
1784
- *
1785
- * * `name` — Grid name to look up.
1786
- *
1787
- * # Example (JavaScript)
1788
- *
1789
- * ```js
1790
- * frame.hasGrid("chgcar"); // true or false
1791
- * ```
1792
- * @param {string} name
1793
- * @returns {boolean}
1794
- */
1795
- hasGrid(name) {
1796
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1797
- const len0 = WASM_VECTOR_LEN;
1798
- const ret = wasm.frame_hasGrid(this.__wbg_ptr, ptr0, len0);
1799
- if (ret[2]) {
1800
- throw takeFromExternrefTable0(ret[1]);
1801
- }
1802
- return ret[0] !== 0;
1803
- }
1804
2271
  /**
1805
2272
  * Insert a block by deep-copying its data into this frame's store.
1806
2273
  *
@@ -1840,52 +2307,16 @@ export class Frame {
1840
2307
  }
1841
2308
  }
1842
2309
  /**
1843
- * Attach a grid to this frame under the given name.
1844
- *
1845
- * If a grid with the same name already exists it is replaced. The grid
1846
- * data is moved into the frame; the JS `Grid` object becomes empty after
1847
- * this call and should not be reused.
1848
- *
1849
- * # Arguments
1850
- *
1851
- * * `name` — Name to store the grid under (e.g., `"chgcar"`).
1852
- * * `grid` — The [`Grid`] to attach.
1853
- *
1854
- * # Errors
2310
+ * Return the names of all metadata keys on this frame.
1855
2311
  *
1856
- * Throws a `JsValue` string if the frame has been dropped.
2312
+ * Includes all keys regardless of whether their values are numeric
2313
+ * or categorical. To filter to numeric keys, iterate and call
2314
+ * [`getMetaScalar`](Self::get_meta_scalar) on each.
1857
2315
  *
1858
2316
  * # Example (JavaScript)
1859
2317
  *
1860
2318
  * ```js
1861
- * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
1862
- * grid.insertArray("rho", rhoData);
1863
- * frame.insertGrid("chgcar", grid);
1864
- * ```
1865
- * @param {string} name
1866
- * @param {Grid} grid
1867
- */
1868
- insertGrid(name, grid) {
1869
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1870
- const len0 = WASM_VECTOR_LEN;
1871
- _assertClass(grid, Grid);
1872
- var ptr1 = grid.__destroy_into_raw();
1873
- const ret = wasm.frame_insertGrid(this.__wbg_ptr, ptr0, len0, ptr1);
1874
- if (ret[1]) {
1875
- throw takeFromExternrefTable0(ret[0]);
1876
- }
1877
- }
1878
- /**
1879
- * Return the names of all metadata keys on this frame.
1880
- *
1881
- * Includes all keys regardless of whether their values are numeric
1882
- * or categorical. To filter to numeric keys, iterate and call
1883
- * [`getMetaScalar`](Self::get_meta_scalar) on each.
1884
- *
1885
- * # Example (JavaScript)
1886
- *
1887
- * ```js
1888
- * const names = frame.metaNames(); // e.g. ["energy", "config", "temp"]
2319
+ * const names = frame.metaNames(); // e.g. ["energy", "config", "temp"]
1889
2320
  * ```
1890
2321
  * @returns {string[]}
1891
2322
  */
@@ -1906,7 +2337,7 @@ export class Frame {
1906
2337
  */
1907
2338
  constructor() {
1908
2339
  const ret = wasm.frame_new();
1909
- this.__wbg_ptr = ret >>> 0;
2340
+ this.__wbg_ptr = ret;
1910
2341
  FrameFinalization.register(this, this.__wbg_ptr, this);
1911
2342
  return this;
1912
2343
  }
@@ -1937,32 +2368,6 @@ export class Frame {
1937
2368
  throw takeFromExternrefTable0(ret[0]);
1938
2369
  }
1939
2370
  }
1940
- /**
1941
- * Remove a named grid from this frame.
1942
- *
1943
- * # Arguments
1944
- *
1945
- * * `name` — Grid name to remove.
1946
- *
1947
- * # Errors
1948
- *
1949
- * Throws a `JsValue` string if the frame has been dropped.
1950
- *
1951
- * # Example (JavaScript)
1952
- *
1953
- * ```js
1954
- * frame.removeGrid("chgcar");
1955
- * ```
1956
- * @param {string} name
1957
- */
1958
- removeGrid(name) {
1959
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1960
- const len0 = WASM_VECTOR_LEN;
1961
- const ret = wasm.frame_removeGrid(this.__wbg_ptr, ptr0, len0);
1962
- if (ret[1]) {
1963
- throw takeFromExternrefTable0(ret[0]);
1964
- }
1965
- }
1966
2371
  /**
1967
2372
  * Rename a block from `old_key` to `new_key`.
1968
2373
  *
@@ -2138,304 +2543,49 @@ export class Frame {
2138
2543
  if (Symbol.dispose) Frame.prototype[Symbol.dispose] = Frame.prototype.free;
2139
2544
 
2140
2545
  /**
2141
- * A uniform spatial grid storing multiple named scalar arrays.
2546
+ * One frame's location inside the source byte stream.
2142
2547
  *
2143
- * All arrays in a `Grid` share the same spatial definition: dimensions
2144
- * (`[nx, ny, nz]`), Cartesian origin, cell matrix (columns are lattice
2145
- * vectors, matching VASP/molrs convention), and periodic boundary flags.
2146
- *
2147
- * # Example (JavaScript)
2148
- *
2149
- * ```js
2150
- * // Create a 10×10×10 cubic grid
2151
- * const origin = new Float32Array([0, 0, 0]);
2152
- * const cell = new Float32Array([
2153
- * 10, 0, 0, // first column (a vector)
2154
- * 0,10, 0, // second column (b vector)
2155
- * 0, 0,10, // third column (c vector)
2156
- * ]);
2157
- * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
2158
- *
2159
- * // Insert a density array (must have length = 10*10*10 = 1000)
2160
- * const rho = new Float32Array(1000).fill(1.0);
2161
- * grid.insertArray("rho", rho);
2162
- *
2163
- * // Retrieve it
2164
- * const arr = grid.getArray("rho");
2165
- * console.log(arr.toCopy());
2166
- * ```
2548
+ * `byteOffset` is the absolute byte position of the frame's first byte
2549
+ * inside the source (round-tripped through `f64`; the spec caps source
2550
+ * size at 1 TB which is well within `Number.MAX_SAFE_INTEGER`).
2551
+ * `byteLen` is `u32` — per-frame size never exceeds the worker chunk
2552
+ * size plus a small slack.
2167
2553
  */
2168
- export class Grid {
2554
+ export class FrameIndexEntry {
2169
2555
  static __wrap(ptr) {
2170
- ptr = ptr >>> 0;
2171
- const obj = Object.create(Grid.prototype);
2556
+ const obj = Object.create(FrameIndexEntry.prototype);
2172
2557
  obj.__wbg_ptr = ptr;
2173
- GridFinalization.register(obj, obj.__wbg_ptr, obj);
2558
+ FrameIndexEntryFinalization.register(obj, obj.__wbg_ptr, obj);
2174
2559
  return obj;
2175
2560
  }
2176
2561
  __destroy_into_raw() {
2177
2562
  const ptr = this.__wbg_ptr;
2178
2563
  this.__wbg_ptr = 0;
2179
- GridFinalization.unregister(this);
2564
+ FrameIndexEntryFinalization.unregister(this);
2180
2565
  return ptr;
2181
2566
  }
2182
2567
  free() {
2183
2568
  const ptr = this.__destroy_into_raw();
2184
- wasm.__wbg_grid_free(ptr, 0);
2185
- }
2186
- /**
2187
- * Names of all scalar arrays stored in this grid.
2188
- *
2189
- * # Example (JavaScript)
2190
- *
2191
- * ```js
2192
- * const names = grid.arrayNames(); // e.g. ["rho", "spin"]
2193
- * ```
2194
- * @returns {Array<any>}
2195
- */
2196
- arrayNames() {
2197
- const ret = wasm.grid_arrayNames(this.__wbg_ptr);
2198
- return ret;
2199
- }
2200
- /**
2201
- * Cell matrix in Ångström as a flat array of length 9 in column-major
2202
- * order (columns are lattice vectors, matching VASP/molrs convention).
2203
- *
2204
- * Layout: `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`
2205
- *
2206
- * # Example (JavaScript)
2207
- *
2208
- * ```js
2209
- * const c = grid.cell();
2210
- * const flat = c.toCopy(); // Float32Array of length 9
2211
- * ```
2212
- * @returns {WasmArray}
2213
- */
2214
- cell() {
2215
- const ret = wasm.grid_cell(this.__wbg_ptr);
2216
- return WasmArray.__wrap(ret);
2217
- }
2218
- /**
2219
- * Grid dimensions `[nx, ny, nz]`.
2220
- *
2221
- * # Example (JavaScript)
2222
- *
2223
- * ```js
2224
- * console.log(grid.dim()); // [10, 10, 10]
2225
- * ```
2226
- * @returns {Uint32Array}
2227
- */
2228
- dim() {
2229
- const ret = wasm.grid_dim(this.__wbg_ptr);
2230
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2231
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2232
- return v1;
2233
- }
2234
- /**
2235
- * Retrieve a named scalar array as a zero-copy `Float64Array` view
2236
- * over the underlying WASM memory. Flat row-major order, length
2237
- * `nx * ny * nz`. Use [`Grid::dim`] for shape.
2238
- *
2239
- * **Warning**: the view is invalidated on any WASM memory growth.
2240
- * Copy it in JS (`new Float64Array(view)`) if it needs to outlive
2241
- * subsequent allocations.
2242
- *
2243
- * Returns `undefined` if the named array does not exist.
2244
- *
2245
- * # Example (JavaScript)
2246
- *
2247
- * ```js
2248
- * const view = grid.getArray("rho"); // zero-copy
2249
- * const copy = new Float64Array(view); // owned copy if needed
2250
- * ```
2251
- * @param {string} name
2252
- * @returns {Float64Array | undefined}
2253
- */
2254
- getArray(name) {
2255
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2256
- const len0 = WASM_VECTOR_LEN;
2257
- const ret = wasm.grid_getArray(this.__wbg_ptr, ptr0, len0);
2258
- return ret;
2259
- }
2260
- /**
2261
- * Returns `true` if a named array is present in this grid.
2262
- *
2263
- * # Arguments
2264
- *
2265
- * * `name` — Array name to look up.
2266
- *
2267
- * # Example (JavaScript)
2268
- *
2269
- * ```js
2270
- * grid.hasArray("rho"); // true or false
2271
- * ```
2272
- * @param {string} name
2273
- * @returns {boolean}
2274
- */
2275
- hasArray(name) {
2276
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2277
- const len0 = WASM_VECTOR_LEN;
2278
- const ret = wasm.grid_hasArray(this.__wbg_ptr, ptr0, len0);
2279
- return ret !== 0;
2280
- }
2281
- /**
2282
- * Insert (or replace) a named scalar array.
2283
- *
2284
- * The provided `data` must have exactly `nx * ny * nz` elements in
2285
- * row-major `(ix, iy, iz)` order.
2286
- *
2287
- * # Arguments
2288
- *
2289
- * * `name` — Array name.
2290
- * * `data` — Float32Array with length equal to `grid.total()`.
2291
- *
2292
- * # Errors
2293
- *
2294
- * Throws if `data.length != nx * ny * nz`.
2295
- *
2296
- * # Example (JavaScript)
2297
- *
2298
- * ```js
2299
- * const rho = new Float32Array(grid.total()).fill(0.5);
2300
- * grid.insertArray("rho", rho);
2301
- * ```
2302
- * @param {string} name
2303
- * @param {Float64Array} data
2304
- */
2305
- insertArray(name, data) {
2306
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2307
- const len0 = WASM_VECTOR_LEN;
2308
- const ptr1 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc_command_export);
2309
- const len1 = WASM_VECTOR_LEN;
2310
- const ret = wasm.grid_insertArray(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2311
- if (ret[1]) {
2312
- throw takeFromExternrefTable0(ret[0]);
2313
- }
2314
- }
2315
- /**
2316
- * Returns `true` if no arrays are stored.
2317
- *
2318
- * # Example (JavaScript)
2319
- *
2320
- * ```js
2321
- * console.log(grid.isEmpty()); // true for a freshly created grid
2322
- * ```
2323
- * @returns {boolean}
2324
- */
2325
- isEmpty() {
2326
- const ret = wasm.grid_isEmpty(this.__wbg_ptr);
2327
- return ret !== 0;
2569
+ wasm.__wbg_frameindexentry_free(ptr, 0);
2328
2570
  }
2329
2571
  /**
2330
- * Number of named arrays stored in this grid.
2331
- *
2332
- * # Example (JavaScript)
2333
- *
2334
- * ```js
2335
- * console.log(grid.len()); // e.g. 2
2336
- * ```
2572
+ * Size of this frame's encoded byte range, in bytes.
2337
2573
  * @returns {number}
2338
2574
  */
2339
- len() {
2340
- const ret = wasm.grid_len(this.__wbg_ptr);
2575
+ get byteLen() {
2576
+ const ret = wasm.frameindexentry_byteLen(this.__wbg_ptr);
2341
2577
  return ret >>> 0;
2342
2578
  }
2343
2579
  /**
2344
- * Create a new empty grid with the given spatial definition.
2345
- *
2346
- * # Arguments
2347
- *
2348
- * * `dim_x`, `dim_y`, `dim_z` — Number of grid points along each axis.
2349
- * * `origin` — Float32Array of length 3: Cartesian origin in Ångström.
2350
- * * `cell` — Float32Array of length 9: cell matrix in column-major order.
2351
- * `cell[0..3]` is the first lattice vector (a), `cell[3..6]` is b,
2352
- * `cell[6..9]` is c (matching VASP/molrs convention where columns are
2353
- * lattice vectors).
2354
- * * `pbc_x`, `pbc_y`, `pbc_z` — Periodic boundary flags for each axis.
2355
- *
2356
- * # Errors
2357
- *
2358
- * Throws if `origin` does not have length 3, or `cell` does not have
2359
- * length 9.
2360
- *
2361
- * # Example (JavaScript)
2362
- *
2363
- * ```js
2364
- * const origin = new Float32Array([0, 0, 0]);
2365
- * const cell = new Float32Array([10,0,0, 0,10,0, 0,0,10]);
2366
- * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
2367
- * ```
2368
- * @param {number} dim_x
2369
- * @param {number} dim_y
2370
- * @param {number} dim_z
2371
- * @param {Float64Array} origin
2372
- * @param {Float64Array} cell
2373
- * @param {boolean} pbc_x
2374
- * @param {boolean} pbc_y
2375
- * @param {boolean} pbc_z
2376
- */
2377
- constructor(dim_x, dim_y, dim_z, origin, cell, pbc_x, pbc_y, pbc_z) {
2378
- const ptr0 = passArrayF64ToWasm0(origin, wasm.__wbindgen_malloc_command_export);
2379
- const len0 = WASM_VECTOR_LEN;
2380
- const ptr1 = passArrayF64ToWasm0(cell, wasm.__wbindgen_malloc_command_export);
2381
- const len1 = WASM_VECTOR_LEN;
2382
- const ret = wasm.grid_new(dim_x, dim_y, dim_z, ptr0, len0, ptr1, len1, pbc_x, pbc_y, pbc_z);
2383
- if (ret[2]) {
2384
- throw takeFromExternrefTable0(ret[1]);
2385
- }
2386
- this.__wbg_ptr = ret[0] >>> 0;
2387
- GridFinalization.register(this, this.__wbg_ptr, this);
2388
- return this;
2389
- }
2390
- /**
2391
- * Cartesian origin in Ångström as a 1-D array of length 3.
2392
- *
2393
- * # Example (JavaScript)
2394
- *
2395
- * ```js
2396
- * const o = grid.origin();
2397
- * const arr = o.toCopy(); // Float32Array [ox, oy, oz]
2398
- * ```
2399
- * @returns {WasmArray}
2400
- */
2401
- origin() {
2402
- const ret = wasm.grid_origin(this.__wbg_ptr);
2403
- return WasmArray.__wrap(ret);
2404
- }
2405
- /**
2406
- * Periodic boundary flags as a `Uint8Array`-compatible slice.
2407
- *
2408
- * Each element is `1` (periodic) or `0` (not periodic).
2409
- *
2410
- * # Example (JavaScript)
2411
- *
2412
- * ```js
2413
- * console.log(grid.pbc()); // [1, 1, 1]
2414
- * ```
2415
- * @returns {Uint8Array}
2416
- */
2417
- pbc() {
2418
- const ret = wasm.grid_pbc(this.__wbg_ptr);
2419
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2420
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
2421
- return v1;
2422
- }
2423
- /**
2424
- * Total number of voxels: `nx * ny * nz`.
2425
- *
2426
- * # Example (JavaScript)
2427
- *
2428
- * ```js
2429
- * console.log(grid.total()); // 1000 for a 10×10×10 grid
2430
- * ```
2580
+ * Absolute byte offset of this frame inside the source (in bytes).
2431
2581
  * @returns {number}
2432
2582
  */
2433
- total() {
2434
- const ret = wasm.grid_total(this.__wbg_ptr);
2435
- return ret >>> 0;
2583
+ get byteOffset() {
2584
+ const ret = wasm.frameindexentry_byteOffset(this.__wbg_ptr);
2585
+ return ret;
2436
2586
  }
2437
2587
  }
2438
- if (Symbol.dispose) Grid.prototype[Symbol.dispose] = Grid.prototype.free;
2588
+ if (Symbol.dispose) FrameIndexEntry.prototype[Symbol.dispose] = FrameIndexEntry.prototype.free;
2439
2589
 
2440
2590
  /**
2441
2591
  * Gyration tensor per cluster.
@@ -2476,7 +2626,7 @@ export class GyrationTensor {
2476
2626
  }
2477
2627
  constructor() {
2478
2628
  const ret = wasm.gyrationtensor_new();
2479
- this.__wbg_ptr = ret >>> 0;
2629
+ this.__wbg_ptr = ret;
2480
2630
  GyrationTensorFinalization.register(this, this.__wbg_ptr, this);
2481
2631
  return this;
2482
2632
  }
@@ -2525,7 +2675,7 @@ export class InertiaTensor {
2525
2675
  var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
2526
2676
  var len0 = WASM_VECTOR_LEN;
2527
2677
  const ret = wasm.inertiatensor_new(ptr0, len0);
2528
- this.__wbg_ptr = ret >>> 0;
2678
+ this.__wbg_ptr = ret;
2529
2679
  InertiaTensorFinalization.register(this, this.__wbg_ptr, this);
2530
2680
  return this;
2531
2681
  }
@@ -2614,7 +2764,7 @@ export class LAMMPSReader {
2614
2764
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2615
2765
  const len0 = WASM_VECTOR_LEN;
2616
2766
  const ret = wasm.lammpsreader_new(ptr0, len0);
2617
- this.__wbg_ptr = ret >>> 0;
2767
+ this.__wbg_ptr = ret;
2618
2768
  LAMMPSReaderFinalization.register(this, this.__wbg_ptr, this);
2619
2769
  return this;
2620
2770
  }
@@ -2712,7 +2862,7 @@ export class LAMMPSTrajReader {
2712
2862
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2713
2863
  const len0 = WASM_VECTOR_LEN;
2714
2864
  const ret = wasm.lammpstrajreader_new(ptr0, len0);
2715
- this.__wbg_ptr = ret >>> 0;
2865
+ this.__wbg_ptr = ret;
2716
2866
  LAMMPSTrajReaderFinalization.register(this, this.__wbg_ptr, this);
2717
2867
  return this;
2718
2868
  }
@@ -2817,7 +2967,7 @@ export class LinkedCell {
2817
2967
  */
2818
2968
  constructor(cutoff) {
2819
2969
  const ret = wasm.linkedcell_new(cutoff);
2820
- this.__wbg_ptr = ret >>> 0;
2970
+ this.__wbg_ptr = ret;
2821
2971
  LinkedCellFinalization.register(this, this.__wbg_ptr, this);
2822
2972
  return this;
2823
2973
  }
@@ -2950,7 +3100,7 @@ export class MSD {
2950
3100
  */
2951
3101
  constructor() {
2952
3102
  const ret = wasm.msd_new();
2953
- this.__wbg_ptr = ret >>> 0;
3103
+ this.__wbg_ptr = ret;
2954
3104
  MSDFinalization.register(this, this.__wbg_ptr, this);
2955
3105
  return this;
2956
3106
  }
@@ -2999,7 +3149,6 @@ if (Symbol.dispose) MSD.prototype[Symbol.dispose] = MSD.prototype.free;
2999
3149
  */
3000
3150
  export class MSDResult {
3001
3151
  static __wrap(ptr) {
3002
- ptr = ptr >>> 0;
3003
3152
  const obj = Object.create(MSDResult.prototype);
3004
3153
  obj.__wbg_ptr = ptr;
3005
3154
  MSDResultFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -3081,7 +3230,7 @@ export class MolRecReader {
3081
3230
  if (ret[2]) {
3082
3231
  throw takeFromExternrefTable0(ret[1]);
3083
3232
  }
3084
- this.__wbg_ptr = ret[0] >>> 0;
3233
+ this.__wbg_ptr = ret[0];
3085
3234
  MolRecReaderFinalization.register(this, this.__wbg_ptr, this);
3086
3235
  return this;
3087
3236
  }
@@ -3128,7 +3277,6 @@ if (Symbol.dispose) MolRecReader.prototype[Symbol.dispose] = MolRecReader.protot
3128
3277
  */
3129
3278
  export class NeighborList {
3130
3279
  static __wrap(ptr) {
3131
- ptr = ptr >>> 0;
3132
3280
  const obj = Object.create(NeighborList.prototype);
3133
3281
  obj.__wbg_ptr = ptr;
3134
3282
  NeighborListFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -3301,7 +3449,7 @@ export class PDBReader {
3301
3449
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
3302
3450
  const len0 = WASM_VECTOR_LEN;
3303
3451
  const ret = wasm.pdbreader_new(ptr0, len0);
3304
- this.__wbg_ptr = ret >>> 0;
3452
+ this.__wbg_ptr = ret;
3305
3453
  PDBReaderFinalization.register(this, this.__wbg_ptr, this);
3306
3454
  return this;
3307
3455
  }
@@ -3465,7 +3613,7 @@ export class RDF {
3465
3613
  if (ret[2]) {
3466
3614
  throw takeFromExternrefTable0(ret[1]);
3467
3615
  }
3468
- this.__wbg_ptr = ret[0] >>> 0;
3616
+ this.__wbg_ptr = ret[0];
3469
3617
  RDFFinalization.register(this, this.__wbg_ptr, this);
3470
3618
  return this;
3471
3619
  }
@@ -3491,7 +3639,6 @@ if (Symbol.dispose) RDF.prototype[Symbol.dispose] = RDF.prototype.free;
3491
3639
  */
3492
3640
  export class RDFResult {
3493
3641
  static __wrap(ptr) {
3494
- ptr = ptr >>> 0;
3495
3642
  const obj = Object.create(RDFResult.prototype);
3496
3643
  obj.__wbg_ptr = ptr;
3497
3644
  RDFResultFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -3613,7 +3760,7 @@ export class RadiusOfGyration {
3613
3760
  var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
3614
3761
  var len0 = WASM_VECTOR_LEN;
3615
3762
  const ret = wasm.radiusofgyration_new(ptr0, len0);
3616
- this.__wbg_ptr = ret >>> 0;
3763
+ this.__wbg_ptr = ret;
3617
3764
  RadiusOfGyrationFinalization.register(this, this.__wbg_ptr, this);
3618
3765
  return this;
3619
3766
  }
@@ -3687,7 +3834,7 @@ export class SDFReader {
3687
3834
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
3688
3835
  const len0 = WASM_VECTOR_LEN;
3689
3836
  const ret = wasm.sdfreader_new(ptr0, len0);
3690
- this.__wbg_ptr = ret >>> 0;
3837
+ this.__wbg_ptr = ret;
3691
3838
  SDFReaderFinalization.register(this, this.__wbg_ptr, this);
3692
3839
  return this;
3693
3840
  }
@@ -3729,7 +3876,6 @@ if (Symbol.dispose) SDFReader.prototype[Symbol.dispose] = SDFReader.prototype.fr
3729
3876
  */
3730
3877
  export class SmilesIR {
3731
3878
  static __wrap(ptr) {
3732
- ptr = ptr >>> 0;
3733
3879
  const obj = Object.create(SmilesIR.prototype);
3734
3880
  obj.__wbg_ptr = ptr;
3735
3881
  SmilesIRFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -3825,7 +3971,6 @@ if (Symbol.dispose) SmilesIR.prototype[Symbol.dispose] = SmilesIR.prototype.free
3825
3971
  */
3826
3972
  export class Topology {
3827
3973
  static __wrap(ptr) {
3828
- ptr = ptr >>> 0;
3829
3974
  const obj = Object.create(Topology.prototype);
3830
3975
  obj.__wbg_ptr = ptr;
3831
3976
  TopologyFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4022,7 +4167,7 @@ export class Topology {
4022
4167
  */
4023
4168
  constructor(n_atoms) {
4024
4169
  const ret = wasm.topology_new(n_atoms);
4025
- this.__wbg_ptr = ret >>> 0;
4170
+ this.__wbg_ptr = ret;
4026
4171
  TopologyFinalization.register(this, this.__wbg_ptr, this);
4027
4172
  return this;
4028
4173
  }
@@ -4046,7 +4191,6 @@ if (Symbol.dispose) Topology.prototype[Symbol.dispose] = Topology.prototype.free
4046
4191
  */
4047
4192
  export class TopologyRingInfo {
4048
4193
  static __wrap(ptr) {
4049
- ptr = ptr >>> 0;
4050
4194
  const obj = Object.create(TopologyRingInfo.prototype);
4051
4195
  obj.__wbg_ptr = ptr;
4052
4196
  TopologyRingInfoFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4152,7 +4296,6 @@ if (Symbol.dispose) TopologyRingInfo.prototype[Symbol.dispose] = TopologyRingInf
4152
4296
  */
4153
4297
  export class WasmArray {
4154
4298
  static __wrap(ptr) {
4155
- ptr = ptr >>> 0;
4156
4299
  const obj = Object.create(WasmArray.prototype);
4157
4300
  obj.__wbg_ptr = ptr;
4158
4301
  WasmArrayFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4263,7 +4406,7 @@ export class WasmArray {
4263
4406
  const ptr0 = passArray32ToWasm0(shape, wasm.__wbindgen_malloc_command_export);
4264
4407
  const len0 = WASM_VECTOR_LEN;
4265
4408
  const ret = wasm.wasmarray_new(ptr0, len0);
4266
- this.__wbg_ptr = ret >>> 0;
4409
+ this.__wbg_ptr = ret;
4267
4410
  WasmArrayFinalization.register(this, this.__wbg_ptr, this);
4268
4411
  return this;
4269
4412
  }
@@ -4446,135 +4589,1644 @@ export class WasmKMeans {
4446
4589
  *
4447
4590
  * # Errors
4448
4591
  *
4449
- * Throws if `k == 0` or `max_iter == 0`.
4450
- * @param {number} k
4451
- * @param {number} max_iter
4452
- * @param {number} seed
4592
+ * Throws if `k == 0` or `max_iter == 0`.
4593
+ * @param {number} k
4594
+ * @param {number} max_iter
4595
+ * @param {number} seed
4596
+ */
4597
+ constructor(k, max_iter, seed) {
4598
+ const ret = wasm.wasmkmeans_new(k, max_iter, seed);
4599
+ if (ret[2]) {
4600
+ throw takeFromExternrefTable0(ret[1]);
4601
+ }
4602
+ this.__wbg_ptr = ret[0];
4603
+ WasmKMeansFinalization.register(this, this.__wbg_ptr, this);
4604
+ return this;
4605
+ }
4606
+ }
4607
+ if (Symbol.dispose) WasmKMeans.prototype[Symbol.dispose] = WasmKMeans.prototype.free;
4608
+
4609
+ export class WasmLammpsDataStream {
4610
+ __destroy_into_raw() {
4611
+ const ptr = this.__wbg_ptr;
4612
+ this.__wbg_ptr = 0;
4613
+ WasmLammpsDataStreamFinalization.unregister(this);
4614
+ return ptr;
4615
+ }
4616
+ free() {
4617
+ const ptr = this.__destroy_into_raw();
4618
+ wasm.__wbg_wasmlammpsdatastream_free(ptr, 0);
4619
+ }
4620
+ /**
4621
+ * Resize the reusable input buffer so it can hold at least
4622
+ * `len` bytes, and return the WASM linear-memory pointer to
4623
+ * its first byte.
4624
+ *
4625
+ * CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
4626
+ * `wasm.memory.buffer` may have been detached by a `memory.grow`.
4627
+ * @param {number} len
4628
+ * @returns {number}
4629
+ */
4630
+ allocInputBuffer(len) {
4631
+ const ret = wasm.wasmlammpsdatastream_allocInputBuffer(this.__wbg_ptr, len);
4632
+ return ret >>> 0;
4633
+ }
4634
+ /**
4635
+ * Number of blocks in the most recently parsed frame.
4636
+ * @returns {number}
4637
+ */
4638
+ blockCount() {
4639
+ const ret = wasm.wasmlammpsdatastream_blockCount(this.__wbg_ptr);
4640
+ return ret >>> 0;
4641
+ }
4642
+ /**
4643
+ * Name of block `blockIdx`, or empty string if out of range.
4644
+ * @param {number} block_idx
4645
+ * @returns {string}
4646
+ */
4647
+ blockName(block_idx) {
4648
+ let deferred1_0;
4649
+ let deferred1_1;
4650
+ try {
4651
+ const ret = wasm.wasmlammpsdatastream_blockName(this.__wbg_ptr, block_idx);
4652
+ deferred1_0 = ret[0];
4653
+ deferred1_1 = ret[1];
4654
+ return getStringFromWasm0(ret[0], ret[1]);
4655
+ } finally {
4656
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
4657
+ }
4658
+ }
4659
+ /**
4660
+ * Number of columns in block `blockIdx`.
4661
+ * @param {number} block_idx
4662
+ * @returns {number}
4663
+ */
4664
+ columnCount(block_idx) {
4665
+ const ret = wasm.wasmlammpsdatastream_columnCount(this.__wbg_ptr, block_idx);
4666
+ return ret >>> 0;
4667
+ }
4668
+ /**
4669
+ * Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
4670
+ * `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
4671
+ * future parser emits those (current streaming formats do not).
4672
+ * Empty string if the index is out of range.
4673
+ * @param {number} block_idx
4674
+ * @param {number} col_idx
4675
+ * @returns {string}
4676
+ */
4677
+ columnDtype(block_idx, col_idx) {
4678
+ let deferred1_0;
4679
+ let deferred1_1;
4680
+ try {
4681
+ const ret = wasm.wasmlammpsdatastream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
4682
+ deferred1_0 = ret[0];
4683
+ deferred1_1 = ret[1];
4684
+ return getStringFromWasm0(ret[0], ret[1]);
4685
+ } finally {
4686
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
4687
+ }
4688
+ }
4689
+ /**
4690
+ * Total flat element count of the column. For multi-dimensional
4691
+ * columns (e.g. an Nx3 positions array) this is the product of
4692
+ * all axes — i.e. the length of the slice the matching
4693
+ * `columnPtr*` points at.
4694
+ * @param {number} block_idx
4695
+ * @param {number} col_idx
4696
+ * @returns {number}
4697
+ */
4698
+ columnLen(block_idx, col_idx) {
4699
+ const ret = wasm.wasmlammpsdatastream_columnLen(this.__wbg_ptr, block_idx, col_idx);
4700
+ return ret >>> 0;
4701
+ }
4702
+ /**
4703
+ * Column name at `(blockIdx, colIdx)`, or empty string if
4704
+ * either index is out of range.
4705
+ * @param {number} block_idx
4706
+ * @param {number} col_idx
4707
+ * @returns {string}
4708
+ */
4709
+ columnName(block_idx, col_idx) {
4710
+ let deferred1_0;
4711
+ let deferred1_1;
4712
+ try {
4713
+ const ret = wasm.wasmlammpsdatastream_columnName(this.__wbg_ptr, block_idx, col_idx);
4714
+ deferred1_0 = ret[0];
4715
+ deferred1_1 = ret[1];
4716
+ return getStringFromWasm0(ret[0], ret[1]);
4717
+ } finally {
4718
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
4719
+ }
4720
+ }
4721
+ /**
4722
+ * Pointer to the contiguous `f64` slice backing this column,
4723
+ * or 0 (null) if the column is missing or has the wrong
4724
+ * dtype.
4725
+ *
4726
+ * **Lifetime**: valid only until the next non-trivial wasm
4727
+ * call. See the module-level memory-grow contract.
4728
+ * @param {number} block_idx
4729
+ * @param {number} col_idx
4730
+ * @returns {number}
4731
+ */
4732
+ columnPtrF64(block_idx, col_idx) {
4733
+ const ret = wasm.wasmlammpsdatastream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
4734
+ return ret >>> 0;
4735
+ }
4736
+ /**
4737
+ * Pointer to the contiguous `i32` slice backing this column,
4738
+ * or 0 (null) if the column is missing or has the wrong
4739
+ * dtype.
4740
+ *
4741
+ * **Lifetime**: valid only until the next non-trivial wasm
4742
+ * call. See the module-level memory-grow contract.
4743
+ * @param {number} block_idx
4744
+ * @param {number} col_idx
4745
+ * @returns {number}
4746
+ */
4747
+ columnPtrI32(block_idx, col_idx) {
4748
+ const ret = wasm.wasmlammpsdatastream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
4749
+ return ret >>> 0;
4750
+ }
4751
+ /**
4752
+ * Pointer to the contiguous `u32` slice backing this column,
4753
+ * or 0 (null) if the column is missing or has the wrong
4754
+ * dtype.
4755
+ *
4756
+ * **Lifetime**: valid only until the next non-trivial wasm
4757
+ * call. See the module-level memory-grow contract.
4758
+ * @param {number} block_idx
4759
+ * @param {number} col_idx
4760
+ * @returns {number}
4761
+ */
4762
+ columnPtrU32(block_idx, col_idx) {
4763
+ const ret = wasm.wasmlammpsdatastream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
4764
+ return ret >>> 0;
4765
+ }
4766
+ /**
4767
+ * Copy a string column out by value. Returns an empty array
4768
+ * if the column is missing or not a string column.
4769
+ * @param {number} block_idx
4770
+ * @param {number} col_idx
4771
+ * @returns {string[]}
4772
+ */
4773
+ columnStrings(block_idx, col_idx) {
4774
+ const ret = wasm.wasmlammpsdatastream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
4775
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
4776
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
4777
+ return v1;
4778
+ }
4779
+ /**
4780
+ * Feed the first `len` bytes of the input buffer into the
4781
+ * indexer at absolute source offset `globalOffset`. Returns
4782
+ * any frame entries that became finalized as a result.
4783
+ *
4784
+ * `globalOffset` is round-tripped through `f64`; per the
4785
+ * streaming protocol the source size is capped at 1 TB
4786
+ * (well within `Number.MAX_SAFE_INTEGER`).
4787
+ * @param {number} global_offset
4788
+ * @param {number} len
4789
+ * @returns {FrameIndexEntry[]}
4790
+ */
4791
+ feedIndexChunk(global_offset, len) {
4792
+ const ret = wasm.wasmlammpsdatastream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
4793
+ if (ret[3]) {
4794
+ throw takeFromExternrefTable0(ret[2]);
4795
+ }
4796
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
4797
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
4798
+ return v1;
4799
+ }
4800
+ /**
4801
+ * Signal end-of-stream; return any trailing frame entry. The
4802
+ * indexer is consumed and further `feedIndexChunk` calls
4803
+ * throw.
4804
+ * @returns {FrameIndexEntry[]}
4805
+ */
4806
+ finishIndex() {
4807
+ const ret = wasm.wasmlammpsdatastream_finishIndex(this.__wbg_ptr);
4808
+ if (ret[3]) {
4809
+ throw takeFromExternrefTable0(ret[2]);
4810
+ }
4811
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
4812
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
4813
+ return v1;
4814
+ }
4815
+ /**
4816
+ * Current capacity (in bytes) of the reusable input buffer.
4817
+ * @returns {number}
4818
+ */
4819
+ inputCapacity() {
4820
+ const ret = wasm.wasmlammpsdatastream_inputCapacity(this.__wbg_ptr);
4821
+ return ret >>> 0;
4822
+ }
4823
+ /**
4824
+ * Create a new streaming reader. The reusable input buffer
4825
+ * starts empty; call [`allocInputBuffer`] before feeding data.
4826
+ */
4827
+ constructor() {
4828
+ const ret = wasm.wasmlammpsdatastream_new();
4829
+ this.__wbg_ptr = ret;
4830
+ WasmLammpsDataStreamFinalization.register(this, this.__wbg_ptr, this);
4831
+ return this;
4832
+ }
4833
+ /**
4834
+ * Decode the byte range `[offset, offset + len)` from the
4835
+ * reusable input buffer as a single frame. Replaces any
4836
+ * previously cached output; the caller must extract data
4837
+ * before the next `parseRangeInInput` (the same buffer can
4838
+ * be overwritten in between).
4839
+ * @param {number} offset
4840
+ * @param {number} len
4841
+ */
4842
+ parseRangeInInput(offset, len) {
4843
+ const ret = wasm.wasmlammpsdatastream_parseRangeInInput(this.__wbg_ptr, offset, len);
4844
+ if (ret[1]) {
4845
+ throw takeFromExternrefTable0(ret[0]);
4846
+ }
4847
+ }
4848
+ /**
4849
+ * Drop the cached output frame, releasing its memory and
4850
+ * invalidating any outstanding `columnPtr*` pointers.
4851
+ * pointers. Subsequent extraction calls return 0 / empty
4852
+ * until the next `parseRangeInInput`.
4853
+ */
4854
+ releaseFrame() {
4855
+ wasm.wasmlammpsdatastream_releaseFrame(this.__wbg_ptr);
4856
+ }
4857
+ /**
4858
+ * Box H-matrix as a length-9 `Float64Array` (column-major:
4859
+ * `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
4860
+ * or `undefined` if the frame has no simbox.
4861
+ *
4862
+ * Returned by VALUE — the typed array is owned by JS and is
4863
+ * stable across subsequent wasm calls.
4864
+ * @returns {Float64Array | undefined}
4865
+ */
4866
+ simboxH() {
4867
+ const ret = wasm.wasmlammpsdatastream_simboxH(this.__wbg_ptr);
4868
+ let v1;
4869
+ if (ret[0] !== 0) {
4870
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4871
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
4872
+ }
4873
+ return v1;
4874
+ }
4875
+ /**
4876
+ * Box origin as a length-3 `Float64Array`, or `undefined` if
4877
+ * the frame has no simbox.
4878
+ * @returns {Float64Array | undefined}
4879
+ */
4880
+ simboxOrigin() {
4881
+ const ret = wasm.wasmlammpsdatastream_simboxOrigin(this.__wbg_ptr);
4882
+ let v1;
4883
+ if (ret[0] !== 0) {
4884
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4885
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
4886
+ }
4887
+ return v1;
4888
+ }
4889
+ /**
4890
+ * Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
4891
+ * `0` = open), or `undefined` if the frame has no simbox.
4892
+ *
4893
+ * (wasm-bindgen does not support `[bool; 3]` returns natively,
4894
+ * hence the `Uint8Array` wire format. The spec calls for
4895
+ * `[boolean, boolean, boolean]`; the JS side is expected to
4896
+ * `Boolean(arr[i])` each entry.)
4897
+ * @returns {Uint8Array | undefined}
4898
+ */
4899
+ simboxPbc() {
4900
+ const ret = wasm.wasmlammpsdatastream_simboxPbc(this.__wbg_ptr);
4901
+ let v1;
4902
+ if (ret[0] !== 0) {
4903
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
4904
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
4905
+ }
4906
+ return v1;
4907
+ }
4908
+ }
4909
+ if (Symbol.dispose) WasmLammpsDataStream.prototype[Symbol.dispose] = WasmLammpsDataStream.prototype.free;
4910
+
4911
+ export class WasmLammpsDumpStream {
4912
+ __destroy_into_raw() {
4913
+ const ptr = this.__wbg_ptr;
4914
+ this.__wbg_ptr = 0;
4915
+ WasmLammpsDumpStreamFinalization.unregister(this);
4916
+ return ptr;
4917
+ }
4918
+ free() {
4919
+ const ptr = this.__destroy_into_raw();
4920
+ wasm.__wbg_wasmlammpsdumpstream_free(ptr, 0);
4921
+ }
4922
+ /**
4923
+ * Resize the reusable input buffer so it can hold at least
4924
+ * `len` bytes, and return the WASM linear-memory pointer to
4925
+ * its first byte.
4926
+ *
4927
+ * CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
4928
+ * `wasm.memory.buffer` may have been detached by a `memory.grow`.
4929
+ * @param {number} len
4930
+ * @returns {number}
4931
+ */
4932
+ allocInputBuffer(len) {
4933
+ const ret = wasm.wasmlammpsdumpstream_allocInputBuffer(this.__wbg_ptr, len);
4934
+ return ret >>> 0;
4935
+ }
4936
+ /**
4937
+ * Number of blocks in the most recently parsed frame.
4938
+ * @returns {number}
4939
+ */
4940
+ blockCount() {
4941
+ const ret = wasm.wasmlammpsdumpstream_blockCount(this.__wbg_ptr);
4942
+ return ret >>> 0;
4943
+ }
4944
+ /**
4945
+ * Name of block `blockIdx`, or empty string if out of range.
4946
+ * @param {number} block_idx
4947
+ * @returns {string}
4948
+ */
4949
+ blockName(block_idx) {
4950
+ let deferred1_0;
4951
+ let deferred1_1;
4952
+ try {
4953
+ const ret = wasm.wasmlammpsdumpstream_blockName(this.__wbg_ptr, block_idx);
4954
+ deferred1_0 = ret[0];
4955
+ deferred1_1 = ret[1];
4956
+ return getStringFromWasm0(ret[0], ret[1]);
4957
+ } finally {
4958
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
4959
+ }
4960
+ }
4961
+ /**
4962
+ * Number of columns in block `blockIdx`.
4963
+ * @param {number} block_idx
4964
+ * @returns {number}
4965
+ */
4966
+ columnCount(block_idx) {
4967
+ const ret = wasm.wasmlammpsdumpstream_columnCount(this.__wbg_ptr, block_idx);
4968
+ return ret >>> 0;
4969
+ }
4970
+ /**
4971
+ * Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
4972
+ * `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
4973
+ * future parser emits those (current streaming formats do not).
4974
+ * Empty string if the index is out of range.
4975
+ * @param {number} block_idx
4976
+ * @param {number} col_idx
4977
+ * @returns {string}
4978
+ */
4979
+ columnDtype(block_idx, col_idx) {
4980
+ let deferred1_0;
4981
+ let deferred1_1;
4982
+ try {
4983
+ const ret = wasm.wasmlammpsdumpstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
4984
+ deferred1_0 = ret[0];
4985
+ deferred1_1 = ret[1];
4986
+ return getStringFromWasm0(ret[0], ret[1]);
4987
+ } finally {
4988
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
4989
+ }
4990
+ }
4991
+ /**
4992
+ * Total flat element count of the column. For multi-dimensional
4993
+ * columns (e.g. an Nx3 positions array) this is the product of
4994
+ * all axes — i.e. the length of the slice the matching
4995
+ * `columnPtr*` points at.
4996
+ * @param {number} block_idx
4997
+ * @param {number} col_idx
4998
+ * @returns {number}
4999
+ */
5000
+ columnLen(block_idx, col_idx) {
5001
+ const ret = wasm.wasmlammpsdumpstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
5002
+ return ret >>> 0;
5003
+ }
5004
+ /**
5005
+ * Column name at `(blockIdx, colIdx)`, or empty string if
5006
+ * either index is out of range.
5007
+ * @param {number} block_idx
5008
+ * @param {number} col_idx
5009
+ * @returns {string}
5010
+ */
5011
+ columnName(block_idx, col_idx) {
5012
+ let deferred1_0;
5013
+ let deferred1_1;
5014
+ try {
5015
+ const ret = wasm.wasmlammpsdumpstream_columnName(this.__wbg_ptr, block_idx, col_idx);
5016
+ deferred1_0 = ret[0];
5017
+ deferred1_1 = ret[1];
5018
+ return getStringFromWasm0(ret[0], ret[1]);
5019
+ } finally {
5020
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5021
+ }
5022
+ }
5023
+ /**
5024
+ * Pointer to the contiguous `f64` slice backing this column,
5025
+ * or 0 (null) if the column is missing or has the wrong
5026
+ * dtype.
5027
+ *
5028
+ * **Lifetime**: valid only until the next non-trivial wasm
5029
+ * call. See the module-level memory-grow contract.
5030
+ * @param {number} block_idx
5031
+ * @param {number} col_idx
5032
+ * @returns {number}
5033
+ */
5034
+ columnPtrF64(block_idx, col_idx) {
5035
+ const ret = wasm.wasmlammpsdumpstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
5036
+ return ret >>> 0;
5037
+ }
5038
+ /**
5039
+ * Pointer to the contiguous `i32` slice backing this column,
5040
+ * or 0 (null) if the column is missing or has the wrong
5041
+ * dtype.
5042
+ *
5043
+ * **Lifetime**: valid only until the next non-trivial wasm
5044
+ * call. See the module-level memory-grow contract.
5045
+ * @param {number} block_idx
5046
+ * @param {number} col_idx
5047
+ * @returns {number}
5048
+ */
5049
+ columnPtrI32(block_idx, col_idx) {
5050
+ const ret = wasm.wasmlammpsdumpstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
5051
+ return ret >>> 0;
5052
+ }
5053
+ /**
5054
+ * Pointer to the contiguous `u32` slice backing this column,
5055
+ * or 0 (null) if the column is missing or has the wrong
5056
+ * dtype.
5057
+ *
5058
+ * **Lifetime**: valid only until the next non-trivial wasm
5059
+ * call. See the module-level memory-grow contract.
5060
+ * @param {number} block_idx
5061
+ * @param {number} col_idx
5062
+ * @returns {number}
5063
+ */
5064
+ columnPtrU32(block_idx, col_idx) {
5065
+ const ret = wasm.wasmlammpsdumpstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
5066
+ return ret >>> 0;
5067
+ }
5068
+ /**
5069
+ * Copy a string column out by value. Returns an empty array
5070
+ * if the column is missing or not a string column.
5071
+ * @param {number} block_idx
5072
+ * @param {number} col_idx
5073
+ * @returns {string[]}
5074
+ */
5075
+ columnStrings(block_idx, col_idx) {
5076
+ const ret = wasm.wasmlammpsdumpstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
5077
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5078
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5079
+ return v1;
5080
+ }
5081
+ /**
5082
+ * Feed the first `len` bytes of the input buffer into the
5083
+ * indexer at absolute source offset `globalOffset`. Returns
5084
+ * any frame entries that became finalized as a result.
5085
+ *
5086
+ * `globalOffset` is round-tripped through `f64`; per the
5087
+ * streaming protocol the source size is capped at 1 TB
5088
+ * (well within `Number.MAX_SAFE_INTEGER`).
5089
+ * @param {number} global_offset
5090
+ * @param {number} len
5091
+ * @returns {FrameIndexEntry[]}
5092
+ */
5093
+ feedIndexChunk(global_offset, len) {
5094
+ const ret = wasm.wasmlammpsdumpstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
5095
+ if (ret[3]) {
5096
+ throw takeFromExternrefTable0(ret[2]);
5097
+ }
5098
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5099
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5100
+ return v1;
5101
+ }
5102
+ /**
5103
+ * Signal end-of-stream; return any trailing frame entry. The
5104
+ * indexer is consumed and further `feedIndexChunk` calls
5105
+ * throw.
5106
+ * @returns {FrameIndexEntry[]}
5107
+ */
5108
+ finishIndex() {
5109
+ const ret = wasm.wasmlammpsdumpstream_finishIndex(this.__wbg_ptr);
5110
+ if (ret[3]) {
5111
+ throw takeFromExternrefTable0(ret[2]);
5112
+ }
5113
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5114
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5115
+ return v1;
5116
+ }
5117
+ /**
5118
+ * Current capacity (in bytes) of the reusable input buffer.
5119
+ * @returns {number}
5120
+ */
5121
+ inputCapacity() {
5122
+ const ret = wasm.wasmlammpsdumpstream_inputCapacity(this.__wbg_ptr);
5123
+ return ret >>> 0;
5124
+ }
5125
+ /**
5126
+ * Create a new streaming reader. The reusable input buffer
5127
+ * starts empty; call [`allocInputBuffer`] before feeding data.
5128
+ */
5129
+ constructor() {
5130
+ const ret = wasm.wasmlammpsdumpstream_new();
5131
+ this.__wbg_ptr = ret;
5132
+ WasmLammpsDumpStreamFinalization.register(this, this.__wbg_ptr, this);
5133
+ return this;
5134
+ }
5135
+ /**
5136
+ * Decode the byte range `[offset, offset + len)` from the
5137
+ * reusable input buffer as a single frame. Replaces any
5138
+ * previously cached output; the caller must extract data
5139
+ * before the next `parseRangeInInput` (the same buffer can
5140
+ * be overwritten in between).
5141
+ * @param {number} offset
5142
+ * @param {number} len
5143
+ */
5144
+ parseRangeInInput(offset, len) {
5145
+ const ret = wasm.wasmlammpsdumpstream_parseRangeInInput(this.__wbg_ptr, offset, len);
5146
+ if (ret[1]) {
5147
+ throw takeFromExternrefTable0(ret[0]);
5148
+ }
5149
+ }
5150
+ /**
5151
+ * Drop the cached output frame, releasing its memory and
5152
+ * invalidating any outstanding `columnPtr*` pointers.
5153
+ * pointers. Subsequent extraction calls return 0 / empty
5154
+ * until the next `parseRangeInInput`.
5155
+ */
5156
+ releaseFrame() {
5157
+ wasm.wasmlammpsdumpstream_releaseFrame(this.__wbg_ptr);
5158
+ }
5159
+ /**
5160
+ * Box H-matrix as a length-9 `Float64Array` (column-major:
5161
+ * `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
5162
+ * or `undefined` if the frame has no simbox.
5163
+ *
5164
+ * Returned by VALUE — the typed array is owned by JS and is
5165
+ * stable across subsequent wasm calls.
5166
+ * @returns {Float64Array | undefined}
5167
+ */
5168
+ simboxH() {
5169
+ const ret = wasm.wasmlammpsdumpstream_simboxH(this.__wbg_ptr);
5170
+ let v1;
5171
+ if (ret[0] !== 0) {
5172
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5173
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5174
+ }
5175
+ return v1;
5176
+ }
5177
+ /**
5178
+ * Box origin as a length-3 `Float64Array`, or `undefined` if
5179
+ * the frame has no simbox.
5180
+ * @returns {Float64Array | undefined}
5181
+ */
5182
+ simboxOrigin() {
5183
+ const ret = wasm.wasmlammpsdumpstream_simboxOrigin(this.__wbg_ptr);
5184
+ let v1;
5185
+ if (ret[0] !== 0) {
5186
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5187
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5188
+ }
5189
+ return v1;
5190
+ }
5191
+ /**
5192
+ * Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
5193
+ * `0` = open), or `undefined` if the frame has no simbox.
5194
+ *
5195
+ * (wasm-bindgen does not support `[bool; 3]` returns natively,
5196
+ * hence the `Uint8Array` wire format. The spec calls for
5197
+ * `[boolean, boolean, boolean]`; the JS side is expected to
5198
+ * `Boolean(arr[i])` each entry.)
5199
+ * @returns {Uint8Array | undefined}
5200
+ */
5201
+ simboxPbc() {
5202
+ const ret = wasm.wasmlammpsdumpstream_simboxPbc(this.__wbg_ptr);
5203
+ let v1;
5204
+ if (ret[0] !== 0) {
5205
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
5206
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
5207
+ }
5208
+ return v1;
5209
+ }
5210
+ }
5211
+ if (Symbol.dispose) WasmLammpsDumpStream.prototype[Symbol.dispose] = WasmLammpsDumpStream.prototype.free;
5212
+
5213
+ /**
5214
+ * Stateless wrapper for [`molrs_compute::pca::Pca2`].
5215
+ *
5216
+ * All configuration lives on [`fitTransform`](Self::fit_transform).
5217
+ *
5218
+ * # Example (JavaScript)
5219
+ *
5220
+ * ```js
5221
+ * const pca = new WasmPca2();
5222
+ * const result = pca.fitTransform(matrix, nRows, nCols);
5223
+ * const coords = result.coords(); // Float64Array, length 2 * nRows
5224
+ * const variance = result.variance(); // Float64Array, length 2
5225
+ * ```
5226
+ */
5227
+ export class WasmPca2 {
5228
+ __destroy_into_raw() {
5229
+ const ptr = this.__wbg_ptr;
5230
+ this.__wbg_ptr = 0;
5231
+ WasmPca2Finalization.unregister(this);
5232
+ return ptr;
5233
+ }
5234
+ free() {
5235
+ const ptr = this.__destroy_into_raw();
5236
+ wasm.__wbg_wasmpca2_free(ptr, 0);
5237
+ }
5238
+ /**
5239
+ * Fit 2-component PCA on a row-major observation matrix and return the
5240
+ * projected coordinates + per-component variance.
5241
+ *
5242
+ * # Arguments
5243
+ *
5244
+ * * `matrix` — row-major `n_rows × n_cols` observation matrix.
5245
+ * * `n_rows` — number of observations.
5246
+ * * `n_cols` — number of features.
5247
+ *
5248
+ * # Errors
5249
+ *
5250
+ * Throws if `n_rows < 3`, `n_cols < 2`, the length does not match
5251
+ * `n_rows * n_cols`, any element is non-finite, or any column has
5252
+ * zero variance.
5253
+ * @param {Float64Array} matrix
5254
+ * @param {number} n_rows
5255
+ * @param {number} n_cols
5256
+ * @returns {WasmPcaResult}
5257
+ */
5258
+ fitTransform(matrix, n_rows, n_cols) {
5259
+ const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc_command_export);
5260
+ const len0 = WASM_VECTOR_LEN;
5261
+ const ret = wasm.wasmpca2_fitTransform(this.__wbg_ptr, ptr0, len0, n_rows, n_cols);
5262
+ if (ret[2]) {
5263
+ throw takeFromExternrefTable0(ret[1]);
5264
+ }
5265
+ return WasmPcaResult.__wrap(ret[0]);
5266
+ }
5267
+ /**
5268
+ * Create a new PCA calculator. The struct carries no state — all
5269
+ * parameters are supplied on [`fitTransform`](Self::fit_transform).
5270
+ */
5271
+ constructor() {
5272
+ const ret = wasm.wasmpca2_new();
5273
+ this.__wbg_ptr = ret;
5274
+ WasmPca2Finalization.register(this, this.__wbg_ptr, this);
5275
+ return this;
5276
+ }
5277
+ }
5278
+ if (Symbol.dispose) WasmPca2.prototype[Symbol.dispose] = WasmPca2.prototype.free;
5279
+
5280
+ /**
5281
+ * Result of a [`WasmPca2::fit_transform`] call.
5282
+ *
5283
+ * Each accessor returns an **owned** `Float64Array` (copy of the underlying
5284
+ * `Vec`) so JS is free to let this wrapper be GC'd without dangling views.
5285
+ */
5286
+ export class WasmPcaResult {
5287
+ static __wrap(ptr) {
5288
+ const obj = Object.create(WasmPcaResult.prototype);
5289
+ obj.__wbg_ptr = ptr;
5290
+ WasmPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);
5291
+ return obj;
5292
+ }
5293
+ __destroy_into_raw() {
5294
+ const ptr = this.__wbg_ptr;
5295
+ this.__wbg_ptr = 0;
5296
+ WasmPcaResultFinalization.unregister(this);
5297
+ return ptr;
5298
+ }
5299
+ free() {
5300
+ const ptr = this.__destroy_into_raw();
5301
+ wasm.__wbg_wasmpcaresult_free(ptr, 0);
5302
+ }
5303
+ /**
5304
+ * Projected 2D coordinates as a row-major `Float64Array` of length
5305
+ * `2 * n_rows`. `coords[2 * i + 0]` is the PC1 score for row `i`,
5306
+ * `coords[2 * i + 1]` is PC2.
5307
+ * @returns {Float64Array}
5308
+ */
5309
+ coords() {
5310
+ const ret = wasm.wasmpcaresult_coords(this.__wbg_ptr);
5311
+ return ret;
5312
+ }
5313
+ /**
5314
+ * Explained variance per component as `Float64Array` of length 2.
5315
+ * `variance[0] >= variance[1]` by construction.
5316
+ * @returns {Float64Array}
5317
+ */
5318
+ variance() {
5319
+ const ret = wasm.wasmpcaresult_variance(this.__wbg_ptr);
5320
+ return ret;
5321
+ }
5322
+ }
5323
+ if (Symbol.dispose) WasmPcaResult.prototype[Symbol.dispose] = WasmPcaResult.prototype.free;
5324
+
5325
+ export class WasmPdbStream {
5326
+ __destroy_into_raw() {
5327
+ const ptr = this.__wbg_ptr;
5328
+ this.__wbg_ptr = 0;
5329
+ WasmPdbStreamFinalization.unregister(this);
5330
+ return ptr;
5331
+ }
5332
+ free() {
5333
+ const ptr = this.__destroy_into_raw();
5334
+ wasm.__wbg_wasmpdbstream_free(ptr, 0);
5335
+ }
5336
+ /**
5337
+ * Resize the reusable input buffer so it can hold at least
5338
+ * `len` bytes, and return the WASM linear-memory pointer to
5339
+ * its first byte.
5340
+ *
5341
+ * CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
5342
+ * `wasm.memory.buffer` may have been detached by a `memory.grow`.
5343
+ * @param {number} len
5344
+ * @returns {number}
5345
+ */
5346
+ allocInputBuffer(len) {
5347
+ const ret = wasm.wasmpdbstream_allocInputBuffer(this.__wbg_ptr, len);
5348
+ return ret >>> 0;
5349
+ }
5350
+ /**
5351
+ * Number of blocks in the most recently parsed frame.
5352
+ * @returns {number}
5353
+ */
5354
+ blockCount() {
5355
+ const ret = wasm.wasmpdbstream_blockCount(this.__wbg_ptr);
5356
+ return ret >>> 0;
5357
+ }
5358
+ /**
5359
+ * Name of block `blockIdx`, or empty string if out of range.
5360
+ * @param {number} block_idx
5361
+ * @returns {string}
5362
+ */
5363
+ blockName(block_idx) {
5364
+ let deferred1_0;
5365
+ let deferred1_1;
5366
+ try {
5367
+ const ret = wasm.wasmpdbstream_blockName(this.__wbg_ptr, block_idx);
5368
+ deferred1_0 = ret[0];
5369
+ deferred1_1 = ret[1];
5370
+ return getStringFromWasm0(ret[0], ret[1]);
5371
+ } finally {
5372
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5373
+ }
5374
+ }
5375
+ /**
5376
+ * Number of columns in block `blockIdx`.
5377
+ * @param {number} block_idx
5378
+ * @returns {number}
5379
+ */
5380
+ columnCount(block_idx) {
5381
+ const ret = wasm.wasmpdbstream_columnCount(this.__wbg_ptr, block_idx);
5382
+ return ret >>> 0;
5383
+ }
5384
+ /**
5385
+ * Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
5386
+ * `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
5387
+ * future parser emits those (current streaming formats do not).
5388
+ * Empty string if the index is out of range.
5389
+ * @param {number} block_idx
5390
+ * @param {number} col_idx
5391
+ * @returns {string}
5392
+ */
5393
+ columnDtype(block_idx, col_idx) {
5394
+ let deferred1_0;
5395
+ let deferred1_1;
5396
+ try {
5397
+ const ret = wasm.wasmpdbstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
5398
+ deferred1_0 = ret[0];
5399
+ deferred1_1 = ret[1];
5400
+ return getStringFromWasm0(ret[0], ret[1]);
5401
+ } finally {
5402
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5403
+ }
5404
+ }
5405
+ /**
5406
+ * Total flat element count of the column. For multi-dimensional
5407
+ * columns (e.g. an Nx3 positions array) this is the product of
5408
+ * all axes — i.e. the length of the slice the matching
5409
+ * `columnPtr*` points at.
5410
+ * @param {number} block_idx
5411
+ * @param {number} col_idx
5412
+ * @returns {number}
5413
+ */
5414
+ columnLen(block_idx, col_idx) {
5415
+ const ret = wasm.wasmpdbstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
5416
+ return ret >>> 0;
5417
+ }
5418
+ /**
5419
+ * Column name at `(blockIdx, colIdx)`, or empty string if
5420
+ * either index is out of range.
5421
+ * @param {number} block_idx
5422
+ * @param {number} col_idx
5423
+ * @returns {string}
5424
+ */
5425
+ columnName(block_idx, col_idx) {
5426
+ let deferred1_0;
5427
+ let deferred1_1;
5428
+ try {
5429
+ const ret = wasm.wasmpdbstream_columnName(this.__wbg_ptr, block_idx, col_idx);
5430
+ deferred1_0 = ret[0];
5431
+ deferred1_1 = ret[1];
5432
+ return getStringFromWasm0(ret[0], ret[1]);
5433
+ } finally {
5434
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5435
+ }
5436
+ }
5437
+ /**
5438
+ * Pointer to the contiguous `f64` slice backing this column,
5439
+ * or 0 (null) if the column is missing or has the wrong
5440
+ * dtype.
5441
+ *
5442
+ * **Lifetime**: valid only until the next non-trivial wasm
5443
+ * call. See the module-level memory-grow contract.
5444
+ * @param {number} block_idx
5445
+ * @param {number} col_idx
5446
+ * @returns {number}
5447
+ */
5448
+ columnPtrF64(block_idx, col_idx) {
5449
+ const ret = wasm.wasmpdbstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
5450
+ return ret >>> 0;
5451
+ }
5452
+ /**
5453
+ * Pointer to the contiguous `i32` slice backing this column,
5454
+ * or 0 (null) if the column is missing or has the wrong
5455
+ * dtype.
5456
+ *
5457
+ * **Lifetime**: valid only until the next non-trivial wasm
5458
+ * call. See the module-level memory-grow contract.
5459
+ * @param {number} block_idx
5460
+ * @param {number} col_idx
5461
+ * @returns {number}
5462
+ */
5463
+ columnPtrI32(block_idx, col_idx) {
5464
+ const ret = wasm.wasmpdbstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
5465
+ return ret >>> 0;
5466
+ }
5467
+ /**
5468
+ * Pointer to the contiguous `u32` slice backing this column,
5469
+ * or 0 (null) if the column is missing or has the wrong
5470
+ * dtype.
5471
+ *
5472
+ * **Lifetime**: valid only until the next non-trivial wasm
5473
+ * call. See the module-level memory-grow contract.
5474
+ * @param {number} block_idx
5475
+ * @param {number} col_idx
5476
+ * @returns {number}
5477
+ */
5478
+ columnPtrU32(block_idx, col_idx) {
5479
+ const ret = wasm.wasmpdbstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
5480
+ return ret >>> 0;
5481
+ }
5482
+ /**
5483
+ * Copy a string column out by value. Returns an empty array
5484
+ * if the column is missing or not a string column.
5485
+ * @param {number} block_idx
5486
+ * @param {number} col_idx
5487
+ * @returns {string[]}
5488
+ */
5489
+ columnStrings(block_idx, col_idx) {
5490
+ const ret = wasm.wasmpdbstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
5491
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5492
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5493
+ return v1;
5494
+ }
5495
+ /**
5496
+ * Feed the first `len` bytes of the input buffer into the
5497
+ * indexer at absolute source offset `globalOffset`. Returns
5498
+ * any frame entries that became finalized as a result.
5499
+ *
5500
+ * `globalOffset` is round-tripped through `f64`; per the
5501
+ * streaming protocol the source size is capped at 1 TB
5502
+ * (well within `Number.MAX_SAFE_INTEGER`).
5503
+ * @param {number} global_offset
5504
+ * @param {number} len
5505
+ * @returns {FrameIndexEntry[]}
5506
+ */
5507
+ feedIndexChunk(global_offset, len) {
5508
+ const ret = wasm.wasmpdbstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
5509
+ if (ret[3]) {
5510
+ throw takeFromExternrefTable0(ret[2]);
5511
+ }
5512
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5513
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5514
+ return v1;
5515
+ }
5516
+ /**
5517
+ * Signal end-of-stream; return any trailing frame entry. The
5518
+ * indexer is consumed and further `feedIndexChunk` calls
5519
+ * throw.
5520
+ * @returns {FrameIndexEntry[]}
5521
+ */
5522
+ finishIndex() {
5523
+ const ret = wasm.wasmpdbstream_finishIndex(this.__wbg_ptr);
5524
+ if (ret[3]) {
5525
+ throw takeFromExternrefTable0(ret[2]);
5526
+ }
5527
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5528
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5529
+ return v1;
5530
+ }
5531
+ /**
5532
+ * Current capacity (in bytes) of the reusable input buffer.
5533
+ * @returns {number}
5534
+ */
5535
+ inputCapacity() {
5536
+ const ret = wasm.wasmpdbstream_inputCapacity(this.__wbg_ptr);
5537
+ return ret >>> 0;
5538
+ }
5539
+ /**
5540
+ * Create a new streaming reader. The reusable input buffer
5541
+ * starts empty; call [`allocInputBuffer`] before feeding data.
5542
+ */
5543
+ constructor() {
5544
+ const ret = wasm.wasmpdbstream_new();
5545
+ this.__wbg_ptr = ret;
5546
+ WasmPdbStreamFinalization.register(this, this.__wbg_ptr, this);
5547
+ return this;
5548
+ }
5549
+ /**
5550
+ * Decode the byte range `[offset, offset + len)` from the
5551
+ * reusable input buffer as a single frame. Replaces any
5552
+ * previously cached output; the caller must extract data
5553
+ * before the next `parseRangeInInput` (the same buffer can
5554
+ * be overwritten in between).
5555
+ * @param {number} offset
5556
+ * @param {number} len
5557
+ */
5558
+ parseRangeInInput(offset, len) {
5559
+ const ret = wasm.wasmpdbstream_parseRangeInInput(this.__wbg_ptr, offset, len);
5560
+ if (ret[1]) {
5561
+ throw takeFromExternrefTable0(ret[0]);
5562
+ }
5563
+ }
5564
+ /**
5565
+ * Drop the cached output frame, releasing its memory and
5566
+ * invalidating any outstanding `columnPtr*` pointers.
5567
+ * pointers. Subsequent extraction calls return 0 / empty
5568
+ * until the next `parseRangeInInput`.
5569
+ */
5570
+ releaseFrame() {
5571
+ wasm.wasmpdbstream_releaseFrame(this.__wbg_ptr);
5572
+ }
5573
+ /**
5574
+ * Box H-matrix as a length-9 `Float64Array` (column-major:
5575
+ * `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
5576
+ * or `undefined` if the frame has no simbox.
5577
+ *
5578
+ * Returned by VALUE — the typed array is owned by JS and is
5579
+ * stable across subsequent wasm calls.
5580
+ * @returns {Float64Array | undefined}
5581
+ */
5582
+ simboxH() {
5583
+ const ret = wasm.wasmpdbstream_simboxH(this.__wbg_ptr);
5584
+ let v1;
5585
+ if (ret[0] !== 0) {
5586
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5587
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5588
+ }
5589
+ return v1;
5590
+ }
5591
+ /**
5592
+ * Box origin as a length-3 `Float64Array`, or `undefined` if
5593
+ * the frame has no simbox.
5594
+ * @returns {Float64Array | undefined}
5595
+ */
5596
+ simboxOrigin() {
5597
+ const ret = wasm.wasmpdbstream_simboxOrigin(this.__wbg_ptr);
5598
+ let v1;
5599
+ if (ret[0] !== 0) {
5600
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5601
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5602
+ }
5603
+ return v1;
5604
+ }
5605
+ /**
5606
+ * Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
5607
+ * `0` = open), or `undefined` if the frame has no simbox.
5608
+ *
5609
+ * (wasm-bindgen does not support `[bool; 3]` returns natively,
5610
+ * hence the `Uint8Array` wire format. The spec calls for
5611
+ * `[boolean, boolean, boolean]`; the JS side is expected to
5612
+ * `Boolean(arr[i])` each entry.)
5613
+ * @returns {Uint8Array | undefined}
5614
+ */
5615
+ simboxPbc() {
5616
+ const ret = wasm.wasmpdbstream_simboxPbc(this.__wbg_ptr);
5617
+ let v1;
5618
+ if (ret[0] !== 0) {
5619
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
5620
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
5621
+ }
5622
+ return v1;
5623
+ }
5624
+ }
5625
+ if (Symbol.dispose) WasmPdbStream.prototype[Symbol.dispose] = WasmPdbStream.prototype.free;
5626
+
5627
+ export class WasmSdfStream {
5628
+ __destroy_into_raw() {
5629
+ const ptr = this.__wbg_ptr;
5630
+ this.__wbg_ptr = 0;
5631
+ WasmSdfStreamFinalization.unregister(this);
5632
+ return ptr;
5633
+ }
5634
+ free() {
5635
+ const ptr = this.__destroy_into_raw();
5636
+ wasm.__wbg_wasmsdfstream_free(ptr, 0);
5637
+ }
5638
+ /**
5639
+ * Resize the reusable input buffer so it can hold at least
5640
+ * `len` bytes, and return the WASM linear-memory pointer to
5641
+ * its first byte.
5642
+ *
5643
+ * CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
5644
+ * `wasm.memory.buffer` may have been detached by a `memory.grow`.
5645
+ * @param {number} len
5646
+ * @returns {number}
5647
+ */
5648
+ allocInputBuffer(len) {
5649
+ const ret = wasm.wasmsdfstream_allocInputBuffer(this.__wbg_ptr, len);
5650
+ return ret >>> 0;
5651
+ }
5652
+ /**
5653
+ * Number of blocks in the most recently parsed frame.
5654
+ * @returns {number}
5655
+ */
5656
+ blockCount() {
5657
+ const ret = wasm.wasmsdfstream_blockCount(this.__wbg_ptr);
5658
+ return ret >>> 0;
5659
+ }
5660
+ /**
5661
+ * Name of block `blockIdx`, or empty string if out of range.
5662
+ * @param {number} block_idx
5663
+ * @returns {string}
5664
+ */
5665
+ blockName(block_idx) {
5666
+ let deferred1_0;
5667
+ let deferred1_1;
5668
+ try {
5669
+ const ret = wasm.wasmsdfstream_blockName(this.__wbg_ptr, block_idx);
5670
+ deferred1_0 = ret[0];
5671
+ deferred1_1 = ret[1];
5672
+ return getStringFromWasm0(ret[0], ret[1]);
5673
+ } finally {
5674
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5675
+ }
5676
+ }
5677
+ /**
5678
+ * Number of columns in block `blockIdx`.
5679
+ * @param {number} block_idx
5680
+ * @returns {number}
5681
+ */
5682
+ columnCount(block_idx) {
5683
+ const ret = wasm.wasmsdfstream_columnCount(this.__wbg_ptr, block_idx);
5684
+ return ret >>> 0;
5685
+ }
5686
+ /**
5687
+ * Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
5688
+ * `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
5689
+ * future parser emits those (current streaming formats do not).
5690
+ * Empty string if the index is out of range.
5691
+ * @param {number} block_idx
5692
+ * @param {number} col_idx
5693
+ * @returns {string}
5694
+ */
5695
+ columnDtype(block_idx, col_idx) {
5696
+ let deferred1_0;
5697
+ let deferred1_1;
5698
+ try {
5699
+ const ret = wasm.wasmsdfstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
5700
+ deferred1_0 = ret[0];
5701
+ deferred1_1 = ret[1];
5702
+ return getStringFromWasm0(ret[0], ret[1]);
5703
+ } finally {
5704
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5705
+ }
5706
+ }
5707
+ /**
5708
+ * Total flat element count of the column. For multi-dimensional
5709
+ * columns (e.g. an Nx3 positions array) this is the product of
5710
+ * all axes — i.e. the length of the slice the matching
5711
+ * `columnPtr*` points at.
5712
+ * @param {number} block_idx
5713
+ * @param {number} col_idx
5714
+ * @returns {number}
5715
+ */
5716
+ columnLen(block_idx, col_idx) {
5717
+ const ret = wasm.wasmsdfstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
5718
+ return ret >>> 0;
5719
+ }
5720
+ /**
5721
+ * Column name at `(blockIdx, colIdx)`, or empty string if
5722
+ * either index is out of range.
5723
+ * @param {number} block_idx
5724
+ * @param {number} col_idx
5725
+ * @returns {string}
5726
+ */
5727
+ columnName(block_idx, col_idx) {
5728
+ let deferred1_0;
5729
+ let deferred1_1;
5730
+ try {
5731
+ const ret = wasm.wasmsdfstream_columnName(this.__wbg_ptr, block_idx, col_idx);
5732
+ deferred1_0 = ret[0];
5733
+ deferred1_1 = ret[1];
5734
+ return getStringFromWasm0(ret[0], ret[1]);
5735
+ } finally {
5736
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5737
+ }
5738
+ }
5739
+ /**
5740
+ * Pointer to the contiguous `f64` slice backing this column,
5741
+ * or 0 (null) if the column is missing or has the wrong
5742
+ * dtype.
5743
+ *
5744
+ * **Lifetime**: valid only until the next non-trivial wasm
5745
+ * call. See the module-level memory-grow contract.
5746
+ * @param {number} block_idx
5747
+ * @param {number} col_idx
5748
+ * @returns {number}
5749
+ */
5750
+ columnPtrF64(block_idx, col_idx) {
5751
+ const ret = wasm.wasmsdfstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
5752
+ return ret >>> 0;
5753
+ }
5754
+ /**
5755
+ * Pointer to the contiguous `i32` slice backing this column,
5756
+ * or 0 (null) if the column is missing or has the wrong
5757
+ * dtype.
5758
+ *
5759
+ * **Lifetime**: valid only until the next non-trivial wasm
5760
+ * call. See the module-level memory-grow contract.
5761
+ * @param {number} block_idx
5762
+ * @param {number} col_idx
5763
+ * @returns {number}
5764
+ */
5765
+ columnPtrI32(block_idx, col_idx) {
5766
+ const ret = wasm.wasmsdfstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
5767
+ return ret >>> 0;
5768
+ }
5769
+ /**
5770
+ * Pointer to the contiguous `u32` slice backing this column,
5771
+ * or 0 (null) if the column is missing or has the wrong
5772
+ * dtype.
5773
+ *
5774
+ * **Lifetime**: valid only until the next non-trivial wasm
5775
+ * call. See the module-level memory-grow contract.
5776
+ * @param {number} block_idx
5777
+ * @param {number} col_idx
5778
+ * @returns {number}
5779
+ */
5780
+ columnPtrU32(block_idx, col_idx) {
5781
+ const ret = wasm.wasmsdfstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
5782
+ return ret >>> 0;
5783
+ }
5784
+ /**
5785
+ * Copy a string column out by value. Returns an empty array
5786
+ * if the column is missing or not a string column.
5787
+ * @param {number} block_idx
5788
+ * @param {number} col_idx
5789
+ * @returns {string[]}
5790
+ */
5791
+ columnStrings(block_idx, col_idx) {
5792
+ const ret = wasm.wasmsdfstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
5793
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5794
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5795
+ return v1;
5796
+ }
5797
+ /**
5798
+ * Feed the first `len` bytes of the input buffer into the
5799
+ * indexer at absolute source offset `globalOffset`. Returns
5800
+ * any frame entries that became finalized as a result.
5801
+ *
5802
+ * `globalOffset` is round-tripped through `f64`; per the
5803
+ * streaming protocol the source size is capped at 1 TB
5804
+ * (well within `Number.MAX_SAFE_INTEGER`).
5805
+ * @param {number} global_offset
5806
+ * @param {number} len
5807
+ * @returns {FrameIndexEntry[]}
5808
+ */
5809
+ feedIndexChunk(global_offset, len) {
5810
+ const ret = wasm.wasmsdfstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
5811
+ if (ret[3]) {
5812
+ throw takeFromExternrefTable0(ret[2]);
5813
+ }
5814
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5815
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5816
+ return v1;
5817
+ }
5818
+ /**
5819
+ * Signal end-of-stream; return any trailing frame entry. The
5820
+ * indexer is consumed and further `feedIndexChunk` calls
5821
+ * throw.
5822
+ * @returns {FrameIndexEntry[]}
5823
+ */
5824
+ finishIndex() {
5825
+ const ret = wasm.wasmsdfstream_finishIndex(this.__wbg_ptr);
5826
+ if (ret[3]) {
5827
+ throw takeFromExternrefTable0(ret[2]);
5828
+ }
5829
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
5830
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
5831
+ return v1;
5832
+ }
5833
+ /**
5834
+ * Current capacity (in bytes) of the reusable input buffer.
5835
+ * @returns {number}
5836
+ */
5837
+ inputCapacity() {
5838
+ const ret = wasm.wasmsdfstream_inputCapacity(this.__wbg_ptr);
5839
+ return ret >>> 0;
5840
+ }
5841
+ /**
5842
+ * Create a new streaming reader. The reusable input buffer
5843
+ * starts empty; call [`allocInputBuffer`] before feeding data.
5844
+ */
5845
+ constructor() {
5846
+ const ret = wasm.wasmsdfstream_new();
5847
+ this.__wbg_ptr = ret;
5848
+ WasmSdfStreamFinalization.register(this, this.__wbg_ptr, this);
5849
+ return this;
5850
+ }
5851
+ /**
5852
+ * Decode the byte range `[offset, offset + len)` from the
5853
+ * reusable input buffer as a single frame. Replaces any
5854
+ * previously cached output; the caller must extract data
5855
+ * before the next `parseRangeInInput` (the same buffer can
5856
+ * be overwritten in between).
5857
+ * @param {number} offset
5858
+ * @param {number} len
5859
+ */
5860
+ parseRangeInInput(offset, len) {
5861
+ const ret = wasm.wasmsdfstream_parseRangeInInput(this.__wbg_ptr, offset, len);
5862
+ if (ret[1]) {
5863
+ throw takeFromExternrefTable0(ret[0]);
5864
+ }
5865
+ }
5866
+ /**
5867
+ * Drop the cached output frame, releasing its memory and
5868
+ * invalidating any outstanding `columnPtr*` pointers.
5869
+ * pointers. Subsequent extraction calls return 0 / empty
5870
+ * until the next `parseRangeInInput`.
5871
+ */
5872
+ releaseFrame() {
5873
+ wasm.wasmsdfstream_releaseFrame(this.__wbg_ptr);
5874
+ }
5875
+ /**
5876
+ * Box H-matrix as a length-9 `Float64Array` (column-major:
5877
+ * `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
5878
+ * or `undefined` if the frame has no simbox.
5879
+ *
5880
+ * Returned by VALUE — the typed array is owned by JS and is
5881
+ * stable across subsequent wasm calls.
5882
+ * @returns {Float64Array | undefined}
5883
+ */
5884
+ simboxH() {
5885
+ const ret = wasm.wasmsdfstream_simboxH(this.__wbg_ptr);
5886
+ let v1;
5887
+ if (ret[0] !== 0) {
5888
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5889
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5890
+ }
5891
+ return v1;
5892
+ }
5893
+ /**
5894
+ * Box origin as a length-3 `Float64Array`, or `undefined` if
5895
+ * the frame has no simbox.
5896
+ * @returns {Float64Array | undefined}
5897
+ */
5898
+ simboxOrigin() {
5899
+ const ret = wasm.wasmsdfstream_simboxOrigin(this.__wbg_ptr);
5900
+ let v1;
5901
+ if (ret[0] !== 0) {
5902
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5903
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
5904
+ }
5905
+ return v1;
5906
+ }
5907
+ /**
5908
+ * Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
5909
+ * `0` = open), or `undefined` if the frame has no simbox.
5910
+ *
5911
+ * (wasm-bindgen does not support `[bool; 3]` returns natively,
5912
+ * hence the `Uint8Array` wire format. The spec calls for
5913
+ * `[boolean, boolean, boolean]`; the JS side is expected to
5914
+ * `Boolean(arr[i])` each entry.)
5915
+ * @returns {Uint8Array | undefined}
4453
5916
  */
4454
- constructor(k, max_iter, seed) {
4455
- const ret = wasm.wasmkmeans_new(k, max_iter, seed);
4456
- if (ret[2]) {
4457
- throw takeFromExternrefTable0(ret[1]);
5917
+ simboxPbc() {
5918
+ const ret = wasm.wasmsdfstream_simboxPbc(this.__wbg_ptr);
5919
+ let v1;
5920
+ if (ret[0] !== 0) {
5921
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
5922
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
4458
5923
  }
4459
- this.__wbg_ptr = ret[0] >>> 0;
4460
- WasmKMeansFinalization.register(this, this.__wbg_ptr, this);
4461
- return this;
5924
+ return v1;
4462
5925
  }
4463
5926
  }
4464
- if (Symbol.dispose) WasmKMeans.prototype[Symbol.dispose] = WasmKMeans.prototype.free;
5927
+ if (Symbol.dispose) WasmSdfStream.prototype[Symbol.dispose] = WasmSdfStream.prototype.free;
4465
5928
 
4466
- /**
4467
- * Stateless wrapper for [`molrs_compute::pca::Pca2`].
4468
- *
4469
- * All configuration lives on [`fitTransform`](Self::fit_transform).
4470
- *
4471
- * # Example (JavaScript)
4472
- *
4473
- * ```js
4474
- * const pca = new WasmPca2();
4475
- * const result = pca.fitTransform(matrix, nRows, nCols);
4476
- * const coords = result.coords(); // Float64Array, length 2 * nRows
4477
- * const variance = result.variance(); // Float64Array, length 2
4478
- * ```
4479
- */
4480
- export class WasmPca2 {
5929
+ export class WasmXyzStream {
4481
5930
  __destroy_into_raw() {
4482
5931
  const ptr = this.__wbg_ptr;
4483
5932
  this.__wbg_ptr = 0;
4484
- WasmPca2Finalization.unregister(this);
5933
+ WasmXyzStreamFinalization.unregister(this);
4485
5934
  return ptr;
4486
5935
  }
4487
5936
  free() {
4488
5937
  const ptr = this.__destroy_into_raw();
4489
- wasm.__wbg_wasmpca2_free(ptr, 0);
5938
+ wasm.__wbg_wasmxyzstream_free(ptr, 0);
4490
5939
  }
4491
5940
  /**
4492
- * Fit 2-component PCA on a row-major observation matrix and return the
4493
- * projected coordinates + per-component variance.
5941
+ * Resize the reusable input buffer so it can hold at least
5942
+ * `len` bytes, and return the WASM linear-memory pointer to
5943
+ * its first byte.
4494
5944
  *
4495
- * # Arguments
5945
+ * CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
5946
+ * `wasm.memory.buffer` may have been detached by a `memory.grow`.
5947
+ * @param {number} len
5948
+ * @returns {number}
5949
+ */
5950
+ allocInputBuffer(len) {
5951
+ const ret = wasm.wasmxyzstream_allocInputBuffer(this.__wbg_ptr, len);
5952
+ return ret >>> 0;
5953
+ }
5954
+ /**
5955
+ * Number of blocks in the most recently parsed frame.
5956
+ * @returns {number}
5957
+ */
5958
+ blockCount() {
5959
+ const ret = wasm.wasmxyzstream_blockCount(this.__wbg_ptr);
5960
+ return ret >>> 0;
5961
+ }
5962
+ /**
5963
+ * Name of block `blockIdx`, or empty string if out of range.
5964
+ * @param {number} block_idx
5965
+ * @returns {string}
5966
+ */
5967
+ blockName(block_idx) {
5968
+ let deferred1_0;
5969
+ let deferred1_1;
5970
+ try {
5971
+ const ret = wasm.wasmxyzstream_blockName(this.__wbg_ptr, block_idx);
5972
+ deferred1_0 = ret[0];
5973
+ deferred1_1 = ret[1];
5974
+ return getStringFromWasm0(ret[0], ret[1]);
5975
+ } finally {
5976
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
5977
+ }
5978
+ }
5979
+ /**
5980
+ * Number of columns in block `blockIdx`.
5981
+ * @param {number} block_idx
5982
+ * @returns {number}
5983
+ */
5984
+ columnCount(block_idx) {
5985
+ const ret = wasm.wasmxyzstream_columnCount(this.__wbg_ptr, block_idx);
5986
+ return ret >>> 0;
5987
+ }
5988
+ /**
5989
+ * Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
5990
+ * `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
5991
+ * future parser emits those (current streaming formats do not).
5992
+ * Empty string if the index is out of range.
5993
+ * @param {number} block_idx
5994
+ * @param {number} col_idx
5995
+ * @returns {string}
5996
+ */
5997
+ columnDtype(block_idx, col_idx) {
5998
+ let deferred1_0;
5999
+ let deferred1_1;
6000
+ try {
6001
+ const ret = wasm.wasmxyzstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
6002
+ deferred1_0 = ret[0];
6003
+ deferred1_1 = ret[1];
6004
+ return getStringFromWasm0(ret[0], ret[1]);
6005
+ } finally {
6006
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
6007
+ }
6008
+ }
6009
+ /**
6010
+ * Total flat element count of the column. For multi-dimensional
6011
+ * columns (e.g. an Nx3 positions array) this is the product of
6012
+ * all axes — i.e. the length of the slice the matching
6013
+ * `columnPtr*` points at.
6014
+ * @param {number} block_idx
6015
+ * @param {number} col_idx
6016
+ * @returns {number}
6017
+ */
6018
+ columnLen(block_idx, col_idx) {
6019
+ const ret = wasm.wasmxyzstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
6020
+ return ret >>> 0;
6021
+ }
6022
+ /**
6023
+ * Column name at `(blockIdx, colIdx)`, or empty string if
6024
+ * either index is out of range.
6025
+ * @param {number} block_idx
6026
+ * @param {number} col_idx
6027
+ * @returns {string}
6028
+ */
6029
+ columnName(block_idx, col_idx) {
6030
+ let deferred1_0;
6031
+ let deferred1_1;
6032
+ try {
6033
+ const ret = wasm.wasmxyzstream_columnName(this.__wbg_ptr, block_idx, col_idx);
6034
+ deferred1_0 = ret[0];
6035
+ deferred1_1 = ret[1];
6036
+ return getStringFromWasm0(ret[0], ret[1]);
6037
+ } finally {
6038
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
6039
+ }
6040
+ }
6041
+ /**
6042
+ * Pointer to the contiguous `f64` slice backing this column,
6043
+ * or 0 (null) if the column is missing or has the wrong
6044
+ * dtype.
4496
6045
  *
4497
- * * `matrix` row-major `n_rows × n_cols` observation matrix.
4498
- * * `n_rows` number of observations.
4499
- * * `n_cols` — number of features.
6046
+ * **Lifetime**: valid only until the next non-trivial wasm
6047
+ * call. See the module-level memory-grow contract.
6048
+ * @param {number} block_idx
6049
+ * @param {number} col_idx
6050
+ * @returns {number}
6051
+ */
6052
+ columnPtrF64(block_idx, col_idx) {
6053
+ const ret = wasm.wasmxyzstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
6054
+ return ret >>> 0;
6055
+ }
6056
+ /**
6057
+ * Pointer to the contiguous `i32` slice backing this column,
6058
+ * or 0 (null) if the column is missing or has the wrong
6059
+ * dtype.
4500
6060
  *
4501
- * # Errors
6061
+ * **Lifetime**: valid only until the next non-trivial wasm
6062
+ * call. See the module-level memory-grow contract.
6063
+ * @param {number} block_idx
6064
+ * @param {number} col_idx
6065
+ * @returns {number}
6066
+ */
6067
+ columnPtrI32(block_idx, col_idx) {
6068
+ const ret = wasm.wasmxyzstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
6069
+ return ret >>> 0;
6070
+ }
6071
+ /**
6072
+ * Pointer to the contiguous `u32` slice backing this column,
6073
+ * or 0 (null) if the column is missing or has the wrong
6074
+ * dtype.
4502
6075
  *
4503
- * Throws if `n_rows < 3`, `n_cols < 2`, the length does not match
4504
- * `n_rows * n_cols`, any element is non-finite, or any column has
4505
- * zero variance.
4506
- * @param {Float64Array} matrix
4507
- * @param {number} n_rows
4508
- * @param {number} n_cols
4509
- * @returns {WasmPcaResult}
6076
+ * **Lifetime**: valid only until the next non-trivial wasm
6077
+ * call. See the module-level memory-grow contract.
6078
+ * @param {number} block_idx
6079
+ * @param {number} col_idx
6080
+ * @returns {number}
4510
6081
  */
4511
- fitTransform(matrix, n_rows, n_cols) {
4512
- const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc_command_export);
4513
- const len0 = WASM_VECTOR_LEN;
4514
- const ret = wasm.wasmpca2_fitTransform(this.__wbg_ptr, ptr0, len0, n_rows, n_cols);
4515
- if (ret[2]) {
4516
- throw takeFromExternrefTable0(ret[1]);
6082
+ columnPtrU32(block_idx, col_idx) {
6083
+ const ret = wasm.wasmxyzstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
6084
+ return ret >>> 0;
6085
+ }
6086
+ /**
6087
+ * Copy a string column out by value. Returns an empty array
6088
+ * if the column is missing or not a string column.
6089
+ * @param {number} block_idx
6090
+ * @param {number} col_idx
6091
+ * @returns {string[]}
6092
+ */
6093
+ columnStrings(block_idx, col_idx) {
6094
+ const ret = wasm.wasmxyzstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
6095
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
6096
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
6097
+ return v1;
6098
+ }
6099
+ /**
6100
+ * Feed the first `len` bytes of the input buffer into the
6101
+ * indexer at absolute source offset `globalOffset`. Returns
6102
+ * any frame entries that became finalized as a result.
6103
+ *
6104
+ * `globalOffset` is round-tripped through `f64`; per the
6105
+ * streaming protocol the source size is capped at 1 TB
6106
+ * (well within `Number.MAX_SAFE_INTEGER`).
6107
+ * @param {number} global_offset
6108
+ * @param {number} len
6109
+ * @returns {FrameIndexEntry[]}
6110
+ */
6111
+ feedIndexChunk(global_offset, len) {
6112
+ const ret = wasm.wasmxyzstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
6113
+ if (ret[3]) {
6114
+ throw takeFromExternrefTable0(ret[2]);
4517
6115
  }
4518
- return WasmPcaResult.__wrap(ret[0]);
6116
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
6117
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
6118
+ return v1;
4519
6119
  }
4520
6120
  /**
4521
- * Create a new PCA calculator. The struct carries no state — all
4522
- * parameters are supplied on [`fitTransform`](Self::fit_transform).
6121
+ * Signal end-of-stream; return any trailing frame entry. The
6122
+ * indexer is consumed and further `feedIndexChunk` calls
6123
+ * throw.
6124
+ * @returns {FrameIndexEntry[]}
6125
+ */
6126
+ finishIndex() {
6127
+ const ret = wasm.wasmxyzstream_finishIndex(this.__wbg_ptr);
6128
+ if (ret[3]) {
6129
+ throw takeFromExternrefTable0(ret[2]);
6130
+ }
6131
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
6132
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
6133
+ return v1;
6134
+ }
6135
+ /**
6136
+ * Current capacity (in bytes) of the reusable input buffer.
6137
+ * @returns {number}
6138
+ */
6139
+ inputCapacity() {
6140
+ const ret = wasm.wasmxyzstream_inputCapacity(this.__wbg_ptr);
6141
+ return ret >>> 0;
6142
+ }
6143
+ /**
6144
+ * Create a new streaming reader. The reusable input buffer
6145
+ * starts empty; call [`allocInputBuffer`] before feeding data.
4523
6146
  */
4524
6147
  constructor() {
4525
- const ret = wasm.wasmpca2_new();
4526
- this.__wbg_ptr = ret >>> 0;
4527
- WasmPca2Finalization.register(this, this.__wbg_ptr, this);
6148
+ const ret = wasm.wasmxyzstream_new();
6149
+ this.__wbg_ptr = ret;
6150
+ WasmXyzStreamFinalization.register(this, this.__wbg_ptr, this);
4528
6151
  return this;
4529
6152
  }
4530
- }
4531
- if (Symbol.dispose) WasmPca2.prototype[Symbol.dispose] = WasmPca2.prototype.free;
4532
-
4533
- /**
4534
- * Result of a [`WasmPca2::fit_transform`] call.
4535
- *
4536
- * Each accessor returns an **owned** `Float64Array` (copy of the underlying
4537
- * `Vec`) so JS is free to let this wrapper be GC'd without dangling views.
4538
- */
4539
- export class WasmPcaResult {
4540
- static __wrap(ptr) {
4541
- ptr = ptr >>> 0;
4542
- const obj = Object.create(WasmPcaResult.prototype);
4543
- obj.__wbg_ptr = ptr;
4544
- WasmPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);
4545
- return obj;
6153
+ /**
6154
+ * Decode the byte range `[offset, offset + len)` from the
6155
+ * reusable input buffer as a single frame. Replaces any
6156
+ * previously cached output; the caller must extract data
6157
+ * before the next `parseRangeInInput` (the same buffer can
6158
+ * be overwritten in between).
6159
+ * @param {number} offset
6160
+ * @param {number} len
6161
+ */
6162
+ parseRangeInInput(offset, len) {
6163
+ const ret = wasm.wasmxyzstream_parseRangeInInput(this.__wbg_ptr, offset, len);
6164
+ if (ret[1]) {
6165
+ throw takeFromExternrefTable0(ret[0]);
6166
+ }
4546
6167
  }
4547
- __destroy_into_raw() {
4548
- const ptr = this.__wbg_ptr;
4549
- this.__wbg_ptr = 0;
4550
- WasmPcaResultFinalization.unregister(this);
4551
- return ptr;
6168
+ /**
6169
+ * Drop the cached output frame, releasing its memory and
6170
+ * invalidating any outstanding `columnPtr*` pointers.
6171
+ * pointers. Subsequent extraction calls return 0 / empty
6172
+ * until the next `parseRangeInInput`.
6173
+ */
6174
+ releaseFrame() {
6175
+ wasm.wasmxyzstream_releaseFrame(this.__wbg_ptr);
4552
6176
  }
4553
- free() {
4554
- const ptr = this.__destroy_into_raw();
4555
- wasm.__wbg_wasmpcaresult_free(ptr, 0);
6177
+ /**
6178
+ * Box H-matrix as a length-9 `Float64Array` (column-major:
6179
+ * `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
6180
+ * or `undefined` if the frame has no simbox.
6181
+ *
6182
+ * Returned by VALUE — the typed array is owned by JS and is
6183
+ * stable across subsequent wasm calls.
6184
+ * @returns {Float64Array | undefined}
6185
+ */
6186
+ simboxH() {
6187
+ const ret = wasm.wasmxyzstream_simboxH(this.__wbg_ptr);
6188
+ let v1;
6189
+ if (ret[0] !== 0) {
6190
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
6191
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
6192
+ }
6193
+ return v1;
4556
6194
  }
4557
6195
  /**
4558
- * Projected 2D coordinates as a row-major `Float64Array` of length
4559
- * `2 * n_rows`. `coords[2 * i + 0]` is the PC1 score for row `i`,
4560
- * `coords[2 * i + 1]` is PC2.
4561
- * @returns {Float64Array}
6196
+ * Box origin as a length-3 `Float64Array`, or `undefined` if
6197
+ * the frame has no simbox.
6198
+ * @returns {Float64Array | undefined}
4562
6199
  */
4563
- coords() {
4564
- const ret = wasm.wasmpcaresult_coords(this.__wbg_ptr);
4565
- return ret;
6200
+ simboxOrigin() {
6201
+ const ret = wasm.wasmxyzstream_simboxOrigin(this.__wbg_ptr);
6202
+ let v1;
6203
+ if (ret[0] !== 0) {
6204
+ v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
6205
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
6206
+ }
6207
+ return v1;
4566
6208
  }
4567
6209
  /**
4568
- * Explained variance per component as `Float64Array` of length 2.
4569
- * `variance[0] >= variance[1]` by construction.
4570
- * @returns {Float64Array}
6210
+ * Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
6211
+ * `0` = open), or `undefined` if the frame has no simbox.
6212
+ *
6213
+ * (wasm-bindgen does not support `[bool; 3]` returns natively,
6214
+ * hence the `Uint8Array` wire format. The spec calls for
6215
+ * `[boolean, boolean, boolean]`; the JS side is expected to
6216
+ * `Boolean(arr[i])` each entry.)
6217
+ * @returns {Uint8Array | undefined}
4571
6218
  */
4572
- variance() {
4573
- const ret = wasm.wasmpcaresult_variance(this.__wbg_ptr);
4574
- return ret;
6219
+ simboxPbc() {
6220
+ const ret = wasm.wasmxyzstream_simboxPbc(this.__wbg_ptr);
6221
+ let v1;
6222
+ if (ret[0] !== 0) {
6223
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
6224
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
6225
+ }
6226
+ return v1;
4575
6227
  }
4576
6228
  }
4577
- if (Symbol.dispose) WasmPcaResult.prototype[Symbol.dispose] = WasmPcaResult.prototype.free;
6229
+ if (Symbol.dispose) WasmXyzStream.prototype[Symbol.dispose] = WasmXyzStream.prototype.free;
4578
6230
 
4579
6231
  /**
4580
6232
  * XYZ / Extended XYZ file reader.
@@ -4664,7 +6316,7 @@ export class XYZReader {
4664
6316
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
4665
6317
  const len0 = WASM_VECTOR_LEN;
4666
6318
  const ret = wasm.xyzreader_new(ptr0, len0);
4667
- this.__wbg_ptr = ret >>> 0;
6319
+ this.__wbg_ptr = ret;
4668
6320
  XYZReaderFinalization.register(this, this.__wbg_ptr, this);
4669
6321
  return this;
4670
6322
  }
@@ -4760,7 +6412,7 @@ export function generate3D(frame, speed, seed) {
4760
6412
  _assertClass(frame, Frame);
4761
6413
  var ptr0 = isLikeNone(speed) ? 0 : passStringToWasm0(speed, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
4762
6414
  var len0 = WASM_VECTOR_LEN;
4763
- const ret = wasm.generate3D(frame.__wbg_ptr, ptr0, len0, isLikeNone(seed) ? 0x100000001 : (seed) >>> 0);
6415
+ const ret = wasm.generate3D(frame.__wbg_ptr, ptr0, len0, isLikeNone(seed) ? Number.MAX_SAFE_INTEGER : (seed) >>> 0);
4764
6416
  if (ret[2]) {
4765
6417
  throw takeFromExternrefTable0(ret[1]);
4766
6418
  }
@@ -4897,18 +6549,18 @@ export function writeFrame(frame, format) {
4897
6549
  wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
4898
6550
  }
4899
6551
  }
4900
- export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
6552
+ export function __wbg___wbindgen_debug_string_edece8177ad01481(arg0, arg1) {
4901
6553
  const ret = debugString(arg1);
4902
6554
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
4903
6555
  const len1 = WASM_VECTOR_LEN;
4904
6556
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4905
6557
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4906
6558
  }
4907
- export function __wbg___wbindgen_memory_dfa12096f400c9bd() {
6559
+ export function __wbg___wbindgen_memory_9544558992fc5400() {
4908
6560
  const ret = wasm.memory;
4909
6561
  return ret;
4910
6562
  }
4911
- export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
6563
+ export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
4912
6564
  const obj = arg1;
4913
6565
  const ret = typeof(obj) === 'string' ? obj : undefined;
4914
6566
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -4916,10 +6568,10 @@ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
4916
6568
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4917
6569
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4918
6570
  }
4919
- export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
6571
+ export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
4920
6572
  throw new Error(getStringFromWasm0(arg0, arg1));
4921
6573
  }
4922
- export function __wbg_done_9158f7cc8751ba32(arg0) {
6574
+ export function __wbg_done_54b8da57023b7ed2(arg0) {
4923
6575
  const ret = arg0.done;
4924
6576
  return ret;
4925
6577
  }
@@ -4934,38 +6586,42 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
4934
6586
  wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
4935
6587
  }
4936
6588
  }
6589
+ export function __wbg_frameindexentry_new(arg0) {
6590
+ const ret = FrameIndexEntry.__wrap(arg0);
6591
+ return ret;
6592
+ }
4937
6593
  export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
4938
6594
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
4939
6595
  }, arguments); }
4940
- export function __wbg_get_ef70f6ce70a05af6(arg0, arg1) {
6596
+ export function __wbg_get_9573a5d891e60573(arg0, arg1) {
4941
6597
  const ret = arg0.get(arg1);
4942
6598
  return ret;
4943
6599
  }
4944
- export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
6600
+ export function __wbg_get_unchecked_1dfe6d05ad91d9b7(arg0, arg1) {
4945
6601
  const ret = arg0[arg1 >>> 0];
4946
6602
  return ret;
4947
6603
  }
4948
- export function __wbg_keys_7fc58fd5f4899356(arg0) {
6604
+ export function __wbg_keys_3905d699258a1ee0(arg0) {
4949
6605
  const ret = arg0.keys();
4950
6606
  return ret;
4951
6607
  }
4952
- export function __wbg_length_3d4ecd04bd8d22f1(arg0) {
6608
+ export function __wbg_length_2591a0f4f659a55c(arg0) {
4953
6609
  const ret = arg0.length;
4954
6610
  return ret;
4955
6611
  }
4956
- export function __wbg_length_7da87610a31a2ef9(arg0) {
6612
+ export function __wbg_length_3a1b902b6cde9e2c(arg0) {
4957
6613
  const ret = arg0.length;
4958
6614
  return ret;
4959
6615
  }
4960
- export function __wbg_length_9f1775224cf1d815(arg0) {
6616
+ export function __wbg_length_56fcd3e2b7e0299d(arg0) {
4961
6617
  const ret = arg0.length;
4962
6618
  return ret;
4963
6619
  }
4964
- export function __wbg_length_d807629e96c741b8(arg0) {
6620
+ export function __wbg_length_911750a64e2f4f88(arg0) {
4965
6621
  const ret = arg0.length;
4966
6622
  return ret;
4967
6623
  }
4968
- export function __wbg_length_fab29957ea6bdb8c(arg0) {
6624
+ export function __wbg_length_c7ce929623e7a230(arg0) {
4969
6625
  const ret = arg0.length;
4970
6626
  return ret;
4971
6627
  }
@@ -4973,64 +6629,78 @@ export function __wbg_msdresult_new(arg0) {
4973
6629
  const ret = MSDResult.__wrap(arg0);
4974
6630
  return ret;
4975
6631
  }
4976
- export function __wbg_new_0c7403db6e782f19(arg0) {
4977
- const ret = new Uint8Array(arg0);
4978
- return ret;
4979
- }
4980
6632
  export function __wbg_new_227d7c05414eb861() {
4981
6633
  const ret = new Error();
4982
6634
  return ret;
4983
6635
  }
4984
- export function __wbg_new_682678e2f47e32bc() {
6636
+ export function __wbg_new_310879b66b6e95e1() {
4985
6637
  const ret = new Array();
4986
6638
  return ret;
4987
6639
  }
4988
- export function __wbg_new_from_slice_01793f7edd3b321a(arg0, arg1) {
4989
- const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
6640
+ export function __wbg_new_7ddec6de44ff8f5d(arg0) {
6641
+ const ret = new Uint8Array(arg0);
4990
6642
  return ret;
4991
6643
  }
4992
- export function __wbg_new_from_slice_3115b094b1002246(arg0, arg1) {
6644
+ export function __wbg_new_from_slice_02962bf7778cf945(arg0, arg1) {
4993
6645
  const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
4994
6646
  return ret;
4995
6647
  }
4996
- export function __wbg_new_from_slice_ede497d29b90a4ad(arg0, arg1) {
6648
+ export function __wbg_new_from_slice_53b9575cecde0d9e(arg0, arg1) {
4997
6649
  const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
4998
6650
  return ret;
4999
6651
  }
5000
- export function __wbg_new_with_length_33f0a4c41f7ce2fc(arg0) {
5001
- const ret = new Int32Array(arg0 >>> 0);
6652
+ export function __wbg_new_from_slice_f92bf65e9a895613(arg0, arg1) {
6653
+ const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
5002
6654
  return ret;
5003
6655
  }
5004
- export function __wbg_new_with_length_5cfd777b51078805(arg0) {
6656
+ export function __wbg_new_with_length_1278c16a5c5b497f(arg0) {
5005
6657
  const ret = new Float64Array(arg0 >>> 0);
5006
6658
  return ret;
5007
6659
  }
5008
- export function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {
6660
+ export function __wbg_new_with_length_78398b95fa59feae(arg0) {
6661
+ const ret = new Int32Array(arg0 >>> 0);
6662
+ return ret;
6663
+ }
6664
+ export function __wbg_new_with_length_99887c91eae4abab(arg0) {
6665
+ const ret = new Uint8Array(arg0 >>> 0);
6666
+ return ret;
6667
+ }
6668
+ export function __wbg_new_with_length_f128f2c16ad4f906(arg0) {
6669
+ const ret = new Uint32Array(arg0 >>> 0);
6670
+ return ret;
6671
+ }
6672
+ export function __wbg_next_6429a146bf756f93() { return handleError(function (arg0) {
5009
6673
  const ret = arg0.next();
5010
6674
  return ret;
5011
6675
  }, arguments); }
5012
- export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
5013
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
5014
- }
5015
- export function __wbg_prototypesetcall_c5875dab42ff6b97(arg0, arg1, arg2) {
6676
+ export function __wbg_prototypesetcall_272875b350b1e49b(arg0, arg1, arg2) {
5016
6677
  Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
5017
6678
  }
5018
- export function __wbg_prototypesetcall_d412f763861ea165(arg0, arg1, arg2) {
6679
+ export function __wbg_prototypesetcall_303283bf37c9f014(arg0, arg1, arg2) {
5019
6680
  Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), arg2);
5020
6681
  }
5021
- export function __wbg_prototypesetcall_db677c7a1d7d3039(arg0, arg1, arg2) {
6682
+ export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
6683
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
6684
+ }
6685
+ export function __wbg_prototypesetcall_e8325bfb1e498d1c(arg0, arg1, arg2) {
5022
6686
  Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
5023
6687
  }
5024
- export function __wbg_push_471a5b068a5295f6(arg0, arg1) {
6688
+ export function __wbg_push_b77c476b01548d0a(arg0, arg1) {
5025
6689
  const ret = arg0.push(arg1);
5026
6690
  return ret;
5027
6691
  }
5028
- export function __wbg_set_5637e648df81c8e5(arg0, arg1, arg2) {
6692
+ export function __wbg_set_5bffd0c00e65c280(arg0, arg1, arg2) {
5029
6693
  arg0.set(getArrayF64FromWasm0(arg1, arg2));
5030
6694
  }
5031
- export function __wbg_set_6c7215e0274bbbf2(arg0, arg1, arg2) {
6695
+ export function __wbg_set_943e5a384dda27eb(arg0, arg1, arg2) {
5032
6696
  arg0.set(getArrayI32FromWasm0(arg1, arg2));
5033
6697
  }
6698
+ export function __wbg_set_index_6216eb6926d2fbc6(arg0, arg1, arg2) {
6699
+ arg0[arg1 >>> 0] = arg2;
6700
+ }
6701
+ export function __wbg_set_index_b93fd9d797d1ff98(arg0, arg1, arg2) {
6702
+ arg0[arg1 >>> 0] = arg2 >>> 0;
6703
+ }
5034
6704
  export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
5035
6705
  const ret = arg1.stack;
5036
6706
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -5038,7 +6708,7 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
5038
6708
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5039
6709
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5040
6710
  }
5041
- export function __wbg_value_ee3a06f4579184fa(arg0) {
6711
+ export function __wbg_value_9cc0518af87a489c(arg0) {
5042
6712
  const ret = arg0.value;
5043
6713
  return ret;
5044
6714
  }
@@ -5073,97 +6743,124 @@ export function __wbindgen_init_externref_table() {
5073
6743
  }
5074
6744
  const BlockFinalization = (typeof FinalizationRegistry === 'undefined')
5075
6745
  ? { register: () => {}, unregister: () => {} }
5076
- : new FinalizationRegistry(ptr => wasm.__wbg_block_free(ptr >>> 0, 1));
6746
+ : new FinalizationRegistry(ptr => wasm.__wbg_block_free(ptr, 1));
5077
6747
  const BoxFinalization = (typeof FinalizationRegistry === 'undefined')
5078
6748
  ? { register: () => {}, unregister: () => {} }
5079
- : new FinalizationRegistry(ptr => wasm.__wbg_box_free(ptr >>> 0, 1));
6749
+ : new FinalizationRegistry(ptr => wasm.__wbg_box_free(ptr, 1));
5080
6750
  const CenterOfMassFinalization = (typeof FinalizationRegistry === 'undefined')
5081
6751
  ? { register: () => {}, unregister: () => {} }
5082
- : new FinalizationRegistry(ptr => wasm.__wbg_centerofmass_free(ptr >>> 0, 1));
6752
+ : new FinalizationRegistry(ptr => wasm.__wbg_centerofmass_free(ptr, 1));
5083
6753
  const CenterOfMassResultFinalization = (typeof FinalizationRegistry === 'undefined')
5084
6754
  ? { register: () => {}, unregister: () => {} }
5085
- : new FinalizationRegistry(ptr => wasm.__wbg_centerofmassresult_free(ptr >>> 0, 1));
6755
+ : new FinalizationRegistry(ptr => wasm.__wbg_centerofmassresult_free(ptr, 1));
6756
+ const CHGCARReaderFinalization = (typeof FinalizationRegistry === 'undefined')
6757
+ ? { register: () => {}, unregister: () => {} }
6758
+ : new FinalizationRegistry(ptr => wasm.__wbg_chgcarreader_free(ptr, 1));
6759
+ const CIFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
6760
+ ? { register: () => {}, unregister: () => {} }
6761
+ : new FinalizationRegistry(ptr => wasm.__wbg_cifreader_free(ptr, 1));
5086
6762
  const ClusterFinalization = (typeof FinalizationRegistry === 'undefined')
5087
6763
  ? { register: () => {}, unregister: () => {} }
5088
- : new FinalizationRegistry(ptr => wasm.__wbg_cluster_free(ptr >>> 0, 1));
6764
+ : new FinalizationRegistry(ptr => wasm.__wbg_cluster_free(ptr, 1));
5089
6765
  const ClusterCentersFinalization = (typeof FinalizationRegistry === 'undefined')
5090
6766
  ? { register: () => {}, unregister: () => {} }
5091
- : new FinalizationRegistry(ptr => wasm.__wbg_clustercenters_free(ptr >>> 0, 1));
6767
+ : new FinalizationRegistry(ptr => wasm.__wbg_clustercenters_free(ptr, 1));
5092
6768
  const ClusterResultFinalization = (typeof FinalizationRegistry === 'undefined')
5093
6769
  ? { register: () => {}, unregister: () => {} }
5094
- : new FinalizationRegistry(ptr => wasm.__wbg_clusterresult_free(ptr >>> 0, 1));
5095
- const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
6770
+ : new FinalizationRegistry(ptr => wasm.__wbg_clusterresult_free(ptr, 1));
6771
+ const CubeReaderFinalization = (typeof FinalizationRegistry === 'undefined')
6772
+ ? { register: () => {}, unregister: () => {} }
6773
+ : new FinalizationRegistry(ptr => wasm.__wbg_cubereader_free(ptr, 1));
6774
+ const DCDReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5096
6775
  ? { register: () => {}, unregister: () => {} }
5097
- : new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr >>> 0, 1));
5098
- const GridFinalization = (typeof FinalizationRegistry === 'undefined')
6776
+ : new FinalizationRegistry(ptr => wasm.__wbg_dcdreader_free(ptr, 1));
6777
+ const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
5099
6778
  ? { register: () => {}, unregister: () => {} }
5100
- : new FinalizationRegistry(ptr => wasm.__wbg_grid_free(ptr >>> 0, 1));
6779
+ : new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr, 1));
5101
6780
  const GyrationTensorFinalization = (typeof FinalizationRegistry === 'undefined')
5102
6781
  ? { register: () => {}, unregister: () => {} }
5103
- : new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr >>> 0, 1));
6782
+ : new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr, 1));
5104
6783
  const InertiaTensorFinalization = (typeof FinalizationRegistry === 'undefined')
5105
6784
  ? { register: () => {}, unregister: () => {} }
5106
- : new FinalizationRegistry(ptr => wasm.__wbg_inertiatensor_free(ptr >>> 0, 1));
6785
+ : new FinalizationRegistry(ptr => wasm.__wbg_inertiatensor_free(ptr, 1));
5107
6786
  const LAMMPSTrajReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5108
6787
  ? { register: () => {}, unregister: () => {} }
5109
- : new FinalizationRegistry(ptr => wasm.__wbg_lammpstrajreader_free(ptr >>> 0, 1));
6788
+ : new FinalizationRegistry(ptr => wasm.__wbg_lammpstrajreader_free(ptr, 1));
5110
6789
  const LAMMPSReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5111
6790
  ? { register: () => {}, unregister: () => {} }
5112
- : new FinalizationRegistry(ptr => wasm.__wbg_lammpsreader_free(ptr >>> 0, 1));
6791
+ : new FinalizationRegistry(ptr => wasm.__wbg_lammpsreader_free(ptr, 1));
5113
6792
  const LinkedCellFinalization = (typeof FinalizationRegistry === 'undefined')
5114
6793
  ? { register: () => {}, unregister: () => {} }
5115
- : new FinalizationRegistry(ptr => wasm.__wbg_linkedcell_free(ptr >>> 0, 1));
6794
+ : new FinalizationRegistry(ptr => wasm.__wbg_linkedcell_free(ptr, 1));
5116
6795
  const MSDFinalization = (typeof FinalizationRegistry === 'undefined')
5117
6796
  ? { register: () => {}, unregister: () => {} }
5118
- : new FinalizationRegistry(ptr => wasm.__wbg_msd_free(ptr >>> 0, 1));
6797
+ : new FinalizationRegistry(ptr => wasm.__wbg_msd_free(ptr, 1));
5119
6798
  const MSDResultFinalization = (typeof FinalizationRegistry === 'undefined')
5120
6799
  ? { register: () => {}, unregister: () => {} }
5121
- : new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr >>> 0, 1));
6800
+ : new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr, 1));
5122
6801
  const MolRecReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5123
6802
  ? { register: () => {}, unregister: () => {} }
5124
- : new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr >>> 0, 1));
6803
+ : new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr, 1));
5125
6804
  const NeighborListFinalization = (typeof FinalizationRegistry === 'undefined')
5126
6805
  ? { register: () => {}, unregister: () => {} }
5127
- : new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr >>> 0, 1));
6806
+ : new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr, 1));
5128
6807
  const PDBReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5129
6808
  ? { register: () => {}, unregister: () => {} }
5130
- : new FinalizationRegistry(ptr => wasm.__wbg_pdbreader_free(ptr >>> 0, 1));
6809
+ : new FinalizationRegistry(ptr => wasm.__wbg_pdbreader_free(ptr, 1));
5131
6810
  const RDFFinalization = (typeof FinalizationRegistry === 'undefined')
5132
6811
  ? { register: () => {}, unregister: () => {} }
5133
- : new FinalizationRegistry(ptr => wasm.__wbg_rdf_free(ptr >>> 0, 1));
6812
+ : new FinalizationRegistry(ptr => wasm.__wbg_rdf_free(ptr, 1));
5134
6813
  const RDFResultFinalization = (typeof FinalizationRegistry === 'undefined')
5135
6814
  ? { register: () => {}, unregister: () => {} }
5136
- : new FinalizationRegistry(ptr => wasm.__wbg_rdfresult_free(ptr >>> 0, 1));
6815
+ : new FinalizationRegistry(ptr => wasm.__wbg_rdfresult_free(ptr, 1));
5137
6816
  const RadiusOfGyrationFinalization = (typeof FinalizationRegistry === 'undefined')
5138
6817
  ? { register: () => {}, unregister: () => {} }
5139
- : new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr >>> 0, 1));
6818
+ : new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr, 1));
5140
6819
  const SDFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5141
6820
  ? { register: () => {}, unregister: () => {} }
5142
- : new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr >>> 0, 1));
6821
+ : new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr, 1));
5143
6822
  const TopologyRingInfoFinalization = (typeof FinalizationRegistry === 'undefined')
5144
6823
  ? { register: () => {}, unregister: () => {} }
5145
- : new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr >>> 0, 1));
6824
+ : new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr, 1));
5146
6825
  const WasmArrayFinalization = (typeof FinalizationRegistry === 'undefined')
5147
6826
  ? { register: () => {}, unregister: () => {} }
5148
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmarray_free(ptr >>> 0, 1));
6827
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmarray_free(ptr, 1));
6828
+ const FrameIndexEntryFinalization = (typeof FinalizationRegistry === 'undefined')
6829
+ ? { register: () => {}, unregister: () => {} }
6830
+ : new FinalizationRegistry(ptr => wasm.__wbg_frameindexentry_free(ptr, 1));
5149
6831
  const WasmKMeansFinalization = (typeof FinalizationRegistry === 'undefined')
5150
6832
  ? { register: () => {}, unregister: () => {} }
5151
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmkmeans_free(ptr >>> 0, 1));
6833
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmkmeans_free(ptr, 1));
6834
+ const WasmLammpsDataStreamFinalization = (typeof FinalizationRegistry === 'undefined')
6835
+ ? { register: () => {}, unregister: () => {} }
6836
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmlammpsdatastream_free(ptr, 1));
6837
+ const WasmLammpsDumpStreamFinalization = (typeof FinalizationRegistry === 'undefined')
6838
+ ? { register: () => {}, unregister: () => {} }
6839
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmlammpsdumpstream_free(ptr, 1));
5152
6840
  const WasmPca2Finalization = (typeof FinalizationRegistry === 'undefined')
5153
6841
  ? { register: () => {}, unregister: () => {} }
5154
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmpca2_free(ptr >>> 0, 1));
6842
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpca2_free(ptr, 1));
5155
6843
  const WasmPcaResultFinalization = (typeof FinalizationRegistry === 'undefined')
5156
6844
  ? { register: () => {}, unregister: () => {} }
5157
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmpcaresult_free(ptr >>> 0, 1));
6845
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpcaresult_free(ptr, 1));
6846
+ const WasmPdbStreamFinalization = (typeof FinalizationRegistry === 'undefined')
6847
+ ? { register: () => {}, unregister: () => {} }
6848
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpdbstream_free(ptr, 1));
6849
+ const WasmSdfStreamFinalization = (typeof FinalizationRegistry === 'undefined')
6850
+ ? { register: () => {}, unregister: () => {} }
6851
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsdfstream_free(ptr, 1));
5158
6852
  const SmilesIRFinalization = (typeof FinalizationRegistry === 'undefined')
5159
6853
  ? { register: () => {}, unregister: () => {} }
5160
- : new FinalizationRegistry(ptr => wasm.__wbg_smilesir_free(ptr >>> 0, 1));
6854
+ : new FinalizationRegistry(ptr => wasm.__wbg_smilesir_free(ptr, 1));
5161
6855
  const TopologyFinalization = (typeof FinalizationRegistry === 'undefined')
5162
6856
  ? { register: () => {}, unregister: () => {} }
5163
- : new FinalizationRegistry(ptr => wasm.__wbg_topology_free(ptr >>> 0, 1));
6857
+ : new FinalizationRegistry(ptr => wasm.__wbg_topology_free(ptr, 1));
6858
+ const WasmXyzStreamFinalization = (typeof FinalizationRegistry === 'undefined')
6859
+ ? { register: () => {}, unregister: () => {} }
6860
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmxyzstream_free(ptr, 1));
5164
6861
  const XYZReaderFinalization = (typeof FinalizationRegistry === 'undefined')
5165
6862
  ? { register: () => {}, unregister: () => {} }
5166
- : new FinalizationRegistry(ptr => wasm.__wbg_xyzreader_free(ptr >>> 0, 1));
6863
+ : new FinalizationRegistry(ptr => wasm.__wbg_xyzreader_free(ptr, 1));
5167
6864
 
5168
6865
  function addToExternrefTable0(obj) {
5169
6866
  const idx = wasm.__externref_table_alloc_command_export();
@@ -5298,8 +6995,7 @@ function getInt32ArrayMemory0() {
5298
6995
  }
5299
6996
 
5300
6997
  function getStringFromWasm0(ptr, len) {
5301
- ptr = ptr >>> 0;
5302
- return decodeText(ptr, len);
6998
+ return decodeText(ptr >>> 0, len);
5303
6999
  }
5304
7000
 
5305
7001
  let cachedUint32ArrayMemory0 = null;
@@ -5338,6 +7034,13 @@ function passArray32ToWasm0(arg, malloc) {
5338
7034
  return ptr;
5339
7035
  }
5340
7036
 
7037
+ function passArray8ToWasm0(arg, malloc) {
7038
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
7039
+ getUint8ArrayMemory0().set(arg, ptr / 1);
7040
+ WASM_VECTOR_LEN = arg.length;
7041
+ return ptr;
7042
+ }
7043
+
5341
7044
  function passArrayF64ToWasm0(arg, malloc) {
5342
7045
  const ptr = malloc(arg.length * 8, 8) >>> 0;
5343
7046
  getFloat64ArrayMemory0().set(arg, ptr / 8);