@rybosome/tspice 0.0.1 → 0.0.2-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/backend-contract/dist/.tsbuildinfo +1 -1
  2. package/backend-contract/dist/domains/coords-vectors.d.ts +30 -0
  3. package/backend-contract/dist/domains/coords-vectors.js +2 -0
  4. package/backend-contract/dist/domains/ephemeris.d.ts +8 -0
  5. package/backend-contract/dist/domains/ephemeris.js +2 -0
  6. package/backend-contract/dist/domains/frames.d.ts +33 -0
  7. package/backend-contract/dist/domains/frames.js +2 -0
  8. package/backend-contract/dist/domains/geometry.d.ts +14 -0
  9. package/backend-contract/dist/domains/geometry.js +2 -0
  10. package/backend-contract/dist/domains/ids-names.d.ts +10 -0
  11. package/backend-contract/dist/domains/ids-names.js +2 -0
  12. package/backend-contract/dist/domains/kernels.d.ts +22 -0
  13. package/backend-contract/dist/domains/kernels.js +2 -0
  14. package/backend-contract/dist/domains/time.d.ts +24 -0
  15. package/backend-contract/dist/domains/time.js +2 -0
  16. package/backend-contract/dist/index.d.ts +17 -222
  17. package/backend-contract/dist/index.js +8 -1
  18. package/backend-contract/dist/shared/types.d.ts +108 -0
  19. package/backend-contract/dist/shared/types.js +2 -0
  20. package/backend-fake/dist/.tsbuildinfo +1 -1
  21. package/backend-node/dist/.tsbuildinfo +1 -1
  22. package/backend-node/dist/codec/errors.d.ts +9 -0
  23. package/backend-node/dist/codec/errors.js +14 -0
  24. package/backend-node/dist/domains/coords-vectors.d.ts +4 -0
  25. package/backend-node/dist/domains/coords-vectors.js +62 -0
  26. package/backend-node/dist/domains/ephemeris.d.ts +4 -0
  27. package/backend-node/dist/domains/ephemeris.js +24 -0
  28. package/backend-node/dist/domains/frames.d.ts +4 -0
  29. package/backend-node/dist/domains/frames.js +74 -0
  30. package/backend-node/dist/domains/geometry.d.ts +4 -0
  31. package/backend-node/dist/domains/geometry.js +67 -0
  32. package/backend-node/dist/domains/ids-names.d.ts +4 -0
  33. package/backend-node/dist/domains/ids-names.js +22 -0
  34. package/backend-node/dist/domains/kernels.d.ts +5 -0
  35. package/backend-node/dist/domains/kernels.js +37 -0
  36. package/backend-node/dist/domains/time.d.ts +4 -0
  37. package/backend-node/dist/domains/time.js +36 -0
  38. package/backend-node/dist/index.js +18 -373
  39. package/backend-node/dist/lowlevel/binding.d.ts +3 -0
  40. package/backend-node/dist/lowlevel/binding.js +44 -0
  41. package/backend-node/dist/native.d.ts +2 -111
  42. package/backend-node/dist/native.js +1 -101
  43. package/backend-node/dist/runtime/addon.d.ts +112 -0
  44. package/backend-node/dist/runtime/addon.js +102 -0
  45. package/backend-node/dist/runtime/kernel-staging.d.ts +9 -0
  46. package/backend-node/dist/runtime/kernel-staging.js +75 -0
  47. package/backend-wasm/dist/.tsbuildinfo +1 -1
  48. package/backend-wasm/dist/codec/calls.d.ts +4 -0
  49. package/backend-wasm/dist/codec/calls.js +41 -0
  50. package/backend-wasm/dist/codec/errors.d.ts +3 -0
  51. package/backend-wasm/dist/codec/errors.js +5 -0
  52. package/backend-wasm/dist/codec/found.d.ts +9 -0
  53. package/backend-wasm/dist/codec/found.js +68 -0
  54. package/backend-wasm/dist/codec/strings.d.ts +3 -0
  55. package/backend-wasm/dist/codec/strings.js +12 -0
  56. package/backend-wasm/dist/domains/coords-vectors.d.ts +4 -0
  57. package/backend-wasm/dist/domains/coords-vectors.js +312 -0
  58. package/backend-wasm/dist/domains/ephemeris.d.ts +4 -0
  59. package/backend-wasm/dist/domains/ephemeris.js +81 -0
  60. package/backend-wasm/dist/domains/frames.d.ts +4 -0
  61. package/backend-wasm/dist/domains/frames.js +239 -0
  62. package/backend-wasm/dist/domains/geometry.d.ts +4 -0
  63. package/backend-wasm/dist/domains/geometry.js +240 -0
  64. package/backend-wasm/dist/domains/ids-names.d.ts +4 -0
  65. package/backend-wasm/dist/domains/ids-names.js +18 -0
  66. package/backend-wasm/dist/domains/kernels.d.ts +5 -0
  67. package/backend-wasm/dist/domains/kernels.js +97 -0
  68. package/backend-wasm/dist/domains/time.d.ts +5 -0
  69. package/backend-wasm/dist/domains/time.js +180 -0
  70. package/backend-wasm/dist/index.d.ts +2 -7
  71. package/backend-wasm/dist/index.js +1 -1504
  72. package/backend-wasm/dist/lowlevel/exports.d.ts +49 -0
  73. package/backend-wasm/dist/lowlevel/exports.js +41 -0
  74. package/backend-wasm/dist/runtime/create-backend.d.ts +8 -0
  75. package/backend-wasm/dist/runtime/create-backend.js +81 -0
  76. package/backend-wasm/dist/runtime/fs.d.ts +9 -0
  77. package/backend-wasm/dist/runtime/fs.js +30 -0
  78. package/dist/.tsbuildinfo +1 -1
  79. package/package.json +4 -4
