math-core 0.2.2 → 0.4.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.
@@ -6,28 +6,33 @@ interface MathCoreOptions {
6
6
  macros?: Map<string, string>;
7
7
  xmlNamespace?: boolean;
8
8
  throwOnError?: boolean;
9
+ ignoreUnknownCommands?: boolean;
10
+ annotation?: boolean;
9
11
  }
10
12
 
11
13
 
14
+
12
15
  export class ConfigParseError {
13
- private constructor();
14
- free(): void;
15
- [Symbol.dispose](): void;
16
- readonly message: string;
16
+ private constructor();
17
+ free(): void;
18
+ [Symbol.dispose](): void;
19
+ readonly message: string;
17
20
  }
21
+
18
22
  export class LatexError {
19
- private constructor();
20
- free(): void;
21
- [Symbol.dispose](): void;
22
- readonly context: string | undefined;
23
- readonly message: string;
24
- location: number;
23
+ private constructor();
24
+ free(): void;
25
+ [Symbol.dispose](): void;
26
+ location: number;
27
+ readonly context: string | undefined;
28
+ readonly message: string;
25
29
  }
30
+
26
31
  export class LatexToMathML {
27
- free(): void;
28
- [Symbol.dispose](): void;
29
- reset_global_counter(): void;
30
- convert_with_local_counter(content: string, displaystyle: boolean): string;
31
- convert_with_global_counter(content: string, displaystyle: boolean): string;
32
- constructor(js_config: MathCoreOptions);
32
+ free(): void;
33
+ [Symbol.dispose](): void;
34
+ convert_with_global_counter(content: string, displaystyle: boolean): string;
35
+ convert_with_local_counter(content: string, displaystyle: boolean): string;
36
+ constructor(js_config: MathCoreOptions);
37
+ reset_global_counter(): void;
33
38
  }
package/dist/math_core.js CHANGED
@@ -1,17 +1,353 @@
1
+ /* @ts-self-types="./math_core.d.ts" */
1
2
 
2
- let imports = {};
3
- import * as import0 from './math_core_bg.js';
4
- imports['./math_core_bg.js'] = import0;
3
+ export class ConfigParseError {
4
+ static __wrap(ptr) {
5
+ ptr = ptr >>> 0;
6
+ const obj = Object.create(ConfigParseError.prototype);
7
+ obj.__wbg_ptr = ptr;
8
+ ConfigParseErrorFinalization.register(obj, obj.__wbg_ptr, obj);
9
+ return obj;
10
+ }
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ ConfigParseErrorFinalization.unregister(this);
15
+ return ptr;
16
+ }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_configparseerror_free(ptr, 0);
20
+ }
21
+ /**
22
+ * @returns {string}
23
+ */
24
+ get message() {
25
+ const ret = wasm.configparseerror_message(this.__wbg_ptr);
26
+ return ret;
27
+ }
28
+ }
29
+ if (Symbol.dispose) ConfigParseError.prototype[Symbol.dispose] = ConfigParseError.prototype.free;
5
30
 
