@kent-tokyo/chematic 0.1.10 → 0.1.19

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/chematic_wasm.js CHANGED
@@ -1,9 +1,1585 @@
1
1
  /* @ts-self-types="./chematic_wasm.d.ts" */
2
- import * as wasm from "./chematic_wasm_bg.wasm";
3
- import { __wbg_set_wasm } from "./chematic_wasm_bg.js";
4
-
5
- __wbg_set_wasm(wasm);
6
- wasm.__wbindgen_start();
7
- export {
8
- DepictOptions, MolHandle, add_hydrogens, brics_fragment_count, depict_svg_grid, ecfp4_bitvec, is_valid_smiles, parse_smiles, remove_hydrogens, run_reactants, tanimoto_atom_pair, tanimoto_ecfp4, tanimoto_fcfp4, tanimoto_torsion
9
- } from "./chematic_wasm_bg.js";
2
+
3
+ /**
4
+ * Style options for [`MolHandle::depict_svg_opts`].
5
+ *
6
+ * Construct with `new DepictOptions()`, then call setters:
7
+ * ```js
8
+ * const opts = new DepictOptions();
9
+ * opts.set_background("transparent");
10
+ * opts.set_dark(true);
11
+ * opts.set_width(240);
12
+ * opts.set_height(240);
13
+ * ```
14
+ */
15
+ export class DepictOptions {
16
+ __destroy_into_raw() {
17
+ const ptr = this.__wbg_ptr;
18
+ this.__wbg_ptr = 0;
19
+ DepictOptionsFinalization.unregister(this);
20
+ return ptr;
21
+ }
22
+ free() {
23
+ const ptr = this.__destroy_into_raw();
24
+ wasm.__wbg_depictoptions_free(ptr, 0);
25
+ }
26
+ constructor() {
27
+ const ret = wasm.depictoptions_new();
28
+ this.__wbg_ptr = ret;
29
+ DepictOptionsFinalization.register(this, this.__wbg_ptr, this);
30
+ return this;
31
+ }
32
+ /**
33
+ * Set a per-atom color override (CSS color string). Calling multiple times
34
+ * for the same `idx` uses the last value. The atom is highlighted even if
35
+ * not in `set_highlight_atoms`.
36
+ * @param {number} idx
37
+ * @param {string} color
38
+ */
39
+ set_atom_color(idx, color) {
40
+ const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ wasm.depictoptions_set_atom_color(this.__wbg_ptr, idx, ptr0, len0);
43
+ }
44
+ /**
45
+ * @param {boolean} v
46
+ */
47
+ set_atom_ids(v) {
48
+ wasm.depictoptions_set_atom_ids(this.__wbg_ptr, v);
49
+ }
50
+ /**
51
+ * @param {string} bg
52
+ */
53
+ set_background(bg) {
54
+ const ptr0 = passStringToWasm0(bg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
55
+ const len0 = WASM_VECTOR_LEN;
56
+ wasm.depictoptions_set_background(this.__wbg_ptr, ptr0, len0);
57
+ }
58
+ /**
59
+ * @param {boolean} dark
60
+ */
61
+ set_dark(dark) {
62
+ wasm.depictoptions_set_dark(this.__wbg_ptr, dark);
63
+ }
64
+ /**
65
+ * @param {number} h
66
+ */
67
+ set_height(h) {
68
+ wasm.depictoptions_set_height(this.__wbg_ptr, h);
69
+ }
70
+ /**
71
+ * @param {Uint32Array} atoms
72
+ */
73
+ set_highlight_atoms(atoms) {
74
+ const ptr0 = passArray32ToWasm0(atoms, wasm.__wbindgen_malloc);
75
+ const len0 = WASM_VECTOR_LEN;
76
+ wasm.depictoptions_set_highlight_atoms(this.__wbg_ptr, ptr0, len0);
77
+ }
78
+ /**
79
+ * @param {Uint32Array} bonds
80
+ */
81
+ set_highlight_bonds(bonds) {
82
+ const ptr0 = passArray32ToWasm0(bonds, wasm.__wbindgen_malloc);
83
+ const len0 = WASM_VECTOR_LEN;
84
+ wasm.depictoptions_set_highlight_bonds(this.__wbg_ptr, ptr0, len0);
85
+ }
86
+ /**
87
+ * @param {string} color
88
+ */
89
+ set_highlight_color(color) {
90
+ const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
91
+ const len0 = WASM_VECTOR_LEN;
92
+ wasm.depictoptions_set_highlight_color(this.__wbg_ptr, ptr0, len0);
93
+ }
94
+ /**
95
+ * @param {boolean} v
96
+ */
97
+ set_kekulize(v) {
98
+ wasm.depictoptions_set_kekulize(this.__wbg_ptr, v);
99
+ }
100
+ /**
101
+ * @param {number} p
102
+ */
103
+ set_padding(p) {
104
+ wasm.depictoptions_set_padding(this.__wbg_ptr, p);
105
+ }
106
+ /**
107
+ * @param {boolean} v
108
+ */
109
+ set_show_atom_indices(v) {
110
+ wasm.depictoptions_set_show_atom_indices(this.__wbg_ptr, v);
111
+ }
112
+ /**
113
+ * @param {number} w
114
+ */
115
+ set_width(w) {
116
+ wasm.depictoptions_set_width(this.__wbg_ptr, w);
117
+ }
118
+ }
119
+ if (Symbol.dispose) DepictOptions.prototype[Symbol.dispose] = DepictOptions.prototype.free;
120
+
121
+ /**
122
+ * A handle to a parsed molecule. Owns the molecule behind an `Rc` so that
123
+ * it can be cheaply cloned on the JS side without copying atom/bond data.
124
+ */
125
+ export class MolHandle {
126
+ static __wrap(ptr) {
127
+ const obj = Object.create(MolHandle.prototype);
128
+ obj.__wbg_ptr = ptr;
129
+ MolHandleFinalization.register(obj, obj.__wbg_ptr, obj);
130
+ return obj;
131
+ }
132
+ __destroy_into_raw() {
133
+ const ptr = this.__wbg_ptr;
134
+ this.__wbg_ptr = 0;
135
+ MolHandleFinalization.unregister(this);
136
+ return ptr;
137
+ }
138
+ free() {
139
+ const ptr = this.__destroy_into_raw();
140
+ wasm.__wbg_molhandle_free(ptr, 0);
141
+ }
142
+ /**
143
+ * Number of aromatic rings (all ring atoms aromatic).
144
+ * @returns {number}
145
+ */
146
+ aromatic_ring_count() {
147
+ const ret = wasm.molhandle_aromatic_ring_count(this.__wbg_ptr);
148
+ return ret >>> 0;
149
+ }
150
+ /**
151
+ * Number of heavy atoms (explicit atoms in the graph; does not count implicit H).
152
+ * @returns {number}
153
+ */
154
+ atom_count() {
155
+ const ret = wasm.molhandle_atom_count(this.__wbg_ptr);
156
+ return ret >>> 0;
157
+ }
158
+ /**
159
+ * Bertz complexity index (BertzCT).
160
+ * @returns {number}
161
+ */
162
+ bertz_ct() {
163
+ const ret = wasm.molhandle_bertz_ct(this.__wbg_ptr);
164
+ return ret;
165
+ }
166
+ /**
167
+ * Number of bonds.
168
+ * @returns {number}
169
+ */
170
+ bond_count() {
171
+ const ret = wasm.molhandle_bond_count(this.__wbg_ptr);
172
+ return ret >>> 0;
173
+ }
174
+ /**
175
+ * Canonical SMILES string.
176
+ * @returns {string}
177
+ */
178
+ canonical_smiles() {
179
+ let deferred1_0;
180
+ let deferred1_1;
181
+ try {
182
+ const ret = wasm.molhandle_canonical_smiles(this.__wbg_ptr);
183
+ deferred1_0 = ret[0];
184
+ deferred1_1 = ret[1];
185
+ return getStringFromWasm0(ret[0], ret[1]);
186
+ } finally {
187
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
188
+ }
189
+ }
190
+ /**
191
+ * Kier–Hall χ0 molecular connectivity index.
192
+ * @returns {number}
193
+ */
194
+ chi0() {
195
+ const ret = wasm.molhandle_chi0(this.__wbg_ptr);
196
+ return ret;
197
+ }
198
+ /**
199
+ * Kier–Hall χ0v valence-weighted connectivity index.
200
+ * @returns {number}
201
+ */
202
+ chi0v() {
203
+ const ret = wasm.molhandle_chi0v(this.__wbg_ptr);
204
+ return ret;
205
+ }
206
+ /**
207
+ * Kier–Hall χ1 molecular connectivity index.
208
+ * @returns {number}
209
+ */
210
+ chi1() {
211
+ const ret = wasm.molhandle_chi1(this.__wbg_ptr);
212
+ return ret;
213
+ }
214
+ /**
215
+ * Kier–Hall χ1v valence-weighted connectivity index.
216
+ * @returns {number}
217
+ */
218
+ chi1v() {
219
+ const ret = wasm.molhandle_chi1v(this.__wbg_ptr);
220
+ return ret;
221
+ }
222
+ /**
223
+ * Kier–Hall χ2 molecular connectivity index.
224
+ * @returns {number}
225
+ */
226
+ chi2() {
227
+ const ret = wasm.molhandle_chi2(this.__wbg_ptr);
228
+ return ret;
229
+ }
230
+ /**
231
+ * Kier–Hall χ2v valence-weighted connectivity index.
232
+ * @returns {number}
233
+ */
234
+ chi2v() {
235
+ const ret = wasm.molhandle_chi2v(this.__wbg_ptr);
236
+ return ret;
237
+ }
238
+ /**
239
+ * Kier–Hall χ3 molecular connectivity index.
240
+ * @returns {number}
241
+ */
242
+ chi3() {
243
+ const ret = wasm.molhandle_chi3(this.__wbg_ptr);
244
+ return ret;
245
+ }
246
+ /**
247
+ * Kier–Hall χ3v valence-weighted connectivity index.
248
+ * @returns {number}
249
+ */
250
+ chi3v() {
251
+ const ret = wasm.molhandle_chi3v(this.__wbg_ptr);
252
+ return ret;
253
+ }
254
+ /**
255
+ * Kier–Hall χ4 molecular connectivity index.
256
+ * @returns {number}
257
+ */
258
+ chi4() {
259
+ const ret = wasm.molhandle_chi4(this.__wbg_ptr);
260
+ return ret;
261
+ }
262
+ /**
263
+ * Kier–Hall χ4v valence-weighted connectivity index.
264
+ * @returns {number}
265
+ */
266
+ chi4v() {
267
+ const ret = wasm.molhandle_chi4v(this.__wbg_ptr);
268
+ return ret;
269
+ }
270
+ /**
271
+ * 2D SVG depiction of the molecule (CPK coloring).
272
+ * @returns {string}
273
+ */
274
+ depict_svg() {
275
+ let deferred1_0;
276
+ let deferred1_1;
277
+ try {
278
+ const ret = wasm.molhandle_depict_svg(this.__wbg_ptr);
279
+ deferred1_0 = ret[0];
280
+ deferred1_1 = ret[1];
281
+ return getStringFromWasm0(ret[0], ret[1]);
282
+ } finally {
283
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
284
+ }
285
+ }
286
+ /**
287
+ * 2D SVG depiction with style options.
288
+ * @param {DepictOptions} opts
289
+ * @returns {string}
290
+ */
291
+ depict_svg_opts(opts) {
292
+ let deferred1_0;
293
+ let deferred1_1;
294
+ try {
295
+ _assertClass(opts, DepictOptions);
296
+ const ret = wasm.molhandle_depict_svg_opts(this.__wbg_ptr, opts.__wbg_ptr);
297
+ deferred1_0 = ret[0];
298
+ deferred1_1 = ret[1];
299
+ return getStringFromWasm0(ret[0], ret[1]);
300
+ } finally {
301
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
302
+ }
303
+ }
304
+ /**
305
+ * Returns `true` if the molecule passes Egan's absorption criteria
306
+ * (TPSA ≤ 131.6 Ų and LogP ≤ 5.88).
307
+ * @returns {boolean}
308
+ */
309
+ egan_passes() {
310
+ const ret = wasm.molhandle_egan_passes(this.__wbg_ptr);
311
+ return ret !== 0;
312
+ }
313
+ /**
314
+ * Monoisotopic (exact) mass.
315
+ * @returns {number}
316
+ */
317
+ exact_mass() {
318
+ const ret = wasm.molhandle_exact_mass(this.__wbg_ptr);
319
+ return ret;
320
+ }
321
+ /**
322
+ * Sum of formal charges.
323
+ * @returns {number}
324
+ */
325
+ formal_charge_sum() {
326
+ const ret = wasm.molhandle_formal_charge_sum(this.__wbg_ptr);
327
+ return ret;
328
+ }
329
+ /**
330
+ * Molecular formula string (Hill notation: C first, H second, then alphabetical).
331
+ * @returns {string}
332
+ */
333
+ formula() {
334
+ let deferred1_0;
335
+ let deferred1_1;
336
+ try {
337
+ const ret = wasm.molhandle_formula(this.__wbg_ptr);
338
+ deferred1_0 = ret[0];
339
+ deferred1_1 = ret[1];
340
+ return getStringFromWasm0(ret[0], ret[1]);
341
+ } finally {
342
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
343
+ }
344
+ }
345
+ /**
346
+ * Fraction of sp3 carbons (Fsp3).
347
+ * @returns {number}
348
+ */
349
+ fsp3() {
350
+ const ret = wasm.molhandle_fsp3(this.__wbg_ptr);
351
+ return ret;
352
+ }
353
+ /**
354
+ * Returns `true` if the molecule passes Ghose's drug-likeness filter
355
+ * (MW 160–480, LogP −0.4–5.6, HeavyAtoms 20–70, MR 40–130).
356
+ * @returns {boolean}
357
+ */
358
+ ghose_passes() {
359
+ const ret = wasm.molhandle_ghose_passes(this.__wbg_ptr);
360
+ return ret !== 0;
361
+ }
362
+ /**
363
+ * Number of hydrogen bond acceptors (Lipinski: all N and O atoms).
364
+ * @returns {number}
365
+ */
366
+ hba_count() {
367
+ const ret = wasm.molhandle_hba_count(this.__wbg_ptr);
368
+ return ret >>> 0;
369
+ }
370
+ /**
371
+ * Number of hydrogen bond donors (N-H or O-H groups).
372
+ * @returns {number}
373
+ */
374
+ hbd_count() {
375
+ const ret = wasm.molhandle_hbd_count(this.__wbg_ptr);
376
+ return ret >>> 0;
377
+ }
378
+ /**
379
+ * Number of non-hydrogen heavy atoms.
380
+ * @returns {number}
381
+ */
382
+ heavy_atom_count() {
383
+ const ret = wasm.molhandle_heavy_atom_count(this.__wbg_ptr);
384
+ return ret >>> 0;
385
+ }
386
+ /**
387
+ * Hall–Kier κ1 shape index.
388
+ * @returns {number}
389
+ */
390
+ kappa1() {
391
+ const ret = wasm.molhandle_kappa1(this.__wbg_ptr);
392
+ return ret;
393
+ }
394
+ /**
395
+ * Hall–Kier κ2 shape index.
396
+ * @returns {number}
397
+ */
398
+ kappa2() {
399
+ const ret = wasm.molhandle_kappa2(this.__wbg_ptr);
400
+ return ret;
401
+ }
402
+ /**
403
+ * Hall–Kier κ3 shape index.
404
+ * @returns {number}
405
+ */
406
+ kappa3() {
407
+ const ret = wasm.molhandle_kappa3(this.__wbg_ptr);
408
+ return ret;
409
+ }
410
+ /**
411
+ * Labute approximate surface area (Ų).
412
+ * @returns {number}
413
+ */
414
+ labute_asa() {
415
+ const ret = wasm.molhandle_labute_asa(this.__wbg_ptr);
416
+ return ret;
417
+ }
418
+ /**
419
+ * Returns `true` if the molecule satisfies Lipinski's Rule of Five.
420
+ * @returns {boolean}
421
+ */
422
+ lipinski_passes() {
423
+ const ret = wasm.molhandle_lipinski_passes(this.__wbg_ptr);
424
+ return ret !== 0;
425
+ }
426
+ /**
427
+ * Crippen–Wildman octanol/water partition coefficient (LogP).
428
+ * @returns {number}
429
+ */
430
+ logp_crippen() {
431
+ const ret = wasm.molhandle_logp_crippen(this.__wbg_ptr);
432
+ return ret;
433
+ }
434
+ /**
435
+ * Maximum EState index across all heavy atoms.
436
+ * @returns {number}
437
+ */
438
+ max_estate() {
439
+ const ret = wasm.molhandle_max_estate(this.__wbg_ptr);
440
+ return ret;
441
+ }
442
+ /**
443
+ * Minimum EState index across all heavy atoms.
444
+ * @returns {number}
445
+ */
446
+ min_estate() {
447
+ const ret = wasm.molhandle_min_estate(this.__wbg_ptr);
448
+ return ret;
449
+ }
450
+ /**
451
+ * Wildman–Crippen molar refractivity (MR).
452
+ * @returns {number}
453
+ */
454
+ molar_refractivity() {
455
+ const ret = wasm.molhandle_molar_refractivity(this.__wbg_ptr);
456
+ return ret;
457
+ }
458
+ /**
459
+ * Average molecular weight (Da).
460
+ * @returns {number}
461
+ */
462
+ molecular_weight() {
463
+ const ret = wasm.molhandle_molecular_weight(this.__wbg_ptr);
464
+ return ret;
465
+ }
466
+ /**
467
+ * Morgan count fingerprint as a JSON object string (`{"<hash>": count, …}`).
468
+ *
469
+ * `radius` controls the ECFP radius (2 = ECFP4-equivalent).
470
+ * @param {number} radius
471
+ * @returns {string}
472
+ */
473
+ morgan_fp_counts_json(radius) {
474
+ let deferred1_0;
475
+ let deferred1_1;
476
+ try {
477
+ const ret = wasm.molhandle_morgan_fp_counts_json(this.__wbg_ptr, radius);
478
+ deferred1_0 = ret[0];
479
+ deferred1_1 = ret[1];
480
+ return getStringFromWasm0(ret[0], ret[1]);
481
+ } finally {
482
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
483
+ }
484
+ }
485
+ /**
486
+ * Number of non-aromatic rings containing at least one heteroatom.
487
+ * @returns {number}
488
+ */
489
+ num_aliphatic_heterocycles() {
490
+ const ret = wasm.molhandle_num_aliphatic_heterocycles(this.__wbg_ptr);
491
+ return ret >>> 0;
492
+ }
493
+ /**
494
+ * Number of aromatic rings containing at least one heteroatom (N, O, S, …).
495
+ * @returns {number}
496
+ */
497
+ num_aromatic_heterocycles() {
498
+ const ret = wasm.molhandle_num_aromatic_heterocycles(this.__wbg_ptr);
499
+ return ret >>> 0;
500
+ }
501
+ /**
502
+ * Number of bridgehead atoms (shared by ≥2 rings with ≥3 ring bonds).
503
+ * @returns {number}
504
+ */
505
+ num_bridgehead_atoms() {
506
+ const ret = wasm.molhandle_num_bridgehead_atoms(this.__wbg_ptr);
507
+ return ret >>> 0;
508
+ }
509
+ /**
510
+ * Number of heteroatoms (non-C, non-H heavy atoms).
511
+ * @returns {number}
512
+ */
513
+ num_heteroatoms() {
514
+ const ret = wasm.molhandle_num_heteroatoms(this.__wbg_ptr);
515
+ return ret >>> 0;
516
+ }
517
+ /**
518
+ * Number of fully saturated rings containing at least one heteroatom.
519
+ * @returns {number}
520
+ */
521
+ num_saturated_heterocycles() {
522
+ const ret = wasm.molhandle_num_saturated_heterocycles(this.__wbg_ptr);
523
+ return ret >>> 0;
524
+ }
525
+ /**
526
+ * Number of spiro atoms (sole shared atom between exactly 2 rings).
527
+ * @returns {number}
528
+ */
529
+ num_spiro_atoms() {
530
+ const ret = wasm.molhandle_num_spiro_atoms(this.__wbg_ptr);
531
+ return ret >>> 0;
532
+ }
533
+ /**
534
+ * Number of assigned stereocenters (R/S).
535
+ * @returns {number}
536
+ */
537
+ num_stereocenters() {
538
+ const ret = wasm.molhandle_num_stereocenters(this.__wbg_ptr);
539
+ return ret >>> 0;
540
+ }
541
+ /**
542
+ * Returns `true` if the molecule has no PAINS structural alerts.
543
+ * @returns {boolean}
544
+ */
545
+ pains_passes() {
546
+ const ret = wasm.molhandle_pains_passes(this.__wbg_ptr);
547
+ return ret !== 0;
548
+ }
549
+ /**
550
+ * Quantitative Estimate of Drug-likeness (QED); range [0, 1].
551
+ * @returns {number}
552
+ */
553
+ qed() {
554
+ const ret = wasm.molhandle_qed(this.__wbg_ptr);
555
+ return ret;
556
+ }
557
+ /**
558
+ * Returns `true` if the molecule passes the REOS (Rapid Elimination Of Swill) filter.
559
+ * @returns {boolean}
560
+ */
561
+ reos_passes() {
562
+ const ret = wasm.molhandle_reos_passes(this.__wbg_ptr);
563
+ return ret !== 0;
564
+ }
565
+ /**
566
+ * Total number of rings (SSSR count).
567
+ * @returns {number}
568
+ */
569
+ ring_count() {
570
+ const ret = wasm.molhandle_ring_count(this.__wbg_ptr);
571
+ return ret >>> 0;
572
+ }
573
+ /**
574
+ * Number of rotatable bonds.
575
+ * @returns {number}
576
+ */
577
+ rotatable_bond_count() {
578
+ const ret = wasm.molhandle_rotatable_bond_count(this.__wbg_ptr);
579
+ return ret >>> 0;
580
+ }
581
+ /**
582
+ * Sum of EState indices over all heavy atoms.
583
+ * @returns {number}
584
+ */
585
+ sum_estate() {
586
+ const ret = wasm.molhandle_sum_estate(this.__wbg_ptr);
587
+ return ret;
588
+ }
589
+ /**
590
+ * Topological polar surface area (Ų).
591
+ * @returns {number}
592
+ */
593
+ tpsa() {
594
+ const ret = wasm.molhandle_tpsa(this.__wbg_ptr);
595
+ return ret;
596
+ }
597
+ /**
598
+ * Returns `true` if the molecule passes Veber's oral bioavailability criteria
599
+ * (TPSA ≤ 140 Ų and rotatable bonds ≤ 10).
600
+ * @returns {boolean}
601
+ */
602
+ veber_passes() {
603
+ const ret = wasm.molhandle_veber_passes(this.__wbg_ptr);
604
+ return ret !== 0;
605
+ }
606
+ /**
607
+ * Wiener topological index (sum of all pairwise shortest-path distances).
608
+ * @returns {number}
609
+ */
610
+ wiener_index() {
611
+ const ret = wasm.molhandle_wiener_index(this.__wbg_ptr);
612
+ return ret;
613
+ }
614
+ }
615
+ if (Symbol.dispose) MolHandle.prototype[Symbol.dispose] = MolHandle.prototype.free;
616
+
617
+ /**
618
+ * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
619
+ * @param {MolHandle} mol
620
+ * @returns {MolHandle}
621
+ */
622
+ export function add_hydrogens(mol) {
623
+ _assertClass(mol, MolHandle);
624
+ const ret = wasm.add_hydrogens(mol.__wbg_ptr);
625
+ return MolHandle.__wrap(ret);
626
+ }
627
+
628
+ /**
629
+ * Number of BRICS fragments produced by fragmenting the molecule.
630
+ *
631
+ * Returns 1 if no BRICS-breakable bonds exist (whole molecule is one fragment).
632
+ * @param {MolHandle} mol
633
+ * @returns {number}
634
+ */
635
+ export function brics_fragment_count(mol) {
636
+ _assertClass(mol, MolHandle);
637
+ const ret = wasm.brics_fragment_count(mol.__wbg_ptr);
638
+ return ret >>> 0;
639
+ }
640
+
641
+ /**
642
+ * Render a reaction SMILES string (e.g. `"CC(=O)O.CCO>>CC(=O)OCC.O"`) as a
643
+ * single SVG showing reactants → products with `+` separators.
644
+ *
645
+ * Returns a self-contained SVG string. Returns a JS error on invalid input.
646
+ * @param {string} rxn_smiles
647
+ * @returns {string}
648
+ */
649
+ export function depict_reaction_svg(rxn_smiles) {
650
+ let deferred3_0;
651
+ let deferred3_1;
652
+ try {
653
+ const ptr0 = passStringToWasm0(rxn_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
654
+ const len0 = WASM_VECTOR_LEN;
655
+ const ret = wasm.depict_reaction_svg(ptr0, len0);
656
+ var ptr2 = ret[0];
657
+ var len2 = ret[1];
658
+ if (ret[3]) {
659
+ ptr2 = 0; len2 = 0;
660
+ throw takeFromExternrefTable0(ret[2]);
661
+ }
662
+ deferred3_0 = ptr2;
663
+ deferred3_1 = len2;
664
+ return getStringFromWasm0(ptr2, len2);
665
+ } finally {
666
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
667
+ }
668
+ }
669
+
670
+ /**
671
+ * Render a grid SVG from newline-separated SMILES (one per line).
672
+ *
673
+ * Lines that fail to parse are silently skipped.
674
+ * `cols` controls the number of columns (each cell is 200×200 px).
675
+ * @param {string} smiles_block
676
+ * @param {number} cols
677
+ * @returns {string}
678
+ */
679
+ export function depict_svg_grid(smiles_block, cols) {
680
+ let deferred2_0;
681
+ let deferred2_1;
682
+ try {
683
+ const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
684
+ const len0 = WASM_VECTOR_LEN;
685
+ const ret = wasm.depict_svg_grid(ptr0, len0, cols);
686
+ deferred2_0 = ret[0];
687
+ deferred2_1 = ret[1];
688
+ return getStringFromWasm0(ret[0], ret[1]);
689
+ } finally {
690
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
691
+ }
692
+ }
693
+
694
+ /**
695
+ * Detect named functional groups in `mol`.
696
+ *
697
+ * Returns a JSON array of `{"name":"hydroxyl","atoms":[3]}` objects.
698
+ * Multiple matches of the same group (e.g. two hydroxyl groups) each appear
699
+ * as a separate entry. Overlapping groups (carboxylic acid → "carboxyl" +
700
+ * "hydroxyl" + "carbonyl") are all returned.
701
+ * @param {MolHandle} mol
702
+ * @returns {string}
703
+ */
704
+ export function detect_functional_groups(mol) {
705
+ let deferred1_0;
706
+ let deferred1_1;
707
+ try {
708
+ _assertClass(mol, MolHandle);
709
+ const ret = wasm.detect_functional_groups(mol.__wbg_ptr);
710
+ deferred1_0 = ret[0];
711
+ deferred1_1 = ret[1];
712
+ return getStringFromWasm0(ret[0], ret[1]);
713
+ } finally {
714
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
715
+ }
716
+ }
717
+
718
+ /**
719
+ * Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
720
+ * @param {MolHandle} mol
721
+ * @returns {Uint8Array}
722
+ */
723
+ export function ecfp4_bitvec(mol) {
724
+ _assertClass(mol, MolHandle);
725
+ const ret = wasm.ecfp4_bitvec(mol.__wbg_ptr);
726
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
727
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
728
+ return v1;
729
+ }
730
+
731
+ /**
732
+ * Per-atom EState values as a JSON array of f64.
733
+ *
734
+ * Indices match `mol.atoms()` order. Hydrogen atoms get 0.0.
735
+ * @param {MolHandle} mol
736
+ * @returns {string}
737
+ */
738
+ export function estate_indices_json(mol) {
739
+ let deferred1_0;
740
+ let deferred1_1;
741
+ try {
742
+ _assertClass(mol, MolHandle);
743
+ const ret = wasm.estate_indices_json(mol.__wbg_ptr);
744
+ deferred1_0 = ret[0];
745
+ deferred1_1 = ret[1];
746
+ return getStringFromWasm0(ret[0], ret[1]);
747
+ } finally {
748
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
749
+ }
750
+ }
751
+
752
+ /**
753
+ * Gasteiger-Marsili PEOE partial charges as a JSON array of f64.
754
+ * @param {MolHandle} mol
755
+ * @returns {string}
756
+ */
757
+ export function gasteiger_charges_json(mol) {
758
+ let deferred1_0;
759
+ let deferred1_1;
760
+ try {
761
+ _assertClass(mol, MolHandle);
762
+ const ret = wasm.gasteiger_charges_json(mol.__wbg_ptr);
763
+ deferred1_0 = ret[0];
764
+ deferred1_1 = ret[1];
765
+ return getStringFromWasm0(ret[0], ret[1]);
766
+ } finally {
767
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
768
+ }
769
+ }
770
+
771
+ /**
772
+ * Generate 3D coordinates for the molecule and return a PDB string.
773
+ *
774
+ * Coordinates are generated using distance-geometry placement with ring templates.
775
+ * Returns heavy-atom PDB (HETATM records, no explicit H).
776
+ * @param {MolHandle} mol
777
+ * @returns {string}
778
+ */
779
+ export function generate_3d_pdb(mol) {
780
+ let deferred1_0;
781
+ let deferred1_1;
782
+ try {
783
+ _assertClass(mol, MolHandle);
784
+ const ret = wasm.generate_3d_pdb(mol.__wbg_ptr);
785
+ deferred1_0 = ret[0];
786
+ deferred1_1 = ret[1];
787
+ return getStringFromWasm0(ret[0], ret[1]);
788
+ } finally {
789
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
790
+ }
791
+ }
792
+
793
+ /**
794
+ * Return information about a single atom as a JSON object.
795
+ *
796
+ * `idx` is the 0-based atom index (matching `atoms()` order).
797
+ * Returns `"null"` if `idx` is out of range.
798
+ *
799
+ * Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
800
+ * `charge` (formal charge integer), `isAromatic` (bool),
801
+ * `totalHydrogens` (explicit + implicit H count, integer).
802
+ * sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
803
+ * @param {MolHandle} mol
804
+ * @param {number} idx
805
+ * @returns {string}
806
+ */
807
+ export function get_atom_info(mol, idx) {
808
+ let deferred1_0;
809
+ let deferred1_1;
810
+ try {
811
+ _assertClass(mol, MolHandle);
812
+ const ret = wasm.get_atom_info(mol.__wbg_ptr, idx);
813
+ deferred1_0 = ret[0];
814
+ deferred1_1 = ret[1];
815
+ return getStringFromWasm0(ret[0], ret[1]);
816
+ } finally {
817
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
818
+ }
819
+ }
820
+
821
+ /**
822
+ * Return bond information as a JSON object, looked up by the two bonded atom indices.
823
+ *
824
+ * Useful when you know the atom indices from SMARTS matching or `data-atom-idx` SVG
825
+ * attributes but not the bond index. Returns `"null"` if no bond exists between them.
826
+ *
827
+ * Fields: same as `get_bond_info` plus `bondIdx` (u32).
828
+ * @param {MolHandle} mol
829
+ * @param {number} atom1
830
+ * @param {number} atom2
831
+ * @returns {string}
832
+ */
833
+ export function get_bond_between(mol, atom1, atom2) {
834
+ let deferred1_0;
835
+ let deferred1_1;
836
+ try {
837
+ _assertClass(mol, MolHandle);
838
+ const ret = wasm.get_bond_between(mol.__wbg_ptr, atom1, atom2);
839
+ deferred1_0 = ret[0];
840
+ deferred1_1 = ret[1];
841
+ return getStringFromWasm0(ret[0], ret[1]);
842
+ } finally {
843
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
844
+ }
845
+ }
846
+
847
+ /**
848
+ * Return bond information as a JSON object, looked up by bond index.
849
+ *
850
+ * `idx` is the 0-based bond index (order matches `mol.bonds()` iteration).
851
+ * Returns `"null"` if `idx` is out of range.
852
+ *
853
+ * Fields: `bondOrder` (1.0/1.5/2.0/3.0), `isAromatic` (bool),
854
+ * `isInRing` (bool), `atomFrom` (u32), `atomTo` (u32).
855
+ * @param {MolHandle} mol
856
+ * @param {number} idx
857
+ * @returns {string}
858
+ */
859
+ export function get_bond_info(mol, idx) {
860
+ let deferred1_0;
861
+ let deferred1_1;
862
+ try {
863
+ _assertClass(mol, MolHandle);
864
+ const ret = wasm.get_bond_info(mol.__wbg_ptr, idx);
865
+ deferred1_0 = ret[0];
866
+ deferred1_1 = ret[1];
867
+ return getStringFromWasm0(ret[0], ret[1]);
868
+ } finally {
869
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
870
+ }
871
+ }
872
+
873
+ /**
874
+ * Identify functional groups. Returns a JSON array of objects:
875
+ * `[{"atoms":[0,2,3],"type":"C,N,O"}, …]`
876
+ * @param {MolHandle} mol
877
+ * @returns {string}
878
+ */
879
+ export function identify_functional_groups(mol) {
880
+ let deferred1_0;
881
+ let deferred1_1;
882
+ try {
883
+ _assertClass(mol, MolHandle);
884
+ const ret = wasm.identify_functional_groups(mol.__wbg_ptr);
885
+ deferred1_0 = ret[0];
886
+ deferred1_1 = ret[1];
887
+ return getStringFromWasm0(ret[0], ret[1]);
888
+ } finally {
889
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
890
+ }
891
+ }
892
+
893
+ /**
894
+ * Returns `true` if the SMILES string can be parsed without error.
895
+ * @param {string} s
896
+ * @returns {boolean}
897
+ */
898
+ export function is_valid_smiles(s) {
899
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
900
+ const len0 = WASM_VECTOR_LEN;
901
+ const ret = wasm.is_valid_smiles(ptr0, len0);
902
+ return ret !== 0;
903
+ }
904
+
905
+ /**
906
+ * Find all SMARTS matches in a molecule given only SMILES strings.
907
+ *
908
+ * Convenience wrapper around `smarts_match_atoms` that accepts raw SMILES
909
+ * instead of a `MolHandle`. Returns the same JSON format: `[[0,1],[3,4]]`.
910
+ * Returns a JS error on SMILES or SMARTS parse failure.
911
+ * @param {string} smiles
912
+ * @param {string} smarts
913
+ * @returns {string}
914
+ */
915
+ export function match_smarts_smiles(smiles, smarts) {
916
+ let deferred4_0;
917
+ let deferred4_1;
918
+ try {
919
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
920
+ const len0 = WASM_VECTOR_LEN;
921
+ const ptr1 = passStringToWasm0(smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
922
+ const len1 = WASM_VECTOR_LEN;
923
+ const ret = wasm.match_smarts_smiles(ptr0, len0, ptr1, len1);
924
+ var ptr3 = ret[0];
925
+ var len3 = ret[1];
926
+ if (ret[3]) {
927
+ ptr3 = 0; len3 = 0;
928
+ throw takeFromExternrefTable0(ret[2]);
929
+ }
930
+ deferred4_0 = ptr3;
931
+ deferred4_1 = len3;
932
+ return getStringFromWasm0(ptr3, len3);
933
+ } finally {
934
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
935
+ }
936
+ }
937
+
938
+ /**
939
+ * Serialize a SMILES string directly to a MOL V2000 block.
940
+ *
941
+ * Convenience wrapper; all atom coordinates are 0.0.
942
+ * Returns a JS error on SMILES parse failure.
943
+ * @param {string} smiles
944
+ * @returns {string}
945
+ */
946
+ export function mol_block_from_smiles(smiles) {
947
+ let deferred3_0;
948
+ let deferred3_1;
949
+ try {
950
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
951
+ const len0 = WASM_VECTOR_LEN;
952
+ const ret = wasm.mol_block_from_smiles(ptr0, len0);
953
+ var ptr2 = ret[0];
954
+ var len2 = ret[1];
955
+ if (ret[3]) {
956
+ ptr2 = 0; len2 = 0;
957
+ throw takeFromExternrefTable0(ret[2]);
958
+ }
959
+ deferred3_0 = ptr2;
960
+ deferred3_1 = len2;
961
+ return getStringFromWasm0(ptr2, len2);
962
+ } finally {
963
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
964
+ }
965
+ }
966
+
967
+ /**
968
+ * Parse a MOL V2000 block and return a `MolHandle`.
969
+ *
970
+ * Returns a JS error string on parse failure.
971
+ * @param {string} block
972
+ * @returns {MolHandle}
973
+ */
974
+ export function mol_from_sdf_block(block) {
975
+ const ptr0 = passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
976
+ const len0 = WASM_VECTOR_LEN;
977
+ const ret = wasm.mol_from_sdf_block(ptr0, len0);
978
+ if (ret[2]) {
979
+ throw takeFromExternrefTable0(ret[1]);
980
+ }
981
+ return MolHandle.__wrap(ret[0]);
982
+ }
983
+
984
+ /**
985
+ * Parse a SMILES string into a `MolHandle`.
986
+ *
987
+ * Returns a JS error string on parse failure.
988
+ * @param {string} s
989
+ * @returns {MolHandle}
990
+ */
991
+ export function parse_smiles(s) {
992
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
+ const len0 = WASM_VECTOR_LEN;
994
+ const ret = wasm.parse_smiles(ptr0, len0);
995
+ if (ret[2]) {
996
+ throw takeFromExternrefTable0(ret[1]);
997
+ }
998
+ return MolHandle.__wrap(ret[0]);
999
+ }
1000
+
1001
+ /**
1002
+ * PEOE_VSA descriptors (14 bins) as a JSON array.
1003
+ * @param {MolHandle} mol
1004
+ * @returns {string}
1005
+ */
1006
+ export function peoe_vsa_json(mol) {
1007
+ let deferred1_0;
1008
+ let deferred1_1;
1009
+ try {
1010
+ _assertClass(mol, MolHandle);
1011
+ const ret = wasm.peoe_vsa_json(mol.__wbg_ptr);
1012
+ deferred1_0 = ret[0];
1013
+ deferred1_1 = ret[1];
1014
+ return getStringFromWasm0(ret[0], ret[1]);
1015
+ } finally {
1016
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1017
+ }
1018
+ }
1019
+
1020
+ /**
1021
+ * Return a copy of the molecule with all explicit hydrogen atoms removed.
1022
+ * @param {MolHandle} mol
1023
+ * @returns {MolHandle}
1024
+ */
1025
+ export function remove_hydrogens(mol) {
1026
+ _assertClass(mol, MolHandle);
1027
+ const ret = wasm.remove_hydrogens(mol.__wbg_ptr);
1028
+ return MolHandle.__wrap(ret);
1029
+ }
1030
+
1031
+ /**
1032
+ * Apply a SMIRKS reaction template and return product SMILES as a JSON string.
1033
+ *
1034
+ * `reactants_smiles`: pipe-separated SMILES, one per reactant slot in the SMIRKS.
1035
+ * Returns a JSON array of arrays: `[["product_smi", …], …]`.
1036
+ * Returns a JS error on parse failure or arity mismatch.
1037
+ * @param {string} smirks
1038
+ * @param {string} reactants_smiles
1039
+ * @returns {string}
1040
+ */
1041
+ export function run_reactants(smirks, reactants_smiles) {
1042
+ let deferred4_0;
1043
+ let deferred4_1;
1044
+ try {
1045
+ const ptr0 = passStringToWasm0(smirks, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1046
+ const len0 = WASM_VECTOR_LEN;
1047
+ const ptr1 = passStringToWasm0(reactants_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1048
+ const len1 = WASM_VECTOR_LEN;
1049
+ const ret = wasm.run_reactants(ptr0, len0, ptr1, len1);
1050
+ var ptr3 = ret[0];
1051
+ var len3 = ret[1];
1052
+ if (ret[3]) {
1053
+ ptr3 = 0; len3 = 0;
1054
+ throw takeFromExternrefTable0(ret[2]);
1055
+ }
1056
+ deferred4_0 = ptr3;
1057
+ deferred4_1 = len3;
1058
+ return getStringFromWasm0(ptr3, len3);
1059
+ } finally {
1060
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1061
+ }
1062
+ }
1063
+
1064
+ /**
1065
+ * Synthetic Accessibility Score (1 = easy, 10 = hard).
1066
+ * @param {MolHandle} mol
1067
+ * @returns {number}
1068
+ */
1069
+ export function sa_score(mol) {
1070
+ _assertClass(mol, MolHandle);
1071
+ const ret = wasm.sa_score(mol.__wbg_ptr);
1072
+ return ret;
1073
+ }
1074
+
1075
+ /**
1076
+ * Parse an SDF string and return a JSON array of canonical SMILES strings.
1077
+ *
1078
+ * Invalid records are represented as `null` in the array.
1079
+ * @param {string} sdf
1080
+ * @returns {string}
1081
+ */
1082
+ export function sdf_to_smiles_json(sdf) {
1083
+ let deferred2_0;
1084
+ let deferred2_1;
1085
+ try {
1086
+ const ptr0 = passStringToWasm0(sdf, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1087
+ const len0 = WASM_VECTOR_LEN;
1088
+ const ret = wasm.sdf_to_smiles_json(ptr0, len0);
1089
+ deferred2_0 = ret[0];
1090
+ deferred2_1 = ret[1];
1091
+ return getStringFromWasm0(ret[0], ret[1]);
1092
+ } finally {
1093
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1094
+ }
1095
+ }
1096
+
1097
+ /**
1098
+ * SlogP_VSA descriptors (12 bins) as a JSON array.
1099
+ * @param {MolHandle} mol
1100
+ * @returns {string}
1101
+ */
1102
+ export function slogp_vsa_json(mol) {
1103
+ let deferred1_0;
1104
+ let deferred1_1;
1105
+ try {
1106
+ _assertClass(mol, MolHandle);
1107
+ const ret = wasm.slogp_vsa_json(mol.__wbg_ptr);
1108
+ deferred1_0 = ret[0];
1109
+ deferred1_1 = ret[1];
1110
+ return getStringFromWasm0(ret[0], ret[1]);
1111
+ } finally {
1112
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1113
+ }
1114
+ }
1115
+
1116
+ /**
1117
+ * Find all substructure matches of a SMARTS pattern in `mol`.
1118
+ *
1119
+ * Returns JSON array of arrays of atom indices (sorted, 0-based).
1120
+ * Example: `[[0,1,2],[3,4,5]]` — two matches.
1121
+ * Returns `"[]"` if no match. Returns a JS error on invalid SMARTS.
1122
+ * @param {string} smarts
1123
+ * @param {MolHandle} mol
1124
+ * @returns {string}
1125
+ */
1126
+ export function smarts_match_atoms(smarts, mol) {
1127
+ let deferred3_0;
1128
+ let deferred3_1;
1129
+ try {
1130
+ const ptr0 = passStringToWasm0(smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1131
+ const len0 = WASM_VECTOR_LEN;
1132
+ _assertClass(mol, MolHandle);
1133
+ const ret = wasm.smarts_match_atoms(ptr0, len0, mol.__wbg_ptr);
1134
+ var ptr2 = ret[0];
1135
+ var len2 = ret[1];
1136
+ if (ret[3]) {
1137
+ ptr2 = 0; len2 = 0;
1138
+ throw takeFromExternrefTable0(ret[2]);
1139
+ }
1140
+ deferred3_0 = ptr2;
1141
+ deferred3_1 = len2;
1142
+ return getStringFromWasm0(ptr2, len2);
1143
+ } finally {
1144
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1145
+ }
1146
+ }
1147
+
1148
+ /**
1149
+ * Render a highlighted SVG from a SMILES string in one call.
1150
+ *
1151
+ * `atoms` — 0-based atom indices to highlight (Uint32Array in JS).
1152
+ * `bonds` — 0-based bond indices to highlight (Uint32Array in JS).
1153
+ * `color` — CSS color for highlights (e.g. `"#ef4444"`); empty string uses default yellow.
1154
+ *
1155
+ * Returns a JS error on SMILES parse failure.
1156
+ * @param {string} smiles
1157
+ * @param {Uint32Array} atoms
1158
+ * @param {Uint32Array} bonds
1159
+ * @param {string} color
1160
+ * @returns {string}
1161
+ */
1162
+ export function smiles_to_svg_highlighted(smiles, atoms, bonds, color) {
1163
+ let deferred6_0;
1164
+ let deferred6_1;
1165
+ try {
1166
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1167
+ const len0 = WASM_VECTOR_LEN;
1168
+ const ptr1 = passArray32ToWasm0(atoms, wasm.__wbindgen_malloc);
1169
+ const len1 = WASM_VECTOR_LEN;
1170
+ const ptr2 = passArray32ToWasm0(bonds, wasm.__wbindgen_malloc);
1171
+ const len2 = WASM_VECTOR_LEN;
1172
+ const ptr3 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1173
+ const len3 = WASM_VECTOR_LEN;
1174
+ const ret = wasm.smiles_to_svg_highlighted(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1175
+ var ptr5 = ret[0];
1176
+ var len5 = ret[1];
1177
+ if (ret[3]) {
1178
+ ptr5 = 0; len5 = 0;
1179
+ throw takeFromExternrefTable0(ret[2]);
1180
+ }
1181
+ deferred6_0 = ptr5;
1182
+ deferred6_1 = len5;
1183
+ return getStringFromWasm0(ptr5, len5);
1184
+ } finally {
1185
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
1186
+ }
1187
+ }
1188
+
1189
+ /**
1190
+ * SMR_VSA descriptors (10 bins) as a JSON array.
1191
+ * @param {MolHandle} mol
1192
+ * @returns {string}
1193
+ */
1194
+ export function smr_vsa_json(mol) {
1195
+ let deferred1_0;
1196
+ let deferred1_1;
1197
+ try {
1198
+ _assertClass(mol, MolHandle);
1199
+ const ret = wasm.smr_vsa_json(mol.__wbg_ptr);
1200
+ deferred1_0 = ret[0];
1201
+ deferred1_1 = ret[1];
1202
+ return getStringFromWasm0(ret[0], ret[1]);
1203
+ } finally {
1204
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1205
+ }
1206
+ }
1207
+
1208
+ export function start() {
1209
+ wasm.start();
1210
+ }
1211
+
1212
+ /**
1213
+ * Tanimoto similarity between two molecules using AtomPair fingerprints.
1214
+ * @param {MolHandle} a
1215
+ * @param {MolHandle} b
1216
+ * @returns {number}
1217
+ */
1218
+ export function tanimoto_atom_pair(a, b) {
1219
+ _assertClass(a, MolHandle);
1220
+ _assertClass(b, MolHandle);
1221
+ const ret = wasm.tanimoto_atom_pair(a.__wbg_ptr, b.__wbg_ptr);
1222
+ return ret;
1223
+ }
1224
+
1225
+ /**
1226
+ * Tanimoto similarity between two molecules using ECFP4 fingerprints.
1227
+ * @param {MolHandle} a
1228
+ * @param {MolHandle} b
1229
+ * @returns {number}
1230
+ */
1231
+ export function tanimoto_ecfp4(a, b) {
1232
+ _assertClass(a, MolHandle);
1233
+ _assertClass(b, MolHandle);
1234
+ const ret = wasm.tanimoto_ecfp4(a.__wbg_ptr, b.__wbg_ptr);
1235
+ return ret;
1236
+ }
1237
+
1238
+ /**
1239
+ * Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
1240
+ * @param {MolHandle} a
1241
+ * @param {MolHandle} b
1242
+ * @returns {number}
1243
+ */
1244
+ export function tanimoto_fcfp4(a, b) {
1245
+ _assertClass(a, MolHandle);
1246
+ _assertClass(b, MolHandle);
1247
+ const ret = wasm.tanimoto_fcfp4(a.__wbg_ptr, b.__wbg_ptr);
1248
+ return ret;
1249
+ }
1250
+
1251
+ /**
1252
+ * Tanimoto similarity between two molecules given only SMILES strings (ECFP4).
1253
+ *
1254
+ * Returns a JS error on parse failure.
1255
+ * @param {string} smiles1
1256
+ * @param {string} smiles2
1257
+ * @returns {number}
1258
+ */
1259
+ export function tanimoto_smiles(smiles1, smiles2) {
1260
+ const ptr0 = passStringToWasm0(smiles1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1261
+ const len0 = WASM_VECTOR_LEN;
1262
+ const ptr1 = passStringToWasm0(smiles2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1263
+ const len1 = WASM_VECTOR_LEN;
1264
+ const ret = wasm.tanimoto_smiles(ptr0, len0, ptr1, len1);
1265
+ if (ret[2]) {
1266
+ throw takeFromExternrefTable0(ret[1]);
1267
+ }
1268
+ return ret[0];
1269
+ }
1270
+
1271
+ /**
1272
+ * Tanimoto similarity between two molecules using topological path fingerprints.
1273
+ * @param {MolHandle} a
1274
+ * @param {MolHandle} b
1275
+ * @returns {number}
1276
+ */
1277
+ export function tanimoto_topo_path(a, b) {
1278
+ _assertClass(a, MolHandle);
1279
+ _assertClass(b, MolHandle);
1280
+ const ret = wasm.tanimoto_topo_path(a.__wbg_ptr, b.__wbg_ptr);
1281
+ return ret;
1282
+ }
1283
+
1284
+ /**
1285
+ * Tanimoto similarity between two molecules using Topological Torsion fingerprints.
1286
+ * @param {MolHandle} a
1287
+ * @param {MolHandle} b
1288
+ * @returns {number}
1289
+ */
1290
+ export function tanimoto_torsion(a, b) {
1291
+ _assertClass(a, MolHandle);
1292
+ _assertClass(b, MolHandle);
1293
+ const ret = wasm.tanimoto_torsion(a.__wbg_ptr, b.__wbg_ptr);
1294
+ return ret;
1295
+ }
1296
+
1297
+ /**
1298
+ * Serialize a molecule to a MOL V2000 block.
1299
+ *
1300
+ * All atom coordinates are written as 0.0 (the `Molecule` type has no 2D
1301
+ * coordinate storage; real coordinates would require a separate layout pass).
1302
+ * @param {MolHandle} mol
1303
+ * @returns {string}
1304
+ */
1305
+ export function to_mol_block(mol) {
1306
+ let deferred1_0;
1307
+ let deferred1_1;
1308
+ try {
1309
+ _assertClass(mol, MolHandle);
1310
+ const ret = wasm.to_mol_block(mol.__wbg_ptr);
1311
+ deferred1_0 = ret[0];
1312
+ deferred1_1 = ret[1];
1313
+ return getStringFromWasm0(ret[0], ret[1]);
1314
+ } finally {
1315
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1316
+ }
1317
+ }
1318
+ function __wbg_get_imports() {
1319
+ const import0 = {
1320
+ __proto__: null,
1321
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
1322
+ throw new Error(getStringFromWasm0(arg0, arg1));
1323
+ },
1324
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1325
+ let deferred0_0;
1326
+ let deferred0_1;
1327
+ try {
1328
+ deferred0_0 = arg0;
1329
+ deferred0_1 = arg1;
1330
+ console.error(getStringFromWasm0(arg0, arg1));
1331
+ } finally {
1332
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1333
+ }
1334
+ },
1335
+ __wbg_new_227d7c05414eb861: function() {
1336
+ const ret = new Error();
1337
+ return ret;
1338
+ },
1339
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1340
+ const ret = arg1.stack;
1341
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1342
+ const len1 = WASM_VECTOR_LEN;
1343
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1344
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1345
+ },
1346
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1347
+ // Cast intrinsic for `Ref(String) -> Externref`.
1348
+ const ret = getStringFromWasm0(arg0, arg1);
1349
+ return ret;
1350
+ },
1351
+ __wbindgen_init_externref_table: function() {
1352
+ const table = wasm.__wbindgen_externrefs;
1353
+ const offset = table.grow(4);
1354
+ table.set(0, undefined);
1355
+ table.set(offset + 0, undefined);
1356
+ table.set(offset + 1, null);
1357
+ table.set(offset + 2, true);
1358
+ table.set(offset + 3, false);
1359
+ },
1360
+ };
1361
+ return {
1362
+ __proto__: null,
1363
+ "./chematic_wasm_bg.js": import0,
1364
+ };
1365
+ }
1366
+
1367
+ const DepictOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
1368
+ ? { register: () => {}, unregister: () => {} }
1369
+ : new FinalizationRegistry(ptr => wasm.__wbg_depictoptions_free(ptr, 1));
1370
+ const MolHandleFinalization = (typeof FinalizationRegistry === 'undefined')
1371
+ ? { register: () => {}, unregister: () => {} }
1372
+ : new FinalizationRegistry(ptr => wasm.__wbg_molhandle_free(ptr, 1));
1373
+
1374
+ function _assertClass(instance, klass) {
1375
+ if (!(instance instanceof klass)) {
1376
+ throw new Error(`expected instance of ${klass.name}`);
1377
+ }
1378
+ }
1379
+
1380
+ function getArrayU8FromWasm0(ptr, len) {
1381
+ ptr = ptr >>> 0;
1382
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1383
+ }
1384
+
1385
+ let cachedDataViewMemory0 = null;
1386
+ function getDataViewMemory0() {
1387
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1388
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1389
+ }
1390
+ return cachedDataViewMemory0;
1391
+ }
1392
+
1393
+ function getStringFromWasm0(ptr, len) {
1394
+ return decodeText(ptr >>> 0, len);
1395
+ }
1396
+
1397
+ let cachedUint32ArrayMemory0 = null;
1398
+ function getUint32ArrayMemory0() {
1399
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1400
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1401
+ }
1402
+ return cachedUint32ArrayMemory0;
1403
+ }
1404
+
1405
+ let cachedUint8ArrayMemory0 = null;
1406
+ function getUint8ArrayMemory0() {
1407
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1408
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1409
+ }
1410
+ return cachedUint8ArrayMemory0;
1411
+ }
1412
+
1413
+ function passArray32ToWasm0(arg, malloc) {
1414
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1415
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1416
+ WASM_VECTOR_LEN = arg.length;
1417
+ return ptr;
1418
+ }
1419
+
1420
+ function passStringToWasm0(arg, malloc, realloc) {
1421
+ if (realloc === undefined) {
1422
+ const buf = cachedTextEncoder.encode(arg);
1423
+ const ptr = malloc(buf.length, 1) >>> 0;
1424
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1425
+ WASM_VECTOR_LEN = buf.length;
1426
+ return ptr;
1427
+ }
1428
+
1429
+ let len = arg.length;
1430
+ let ptr = malloc(len, 1) >>> 0;
1431
+
1432
+ const mem = getUint8ArrayMemory0();
1433
+
1434
+ let offset = 0;
1435
+
1436
+ for (; offset < len; offset++) {
1437
+ const code = arg.charCodeAt(offset);
1438
+ if (code > 0x7F) break;
1439
+ mem[ptr + offset] = code;
1440
+ }
1441
+ if (offset !== len) {
1442
+ if (offset !== 0) {
1443
+ arg = arg.slice(offset);
1444
+ }
1445
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1446
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1447
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1448
+
1449
+ offset += ret.written;
1450
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1451
+ }
1452
+
1453
+ WASM_VECTOR_LEN = offset;
1454
+ return ptr;
1455
+ }
1456
+
1457
+ function takeFromExternrefTable0(idx) {
1458
+ const value = wasm.__wbindgen_externrefs.get(idx);
1459
+ wasm.__externref_table_dealloc(idx);
1460
+ return value;
1461
+ }
1462
+
1463
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1464
+ cachedTextDecoder.decode();
1465
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1466
+ let numBytesDecoded = 0;
1467
+ function decodeText(ptr, len) {
1468
+ numBytesDecoded += len;
1469
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1470
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1471
+ cachedTextDecoder.decode();
1472
+ numBytesDecoded = len;
1473
+ }
1474
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1475
+ }
1476
+
1477
+ const cachedTextEncoder = new TextEncoder();
1478
+
1479
+ if (!('encodeInto' in cachedTextEncoder)) {
1480
+ cachedTextEncoder.encodeInto = function (arg, view) {
1481
+ const buf = cachedTextEncoder.encode(arg);
1482
+ view.set(buf);
1483
+ return {
1484
+ read: arg.length,
1485
+ written: buf.length
1486
+ };
1487
+ };
1488
+ }
1489
+
1490
+ let WASM_VECTOR_LEN = 0;
1491
+
1492
+ let wasmModule, wasmInstance, wasm;
1493
+ function __wbg_finalize_init(instance, module) {
1494
+ wasmInstance = instance;
1495
+ wasm = instance.exports;
1496
+ wasmModule = module;
1497
+ cachedDataViewMemory0 = null;
1498
+ cachedUint32ArrayMemory0 = null;
1499
+ cachedUint8ArrayMemory0 = null;
1500
+ wasm.__wbindgen_start();
1501
+ return wasm;
1502
+ }
1503
+
1504
+ async function __wbg_load(module, imports) {
1505
+ if (typeof Response === 'function' && module instanceof Response) {
1506
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1507
+ try {
1508
+ return await WebAssembly.instantiateStreaming(module, imports);
1509
+ } catch (e) {
1510
+ const validResponse = module.ok && expectedResponseType(module.type);
1511
+
1512
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1513
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1514
+
1515
+ } else { throw e; }
1516
+ }
1517
+ }
1518
+
1519
+ const bytes = await module.arrayBuffer();
1520
+ return await WebAssembly.instantiate(bytes, imports);
1521
+ } else {
1522
+ const instance = await WebAssembly.instantiate(module, imports);
1523
+
1524
+ if (instance instanceof WebAssembly.Instance) {
1525
+ return { instance, module };
1526
+ } else {
1527
+ return instance;
1528
+ }
1529
+ }
1530
+
1531
+ function expectedResponseType(type) {
1532
+ switch (type) {
1533
+ case 'basic': case 'cors': case 'default': return true;
1534
+ }
1535
+ return false;
1536
+ }
1537
+ }
1538
+
1539
+ function initSync(module) {
1540
+ if (wasm !== undefined) return wasm;
1541
+
1542
+
1543
+ if (module !== undefined) {
1544
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1545
+ ({module} = module)
1546
+ } else {
1547
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1548
+ }
1549
+ }
1550
+
1551
+ const imports = __wbg_get_imports();
1552
+ if (!(module instanceof WebAssembly.Module)) {
1553
+ module = new WebAssembly.Module(module);
1554
+ }
1555
+ const instance = new WebAssembly.Instance(module, imports);
1556
+ return __wbg_finalize_init(instance, module);
1557
+ }
1558
+
1559
+ async function __wbg_init(module_or_path) {
1560
+ if (wasm !== undefined) return wasm;
1561
+
1562
+
1563
+ if (module_or_path !== undefined) {
1564
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1565
+ ({module_or_path} = module_or_path)
1566
+ } else {
1567
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1568
+ }
1569
+ }
1570
+
1571
+ if (module_or_path === undefined) {
1572
+ module_or_path = new URL('chematic_wasm_bg.wasm', import.meta.url);
1573
+ }
1574
+ const imports = __wbg_get_imports();
1575
+
1576
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1577
+ module_or_path = fetch(module_or_path);
1578
+ }
1579
+
1580
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1581
+
1582
+ return __wbg_finalize_init(instance, module);
1583
+ }
1584
+
1585
+ export { initSync, __wbg_init as default };