@@ -1,1505 +1,2 @@
1
- export const WASM_JS_FILENAME = "tspice_backend_wasm.js";
2
- export const WASM_BINARY_FILENAME = "tspice_backend_wasm.wasm";
3
- function writeUtf8CString(module, value) {
4
- const encoder = new TextEncoder();
5
- const encoded = encoder.encode(value);
6
- const ptr = module._malloc(encoded.length + 1);
7
- if (!ptr) {
8
- throw new Error("WASM malloc failed");
9
- }
10
- module.HEAPU8.set(encoded, ptr);
11
- module.HEAPU8[ptr + encoded.length] = 0;
12
- return ptr;
13
- }
14
- function throwWasmSpiceError(module, errPtr, errMaxBytes, code) {
15
- const message = module.UTF8ToString(errPtr, errMaxBytes).trim();
16
- throw new Error(message || `CSPICE call failed with code ${code}`);
17
- }
18
- function tspiceCall0(module, fn) {
19
- const errMaxBytes = 2048;
20
- const errPtr = module._malloc(errMaxBytes);
21
- if (!errPtr) {
22
- throw new Error("WASM malloc failed");
23
- }
24
- try {
25
- const result = fn(errPtr, errMaxBytes);
26
- if (result !== 0) {
27
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
28
- }
29
- }
30
- finally {
31
- module._free(errPtr);
32
- }
33
- }
34
- function tspiceCall1Path(module, fn, path) {
35
- const errMaxBytes = 2048;
36
- const errPtr = module._malloc(errMaxBytes);
37
- const pathPtr = writeUtf8CString(module, path);
38
- if (!errPtr || !pathPtr) {
39
- if (pathPtr)
40
- module._free(pathPtr);
41
- if (errPtr)
42
- module._free(errPtr);
43
- throw new Error("WASM malloc failed");
44
- }
45
- try {
46
- const result = fn(pathPtr, errPtr, errMaxBytes);
47
- if (result !== 0) {
48
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
49
- }
50
- }
51
- finally {
52
- module._free(pathPtr);
53
- module._free(errPtr);
54
- }
55
- }
56
- function tspiceCallKtotal(module, kind) {
57
- const errMaxBytes = 2048;
58
- const errPtr = module._malloc(errMaxBytes);
59
- const kindPtr = writeUtf8CString(module, kind);
60
- const outCountPtr = module._malloc(4);
61
- if (!errPtr || !kindPtr || !outCountPtr) {
62
- if (outCountPtr)
63
- module._free(outCountPtr);
64
- if (kindPtr)
65
- module._free(kindPtr);
66
- if (errPtr)
67
- module._free(errPtr);
68
- throw new Error("WASM malloc failed");
69
- }
70
- try {
71
- module.HEAP32[outCountPtr >> 2] = 0;
72
- const result = module._tspice_ktotal(kindPtr, outCountPtr, errPtr, errMaxBytes);
73
- if (result !== 0) {
74
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
75
- }
76
- return module.HEAP32[outCountPtr >> 2] ?? 0;
77
- }
78
- finally {
79
- module._free(outCountPtr);
80
- module._free(kindPtr);
81
- module._free(errPtr);
82
- }
83
- }
84
- function tspiceCallKdata(module, which, kind) {
85
- const errMaxBytes = 2048;
86
- const errPtr = module._malloc(errMaxBytes);
87
- const kindPtr = writeUtf8CString(module, kind);
88
- const fileMaxBytes = 2048;
89
- const filtypMaxBytes = 256;
90
- const sourceMaxBytes = 2048;
91
- const filePtr = module._malloc(fileMaxBytes);
92
- const filtypPtr = module._malloc(filtypMaxBytes);
93
- const sourcePtr = module._malloc(sourceMaxBytes);
94
- const handlePtr = module._malloc(4);
95
- const foundPtr = module._malloc(4);
96
- if (!errPtr ||
97
- !kindPtr ||
98
- !filePtr ||
99
- !filtypPtr ||
100
- !sourcePtr ||
101
- !handlePtr ||
102
- !foundPtr) {
103
- for (const ptr of [foundPtr, handlePtr, sourcePtr, filtypPtr, filePtr, kindPtr, errPtr]) {
104
- if (ptr)
105
- module._free(ptr);
106
- }
107
- throw new Error("WASM malloc failed");
108
- }
109
- try {
110
- module.HEAP32[handlePtr >> 2] = 0;
111
- module.HEAP32[foundPtr >> 2] = 0;
112
- const result = module._tspice_kdata(which, kindPtr, filePtr, fileMaxBytes, filtypPtr, filtypMaxBytes, sourcePtr, sourceMaxBytes, handlePtr, foundPtr, errPtr, errMaxBytes);
113
- if (result !== 0) {
114
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
115
- }
116
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
117
- if (!found) {
118
- return { found: false };
119
- }
120
- return {
121
- found: true,
122
- file: module.UTF8ToString(filePtr, fileMaxBytes).trim(),
123
- filtyp: module.UTF8ToString(filtypPtr, filtypMaxBytes).trim(),
124
- source: module.UTF8ToString(sourcePtr, sourceMaxBytes).trim(),
125
- handle: module.HEAP32[handlePtr >> 2] ?? 0,
126
- };
127
- }
128
- finally {
129
- module._free(foundPtr);
130
- module._free(handlePtr);
131
- module._free(sourcePtr);
132
- module._free(filtypPtr);
133
- module._free(filePtr);
134
- module._free(kindPtr);
135
- module._free(errPtr);
136
- }
137
- }
138
- function tspiceCallStr2et(module, utc) {
139
- const errMaxBytes = 2048;
140
- const errPtr = module._malloc(errMaxBytes);
141
- const utcPtr = writeUtf8CString(module, utc);
142
- const outEtPtr = module._malloc(8);
143
- if (!errPtr || !utcPtr || !outEtPtr) {
144
- for (const ptr of [outEtPtr, utcPtr, errPtr]) {
145
- if (ptr)
146
- module._free(ptr);
147
- }
148
- throw new Error("WASM malloc failed");
149
- }
150
- try {
151
- module.HEAPF64[outEtPtr >> 3] = 0;
152
- const result = module._tspice_str2et(utcPtr, outEtPtr, errPtr, errMaxBytes);
153
- if (result !== 0) {
154
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
155
- }
156
- return module.HEAPF64[outEtPtr >> 3] ?? 0;
157
- }
158
- finally {
159
- module._free(outEtPtr);
160
- module._free(utcPtr);
161
- module._free(errPtr);
162
- }
163
- }
164
- function tspiceCallEt2utc(module, et, format, prec) {
165
- const errMaxBytes = 2048;
166
- const errPtr = module._malloc(errMaxBytes);
167
- const formatPtr = writeUtf8CString(module, format);
168
- // Buffer size includes terminating NUL.
169
- const outMaxBytes = 2048;
170
- const outPtr = module._malloc(outMaxBytes);
171
- if (!errPtr || !formatPtr || !outPtr) {
172
- for (const ptr of [outPtr, formatPtr, errPtr]) {
173
- if (ptr)
174
- module._free(ptr);
175
- }
176
- throw new Error("WASM malloc failed");
177
- }
178
- try {
179
- module.HEAPU8[outPtr] = 0;
180
- const result = module._tspice_et2utc(et, formatPtr, prec, outPtr, outMaxBytes, errPtr, errMaxBytes);
181
- if (result !== 0) {
182
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
183
- }
184
- return module.UTF8ToString(outPtr, outMaxBytes).trim();
185
- }
186
- finally {
187
- module._free(outPtr);
188
- module._free(formatPtr);
189
- module._free(errPtr);
190
- }
191
- }
192
- function tspiceCallTimout(module, et, picture) {
193
- const errMaxBytes = 2048;
194
- const errPtr = module._malloc(errMaxBytes);
195
- const picturePtr = writeUtf8CString(module, picture);
196
- // Buffer size includes terminating NUL.
197
- const outMaxBytes = 2048;
198
- const outPtr = module._malloc(outMaxBytes);
199
- if (!errPtr || !picturePtr || !outPtr) {
200
- for (const ptr of [outPtr, picturePtr, errPtr]) {
201
- if (ptr)
202
- module._free(ptr);
203
- }
204
- throw new Error("WASM malloc failed");
205
- }
206
- try {
207
- module.HEAPU8[outPtr] = 0;
208
- const result = module._tspice_timout(et, picturePtr, outPtr, outMaxBytes, errPtr, errMaxBytes);
209
- if (result !== 0) {
210
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
211
- }
212
- return module.UTF8ToString(outPtr, outMaxBytes).trim();
213
- }
214
- finally {
215
- module._free(outPtr);
216
- module._free(picturePtr);
217
- module._free(errPtr);
218
- }
219
- }
220
- function tspiceCallFoundInt(module, fn, arg) {
221
- const errMaxBytes = 2048;
222
- const errPtr = module._malloc(errMaxBytes);
223
- const argPtr = writeUtf8CString(module, arg);
224
- const outPtr = module._malloc(4);
225
- const foundPtr = module._malloc(4);
226
- if (!errPtr || !argPtr || !outPtr || !foundPtr) {
227
- for (const ptr of [foundPtr, outPtr, argPtr, errPtr]) {
228
- if (ptr)
229
- module._free(ptr);
230
- }
231
- throw new Error("WASM malloc failed");
232
- }
233
- try {
234
- module.HEAP32[outPtr >> 2] = 0;
235
- module.HEAP32[foundPtr >> 2] = 0;
236
- const result = fn(argPtr, outPtr, foundPtr, errPtr, errMaxBytes);
237
- if (result !== 0) {
238
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
239
- }
240
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
241
- if (!found) {
242
- return { found: false };
243
- }
244
- return { found: true, value: module.HEAP32[outPtr >> 2] ?? 0 };
245
- }
246
- finally {
247
- module._free(foundPtr);
248
- module._free(outPtr);
249
- module._free(argPtr);
250
- module._free(errPtr);
251
- }
252
- }
253
- function tspiceCallFoundString(module, fn, code) {
254
- const errMaxBytes = 2048;
255
- const errPtr = module._malloc(errMaxBytes);
256
- const outMaxBytes = 256;
257
- const outPtr = module._malloc(outMaxBytes);
258
- const foundPtr = module._malloc(4);
259
- if (!errPtr || !outPtr || !foundPtr) {
260
- for (const ptr of [foundPtr, outPtr, errPtr]) {
261
- if (ptr)
262
- module._free(ptr);
263
- }
264
- throw new Error("WASM malloc failed");
265
- }
266
- try {
267
- module.HEAPU8[outPtr] = 0;
268
- module.HEAP32[foundPtr >> 2] = 0;
269
- const result = fn(code, outPtr, outMaxBytes, foundPtr, errPtr, errMaxBytes);
270
- if (result !== 0) {
271
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
272
- }
273
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
274
- if (!found) {
275
- return { found: false };
276
- }
277
- return { found: true, value: module.UTF8ToString(outPtr, outMaxBytes).trim() };
278
- }
279
- finally {
280
- module._free(foundPtr);
281
- module._free(outPtr);
282
- module._free(errPtr);
283
- }
284
- }
285
- function tspiceCallCidfrm(module, fn, center) {
286
- const errMaxBytes = 2048;
287
- const errPtr = module._malloc(errMaxBytes);
288
- const outNameMaxBytes = 256;
289
- const outNamePtr = module._malloc(outNameMaxBytes);
290
- const outCodePtr = module._malloc(4);
291
- const foundPtr = module._malloc(4);
292
- if (!errPtr || !outNamePtr || !outCodePtr || !foundPtr) {
293
- for (const ptr of [foundPtr, outCodePtr, outNamePtr, errPtr]) {
294
- if (ptr)
295
- module._free(ptr);
296
- }
297
- throw new Error("WASM malloc failed");
298
- }
299
- try {
300
- module.HEAPU8[outNamePtr] = 0;
301
- module.HEAP32[outCodePtr >> 2] = 0;
302
- module.HEAP32[foundPtr >> 2] = 0;
303
- const result = fn(center, outCodePtr, outNamePtr, outNameMaxBytes, foundPtr, errPtr, errMaxBytes);
304
- if (result !== 0) {
305
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
306
- }
307
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
308
- if (!found) {
309
- return { found: false };
310
- }
311
- return {
312
- found: true,
313
- frcode: module.HEAP32[outCodePtr >> 2] ?? 0,
314
- frname: module.UTF8ToString(outNamePtr, outNameMaxBytes).trim(),
315
- };
316
- }
317
- finally {
318
- module._free(foundPtr);
319
- module._free(outCodePtr);
320
- module._free(outNamePtr);
321
- module._free(errPtr);
322
- }
323
- }
324
- function tspiceCallCnmfrm(module, fn, centerName) {
325
- const errMaxBytes = 2048;
326
- const errPtr = module._malloc(errMaxBytes);
327
- const centerNamePtr = writeUtf8CString(module, centerName);
328
- const outNameMaxBytes = 256;
329
- const outNamePtr = module._malloc(outNameMaxBytes);
330
- const outCodePtr = module._malloc(4);
331
- const foundPtr = module._malloc(4);
332
- if (!errPtr || !centerNamePtr || !outNamePtr || !outCodePtr || !foundPtr) {
333
- for (const ptr of [foundPtr, outCodePtr, outNamePtr, centerNamePtr, errPtr]) {
334
- if (ptr)
335
- module._free(ptr);
336
- }
337
- throw new Error("WASM malloc failed");
338
- }
339
- try {
340
- module.HEAPU8[outNamePtr] = 0;
341
- module.HEAP32[outCodePtr >> 2] = 0;
342
- module.HEAP32[foundPtr >> 2] = 0;
343
- const result = fn(centerNamePtr, outCodePtr, outNamePtr, outNameMaxBytes, foundPtr, errPtr, errMaxBytes);
344
- if (result !== 0) {
345
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
346
- }
347
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
348
- if (!found) {
349
- return { found: false };
350
- }
351
- return {
352
- found: true,
353
- frcode: module.HEAP32[outCodePtr >> 2] ?? 0,
354
- frname: module.UTF8ToString(outNamePtr, outNameMaxBytes).trim(),
355
- };
356
- }
357
- finally {
358
- module._free(foundPtr);
359
- module._free(outCodePtr);
360
- module._free(outNamePtr);
361
- module._free(centerNamePtr);
362
- module._free(errPtr);
363
- }
364
- }
365
- function tspiceCallScs2e(module, sc, sclkch) {
366
- const errMaxBytes = 2048;
367
- const errPtr = module._malloc(errMaxBytes);
368
- const sclkchPtr = writeUtf8CString(module, sclkch);
369
- const outEtPtr = module._malloc(8);
370
- if (!errPtr || !sclkchPtr || !outEtPtr) {
371
- for (const ptr of [outEtPtr, sclkchPtr, errPtr]) {
372
- if (ptr)
373
- module._free(ptr);
374
- }
375
- throw new Error("WASM malloc failed");
376
- }
377
- try {
378
- module.HEAPF64[outEtPtr >> 3] = 0;
379
- const result = module._tspice_scs2e(sc, sclkchPtr, outEtPtr, errPtr, errMaxBytes);
380
- if (result !== 0) {
381
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
382
- }
383
- return module.HEAPF64[outEtPtr >> 3] ?? 0;
384
- }
385
- finally {
386
- module._free(outEtPtr);
387
- module._free(sclkchPtr);
388
- module._free(errPtr);
389
- }
390
- }
391
- function tspiceCallSce2s(module, sc, et) {
392
- const errMaxBytes = 2048;
393
- const errPtr = module._malloc(errMaxBytes);
394
- const outMaxBytes = 2048;
395
- const outPtr = module._malloc(outMaxBytes);
396
- if (!errPtr || !outPtr) {
397
- for (const ptr of [outPtr, errPtr]) {
398
- if (ptr)
399
- module._free(ptr);
400
- }
401
- throw new Error("WASM malloc failed");
402
- }
403
- try {
404
- module.HEAPU8[outPtr] = 0;
405
- const result = module._tspice_sce2s(sc, et, outPtr, outMaxBytes, errPtr, errMaxBytes);
406
- if (result !== 0) {
407
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
408
- }
409
- return module.UTF8ToString(outPtr, outMaxBytes).trim();
410
- }
411
- finally {
412
- module._free(outPtr);
413
- module._free(errPtr);
414
- }
415
- }
416
- function tspiceCallCkgp(module, inst, sclkdp, tol, ref) {
417
- const errMaxBytes = 2048;
418
- const errPtr = module._malloc(errMaxBytes);
419
- const refPtr = writeUtf8CString(module, ref);
420
- const outCmatPtr = module._malloc(9 * 8);
421
- const outClkoutPtr = module._malloc(8);
422
- const foundPtr = module._malloc(4);
423
- if (!errPtr || !refPtr || !outCmatPtr || !outClkoutPtr || !foundPtr) {
424
- for (const ptr of [foundPtr, outClkoutPtr, outCmatPtr, refPtr, errPtr]) {
425
- if (ptr)
426
- module._free(ptr);
427
- }
428
- throw new Error("WASM malloc failed");
429
- }
430
- try {
431
- module.HEAPF64[outClkoutPtr >> 3] = 0;
432
- module.HEAP32[foundPtr >> 2] = 0;
433
- const result = module._tspice_ckgp(inst, sclkdp, tol, refPtr, outCmatPtr, outClkoutPtr, foundPtr, errPtr, errMaxBytes);
434
- if (result !== 0) {
435
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
436
- }
437
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
438
- if (!found) {
439
- return { found: false };
440
- }
441
- const cmat = Array.from(module.HEAPF64.subarray(outCmatPtr >> 3, (outCmatPtr >> 3) + 9));
442
- const clkout = module.HEAPF64[outClkoutPtr >> 3] ?? 0;
443
- return { found: true, cmat, clkout };
444
- }
445
- finally {
446
- module._free(foundPtr);
447
- module._free(outClkoutPtr);
448
- module._free(outCmatPtr);
449
- module._free(refPtr);
450
- module._free(errPtr);
451
- }
452
- }
453
- function tspiceCallCkgpav(module, inst, sclkdp, tol, ref) {
454
- const errMaxBytes = 2048;
455
- const errPtr = module._malloc(errMaxBytes);
456
- const refPtr = writeUtf8CString(module, ref);
457
- const outCmatPtr = module._malloc(9 * 8);
458
- const outAvPtr = module._malloc(3 * 8);
459
- const outClkoutPtr = module._malloc(8);
460
- const foundPtr = module._malloc(4);
461
- if (!errPtr || !refPtr || !outCmatPtr || !outAvPtr || !outClkoutPtr || !foundPtr) {
462
- for (const ptr of [foundPtr, outClkoutPtr, outAvPtr, outCmatPtr, refPtr, errPtr]) {
463
- if (ptr)
464
- module._free(ptr);
465
- }
466
- throw new Error("WASM malloc failed");
467
- }
468
- try {
469
- module.HEAPF64[outClkoutPtr >> 3] = 0;
470
- module.HEAP32[foundPtr >> 2] = 0;
471
- const result = module._tspice_ckgpav(inst, sclkdp, tol, refPtr, outCmatPtr, outAvPtr, outClkoutPtr, foundPtr, errPtr, errMaxBytes);
472
- if (result !== 0) {
473
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
474
- }
475
- const found = (module.HEAP32[foundPtr >> 2] ?? 0) !== 0;
476
- if (!found) {
477
- return { found: false };
478
- }
479
- const cmat = Array.from(module.HEAPF64.subarray(outCmatPtr >> 3, (outCmatPtr >> 3) + 9));
480
- const av = Array.from(module.HEAPF64.subarray(outAvPtr >> 3, (outAvPtr >> 3) + 3));
481
- const clkout = module.HEAPF64[outClkoutPtr >> 3] ?? 0;
482
- return { found: true, cmat, av, clkout };
483
- }
484
- finally {
485
- module._free(foundPtr);
486
- module._free(outClkoutPtr);
487
- module._free(outAvPtr);
488
- module._free(outCmatPtr);
489
- module._free(refPtr);
490
- module._free(errPtr);
491
- }
492
- }
493
- function tspiceCallPxform(module, from, to, et) {
494
- const errMaxBytes = 2048;
495
- const errPtr = module._malloc(errMaxBytes);
496
- const fromPtr = writeUtf8CString(module, from);
497
- const toPtr = writeUtf8CString(module, to);
498
- const outPtr = module._malloc(9 * 8);
499
- if (!errPtr || !fromPtr || !toPtr || !outPtr) {
500
- for (const ptr of [outPtr, toPtr, fromPtr, errPtr]) {
501
- if (ptr)
502
- module._free(ptr);
503
- }
504
- throw new Error("WASM malloc failed");
505
- }
506
- try {
507
- const result = module._tspice_pxform(fromPtr, toPtr, et, outPtr, errPtr, errMaxBytes);
508
- if (result !== 0) {
509
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
510
- }
511
- const out = Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 9));
512
- return out;
513
- }
514
- finally {
515
- module._free(outPtr);
516
- module._free(toPtr);
517
- module._free(fromPtr);
518
- module._free(errPtr);
519
- }
520
- }
521
- function tspiceCallSxform(module, from, to, et) {
522
- const errMaxBytes = 2048;
523
- const errPtr = module._malloc(errMaxBytes);
524
- const fromPtr = writeUtf8CString(module, from);
525
- const toPtr = writeUtf8CString(module, to);
526
- const outPtr = module._malloc(36 * 8);
527
- if (!errPtr || !fromPtr || !toPtr || !outPtr) {
528
- for (const ptr of [outPtr, toPtr, fromPtr, errPtr]) {
529
- if (ptr)
530
- module._free(ptr);
531
- }
532
- throw new Error("WASM malloc failed");
533
- }
534
- try {
535
- const result = module._tspice_sxform(fromPtr, toPtr, et, outPtr, errPtr, errMaxBytes);
536
- if (result !== 0) {
537
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
538
- }
539
- const out = Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 36));
540
- return out;
541
- }
542
- finally {
543
- module._free(outPtr);
544
- module._free(toPtr);
545
- module._free(fromPtr);
546
- module._free(errPtr);
547
- }
548
- }
549
- function tspiceCallSpkezr(module, target, et, ref, abcorr, obs) {
550
- const errMaxBytes = 2048;
551
- const errPtr = module._malloc(errMaxBytes);
552
- const targetPtr = writeUtf8CString(module, target);
553
- const refPtr = writeUtf8CString(module, ref);
554
- const abcorrPtr = writeUtf8CString(module, abcorr);
555
- const obsPtr = writeUtf8CString(module, obs);
556
- const outStatePtr = module._malloc(6 * 8);
557
- const outLtPtr = module._malloc(8);
558
- if (!errPtr || !targetPtr || !refPtr || !abcorrPtr || !obsPtr || !outStatePtr || !outLtPtr) {
559
- for (const ptr of [outLtPtr, outStatePtr, obsPtr, abcorrPtr, refPtr, targetPtr, errPtr]) {
560
- if (ptr)
561
- module._free(ptr);
562
- }
563
- throw new Error("WASM malloc failed");
564
- }
565
- try {
566
- module.HEAPF64[outLtPtr >> 3] = 0;
567
- const result = module._tspice_spkezr(targetPtr, et, refPtr, abcorrPtr, obsPtr, outStatePtr, outLtPtr, errPtr, errMaxBytes);
568
- if (result !== 0) {
569
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
570
- }
571
- const state = Array.from(module.HEAPF64.subarray(outStatePtr >> 3, (outStatePtr >> 3) + 6));
572
- const lt = module.HEAPF64[outLtPtr >> 3] ?? 0;
573
- return { state, lt };
574
- }
575
- finally {
576
- module._free(outLtPtr);
577
- module._free(outStatePtr);
578
- module._free(obsPtr);
579
- module._free(abcorrPtr);
580
- module._free(refPtr);
581
- module._free(targetPtr);
582
- module._free(errPtr);
583
- }
584
- }
585
- function tspiceCallSpkpos(module, target, et, ref, abcorr, obs) {
586
- const errMaxBytes = 2048;
587
- const errPtr = module._malloc(errMaxBytes);
588
- const targetPtr = writeUtf8CString(module, target);
589
- const refPtr = writeUtf8CString(module, ref);
590
- const abcorrPtr = writeUtf8CString(module, abcorr);
591
- const obsPtr = writeUtf8CString(module, obs);
592
- const outPosPtr = module._malloc(3 * 8);
593
- const outLtPtr = module._malloc(8);
594
- if (!errPtr || !targetPtr || !refPtr || !abcorrPtr || !obsPtr || !outPosPtr || !outLtPtr) {
595
- for (const ptr of [outLtPtr, outPosPtr, obsPtr, abcorrPtr, refPtr, targetPtr, errPtr]) {
596
- if (ptr)
597
- module._free(ptr);
598
- }
599
- throw new Error("WASM malloc failed");
600
- }
601
- try {
602
- module.HEAPF64[outLtPtr >> 3] = 0;
603
- const result = module._tspice_spkpos(targetPtr, et, refPtr, abcorrPtr, obsPtr, outPosPtr, outLtPtr, errPtr, errMaxBytes);
604
- if (result !== 0) {
605
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
606
- }
607
- const pos = Array.from(module.HEAPF64.subarray(outPosPtr >> 3, (outPosPtr >> 3) + 3));
608
- const lt = module.HEAPF64[outLtPtr >> 3] ?? 0;
609
- return { pos, lt };
610
- }
611
- finally {
612
- module._free(outLtPtr);
613
- module._free(outPosPtr);
614
- module._free(obsPtr);
615
- module._free(abcorrPtr);
616
- module._free(refPtr);
617
- module._free(targetPtr);
618
- module._free(errPtr);
619
- }
620
- }
621
- // --- Derived geometry primitives ---
622
- function tspiceCallSubpnt(module, method, target, et, fixref, abcorr, observer) {
623
- const errMaxBytes = 2048;
624
- const errPtr = module._malloc(errMaxBytes);
625
- const methodPtr = writeUtf8CString(module, method);
626
- const targetPtr = writeUtf8CString(module, target);
627
- const fixrefPtr = writeUtf8CString(module, fixref);
628
- const abcorrPtr = writeUtf8CString(module, abcorr);
629
- const observerPtr = writeUtf8CString(module, observer);
630
- const outSpointPtr = module._malloc(3 * 8);
631
- const outTrgepcPtr = module._malloc(8);
632
- const outSrfvecPtr = module._malloc(3 * 8);
633
- if (!errPtr ||
634
- !methodPtr ||
635
- !targetPtr ||
636
- !fixrefPtr ||
637
- !abcorrPtr ||
638
- !observerPtr ||
639
- !outSpointPtr ||
640
- !outTrgepcPtr ||
641
- !outSrfvecPtr) {
642
- for (const ptr of [
643
- outSrfvecPtr,
644
- outTrgepcPtr,
645
- outSpointPtr,
646
- observerPtr,
647
- abcorrPtr,
648
- fixrefPtr,
649
- targetPtr,
650
- methodPtr,
651
- errPtr,
652
- ]) {
653
- if (ptr)
654
- module._free(ptr);
655
- }
656
- throw new Error("WASM malloc failed");
657
- }
658
- try {
659
- module.HEAPF64[outTrgepcPtr >> 3] = 0;
660
- const result = module._tspice_subpnt(methodPtr, targetPtr, et, fixrefPtr, abcorrPtr, observerPtr, outSpointPtr, outTrgepcPtr, outSrfvecPtr, errPtr, errMaxBytes);
661
- if (result !== 0) {
662
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
663
- }
664
- const spoint = Array.from(module.HEAPF64.subarray(outSpointPtr >> 3, (outSpointPtr >> 3) + 3));
665
- const trgepc = module.HEAPF64[outTrgepcPtr >> 3] ?? 0;
666
- const srfvec = Array.from(module.HEAPF64.subarray(outSrfvecPtr >> 3, (outSrfvecPtr >> 3) + 3));
667
- return { spoint, trgepc, srfvec };
668
- }
669
- finally {
670
- module._free(outSrfvecPtr);
671
- module._free(outTrgepcPtr);
672
- module._free(outSpointPtr);
673
- module._free(observerPtr);
674
- module._free(abcorrPtr);
675
- module._free(fixrefPtr);
676
- module._free(targetPtr);
677
- module._free(methodPtr);
678
- module._free(errPtr);
679
- }
680
- }
681
- function tspiceCallSubslr(module, method, target, et, fixref, abcorr, observer) {
682
- const errMaxBytes = 2048;
683
- const errPtr = module._malloc(errMaxBytes);
684
- const methodPtr = writeUtf8CString(module, method);
685
- const targetPtr = writeUtf8CString(module, target);
686
- const fixrefPtr = writeUtf8CString(module, fixref);
687
- const abcorrPtr = writeUtf8CString(module, abcorr);
688
- const observerPtr = writeUtf8CString(module, observer);
689
- const outSpointPtr = module._malloc(3 * 8);
690
- const outTrgepcPtr = module._malloc(8);
691
- const outSrfvecPtr = module._malloc(3 * 8);
692
- if (!errPtr ||
693
- !methodPtr ||
694
- !targetPtr ||
695
- !fixrefPtr ||
696
- !abcorrPtr ||
697
- !observerPtr ||
698
- !outSpointPtr ||
699
- !outTrgepcPtr ||
700
- !outSrfvecPtr) {
701
- for (const ptr of [
702
- outSrfvecPtr,
703
- outTrgepcPtr,
704
- outSpointPtr,
705
- observerPtr,
706
- abcorrPtr,
707
- fixrefPtr,
708
- targetPtr,
709
- methodPtr,
710
- errPtr,
711
- ]) {
712
- if (ptr)
713
- module._free(ptr);
714
- }
715
- throw new Error("WASM malloc failed");
716
- }
717
- try {
718
- module.HEAPF64[outTrgepcPtr >> 3] = 0;
719
- const result = module._tspice_subslr(methodPtr, targetPtr, et, fixrefPtr, abcorrPtr, observerPtr, outSpointPtr, outTrgepcPtr, outSrfvecPtr, errPtr, errMaxBytes);
720
- if (result !== 0) {
721
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
722
- }
723
- const spoint = Array.from(module.HEAPF64.subarray(outSpointPtr >> 3, (outSpointPtr >> 3) + 3));
724
- const trgepc = module.HEAPF64[outTrgepcPtr >> 3] ?? 0;
725
- const srfvec = Array.from(module.HEAPF64.subarray(outSrfvecPtr >> 3, (outSrfvecPtr >> 3) + 3));
726
- return { spoint, trgepc, srfvec };
727
- }
728
- finally {
729
- module._free(outSrfvecPtr);
730
- module._free(outTrgepcPtr);
731
- module._free(outSpointPtr);
732
- module._free(observerPtr);
733
- module._free(abcorrPtr);
734
- module._free(fixrefPtr);
735
- module._free(targetPtr);
736
- module._free(methodPtr);
737
- module._free(errPtr);
738
- }
739
- }
740
- function tspiceCallSincpt(module, method, target, et, fixref, abcorr, observer, dref, dvec) {
741
- const errMaxBytes = 2048;
742
- const errPtr = module._malloc(errMaxBytes);
743
- const methodPtr = writeUtf8CString(module, method);
744
- const targetPtr = writeUtf8CString(module, target);
745
- const fixrefPtr = writeUtf8CString(module, fixref);
746
- const abcorrPtr = writeUtf8CString(module, abcorr);
747
- const observerPtr = writeUtf8CString(module, observer);
748
- const drefPtr = writeUtf8CString(module, dref);
749
- const dvecPtr = module._malloc(3 * 8);
750
- const outSpointPtr = module._malloc(3 * 8);
751
- const outTrgepcPtr = module._malloc(8);
752
- const outSrfvecPtr = module._malloc(3 * 8);
753
- const outFoundPtr = module._malloc(4);
754
- if (!errPtr ||
755
- !methodPtr ||
756
- !targetPtr ||
757
- !fixrefPtr ||
758
- !abcorrPtr ||
759
- !observerPtr ||
760
- !drefPtr ||
761
- !dvecPtr ||
762
- !outSpointPtr ||
763
- !outTrgepcPtr ||
764
- !outSrfvecPtr ||
765
- !outFoundPtr) {
766
- for (const ptr of [
767
- outFoundPtr,
768
- outSrfvecPtr,
769
- outTrgepcPtr,
770
- outSpointPtr,
771
- dvecPtr,
772
- drefPtr,
773
- observerPtr,
774
- abcorrPtr,
775
- fixrefPtr,
776
- targetPtr,
777
- methodPtr,
778
- errPtr,
779
- ]) {
780
- if (ptr)
781
- module._free(ptr);
782
- }
783
- throw new Error("WASM malloc failed");
784
- }
785
- try {
786
- module.HEAPF64.set(dvec, dvecPtr >> 3);
787
- module.HEAPF64[outTrgepcPtr >> 3] = 0;
788
- module.HEAP32[outFoundPtr >> 2] = 0;
789
- const result = module._tspice_sincpt(methodPtr, targetPtr, et, fixrefPtr, abcorrPtr, observerPtr, drefPtr, dvecPtr, outSpointPtr, outTrgepcPtr, outSrfvecPtr, outFoundPtr, errPtr, errMaxBytes);
790
- if (result !== 0) {
791
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
792
- }
793
- const found = module.HEAP32[outFoundPtr >> 2] ?? 0;
794
- if (!found) {
795
- return { found: false };
796
- }
797
- const spoint = Array.from(module.HEAPF64.subarray(outSpointPtr >> 3, (outSpointPtr >> 3) + 3));
798
- const trgepc = module.HEAPF64[outTrgepcPtr >> 3] ?? 0;
799
- const srfvec = Array.from(module.HEAPF64.subarray(outSrfvecPtr >> 3, (outSrfvecPtr >> 3) + 3));
800
- return { found: true, spoint, trgepc, srfvec };
801
- }
802
- finally {
803
- module._free(outFoundPtr);
804
- module._free(outSrfvecPtr);
805
- module._free(outTrgepcPtr);
806
- module._free(outSpointPtr);
807
- module._free(dvecPtr);
808
- module._free(drefPtr);
809
- module._free(observerPtr);
810
- module._free(abcorrPtr);
811
- module._free(fixrefPtr);
812
- module._free(targetPtr);
813
- module._free(methodPtr);
814
- module._free(errPtr);
815
- }
816
- }
817
- function tspiceCallIlumin(module, method, target, et, fixref, abcorr, observer, spoint) {
818
- const errMaxBytes = 2048;
819
- const errPtr = module._malloc(errMaxBytes);
820
- const methodPtr = writeUtf8CString(module, method);
821
- const targetPtr = writeUtf8CString(module, target);
822
- const fixrefPtr = writeUtf8CString(module, fixref);
823
- const abcorrPtr = writeUtf8CString(module, abcorr);
824
- const observerPtr = writeUtf8CString(module, observer);
825
- const spointPtr = module._malloc(3 * 8);
826
- const outTrgepcPtr = module._malloc(8);
827
- const outSrfvecPtr = module._malloc(3 * 8);
828
- const outPhasePtr = module._malloc(8);
829
- const outIncdncPtr = module._malloc(8);
830
- const outEmissnPtr = module._malloc(8);
831
- if (!errPtr ||
832
- !methodPtr ||
833
- !targetPtr ||
834
- !fixrefPtr ||
835
- !abcorrPtr ||
836
- !observerPtr ||
837
- !spointPtr ||
838
- !outTrgepcPtr ||
839
- !outSrfvecPtr ||
840
- !outPhasePtr ||
841
- !outIncdncPtr ||
842
- !outEmissnPtr) {
843
- for (const ptr of [
844
- outEmissnPtr,
845
- outIncdncPtr,
846
- outPhasePtr,
847
- outSrfvecPtr,
848
- outTrgepcPtr,
849
- spointPtr,
850
- observerPtr,
851
- abcorrPtr,
852
- fixrefPtr,
853
- targetPtr,
854
- methodPtr,
855
- errPtr,
856
- ]) {
857
- if (ptr)
858
- module._free(ptr);
859
- }
860
- throw new Error("WASM malloc failed");
861
- }
862
- try {
863
- module.HEAPF64.set(spoint, spointPtr >> 3);
864
- module.HEAPF64[outTrgepcPtr >> 3] = 0;
865
- module.HEAPF64[outPhasePtr >> 3] = 0;
866
- module.HEAPF64[outIncdncPtr >> 3] = 0;
867
- module.HEAPF64[outEmissnPtr >> 3] = 0;
868
- const result = module._tspice_ilumin(methodPtr, targetPtr, et, fixrefPtr, abcorrPtr, observerPtr, spointPtr, outTrgepcPtr, outSrfvecPtr, outPhasePtr, outIncdncPtr, outEmissnPtr, errPtr, errMaxBytes);
869
- if (result !== 0) {
870
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
871
- }
872
- const trgepc = module.HEAPF64[outTrgepcPtr >> 3] ?? 0;
873
- const srfvec = Array.from(module.HEAPF64.subarray(outSrfvecPtr >> 3, (outSrfvecPtr >> 3) + 3));
874
- const phase = module.HEAPF64[outPhasePtr >> 3] ?? 0;
875
- const incdnc = module.HEAPF64[outIncdncPtr >> 3] ?? 0;
876
- const emissn = module.HEAPF64[outEmissnPtr >> 3] ?? 0;
877
- return { trgepc, srfvec, phase, incdnc, emissn };
878
- }
879
- finally {
880
- module._free(outEmissnPtr);
881
- module._free(outIncdncPtr);
882
- module._free(outPhasePtr);
883
- module._free(outSrfvecPtr);
884
- module._free(outTrgepcPtr);
885
- module._free(spointPtr);
886
- module._free(observerPtr);
887
- module._free(abcorrPtr);
888
- module._free(fixrefPtr);
889
- module._free(targetPtr);
890
- module._free(methodPtr);
891
- module._free(errPtr);
892
- }
893
- }
894
- function tspiceCallOccult(module, targ1, shape1, frame1, targ2, shape2, frame2, abcorr, observer, et) {
895
- const errMaxBytes = 2048;
896
- const errPtr = module._malloc(errMaxBytes);
897
- const targ1Ptr = writeUtf8CString(module, targ1);
898
- const shape1Ptr = writeUtf8CString(module, shape1);
899
- const frame1Ptr = writeUtf8CString(module, frame1);
900
- const targ2Ptr = writeUtf8CString(module, targ2);
901
- const shape2Ptr = writeUtf8CString(module, shape2);
902
- const frame2Ptr = writeUtf8CString(module, frame2);
903
- const abcorrPtr = writeUtf8CString(module, abcorr);
904
- const observerPtr = writeUtf8CString(module, observer);
905
- const outOcltidPtr = module._malloc(4);
906
- if (!errPtr ||
907
- !targ1Ptr ||
908
- !shape1Ptr ||
909
- !frame1Ptr ||
910
- !targ2Ptr ||
911
- !shape2Ptr ||
912
- !frame2Ptr ||
913
- !abcorrPtr ||
914
- !observerPtr ||
915
- !outOcltidPtr) {
916
- for (const ptr of [
917
- outOcltidPtr,
918
- observerPtr,
919
- abcorrPtr,
920
- frame2Ptr,
921
- shape2Ptr,
922
- targ2Ptr,
923
- frame1Ptr,
924
- shape1Ptr,
925
- targ1Ptr,
926
- errPtr,
927
- ]) {
928
- if (ptr)
929
- module._free(ptr);
930
- }
931
- throw new Error("WASM malloc failed");
932
- }
933
- try {
934
- module.HEAP32[outOcltidPtr >> 2] = 0;
935
- const result = module._tspice_occult(targ1Ptr, shape1Ptr, frame1Ptr, targ2Ptr, shape2Ptr, frame2Ptr, abcorrPtr, observerPtr, et, outOcltidPtr, errPtr, errMaxBytes);
936
- if (result !== 0) {
937
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
938
- }
939
- return module.HEAP32[outOcltidPtr >> 2] ?? 0;
940
- }
941
- finally {
942
- module._free(outOcltidPtr);
943
- module._free(observerPtr);
944
- module._free(abcorrPtr);
945
- module._free(frame2Ptr);
946
- module._free(shape2Ptr);
947
- module._free(targ2Ptr);
948
- module._free(frame1Ptr);
949
- module._free(shape1Ptr);
950
- module._free(targ1Ptr);
951
- module._free(errPtr);
952
- }
953
- }
954
- // --- coordinate conversions + small vector/matrix helpers ---
955
- function tspiceCallReclat(module, rect) {
956
- const errMaxBytes = 2048;
957
- const errPtr = module._malloc(errMaxBytes);
958
- const rectPtr = module._malloc(3 * 8);
959
- const outRadiusPtr = module._malloc(8);
960
- const outLonPtr = module._malloc(8);
961
- const outLatPtr = module._malloc(8);
962
- if (!errPtr || !rectPtr || !outRadiusPtr || !outLonPtr || !outLatPtr) {
963
- for (const ptr of [outLatPtr, outLonPtr, outRadiusPtr, rectPtr, errPtr]) {
964
- if (ptr)
965
- module._free(ptr);
966
- }
967
- throw new Error("WASM malloc failed");
968
- }
969
- try {
970
- module.HEAPF64.set(rect, rectPtr >> 3);
971
- module.HEAPF64[outRadiusPtr >> 3] = 0;
972
- module.HEAPF64[outLonPtr >> 3] = 0;
973
- module.HEAPF64[outLatPtr >> 3] = 0;
974
- const result = module._tspice_reclat(rectPtr, outRadiusPtr, outLonPtr, outLatPtr, errPtr, errMaxBytes);
975
- if (result !== 0) {
976
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
977
- }
978
- return {
979
- radius: module.HEAPF64[outRadiusPtr >> 3] ?? 0,
980
- lon: module.HEAPF64[outLonPtr >> 3] ?? 0,
981
- lat: module.HEAPF64[outLatPtr >> 3] ?? 0,
982
- };
983
- }
984
- finally {
985
- module._free(outLatPtr);
986
- module._free(outLonPtr);
987
- module._free(outRadiusPtr);
988
- module._free(rectPtr);
989
- module._free(errPtr);
990
- }
991
- }
992
- function tspiceCallLatrec(module, radius, lon, lat) {
993
- const errMaxBytes = 2048;
994
- const errPtr = module._malloc(errMaxBytes);
995
- const outRectPtr = module._malloc(3 * 8);
996
- if (!errPtr || !outRectPtr) {
997
- for (const ptr of [outRectPtr, errPtr]) {
998
- if (ptr)
999
- module._free(ptr);
1000
- }
1001
- throw new Error("WASM malloc failed");
1002
- }
1003
- try {
1004
- module.HEAPF64.set([0, 0, 0], outRectPtr >> 3);
1005
- const result = module._tspice_latrec(radius, lon, lat, outRectPtr, errPtr, errMaxBytes);
1006
- if (result !== 0) {
1007
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1008
- }
1009
- return Array.from(module.HEAPF64.subarray(outRectPtr >> 3, (outRectPtr >> 3) + 3));
1010
- }
1011
- finally {
1012
- module._free(outRectPtr);
1013
- module._free(errPtr);
1014
- }
1015
- }
1016
- function tspiceCallRecsph(module, rect) {
1017
- const errMaxBytes = 2048;
1018
- const errPtr = module._malloc(errMaxBytes);
1019
- const rectPtr = module._malloc(3 * 8);
1020
- const outRadiusPtr = module._malloc(8);
1021
- const outColatPtr = module._malloc(8);
1022
- const outLonPtr = module._malloc(8);
1023
- if (!errPtr || !rectPtr || !outRadiusPtr || !outColatPtr || !outLonPtr) {
1024
- for (const ptr of [outLonPtr, outColatPtr, outRadiusPtr, rectPtr, errPtr]) {
1025
- if (ptr)
1026
- module._free(ptr);
1027
- }
1028
- throw new Error("WASM malloc failed");
1029
- }
1030
- try {
1031
- module.HEAPF64.set(rect, rectPtr >> 3);
1032
- module.HEAPF64[outRadiusPtr >> 3] = 0;
1033
- module.HEAPF64[outColatPtr >> 3] = 0;
1034
- module.HEAPF64[outLonPtr >> 3] = 0;
1035
- const result = module._tspice_recsph(rectPtr, outRadiusPtr, outColatPtr, outLonPtr, errPtr, errMaxBytes);
1036
- if (result !== 0) {
1037
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1038
- }
1039
- return {
1040
- radius: module.HEAPF64[outRadiusPtr >> 3] ?? 0,
1041
- colat: module.HEAPF64[outColatPtr >> 3] ?? 0,
1042
- lon: module.HEAPF64[outLonPtr >> 3] ?? 0,
1043
- };
1044
- }
1045
- finally {
1046
- module._free(outLonPtr);
1047
- module._free(outColatPtr);
1048
- module._free(outRadiusPtr);
1049
- module._free(rectPtr);
1050
- module._free(errPtr);
1051
- }
1052
- }
1053
- function tspiceCallSphrec(module, radius, colat, lon) {
1054
- const errMaxBytes = 2048;
1055
- const errPtr = module._malloc(errMaxBytes);
1056
- const outRectPtr = module._malloc(3 * 8);
1057
- if (!errPtr || !outRectPtr) {
1058
- for (const ptr of [outRectPtr, errPtr]) {
1059
- if (ptr)
1060
- module._free(ptr);
1061
- }
1062
- throw new Error("WASM malloc failed");
1063
- }
1064
- try {
1065
- module.HEAPF64.set([0, 0, 0], outRectPtr >> 3);
1066
- const result = module._tspice_sphrec(radius, colat, lon, outRectPtr, errPtr, errMaxBytes);
1067
- if (result !== 0) {
1068
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1069
- }
1070
- return Array.from(module.HEAPF64.subarray(outRectPtr >> 3, (outRectPtr >> 3) + 3));
1071
- }
1072
- finally {
1073
- module._free(outRectPtr);
1074
- module._free(errPtr);
1075
- }
1076
- }
1077
- function tspiceCallVnorm(module, v) {
1078
- const errMaxBytes = 2048;
1079
- const errPtr = module._malloc(errMaxBytes);
1080
- const vPtr = module._malloc(3 * 8);
1081
- const outNormPtr = module._malloc(8);
1082
- if (!errPtr || !vPtr || !outNormPtr) {
1083
- for (const ptr of [outNormPtr, vPtr, errPtr]) {
1084
- if (ptr)
1085
- module._free(ptr);
1086
- }
1087
- throw new Error("WASM malloc failed");
1088
- }
1089
- try {
1090
- module.HEAPF64.set(v, vPtr >> 3);
1091
- module.HEAPF64[outNormPtr >> 3] = 0;
1092
- const result = module._tspice_vnorm(vPtr, outNormPtr, errPtr, errMaxBytes);
1093
- if (result !== 0) {
1094
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1095
- }
1096
- return module.HEAPF64[outNormPtr >> 3] ?? 0;
1097
- }
1098
- finally {
1099
- module._free(outNormPtr);
1100
- module._free(vPtr);
1101
- module._free(errPtr);
1102
- }
1103
- }
1104
- function tspiceCallVhat(module, v) {
1105
- const errMaxBytes = 2048;
1106
- const errPtr = module._malloc(errMaxBytes);
1107
- const vPtr = module._malloc(3 * 8);
1108
- const outPtr = module._malloc(3 * 8);
1109
- if (!errPtr || !vPtr || !outPtr) {
1110
- for (const ptr of [outPtr, vPtr, errPtr]) {
1111
- if (ptr)
1112
- module._free(ptr);
1113
- }
1114
- throw new Error("WASM malloc failed");
1115
- }
1116
- try {
1117
- module.HEAPF64.set(v, vPtr >> 3);
1118
- module.HEAPF64.set([0, 0, 0], outPtr >> 3);
1119
- const result = module._tspice_vhat(vPtr, outPtr, errPtr, errMaxBytes);
1120
- if (result !== 0) {
1121
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1122
- }
1123
- return Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 3));
1124
- }
1125
- finally {
1126
- module._free(outPtr);
1127
- module._free(vPtr);
1128
- module._free(errPtr);
1129
- }
1130
- }
1131
- function tspiceCallVdot(module, a, b) {
1132
- const errMaxBytes = 2048;
1133
- const errPtr = module._malloc(errMaxBytes);
1134
- const aPtr = module._malloc(3 * 8);
1135
- const bPtr = module._malloc(3 * 8);
1136
- const outDotPtr = module._malloc(8);
1137
- if (!errPtr || !aPtr || !bPtr || !outDotPtr) {
1138
- for (const ptr of [outDotPtr, bPtr, aPtr, errPtr]) {
1139
- if (ptr)
1140
- module._free(ptr);
1141
- }
1142
- throw new Error("WASM malloc failed");
1143
- }
1144
- try {
1145
- module.HEAPF64.set(a, aPtr >> 3);
1146
- module.HEAPF64.set(b, bPtr >> 3);
1147
- module.HEAPF64[outDotPtr >> 3] = 0;
1148
- const result = module._tspice_vdot(aPtr, bPtr, outDotPtr, errPtr, errMaxBytes);
1149
- if (result !== 0) {
1150
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1151
- }
1152
- return module.HEAPF64[outDotPtr >> 3] ?? 0;
1153
- }
1154
- finally {
1155
- module._free(outDotPtr);
1156
- module._free(bPtr);
1157
- module._free(aPtr);
1158
- module._free(errPtr);
1159
- }
1160
- }
1161
- function tspiceCallVcrss(module, a, b) {
1162
- const errMaxBytes = 2048;
1163
- const errPtr = module._malloc(errMaxBytes);
1164
- const aPtr = module._malloc(3 * 8);
1165
- const bPtr = module._malloc(3 * 8);
1166
- const outPtr = module._malloc(3 * 8);
1167
- if (!errPtr || !aPtr || !bPtr || !outPtr) {
1168
- for (const ptr of [outPtr, bPtr, aPtr, errPtr]) {
1169
- if (ptr)
1170
- module._free(ptr);
1171
- }
1172
- throw new Error("WASM malloc failed");
1173
- }
1174
- try {
1175
- module.HEAPF64.set(a, aPtr >> 3);
1176
- module.HEAPF64.set(b, bPtr >> 3);
1177
- module.HEAPF64.set([0, 0, 0], outPtr >> 3);
1178
- const result = module._tspice_vcrss(aPtr, bPtr, outPtr, errPtr, errMaxBytes);
1179
- if (result !== 0) {
1180
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1181
- }
1182
- return Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 3));
1183
- }
1184
- finally {
1185
- module._free(outPtr);
1186
- module._free(bPtr);
1187
- module._free(aPtr);
1188
- module._free(errPtr);
1189
- }
1190
- }
1191
- function tspiceCallMxv(module, m, v) {
1192
- const errMaxBytes = 2048;
1193
- const errPtr = module._malloc(errMaxBytes);
1194
- const mPtr = module._malloc(9 * 8);
1195
- const vPtr = module._malloc(3 * 8);
1196
- const outPtr = module._malloc(3 * 8);
1197
- if (!errPtr || !mPtr || !vPtr || !outPtr) {
1198
- for (const ptr of [outPtr, vPtr, mPtr, errPtr]) {
1199
- if (ptr)
1200
- module._free(ptr);
1201
- }
1202
- throw new Error("WASM malloc failed");
1203
- }
1204
- try {
1205
- module.HEAPF64.set(m, mPtr >> 3);
1206
- module.HEAPF64.set(v, vPtr >> 3);
1207
- module.HEAPF64.set([0, 0, 0], outPtr >> 3);
1208
- const result = module._tspice_mxv(mPtr, vPtr, outPtr, errPtr, errMaxBytes);
1209
- if (result !== 0) {
1210
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1211
- }
1212
- return Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 3));
1213
- }
1214
- finally {
1215
- module._free(outPtr);
1216
- module._free(vPtr);
1217
- module._free(mPtr);
1218
- module._free(errPtr);
1219
- }
1220
- }
1221
- function tspiceCallMtxv(module, m, v) {
1222
- const errMaxBytes = 2048;
1223
- const errPtr = module._malloc(errMaxBytes);
1224
- const mPtr = module._malloc(9 * 8);
1225
- const vPtr = module._malloc(3 * 8);
1226
- const outPtr = module._malloc(3 * 8);
1227
- if (!errPtr || !mPtr || !vPtr || !outPtr) {
1228
- for (const ptr of [outPtr, vPtr, mPtr, errPtr]) {
1229
- if (ptr)
1230
- module._free(ptr);
1231
- }
1232
- throw new Error("WASM malloc failed");
1233
- }
1234
- try {
1235
- module.HEAPF64.set(m, mPtr >> 3);
1236
- module.HEAPF64.set(v, vPtr >> 3);
1237
- module.HEAPF64.set([0, 0, 0], outPtr >> 3);
1238
- const result = module._tspice_mtxv(mPtr, vPtr, outPtr, errPtr, errMaxBytes);
1239
- if (result !== 0) {
1240
- throwWasmSpiceError(module, errPtr, errMaxBytes, result);
1241
- }
1242
- return Array.from(module.HEAPF64.subarray(outPtr >> 3, (outPtr >> 3) + 3));
1243
- }
1244
- finally {
1245
- module._free(outPtr);
1246
- module._free(vPtr);
1247
- module._free(mPtr);
1248
- module._free(errPtr);
1249
- }
1250
- }
1251
- function getToolkitVersion(module) {
1252
- const outMaxBytes = 256;
1253
- const errMaxBytes = 2048;
1254
- const outPtr = module._malloc(outMaxBytes);
1255
- const errPtr = module._malloc(errMaxBytes);
1256
- if (!outPtr || !errPtr) {
1257
- if (errPtr) {
1258
- module._free(errPtr);
1259
- }
1260
- if (outPtr) {
1261
- module._free(outPtr);
1262
- }
1263
- throw new Error("WASM malloc failed");
1264
- }
1265
- try {
1266
- const result = module._tspice_tkvrsn_toolkit(outPtr, outMaxBytes, errPtr, errMaxBytes);
1267
- if (result !== 0) {
1268
- const message = module.UTF8ToString(errPtr, errMaxBytes).trim();
1269
- throw new Error(message || `CSPICE call failed with code ${result}`);
1270
- }
1271
- return module.UTF8ToString(outPtr, outMaxBytes);
1272
- }
1273
- finally {
1274
- module._free(errPtr);
1275
- module._free(outPtr);
1276
- }
1277
- }
1278
- export async function createWasmBackend(options = {}) {
1279
- // NOTE: Keep this as a literal string so bundlers (Vite) don't generate a
1280
- // runtime glob map for *every* file in this directory (including *.d.ts.map),
1281
- // which can lead to JSON being imported as an ESM module.
1282
- const defaultWasmUrl = new URL("./tspice_backend_wasm.wasm", import.meta.url);
1283
- const wasmUrl = options.wasmUrl?.toString() ?? defaultWasmUrl.href;
1284
- let createEmscriptenModule;
1285
- try {
1286
- // NOTE: This must be a literal import path so bundlers like Vite don't
1287
- // rewrite the glue JS into an asset URL module (via `new URL(..., import.meta.url)`
1288
- // + `?url`) which breaks `import()`.
1289
- ({ default: createEmscriptenModule } = (await import("./tspice_backend_wasm.js")));
1290
- }
1291
- catch (error) {
1292
- throw new Error(`Failed to load tspice WASM glue (./${WASM_JS_FILENAME}): ${String(error)}`);
1293
- }
1294
- const wasmLocator = wasmUrl;
1295
- const isNodeRuntime =
1296
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1297
- typeof process !== "undefined" &&
1298
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1299
- !!process.versions?.node;
1300
- // Node's built-in `fetch` can't load `file://...` URLs, so in Node we feed the
1301
- // bytes directly to Emscripten via `wasmBinary`.
1302
- const wasmBinary = isNodeRuntime && wasmUrl.startsWith("file://")
1303
- ? await (async () => {
1304
- const [{ readFile }, { fileURLToPath }] = await Promise.all([
1305
- import("node:fs/promises"),
1306
- import("node:url"),
1307
- ]);
1308
- const wasmPath = fileURLToPath(wasmUrl);
1309
- return readFile(wasmPath);
1310
- })()
1311
- : undefined;
1312
- let module;
1313
- try {
1314
- module = (await createEmscriptenModule({
1315
- locateFile(path, prefix) {
1316
- if (path === WASM_BINARY_FILENAME) {
1317
- return wasmLocator;
1318
- }
1319
- return `${prefix}${path}`;
1320
- },
1321
- ...(wasmBinary ? { wasmBinary } : {}),
1322
- }));
1323
- }
1324
- catch (error) {
1325
- throw new Error(`Failed to initialize tspice WASM module (wasmUrl=${wasmUrl}): ${String(error)}`);
1326
- }
1327
- if (typeof module._tspice_tkvrsn_toolkit !== "function" ||
1328
- typeof module._malloc !== "function" ||
1329
- typeof module._free !== "function" ||
1330
- typeof module.UTF8ToString !== "function" ||
1331
- typeof module._tspice_furnsh !== "function" ||
1332
- typeof module._tspice_unload !== "function" ||
1333
- typeof module._tspice_kclear !== "function" ||
1334
- typeof module._tspice_ktotal !== "function" ||
1335
- typeof module._tspice_kdata !== "function" ||
1336
- typeof module._tspice_str2et !== "function" ||
1337
- typeof module._tspice_et2utc !== "function" ||
1338
- typeof module._tspice_timout !== "function" ||
1339
- typeof module._tspice_bodn2c !== "function" ||
1340
- typeof module._tspice_bodc2n !== "function" ||
1341
- typeof module._tspice_namfrm !== "function" ||
1342
- typeof module._tspice_frmnam !== "function" ||
1343
- typeof module._tspice_scs2e !== "function" ||
1344
- typeof module._tspice_sce2s !== "function" ||
1345
- typeof module._tspice_ckgp !== "function" ||
1346
- typeof module._tspice_ckgpav !== "function" ||
1347
- typeof module._tspice_pxform !== "function" ||
1348
- typeof module._tspice_sxform !== "function" ||
1349
- typeof module._tspice_spkezr !== "function" ||
1350
- typeof module._tspice_spkpos !== "function" ||
1351
- typeof module._tspice_reclat !== "function" ||
1352
- typeof module._tspice_latrec !== "function" ||
1353
- typeof module._tspice_recsph !== "function" ||
1354
- typeof module._tspice_sphrec !== "function" ||
1355
- typeof module._tspice_vnorm !== "function" ||
1356
- typeof module._tspice_vhat !== "function" ||
1357
- typeof module._tspice_vdot !== "function" ||
1358
- typeof module._tspice_vcrss !== "function" ||
1359
- typeof module._tspice_mxv !== "function" ||
1360
- typeof module._tspice_mtxv !== "function") {
1361
- throw new Error("WASM module is missing expected exports");
1362
- }
1363
- // The toolkit version is constant for the lifetime of a loaded module.
1364
- const toolkitVersion = getToolkitVersion(module);
1365
- function writeFile(path, data) {
1366
- const dir = path.split("/").slice(0, -1).join("/") || "/";
1367
- if (dir && dir !== "/") {
1368
- module.FS.mkdirTree(dir);
1369
- }
1370
- // Normalize to a tightly-sized, offset-0 view to avoid FS edge cases with Buffer pooling.
1371
- const bytes = data.byteOffset === 0 && data.byteLength === data.buffer.byteLength
1372
- ? data
1373
- : new Uint8Array(data);
1374
- module.FS.writeFile(path, bytes);
1375
- }
1376
- const backend = {
1377
- kind: "wasm",
1378
- spiceVersion: () => toolkitVersion,
1379
- tkvrsn: (item) => {
1380
- if (item !== "TOOLKIT") {
1381
- throw new Error(`Unsupported tkvrsn item: ${item}`);
1382
- }
1383
- return toolkitVersion;
1384
- },
1385
- furnsh(kernel) {
1386
- if (typeof kernel === "string") {
1387
- tspiceCall1Path(module, module._tspice_furnsh, kernel);
1388
- return;
1389
- }
1390
- writeFile(kernel.path, kernel.bytes);
1391
- tspiceCall1Path(module, module._tspice_furnsh, kernel.path);
1392
- },
1393
- unload(path) {
1394
- tspiceCall1Path(module, module._tspice_unload, path);
1395
- },
1396
- kclear() {
1397
- tspiceCall0(module, module._tspice_kclear);
1398
- },
1399
- ktotal(kind = "ALL") {
1400
- return tspiceCallKtotal(module, kind);
1401
- },
1402
- kdata(which, kind = "ALL") {
1403
- return tspiceCallKdata(module, which, kind);
1404
- },
1405
- str2et(utc) {
1406
- return tspiceCallStr2et(module, utc);
1407
- },
1408
- et2utc(et, format, prec) {
1409
- return tspiceCallEt2utc(module, et, format, prec);
1410
- },
1411
- timout(et, picture) {
1412
- return tspiceCallTimout(module, et, picture);
1413
- },
1414
- bodn2c(name) {
1415
- const out = tspiceCallFoundInt(module, module._tspice_bodn2c, name);
1416
- if (!out.found)
1417
- return { found: false };
1418
- return { found: true, code: out.value };
1419
- },
1420
- bodc2n(code) {
1421
- const out = tspiceCallFoundString(module, module._tspice_bodc2n, code);
1422
- if (!out.found)
1423
- return { found: false };
1424
- return { found: true, name: out.value };
1425
- },
1426
- namfrm(name) {
1427
- const out = tspiceCallFoundInt(module, module._tspice_namfrm, name);
1428
- if (!out.found)
1429
- return { found: false };
1430
- return { found: true, code: out.value };
1431
- },
1432
- frmnam(code) {
1433
- const out = tspiceCallFoundString(module, module._tspice_frmnam, code);
1434
- if (!out.found)
1435
- return { found: false };
1436
- return { found: true, name: out.value };
1437
- },
1438
- cidfrm(center) {
1439
- return tspiceCallCidfrm(module, module._tspice_cidfrm, center);
1440
- },
1441
- cnmfrm(centerName) {
1442
- return tspiceCallCnmfrm(module, module._tspice_cnmfrm, centerName);
1443
- },
1444
- scs2e(sc, sclkch) {
1445
- return tspiceCallScs2e(module, sc, sclkch);
1446
- },
1447
- sce2s(sc, et) {
1448
- return tspiceCallSce2s(module, sc, et);
1449
- },
1450
- ckgp(inst, sclkdp, tol, ref) {
1451
- return tspiceCallCkgp(module, inst, sclkdp, tol, ref);
1452
- },
1453
- ckgpav(inst, sclkdp, tol, ref) {
1454
- return tspiceCallCkgpav(module, inst, sclkdp, tol, ref);
1455
- },
1456
- spkezr(target, et, ref, abcorr, observer) {
1457
- return tspiceCallSpkezr(module, target, et, ref, abcorr, observer);
1458
- },
1459
- spkpos(target, et, ref, abcorr, observer) {
1460
- return tspiceCallSpkpos(module, target, et, ref, abcorr, observer);
1461
- },
1462
- subpnt(method, target, et, fixref, abcorr, observer) {
1463
- return tspiceCallSubpnt(module, method, target, et, fixref, abcorr, observer);
1464
- },
1465
- subslr(method, target, et, fixref, abcorr, observer) {
1466
- return tspiceCallSubslr(module, method, target, et, fixref, abcorr, observer);
1467
- },
1468
- sincpt(method, target, et, fixref, abcorr, observer, dref, dvec) {
1469
- return tspiceCallSincpt(module, method, target, et, fixref, abcorr, observer, dref, dvec);
1470
- },
1471
- ilumin(method, target, et, fixref, abcorr, observer, spoint) {
1472
- return tspiceCallIlumin(module, method, target, et, fixref, abcorr, observer, spoint);
1473
- },
1474
- occult(targ1, shape1, frame1, targ2, shape2, frame2, abcorr, observer, et) {
1475
- return tspiceCallOccult(module, targ1, shape1, frame1, targ2, shape2, frame2, abcorr, observer, et);
1476
- },
1477
- pxform(from, to, et) {
1478
- return tspiceCallPxform(module, from, to, et);
1479
- },
1480
- sxform(from, to, et) {
1481
- return tspiceCallSxform(module, from, to, et);
1482
- },
1483
- reclat: (rect) => tspiceCallReclat(module, rect),
1484
- latrec: (radius, lon, lat) => tspiceCallLatrec(module, radius, lon, lat),
1485
- recsph: (rect) => tspiceCallRecsph(module, rect),
1486
- sphrec: (radius, colat, lon) => tspiceCallSphrec(module, radius, colat, lon),
1487
- vnorm: (v) => tspiceCallVnorm(module, v),
1488
- vhat: (v) => tspiceCallVhat(module, v),
1489
- vdot: (a, b) => tspiceCallVdot(module, a, b),
1490
- vcrss: (a, b) => tspiceCallVcrss(module, a, b),
1491
- mxv: (m, v) => tspiceCallMxv(module, m, v),
1492
- mtxv: (m, v) => tspiceCallMtxv(module, m, v),
1493
- // WASM-only
1494
- writeFile,
1495
- loadKernel(path, data) {
1496
- const resolvedPath = path.startsWith("/") ? path : `/kernels/${path}`;
1497
- writeFile(resolvedPath, data);
1498
- tspiceCall1Path(module, module._tspice_furnsh, resolvedPath);
1499
- },
1500
- };
1501
- // Internal testing hook (not part of the public backend contract).
1502
- backend.__ktotalAll = () => backend.ktotal("ALL");
1503
- return backend;
1504
- }
1
+ export { WASM_BINARY_FILENAME, WASM_JS_FILENAME, createWasmBackend, } from "./runtime/create-backend.js";
1505
2
  //# sourceMappingURL=index.js.map