6
- import { readFileSync } from 'node:fs';
31
+ export class LatexError {
32
+ static __wrap(ptr) {
33
+ ptr = ptr >>> 0;
34
+ const obj = Object.create(LatexError.prototype);
35
+ obj.__wbg_ptr = ptr;
36
+ LatexErrorFinalization.register(obj, obj.__wbg_ptr, obj);
37
+ return obj;
38
+ }
39
+ __destroy_into_raw() {
40
+ const ptr = this.__wbg_ptr;
41
+ this.__wbg_ptr = 0;
42
+ LatexErrorFinalization.unregister(this);
43
+ return ptr;
44
+ }
45
+ free() {
46
+ const ptr = this.__destroy_into_raw();
47
+ wasm.__wbg_latexerror_free(ptr, 0);
48
+ }
49
+ /**
50
+ * @returns {number}
51
+ */
52
+ get location() {
53
+ const ret = wasm.__wbg_get_latexerror_location(this.__wbg_ptr);
54
+ return ret >>> 0;
55
+ }
56
+ /**
57
+ * @returns {string | undefined}
58
+ */
59
+ get context() {
60
+ const ret = wasm.latexerror_context(this.__wbg_ptr);
61
+ return ret;
62
+ }
63
+ /**
64
+ * @returns {string}
65
+ */
66
+ get message() {
67
+ const ret = wasm.latexerror_message(this.__wbg_ptr);
68
+ return ret;
69
+ }
70
+ /**
71
+ * @param {number} arg0
72
+ */
73
+ set location(arg0) {
74
+ wasm.__wbg_set_latexerror_location(this.__wbg_ptr, arg0);
75
+ }
76
+ }
77
+ if (Symbol.dispose) LatexError.prototype[Symbol.dispose] = LatexError.prototype.free;
78
+
79
+ export class LatexToMathML {
80
+ __destroy_into_raw() {
81
+ const ptr = this.__wbg_ptr;
82
+ this.__wbg_ptr = 0;
83
+ LatexToMathMLFinalization.unregister(this);
84
+ return ptr;
85
+ }
86
+ free() {
87
+ const ptr = this.__destroy_into_raw();
88
+ wasm.__wbg_latextomathml_free(ptr, 0);
89
+ }
90
+ /**
91
+ * @param {string} content
92
+ * @param {boolean} displaystyle
93
+ * @returns {string}
94
+ */
95
+ convert_with_global_counter(content, displaystyle) {
96
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
97
+ const len0 = WASM_VECTOR_LEN;
98
+ const ret = wasm.latextomathml_convert_with_global_counter(this.__wbg_ptr, ptr0, len0, displaystyle);
99
+ if (ret[2]) {
100
+ throw takeFromExternrefTable0(ret[1]);
101
+ }
102
+ return takeFromExternrefTable0(ret[0]);
103
+ }
104
+ /**
105
+ * @param {string} content
106
+ * @param {boolean} displaystyle
107
+ * @returns {string}
108
+ */
109
+ convert_with_local_counter(content, displaystyle) {
110
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
111
+ const len0 = WASM_VECTOR_LEN;
112
+ const ret = wasm.latextomathml_convert_with_local_counter(this.__wbg_ptr, ptr0, len0, displaystyle);
113
+ if (ret[2]) {
114
+ throw takeFromExternrefTable0(ret[1]);
115
+ }
116
+ return takeFromExternrefTable0(ret[0]);
117
+ }
118
+ /**
119
+ * @param {MathCoreOptions} js_config
120
+ */
121
+ constructor(js_config) {
122
+ const ret = wasm.latextomathml_new(js_config);
123
+ if (ret[2]) {
124
+ throw takeFromExternrefTable0(ret[1]);
125
+ }
126
+ this.__wbg_ptr = ret[0] >>> 0;
127
+ LatexToMathMLFinalization.register(this, this.__wbg_ptr, this);
128
+ return this;
129
+ }
130
+ reset_global_counter() {
131
+ wasm.latextomathml_reset_global_counter(this.__wbg_ptr);
132
+ }
133
+ }
134
+ if (Symbol.dispose) LatexToMathML.prototype[Symbol.dispose] = LatexToMathML.prototype.free;
135
+
136
+ function __wbg_get_imports() {
137
+ const import0 = {
138
+ __proto__: null,
139
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
140
+ const obj = arg1;
141
+ const ret = typeof(obj) === 'string' ? obj : undefined;
142
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
143
+ var len1 = WASM_VECTOR_LEN;
144
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
145
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
146
+ },
147
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
148
+ throw new Error(getStringFromWasm0(arg0, arg1));
149
+ },
150
+ __wbg_annotation_759b78937e6192ec: function(arg0) {
151
+ const ret = arg0.annotation;
152
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
153
+ },
154
+ __wbg_configparseerror_new: function(arg0) {
155
+ const ret = ConfigParseError.__wrap(arg0);
156
+ return ret;
157
+ },
158
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
159
+ const ret = arg0.done;
160
+ return ret;
161
+ },
162
+ __wbg_entries_200a450561fa274f: function(arg0) {
163
+ const ret = arg0.entries();
164
+ return ret;
165
+ },
166
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
167
+ const ret = arg0[arg1 >>> 0];
168
+ return ret;
169
+ },
170
+ __wbg_ignoreUnknownCommands_9362806c97567214: function(arg0) {
171
+ const ret = arg0.ignoreUnknownCommands;
172
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
173
+ },
174
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
175
+ const ret = Array.isArray(arg0);
176
+ return ret;
177
+ },
178
+ __wbg_latexerror_new: function(arg0) {
179
+ const ret = LatexError.__wrap(arg0);
180
+ return ret;
181
+ },
182
+ __wbg_macros_d47e1328485f7fc7: function(arg0) {
183
+ const ret = arg0.macros;
184
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
185
+ },
186
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
187
+ const ret = arg0.next();
188
+ return ret;
189
+ }, arguments); },
190
+ __wbg_prettyPrint_c016c0e02414dbad: function(arg0, arg1) {
191
+ const ret = arg1.prettyPrint;
192
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
193
+ var len1 = WASM_VECTOR_LEN;
194
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
195
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
196
+ },
197
+ __wbg_size_0ffc76d0c4697f79: function(arg0) {
198
+ const ret = arg0.size;
199
+ return ret;
200
+ },
201
+ __wbg_throwOnError_cd9a1d97f3b2fda5: function(arg0) {
202
+ const ret = arg0.throwOnError;
203
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
204
+ },
205
+ __wbg_value_0546255b415e96c1: function(arg0) {
206
+ const ret = arg0.value;
207
+ return ret;
208
+ },
209
+ __wbg_xmlNamespace_3f10fdf981acbcbf: function(arg0) {
210
+ const ret = arg0.xmlNamespace;
211
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
212
+ },
213
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
214
+ // Cast intrinsic for `Ref(String) -> Externref`.
215
+ const ret = getStringFromWasm0(arg0, arg1);
216
+ return ret;
217
+ },
218
+ __wbindgen_init_externref_table: function() {
219
+ const table = wasm.__wbindgen_externrefs;
220
+ const offset = table.grow(4);
221
+ table.set(0, undefined);
222
+ table.set(offset + 0, undefined);
223
+ table.set(offset + 1, null);
224
+ table.set(offset + 2, true);
225
+ table.set(offset + 3, false);
226
+ },
227
+ };
228
+ return {
229
+ __proto__: null,
230
+ "./math_core_bg.js": import0,
231
+ };
232
+ }
233
+
234
+ const ConfigParseErrorFinalization = (typeof FinalizationRegistry === 'undefined')
235
+ ? { register: () => {}, unregister: () => {} }
236
+ : new FinalizationRegistry(ptr => wasm.__wbg_configparseerror_free(ptr >>> 0, 1));
237
+ const LatexErrorFinalization = (typeof FinalizationRegistry === 'undefined')
238
+ ? { register: () => {}, unregister: () => {} }
239
+ : new FinalizationRegistry(ptr => wasm.__wbg_latexerror_free(ptr >>> 0, 1));
240
+ const LatexToMathMLFinalization = (typeof FinalizationRegistry === 'undefined')
241
+ ? { register: () => {}, unregister: () => {} }
242
+ : new FinalizationRegistry(ptr => wasm.__wbg_latextomathml_free(ptr >>> 0, 1));
243
+
244
+ function addToExternrefTable0(obj) {
245
+ const idx = wasm.__externref_table_alloc();
246
+ wasm.__wbindgen_externrefs.set(idx, obj);
247
+ return idx;
248
+ }
249
+
250
+ let cachedDataViewMemory0 = null;
251
+ function getDataViewMemory0() {
252
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
253
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
254
+ }
255
+ return cachedDataViewMemory0;
256
+ }
257
+
258
+ function getStringFromWasm0(ptr, len) {
259
+ ptr = ptr >>> 0;
260
+ return decodeText(ptr, len);
261
+ }
262
+
263
+ let cachedUint8ArrayMemory0 = null;
264
+ function getUint8ArrayMemory0() {
265
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
266
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
267
+ }
268
+ return cachedUint8ArrayMemory0;
269
+ }
270
+
271
+ function handleError(f, args) {
272
+ try {
273
+ return f.apply(this, args);
274
+ } catch (e) {
275
+ const idx = addToExternrefTable0(e);
276
+ wasm.__wbindgen_exn_store(idx);
277
+ }
278
+ }
279
+
280
+ function isLikeNone(x) {
281
+ return x === undefined || x === null;
282
+ }
283
+
284
+ function passStringToWasm0(arg, malloc, realloc) {
285
+ if (realloc === undefined) {
286
+ const buf = cachedTextEncoder.encode(arg);
287
+ const ptr = malloc(buf.length, 1) >>> 0;
288
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
289
+ WASM_VECTOR_LEN = buf.length;
290
+ return ptr;
291
+ }
292
+
293
+ let len = arg.length;
294
+ let ptr = malloc(len, 1) >>> 0;
295
+
296
+ const mem = getUint8ArrayMemory0();
7
297
 
298
+ let offset = 0;
299
+
300
+ for (; offset < len; offset++) {
301
+ const code = arg.charCodeAt(offset);
302
+ if (code > 0x7F) break;
303
+ mem[ptr + offset] = code;
304
+ }
305
+ if (offset !== len) {
306
+ if (offset !== 0) {
307
+ arg = arg.slice(offset);
308
+ }
309
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
310
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
311
+ const ret = cachedTextEncoder.encodeInto(arg, view);
312
+
313
+ offset += ret.written;
314
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
315
+ }
316
+
317
+ WASM_VECTOR_LEN = offset;
318
+ return ptr;
319
+ }
320
+
321
+ function takeFromExternrefTable0(idx) {
322
+ const value = wasm.__wbindgen_externrefs.get(idx);
323
+ wasm.__externref_table_dealloc(idx);
324
+ return value;
325
+ }
326
+
327
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
328
+ cachedTextDecoder.decode();
329
+ function decodeText(ptr, len) {
330
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
331
+ }
332
+
333
+ const cachedTextEncoder = new TextEncoder();
334
+
335
+ if (!('encodeInto' in cachedTextEncoder)) {
336
+ cachedTextEncoder.encodeInto = function (arg, view) {
337
+ const buf = cachedTextEncoder.encode(arg);
338
+ view.set(buf);
339
+ return {
340
+ read: arg.length,
341
+ written: buf.length
342
+ };
343
+ };
344
+ }
345
+
346
+ let WASM_VECTOR_LEN = 0;
347
+
348
+ import { readFileSync } from 'node:fs';
8
349
  const wasmUrl = new URL('math_core_bg.wasm', import.meta.url);
