@c9up/chronos 0.1.12 → 0.1.14

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.
@@ -0,0 +1,688 @@
1
+ /* @ts-self-types="./chronos_engine_wasm.d.ts" */
2
+
3
+ /**
4
+ * @param {string} iso
5
+ * @param {bigint} amount
6
+ * @param {string} unit
7
+ * @returns {string}
8
+ */
9
+ export function add(iso, amount, unit) {
10
+ let deferred4_0;
11
+ let deferred4_1;
12
+ try {
13
+ const ptr0 = passStringToWasm0(iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14
+ const len0 = WASM_VECTOR_LEN;
15
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
16
+ const len1 = WASM_VECTOR_LEN;
17
+ const ret = wasm.add(ptr0, len0, amount, ptr1, len1);
18
+ var ptr3 = ret[0];
19
+ var len3 = ret[1];
20
+ if (ret[3]) {
21
+ ptr3 = 0; len3 = 0;
22
+ throw takeFromExternrefTable0(ret[2]);
23
+ }
24
+ deferred4_0 = ptr3;
25
+ deferred4_1 = len3;
26
+ return getStringFromWasm0(ptr3, len3);
27
+ } finally {
28
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * @param {string} utc_iso
34
+ * @param {bigint} amount
35
+ * @param {string} unit
36
+ * @param {string} zone
37
+ * @returns {string}
38
+ */
39
+ export function add_in_zone(utc_iso, amount, unit, zone) {
40
+ let deferred5_0;
41
+ let deferred5_1;
42
+ try {
43
+ const ptr0 = passStringToWasm0(utc_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
44
+ const len0 = WASM_VECTOR_LEN;
45
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
46
+ const len1 = WASM_VECTOR_LEN;
47
+ const ptr2 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
48
+ const len2 = WASM_VECTOR_LEN;
49
+ const ret = wasm.add_in_zone(ptr0, len0, amount, ptr1, len1, ptr2, len2);
50
+ var ptr4 = ret[0];
51
+ var len4 = ret[1];
52
+ if (ret[3]) {
53
+ ptr4 = 0; len4 = 0;
54
+ throw takeFromExternrefTable0(ret[2]);
55
+ }
56
+ deferred5_0 = ptr4;
57
+ deferred5_1 = len4;
58
+ return getStringFromWasm0(ptr4, len4);
59
+ } finally {
60
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * @param {string} iso
66
+ * @returns {any}
67
+ */
68
+ export function calendar_parts(iso) {
69
+ const ptr0 = passStringToWasm0(iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
70
+ const len0 = WASM_VECTOR_LEN;
71
+ const ret = wasm.calendar_parts(ptr0, len0);
72
+ if (ret[2]) {
73
+ throw takeFromExternrefTable0(ret[1]);
74
+ }
75
+ return takeFromExternrefTable0(ret[0]);
76
+ }
77
+
78
+ /**
79
+ * @param {string} a_iso
80
+ * @param {string} b_iso
81
+ * @param {string} unit
82
+ * @returns {number}
83
+ */
84
+ export function diff(a_iso, b_iso, unit) {
85
+ const ptr0 = passStringToWasm0(a_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
86
+ const len0 = WASM_VECTOR_LEN;
87
+ const ptr1 = passStringToWasm0(b_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len1 = WASM_VECTOR_LEN;
89
+ const ptr2 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
90
+ const len2 = WASM_VECTOR_LEN;
91
+ const ret = wasm.diff(ptr0, len0, ptr1, len1, ptr2, len2);
92
+ if (ret[2]) {
93
+ throw takeFromExternrefTable0(ret[1]);
94
+ }
95
+ return ret[0];
96
+ }
97
+
98
+ /**
99
+ * @param {string} a_utc
100
+ * @param {string} b_utc
101
+ * @param {string} unit
102
+ * @param {string} zone
103
+ * @returns {number}
104
+ */
105
+ export function diff_in_zone(a_utc, b_utc, unit, zone) {
106
+ const ptr0 = passStringToWasm0(a_utc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
107
+ const len0 = WASM_VECTOR_LEN;
108
+ const ptr1 = passStringToWasm0(b_utc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
109
+ const len1 = WASM_VECTOR_LEN;
110
+ const ptr2 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
111
+ const len2 = WASM_VECTOR_LEN;
112
+ const ptr3 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
113
+ const len3 = WASM_VECTOR_LEN;
114
+ const ret = wasm.diff_in_zone(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
115
+ if (ret[2]) {
116
+ throw takeFromExternrefTable0(ret[1]);
117
+ }
118
+ return ret[0];
119
+ }
120
+
121
+ /**
122
+ * @param {string} iso
123
+ * @param {string} unit
124
+ * @returns {string}
125
+ */
126
+ export function end_of(iso, unit) {
127
+ let deferred4_0;
128
+ let deferred4_1;
129
+ try {
130
+ const ptr0 = passStringToWasm0(iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
131
+ const len0 = WASM_VECTOR_LEN;
132
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
133
+ const len1 = WASM_VECTOR_LEN;
134
+ const ret = wasm.end_of(ptr0, len0, ptr1, len1);
135
+ var ptr3 = ret[0];
136
+ var len3 = ret[1];
137
+ if (ret[3]) {
138
+ ptr3 = 0; len3 = 0;
139
+ throw takeFromExternrefTable0(ret[2]);
140
+ }
141
+ deferred4_0 = ptr3;
142
+ deferred4_1 = len3;
143
+ return getStringFromWasm0(ptr3, len3);
144
+ } finally {
145
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @param {string} utc_iso
151
+ * @param {string} unit
152
+ * @param {string} zone
153
+ * @returns {string}
154
+ */
155
+ export function end_of_in_zone(utc_iso, unit, zone) {
156
+ let deferred5_0;
157
+ let deferred5_1;
158
+ try {
159
+ const ptr0 = passStringToWasm0(utc_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ const ptr2 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
164
+ const len2 = WASM_VECTOR_LEN;
165
+ const ret = wasm.end_of_in_zone(ptr0, len0, ptr1, len1, ptr2, len2);
166
+ var ptr4 = ret[0];
167
+ var len4 = ret[1];
168
+ if (ret[3]) {
169
+ ptr4 = 0; len4 = 0;
170
+ throw takeFromExternrefTable0(ret[2]);
171
+ }
172
+ deferred5_0 = ptr4;
173
+ deferred5_1 = len4;
174
+ return getStringFromWasm0(ptr4, len4);
175
+ } finally {
176
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
177
+ }
178
+ }
179
+
180
+ /**
181
+ * @param {string} iso
182
+ * @param {string} pattern
183
+ * @returns {string}
184
+ */
185
+ export function format(iso, pattern) {
186
+ let deferred4_0;
187
+ let deferred4_1;
188
+ try {
189
+ const ptr0 = passStringToWasm0(iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
190
+ const len0 = WASM_VECTOR_LEN;
191
+ const ptr1 = passStringToWasm0(pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
192
+ const len1 = WASM_VECTOR_LEN;
193
+ const ret = wasm.format(ptr0, len0, ptr1, len1);
194
+ var ptr3 = ret[0];
195
+ var len3 = ret[1];
196
+ if (ret[3]) {
197
+ ptr3 = 0; len3 = 0;
198
+ throw takeFromExternrefTable0(ret[2]);
199
+ }
200
+ deferred4_0 = ptr3;
201
+ deferred4_1 = len3;
202
+ return getStringFromWasm0(ptr3, len3);
203
+ } finally {
204
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
205
+ }
206
+ }
207
+
208
+ /**
209
+ * @param {string} naive_iso
210
+ * @param {string} zone
211
+ * @returns {string}
212
+ */
213
+ export function from_local(naive_iso, zone) {
214
+ let deferred4_0;
215
+ let deferred4_1;
216
+ try {
217
+ const ptr0 = passStringToWasm0(naive_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
218
+ const len0 = WASM_VECTOR_LEN;
219
+ const ptr1 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
220
+ const len1 = WASM_VECTOR_LEN;
221
+ const ret = wasm.from_local(ptr0, len0, ptr1, len1);
222
+ var ptr3 = ret[0];
223
+ var len3 = ret[1];
224
+ if (ret[3]) {
225
+ ptr3 = 0; len3 = 0;
226
+ throw takeFromExternrefTable0(ret[2]);
227
+ }
228
+ deferred4_0 = ptr3;
229
+ deferred4_1 = len3;
230
+ return getStringFromWasm0(ptr3, len3);
231
+ } finally {
232
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
233
+ }
234
+ }
235
+
236
+ /**
237
+ * @param {string} input
238
+ * @returns {string}
239
+ */
240
+ export function parse_http(input) {
241
+ let deferred3_0;
242
+ let deferred3_1;
243
+ try {
244
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ const ret = wasm.parse_http(ptr0, len0);
247
+ var ptr2 = ret[0];
248
+ var len2 = ret[1];
249
+ if (ret[3]) {
250
+ ptr2 = 0; len2 = 0;
251
+ throw takeFromExternrefTable0(ret[2]);
252
+ }
253
+ deferred3_0 = ptr2;
254
+ deferred3_1 = len2;
255
+ return getStringFromWasm0(ptr2, len2);
256
+ } finally {
257
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
258
+ }
259
+ }
260
+
261
+ /**
262
+ * @param {string} input
263
+ * @returns {string}
264
+ */
265
+ export function parse_rfc2822(input) {
266
+ let deferred3_0;
267
+ let deferred3_1;
268
+ try {
269
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
270
+ const len0 = WASM_VECTOR_LEN;
271
+ const ret = wasm.parse_rfc2822(ptr0, len0);
272
+ var ptr2 = ret[0];
273
+ var len2 = ret[1];
274
+ if (ret[3]) {
275
+ ptr2 = 0; len2 = 0;
276
+ throw takeFromExternrefTable0(ret[2]);
277
+ }
278
+ deferred3_0 = ptr2;
279
+ deferred3_1 = len2;
280
+ return getStringFromWasm0(ptr2, len2);
281
+ } finally {
282
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * @param {string} input
288
+ * @returns {string}
289
+ */
290
+ export function parse_sql(input) {
291
+ let deferred3_0;
292
+ let deferred3_1;
293
+ try {
294
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ const ret = wasm.parse_sql(ptr0, len0);
297
+ var ptr2 = ret[0];
298
+ var len2 = ret[1];
299
+ if (ret[3]) {
300
+ ptr2 = 0; len2 = 0;
301
+ throw takeFromExternrefTable0(ret[2]);
302
+ }
303
+ deferred3_0 = ptr2;
304
+ deferred3_1 = len2;
305
+ return getStringFromWasm0(ptr2, len2);
306
+ } finally {
307
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
308
+ }
309
+ }
310
+
311
+ /**
312
+ * @param {string} start_iso
313
+ * @param {string} rrule
314
+ * @param {number} limit
315
+ * @returns {any}
316
+ */
317
+ export function rrule_expand(start_iso, rrule, limit) {
318
+ const ptr0 = passStringToWasm0(start_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
319
+ const len0 = WASM_VECTOR_LEN;
320
+ const ptr1 = passStringToWasm0(rrule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
+ const len1 = WASM_VECTOR_LEN;
322
+ const ret = wasm.rrule_expand(ptr0, len0, ptr1, len1, limit);
323
+ if (ret[2]) {
324
+ throw takeFromExternrefTable0(ret[1]);
325
+ }
326
+ return takeFromExternrefTable0(ret[0]);
327
+ }
328
+
329
+ /**
330
+ * @param {string} iso
331
+ * @param {string} unit
332
+ * @returns {string}
333
+ */
334
+ export function start_of(iso, unit) {
335
+ let deferred4_0;
336
+ let deferred4_1;
337
+ try {
338
+ const ptr0 = passStringToWasm0(iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
+ const len1 = WASM_VECTOR_LEN;
342
+ const ret = wasm.start_of(ptr0, len0, ptr1, len1);
343
+ var ptr3 = ret[0];
344
+ var len3 = ret[1];
345
+ if (ret[3]) {
346
+ ptr3 = 0; len3 = 0;
347
+ throw takeFromExternrefTable0(ret[2]);
348
+ }
349
+ deferred4_0 = ptr3;
350
+ deferred4_1 = len3;
351
+ return getStringFromWasm0(ptr3, len3);
352
+ } finally {
353
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
354
+ }
355
+ }
356
+
357
+ /**
358
+ * @param {string} utc_iso
359
+ * @param {string} unit
360
+ * @param {string} zone
361
+ * @returns {string}
362
+ */
363
+ export function start_of_in_zone(utc_iso, unit, zone) {
364
+ let deferred5_0;
365
+ let deferred5_1;
366
+ try {
367
+ const ptr0 = passStringToWasm0(utc_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ const len0 = WASM_VECTOR_LEN;
369
+ const ptr1 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
370
+ const len1 = WASM_VECTOR_LEN;
371
+ const ptr2 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
+ const len2 = WASM_VECTOR_LEN;
373
+ const ret = wasm.start_of_in_zone(ptr0, len0, ptr1, len1, ptr2, len2);
374
+ var ptr4 = ret[0];
375
+ var len4 = ret[1];
376
+ if (ret[3]) {
377
+ ptr4 = 0; len4 = 0;
378
+ throw takeFromExternrefTable0(ret[2]);
379
+ }
380
+ deferred5_0 = ptr4;
381
+ deferred5_1 = len4;
382
+ return getStringFromWasm0(ptr4, len4);
383
+ } finally {
384
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
385
+ }
386
+ }
387
+
388
+ /**
389
+ * @param {string} utc_iso
390
+ * @param {string} zone
391
+ * @returns {any}
392
+ */
393
+ export function to_zone(utc_iso, zone) {
394
+ const ptr0 = passStringToWasm0(utc_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
+ const len0 = WASM_VECTOR_LEN;
396
+ const ptr1 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
397
+ const len1 = WASM_VECTOR_LEN;
398
+ const ret = wasm.to_zone(ptr0, len0, ptr1, len1);
399
+ if (ret[2]) {
400
+ throw takeFromExternrefTable0(ret[1]);
401
+ }
402
+ return takeFromExternrefTable0(ret[0]);
403
+ }
404
+
405
+ /**
406
+ * @param {string} zone
407
+ * @returns {string}
408
+ */
409
+ export function validate_timezone(zone) {
410
+ let deferred3_0;
411
+ let deferred3_1;
412
+ try {
413
+ const ptr0 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
414
+ const len0 = WASM_VECTOR_LEN;
415
+ const ret = wasm.validate_timezone(ptr0, len0);
416
+ var ptr2 = ret[0];
417
+ var len2 = ret[1];
418
+ if (ret[3]) {
419
+ ptr2 = 0; len2 = 0;
420
+ throw takeFromExternrefTable0(ret[2]);
421
+ }
422
+ deferred3_0 = ptr2;
423
+ deferred3_1 = len2;
424
+ return getStringFromWasm0(ptr2, len2);
425
+ } finally {
426
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
427
+ }
428
+ }
429
+
430
+ /**
431
+ * @param {string} utc_iso
432
+ * @param {string} zone
433
+ * @returns {number}
434
+ */
435
+ export function zone_offset(utc_iso, zone) {
436
+ const ptr0 = passStringToWasm0(utc_iso, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ptr1 = passStringToWasm0(zone, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
439
+ const len1 = WASM_VECTOR_LEN;
440
+ const ret = wasm.zone_offset(ptr0, len0, ptr1, len1);
441
+ if (ret[2]) {
442
+ throw takeFromExternrefTable0(ret[1]);
443
+ }
444
+ return ret[0];
445
+ }
446
+ function __wbg_get_imports() {
447
+ const import0 = {
448
+ __proto__: null,
449
+ __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
450
+ throw new Error(getStringFromWasm0(arg0, arg1));
451
+ },
452
+ __wbg_new_116be93542d39019: function() {
453
+ const ret = new Array();
454
+ return ret;
455
+ },
456
+ __wbg_new_ebe3e0f6837f0879: function() {
457
+ const ret = new Object();
458
+ return ret;
459
+ },
460
+ __wbg_push_adb0107829f02d75: function(arg0, arg1) {
461
+ const ret = arg0.push(arg1);
462
+ return ret;
463
+ },
464
+ __wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
465
+ const ret = Reflect.set(arg0, arg1, arg2);
466
+ return ret;
467
+ }, arguments); },
468
+ __wbindgen_cast_0000000000000001: function(arg0) {
469
+ // Cast intrinsic for `F64 -> Externref`.
470
+ const ret = arg0;
471
+ return ret;
472
+ },
473
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
474
+ // Cast intrinsic for `Ref(String) -> Externref`.
475
+ const ret = getStringFromWasm0(arg0, arg1);
476
+ return ret;
477
+ },
478
+ __wbindgen_init_externref_table: function() {
479
+ const table = wasm.__wbindgen_externrefs;
480
+ const offset = table.grow(4);
481
+ table.set(0, undefined);
482
+ table.set(offset + 0, undefined);
483
+ table.set(offset + 1, null);
484
+ table.set(offset + 2, true);
485
+ table.set(offset + 3, false);
486
+ },
487
+ };
488
+ return {
489
+ __proto__: null,
490
+ "./chronos_engine_wasm_bg.js": import0,
491
+ };
492
+ }
493
+
494
+ function addToExternrefTable0(obj) {
495
+ const idx = wasm.__externref_table_alloc();
496
+ wasm.__wbindgen_externrefs.set(idx, obj);
497
+ return idx;
498
+ }
499
+
500
+ function getStringFromWasm0(ptr, len) {
501
+ return decodeText(ptr >>> 0, len);
502
+ }
503
+
504
+ let cachedUint8ArrayMemory0 = null;
505
+ function getUint8ArrayMemory0() {
506
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
507
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
508
+ }
509
+ return cachedUint8ArrayMemory0;
510
+ }
511
+
512
+ function handleError(f, args) {
513
+ try {
514
+ return f.apply(this, args);
515
+ } catch (e) {
516
+ const idx = addToExternrefTable0(e);
517
+ wasm.__wbindgen_exn_store(idx);
518
+ }
519
+ }
520
+
521
+ function passStringToWasm0(arg, malloc, realloc) {
522
+ if (realloc === undefined) {
523
+ const buf = cachedTextEncoder.encode(arg);
524
+ const ptr = malloc(buf.length, 1) >>> 0;
525
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
526
+ WASM_VECTOR_LEN = buf.length;
527
+ return ptr;
528
+ }
529
+
530
+ let len = arg.length;
531
+ let ptr = malloc(len, 1) >>> 0;
532
+
533
+ const mem = getUint8ArrayMemory0();
534
+
535
+ let offset = 0;
536
+
537
+ for (; offset < len; offset++) {
538
+ const code = arg.charCodeAt(offset);
539
+ if (code > 0x7F) break;
540
+ mem[ptr + offset] = code;
541
+ }
542
+ if (offset !== len) {
543
+ if (offset !== 0) {
544
+ arg = arg.slice(offset);
545
+ }
546
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
547
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
548
+ const ret = cachedTextEncoder.encodeInto(arg, view);
549
+
550
+ offset += ret.written;
551
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
552
+ }
553
+
554
+ WASM_VECTOR_LEN = offset;
555
+ return ptr;
556
+ }
557
+
558
+ function takeFromExternrefTable0(idx) {
559
+ const value = wasm.__wbindgen_externrefs.get(idx);
560
+ wasm.__externref_table_dealloc(idx);
561
+ return value;
562
+ }
563
+
564
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
565
+ cachedTextDecoder.decode();
566
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
567
+ let numBytesDecoded = 0;
568
+ function decodeText(ptr, len) {
569
+ numBytesDecoded += len;
570
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
571
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
572
+ cachedTextDecoder.decode();
573
+ numBytesDecoded = len;
574
+ }
575
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
576
+ }
577
+
578
+ const cachedTextEncoder = new TextEncoder();
579
+
580
+ if (!('encodeInto' in cachedTextEncoder)) {
581
+ cachedTextEncoder.encodeInto = function (arg, view) {
582
+ const buf = cachedTextEncoder.encode(arg);
583
+ view.set(buf);
584
+ return {
585
+ read: arg.length,
586
+ written: buf.length
587
+ };
588
+ };
589
+ }
590
+
591
+ let WASM_VECTOR_LEN = 0;
592
+
593
+ let wasmModule, wasmInstance, wasm;
594
+ function __wbg_finalize_init(instance, module) {
595
+ wasmInstance = instance;
596
+ wasm = instance.exports;
597
+ wasmModule = module;
598
+ cachedUint8ArrayMemory0 = null;
599
+ wasm.__wbindgen_start();
600
+ return wasm;
601
+ }
602
+
603
+ async function __wbg_load(module, imports) {
604
+ if (typeof Response === 'function' && module instanceof Response) {
605
+ if (!module.ok) {
606
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
607
+ }
608
+
609
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
610
+ try {
611
+ return await WebAssembly.instantiateStreaming(module, imports);
612
+ } catch (e) {
613
+ const validResponse = expectedResponseType(module.type);
614
+
615
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
616
+ 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);
617
+
618
+ } else { throw e; }
619
+ }
620
+ }
621
+
622
+ const bytes = await module.arrayBuffer();
623
+ return await WebAssembly.instantiate(bytes, imports);
624
+ } else {
625
+ const instance = await WebAssembly.instantiate(module, imports);
626
+
627
+ if (instance instanceof WebAssembly.Instance) {
628
+ return { instance, module };
629
+ } else {
630
+ return instance;
631
+ }
632
+ }
633
+
634
+ function expectedResponseType(type) {
635
+ switch (type) {
636
+ case 'basic': case 'cors': case 'default': return true;
637
+ }
638
+ return false;
639
+ }
640
+ }
641
+
642
+ function initSync(module) {
643
+ if (wasm !== undefined) return wasm;
644
+
645
+
646
+ if (module !== undefined) {
647
+ if (Object.getPrototypeOf(module) === Object.prototype) {
648
+ ({module} = module)
649
+ } else {
650
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
651
+ }
652
+ }
653
+
654
+ const imports = __wbg_get_imports();
655
+ if (!(module instanceof WebAssembly.Module)) {
656
+ module = new WebAssembly.Module(module);
657
+ }
658
+ const instance = new WebAssembly.Instance(module, imports);
659
+ return __wbg_finalize_init(instance, module);
660
+ }
661
+
662
+ async function __wbg_init(module_or_path) {
663
+ if (wasm !== undefined) return wasm;
664
+
665
+
666
+ if (module_or_path !== undefined) {
667
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
668
+ ({module_or_path} = module_or_path)
669
+ } else {
670
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
671
+ }
672
+ }
673
+
674
+ if (module_or_path === undefined) {
675
+ module_or_path = new URL('chronos_engine_wasm_bg.wasm', import.meta.url);
676
+ }
677
+ const imports = __wbg_get_imports();
678
+
679
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
680
+ module_or_path = fetch(module_or_path);
681
+ }
682
+
683
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
684
+
685
+ return __wbg_finalize_init(instance, module);
686
+ }
687
+
688
+ export { initSync, __wbg_init as default };
Binary file