minijinja-js 2.8.0

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,905 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let WASM_VECTOR_LEN = 0;
10
+
11
+ let cachedUint8ArrayMemory0 = null;
12
+
13
+ function getUint8ArrayMemory0() {
14
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
16
+ }
17
+ return cachedUint8ArrayMemory0;
18
+ }
19
+
20
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
21
+
22
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
+ ? function (arg, view) {
24
+ return cachedTextEncoder.encodeInto(arg, view);
25
+ }
26
+ : function (arg, view) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ view.set(buf);
29
+ return {
30
+ read: arg.length,
31
+ written: buf.length
32
+ };
33
+ });
34
+
35
+ function passStringToWasm0(arg, malloc, realloc) {
36
+
37
+ if (realloc === undefined) {
38
+ const buf = cachedTextEncoder.encode(arg);
39
+ const ptr = malloc(buf.length, 1) >>> 0;
40
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
41
+ WASM_VECTOR_LEN = buf.length;
42
+ return ptr;
43
+ }
44
+
45
+ let len = arg.length;
46
+ let ptr = malloc(len, 1) >>> 0;
47
+
48
+ const mem = getUint8ArrayMemory0();
49
+
50
+ let offset = 0;
51
+
52
+ for (; offset < len; offset++) {
53
+ const code = arg.charCodeAt(offset);
54
+ if (code > 0x7F) break;
55
+ mem[ptr + offset] = code;
56
+ }
57
+
58
+ if (offset !== len) {
59
+ if (offset !== 0) {
60
+ arg = arg.slice(offset);
61
+ }
62
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
64
+ const ret = encodeString(arg, view);
65
+
66
+ offset += ret.written;
67
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
68
+ }
69
+
70
+ WASM_VECTOR_LEN = offset;
71
+ return ptr;
72
+ }
73
+
74
+ let cachedDataViewMemory0 = null;
75
+
76
+ function getDataViewMemory0() {
77
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
+ }
80
+ return cachedDataViewMemory0;
81
+ }
82
+
83
+ let heap_next = heap.length;
84
+
85
+ function addHeapObject(obj) {
86
+ if (heap_next === heap.length) heap.push(heap.length + 1);
87
+ const idx = heap_next;
88
+ heap_next = heap[idx];
89
+
90
+ heap[idx] = obj;
91
+ return idx;
92
+ }
93
+
94
+ function handleError(f, args) {
95
+ try {
96
+ return f.apply(this, args);
97
+ } catch (e) {
98
+ wasm.__wbindgen_export_2(addHeapObject(e));
99
+ }
100
+ }
101
+
102
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
103
+
104
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
105
+
106
+ function getStringFromWasm0(ptr, len) {
107
+ ptr = ptr >>> 0;
108
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
109
+ }
110
+
111
+ function dropObject(idx) {
112
+ if (idx < 132) return;
113
+ heap[idx] = heap_next;
114
+ heap_next = idx;
115
+ }
116
+
117
+ function takeObject(idx) {
118
+ const ret = getObject(idx);
119
+ dropObject(idx);
120
+ return ret;
121
+ }
122
+
123
+ function isLikeNone(x) {
124
+ return x === undefined || x === null;
125
+ }
126
+
127
+ function debugString(val) {
128
+ // primitive types
129
+ const type = typeof val;
130
+ if (type == 'number' || type == 'boolean' || val == null) {
131
+ return `${val}`;
132
+ }
133
+ if (type == 'string') {
134
+ return `"${val}"`;
135
+ }
136
+ if (type == 'symbol') {
137
+ const description = val.description;
138
+ if (description == null) {
139
+ return 'Symbol';
140
+ } else {
141
+ return `Symbol(${description})`;
142
+ }
143
+ }
144
+ if (type == 'function') {
145
+ const name = val.name;
146
+ if (typeof name == 'string' && name.length > 0) {
147
+ return `Function(${name})`;
148
+ } else {
149
+ return 'Function';
150
+ }
151
+ }
152
+ // objects
153
+ if (Array.isArray(val)) {
154
+ const length = val.length;
155
+ let debug = '[';
156
+ if (length > 0) {
157
+ debug += debugString(val[0]);
158
+ }
159
+ for(let i = 1; i < length; i++) {
160
+ debug += ', ' + debugString(val[i]);
161
+ }
162
+ debug += ']';
163
+ return debug;
164
+ }
165
+ // Test for built-in
166
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
167
+ let className;
168
+ if (builtInMatches && builtInMatches.length > 1) {
169
+ className = builtInMatches[1];
170
+ } else {
171
+ // Failed to match the standard '[object ClassName]'
172
+ return toString.call(val);
173
+ }
174
+ if (className == 'Object') {
175
+ // we're a user defined class or Object
176
+ // JSON.stringify avoids problems with cycles, and is generally much
177
+ // easier than looping through ownProperties of `val`.
178
+ try {
179
+ return 'Object(' + JSON.stringify(val) + ')';
180
+ } catch (_) {
181
+ return 'Object';
182
+ }
183
+ }
184
+ // errors
185
+ if (val instanceof Error) {
186
+ return `${val.name}: ${val.message}\n${val.stack}`;
187
+ }
188
+ // TODO we could test for more things here, like `Set`s and `Map`s.
189
+ return className;
190
+ }
191
+
192
+ const __wbindgen_enum_UndefinedBehavior = ["strict", "chainable", "lenient", "semi_strct"];
193
+
194
+ const EnvironmentFinalization = (typeof FinalizationRegistry === 'undefined')
195
+ ? { register: () => {}, unregister: () => {} }
196
+ : new FinalizationRegistry(ptr => wasm.__wbg_environment_free(ptr >>> 0, 1));
197
+ /**
198
+ * Represents a MiniJinja environment.
199
+ */
200
+ export class Environment {
201
+
202
+ __destroy_into_raw() {
203
+ const ptr = this.__wbg_ptr;
204
+ this.__wbg_ptr = 0;
205
+ EnvironmentFinalization.unregister(this);
206
+ return ptr;
207
+ }
208
+
209
+ free() {
210
+ const ptr = this.__destroy_into_raw();
211
+ wasm.__wbg_environment_free(ptr, 0);
212
+ }
213
+ constructor() {
214
+ const ret = wasm.environment_new();
215
+ this.__wbg_ptr = ret >>> 0;
216
+ EnvironmentFinalization.register(this, this.__wbg_ptr, this);
217
+ return this;
218
+ }
219
+ /**
220
+ * Registers a new template by name and source.
221
+ * @param {string} name
222
+ * @param {string} source
223
+ */
224
+ addTemplate(name, source) {
225
+ try {
226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
227
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
228
+ const len0 = WASM_VECTOR_LEN;
229
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
230
+ const len1 = WASM_VECTOR_LEN;
231
+ wasm.environment_addTemplate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
232
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
233
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
234
+ if (r1) {
235
+ throw takeObject(r0);
236
+ }
237
+ } finally {
238
+ wasm.__wbindgen_add_to_stack_pointer(16);
239
+ }
240
+ }
241
+ /**
242
+ * Removes a template by name.
243
+ * @param {string} name
244
+ */
245
+ removeTemplate(name) {
246
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
247
+ const len0 = WASM_VECTOR_LEN;
248
+ wasm.environment_removeTemplate(this.__wbg_ptr, ptr0, len0);
249
+ }
250
+ /**
251
+ * Clears all templates from the environment.
252
+ */
253
+ clearTemplates() {
254
+ wasm.environment_clearTemplates(this.__wbg_ptr);
255
+ }
256
+ /**
257
+ * Renders a registered template by name with the given context.
258
+ * @param {string} name
259
+ * @param {any} ctx
260
+ * @returns {string}
261
+ */
262
+ renderTemplate(name, ctx) {
263
+ let deferred3_0;
264
+ let deferred3_1;
265
+ try {
266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
268
+ const len0 = WASM_VECTOR_LEN;
269
+ wasm.environment_renderTemplate(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
270
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
271
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
272
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
273
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
274
+ var ptr2 = r0;
275
+ var len2 = r1;
276
+ if (r3) {
277
+ ptr2 = 0; len2 = 0;
278
+ throw takeObject(r2);
279
+ }
280
+ deferred3_0 = ptr2;
281
+ deferred3_1 = len2;
282
+ return getStringFromWasm0(ptr2, len2);
283
+ } finally {
284
+ wasm.__wbindgen_add_to_stack_pointer(16);
285
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
286
+ }
287
+ }
288
+ /**
289
+ * Renders a string template with the given context.
290
+ *
291
+ * This is useful for one-off template rendering without registering the template. The
292
+ * template is parsed and rendered immediately.
293
+ * @param {string} source
294
+ * @param {any} ctx
295
+ * @returns {string}
296
+ */
297
+ renderStr(source, ctx) {
298
+ let deferred3_0;
299
+ let deferred3_1;
300
+ try {
301
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
302
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
303
+ const len0 = WASM_VECTOR_LEN;
304
+ wasm.environment_renderStr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
305
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
306
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
307
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
308
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
309
+ var ptr2 = r0;
310
+ var len2 = r1;
311
+ if (r3) {
312
+ ptr2 = 0; len2 = 0;
313
+ throw takeObject(r2);
314
+ }
315
+ deferred3_0 = ptr2;
316
+ deferred3_1 = len2;
317
+ return getStringFromWasm0(ptr2, len2);
318
+ } finally {
319
+ wasm.__wbindgen_add_to_stack_pointer(16);
320
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
321
+ }
322
+ }
323
+ /**
324
+ * Like `renderStr` but with a named template for auto escape detection.
325
+ * @param {string} name
326
+ * @param {string} source
327
+ * @param {any} ctx
328
+ * @returns {string}
329
+ */
330
+ renderNamedStr(name, source, ctx) {
331
+ let deferred4_0;
332
+ let deferred4_1;
333
+ try {
334
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
336
+ const len0 = WASM_VECTOR_LEN;
337
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
338
+ const len1 = WASM_VECTOR_LEN;
339
+ wasm.environment_renderNamedStr(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(ctx));
340
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
341
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
342
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
343
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
344
+ var ptr3 = r0;
345
+ var len3 = r1;
346
+ if (r3) {
347
+ ptr3 = 0; len3 = 0;
348
+ throw takeObject(r2);
349
+ }
350
+ deferred4_0 = ptr3;
351
+ deferred4_1 = len3;
352
+ return getStringFromWasm0(ptr3, len3);
353
+ } finally {
354
+ wasm.__wbindgen_add_to_stack_pointer(16);
355
+ wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
356
+ }
357
+ }
358
+ /**
359
+ * Evaluates an expression with the given context.
360
+ *
361
+ * This is useful for evaluating expressions outside of templates. The expression is
362
+ * parsed and evaluated immediately.
363
+ * @param {string} expr
364
+ * @param {any} ctx
365
+ * @returns {any}
366
+ */
367
+ evalExpr(expr, ctx) {
368
+ try {
369
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
+ const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
371
+ const len0 = WASM_VECTOR_LEN;
372
+ wasm.environment_evalExpr(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(ctx));
373
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
374
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
375
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
376
+ if (r2) {
377
+ throw takeObject(r1);
378
+ }
379
+ return takeObject(r0);
380
+ } finally {
381
+ wasm.__wbindgen_add_to_stack_pointer(16);
382
+ }
383
+ }
384
+ /**
385
+ * Registers a filter function.
386
+ * @param {string} name
387
+ * @param {Function} func
388
+ */
389
+ addFilter(name, func) {
390
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
391
+ const len0 = WASM_VECTOR_LEN;
392
+ wasm.environment_addFilter(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
393
+ }
394
+ /**
395
+ * Registers a test function.
396
+ * @param {string} name
397
+ * @param {Function} func
398
+ */
399
+ addTest(name, func) {
400
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
401
+ const len0 = WASM_VECTOR_LEN;
402
+ wasm.environment_addTest(this.__wbg_ptr, ptr0, len0, addHeapObject(func));
403
+ }
404
+ /**
405
+ * Enables python compatibility.
406
+ */
407
+ enablePyCompat() {
408
+ wasm.environment_enablePyCompat(this.__wbg_ptr);
409
+ }
410
+ /**
411
+ * Enables or disables debug mode.
412
+ * @returns {boolean}
413
+ */
414
+ get debug() {
415
+ const ret = wasm.environment_debug(this.__wbg_ptr);
416
+ return ret !== 0;
417
+ }
418
+ /**
419
+ * @param {boolean} yes
420
+ */
421
+ set debug(yes) {
422
+ wasm.environment_set_debug(this.__wbg_ptr, yes);
423
+ }
424
+ /**
425
+ * Enables or disables block trimming.
426
+ * @returns {boolean}
427
+ */
428
+ get trimBlocks() {
429
+ const ret = wasm.environment_trimBlocks(this.__wbg_ptr);
430
+ return ret !== 0;
431
+ }
432
+ /**
433
+ * @param {boolean} yes
434
+ */
435
+ set trimBlocks(yes) {
436
+ wasm.environment_set_trimBlocks(this.__wbg_ptr, yes);
437
+ }
438
+ /**
439
+ * Enables or disables the lstrip blocks feature.
440
+ * @returns {boolean}
441
+ */
442
+ get lstripBlocks() {
443
+ const ret = wasm.environment_lstripBlocks(this.__wbg_ptr);
444
+ return ret !== 0;
445
+ }
446
+ /**
447
+ * @param {boolean} yes
448
+ */
449
+ set lstripBlocks(yes) {
450
+ wasm.environment_set_lstripBlocks(this.__wbg_ptr, yes);
451
+ }
452
+ /**
453
+ * Enables or disables keeping of the final newline.
454
+ * @returns {boolean}
455
+ */
456
+ get keepTrailingNewline() {
457
+ const ret = wasm.environment_keepTrailingNewline(this.__wbg_ptr);
458
+ return ret !== 0;
459
+ }
460
+ /**
461
+ * @param {boolean} yes
462
+ */
463
+ set keepTrailingNewline(yes) {
464
+ wasm.environment_set_keepTrailingNewline(this.__wbg_ptr, yes);
465
+ }
466
+ /**
467
+ * Reconfigures the behavior of undefined variables.
468
+ * @returns {UndefinedBehavior}
469
+ */
470
+ get undefinedBehavior() {
471
+ const ret = wasm.environment_undefinedBehavior(this.__wbg_ptr);
472
+ return __wbindgen_enum_UndefinedBehavior[ret];
473
+ }
474
+ /**
475
+ * @param {UndefinedBehavior} value
476
+ */
477
+ set undefinedBehavior(value) {
478
+ try {
479
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
480
+ wasm.environment_set_undefinedBehavior(retptr, this.__wbg_ptr, (__wbindgen_enum_UndefinedBehavior.indexOf(value) + 1 || 5) - 1);
481
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
482
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
483
+ if (r1) {
484
+ throw takeObject(r0);
485
+ }
486
+ } finally {
487
+ wasm.__wbindgen_add_to_stack_pointer(16);
488
+ }
489
+ }
490
+ /**
491
+ * Configures the max-fuel for template evaluation.
492
+ * @returns {number | undefined}
493
+ */
494
+ get fuel() {
495
+ const ret = wasm.environment_fuel(this.__wbg_ptr);
496
+ return ret === 0x100000001 ? undefined : ret;
497
+ }
498
+ /**
499
+ * @param {number | null} [value]
500
+ */
501
+ set fuel(value) {
502
+ wasm.environment_set_fuel(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
503
+ }
504
+ /**
505
+ * Registers a value as global.
506
+ * @param {string} name
507
+ * @param {any} value
508
+ */
509
+ addGlobal(name, value) {
510
+ try {
511
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
512
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
513
+ const len0 = WASM_VECTOR_LEN;
514
+ wasm.environment_addGlobal(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
515
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
516
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
517
+ if (r1) {
518
+ throw takeObject(r0);
519
+ }
520
+ } finally {
521
+ wasm.__wbindgen_add_to_stack_pointer(16);
522
+ }
523
+ }
524
+ /**
525
+ * Removes a global again.
526
+ * @param {string} name
527
+ */
528
+ removeGlobal(name) {
529
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
530
+ const len0 = WASM_VECTOR_LEN;
531
+ wasm.environment_removeGlobal(this.__wbg_ptr, ptr0, len0);
532
+ }
533
+ }
534
+
535
+ async function __wbg_load(module, imports) {
536
+ if (typeof Response === 'function' && module instanceof Response) {
537
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
538
+ try {
539
+ return await WebAssembly.instantiateStreaming(module, imports);
540
+
541
+ } catch (e) {
542
+ if (module.headers.get('Content-Type') != 'application/wasm') {
543
+ 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);
544
+
545
+ } else {
546
+ throw e;
547
+ }
548
+ }
549
+ }
550
+
551
+ const bytes = await module.arrayBuffer();
552
+ return await WebAssembly.instantiate(bytes, imports);
553
+
554
+ } else {
555
+ const instance = await WebAssembly.instantiate(module, imports);
556
+
557
+ if (instance instanceof WebAssembly.Instance) {
558
+ return { instance, module };
559
+
560
+ } else {
561
+ return instance;
562
+ }
563
+ }
564
+ }
565
+
566
+ function __wbg_get_imports() {
567
+ const imports = {};
568
+ imports.wbg = {};
569
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
570
+ const ret = String(getObject(arg1));
571
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
572
+ const len1 = WASM_VECTOR_LEN;
573
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
574
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
575
+ };
576
+ imports.wbg.__wbg_apply_36be6a55257c99bf = function() { return handleError(function (arg0, arg1, arg2) {
577
+ const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
578
+ return addHeapObject(ret);
579
+ }, arguments) };
580
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
581
+ const ret = getObject(arg0).buffer;
582
+ return addHeapObject(ret);
583
+ };
584
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
585
+ const ret = getObject(arg0).call(getObject(arg1));
586
+ return addHeapObject(ret);
587
+ }, arguments) };
588
+ imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
589
+ const ret = getObject(arg0).done;
590
+ return ret;
591
+ };
592
+ imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
593
+ const ret = Object.entries(getObject(arg0));
594
+ return addHeapObject(ret);
595
+ };
596
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
597
+ let deferred0_0;
598
+ let deferred0_1;
599
+ try {
600
+ deferred0_0 = arg0;
601
+ deferred0_1 = arg1;
602
+ console.error(getStringFromWasm0(arg0, arg1));
603
+ } finally {
604
+ wasm.__wbindgen_export_3(deferred0_0, deferred0_1, 1);
605
+ }
606
+ };
607
+ imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
608
+ const ret = Array.from(getObject(arg0));
609
+ return addHeapObject(ret);
610
+ };
611
+ imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
612
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
613
+ return addHeapObject(ret);
614
+ }, arguments) };
615
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
616
+ const ret = getObject(arg0)[arg1 >>> 0];
617
+ return addHeapObject(ret);
618
+ };
619
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
620
+ let result;
621
+ try {
622
+ result = getObject(arg0) instanceof ArrayBuffer;
623
+ } catch (_) {
624
+ result = false;
625
+ }
626
+ const ret = result;
627
+ return ret;
628
+ };
629
+ imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
630
+ let result;
631
+ try {
632
+ result = getObject(arg0) instanceof Map;
633
+ } catch (_) {
634
+ result = false;
635
+ }
636
+ const ret = result;
637
+ return ret;
638
+ };
639
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
640
+ let result;
641
+ try {
642
+ result = getObject(arg0) instanceof Uint8Array;
643
+ } catch (_) {
644
+ result = false;
645
+ }
646
+ const ret = result;
647
+ return ret;
648
+ };
649
+ imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
650
+ const ret = Array.isArray(getObject(arg0));
651
+ return ret;
652
+ };
653
+ imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
654
+ const ret = Number.isSafeInteger(getObject(arg0));
655
+ return ret;
656
+ };
657
+ imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
658
+ const ret = Symbol.iterator;
659
+ return addHeapObject(ret);
660
+ };
661
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
662
+ const ret = getObject(arg0).length;
663
+ return ret;
664
+ };
665
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
666
+ const ret = getObject(arg0).length;
667
+ return ret;
668
+ };
669
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
670
+ const ret = new Object();
671
+ return addHeapObject(ret);
672
+ };
673
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
674
+ const ret = new Map();
675
+ return addHeapObject(ret);
676
+ };
677
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
678
+ const ret = new Array();
679
+ return addHeapObject(ret);
680
+ };
681
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
682
+ const ret = new Error();
683
+ return addHeapObject(ret);
684
+ };
685
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
686
+ const ret = new Uint8Array(getObject(arg0));
687
+ return addHeapObject(ret);
688
+ };
689
+ imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
690
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
691
+ return addHeapObject(ret);
692
+ };
693
+ imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
694
+ const ret = getObject(arg0).next;
695
+ return addHeapObject(ret);
696
+ };
697
+ imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
698
+ const ret = getObject(arg0).next();
699
+ return addHeapObject(ret);
700
+ }, arguments) };
701
+ imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
702
+ const ret = getObject(arg0).push(getObject(arg1));
703
+ return ret;
704
+ };
705
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
706
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
707
+ };
708
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
709
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
710
+ };
711
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
712
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
713
+ };
714
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
715
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
716
+ return addHeapObject(ret);
717
+ };
718
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
719
+ const ret = getObject(arg1).stack;
720
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
721
+ const len1 = WASM_VECTOR_LEN;
722
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
723
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
724
+ };
725
+ imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
726
+ const ret = getObject(arg0).value;
727
+ return addHeapObject(ret);
728
+ };
729
+ imports.wbg.__wbindgen_bigint_from_i128 = function(arg0, arg1) {
730
+ const ret = arg0 << BigInt(64) | BigInt.asUintN(64, arg1);
731
+ return addHeapObject(ret);
732
+ };
733
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
734
+ const ret = arg0;
735
+ return addHeapObject(ret);
736
+ };
737
+ imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
738
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
739
+ return addHeapObject(ret);
740
+ };
741
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
742
+ const ret = BigInt.asUintN(64, arg0);
743
+ return addHeapObject(ret);
744
+ };
745
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
746
+ const v = getObject(arg1);
747
+ const ret = typeof(v) === 'bigint' ? v : undefined;
748
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
749
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
750
+ };
751
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
752
+ const v = getObject(arg0);
753
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
754
+ return ret;
755
+ };
756
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
757
+ const ret = debugString(getObject(arg1));
758
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
759
+ const len1 = WASM_VECTOR_LEN;
760
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
761
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
762
+ };
763
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
764
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
765
+ return addHeapObject(ret);
766
+ };
767
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
768
+ const ret = getObject(arg0) in getObject(arg1);
769
+ return ret;
770
+ };
771
+ imports.wbg.__wbindgen_is_array = function(arg0) {
772
+ const ret = Array.isArray(getObject(arg0));
773
+ return ret;
774
+ };
775
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
776
+ const ret = typeof(getObject(arg0)) === 'bigint';
777
+ return ret;
778
+ };
779
+ imports.wbg.__wbindgen_is_function = function(arg0) {
780
+ const ret = typeof(getObject(arg0)) === 'function';
781
+ return ret;
782
+ };
783
+ imports.wbg.__wbindgen_is_object = function(arg0) {
784
+ const val = getObject(arg0);
785
+ const ret = typeof(val) === 'object' && val !== null;
786
+ return ret;
787
+ };
788
+ imports.wbg.__wbindgen_is_string = function(arg0) {
789
+ const ret = typeof(getObject(arg0)) === 'string';
790
+ return ret;
791
+ };
792
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
793
+ const ret = getObject(arg0) === getObject(arg1);
794
+ return ret;
795
+ };
796
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
797
+ const ret = getObject(arg0) == getObject(arg1);
798
+ return ret;
799
+ };
800
+ imports.wbg.__wbindgen_memory = function() {
801
+ const ret = wasm.memory;
802
+ return addHeapObject(ret);
803
+ };
804
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
805
+ const obj = getObject(arg1);
806
+ const ret = typeof(obj) === 'number' ? obj : undefined;
807
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
808
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
809
+ };
810
+ imports.wbg.__wbindgen_number_new = function(arg0) {
811
+ const ret = arg0;
812
+ return addHeapObject(ret);
813
+ };
814
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
815
+ takeObject(arg0);
816
+ };
817
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
818
+ const obj = getObject(arg1);
819
+ const ret = typeof(obj) === 'string' ? obj : undefined;
820
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
821
+ var len1 = WASM_VECTOR_LEN;
822
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
823
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
824
+ };
825
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
826
+ const ret = getStringFromWasm0(arg0, arg1);
827
+ return addHeapObject(ret);
828
+ };
829
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
830
+ throw new Error(getStringFromWasm0(arg0, arg1));
831
+ };
832
+
833
+ return imports;
834
+ }
835
+
836
+ function __wbg_init_memory(imports, memory) {
837
+
838
+ }
839
+
840
+ function __wbg_finalize_init(instance, module) {
841
+ wasm = instance.exports;
842
+ __wbg_init.__wbindgen_wasm_module = module;
843
+ cachedDataViewMemory0 = null;
844
+ cachedUint8ArrayMemory0 = null;
845
+
846
+
847
+
848
+ return wasm;
849
+ }
850
+
851
+ function initSync(module) {
852
+ if (wasm !== undefined) return wasm;
853
+
854
+
855
+ if (typeof module !== 'undefined') {
856
+ if (Object.getPrototypeOf(module) === Object.prototype) {
857
+ ({module} = module)
858
+ } else {
859
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
860
+ }
861
+ }
862
+
863
+ const imports = __wbg_get_imports();
864
+
865
+ __wbg_init_memory(imports);
866
+
867
+ if (!(module instanceof WebAssembly.Module)) {
868
+ module = new WebAssembly.Module(module);
869
+ }
870
+
871
+ const instance = new WebAssembly.Instance(module, imports);
872
+
873
+ return __wbg_finalize_init(instance, module);
874
+ }
875
+
876
+ async function __wbg_init(module_or_path) {
877
+ if (wasm !== undefined) return wasm;
878
+
879
+
880
+ if (typeof module_or_path !== 'undefined') {
881
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
882
+ ({module_or_path} = module_or_path)
883
+ } else {
884
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
885
+ }
886
+ }
887
+
888
+ if (typeof module_or_path === 'undefined') {
889
+ module_or_path = new URL('minijinja_js_bg.wasm', import.meta.url);
890
+ }
891
+ const imports = __wbg_get_imports();
892
+
893
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
894
+ module_or_path = fetch(module_or_path);
895
+ }
896
+
897
+ __wbg_init_memory(imports);
898
+
899
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
900
+
901
+ return __wbg_finalize_init(instance, module);
902
+ }
903
+
904
+ export { initSync };
905
+ export default __wbg_init;