9
350
  const wasmBytes = readFileSync(wasmUrl);
10
351
  const wasmModule = new WebAssembly.Module(wasmBytes);
11
- const wasm = new WebAssembly.Instance(wasmModule, imports).exports;
12
- export { wasm as __wasm };
13
-
14
- imports["./math_core_bg.js"].__wbg_set_wasm(wasm, wasmModule);
352
+ const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
15
353
  wasm.__wbindgen_start();
16
-
17
- export * from "./math_core_bg.js";
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-core",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Convert LaTeX to MathML Core",
5
5
  "homepage": "https://github.com/tmke8/math-core#readme",
6
6
  "bugs": {
@@ -1,369 +0,0 @@
1
- let wasm;
2
- let wasmModule;
3
- export function __wbg_set_wasm(exports, module) {
4
- wasm = exports;
5
- wasmModule = module;
6
- }
7
-
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 = new TextEncoder();
21
-
22
- if (!('encodeInto' in cachedTextEncoder)) {
23
- cachedTextEncoder.encodeInto = function (arg, view) {
24
- const buf = cachedTextEncoder.encode(arg);
25
- view.set(buf);
26
- return {
27
- read: arg.length,
28
- written: buf.length
29
- };
30
- }
31
- }
32
-
33
- function passStringToWasm0(arg, malloc, realloc) {
34
-
35
- if (realloc === undefined) {
36
- const buf = cachedTextEncoder.encode(arg);
37
- const ptr = malloc(buf.length, 1) >>> 0;
38
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
39
- WASM_VECTOR_LEN = buf.length;
40
- return ptr;
41
- }
42
-
43
- let len = arg.length;
44
- let ptr = malloc(len, 1) >>> 0;
45
-
46
- const mem = getUint8ArrayMemory0();
47
-
48
- let offset = 0;
49
-
50
- for (; offset < len; offset++) {
51
- const code = arg.charCodeAt(offset);
52
- if (code > 0x7F) break;
53
- mem[ptr + offset] = code;
54
- }
55
-
56
- if (offset !== len) {
57
- if (offset !== 0) {
58
- arg = arg.slice(offset);
59
- }
60
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
61
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
62
- const ret = cachedTextEncoder.encodeInto(arg, view);
63
-
64
- offset += ret.written;
65
- ptr = realloc(ptr, len, offset, 1) >>> 0;
66
- }
67
-
68
- WASM_VECTOR_LEN = offset;
69
- return ptr;
70
- }
71
-
72
- function isLikeNone(x) {
73
- return x === undefined || x === null;
74
- }
75
-
76
- let cachedDataViewMemory0 = null;
77
-
78
- function getDataViewMemory0() {
79
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
80
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
81
- }
82
- return cachedDataViewMemory0;
83
- }
84
-
85
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
86
-
87
- cachedTextDecoder.decode();
88
-
89
- function decodeText(ptr, len) {
90
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
91
- }
92
-
93
- function getStringFromWasm0(ptr, len) {
94
- ptr = ptr >>> 0;
95
- return decodeText(ptr, len);
96
- }
97
-
98
- function addToExternrefTable0(obj) {
99
- const idx = wasm.__externref_table_alloc();
100
- wasm.__wbindgen_externrefs.set(idx, obj);
101
- return idx;
102
- }
103
-
104
- function handleError(f, args) {
105
- try {
106
- return f.apply(this, args);
107
- } catch (e) {
108
- const idx = addToExternrefTable0(e);
109
- wasm.__wbindgen_exn_store(idx);
110
- }
111
- }
112
-
113
- function takeFromExternrefTable0(idx) {
114
- const value = wasm.__wbindgen_externrefs.get(idx);
115
- wasm.__externref_table_dealloc(idx);
116
- return value;
117
- }
118
-
119
- const ConfigParseErrorFinalization = (typeof FinalizationRegistry === 'undefined')
120
- ? { register: () => {}, unregister: () => {} }
121
- : new FinalizationRegistry(ptr => wasm.__wbg_configparseerror_free(ptr >>> 0, 1));
122
-
123
- export class ConfigParseError {
124
-
125
- static __wrap(ptr) {
126
- ptr = ptr >>> 0;
127
- const obj = Object.create(ConfigParseError.prototype);
128
- obj.__wbg_ptr = ptr;
129
- ConfigParseErrorFinalization.register(obj, obj.__wbg_ptr, obj);
130
- return obj;
131
- }
132
-
133
- __destroy_into_raw() {
134
- const ptr = this.__wbg_ptr;
135
- this.__wbg_ptr = 0;
136
- ConfigParseErrorFinalization.unregister(this);
137
- return ptr;
138
- }
139
-
140
- free() {
141
- const ptr = this.__destroy_into_raw();
142
- wasm.__wbg_configparseerror_free(ptr, 0);
143
- }
144
- /**
145
- * @returns {string}
146
- */
147
- get message() {
148
- const ret = wasm.configparseerror_message(this.__wbg_ptr);
149
- return ret;
150
- }
151
- }
152
- if (Symbol.dispose) ConfigParseError.prototype[Symbol.dispose] = ConfigParseError.prototype.free;
153
-
154
- const LatexErrorFinalization = (typeof FinalizationRegistry === 'undefined')
155
- ? { register: () => {}, unregister: () => {} }
156
- : new FinalizationRegistry(ptr => wasm.__wbg_latexerror_free(ptr >>> 0, 1));
157
-
158
- export class LatexError {
159
-
160
- static __wrap(ptr) {
161
- ptr = ptr >>> 0;
162
- const obj = Object.create(LatexError.prototype);
163
- obj.__wbg_ptr = ptr;
164
- LatexErrorFinalization.register(obj, obj.__wbg_ptr, obj);
165
- return obj;
166
- }
167
-
168
- __destroy_into_raw() {
169
- const ptr = this.__wbg_ptr;
170
- this.__wbg_ptr = 0;
171
- LatexErrorFinalization.unregister(this);
172
- return ptr;
173
- }
174
-
175
- free() {
176
- const ptr = this.__destroy_into_raw();
177
- wasm.__wbg_latexerror_free(ptr, 0);
178
- }
179
- /**
180
- * @returns {string | undefined}
181
- */
182
- get context() {
183
- const ret = wasm.latexerror_context(this.__wbg_ptr);
184
- return ret;
185
- }
186
- /**
187
- * @returns {string}
188
- */
189
- get message() {
190
- const ret = wasm.latexerror_message(this.__wbg_ptr);
191
- return ret;
192
- }
193
- /**
194
- * @returns {number}
195
- */
196
- get location() {
197
- const ret = wasm.__wbg_get_latexerror_location(this.__wbg_ptr);
198
- return ret >>> 0;
199
- }
200
- /**
201
- * @param {number} arg0
202
- */
203
- set location(arg0) {
204
- wasm.__wbg_set_latexerror_location(this.__wbg_ptr, arg0);
205
- }
206
- }
207
- if (Symbol.dispose) LatexError.prototype[Symbol.dispose] = LatexError.prototype.free;
208
-
209
- const LatexToMathMLFinalization = (typeof FinalizationRegistry === 'undefined')
210
- ? { register: () => {}, unregister: () => {} }
211
- : new FinalizationRegistry(ptr => wasm.__wbg_latextomathml_free(ptr >>> 0, 1));
212
-
213
- export class LatexToMathML {
214
-
215
- __destroy_into_raw() {
216
- const ptr = this.__wbg_ptr;
217
- this.__wbg_ptr = 0;
218
- LatexToMathMLFinalization.unregister(this);
219
- return ptr;
220
- }
221
-
222
- free() {
223
- const ptr = this.__destroy_into_raw();
224
- wasm.__wbg_latextomathml_free(ptr, 0);
225
- }
226
- reset_global_counter() {
227
- wasm.latextomathml_reset_global_counter(this.__wbg_ptr);
228
- }
229
- /**
230
- * @param {string} content
231
- * @param {boolean} displaystyle
232
- * @returns {string}
233
- */
234
- convert_with_local_counter(content, displaystyle) {
235
- const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
- const len0 = WASM_VECTOR_LEN;
237
- const ret = wasm.latextomathml_convert_with_local_counter(this.__wbg_ptr, ptr0, len0, displaystyle);
238
- if (ret[2]) {
239
- throw takeFromExternrefTable0(ret[1]);
240
- }
241
- return takeFromExternrefTable0(ret[0]);
242
- }
243
- /**
244
- * @param {string} content
245
- * @param {boolean} displaystyle
246
- * @returns {string}
247
- */
248
- convert_with_global_counter(content, displaystyle) {
249
- const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ret = wasm.latextomathml_convert_with_global_counter(this.__wbg_ptr, ptr0, len0, displaystyle);
252
- if (ret[2]) {
253
- throw takeFromExternrefTable0(ret[1]);
254
- }
255
- return takeFromExternrefTable0(ret[0]);
256
- }
257
- /**
258
- * @param {MathCoreOptions} js_config
259
- */
260
- constructor(js_config) {
261
- const ret = wasm.latextomathml_new(js_config);
262
- if (ret[2]) {
263
- throw takeFromExternrefTable0(ret[1]);
264
- }
265
- this.__wbg_ptr = ret[0] >>> 0;
266
- LatexToMathMLFinalization.register(this, this.__wbg_ptr, this);
267
- return this;
268
- }
269
- }
270
- if (Symbol.dispose) LatexToMathML.prototype[Symbol.dispose] = LatexToMathML.prototype.free;
271
-
272
- export function __wbg___wbindgen_string_get_e4f06c90489ad01b(arg0, arg1) {
273
- const obj = arg1;
274
- const ret = typeof(obj) === 'string' ? obj : undefined;
275
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
- var len1 = WASM_VECTOR_LEN;
277
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
278
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
279
- };
280
-
281
- export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
282
- throw new Error(getStringFromWasm0(arg0, arg1));
283
- };
284
-
285
- export function __wbg_configparseerror_new(arg0) {
286
- const ret = ConfigParseError.__wrap(arg0);
287
- return ret;
288
- };
289
-
290
- export function __wbg_done_2042aa2670fb1db1(arg0) {
291
- const ret = arg0.done;
292
- return ret;
293
- };
294
-
295
- export function __wbg_entries_eb145c4da5c811f7(arg0) {
296
- const ret = arg0.entries();
297
- return ret;
298
- };
299
-
300
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
301
- const ret = arg0[arg1 >>> 0];
302
- return ret;
303
- };
304
-
305
- export function __wbg_isArray_96e0af9891d0945d(arg0) {
306
- const ret = Array.isArray(arg0);
307
- return ret;
308
- };
309
-
310
- export function __wbg_latexerror_new(arg0) {
311
- const ret = LatexError.__wrap(arg0);
312
- return ret;
313
- };
314
-
315
- export function __wbg_macros_3380c47e0edc8e5c(arg0) {
316
- const ret = arg0.macros;
317
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
318
- };
319
-
320
- export function __wbg_next_020810e0ae8ebcb0() { return handleError(function (arg0) {
321
- const ret = arg0.next();
322
- return ret;
323
- }, arguments) };
324
-
325
- export function __wbg_prettyPrint_ec45c2f58e4177d3(arg0, arg1) {
326
- const ret = arg1.prettyPrint;
327
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
- var len1 = WASM_VECTOR_LEN;
329
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
330
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
331
- };
332
-
333
- export function __wbg_size_252e34f77ca59a74(arg0) {
334
- const ret = arg0.size;
335
- return ret;
336
- };
337
-
338
- export function __wbg_throwOnError_32ac5d7046717964(arg0) {
339
- const ret = arg0.throwOnError;
340
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
341
- };
342
-
343
- export function __wbg_value_692627309814bb8c(arg0) {
344
- const ret = arg0.value;
345
- return ret;
346
- };
347
-
348
- export function __wbg_xmlNamespace_3f74e05796c7263f(arg0) {
349
- const ret = arg0.xmlNamespace;
350
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
351
- };
352
-
353
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
354
- // Cast intrinsic for `Ref(String) -> Externref`.
355
- const ret = getStringFromWasm0(arg0, arg1);
356
- return ret;
357
- };
358
-
359
- export function __wbindgen_init_externref_table() {
360
- const table = wasm.__wbindgen_externrefs;
361
- const offset = table.grow(4);
362
- table.set(0, undefined);
363
- table.set(offset + 0, undefined);
364
- table.set(offset + 1, null);
365
- table.set(offset + 2, true);
366
- table.set(offset + 3, false);
367
- ;
368
- };
369
-