Author: Michael Davis [mcarsondavis@gmail.com]
Hash: 6ebc9b01f80293f4f48ba891989adaf309f5d3bf
Timestamp: Sun, 26 Dec 2021 16:40:12 +0000 (2 years ago)

+4819 -0 +/-5 browse
add playground in docs dir
1diff --git a/docs/index.html b/docs/index.html
2new file mode 100644
3index 0000000..6b55fbd
4--- /dev/null
5+++ b/docs/index.html
6 @@ -0,0 +1,235 @@
7+ <html>
8+ <head>
9+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10+ <meta charset="utf-8" />
11+ <title>tree-sitter git-diff</title>
12+ <link
13+ rel="stylesheet"
14+ href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.45.0/codemirror.min.css"
15+ />
16+ <link
17+ rel="stylesheet"
18+ href="https://cdnjs.cloudflare.com/ajax/libs/clusterize.js/0.18.0/clusterize.min.css"
19+ />
20+ <link
21+ rel="icon"
22+ type="image/png"
23+ href="https://tree-sitter.github.io/tree-sitter/assets/images/favicon-32x32.png"
24+ sizes="32x32"
25+ />
26+ <link
27+ rel="icon"
28+ type="image/png"
29+ href="https://tree-sitter.github.io/tree-sitter/assets/images/favicon-16x16.png"
30+ sizes="16x16"
31+ />
32+ </head>
33+
34+ <body>
35+ <div id="playground-container" style="visibility: visible">
36+ <header>
37+ <div class="header-item">
38+ <bold>git-diff</bold>
39+ </div>
40+
41+ <div class="header-item">
42+ <label for="logging-checkbox">log</label>
43+ <input id="logging-checkbox" type="checkbox" />
44+ </div>
45+
46+ <div class="header-item">
47+ <label for="query-checkbox">query</label>
48+ <input id="query-checkbox" type="checkbox" checked="checked" />
49+ </div>
50+
51+ <div class="header-item">
52+ <label for="update-time">parse time: </label>
53+ <span id="update-time">19.0 ms</span>
54+ </div>
55+
56+ <select id="language-select" style="display: none">
57+ <option value="git-diff" selected="selected">Parser</option>
58+ </select>
59+ </header>
60+
61+ <main>
62+ <div id="input-pane">
63+ <div id="code-container">
64+ <textarea id="code-input" style="display: none">
65+ diff --git a/.gitmodules b/.gitmodules
66+ index d5bd61c9e..422671b4e 100644
67+ --- a/.gitmodules
68+ +++ b/.gitmodules
69+ @@ -174,3 +174,7 @@
70+ path = helix-syntax/languages/tree-sitter-git-commit
71+ url = https://github.com/the-mikedavis/tree-sitter-git-commit.git
72+ shallow = true
73+ +[submodule "helix-syntax/languages/tree-sitter-git-diff"]
74+ + path = helix-syntax/languages/tree-sitter-git-diff
75+ + url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
76+ + shallow = true
77+ diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
78+ index 9c42005bb..7eab8fd03 100644
79+ --- a/book/src/generated/lang-support.md
80+ +++ b/book/src/generated/lang-support.md
81+ @@ -12,6 +12,7 @@
82+ | elixir | ✓ | | | `elixir-ls` |
83+ | fish | ✓ | ✓ | ✓ | |
84+ | git-commit | ✓ | | | |
85+ +| git-diff | ✓ | | | |
86+ | glsl | ✓ | | ✓ | |
87+ | go | ✓ | ✓ | ✓ | `gopls` |
88+ | html | ✓ | | | |
89+ diff --git a/helix-syntax/languages/tree-sitter-git-commit b/helix-syntax/languages/tree-sitter-git-commit
90+ index 5cd4776c8..066e395e1 160000
91+ --- a/helix-syntax/languages/tree-sitter-git-commit
92+ +++ b/helix-syntax/languages/tree-sitter-git-commit
93+ @@ -1 +1 @@
94+ -Subproject commit 5cd4776c86c82d9d6afdc8c73a47a08057aef618
95+ +Subproject commit 066e395e1107df17183cf3ae4230f1a1406cc972</textarea>
96+ </div>
97+ <div id="query-container" style="">
98+ <textarea id="query-input" style="display: none">
99+ (command) @bold
100+ (commit) @constant
101+ (mode) @mode
102+ (location) @location
103+ [(new_file) (addition)] @plus
104+ [(old_file) (deletion)] @minus</textarea>
105+ </div>
106+ </div>
107+
108+ <div id="output-container-scroll">
109+ <pre
110+ id="output-container"
111+ class="highlight"
112+ tabindex="0"
113+ style="counter-increment: clusterize-counter 0"
114+ ></pre>
115+ </div>
116+ </main>
117+ </div>
118+
119+ <script
120+ src="https://code.jquery.com/jquery-3.3.1.min.js"
121+ crossorigin="anonymous"
122+ ></script>
123+
124+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.45.0/codemirror.min.js"></script>
125+ <script src="https://cdnjs.cloudflare.com/ajax/libs/clusterize.js/0.18.0/clusterize.min.js"></script>
126+
127+ <script>
128+ LANGUAGE_BASE_URL = "";
129+ </script>
130+ <script src="tree-sitter.js"></script>
131+ <script src="playground.js"></script>
132+
133+ <style>
134+ body {
135+ margin: 0;
136+ padding: 0;
137+ }
138+
139+ #playground-container {
140+ width: 100%;
141+ height: 100%;
142+ display: flex;
143+ flex-direction: column;
144+ }
145+
146+ header {
147+ box-sizing: border-box;
148+ display: flex;
149+ padding: 20px;
150+ height: 60px;
151+ border-bottom: 1px solid #aaa;
152+ }
153+
154+ main {
155+ flex: 1;
156+ position: relative;
157+ }
158+
159+ #input-pane {
160+ position: absolute;
161+ top: 0;
162+ left: 0;
163+ bottom: 0;
164+ right: 50%;
165+ display: flex;
166+ flex-direction: column;
167+ }
168+
169+ #code-container,
170+ #query-container {
171+ flex: 1;
172+ position: relative;
173+ overflow: hidden;
174+ border-right: 1px solid #aaa;
175+ border-bottom: 1px solid #aaa;
176+ }
177+
178+ #output-container-scroll {
179+ position: absolute;
180+ top: 0;
181+ left: 50%;
182+ bottom: 0;
183+ right: 0;
184+ }
185+
186+ .header-item {
187+ margin-right: 30px;
188+ }
189+
190+ #playground-container .CodeMirror {
191+ position: absolute;
192+ top: 0;
193+ bottom: 0;
194+ left: 0;
195+ right: 0;
196+ height: 100%;
197+ }
198+
199+ #output-container-scroll {
200+ flex: 1;
201+ padding: 0;
202+ overflow: auto;
203+ }
204+
205+ #output-container {
206+ padding: 0 10px;
207+ margin: 0;
208+ }
209+
210+ #logging-checkbox {
211+ vertical-align: middle;
212+ }
213+
214+ .CodeMirror div.CodeMirror-cursor {
215+ border-left: 3px solid red;
216+ }
217+
218+ a {
219+ text-decoration: none;
220+ color: #040404;
221+ padding: 2px;
222+ }
223+
224+ a:hover {
225+ text-decoration: underline;
226+ }
227+
228+ a.highlighted {
229+ background-color: #d9d9d9;
230+ color: red;
231+ border-radius: 3px;
232+ text-decoration: underline;
233+ }
234+
235+ .query-error {
236+ text-decoration: underline red dashed;
237+ -webkit-text-decoration: underline red dashed;
238+ }
239+ </style>
240+ </body>
241+ </html>
242 diff --git a/docs/playground.js b/docs/playground.js
243new file mode 100644
244index 0000000..42b14a7
245--- /dev/null
246+++ b/docs/playground.js
247 @@ -0,0 +1,461 @@
248+ let tree;
249+
250+ (async () => {
251+ const CAPTURE_REGEX = /@\s*([\w\._-]+)/g;
252+ const COLORS_BY_INDEX = [
253+ 'blue',
254+ 'chocolate',
255+ 'darkblue',
256+ 'darkcyan',
257+ 'darkgreen',
258+ 'darkred',
259+ 'darkslategray',
260+ 'dimgray',
261+ 'green',
262+ 'indigo',
263+ 'navy',
264+ 'red',
265+ 'sienna',
266+ ];
267+
268+ const scriptURL = document.currentScript.getAttribute('src');
269+
270+ const codeInput = document.getElementById('code-input');
271+ const languageSelect = document.getElementById('language-select');
272+ const loggingCheckbox = document.getElementById('logging-checkbox');
273+ const outputContainer = document.getElementById('output-container');
274+ const outputContainerScroll = document.getElementById('output-container-scroll');
275+ const playgroundContainer = document.getElementById('playground-container');
276+ const queryCheckbox = document.getElementById('query-checkbox');
277+ const queryContainer = document.getElementById('query-container');
278+ const queryInput = document.getElementById('query-input');
279+ const updateTimeSpan = document.getElementById('update-time');
280+ const languagesByName = {};
281+
282+ loadState();
283+
284+ await TreeSitter.init();
285+
286+ const parser = new TreeSitter();
287+ const codeEditor = CodeMirror.fromTextArea(codeInput, {
288+ lineNumbers: true,
289+ showCursorWhenSelecting: true
290+ });
291+
292+ const queryEditor = CodeMirror.fromTextArea(queryInput, {
293+ lineNumbers: true,
294+ showCursorWhenSelecting: true
295+ });
296+
297+ const cluster = new Clusterize({
298+ rows: [],
299+ noDataText: null,
300+ contentElem: outputContainer,
301+ scrollElem: outputContainerScroll
302+ });
303+ const renderTreeOnCodeChange = debounce(renderTree, 50);
304+ const saveStateOnChange = debounce(saveState, 2000);
305+ const runTreeQueryOnChange = debounce(runTreeQuery, 50);
306+
307+ let languageName = languageSelect.value;
308+ let treeRows = null;
309+ let treeRowHighlightedIndex = -1;
310+ let parseCount = 0;
311+ let isRendering = 0;
312+ let query;
313+
314+ codeEditor.on('changes', handleCodeChange);
315+ codeEditor.on('viewportChange', runTreeQueryOnChange);
316+ codeEditor.on('cursorActivity', debounce(handleCursorMovement, 150));
317+ queryEditor.on('changes', debounce(handleQueryChange, 150));
318+
319+ loggingCheckbox.addEventListener('change', handleLoggingChange);
320+ queryCheckbox.addEventListener('change', handleQueryEnableChange);
321+ languageSelect.addEventListener('change', handleLanguageChange);
322+ outputContainer.addEventListener('click', handleTreeClick);
323+
324+ handleQueryEnableChange();
325+ await handleLanguageChange()
326+
327+ playgroundContainer.style.visibility = 'visible';
328+
329+ async function handleLanguageChange() {
330+ const newLanguageName = languageSelect.value;
331+ if (!languagesByName[newLanguageName]) {
332+ const url = 'https://raw.githubusercontent.com/the-mikedavis/tree-sitter-git-diff/main/tree-sitter-git_diff.wasm'
333+ languageSelect.disabled = true;
334+ try {
335+ languagesByName[newLanguageName] = await TreeSitter.Language.load(url);
336+ } catch (e) {
337+ console.error(e);
338+ languageSelect.value = languageName;
339+ return
340+ } finally {
341+ languageSelect.disabled = false;
342+ }
343+ }
344+
345+ tree = null;
346+ languageName = newLanguageName;
347+ parser.setLanguage(languagesByName[newLanguageName]);
348+ handleCodeChange();
349+ handleQueryChange();
350+ }
351+
352+ async function handleCodeChange(editor, changes) {
353+ const newText = codeEditor.getValue() + '\n';
354+ const edits = tree && changes && changes.map(treeEditForEditorChange);
355+
356+ const start = performance.now();
357+ if (edits) {
358+ for (const edit of edits) {
359+ tree.edit(edit);
360+ }
361+ }
362+ const newTree = parser.parse(newText, tree);
363+ const duration = (performance.now() - start).toFixed(1);
364+
365+ updateTimeSpan.innerText = `${duration} ms`;
366+ if (tree) tree.delete();
367+ tree = newTree;
368+ parseCount++;
369+ renderTreeOnCodeChange();
370+ runTreeQueryOnChange();
371+ saveStateOnChange();
372+ }
373+
374+ async function renderTree() {
375+ isRendering++;
376+ const cursor = tree.walk();
377+
378+ let currentRenderCount = parseCount;
379+ let row = '';
380+ let rows = [];
381+ let finishedRow = false;
382+ let visitedChildren = false;
383+ let indentLevel = 0;
384+
385+ for (let i = 0;; i++) {
386+ if (i > 0 && i % 10000 === 0) {
387+ await new Promise(r => setTimeout(r, 0));
388+ if (parseCount !== currentRenderCount) {
389+ cursor.delete();
390+ isRendering--;
391+ return;
392+ }
393+ }
394+
395+ let displayName;
396+ if (cursor.nodeIsMissing) {
397+ displayName = `MISSING ${cursor.nodeType}`
398+ } else if (cursor.nodeIsNamed) {
399+ displayName = cursor.nodeType;
400+ }
401+
402+ if (visitedChildren) {
403+ if (displayName) {
404+ finishedRow = true;
405+ }
406+
407+ if (cursor.gotoNextSibling()) {
408+ visitedChildren = false;
409+ } else if (cursor.gotoParent()) {
410+ visitedChildren = true;
411+ indentLevel--;
412+ } else {
413+ break;
414+ }
415+ } else {
416+ if (displayName) {
417+ if (finishedRow) {
418+ row += '</div>';
419+ rows.push(row);
420+ finishedRow = false;
421+ }
422+ const start = cursor.startPosition;
423+ const end = cursor.endPosition;
424+ const id = cursor.nodeId;
425+ let fieldName = cursor.currentFieldName();
426+ if (fieldName) {
427+ fieldName += ': ';
428+ } else {
429+ fieldName = '';
430+ }
431+ row = `<div>${' '.repeat(indentLevel)}${fieldName}<a class='plain' href="#" data-id=${id} data-range="${start.row},${start.column},${end.row},${end.column}">${displayName}</a> [${start.row}, ${start.column}] - [${end.row}, ${end.column}]`;
432+ finishedRow = true;
433+ }
434+
435+ if (cursor.gotoFirstChild()) {
436+ visitedChildren = false;
437+ indentLevel++;
438+ } else {
439+ visitedChildren = true;
440+ }
441+ }
442+ }
443+ if (finishedRow) {
444+ row += '</div>';
445+ rows.push(row);
446+ }
447+
448+ cursor.delete();
449+ cluster.update(rows);
450+ treeRows = rows;
451+ isRendering--;
452+ handleCursorMovement();
453+ }
454+
455+ function runTreeQuery(_, startRow, endRow) {
456+ if (endRow == null) {
457+ const viewport = codeEditor.getViewport();
458+ startRow = viewport.from;
459+ endRow = viewport.to;
460+ }
461+
462+ codeEditor.operation(() => {
463+ const marks = codeEditor.getAllMarks();
464+ marks.forEach(m => m.clear());
465+
466+ if (tree && query) {
467+ const captures = query.captures(
468+ tree.rootNode,
469+ {row: startRow, column: 0},
470+ {row: endRow, column: 0},
471+ );
472+ let lastNodeId;
473+ for (const {name, node} of captures) {
474+ if (node.id === lastNodeId) continue;
475+ lastNodeId = node.id;
476+ const {startPosition, endPosition} = node;
477+ codeEditor.markText(
478+ {line: startPosition.row, ch: startPosition.column},
479+ {line: endPosition.row, ch: endPosition.column},
480+ {
481+ inclusiveLeft: true,
482+ inclusiveRight: true,
483+ css: `color: ${colorForCaptureName(name)}`
484+ }
485+ );
486+ }
487+ }
488+ });
489+ }
490+
491+ function handleQueryChange() {
492+ if (query) {
493+ query.delete();
494+ query.deleted = true;
495+ query = null;
496+ }
497+
498+ queryEditor.operation(() => {
499+ queryEditor.getAllMarks().forEach(m => m.clear());
500+ if (!queryCheckbox.checked) return;
501+
502+ const queryText = queryEditor.getValue();
503+
504+ try {
505+ query = parser.getLanguage().query(queryText);
506+ let match;
507+
508+ let row = 0;
509+ queryEditor.eachLine((line) => {
510+ while (match = CAPTURE_REGEX.exec(line.text)) {
511+ queryEditor.markText(
512+ {line: row, ch: match.index},
513+ {line: row, ch: match.index + match[0].length},
514+ {
515+ inclusiveLeft: true,
516+ inclusiveRight: true,
517+ css: `color: ${colorForCaptureName(match[1])}`
518+ }
519+ );
520+ }
521+ row++;
522+ });
523+ } catch (error) {
524+ const startPosition = queryEditor.posFromIndex(error.index);
525+ const endPosition = {
526+ line: startPosition.line,
527+ ch: startPosition.ch + (error.length || Infinity)
528+ };
529+
530+ if (error.index === queryText.length) {
531+ if (startPosition.ch > 0) {
532+ startPosition.ch--;
533+ } else if (startPosition.row > 0) {
534+ startPosition.row--;
535+ startPosition.column = Infinity;
536+ }
537+ }
538+
539+ queryEditor.markText(
540+ startPosition,
541+ endPosition,
542+ {
543+ className: 'query-error',
544+ inclusiveLeft: true,
545+ inclusiveRight: true,
546+ attributes: {title: error.message}
547+ }
548+ );
549+ }
550+ });
551+
552+ runTreeQuery();
553+ saveQueryState();
554+ }
555+
556+ function handleCursorMovement() {
557+ if (isRendering) return;
558+
559+ const selection = codeEditor.getDoc().listSelections()[0];
560+ let start = {row: selection.anchor.line, column: selection.anchor.ch};
561+ let end = {row: selection.head.line, column: selection.head.ch};
562+ if (
563+ start.row > end.row ||
564+ (
565+ start.row === end.row &&
566+ start.column > end.column
567+ )
568+ ) {
569+ let swap = end;
570+ end = start;
571+ start = swap;
572+ }
573+ const node = tree.rootNode.namedDescendantForPosition(start, end);
574+ if (treeRows) {
575+ if (treeRowHighlightedIndex !== -1) {
576+ const row = treeRows[treeRowHighlightedIndex];
577+ if (row) treeRows[treeRowHighlightedIndex] = row.replace('highlighted', 'plain');
578+ }
579+ treeRowHighlightedIndex = treeRows.findIndex(row => row.includes(`data-id=${node.id}`));
580+ if (treeRowHighlightedIndex !== -1) {
581+ const row = treeRows[treeRowHighlightedIndex];
582+ if (row) treeRows[treeRowHighlightedIndex] = row.replace('plain', 'highlighted');
583+ }
584+ cluster.update(treeRows);
585+ const lineHeight = cluster.options.item_height;
586+ const scrollTop = outputContainerScroll.scrollTop;
587+ const containerHeight = outputContainerScroll.clientHeight;
588+ const offset = treeRowHighlightedIndex * lineHeight;
589+ if (scrollTop > offset - 20) {
590+ $(outputContainerScroll).animate({scrollTop: offset - 20}, 150);
591+ } else if (scrollTop < offset + lineHeight + 40 - containerHeight) {
592+ $(outputContainerScroll).animate({scrollTop: offset - containerHeight + 40}, 150);
593+ }
594+ }
595+ }
596+
597+ function handleTreeClick(event) {
598+ if (event.target.tagName === 'A') {
599+ event.preventDefault();
600+ const [startRow, startColumn, endRow, endColumn] = event
601+ .target
602+ .dataset
603+ .range
604+ .split(',')
605+ .map(n => parseInt(n));
606+ codeEditor.focus();
607+ codeEditor.setSelection(
608+ {line: startRow, ch: startColumn},
609+ {line: endRow, ch: endColumn}
610+ );
611+ }
612+ }
613+
614+ function handleLoggingChange() {
615+ if (loggingCheckbox.checked) {
616+ parser.setLogger((message, lexing) => {
617+ if (lexing) {
618+ console.log(" ", message)
619+ } else {
620+ console.log(message)
621+ }
622+ });
623+ } else {
624+ parser.setLogger(null);
625+ }
626+ }
627+
628+ function handleQueryEnableChange() {
629+ if (queryCheckbox.checked) {
630+ queryContainer.style.visibility = '';
631+ queryContainer.style.position = '';
632+ } else {
633+ queryContainer.style.visibility = 'hidden';
634+ queryContainer.style.position = 'absolute';
635+ }
636+ handleQueryChange();
637+ }
638+
639+ function treeEditForEditorChange(change) {
640+ const oldLineCount = change.removed.length;
641+ const newLineCount = change.text.length;
642+ const lastLineLength = change.text[newLineCount - 1].length;
643+
644+ const startPosition = {row: change.from.line, column: change.from.ch};
645+ const oldEndPosition = {row: change.to.line, column: change.to.ch};
646+ const newEndPosition = {
647+ row: startPosition.row + newLineCount - 1,
648+ column: newLineCount === 1
649+ ? startPosition.column + lastLineLength
650+ : lastLineLength
651+ };
652+
653+ const startIndex = codeEditor.indexFromPos(change.from);
654+ let newEndIndex = startIndex + newLineCount - 1;
655+ let oldEndIndex = startIndex + oldLineCount - 1;
656+ for (let i = 0; i < newLineCount; i++) newEndIndex += change.text[i].length;
657+ for (let i = 0; i < oldLineCount; i++) oldEndIndex += change.removed[i].length;
658+
659+ return {
660+ startIndex, oldEndIndex, newEndIndex,
661+ startPosition, oldEndPosition, newEndPosition
662+ };
663+ }
664+
665+ function colorForCaptureName(capture) {
666+ const id = query.captureNames.indexOf(capture);
667+ return COLORS_BY_INDEX[id % COLORS_BY_INDEX.length];
668+ }
669+
670+ function loadState() {
671+ const language = localStorage.getItem("languageDiff");
672+ const sourceCode = localStorage.getItem("sourceCodeDiff");
673+ const query = localStorage.getItem("queryDiff");
674+ const queryEnabled = localStorage.getItem("queryEnabledDiff");
675+ if (language != null && sourceCode != null && query != null) {
676+ queryInput.value = query;
677+ codeInput.value = sourceCode;
678+ languageSelect.value = language;
679+ queryCheckbox.checked = (queryEnabled === 'true');
680+ }
681+ }
682+
683+ function saveState() {
684+ localStorage.setItem("languageDiff", languageSelect.value);
685+ localStorage.setItem("sourceCodeDiff", codeEditor.getValue());
686+ saveQueryState();
687+ }
688+
689+ function saveQueryState() {
690+ localStorage.setItem("queryEnabledDiff", queryCheckbox.checked);
691+ localStorage.setItem("queryDiff", queryEditor.getValue());
692+ }
693+
694+ function debounce(func, wait, immediate) {
695+ var timeout;
696+ return function() {
697+ var context = this, args = arguments;
698+ var later = function() {
699+ timeout = null;
700+ if (!immediate) func.apply(context, args);
701+ };
702+ var callNow = immediate && !timeout;
703+ clearTimeout(timeout);
704+ timeout = setTimeout(later, wait);
705+ if (callNow) func.apply(context, args);
706+ };
707+ }
708+ })();
709 diff --git a/docs/tree-sitter.js b/docs/tree-sitter.js
710new file mode 100644
711index 0000000..2eba8e2
712--- /dev/null
713+++ b/docs/tree-sitter.js
714 @@ -0,0 +1,4123 @@
715+ var Module = typeof Module !== "undefined" ? Module : {};
716+
717+ var TreeSitter = function() {
718+ var initPromise;
719+ var document = typeof window == "object" ? {
720+ currentScript: window.document.currentScript
721+ } : null;
722+ class Parser {
723+ constructor() {
724+ this.initialize();
725+ }
726+ initialize() {
727+ throw new Error("cannot construct a Parser before calling `init()`");
728+ }
729+ static init(moduleOptions) {
730+ if (initPromise) return initPromise;
731+ Module = Object.assign({}, Module, moduleOptions);
732+ return initPromise = new Promise(resolveInitPromise => {
733+ var moduleOverrides = {};
734+ var key;
735+ for (key in Module) {
736+ if (Module.hasOwnProperty(key)) {
737+ moduleOverrides[key] = Module[key];
738+ }
739+ }
740+ var arguments_ = [];
741+ var thisProgram = "./this.program";
742+ var quit_ = function(status, toThrow) {
743+ throw toThrow;
744+ };
745+ var ENVIRONMENT_IS_WEB = typeof window === "object";
746+ var ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
747+ var ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";
748+ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
749+ if (Module["ENVIRONMENT"]) {
750+ throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");
751+ }
752+ var scriptDirectory = "";
753+ function locateFile(path) {
754+ if (Module["locateFile"]) {
755+ return Module["locateFile"](path, scriptDirectory);
756+ }
757+ return scriptDirectory + path;
758+ }
759+ var read_, readAsync, readBinary, setWindowTitle;
760+ var nodeFS;
761+ var nodePath;
762+ if (ENVIRONMENT_IS_NODE) {
763+ if (!(typeof process === "object" && typeof require === "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
764+ if (ENVIRONMENT_IS_WORKER) {
765+ scriptDirectory = require("path").dirname(scriptDirectory) + "/";
766+ } else {
767+ scriptDirectory = __dirname + "/";
768+ }
769+ read_ = function shell_read(filename, binary) {
770+ if (!nodeFS) nodeFS = require("fs");
771+ if (!nodePath) nodePath = require("path");
772+ filename = nodePath["normalize"](filename);
773+ return nodeFS["readFileSync"](filename, binary ? null : "utf8");
774+ };
775+ readBinary = function readBinary(filename) {
776+ var ret = read_(filename, true);
777+ if (!ret.buffer) {
778+ ret = new Uint8Array(ret);
779+ }
780+ assert(ret.buffer);
781+ return ret;
782+ };
783+ readAsync = function readAsync(filename, onload, onerror) {
784+ if (!nodeFS) nodeFS = require("fs");
785+ if (!nodePath) nodePath = require("path");
786+ filename = nodePath["normalize"](filename);
787+ nodeFS["readFile"](filename, function(err, data) {
788+ if (err) onerror(err); else onload(data.buffer);
789+ });
790+ };
791+ if (process["argv"].length > 1) {
792+ thisProgram = process["argv"][1].replace(/\\/g, "/");
793+ }
794+ arguments_ = process["argv"].slice(2);
795+ if (typeof module !== "undefined") {
796+ module["exports"] = Module;
797+ }
798+ quit_ = function(status, toThrow) {
799+ if (keepRuntimeAlive()) {
800+ process["exitCode"] = status;
801+ throw toThrow;
802+ }
803+ process["exit"](status);
804+ };
805+ Module["inspect"] = function() {
806+ return "[Emscripten Module object]";
807+ };
808+ } else if (ENVIRONMENT_IS_SHELL) {
809+ if (typeof process === "object" && typeof require === "function" || typeof window === "object" || typeof importScripts === "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
810+ if (typeof read != "undefined") {
811+ read_ = function shell_read(f) {
812+ return read(f);
813+ };
814+ }
815+ readBinary = function readBinary(f) {
816+ var data;
817+ if (typeof readbuffer === "function") {
818+ return new Uint8Array(readbuffer(f));
819+ }
820+ data = read(f, "binary");
821+ assert(typeof data === "object");
822+ return data;
823+ };
824+ readAsync = function readAsync(f, onload, onerror) {
825+ setTimeout(function() {
826+ onload(readBinary(f));
827+ }, 0);
828+ };
829+ if (typeof scriptArgs != "undefined") {
830+ arguments_ = scriptArgs;
831+ } else if (typeof arguments != "undefined") {
832+ arguments_ = arguments;
833+ }
834+ if (typeof quit === "function") {
835+ quit_ = function(status) {
836+ quit(status);
837+ };
838+ }
839+ if (typeof print !== "undefined") {
840+ if (typeof console === "undefined") console = {};
841+ console.log = print;
842+ console.warn = console.error = typeof printErr !== "undefined" ? printErr : print;
843+ }
844+ } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
845+ if (ENVIRONMENT_IS_WORKER) {
846+ scriptDirectory = self.location.href;
847+ } else if (typeof document !== "undefined" && document.currentScript) {
848+ scriptDirectory = document.currentScript.src;
849+ }
850+ if (scriptDirectory.indexOf("blob:") !== 0) {
851+ scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
852+ } else {
853+ scriptDirectory = "";
854+ }
855+ if (!(typeof window === "object" || typeof importScripts === "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
856+ {
857+ read_ = function(url) {
858+ var xhr = new XMLHttpRequest();
859+ xhr.open("GET", url, false);
860+ xhr.send(null);
861+ return xhr.responseText;
862+ };
863+ if (ENVIRONMENT_IS_WORKER) {
864+ readBinary = function(url) {
865+ var xhr = new XMLHttpRequest();
866+ xhr.open("GET", url, false);
867+ xhr.responseType = "arraybuffer";
868+ xhr.send(null);
869+ return new Uint8Array(xhr.response);
870+ };
871+ }
872+ readAsync = function(url, onload, onerror) {
873+ var xhr = new XMLHttpRequest();
874+ xhr.open("GET", url, true);
875+ xhr.responseType = "arraybuffer";
876+ xhr.onload = function() {
877+ if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
878+ onload(xhr.response);
879+ return;
880+ }
881+ onerror();
882+ };
883+ xhr.onerror = onerror;
884+ xhr.send(null);
885+ };
886+ }
887+ setWindowTitle = function(title) {
888+ document.title = title;
889+ };
890+ } else {
891+ throw new Error("environment detection error");
892+ }
893+ var out = Module["print"] || console.log.bind(console);
894+ var err = Module["printErr"] || console.warn.bind(console);
895+ for (key in moduleOverrides) {
896+ if (moduleOverrides.hasOwnProperty(key)) {
897+ Module[key] = moduleOverrides[key];
898+ }
899+ }
900+ moduleOverrides = null;
901+ if (Module["arguments"]) arguments_ = Module["arguments"];
902+ if (!Object.getOwnPropertyDescriptor(Module, "arguments")) {
903+ Object.defineProperty(Module, "arguments", {
904+ configurable: true,
905+ get: function() {
906+ abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
907+ }
908+ });
909+ }
910+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
911+ if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) {
912+ Object.defineProperty(Module, "thisProgram", {
913+ configurable: true,
914+ get: function() {
915+ abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
916+ }
917+ });
918+ }
919+ if (Module["quit"]) quit_ = Module["quit"];
920+ if (!Object.getOwnPropertyDescriptor(Module, "quit")) {
921+ Object.defineProperty(Module, "quit", {
922+ configurable: true,
923+ get: function() {
924+ abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
925+ }
926+ });
927+ }
928+ assert(typeof Module["memoryInitializerPrefixURL"] === "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
929+ assert(typeof Module["pthreadMainPrefixURL"] === "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
930+ assert(typeof Module["cdInitializerPrefixURL"] === "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");
931+ assert(typeof Module["filePackagePrefixURL"] === "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead");
932+ assert(typeof Module["read"] === "undefined", "Module.read option was removed (modify read_ in JS)");
933+ assert(typeof Module["readAsync"] === "undefined", "Module.readAsync option was removed (modify readAsync in JS)");
934+ assert(typeof Module["readBinary"] === "undefined", "Module.readBinary option was removed (modify readBinary in JS)");
935+ assert(typeof Module["setWindowTitle"] === "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)");
936+ assert(typeof Module["TOTAL_MEMORY"] === "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");
937+ if (!Object.getOwnPropertyDescriptor(Module, "read")) {
938+ Object.defineProperty(Module, "read", {
939+ configurable: true,
940+ get: function() {
941+ abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
942+ }
943+ });
944+ }
945+ if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) {
946+ Object.defineProperty(Module, "readAsync", {
947+ configurable: true,
948+ get: function() {
949+ abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
950+ }
951+ });
952+ }
953+ if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) {
954+ Object.defineProperty(Module, "readBinary", {
955+ configurable: true,
956+ get: function() {
957+ abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
958+ }
959+ });
960+ }
961+ if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) {
962+ Object.defineProperty(Module, "setWindowTitle", {
963+ configurable: true,
964+ get: function() {
965+ abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
966+ }
967+ });
968+ }
969+ var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js";
970+ var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js";
971+ var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js";
972+ var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js";
973+ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.");
974+ var STACK_ALIGN = 16;
975+ function getNativeTypeSize(type) {
976+ switch (type) {
977+ case "i1":
978+ case "i8":
979+ return 1;
980+
981+ case "i16":
982+ return 2;
983+
984+ case "i32":
985+ return 4;
986+
987+ case "i64":
988+ return 8;
989+
990+ case "float":
991+ return 4;
992+
993+ case "double":
994+ return 8;
995+
996+ default:
997+ {
998+ if (type[type.length - 1] === "*") {
999+ return 4;
1000+ } else if (type[0] === "i") {
1001+ var bits = Number(type.substr(1));
1002+ assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type);
1003+ return bits / 8;
1004+ } else {
1005+ return 0;
1006+ }
1007+ }
1008+ }
1009+ }
1010+ function warnOnce(text) {
1011+ if (!warnOnce.shown) warnOnce.shown = {};
1012+ if (!warnOnce.shown[text]) {
1013+ warnOnce.shown[text] = 1;
1014+ err(text);
1015+ }
1016+ }
1017+ function convertJsFunctionToWasm(func, sig) {
1018+ if (typeof WebAssembly.Function === "function") {
1019+ var typeNames = {
1020+ "i": "i32",
1021+ "j": "i64",
1022+ "f": "f32",
1023+ "d": "f64"
1024+ };
1025+ var type = {
1026+ parameters: [],
1027+ results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ]
1028+ };
1029+ for (var i = 1; i < sig.length; ++i) {
1030+ type.parameters.push(typeNames[sig[i]]);
1031+ }
1032+ return new WebAssembly.Function(type, func);
1033+ }
1034+ var typeSection = [ 1, 0, 1, 96 ];
1035+ var sigRet = sig.slice(0, 1);
1036+ var sigParam = sig.slice(1);
1037+ var typeCodes = {
1038+ "i": 127,
1039+ "j": 126,
1040+ "f": 125,
1041+ "d": 124
1042+ };
1043+ typeSection.push(sigParam.length);
1044+ for (var i = 0; i < sigParam.length; ++i) {
1045+ typeSection.push(typeCodes[sigParam[i]]);
1046+ }
1047+ if (sigRet == "v") {
1048+ typeSection.push(0);
1049+ } else {
1050+ typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]);
1051+ }
1052+ typeSection[1] = typeSection.length - 2;
1053+ var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ]));
1054+ var module = new WebAssembly.Module(bytes);
1055+ var instance = new WebAssembly.Instance(module, {
1056+ "e": {
1057+ "f": func
1058+ }
1059+ });
1060+ var wrappedFunc = instance.exports["f"];
1061+ return wrappedFunc;
1062+ }
1063+ var freeTableIndexes = [];
1064+ var functionsInTableMap;
1065+ function getEmptyTableSlot() {
1066+ if (freeTableIndexes.length) {
1067+ return freeTableIndexes.pop();
1068+ }
1069+ try {
1070+ wasmTable.grow(1);
1071+ } catch (err) {
1072+ if (!(err instanceof RangeError)) {
1073+ throw err;
1074+ }
1075+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
1076+ }
1077+ return wasmTable.length - 1;
1078+ }
1079+ function addFunctionWasm(func, sig) {
1080+ if (!functionsInTableMap) {
1081+ functionsInTableMap = new WeakMap();
1082+ for (var i = 0; i < wasmTable.length; i++) {
1083+ var item = wasmTable.get(i);
1084+ if (item) {
1085+ functionsInTableMap.set(item, i);
1086+ }
1087+ }
1088+ }
1089+ if (functionsInTableMap.has(func)) {
1090+ return functionsInTableMap.get(func);
1091+ }
1092+ var ret = getEmptyTableSlot();
1093+ try {
1094+ wasmTable.set(ret, func);
1095+ } catch (err) {
1096+ if (!(err instanceof TypeError)) {
1097+ throw err;
1098+ }
1099+ assert(typeof sig !== "undefined", "Missing signature argument to addFunction: " + func);
1100+ var wrapped = convertJsFunctionToWasm(func, sig);
1101+ wasmTable.set(ret, wrapped);
1102+ }
1103+ functionsInTableMap.set(func, ret);
1104+ return ret;
1105+ }
1106+ function removeFunction(index) {
1107+ functionsInTableMap.delete(wasmTable.get(index));
1108+ freeTableIndexes.push(index);
1109+ }
1110+ function addFunction(func, sig) {
1111+ assert(typeof func !== "undefined");
1112+ return addFunctionWasm(func, sig);
1113+ }
1114+ var tempRet0 = 0;
1115+ var setTempRet0 = function(value) {
1116+ tempRet0 = value;
1117+ };
1118+ var getTempRet0 = function() {
1119+ return tempRet0;
1120+ };
1121+ var dynamicLibraries = Module["dynamicLibraries"] || [];
1122+ var wasmBinary;
1123+ if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
1124+ if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) {
1125+ Object.defineProperty(Module, "wasmBinary", {
1126+ configurable: true,
1127+ get: function() {
1128+ abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
1129+ }
1130+ });
1131+ }
1132+ var noExitRuntime = Module["noExitRuntime"] || true;
1133+ if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) {
1134+ Object.defineProperty(Module, "noExitRuntime", {
1135+ configurable: true,
1136+ get: function() {
1137+ abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
1138+ }
1139+ });
1140+ }
1141+ if (typeof WebAssembly !== "object") {
1142+ abort("no native wasm support detected");
1143+ }
1144+ function setValue(ptr, value, type, noSafe) {
1145+ type = type || "i8";
1146+ if (type.charAt(type.length - 1) === "*") type = "i32";
1147+ if (noSafe) {
1148+ switch (type) {
1149+ case "i1":
1150+ HEAP8[ptr >> 0] = value;
1151+ break;
1152+
1153+ case "i8":
1154+ HEAP8[ptr >> 0] = value;
1155+ break;
1156+
1157+ case "i16":
1158+ HEAP16[ptr >> 1] = value;
1159+ break;
1160+
1161+ case "i32":
1162+ HEAP32[ptr >> 2] = value;
1163+ break;
1164+
1165+ case "i64":
1166+ tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
1167+ HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1];
1168+ break;
1169+
1170+ case "float":
1171+ HEAPF32[ptr >> 2] = value;
1172+ break;
1173+
1174+ case "double":
1175+ HEAPF64[ptr >> 3] = value;
1176+ break;
1177+
1178+ default:
1179+ abort("invalid type for setValue: " + type);
1180+ }
1181+ } else {
1182+ switch (type) {
1183+ case "i1":
1184+ SAFE_HEAP_STORE(ptr | 0, value | 0, 1);
1185+ break;
1186+
1187+ case "i8":
1188+ SAFE_HEAP_STORE(ptr | 0, value | 0, 1);
1189+ break;
1190+
1191+ case "i16":
1192+ SAFE_HEAP_STORE(ptr | 0, value | 0, 2);
1193+ break;
1194+
1195+ case "i32":
1196+ SAFE_HEAP_STORE(ptr | 0, value | 0, 4);
1197+ break;
1198+
1199+ case "i64":
1200+ tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
1201+ SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4);
1202+ break;
1203+
1204+ case "float":
1205+ SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4);
1206+ break;
1207+
1208+ case "double":
1209+ SAFE_HEAP_STORE_D(ptr | 0, +value, 8);
1210+ break;
1211+
1212+ default:
1213+ abort("invalid type for setValue: " + type);
1214+ }
1215+ }
1216+ }
1217+ function getValue(ptr, type, noSafe) {
1218+ type = type || "i8";
1219+ if (type.charAt(type.length - 1) === "*") type = "i32";
1220+ if (noSafe) {
1221+ switch (type) {
1222+ case "i1":
1223+ return HEAP8[ptr >> 0];
1224+
1225+ case "i8":
1226+ return HEAP8[ptr >> 0];
1227+
1228+ case "i16":
1229+ return HEAP16[ptr >> 1];
1230+
1231+ case "i32":
1232+ return HEAP32[ptr >> 2];
1233+
1234+ case "i64":
1235+ return HEAP32[ptr >> 2];
1236+
1237+ case "float":
1238+ return HEAPF32[ptr >> 2];
1239+
1240+ case "double":
1241+ return HEAPF64[ptr >> 3];
1242+
1243+ default:
1244+ abort("invalid type for getValue: " + type);
1245+ }
1246+ } else {
1247+ switch (type) {
1248+ case "i1":
1249+ return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0;
1250+
1251+ case "i8":
1252+ return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0;
1253+
1254+ case "i16":
1255+ return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0;
1256+
1257+ case "i32":
1258+ return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0;
1259+
1260+ case "i64":
1261+ return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0;
1262+
1263+ case "float":
1264+ return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0));
1265+
1266+ case "double":
1267+ return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0);
1268+
1269+ default:
1270+ abort("invalid type for getValue: " + type);
1271+ }
1272+ }
1273+ return null;
1274+ }
1275+ function getSafeHeapType(bytes, isFloat) {
1276+ switch (bytes) {
1277+ case 1:
1278+ return "i8";
1279+
1280+ case 2:
1281+ return "i16";
1282+
1283+ case 4:
1284+ return isFloat ? "float" : "i32";
1285+
1286+ case 8:
1287+ return "double";
1288+
1289+ default:
1290+ assert(0);
1291+ }
1292+ }
1293+ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) {
1294+ if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest);
1295+ if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes);
1296+ if (runtimeInitialized) {
1297+ var brk = _sbrk() >>> 0;
1298+ if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk);
1299+ assert(brk >= _emscripten_stack_get_base());
1300+ assert(brk <= HEAP8.length);
1301+ }
1302+ setValue(dest, value, getSafeHeapType(bytes, isFloat), 1);
1303+ return value;
1304+ }
1305+ function SAFE_HEAP_STORE_D(dest, value, bytes) {
1306+ return SAFE_HEAP_STORE(dest, value, bytes, true);
1307+ }
1308+ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) {
1309+ if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest);
1310+ if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes);
1311+ if (runtimeInitialized) {
1312+ var brk = _sbrk() >>> 0;
1313+ if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk);
1314+ assert(brk >= _emscripten_stack_get_base());
1315+ assert(brk <= HEAP8.length);
1316+ }
1317+ var type = getSafeHeapType(bytes, isFloat);
1318+ var ret = getValue(dest, type, 1);
1319+ if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10));
1320+ return ret;
1321+ }
1322+ function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) {
1323+ return SAFE_HEAP_LOAD(dest, bytes, unsigned, true);
1324+ }
1325+ function SAFE_FT_MASK(value, mask) {
1326+ var ret = value & mask;
1327+ if (ret !== value) {
1328+ abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type.");
1329+ }
1330+ return ret;
1331+ }
1332+ function segfault() {
1333+ abort("segmentation fault");
1334+ }
1335+ function alignfault() {
1336+ abort("alignment fault");
1337+ }
1338+ function ftfault() {
1339+ abort("Function table mask error");
1340+ }
1341+ var wasmMemory;
1342+ var ABORT = false;
1343+ var EXITSTATUS;
1344+ function assert(condition, text) {
1345+ if (!condition) {
1346+ abort("Assertion failed: " + text);
1347+ }
1348+ }
1349+ function getCFunc(ident) {
1350+ var func = Module["_" + ident];
1351+ assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
1352+ return func;
1353+ }
1354+ function ccall(ident, returnType, argTypes, args, opts) {
1355+ var toC = {
1356+ "string": function(str) {
1357+ var ret = 0;
1358+ if (str !== null && str !== undefined && str !== 0) {
1359+ var len = (str.length << 2) + 1;
1360+ ret = stackAlloc(len);
1361+ stringToUTF8(str, ret, len);
1362+ }
1363+ return ret;
1364+ },
1365+ "array": function(arr) {
1366+ var ret = stackAlloc(arr.length);
1367+ writeArrayToMemory(arr, ret);
1368+ return ret;
1369+ }
1370+ };
1371+ function convertReturnValue(ret) {
1372+ if (returnType === "string") return UTF8ToString(ret);
1373+ if (returnType === "boolean") return Boolean(ret);
1374+ return ret;
1375+ }
1376+ var func = getCFunc(ident);
1377+ var cArgs = [];
1378+ var stack = 0;
1379+ assert(returnType !== "array", 'Return type should not be "array".');
1380+ if (args) {
1381+ for (var i = 0; i < args.length; i++) {
1382+ var converter = toC[argTypes[i]];
1383+ if (converter) {
1384+ if (stack === 0) stack = stackSave();
1385+ cArgs[i] = converter(args[i]);
1386+ } else {
1387+ cArgs[i] = args[i];
1388+ }
1389+ }
1390+ }
1391+ var ret = func.apply(null, cArgs);
1392+ function onDone(ret) {
1393+ if (stack !== 0) stackRestore(stack);
1394+ return convertReturnValue(ret);
1395+ }
1396+ ret = onDone(ret);
1397+ return ret;
1398+ }
1399+ function cwrap(ident, returnType, argTypes, opts) {
1400+ return function() {
1401+ return ccall(ident, returnType, argTypes, arguments, opts);
1402+ };
1403+ }
1404+ var ALLOC_NORMAL = 0;
1405+ var ALLOC_STACK = 1;
1406+ function allocate(slab, allocator) {
1407+ var ret;
1408+ assert(typeof allocator === "number", "allocate no longer takes a type argument");
1409+ assert(typeof slab !== "number", "allocate no longer takes a number as arg0");
1410+ if (allocator == ALLOC_STACK) {
1411+ ret = stackAlloc(slab.length);
1412+ } else {
1413+ ret = _malloc(slab.length);
1414+ }
1415+ if (slab.subarray || slab.slice) {
1416+ HEAPU8.set(slab, ret);
1417+ } else {
1418+ HEAPU8.set(new Uint8Array(slab), ret);
1419+ }
1420+ return ret;
1421+ }
1422+ var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
1423+ function UTF8ArrayToString(heap, idx, maxBytesToRead) {
1424+ var endIdx = idx + maxBytesToRead;
1425+ var endPtr = idx;
1426+ while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr;
1427+ if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) {
1428+ return UTF8Decoder.decode(heap.subarray(idx, endPtr));
1429+ } else {
1430+ var str = "";
1431+ while (idx < endPtr) {
1432+ var u0 = heap[idx++];
1433+ if (!(u0 & 128)) {
1434+ str += String.fromCharCode(u0);
1435+ continue;
1436+ }
1437+ var u1 = heap[idx++] & 63;
1438+ if ((u0 & 224) == 192) {
1439+ str += String.fromCharCode((u0 & 31) << 6 | u1);
1440+ continue;
1441+ }
1442+ var u2 = heap[idx++] & 63;
1443+ if ((u0 & 240) == 224) {
1444+ u0 = (u0 & 15) << 12 | u1 << 6 | u2;
1445+ } else {
1446+ if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
1447+ u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63;
1448+ }
1449+ if (u0 < 65536) {
1450+ str += String.fromCharCode(u0);
1451+ } else {
1452+ var ch = u0 - 65536;
1453+ str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
1454+ }
1455+ }
1456+ }
1457+ return str;
1458+ }
1459+ function UTF8ToString(ptr, maxBytesToRead) {
1460+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
1461+ }
1462+ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
1463+ if (!(maxBytesToWrite > 0)) return 0;
1464+ var startIdx = outIdx;
1465+ var endIdx = outIdx + maxBytesToWrite - 1;
1466+ for (var i = 0; i < str.length; ++i) {
1467+ var u = str.charCodeAt(i);
1468+ if (u >= 55296 && u <= 57343) {
1469+ var u1 = str.charCodeAt(++i);
1470+ u = 65536 + ((u & 1023) << 10) | u1 & 1023;
1471+ }
1472+ if (u <= 127) {
1473+ if (outIdx >= endIdx) break;
1474+ heap[outIdx++] = u;
1475+ } else if (u <= 2047) {
1476+ if (outIdx + 1 >= endIdx) break;
1477+ heap[outIdx++] = 192 | u >> 6;
1478+ heap[outIdx++] = 128 | u & 63;
1479+ } else if (u <= 65535) {
1480+ if (outIdx + 2 >= endIdx) break;
1481+ heap[outIdx++] = 224 | u >> 12;
1482+ heap[outIdx++] = 128 | u >> 6 & 63;
1483+ heap[outIdx++] = 128 | u & 63;
1484+ } else {
1485+ if (outIdx + 3 >= endIdx) break;
1486+ if (u >= 2097152) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x1FFFFF).");
1487+ heap[outIdx++] = 240 | u >> 18;
1488+ heap[outIdx++] = 128 | u >> 12 & 63;
1489+ heap[outIdx++] = 128 | u >> 6 & 63;
1490+ heap[outIdx++] = 128 | u & 63;
1491+ }
1492+ }
1493+ heap[outIdx] = 0;
1494+ return outIdx - startIdx;
1495+ }
1496+ function stringToUTF8(str, outPtr, maxBytesToWrite) {
1497+ assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
1498+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
1499+ }
1500+ function lengthBytesUTF8(str) {
1501+ var len = 0;
1502+ for (var i = 0; i < str.length; ++i) {
1503+ var u = str.charCodeAt(i);
1504+ if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
1505+ if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4;
1506+ }
1507+ return len;
1508+ }
1509+ function AsciiToString(ptr) {
1510+ var str = "";
1511+ while (1) {
1512+ var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0;
1513+ if (!ch) return str;
1514+ str += String.fromCharCode(ch);
1515+ }
1516+ }
1517+ function stringToAscii(str, outPtr) {
1518+ return writeAsciiToMemory(str, outPtr, false);
1519+ }
1520+ var UTF16Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : undefined;
1521+ function UTF16ToString(ptr, maxBytesToRead) {
1522+ assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
1523+ var endPtr = ptr;
1524+ var idx = endPtr >> 1;
1525+ var maxIdx = idx + maxBytesToRead / 2;
1526+ while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx;
1527+ endPtr = idx << 1;
1528+ if (endPtr - ptr > 32 && UTF16Decoder) {
1529+ return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
1530+ } else {
1531+ var str = "";
1532+ for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
1533+ var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0;
1534+ if (codeUnit == 0) break;
1535+ str += String.fromCharCode(codeUnit);
1536+ }
1537+ return str;
1538+ }
1539+ }
1540+ function stringToUTF16(str, outPtr, maxBytesToWrite) {
1541+ assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!");
1542+ assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
1543+ if (maxBytesToWrite === undefined) {
1544+ maxBytesToWrite = 2147483647;
1545+ }
1546+ if (maxBytesToWrite < 2) return 0;
1547+ maxBytesToWrite -= 2;
1548+ var startPtr = outPtr;
1549+ var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
1550+ for (var i = 0; i < numCharsToWrite; ++i) {
1551+ var codeUnit = str.charCodeAt(i);
1552+ SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2);
1553+ outPtr += 2;
1554+ }
1555+ SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2);
1556+ return outPtr - startPtr;
1557+ }
1558+ function lengthBytesUTF16(str) {
1559+ return str.length * 2;
1560+ }
1561+ function UTF32ToString(ptr, maxBytesToRead) {
1562+ assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
1563+ var i = 0;
1564+ var str = "";
1565+ while (!(i >= maxBytesToRead / 4)) {
1566+ var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0;
1567+ if (utf32 == 0) break;
1568+ ++i;
1569+ if (utf32 >= 65536) {
1570+ var ch = utf32 - 65536;
1571+ str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
1572+ } else {
1573+ str += String.fromCharCode(utf32);
1574+ }
1575+ }
1576+ return str;
1577+ }
1578+ function stringToUTF32(str, outPtr, maxBytesToWrite) {
1579+ assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!");
1580+ assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
1581+ if (maxBytesToWrite === undefined) {
1582+ maxBytesToWrite = 2147483647;
1583+ }
1584+ if (maxBytesToWrite < 4) return 0;
1585+ var startPtr = outPtr;
1586+ var endPtr = startPtr + maxBytesToWrite - 4;
1587+ for (var i = 0; i < str.length; ++i) {
1588+ var codeUnit = str.charCodeAt(i);
1589+ if (codeUnit >= 55296 && codeUnit <= 57343) {
1590+ var trailSurrogate = str.charCodeAt(++i);
1591+ codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023;
1592+ }
1593+ SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4);
1594+ outPtr += 4;
1595+ if (outPtr + 4 > endPtr) break;
1596+ }
1597+ SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4);
1598+ return outPtr - startPtr;
1599+ }
1600+ function lengthBytesUTF32(str) {
1601+ var len = 0;
1602+ for (var i = 0; i < str.length; ++i) {
1603+ var codeUnit = str.charCodeAt(i);
1604+ if (codeUnit >= 55296 && codeUnit <= 57343) ++i;
1605+ len += 4;
1606+ }
1607+ return len;
1608+ }
1609+ function allocateUTF8(str) {
1610+ var size = lengthBytesUTF8(str) + 1;
1611+ var ret = _malloc(size);
1612+ if (ret) stringToUTF8Array(str, HEAP8, ret, size);
1613+ return ret;
1614+ }
1615+ function allocateUTF8OnStack(str) {
1616+ var size = lengthBytesUTF8(str) + 1;
1617+ var ret = stackAlloc(size);
1618+ stringToUTF8Array(str, HEAP8, ret, size);
1619+ return ret;
1620+ }
1621+ function writeStringToMemory(string, buffer, dontAddNull) {
1622+ warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");
1623+ var lastChar, end;
1624+ if (dontAddNull) {
1625+ end = buffer + lengthBytesUTF8(string);
1626+ lastChar = SAFE_HEAP_LOAD(end, 1, 0);
1627+ }
1628+ stringToUTF8(string, buffer, Infinity);
1629+ if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1);
1630+ }
1631+ function writeArrayToMemory(array, buffer) {
1632+ assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)");
1633+ HEAP8.set(array, buffer);
1634+ }
1635+ function writeAsciiToMemory(str, buffer, dontAddNull) {
1636+ for (var i = 0; i < str.length; ++i) {
1637+ assert(str.charCodeAt(i) === str.charCodeAt(i) & 255);
1638+ SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1);
1639+ }
1640+ if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1);
1641+ }
1642+ function alignUp(x, multiple) {
1643+ if (x % multiple > 0) {
1644+ x += multiple - x % multiple;
1645+ }
1646+ return x;
1647+ }
1648+ var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
1649+ function updateGlobalBufferAndViews(buf) {
1650+ buffer = buf;
1651+ Module["HEAP8"] = HEAP8 = new Int8Array(buf);
1652+ Module["HEAP16"] = HEAP16 = new Int16Array(buf);
1653+ Module["HEAP32"] = HEAP32 = new Int32Array(buf);
1654+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
1655+ Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
1656+ Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
1657+ Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
1658+ Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
1659+ }
1660+ var TOTAL_STACK = 5242880;
1661+ if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
1662+ var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432;
1663+ if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) {
1664+ Object.defineProperty(Module, "INITIAL_MEMORY", {
1665+ configurable: true,
1666+ get: function() {
1667+ abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
1668+ }
1669+ });
1670+ }
1671+ assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
1672+ assert(typeof Int32Array !== "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray !== undefined && Int32Array.prototype.set !== undefined, "JS engine does not provide full typed array support");
1673+ if (Module["wasmMemory"]) {
1674+ wasmMemory = Module["wasmMemory"];
1675+ } else {
1676+ wasmMemory = new WebAssembly.Memory({
1677+ "initial": INITIAL_MEMORY / 65536,
1678+ "maximum": 2147483648 / 65536
1679+ });
1680+ }
1681+ if (wasmMemory) {
1682+ buffer = wasmMemory.buffer;
1683+ }
1684+ INITIAL_MEMORY = buffer.byteLength;
1685+ assert(INITIAL_MEMORY % 65536 === 0);
1686+ updateGlobalBufferAndViews(buffer);
1687+ var wasmTable = new WebAssembly.Table({
1688+ "initial": 21,
1689+ "element": "anyfunc"
1690+ });
1691+ function writeStackCookie() {
1692+ var max = _emscripten_stack_get_end();
1693+ assert((max & 3) == 0);
1694+ SAFE_HEAP_STORE(((max >> 2) + 1) * 4, 34821223, 4);
1695+ SAFE_HEAP_STORE(((max >> 2) + 2) * 4, 2310721022, 4);
1696+ }
1697+ function checkStackCookie() {
1698+ if (ABORT) return;
1699+ var max = _emscripten_stack_get_end();
1700+ var cookie1 = SAFE_HEAP_LOAD(((max >> 2) + 1) * 4, 4, 1);
1701+ var cookie2 = SAFE_HEAP_LOAD(((max >> 2) + 2) * 4, 4, 1);
1702+ if (cookie1 != 34821223 || cookie2 != 2310721022) {
1703+ abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " " + cookie1.toString(16));
1704+ }
1705+ }
1706+ (function() {
1707+ var h16 = new Int16Array(1);
1708+ var h8 = new Int8Array(h16.buffer);
1709+ h16[0] = 25459;
1710+ if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)";
1711+ })();
1712+ var __ATPRERUN__ = [];
1713+ var __ATINIT__ = [];
1714+ var __ATMAIN__ = [];
1715+ var __ATEXIT__ = [];
1716+ var __ATPOSTRUN__ = [];
1717+ var runtimeInitialized = false;
1718+ var runtimeExited = false;
1719+ var runtimeKeepaliveCounter = 0;
1720+ function keepRuntimeAlive() {
1721+ return noExitRuntime || runtimeKeepaliveCounter > 0;
1722+ }
1723+ function preRun() {
1724+ if (Module["preRun"]) {
1725+ if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
1726+ while (Module["preRun"].length) {
1727+ addOnPreRun(Module["preRun"].shift());
1728+ }
1729+ }
1730+ callRuntimeCallbacks(__ATPRERUN__);
1731+ }
1732+ function initRuntime() {
1733+ checkStackCookie();
1734+ assert(!runtimeInitialized);
1735+ runtimeInitialized = true;
1736+ callRuntimeCallbacks(__ATINIT__);
1737+ }
1738+ function preMain() {
1739+ checkStackCookie();
1740+ callRuntimeCallbacks(__ATMAIN__);
1741+ }
1742+ function exitRuntime() {
1743+ checkStackCookie();
1744+ runtimeExited = true;
1745+ }
1746+ function postRun() {
1747+ checkStackCookie();
1748+ if (Module["postRun"]) {
1749+ if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
1750+ while (Module["postRun"].length) {
1751+ addOnPostRun(Module["postRun"].shift());
1752+ }
1753+ }
1754+ callRuntimeCallbacks(__ATPOSTRUN__);
1755+ }
1756+ function addOnPreRun(cb) {
1757+ __ATPRERUN__.unshift(cb);
1758+ }
1759+ function addOnInit(cb) {
1760+ __ATINIT__.unshift(cb);
1761+ }
1762+ function addOnPreMain(cb) {
1763+ __ATMAIN__.unshift(cb);
1764+ }
1765+ function addOnExit(cb) {}
1766+ function addOnPostRun(cb) {
1767+ __ATPOSTRUN__.unshift(cb);
1768+ }
1769+ assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1770+ assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1771+ assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1772+ assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1773+ var runDependencies = 0;
1774+ var runDependencyWatcher = null;
1775+ var dependenciesFulfilled = null;
1776+ var runDependencyTracking = {};
1777+ function getUniqueRunDependency(id) {
1778+ var orig = id;
1779+ while (1) {
1780+ if (!runDependencyTracking[id]) return id;
1781+ id = orig + Math.random();
1782+ }
1783+ }
1784+ function addRunDependency(id) {
1785+ runDependencies++;
1786+ if (Module["monitorRunDependencies"]) {
1787+ Module["monitorRunDependencies"](runDependencies);
1788+ }
1789+ if (id) {
1790+ assert(!runDependencyTracking[id]);
1791+ runDependencyTracking[id] = 1;
1792+ if (runDependencyWatcher === null && typeof setInterval !== "undefined") {
1793+ runDependencyWatcher = setInterval(function() {
1794+ if (ABORT) {
1795+ clearInterval(runDependencyWatcher);
1796+ runDependencyWatcher = null;
1797+ return;
1798+ }
1799+ var shown = false;
1800+ for (var dep in runDependencyTracking) {
1801+ if (!shown) {
1802+ shown = true;
1803+ err("still waiting on run dependencies:");
1804+ }
1805+ err("dependency: " + dep);
1806+ }
1807+ if (shown) {
1808+ err("(end of list)");
1809+ }
1810+ }, 1e4);
1811+ }
1812+ } else {
1813+ err("warning: run dependency added without ID");
1814+ }
1815+ }
1816+ function removeRunDependency(id) {
1817+ runDependencies--;
1818+ if (Module["monitorRunDependencies"]) {
1819+ Module["monitorRunDependencies"](runDependencies);
1820+ }
1821+ if (id) {
1822+ assert(runDependencyTracking[id]);
1823+ delete runDependencyTracking[id];
1824+ } else {
1825+ err("warning: run dependency removed without ID");
1826+ }
1827+ if (runDependencies == 0) {
1828+ if (runDependencyWatcher !== null) {
1829+ clearInterval(runDependencyWatcher);
1830+ runDependencyWatcher = null;
1831+ }
1832+ if (dependenciesFulfilled) {
1833+ var callback = dependenciesFulfilled;
1834+ dependenciesFulfilled = null;
1835+ callback();
1836+ }
1837+ }
1838+ }
1839+ Module["preloadedImages"] = {};
1840+ Module["preloadedAudios"] = {};
1841+ Module["preloadedWasm"] = {};
1842+ function abort(what) {
1843+ if (Module["onAbort"]) {
1844+ Module["onAbort"](what);
1845+ }
1846+ what += "";
1847+ err(what);
1848+ ABORT = true;
1849+ EXITSTATUS = 1;
1850+ var output = "abort(" + what + ") at " + stackTrace();
1851+ what = output;
1852+ var e = new WebAssembly.RuntimeError(what);
1853+ throw e;
1854+ }
1855+ var FS = {
1856+ error: function() {
1857+ abort("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -s FORCE_FILESYSTEM=1");
1858+ },
1859+ init: function() {
1860+ FS.error();
1861+ },
1862+ createDataFile: function() {
1863+ FS.error();
1864+ },
1865+ createPreloadedFile: function() {
1866+ FS.error();
1867+ },
1868+ createLazyFile: function() {
1869+ FS.error();
1870+ },
1871+ open: function() {
1872+ FS.error();
1873+ },
1874+ mkdev: function() {
1875+ FS.error();
1876+ },
1877+ registerDevice: function() {
1878+ FS.error();
1879+ },
1880+ analyzePath: function() {
1881+ FS.error();
1882+ },
1883+ loadFilesFromDB: function() {
1884+ FS.error();
1885+ },
1886+ ErrnoError: function ErrnoError() {
1887+ FS.error();
1888+ }
1889+ };
1890+ Module["FS_createDataFile"] = FS.createDataFile;
1891+ Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
1892+ var dataURIPrefix = "data:application/octet-stream;base64,";
1893+ function isDataURI(filename) {
1894+ return filename.startsWith(dataURIPrefix);
1895+ }
1896+ function isFileURI(filename) {
1897+ return filename.startsWith("file://");
1898+ }
1899+ function createExportWrapper(name, fixedasm) {
1900+ return function() {
1901+ var displayName = name;
1902+ var asm = fixedasm;
1903+ if (!fixedasm) {
1904+ asm = Module["asm"];
1905+ }
1906+ assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization");
1907+ assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
1908+ if (!asm[name]) {
1909+ assert(asm[name], "exported native function `" + displayName + "` not found");
1910+ }
1911+ return asm[name].apply(null, arguments);
1912+ };
1913+ }
1914+ var wasmBinaryFile;
1915+ wasmBinaryFile = "tree-sitter.wasm";
1916+ if (!isDataURI(wasmBinaryFile)) {
1917+ wasmBinaryFile = locateFile(wasmBinaryFile);
1918+ }
1919+ function getBinary(file) {
1920+ try {
1921+ if (file == wasmBinaryFile && wasmBinary) {
1922+ return new Uint8Array(wasmBinary);
1923+ }
1924+ if (readBinary) {
1925+ return readBinary(file);
1926+ } else {
1927+ throw "both async and sync fetching of the wasm failed";
1928+ }
1929+ } catch (err) {
1930+ abort(err);
1931+ }
1932+ }
1933+ function getBinaryPromise() {
1934+ if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
1935+ if (typeof fetch === "function" && !isFileURI(wasmBinaryFile)) {
1936+ return fetch(wasmBinaryFile, {
1937+ credentials: "same-origin"
1938+ }).then(function(response) {
1939+ if (!response["ok"]) {
1940+ throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
1941+ }
1942+ return response["arrayBuffer"]();
1943+ }).catch(function() {
1944+ return getBinary(wasmBinaryFile);
1945+ });
1946+ } else {
1947+ if (readAsync) {
1948+ return new Promise(function(resolve, reject) {
1949+ readAsync(wasmBinaryFile, function(response) {
1950+ resolve(new Uint8Array(response));
1951+ }, reject);
1952+ });
1953+ }
1954+ }
1955+ }
1956+ return Promise.resolve().then(function() {
1957+ return getBinary(wasmBinaryFile);
1958+ });
1959+ }
1960+ function createWasm() {
1961+ var info = {
1962+ "env": asmLibraryArg,
1963+ "wasi_snapshot_preview1": asmLibraryArg,
1964+ "GOT.mem": new Proxy(asmLibraryArg, GOTHandler),
1965+ "GOT.func": new Proxy(asmLibraryArg, GOTHandler)
1966+ };
1967+ function receiveInstance(instance, module) {
1968+ var exports = instance.exports;
1969+ exports = relocateExports(exports, 1024);
1970+ Module["asm"] = exports;
1971+ var metadata = getDylinkMetadata(module);
1972+ if (metadata.neededDynlibs) {
1973+ dynamicLibraries = metadata.neededDynlibs.concat(dynamicLibraries);
1974+ }
1975+ mergeLibSymbols(exports, "main");
1976+ addOnInit(Module["asm"]["__wasm_call_ctors"]);
1977+ removeRunDependency("wasm-instantiate");
1978+ }
1979+ addRunDependency("wasm-instantiate");
1980+ var trueModule = Module;
1981+ function receiveInstantiationResult(result) {
1982+ assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");
1983+ trueModule = null;
1984+ receiveInstance(result["instance"], result["module"]);
1985+ }
1986+ function instantiateArrayBuffer(receiver) {
1987+ return getBinaryPromise().then(function(binary) {
1988+ return WebAssembly.instantiate(binary, info);
1989+ }).then(function(instance) {
1990+ return instance;
1991+ }).then(receiver, function(reason) {
1992+ err("failed to asynchronously prepare wasm: " + reason);
1993+ if (isFileURI(wasmBinaryFile)) {
1994+ err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing");
1995+ }
1996+ abort(reason);
1997+ });
1998+ }
1999+ function instantiateAsync() {
2000+ if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") {
2001+ return fetch(wasmBinaryFile, {
2002+ credentials: "same-origin"
2003+ }).then(function(response) {
2004+ var result = WebAssembly.instantiateStreaming(response, info);
2005+ return result.then(receiveInstantiationResult, function(reason) {
2006+ err("wasm streaming compile failed: " + reason);
2007+ err("falling back to ArrayBuffer instantiation");
2008+ return instantiateArrayBuffer(receiveInstantiationResult);
2009+ });
2010+ });
2011+ } else {
2012+ return instantiateArrayBuffer(receiveInstantiationResult);
2013+ }
2014+ }
2015+ if (Module["instantiateWasm"]) {
2016+ try {
2017+ var exports = Module["instantiateWasm"](info, receiveInstance);
2018+ return exports;
2019+ } catch (e) {
2020+ err("Module.instantiateWasm callback failed with error: " + e);
2021+ return false;
2022+ }
2023+ }
2024+ instantiateAsync();
2025+ return {};
2026+ }
2027+ var tempDouble;
2028+ var tempI64;
2029+ var ASM_CONSTS = {};
2030+ var GOT = {};
2031+ var GOTHandler = {
2032+ get: function(obj, symName) {
2033+ if (!GOT[symName]) {
2034+ GOT[symName] = new WebAssembly.Global({
2035+ "value": "i32",
2036+ "mutable": true
2037+ });
2038+ }
2039+ return GOT[symName];
2040+ }
2041+ };
2042+ function callRuntimeCallbacks(callbacks) {
2043+ while (callbacks.length > 0) {
2044+ var callback = callbacks.shift();
2045+ if (typeof callback == "function") {
2046+ callback(Module);
2047+ continue;
2048+ }
2049+ var func = callback.func;
2050+ if (typeof func === "number") {
2051+ if (callback.arg === undefined) {
2052+ wasmTable.get(func)();
2053+ } else {
2054+ wasmTable.get(func)(callback.arg);
2055+ }
2056+ } else {
2057+ func(callback.arg === undefined ? null : callback.arg);
2058+ }
2059+ }
2060+ }
2061+ function demangle(func) {
2062+ warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");
2063+ return func;
2064+ }
2065+ function demangleAll(text) {
2066+ var regex = /\b_Z[\w\d_]+/g;
2067+ return text.replace(regex, function(x) {
2068+ var y = demangle(x);
2069+ return x === y ? x : y + " [" + x + "]";
2070+ });
2071+ }
2072+ function getDylinkMetadata(binary) {
2073+ var next = 0;
2074+ function getLEB() {
2075+ var ret = 0;
2076+ var mul = 1;
2077+ while (1) {
2078+ var byte = binary[next++];
2079+ ret += (byte & 127) * mul;
2080+ mul *= 128;
2081+ if (!(byte & 128)) break;
2082+ }
2083+ return ret;
2084+ }
2085+ if (binary instanceof WebAssembly.Module) {
2086+ var dylinkSection = WebAssembly.Module.customSections(binary, "dylink");
2087+ assert(dylinkSection.length != 0, "need dylink section");
2088+ binary = new Int8Array(dylinkSection[0]);
2089+ } else {
2090+ var int32View = new Uint32Array(new Uint8Array(binary.subarray(0, 24)).buffer);
2091+ assert(int32View[0] == 1836278016, "need to see wasm magic number");
2092+ assert(binary[8] === 0, "need the dylink section to be first");
2093+ next = 9;
2094+ getLEB();
2095+ assert(binary[next] === 6);
2096+ next++;
2097+ assert(binary[next] === "d".charCodeAt(0));
2098+ next++;
2099+ assert(binary[next] === "y".charCodeAt(0));
2100+ next++;
2101+ assert(binary[next] === "l".charCodeAt(0));
2102+ next++;
2103+ assert(binary[next] === "i".charCodeAt(0));
2104+ next++;
2105+ assert(binary[next] === "n".charCodeAt(0));
2106+ next++;
2107+ assert(binary[next] === "k".charCodeAt(0));
2108+ next++;
2109+ }
2110+ var customSection = {};
2111+ customSection.memorySize = getLEB();
2112+ customSection.memoryAlign = getLEB();
2113+ customSection.tableSize = getLEB();
2114+ customSection.tableAlign = getLEB();
2115+ var tableAlign = Math.pow(2, customSection.tableAlign);
2116+ assert(tableAlign === 1, "invalid tableAlign " + tableAlign);
2117+ var neededDynlibsCount = getLEB();
2118+ customSection.neededDynlibs = [];
2119+ for (var i = 0; i < neededDynlibsCount; ++i) {
2120+ var nameLen = getLEB();
2121+ var nameUTF8 = binary.subarray(next, next + nameLen);
2122+ next += nameLen;
2123+ var name = UTF8ArrayToString(nameUTF8, 0);
2124+ customSection.neededDynlibs.push(name);
2125+ }
2126+ return customSection;
2127+ }
2128+ function jsStackTrace() {
2129+ var error = new Error();
2130+ if (!error.stack) {
2131+ try {
2132+ throw new Error();
2133+ } catch (e) {
2134+ error = e;
2135+ }
2136+ if (!error.stack) {
2137+ return "(no stack trace available)";
2138+ }
2139+ }
2140+ return error.stack.toString();
2141+ }
2142+ function asmjsMangle(x) {
2143+ var unmangledSymbols = [ "stackAlloc", "stackSave", "stackRestore" ];
2144+ return x.indexOf("dynCall_") == 0 || unmangledSymbols.includes(x) ? x : "_" + x;
2145+ }
2146+ function mergeLibSymbols(exports, libName) {
2147+ for (var sym in exports) {
2148+ if (!exports.hasOwnProperty(sym)) {
2149+ continue;
2150+ }
2151+ if (!asmLibraryArg.hasOwnProperty(sym)) {
2152+ asmLibraryArg[sym] = exports[sym];
2153+ }
2154+ var module_sym = asmjsMangle(sym);
2155+ if (!Module.hasOwnProperty(module_sym)) {
2156+ Module[module_sym] = exports[sym];
2157+ }
2158+ }
2159+ }
2160+ var LDSO = {
2161+ nextHandle: 1,
2162+ loadedLibs: {},
2163+ loadedLibNames: {}
2164+ };
2165+ function dynCallLegacy(sig, ptr, args) {
2166+ assert("dynCall_" + sig in Module, "bad function pointer type - no table for sig '" + sig + "'");
2167+ if (args && args.length) {
2168+ assert(args.length === sig.substring(1).replace(/j/g, "--").length);
2169+ } else {
2170+ assert(sig.length == 1);
2171+ }
2172+ var f = Module["dynCall_" + sig];
2173+ return args && args.length ? f.apply(null, [ ptr ].concat(args)) : f.call(null, ptr);
2174+ }
2175+ function dynCall(sig, ptr, args) {
2176+ if (sig.includes("j")) {
2177+ return dynCallLegacy(sig, ptr, args);
2178+ }
2179+ assert(wasmTable.get(ptr), "missing table entry in dynCall: " + ptr);
2180+ return wasmTable.get(ptr).apply(null, args);
2181+ }
2182+ function createInvokeFunction(sig) {
2183+ return function() {
2184+ var sp = stackSave();
2185+ try {
2186+ return dynCall(sig, arguments[0], Array.prototype.slice.call(arguments, 1));
2187+ } catch (e) {
2188+ stackRestore(sp);
2189+ if (e !== e + 0 && e !== "longjmp") throw e;
2190+ _setThrew(1, 0);
2191+ }
2192+ };
2193+ }
2194+ var ___heap_base = 5251008;
2195+ Module["___heap_base"] = ___heap_base;
2196+ function getMemory(size) {
2197+ if (runtimeInitialized) return _malloc(size);
2198+ var ret = ___heap_base;
2199+ var end = ret + size + 15 & -16;
2200+ assert(end <= HEAP8.length, "failure to getMemory - memory growth etc. is not supported there, call malloc/sbrk directly or increase INITIAL_MEMORY");
2201+ ___heap_base = end;
2202+ GOT["__heap_base"].value = end;
2203+ return ret;
2204+ }
2205+ function isInternalSym(symName) {
2206+ return [ "__cpp_exception", "__wasm_apply_data_relocs", "__dso_handle", "__set_stack_limits" ].includes(symName);
2207+ }
2208+ function updateGOT(exports) {
2209+ for (var symName in exports) {
2210+ if (isInternalSym(symName)) {
2211+ continue;
2212+ }
2213+ var replace = false;
2214+ var value = exports[symName];
2215+ if (symName.startsWith("orig$")) {
2216+ symName = symName.split("$")[1];
2217+ replace = true;
2218+ }
2219+ if (!GOT[symName]) {
2220+ GOT[symName] = new WebAssembly.Global({
2221+ "value": "i32",
2222+ "mutable": true
2223+ });
2224+ }
2225+ if (replace || GOT[symName].value == 0) {
2226+ if (typeof value === "function") {
2227+ GOT[symName].value = addFunctionWasm(value);
2228+ } else if (typeof value === "number") {
2229+ GOT[symName].value = value;
2230+ } else {
2231+ err("unhandled export type for `" + symName + "`: " + typeof value);
2232+ }
2233+ }
2234+ }
2235+ }
2236+ function relocateExports(exports, memoryBase) {
2237+ var relocated = {};
2238+ for (var e in exports) {
2239+ var value = exports[e];
2240+ if (typeof value === "object") {
2241+ value = value.value;
2242+ }
2243+ if (typeof value === "number") {
2244+ value += memoryBase;
2245+ }
2246+ relocated[e] = value;
2247+ }
2248+ updateGOT(relocated);
2249+ return relocated;
2250+ }
2251+ function resolveGlobalSymbol(symName, direct) {
2252+ var sym;
2253+ if (direct) {
2254+ sym = asmLibraryArg["orig$" + symName];
2255+ }
2256+ if (!sym) {
2257+ sym = asmLibraryArg[symName];
2258+ }
2259+ if (!sym) {
2260+ sym = Module[asmjsMangle(symName)];
2261+ }
2262+ if (!sym && symName.startsWith("invoke_")) {
2263+ sym = createInvokeFunction(symName.split("_")[1]);
2264+ }
2265+ return sym;
2266+ }
2267+ function alignMemory(size, alignment) {
2268+ assert(alignment, "alignment argument is required");
2269+ return Math.ceil(size / alignment) * alignment;
2270+ }
2271+ function loadWebAssemblyModule(binary, flags) {
2272+ var metadata = getDylinkMetadata(binary);
2273+ var originalTable = wasmTable;
2274+ function loadModule() {
2275+ var memAlign = Math.pow(2, metadata.memoryAlign);
2276+ memAlign = Math.max(memAlign, STACK_ALIGN);
2277+ var memoryBase = alignMemory(getMemory(metadata.memorySize + memAlign), memAlign);
2278+ var tableBase = wasmTable.length;
2279+ wasmTable.grow(metadata.tableSize);
2280+ for (var i = memoryBase; i < memoryBase + metadata.memorySize; i++) {
2281+ SAFE_HEAP_STORE(i, 0, 1);
2282+ }
2283+ for (var i = tableBase; i < tableBase + metadata.tableSize; i++) {
2284+ wasmTable.set(i, null);
2285+ }
2286+ var moduleExports;
2287+ function resolveSymbol(sym) {
2288+ var resolved = resolveGlobalSymbol(sym, false);
2289+ if (!resolved) {
2290+ resolved = moduleExports[sym];
2291+ }
2292+ assert(resolved, "undefined symbol `" + sym + "`. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment");
2293+ return resolved;
2294+ }
2295+ var proxyHandler = {
2296+ "get": function(stubs, prop) {
2297+ switch (prop) {
2298+ case "__memory_base":
2299+ return memoryBase;
2300+
2301+ case "__table_base":
2302+ return tableBase;
2303+ }
2304+ if (prop in asmLibraryArg) {
2305+ return asmLibraryArg[prop];
2306+ }
2307+ if (!(prop in stubs)) {
2308+ var resolved;
2309+ stubs[prop] = function() {
2310+ if (!resolved) resolved = resolveSymbol(prop, true);
2311+ return resolved.apply(null, arguments);
2312+ };
2313+ }
2314+ return stubs[prop];
2315+ }
2316+ };
2317+ var proxy = new Proxy({}, proxyHandler);
2318+ var info = {
2319+ "GOT.mem": new Proxy({}, GOTHandler),
2320+ "GOT.func": new Proxy({}, GOTHandler),
2321+ "env": proxy,
2322+ wasi_snapshot_preview1: proxy
2323+ };
2324+ function postInstantiation(instance) {
2325+ assert(wasmTable === originalTable);
2326+ for (var i = 0; i < metadata.tableSize; i++) {
2327+ var item = wasmTable.get(tableBase + i);
2328+ assert(item !== undefined, "table entry was not filled in");
2329+ if (item) {
2330+ functionsInTableMap.set(item, tableBase + i);
2331+ }
2332+ }
2333+ moduleExports = relocateExports(instance.exports, memoryBase);
2334+ if (!flags.allowUndefined) {
2335+ reportUndefinedSymbols();
2336+ }
2337+ var init = moduleExports["__wasm_call_ctors"];
2338+ if (!init) {
2339+ init = moduleExports["__post_instantiate"];
2340+ }
2341+ if (init) {
2342+ if (runtimeInitialized) {
2343+ init();
2344+ } else {
2345+ __ATINIT__.push(init);
2346+ }
2347+ }
2348+ return moduleExports;
2349+ }
2350+ if (flags.loadAsync) {
2351+ if (binary instanceof WebAssembly.Module) {
2352+ var instance = new WebAssembly.Instance(binary, info);
2353+ return Promise.resolve(postInstantiation(instance));
2354+ }
2355+ return WebAssembly.instantiate(binary, info).then(function(result) {
2356+ return postInstantiation(result.instance);
2357+ });
2358+ }
2359+ var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary);
2360+ var instance = new WebAssembly.Instance(module, info);
2361+ return postInstantiation(instance);
2362+ }
2363+ if (flags.loadAsync) {
2364+ return metadata.neededDynlibs.reduce(function(chain, dynNeeded) {
2365+ return chain.then(function() {
2366+ return loadDynamicLibrary(dynNeeded, flags);
2367+ });
2368+ }, Promise.resolve()).then(function() {
2369+ return loadModule();
2370+ });
2371+ }
2372+ metadata.neededDynlibs.forEach(function(dynNeeded) {
2373+ loadDynamicLibrary(dynNeeded, flags);
2374+ });
2375+ return loadModule();
2376+ }
2377+ function loadDynamicLibrary(lib, flags) {
2378+ if (lib == "__main__" && !LDSO.loadedLibNames[lib]) {
2379+ LDSO.loadedLibs[-1] = {
2380+ refcount: Infinity,
2381+ name: "__main__",
2382+ module: Module["asm"],
2383+ global: true
2384+ };
2385+ LDSO.loadedLibNames["__main__"] = -1;
2386+ }
2387+ flags = flags || {
2388+ global: true,
2389+ nodelete: true
2390+ };
2391+ var handle = LDSO.loadedLibNames[lib];
2392+ var dso;
2393+ if (handle) {
2394+ dso = LDSO.loadedLibs[handle];
2395+ if (flags.global && !dso.global) {
2396+ dso.global = true;
2397+ if (dso.module !== "loading") {
2398+ mergeLibSymbols(dso.module, lib);
2399+ }
2400+ }
2401+ if (flags.nodelete && dso.refcount !== Infinity) {
2402+ dso.refcount = Infinity;
2403+ }
2404+ dso.refcount++;
2405+ return flags.loadAsync ? Promise.resolve(handle) : handle;
2406+ }
2407+ handle = LDSO.nextHandle++;
2408+ dso = {
2409+ refcount: flags.nodelete ? Infinity : 1,
2410+ name: lib,
2411+ module: "loading",
2412+ global: flags.global
2413+ };
2414+ LDSO.loadedLibNames[lib] = handle;
2415+ LDSO.loadedLibs[handle] = dso;
2416+ function loadLibData(libFile) {
2417+ if (flags.fs && flags.fs.findObject(libFile)) {
2418+ var libData = flags.fs.readFile(libFile, {
2419+ encoding: "binary"
2420+ });
2421+ if (!(libData instanceof Uint8Array)) {
2422+ libData = new Uint8Array(libData);
2423+ }
2424+ return flags.loadAsync ? Promise.resolve(libData) : libData;
2425+ }
2426+ if (flags.loadAsync) {
2427+ return new Promise(function(resolve, reject) {
2428+ readAsync(libFile, function(data) {
2429+ resolve(new Uint8Array(data));
2430+ }, reject);
2431+ });
2432+ }
2433+ if (!readBinary) {
2434+ throw new Error(libFile + ": file not found, and synchronous loading of external files is not available");
2435+ }
2436+ return readBinary(libFile);
2437+ }
2438+ function getLibModule() {
2439+ if (Module["preloadedWasm"] !== undefined && Module["preloadedWasm"][lib] !== undefined) {
2440+ var libModule = Module["preloadedWasm"][lib];
2441+ return flags.loadAsync ? Promise.resolve(libModule) : libModule;
2442+ }
2443+ if (flags.loadAsync) {
2444+ return loadLibData(lib).then(function(libData) {
2445+ return loadWebAssemblyModule(libData, flags);
2446+ });
2447+ }
2448+ return loadWebAssemblyModule(loadLibData(lib), flags);
2449+ }
2450+ function moduleLoaded(libModule) {
2451+ if (dso.global) {
2452+ mergeLibSymbols(libModule, lib);
2453+ }
2454+ dso.module = libModule;
2455+ }
2456+ if (flags.loadAsync) {
2457+ return getLibModule().then(function(libModule) {
2458+ moduleLoaded(libModule);
2459+ return handle;
2460+ });
2461+ }
2462+ moduleLoaded(getLibModule());
2463+ return handle;
2464+ }
2465+ function reportUndefinedSymbols() {
2466+ for (var symName in GOT) {
2467+ if (GOT[symName].value == 0) {
2468+ var value = resolveGlobalSymbol(symName, true);
2469+ assert(value, "undefined symbol `" + symName + "`. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment");
2470+ if (typeof value === "function") {
2471+ GOT[symName].value = addFunctionWasm(value, value.sig);
2472+ } else if (typeof value === "number") {
2473+ GOT[symName].value = value;
2474+ } else {
2475+ assert(false, "bad export type for `" + symName + "`: " + typeof value);
2476+ }
2477+ }
2478+ }
2479+ }
2480+ function preloadDylibs() {
2481+ if (!dynamicLibraries.length) {
2482+ reportUndefinedSymbols();
2483+ return;
2484+ }
2485+ addRunDependency("preloadDylibs");
2486+ dynamicLibraries.reduce(function(chain, lib) {
2487+ return chain.then(function() {
2488+ return loadDynamicLibrary(lib, {
2489+ loadAsync: true,
2490+ global: true,
2491+ nodelete: true,
2492+ allowUndefined: true
2493+ });
2494+ });
2495+ }, Promise.resolve()).then(function() {
2496+ reportUndefinedSymbols();
2497+ removeRunDependency("preloadDylibs");
2498+ });
2499+ }
2500+ function stackTrace() {
2501+ var js = jsStackTrace();
2502+ if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
2503+ return demangleAll(js);
2504+ }
2505+ function unSign(value, bits) {
2506+ if (value >= 0) {
2507+ return value;
2508+ }
2509+ return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value;
2510+ }
2511+ var ___stack_pointer = new WebAssembly.Global({
2512+ "value": "i32",
2513+ "mutable": true
2514+ }, 5251008);
2515+ function _abort() {
2516+ abort();
2517+ }
2518+ Module["_abort"] = _abort;
2519+ _abort.sig = "v";
2520+ var _emscripten_get_now;
2521+ if (ENVIRONMENT_IS_NODE) {
2522+ _emscripten_get_now = function() {
2523+ var t = process["hrtime"]();
2524+ return t[0] * 1e3 + t[1] / 1e6;
2525+ };
2526+ } else _emscripten_get_now = function() {
2527+ return performance.now();
2528+ };
2529+ var _emscripten_get_now_is_monotonic = true;
2530+ function setErrNo(value) {
2531+ SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4);
2532+ return value;
2533+ }
2534+ function _clock_gettime(clk_id, tp) {
2535+ var now;
2536+ if (clk_id === 0) {
2537+ now = Date.now();
2538+ } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) {
2539+ now = _emscripten_get_now();
2540+ } else {
2541+ setErrNo(28);
2542+ return -1;
2543+ }
2544+ SAFE_HEAP_STORE(tp | 0, now / 1e3 | 0 | 0, 4);
2545+ SAFE_HEAP_STORE(tp + 4 | 0, now % 1e3 * 1e3 * 1e3 | 0 | 0, 4);
2546+ return 0;
2547+ }
2548+ _clock_gettime.sig = "iii";
2549+ function _emscripten_memcpy_big(dest, src, num) {
2550+ HEAPU8.copyWithin(dest, src, src + num);
2551+ }
2552+ function emscripten_realloc_buffer(size) {
2553+ try {
2554+ wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16);
2555+ updateGlobalBufferAndViews(wasmMemory.buffer);
2556+ return 1;
2557+ } catch (e) {
2558+ err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e);
2559+ }
2560+ }
2561+ function _emscripten_resize_heap(requestedSize) {
2562+ var oldSize = HEAPU8.length;
2563+ requestedSize = requestedSize >>> 0;
2564+ assert(requestedSize > oldSize);
2565+ var maxHeapSize = 2147483648;
2566+ if (requestedSize > maxHeapSize) {
2567+ err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!");
2568+ return false;
2569+ }
2570+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
2571+ var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
2572+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
2573+ var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
2574+ var replacement = emscripten_realloc_buffer(newSize);
2575+ if (replacement) {
2576+ return true;
2577+ }
2578+ }
2579+ err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!");
2580+ return false;
2581+ }
2582+ function _exit(status) {
2583+ exit(status);
2584+ }
2585+ _exit.sig = "vi";
2586+ var SYSCALLS = {
2587+ mappings: {},
2588+ DEFAULT_POLLMASK: 5,
2589+ umask: 511,
2590+ calculateAt: function(dirfd, path, allowEmpty) {
2591+ if (path[0] === "/") {
2592+ return path;
2593+ }
2594+ var dir;
2595+ if (dirfd === -100) {
2596+ dir = FS.cwd();
2597+ } else {
2598+ var dirstream = FS.getStream(dirfd);
2599+ if (!dirstream) throw new FS.ErrnoError(8);
2600+ dir = dirstream.path;
2601+ }
2602+ if (path.length == 0) {
2603+ if (!allowEmpty) {
2604+ throw new FS.ErrnoError(44);
2605+ }
2606+ return dir;
2607+ }
2608+ return PATH.join2(dir, path);
2609+ },
2610+ doStat: function(func, path, buf) {
2611+ try {
2612+ var stat = func(path);
2613+ } catch (e) {
2614+ if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
2615+ return -54;
2616+ }
2617+ throw e;
2618+ }
2619+ SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4);
2620+ SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4);
2621+ SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4);
2622+ SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4);
2623+ SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4);
2624+ SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4);
2625+ SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4);
2626+ SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4);
2627+ SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4);
2628+ tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
2629+ SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4);
2630+ SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4);
2631+ SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4);
2632+ SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4);
2633+ SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4);
2634+ SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4);
2635+ SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4);
2636+ SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4);
2637+ SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4);
2638+ tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
2639+ SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4);
2640+ return 0;
2641+ },
2642+ doMsync: function(addr, stream, len, flags, offset) {
2643+ var buffer = HEAPU8.slice(addr, addr + len);
2644+ FS.msync(stream, buffer, offset, len, flags);
2645+ },
2646+ doMkdir: function(path, mode) {
2647+ path = PATH.normalize(path);
2648+ if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
2649+ FS.mkdir(path, mode, 0);
2650+ return 0;
2651+ },
2652+ doMknod: function(path, mode, dev) {
2653+ switch (mode & 61440) {
2654+ case 32768:
2655+ case 8192:
2656+ case 24576:
2657+ case 4096:
2658+ case 49152:
2659+ break;
2660+
2661+ default:
2662+ return -28;
2663+ }
2664+ FS.mknod(path, mode, dev);
2665+ return 0;
2666+ },
2667+ doReadlink: function(path, buf, bufsize) {
2668+ if (bufsize <= 0) return -28;
2669+ var ret = FS.readlink(path);
2670+ var len = Math.min(bufsize, lengthBytesUTF8(ret));
2671+ var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0);
2672+ stringToUTF8(ret, buf, bufsize + 1);
2673+ SAFE_HEAP_STORE(buf + len, endChar, 1);
2674+ return len;
2675+ },
2676+ doAccess: function(path, amode) {
2677+ if (amode & ~7) {
2678+ return -28;
2679+ }
2680+ var node;
2681+ var lookup = FS.lookupPath(path, {
2682+ follow: true
2683+ });
2684+ node = lookup.node;
2685+ if (!node) {
2686+ return -44;
2687+ }
2688+ var perms = "";
2689+ if (amode & 4) perms += "r";
2690+ if (amode & 2) perms += "w";
2691+ if (amode & 1) perms += "x";
2692+ if (perms && FS.nodePermissions(node, perms)) {
2693+ return -2;
2694+ }
2695+ return 0;
2696+ },
2697+ doDup: function(path, flags, suggestFD) {
2698+ var suggest = FS.getStream(suggestFD);
2699+ if (suggest) FS.close(suggest);
2700+ return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
2701+ },
2702+ doReadv: function(stream, iov, iovcnt, offset) {
2703+ var ret = 0;
2704+ for (var i = 0; i < iovcnt; i++) {
2705+ var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0;
2706+ var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0;
2707+ var curr = FS.read(stream, HEAP8, ptr, len, offset);
2708+ if (curr < 0) return -1;
2709+ ret += curr;
2710+ if (curr < len) break;
2711+ }
2712+ return ret;
2713+ },
2714+ doWritev: function(stream, iov, iovcnt, offset) {
2715+ var ret = 0;
2716+ for (var i = 0; i < iovcnt; i++) {
2717+ var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0;
2718+ var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0;
2719+ var curr = FS.write(stream, HEAP8, ptr, len, offset);
2720+ if (curr < 0) return -1;
2721+ ret += curr;
2722+ }
2723+ return ret;
2724+ },
2725+ varargs: undefined,
2726+ get: function() {
2727+ assert(SYSCALLS.varargs != undefined);
2728+ SYSCALLS.varargs += 4;
2729+ var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0;
2730+ return ret;
2731+ },
2732+ getStr: function(ptr) {
2733+ var ret = UTF8ToString(ptr);
2734+ return ret;
2735+ },
2736+ getStreamFromFD: function(fd) {
2737+ var stream = FS.getStream(fd);
2738+ if (!stream) throw new FS.ErrnoError(8);
2739+ return stream;
2740+ },
2741+ get64: function(low, high) {
2742+ if (low >= 0) assert(high === 0); else assert(high === -1);
2743+ return low;
2744+ }
2745+ };
2746+ function _fd_close(fd) {
2747+ try {
2748+ var stream = SYSCALLS.getStreamFromFD(fd);
2749+ FS.close(stream);
2750+ return 0;
2751+ } catch (e) {
2752+ if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
2753+ return e.errno;
2754+ }
2755+ }
2756+ _fd_close.sig = "ii";
2757+ function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
2758+ try {
2759+ var stream = SYSCALLS.getStreamFromFD(fd);
2760+ var HIGH_OFFSET = 4294967296;
2761+ var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0);
2762+ var DOUBLE_LIMIT = 9007199254740992;
2763+ if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) {
2764+ return -61;
2765+ }
2766+ FS.llseek(stream, offset, whence);
2767+ tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
2768+ SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4);
2769+ if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
2770+ return 0;
2771+ } catch (e) {
2772+ if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
2773+ return e.errno;
2774+ }
2775+ }
2776+ function _fd_write(fd, iov, iovcnt, pnum) {
2777+ try {
2778+ var stream = SYSCALLS.getStreamFromFD(fd);
2779+ var num = SYSCALLS.doWritev(stream, iov, iovcnt);
2780+ SAFE_HEAP_STORE(pnum | 0, num | 0, 4);
2781+ return 0;
2782+ } catch (e) {
2783+ if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
2784+ return e.errno;
2785+ }
2786+ }
2787+ _fd_write.sig = "iiiii";
2788+ function _setTempRet0(val) {
2789+ setTempRet0(val);
2790+ }
2791+ _setTempRet0.sig = "vi";
2792+ function _tree_sitter_log_callback(isLexMessage, messageAddress) {
2793+ if (currentLogCallback) {
2794+ const message = UTF8ToString(messageAddress);
2795+ currentLogCallback(message, isLexMessage !== 0);
2796+ }
2797+ }
2798+ function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
2799+ var INPUT_BUFFER_SIZE = 10 * 1024;
2800+ var string = currentParseCallback(index, {
2801+ row: row,
2802+ column: column
2803+ });
2804+ if (typeof string === "string") {
2805+ setValue(lengthAddress, string.length, "i32");
2806+ stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
2807+ } else {
2808+ setValue(lengthAddress, 0, "i32");
2809+ }
2810+ }
2811+ var ___memory_base = 1024;
2812+ var ___table_base = 1;
2813+ var ASSERTIONS = true;
2814+ function intArrayFromString(stringy, dontAddNull, length) {
2815+ var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
2816+ var u8array = new Array(len);
2817+ var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
2818+ if (dontAddNull) u8array.length = numBytesWritten;
2819+ return u8array;
2820+ }
2821+ function intArrayToString(array) {
2822+ var ret = [];
2823+ for (var i = 0; i < array.length; i++) {
2824+ var chr = array[i];
2825+ if (chr > 255) {
2826+ if (ASSERTIONS) {
2827+ assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF.");
2828+ }
2829+ chr &= 255;
2830+ }
2831+ ret.push(String.fromCharCode(chr));
2832+ }
2833+ return ret.join("");
2834+ }
2835+ var asmLibraryArg = {
2836+ "__heap_base": ___heap_base,
2837+ "__indirect_function_table": wasmTable,
2838+ "__memory_base": ___memory_base,
2839+ "__stack_pointer": ___stack_pointer,
2840+ "__table_base": ___table_base,
2841+ "abort": _abort,
2842+ "alignfault": alignfault,
2843+ "clock_gettime": _clock_gettime,
2844+ "emscripten_memcpy_big": _emscripten_memcpy_big,
2845+ "emscripten_resize_heap": _emscripten_resize_heap,
2846+ "exit": _exit,
2847+ "fd_close": _fd_close,
2848+ "fd_seek": _fd_seek,
2849+ "fd_write": _fd_write,
2850+ "memory": wasmMemory,
2851+ "segfault": segfault,
2852+ "setTempRet0": _setTempRet0,
2853+ "tree_sitter_log_callback": _tree_sitter_log_callback,
2854+ "tree_sitter_parse_callback": _tree_sitter_parse_callback
2855+ };
2856+ var asm = createWasm();
2857+ var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors");
2858+ var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = createExportWrapper("ts_language_symbol_count");
2859+ var _ts_language_version = Module["_ts_language_version"] = createExportWrapper("ts_language_version");
2860+ var _ts_language_field_count = Module["_ts_language_field_count"] = createExportWrapper("ts_language_field_count");
2861+ var _ts_language_symbol_name = Module["_ts_language_symbol_name"] = createExportWrapper("ts_language_symbol_name");
2862+ var _ts_language_symbol_for_name = Module["_ts_language_symbol_for_name"] = createExportWrapper("ts_language_symbol_for_name");
2863+ var _ts_language_symbol_type = Module["_ts_language_symbol_type"] = createExportWrapper("ts_language_symbol_type");
2864+ var _ts_language_field_name_for_id = Module["_ts_language_field_name_for_id"] = createExportWrapper("ts_language_field_name_for_id");
2865+ var _memcpy = Module["_memcpy"] = createExportWrapper("memcpy");
2866+ var _free = Module["_free"] = createExportWrapper("free");
2867+ var _calloc = Module["_calloc"] = createExportWrapper("calloc");
2868+ var _ts_parser_delete = Module["_ts_parser_delete"] = createExportWrapper("ts_parser_delete");
2869+ var _ts_parser_set_language = Module["_ts_parser_set_language"] = createExportWrapper("ts_parser_set_language");
2870+ var _ts_parser_reset = Module["_ts_parser_reset"] = createExportWrapper("ts_parser_reset");
2871+ var _ts_parser_timeout_micros = Module["_ts_parser_timeout_micros"] = createExportWrapper("ts_parser_timeout_micros");
2872+ var _ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = createExportWrapper("ts_parser_set_timeout_micros");
2873+ var _ts_query_new = Module["_ts_query_new"] = createExportWrapper("ts_query_new");
2874+ var _ts_query_delete = Module["_ts_query_delete"] = createExportWrapper("ts_query_delete");
2875+ var _malloc = Module["_malloc"] = createExportWrapper("malloc");
2876+ var _iswspace = Module["_iswspace"] = createExportWrapper("iswspace");
2877+ var _ts_query_pattern_count = Module["_ts_query_pattern_count"] = createExportWrapper("ts_query_pattern_count");
2878+ var _ts_query_capture_count = Module["_ts_query_capture_count"] = createExportWrapper("ts_query_capture_count");
2879+ var _ts_query_string_count = Module["_ts_query_string_count"] = createExportWrapper("ts_query_string_count");
2880+ var _ts_query_capture_name_for_id = Module["_ts_query_capture_name_for_id"] = createExportWrapper("ts_query_capture_name_for_id");
2881+ var _ts_query_string_value_for_id = Module["_ts_query_string_value_for_id"] = createExportWrapper("ts_query_string_value_for_id");
2882+ var _ts_query_predicates_for_pattern = Module["_ts_query_predicates_for_pattern"] = createExportWrapper("ts_query_predicates_for_pattern");
2883+ var _memmove = Module["_memmove"] = createExportWrapper("memmove");
2884+ var _memcmp = Module["_memcmp"] = createExportWrapper("memcmp");
2885+ var _ts_tree_copy = Module["_ts_tree_copy"] = createExportWrapper("ts_tree_copy");
2886+ var _ts_tree_delete = Module["_ts_tree_delete"] = createExportWrapper("ts_tree_delete");
2887+ var _iswalnum = Module["_iswalnum"] = createExportWrapper("iswalnum");
2888+ var _ts_init = Module["_ts_init"] = createExportWrapper("ts_init");
2889+ var _ts_parser_new_wasm = Module["_ts_parser_new_wasm"] = createExportWrapper("ts_parser_new_wasm");
2890+ var _ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = createExportWrapper("ts_parser_enable_logger_wasm");
2891+ var _ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = createExportWrapper("ts_parser_parse_wasm");
2892+ var _ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = createExportWrapper("ts_language_type_is_named_wasm");
2893+ var _ts_language_type_is_visible_wasm = Module["_ts_language_type_is_visible_wasm"] = createExportWrapper("ts_language_type_is_visible_wasm");
2894+ var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = createExportWrapper("ts_tree_root_node_wasm");
2895+ var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = createExportWrapper("ts_tree_edit_wasm");
2896+ var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = createExportWrapper("ts_tree_get_changed_ranges_wasm");
2897+ var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = createExportWrapper("ts_tree_cursor_new_wasm");
2898+ var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = createExportWrapper("ts_tree_cursor_delete_wasm");
2899+ var _ts_tree_cursor_reset_wasm = Module["_ts_tree_cursor_reset_wasm"] = createExportWrapper("ts_tree_cursor_reset_wasm");
2900+ var _ts_tree_cursor_goto_first_child_wasm = Module["_ts_tree_cursor_goto_first_child_wasm"] = createExportWrapper("ts_tree_cursor_goto_first_child_wasm");
2901+ var _ts_tree_cursor_goto_next_sibling_wasm = Module["_ts_tree_cursor_goto_next_sibling_wasm"] = createExportWrapper("ts_tree_cursor_goto_next_sibling_wasm");
2902+ var _ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = createExportWrapper("ts_tree_cursor_goto_parent_wasm");
2903+ var _ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = createExportWrapper("ts_tree_cursor_current_node_type_id_wasm");
2904+ var _ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = createExportWrapper("ts_tree_cursor_current_node_is_named_wasm");
2905+ var _ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = createExportWrapper("ts_tree_cursor_current_node_is_missing_wasm");
2906+ var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = createExportWrapper("ts_tree_cursor_current_node_id_wasm");
2907+ var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = createExportWrapper("ts_tree_cursor_start_position_wasm");
2908+ var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = createExportWrapper("ts_tree_cursor_end_position_wasm");
2909+ var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = createExportWrapper("ts_tree_cursor_start_index_wasm");
2910+ var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = createExportWrapper("ts_tree_cursor_end_index_wasm");
2911+ var _ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = createExportWrapper("ts_tree_cursor_current_field_id_wasm");
2912+ var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = createExportWrapper("ts_tree_cursor_current_node_wasm");
2913+ var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = createExportWrapper("ts_node_symbol_wasm");
2914+ var _ts_node_child_count_wasm = Module["_ts_node_child_count_wasm"] = createExportWrapper("ts_node_child_count_wasm");
2915+ var _ts_node_named_child_count_wasm = Module["_ts_node_named_child_count_wasm"] = createExportWrapper("ts_node_named_child_count_wasm");
2916+ var _ts_node_child_wasm = Module["_ts_node_child_wasm"] = createExportWrapper("ts_node_child_wasm");
2917+ var _ts_node_named_child_wasm = Module["_ts_node_named_child_wasm"] = createExportWrapper("ts_node_named_child_wasm");
2918+ var _ts_node_child_by_field_id_wasm = Module["_ts_node_child_by_field_id_wasm"] = createExportWrapper("ts_node_child_by_field_id_wasm");
2919+ var _ts_node_next_sibling_wasm = Module["_ts_node_next_sibling_wasm"] = createExportWrapper("ts_node_next_sibling_wasm");
2920+ var _ts_node_prev_sibling_wasm = Module["_ts_node_prev_sibling_wasm"] = createExportWrapper("ts_node_prev_sibling_wasm");
2921+ var _ts_node_next_named_sibling_wasm = Module["_ts_node_next_named_sibling_wasm"] = createExportWrapper("ts_node_next_named_sibling_wasm");
2922+ var _ts_node_prev_named_sibling_wasm = Module["_ts_node_prev_named_sibling_wasm"] = createExportWrapper("ts_node_prev_named_sibling_wasm");
2923+ var _ts_node_parent_wasm = Module["_ts_node_parent_wasm"] = createExportWrapper("ts_node_parent_wasm");
2924+ var _ts_node_descendant_for_index_wasm = Module["_ts_node_descendant_for_index_wasm"] = createExportWrapper("ts_node_descendant_for_index_wasm");
2925+ var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = createExportWrapper("ts_node_named_descendant_for_index_wasm");
2926+ var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = createExportWrapper("ts_node_descendant_for_position_wasm");
2927+ var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = createExportWrapper("ts_node_named_descendant_for_position_wasm");
2928+ var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = createExportWrapper("ts_node_start_point_wasm");
2929+ var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = createExportWrapper("ts_node_end_point_wasm");
2930+ var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = createExportWrapper("ts_node_start_index_wasm");
2931+ var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = createExportWrapper("ts_node_end_index_wasm");
2932+ var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = createExportWrapper("ts_node_to_string_wasm");
2933+ var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = createExportWrapper("ts_node_children_wasm");
2934+ var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = createExportWrapper("ts_node_named_children_wasm");
2935+ var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = createExportWrapper("ts_node_descendants_of_type_wasm");
2936+ var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = createExportWrapper("ts_node_is_named_wasm");
2937+ var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = createExportWrapper("ts_node_has_changes_wasm");
2938+ var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = createExportWrapper("ts_node_has_error_wasm");
2939+ var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = createExportWrapper("ts_node_is_missing_wasm");
2940+ var _ts_query_matches_wasm = Module["_ts_query_matches_wasm"] = createExportWrapper("ts_query_matches_wasm");
2941+ var _ts_query_captures_wasm = Module["_ts_query_captures_wasm"] = createExportWrapper("ts_query_captures_wasm");
2942+ var _iswalpha = Module["_iswalpha"] = createExportWrapper("iswalpha");
2943+ var _towupper = Module["_towupper"] = createExportWrapper("towupper");
2944+ var _iswdigit = Module["_iswdigit"] = createExportWrapper("iswdigit");
2945+ var _iswlower = Module["_iswlower"] = createExportWrapper("iswlower");
2946+ var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location");
2947+ var _memchr = Module["_memchr"] = createExportWrapper("memchr");
2948+ var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() {
2949+ return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments);
2950+ };
2951+ var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() {
2952+ return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments);
2953+ };
2954+ var _strlen = Module["_strlen"] = createExportWrapper("strlen");
2955+ var stackSave = Module["stackSave"] = createExportWrapper("stackSave");
2956+ var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore");
2957+ var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc");
2958+ var _emscripten_stack_set_limits = Module["_emscripten_stack_set_limits"] = function() {
2959+ return (_emscripten_stack_set_limits = Module["_emscripten_stack_set_limits"] = Module["asm"]["emscripten_stack_set_limits"]).apply(null, arguments);
2960+ };
2961+ var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() {
2962+ return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments);
2963+ };
2964+ var _setThrew = Module["_setThrew"] = createExportWrapper("setThrew");
2965+ var __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv = Module["__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv"] = createExportWrapper("_ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv");
2966+ var __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev = Module["__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev"] = createExportWrapper("_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev");
2967+ var __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm = Module["__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm"] = createExportWrapper("_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm");
2968+ var __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm = Module["__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm"] = createExportWrapper("_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm");
2969+ var __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm = Module["__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm"] = createExportWrapper("_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm");
2970+ var __ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm = Module["__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm"] = createExportWrapper("_ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm");
2971+ var __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc = Module["__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc"] = createExportWrapper("_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc");
2972+ var __ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev = Module["__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev"] = createExportWrapper("_ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev");
2973+ var __ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw = Module["__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw"] = createExportWrapper("_ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw");
2974+ var __Znwm = Module["__Znwm"] = createExportWrapper("_Znwm");
2975+ var __ZdlPv = Module["__ZdlPv"] = createExportWrapper("_ZdlPv");
2976+ var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk");
2977+ var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr");
2978+ var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji");
2979+ var _orig$ts_parser_timeout_micros = Module["_orig$ts_parser_timeout_micros"] = createExportWrapper("orig$ts_parser_timeout_micros");
2980+ var _orig$ts_parser_set_timeout_micros = Module["_orig$ts_parser_set_timeout_micros"] = createExportWrapper("orig$ts_parser_set_timeout_micros");
2981+ var _stderr = Module["_stderr"] = 7456;
2982+ var _TRANSFER_BUFFER = Module["_TRANSFER_BUFFER"] = 7472;
2983+ var ___data_end = Module["___data_end"] = 8124;
2984+ var ___THREW__ = Module["___THREW__"] = 8116;
2985+ var ___threwValue = Module["___threwValue"] = 8120;
2986+ var ___cxa_new_handler = Module["___cxa_new_handler"] = 8112;
2987+ if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = function() {
2988+ abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2989+ };
2990+ if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = function() {
2991+ abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2992+ };
2993+ if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = function() {
2994+ abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2995+ };
2996+ if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = function() {
2997+ abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2998+ };
2999+ if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = function() {
3000+ abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3001+ };
3002+ if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = function() {
3003+ abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3004+ };
3005+ Module["allocate"] = allocate;
3006+ if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = function() {
3007+ abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3008+ };
3009+ if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = function() {
3010+ abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3011+ };
3012+ if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = function() {
3013+ abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3014+ };
3015+ if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = function() {
3016+ abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3017+ };
3018+ if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = function() {
3019+ abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3020+ };
3021+ if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = function() {
3022+ abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3023+ };
3024+ if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = function() {
3025+ abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3026+ };
3027+ if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = function() {
3028+ abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3029+ };
3030+ if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = function() {
3031+ abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3032+ };
3033+ if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = function() {
3034+ abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3035+ };
3036+ if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = function() {
3037+ abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3038+ };
3039+ if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = function() {
3040+ abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3041+ };
3042+ if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = function() {
3043+ abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3044+ };
3045+ if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = function() {
3046+ abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3047+ };
3048+ if (!Object.getOwnPropertyDescriptor(Module, "addRunDependency")) Module["addRunDependency"] = function() {
3049+ abort("'addRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3050+ };
3051+ if (!Object.getOwnPropertyDescriptor(Module, "removeRunDependency")) Module["removeRunDependency"] = function() {
3052+ abort("'removeRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3053+ };
3054+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = function() {
3055+ abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3056+ };
3057+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createPath")) Module["FS_createPath"] = function() {
3058+ abort("'FS_createPath' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3059+ };
3060+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createDataFile")) Module["FS_createDataFile"] = function() {
3061+ abort("'FS_createDataFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3062+ };
3063+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createPreloadedFile")) Module["FS_createPreloadedFile"] = function() {
3064+ abort("'FS_createPreloadedFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3065+ };
3066+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createLazyFile")) Module["FS_createLazyFile"] = function() {
3067+ abort("'FS_createLazyFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3068+ };
3069+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = function() {
3070+ abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3071+ };
3072+ if (!Object.getOwnPropertyDescriptor(Module, "FS_createDevice")) Module["FS_createDevice"] = function() {
3073+ abort("'FS_createDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3074+ };
3075+ if (!Object.getOwnPropertyDescriptor(Module, "FS_unlink")) Module["FS_unlink"] = function() {
3076+ abort("'FS_unlink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
3077+ };
3078+ if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = function() {
3079+ abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3080+ };
3081+ if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = function() {
3082+ abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3083+ };
3084+ if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = function() {
3085+ abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3086+ };
3087+ if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = function() {
3088+ abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3089+ };
3090+ if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = function() {
3091+ abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3092+ };
3093+ if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = function() {
3094+ abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3095+ };
3096+ if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = function() {
3097+ abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3098+ };
3099+ if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = function() {
3100+ abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3101+ };
3102+ if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = function() {
3103+ abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3104+ };
3105+ if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = function() {
3106+ abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3107+ };
3108+ if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = function() {
3109+ abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3110+ };
3111+ if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = function() {
3112+ abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3113+ };
3114+ if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = function() {
3115+ abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3116+ };
3117+ if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = function() {
3118+ abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3119+ };
3120+ if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = function() {
3121+ abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3122+ };
3123+ if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = function() {
3124+ abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3125+ };
3126+ if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = function() {
3127+ abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3128+ };
3129+ if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = function() {
3130+ abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3131+ };
3132+ if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = function() {
3133+ abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3134+ };
3135+ if (!Object.getOwnPropertyDescriptor(Module, "setFileTime")) Module["setFileTime"] = function() {
3136+ abort("'setFileTime' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3137+ };
3138+ if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = function() {
3139+ abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3140+ };
3141+ if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = function() {
3142+ abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3143+ };
3144+ if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = function() {
3145+ abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3146+ };
3147+ if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = function() {
3148+ abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3149+ };
3150+ if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = function() {
3151+ abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3152+ };
3153+ if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = function() {
3154+ abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3155+ };
3156+ if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = function() {
3157+ abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3158+ };
3159+ if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = function() {
3160+ abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3161+ };
3162+ if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = function() {
3163+ abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3164+ };
3165+ if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = function() {
3166+ abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3167+ };
3168+ if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = function() {
3169+ abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3170+ };
3171+ if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = function() {
3172+ abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3173+ };
3174+ if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = function() {
3175+ abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3176+ };
3177+ if (!Object.getOwnPropertyDescriptor(Module, "GAI_ERRNO_MESSAGES")) Module["GAI_ERRNO_MESSAGES"] = function() {
3178+ abort("'GAI_ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3179+ };
3180+ if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = function() {
3181+ abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3182+ };
3183+ if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = function() {
3184+ abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3185+ };
3186+ if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = function() {
3187+ abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3188+ };
3189+ if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = function() {
3190+ abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3191+ };
3192+ if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = function() {
3193+ abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3194+ };
3195+ if (!Object.getOwnPropertyDescriptor(Module, "withBuiltinMalloc")) Module["withBuiltinMalloc"] = function() {
3196+ abort("'withBuiltinMalloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3197+ };
3198+ if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = function() {
3199+ abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3200+ };
3201+ if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = function() {
3202+ abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3203+ };
3204+ if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = function() {
3205+ abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3206+ };
3207+ if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = function() {
3208+ abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3209+ };
3210+ if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = function() {
3211+ abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3212+ };
3213+ if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = function() {
3214+ abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3215+ };
3216+ if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = function() {
3217+ abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3218+ };
3219+ if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = function() {
3220+ abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3221+ };
3222+ if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = function() {
3223+ abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3224+ };
3225+ if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = function() {
3226+ abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3227+ };
3228+ if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = function() {
3229+ abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3230+ };
3231+ if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = function() {
3232+ abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3233+ };
3234+ if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = function() {
3235+ abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3236+ };
3237+ if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = function() {
3238+ abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3239+ };
3240+ if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = function() {
3241+ abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3242+ };
3243+ if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = function() {
3244+ abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3245+ };
3246+ if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = function() {
3247+ abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3248+ };
3249+ if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = function() {
3250+ abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3251+ };
3252+ if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = function() {
3253+ abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3254+ };
3255+ if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = function() {
3256+ abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3257+ };
3258+ if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = function() {
3259+ abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3260+ };
3261+ if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = function() {
3262+ abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3263+ };
3264+ if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = function() {
3265+ abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3266+ };
3267+ if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = function() {
3268+ abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3269+ };
3270+ if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = function() {
3271+ abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3272+ };
3273+ if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = function() {
3274+ abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3275+ };
3276+ if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = function() {
3277+ abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3278+ };
3279+ if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = function() {
3280+ abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3281+ };
3282+ if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = function() {
3283+ abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3284+ };
3285+ if (!Object.getOwnPropertyDescriptor(Module, "syscallMmap2")) Module["syscallMmap2"] = function() {
3286+ abort("'syscallMmap2' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3287+ };
3288+ if (!Object.getOwnPropertyDescriptor(Module, "syscallMunmap")) Module["syscallMunmap"] = function() {
3289+ abort("'syscallMunmap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3290+ };
3291+ if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = function() {
3292+ abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3293+ };
3294+ if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = function() {
3295+ abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3296+ };
3297+ if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = function() {
3298+ abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3299+ };
3300+ if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = function() {
3301+ abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3302+ };
3303+ if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = function() {
3304+ abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3305+ };
3306+ if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = function() {
3307+ abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3308+ };
3309+ if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = function() {
3310+ abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3311+ };
3312+ if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = function() {
3313+ abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3314+ };
3315+ if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = function() {
3316+ abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3317+ };
3318+ if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = function() {
3319+ abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3320+ };
3321+ if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = function() {
3322+ abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3323+ };
3324+ if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = function() {
3325+ abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3326+ };
3327+ if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = function() {
3328+ abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3329+ };
3330+ if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = function() {
3331+ abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3332+ };
3333+ if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = function() {
3334+ abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3335+ };
3336+ if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = function() {
3337+ abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3338+ };
3339+ if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = function() {
3340+ abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3341+ };
3342+ if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = function() {
3343+ abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3344+ };
3345+ if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = function() {
3346+ abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3347+ };
3348+ if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = function() {
3349+ abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3350+ };
3351+ if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = function() {
3352+ abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3353+ };
3354+ if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = function() {
3355+ abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3356+ };
3357+ if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = function() {
3358+ abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3359+ };
3360+ if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = function() {
3361+ abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3362+ };
3363+ if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = function() {
3364+ abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3365+ };
3366+ if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = function() {
3367+ abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3368+ };
3369+ if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = function() {
3370+ abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3371+ };
3372+ if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = function() {
3373+ abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3374+ };
3375+ if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = function() {
3376+ abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3377+ };
3378+ if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = function() {
3379+ abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3380+ };
3381+ if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = function() {
3382+ abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3383+ };
3384+ if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = function() {
3385+ abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3386+ };
3387+ if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = function() {
3388+ abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3389+ };
3390+ if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = function() {
3391+ abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3392+ };
3393+ if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = function() {
3394+ abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3395+ };
3396+ if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = function() {
3397+ abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3398+ };
3399+ if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = function() {
3400+ abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3401+ };
3402+ if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = function() {
3403+ abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3404+ };
3405+ if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = function() {
3406+ abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3407+ };
3408+ if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = function() {
3409+ abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3410+ };
3411+ if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = function() {
3412+ abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3413+ };
3414+ if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = function() {
3415+ abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3416+ };
3417+ if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = function() {
3418+ abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3419+ };
3420+ if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = function() {
3421+ abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3422+ };
3423+ if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = function() {
3424+ abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3425+ };
3426+ if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = function() {
3427+ abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3428+ };
3429+ if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = function() {
3430+ abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3431+ };
3432+ if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = function() {
3433+ abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3434+ };
3435+ if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = function() {
3436+ abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3437+ };
3438+ if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = function() {
3439+ abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3440+ };
3441+ if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = function() {
3442+ abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3443+ };
3444+ if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = function() {
3445+ abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3446+ };
3447+ if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = function() {
3448+ abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3449+ };
3450+ if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = function() {
3451+ abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3452+ };
3453+ if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = function() {
3454+ abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3455+ };
3456+ if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = function() {
3457+ abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3458+ };
3459+ if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = function() {
3460+ abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3461+ };
3462+ if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = function() {
3463+ abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3464+ };
3465+ if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = function() {
3466+ abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3467+ };
3468+ if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = function() {
3469+ abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3470+ };
3471+ if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = function() {
3472+ abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3473+ };
3474+ if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = function() {
3475+ abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3476+ };
3477+ if (!Object.getOwnPropertyDescriptor(Module, "resolveGlobalSymbol")) Module["resolveGlobalSymbol"] = function() {
3478+ abort("'resolveGlobalSymbol' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3479+ };
3480+ if (!Object.getOwnPropertyDescriptor(Module, "GOT")) Module["GOT"] = function() {
3481+ abort("'GOT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3482+ };
3483+ if (!Object.getOwnPropertyDescriptor(Module, "GOTHandler")) Module["GOTHandler"] = function() {
3484+ abort("'GOTHandler' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3485+ };
3486+ if (!Object.getOwnPropertyDescriptor(Module, "isInternalSym")) Module["isInternalSym"] = function() {
3487+ abort("'isInternalSym' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3488+ };
3489+ if (!Object.getOwnPropertyDescriptor(Module, "updateGOT")) Module["updateGOT"] = function() {
3490+ abort("'updateGOT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3491+ };
3492+ if (!Object.getOwnPropertyDescriptor(Module, "relocateExports")) Module["relocateExports"] = function() {
3493+ abort("'relocateExports' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3494+ };
3495+ if (!Object.getOwnPropertyDescriptor(Module, "reportUndefinedSymbols")) Module["reportUndefinedSymbols"] = function() {
3496+ abort("'reportUndefinedSymbols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3497+ };
3498+ if (!Object.getOwnPropertyDescriptor(Module, "DLFCN")) Module["DLFCN"] = function() {
3499+ abort("'DLFCN' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3500+ };
3501+ if (!Object.getOwnPropertyDescriptor(Module, "LDSO")) Module["LDSO"] = function() {
3502+ abort("'LDSO' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3503+ };
3504+ if (!Object.getOwnPropertyDescriptor(Module, "createInvokeFunction")) Module["createInvokeFunction"] = function() {
3505+ abort("'createInvokeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3506+ };
3507+ if (!Object.getOwnPropertyDescriptor(Module, "getMemory")) Module["getMemory"] = function() {
3508+ abort("'getMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3509+ };
3510+ if (!Object.getOwnPropertyDescriptor(Module, "getDylinkMetadata")) Module["getDylinkMetadata"] = function() {
3511+ abort("'getDylinkMetadata' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3512+ };
3513+ if (!Object.getOwnPropertyDescriptor(Module, "mergeLibSymbols")) Module["mergeLibSymbols"] = function() {
3514+ abort("'mergeLibSymbols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3515+ };
3516+ if (!Object.getOwnPropertyDescriptor(Module, "loadWebAssemblyModule")) Module["loadWebAssemblyModule"] = function() {
3517+ abort("'loadWebAssemblyModule' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3518+ };
3519+ if (!Object.getOwnPropertyDescriptor(Module, "loadDynamicLibrary")) Module["loadDynamicLibrary"] = function() {
3520+ abort("'loadDynamicLibrary' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3521+ };
3522+ if (!Object.getOwnPropertyDescriptor(Module, "preloadDylibs")) Module["preloadDylibs"] = function() {
3523+ abort("'preloadDylibs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3524+ };
3525+ if (!Object.getOwnPropertyDescriptor(Module, "dlopenInternal")) Module["dlopenInternal"] = function() {
3526+ abort("'dlopenInternal' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3527+ };
3528+ if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = function() {
3529+ abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3530+ };
3531+ if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = function() {
3532+ abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3533+ };
3534+ if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = function() {
3535+ abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3536+ };
3537+ if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = function() {
3538+ abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3539+ };
3540+ if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = function() {
3541+ abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3542+ };
3543+ if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = function() {
3544+ abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3545+ };
3546+ if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = function() {
3547+ abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3548+ };
3549+ if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = function() {
3550+ abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3551+ };
3552+ if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = function() {
3553+ abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3554+ };
3555+ if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = function() {
3556+ abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3557+ };
3558+ if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = function() {
3559+ abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3560+ };
3561+ if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = function() {
3562+ abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3563+ };
3564+ if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = function() {
3565+ abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3566+ };
3567+ if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = function() {
3568+ abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3569+ };
3570+ if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = function() {
3571+ abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3572+ };
3573+ if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = function() {
3574+ abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3575+ };
3576+ if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = function() {
3577+ abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3578+ };
3579+ if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = function() {
3580+ abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3581+ };
3582+ if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = function() {
3583+ abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3584+ };
3585+ if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = function() {
3586+ abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3587+ };
3588+ if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = function() {
3589+ abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3590+ };
3591+ if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = function() {
3592+ abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3593+ };
3594+ if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = function() {
3595+ abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3596+ };
3597+ if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = function() {
3598+ abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3599+ };
3600+ if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = function() {
3601+ abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3602+ };
3603+ if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = function() {
3604+ abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3605+ };
3606+ if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = function() {
3607+ abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3608+ };
3609+ if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = function() {
3610+ abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3611+ };
3612+ if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = function() {
3613+ abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3614+ };
3615+ if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = function() {
3616+ abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3617+ };
3618+ if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = function() {
3619+ abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3620+ };
3621+ if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = function() {
3622+ abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3623+ };
3624+ if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = function() {
3625+ abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3626+ };
3627+ if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = function() {
3628+ abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3629+ };
3630+ if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = function() {
3631+ abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3632+ };
3633+ if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = function() {
3634+ abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3635+ };
3636+ if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = function() {
3637+ abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3638+ };
3639+ if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = function() {
3640+ abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3641+ };
3642+ if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = function() {
3643+ abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3644+ };
3645+ if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = function() {
3646+ abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3647+ };
3648+ if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = function() {
3649+ abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3650+ };
3651+ if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = function() {
3652+ abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3653+ };
3654+ if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = function() {
3655+ abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3656+ };
3657+ if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = function() {
3658+ abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3659+ };
3660+ if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = function() {
3661+ abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3662+ };
3663+ if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = function() {
3664+ abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3665+ };
3666+ if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = function() {
3667+ abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3668+ };
3669+ if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = function() {
3670+ abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3671+ };
3672+ if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = function() {
3673+ abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3674+ };
3675+ if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = function() {
3676+ abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3677+ };
3678+ if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = function() {
3679+ abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3680+ };
3681+ if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = function() {
3682+ abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3683+ };
3684+ if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = function() {
3685+ abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3686+ };
3687+ Module["writeStackCookie"] = writeStackCookie;
3688+ Module["checkStackCookie"] = checkStackCookie;
3689+ if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", {
3690+ configurable: true,
3691+ get: function() {
3692+ abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3693+ }
3694+ });
3695+ if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", {
3696+ configurable: true,
3697+ get: function() {
3698+ abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3699+ }
3700+ });
3701+ var calledRun;
3702+ function ExitStatus(status) {
3703+ this.name = "ExitStatus";
3704+ this.message = "Program terminated with exit(" + status + ")";
3705+ this.status = status;
3706+ }
3707+ var calledMain = false;
3708+ dependenciesFulfilled = function runCaller() {
3709+ if (!calledRun) run();
3710+ if (!calledRun) dependenciesFulfilled = runCaller;
3711+ };
3712+ function callMain(args) {
3713+ assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
3714+ assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called");
3715+ var entryFunction = Module["_main"];
3716+ if (!entryFunction) return;
3717+ args = args || [];
3718+ var argc = args.length + 1;
3719+ var argv = stackAlloc((argc + 1) * 4);
3720+ SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4);
3721+ for (var i = 1; i < argc; i++) {
3722+ SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4);
3723+ }
3724+ SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4);
3725+ try {
3726+ var ret = entryFunction(argc, argv);
3727+ exit(ret, true);
3728+ } catch (e) {
3729+ if (e instanceof ExitStatus || e == "unwind") {
3730+ return;
3731+ }
3732+ var toLog = e;
3733+ if (e && typeof e === "object" && e.stack) {
3734+ toLog = [ e, e.stack ];
3735+ }
3736+ err("exception thrown: " + toLog);
3737+ quit_(1, e);
3738+ } finally {
3739+ calledMain = true;
3740+ }
3741+ }
3742+ function stackCheckInit() {
3743+ _emscripten_stack_set_limits(5251008, 8128);
3744+ writeStackCookie();
3745+ }
3746+ var dylibsLoaded = false;
3747+ function run(args) {
3748+ args = args || arguments_;
3749+ if (runDependencies > 0) {
3750+ return;
3751+ }
3752+ stackCheckInit();
3753+ if (!dylibsLoaded) {
3754+ preloadDylibs();
3755+ dylibsLoaded = true;
3756+ if (runDependencies > 0) {
3757+ return;
3758+ }
3759+ }
3760+ preRun();
3761+ if (runDependencies > 0) {
3762+ return;
3763+ }
3764+ function doRun() {
3765+ if (calledRun) return;
3766+ calledRun = true;
3767+ Module["calledRun"] = true;
3768+ if (ABORT) return;
3769+ initRuntime();
3770+ preMain();
3771+ if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
3772+ if (shouldRunNow) callMain(args);
3773+ postRun();
3774+ }
3775+ if (Module["setStatus"]) {
3776+ Module["setStatus"]("Running...");
3777+ setTimeout(function() {
3778+ setTimeout(function() {
3779+ Module["setStatus"]("");
3780+ }, 1);
3781+ doRun();
3782+ }, 1);
3783+ } else {
3784+ doRun();
3785+ }
3786+ checkStackCookie();
3787+ }
3788+ Module["run"] = run;
3789+ function checkUnflushedContent() {
3790+ var oldOut = out;
3791+ var oldErr = err;
3792+ var has = false;
3793+ out = err = function(x) {
3794+ has = true;
3795+ };
3796+ try {
3797+ var flush = Module["_fflush"];
3798+ if (flush) flush(0);
3799+ } catch (e) {}
3800+ out = oldOut;
3801+ err = oldErr;
3802+ if (has) {
3803+ warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.");
3804+ warnOnce("(this may also be due to not including full filesystem support - try building with -s FORCE_FILESYSTEM=1)");
3805+ }
3806+ }
3807+ function exit(status, implicit) {
3808+ EXITSTATUS = status;
3809+ checkUnflushedContent();
3810+ if (keepRuntimeAlive()) {
3811+ if (!implicit) {
3812+ var msg = "program exited (with status: " + status + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)";
3813+ err(msg);
3814+ }
3815+ } else {
3816+ exitRuntime();
3817+ }
3818+ procExit(status);
3819+ }
3820+ function procExit(code) {
3821+ EXITSTATUS = code;
3822+ if (!keepRuntimeAlive()) {
3823+ if (Module["onExit"]) Module["onExit"](code);
3824+ ABORT = true;
3825+ }
3826+ quit_(code, new ExitStatus(code));
3827+ }
3828+ if (Module["preInit"]) {
3829+ if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
3830+ while (Module["preInit"].length > 0) {
3831+ Module["preInit"].pop()();
3832+ }
3833+ }
3834+ var shouldRunNow = true;
3835+ if (Module["noInitialRun"]) shouldRunNow = false;
3836+ run();
3837+ const C = Module;
3838+ const INTERNAL = {};
3839+ const SIZE_OF_INT = 4;
3840+ const SIZE_OF_NODE = 5 * SIZE_OF_INT;
3841+ const SIZE_OF_POINT = 2 * SIZE_OF_INT;
3842+ const SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT;
3843+ const ZERO_POINT = {
3844+ row: 0,
3845+ column: 0
3846+ };
3847+ const QUERY_WORD_REGEX = /[\w-.]*/g;
3848+ const PREDICATE_STEP_TYPE_CAPTURE = 1;
3849+ const PREDICATE_STEP_TYPE_STRING = 2;
3850+ const LANGUAGE_FUNCTION_REGEX = /^_?tree_sitter_\w+/;
3851+ var VERSION;
3852+ var MIN_COMPATIBLE_VERSION;
3853+ var TRANSFER_BUFFER;
3854+ var currentParseCallback;
3855+ var currentLogCallback;
3856+ class ParserImpl {
3857+ static init() {
3858+ TRANSFER_BUFFER = C._ts_init();
3859+ VERSION = getValue(TRANSFER_BUFFER, "i32");
3860+ MIN_COMPATIBLE_VERSION = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
3861+ }
3862+ initialize() {
3863+ C._ts_parser_new_wasm();
3864+ this[0] = getValue(TRANSFER_BUFFER, "i32");
3865+ this[1] = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
3866+ }
3867+ delete() {
3868+ C._ts_parser_delete(this[0]);
3869+ C._free(this[1]);
3870+ this[0] = 0;
3871+ this[1] = 0;
3872+ }
3873+ setLanguage(language) {
3874+ let address;
3875+ if (!language) {
3876+ address = 0;
3877+ language = null;
3878+ } else if (language.constructor === Language) {
3879+ address = language[0];
3880+ const version = C._ts_language_version(address);
3881+ if (version < MIN_COMPATIBLE_VERSION || VERSION < version) {
3882+ throw new Error(`Incompatible language version ${version}. ` + `Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`);
3883+ }
3884+ } else {
3885+ throw new Error("Argument must be a Language");
3886+ }
3887+ this.language = language;
3888+ C._ts_parser_set_language(this[0], address);
3889+ return this;
3890+ }
3891+ getLanguage() {
3892+ return this.language;
3893+ }
3894+ parse(callback, oldTree, options) {
3895+ if (typeof callback === "string") {
3896+ currentParseCallback = ((index, _, endIndex) => callback.slice(index, endIndex));
3897+ } else if (typeof callback === "function") {
3898+ currentParseCallback = callback;
3899+ } else {
3900+ throw new Error("Argument must be a string or a function");
3901+ }
3902+ if (this.logCallback) {
3903+ currentLogCallback = this.logCallback;
3904+ C._ts_parser_enable_logger_wasm(this[0], 1);
3905+ } else {
3906+ currentLogCallback = null;
3907+ C._ts_parser_enable_logger_wasm(this[0], 0);
3908+ }
3909+ let rangeCount = 0;
3910+ let rangeAddress = 0;
3911+ if (options && options.includedRanges) {
3912+ rangeCount = options.includedRanges.length;
3913+ rangeAddress = C._calloc(rangeCount, SIZE_OF_RANGE);
3914+ let address = rangeAddress;
3915+ for (let i = 0; i < rangeCount; i++) {
3916+ marshalRange(address, options.includedRanges[i]);
3917+ address += SIZE_OF_RANGE;
3918+ }
3919+ }
3920+ const treeAddress = C._ts_parser_parse_wasm(this[0], this[1], oldTree ? oldTree[0] : 0, rangeAddress, rangeCount);
3921+ if (!treeAddress) {
3922+ currentParseCallback = null;
3923+ currentLogCallback = null;
3924+ throw new Error("Parsing failed");
3925+ }
3926+ const result = new Tree(INTERNAL, treeAddress, this.language, currentParseCallback);
3927+ currentParseCallback = null;
3928+ currentLogCallback = null;
3929+ return result;
3930+ }
3931+ reset() {
3932+ C._ts_parser_reset(this[0]);
3933+ }
3934+ setTimeoutMicros(timeout) {
3935+ C._ts_parser_set_timeout_micros(this[0], timeout);
3936+ }
3937+ getTimeoutMicros() {
3938+ return C._ts_parser_timeout_micros(this[0]);
3939+ }
3940+ setLogger(callback) {
3941+ if (!callback) {
3942+ callback = null;
3943+ } else if (typeof callback !== "function") {
3944+ throw new Error("Logger callback must be a function");
3945+ }
3946+ this.logCallback = callback;
3947+ return this;
3948+ }
3949+ getLogger() {
3950+ return this.logCallback;
3951+ }
3952+ }
3953+ class Tree {
3954+ constructor(internal, address, language, textCallback) {
3955+ assertInternal(internal);
3956+ this[0] = address;
3957+ this.language = language;
3958+ this.textCallback = textCallback;
3959+ }
3960+ copy() {
3961+ const address = C._ts_tree_copy(this[0]);
3962+ return new Tree(INTERNAL, address, this.language, this.textCallback);
3963+ }
3964+ delete() {
3965+ C._ts_tree_delete(this[0]);
3966+ this[0] = 0;
3967+ }
3968+ edit(edit) {
3969+ marshalEdit(edit);
3970+ C._ts_tree_edit_wasm(this[0]);
3971+ }
3972+ get rootNode() {
3973+ C._ts_tree_root_node_wasm(this[0]);
3974+ return unmarshalNode(this);
3975+ }
3976+ getLanguage() {
3977+ return this.language;
3978+ }
3979+ walk() {
3980+ return this.rootNode.walk();
3981+ }
3982+ getChangedRanges(other) {
3983+ if (other.constructor !== Tree) {
3984+ throw new TypeError("Argument must be a Tree");
3985+ }
3986+ C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
3987+ const count = getValue(TRANSFER_BUFFER, "i32");
3988+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
3989+ const result = new Array(count);
3990+ if (count > 0) {
3991+ let address = buffer;
3992+ for (let i = 0; i < count; i++) {
3993+ result[i] = unmarshalRange(address);
3994+ address += SIZE_OF_RANGE;
3995+ }
3996+ C._free(buffer);
3997+ }
3998+ return result;
3999+ }
4000+ }
4001+ class Node {
4002+ constructor(internal, tree) {
4003+ assertInternal(internal);
4004+ this.tree = tree;
4005+ }
4006+ get typeId() {
4007+ marshalNode(this);
4008+ return C._ts_node_symbol_wasm(this.tree[0]);
4009+ }
4010+ get type() {
4011+ return this.tree.language.types[this.typeId] || "ERROR";
4012+ }
4013+ get endPosition() {
4014+ marshalNode(this);
4015+ C._ts_node_end_point_wasm(this.tree[0]);
4016+ return unmarshalPoint(TRANSFER_BUFFER);
4017+ }
4018+ get endIndex() {
4019+ marshalNode(this);
4020+ return C._ts_node_end_index_wasm(this.tree[0]);
4021+ }
4022+ get text() {
4023+ return getText(this.tree, this.startIndex, this.endIndex);
4024+ }
4025+ isNamed() {
4026+ marshalNode(this);
4027+ return C._ts_node_is_named_wasm(this.tree[0]) === 1;
4028+ }
4029+ hasError() {
4030+ marshalNode(this);
4031+ return C._ts_node_has_error_wasm(this.tree[0]) === 1;
4032+ }
4033+ hasChanges() {
4034+ marshalNode(this);
4035+ return C._ts_node_has_changes_wasm(this.tree[0]) === 1;
4036+ }
4037+ isMissing() {
4038+ marshalNode(this);
4039+ return C._ts_node_is_missing_wasm(this.tree[0]) === 1;
4040+ }
4041+ equals(other) {
4042+ return this.id === other.id;
4043+ }
4044+ child(index) {
4045+ marshalNode(this);
4046+ C._ts_node_child_wasm(this.tree[0], index);
4047+ return unmarshalNode(this.tree);
4048+ }
4049+ namedChild(index) {
4050+ marshalNode(this);
4051+ C._ts_node_named_child_wasm(this.tree[0], index);
4052+ return unmarshalNode(this.tree);
4053+ }
4054+ childForFieldId(fieldId) {
4055+ marshalNode(this);
4056+ C._ts_node_child_by_field_id_wasm(this.tree[0], fieldId);
4057+ return unmarshalNode(this.tree);
4058+ }
4059+ childForFieldName(fieldName) {
4060+ const fieldId = this.tree.language.fields.indexOf(fieldName);
4061+ if (fieldId !== -1) return this.childForFieldId(fieldId);
4062+ }
4063+ get childCount() {
4064+ marshalNode(this);
4065+ return C._ts_node_child_count_wasm(this.tree[0]);
4066+ }
4067+ get namedChildCount() {
4068+ marshalNode(this);
4069+ return C._ts_node_named_child_count_wasm(this.tree[0]);
4070+ }
4071+ get firstChild() {
4072+ return this.child(0);
4073+ }
4074+ get firstNamedChild() {
4075+ return this.namedChild(0);
4076+ }
4077+ get lastChild() {
4078+ return this.child(this.childCount - 1);
4079+ }
4080+ get lastNamedChild() {
4081+ return this.namedChild(this.namedChildCount - 1);
4082+ }
4083+ get children() {
4084+ if (!this._children) {
4085+ marshalNode(this);
4086+ C._ts_node_children_wasm(this.tree[0]);
4087+ const count = getValue(TRANSFER_BUFFER, "i32");
4088+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4089+ this._children = new Array(count);
4090+ if (count > 0) {
4091+ let address = buffer;
4092+ for (let i = 0; i < count; i++) {
4093+ this._children[i] = unmarshalNode(this.tree, address);
4094+ address += SIZE_OF_NODE;
4095+ }
4096+ C._free(buffer);
4097+ }
4098+ }
4099+ return this._children;
4100+ }
4101+ get namedChildren() {
4102+ if (!this._namedChildren) {
4103+ marshalNode(this);
4104+ C._ts_node_named_children_wasm(this.tree[0]);
4105+ const count = getValue(TRANSFER_BUFFER, "i32");
4106+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4107+ this._namedChildren = new Array(count);
4108+ if (count > 0) {
4109+ let address = buffer;
4110+ for (let i = 0; i < count; i++) {
4111+ this._namedChildren[i] = unmarshalNode(this.tree, address);
4112+ address += SIZE_OF_NODE;
4113+ }
4114+ C._free(buffer);
4115+ }
4116+ }
4117+ return this._namedChildren;
4118+ }
4119+ descendantsOfType(types, startPosition, endPosition) {
4120+ if (!Array.isArray(types)) types = [ types ];
4121+ if (!startPosition) startPosition = ZERO_POINT;
4122+ if (!endPosition) endPosition = ZERO_POINT;
4123+ const symbols = [];
4124+ const typesBySymbol = this.tree.language.types;
4125+ for (let i = 0, n = typesBySymbol.length; i < n; i++) {
4126+ if (types.includes(typesBySymbol[i])) {
4127+ symbols.push(i);
4128+ }
4129+ }
4130+ const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
4131+ for (let i = 0, n = symbols.length; i < n; i++) {
4132+ setValue(symbolsAddress + i * SIZE_OF_INT, symbols[i], "i32");
4133+ }
4134+ marshalNode(this);
4135+ C._ts_node_descendants_of_type_wasm(this.tree[0], symbolsAddress, symbols.length, startPosition.row, startPosition.column, endPosition.row, endPosition.column);
4136+ const descendantCount = getValue(TRANSFER_BUFFER, "i32");
4137+ const descendantAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4138+ const result = new Array(descendantCount);
4139+ if (descendantCount > 0) {
4140+ let address = descendantAddress;
4141+ for (let i = 0; i < descendantCount; i++) {
4142+ result[i] = unmarshalNode(this.tree, address);
4143+ address += SIZE_OF_NODE;
4144+ }
4145+ }
4146+ C._free(descendantAddress);
4147+ C._free(symbolsAddress);
4148+ return result;
4149+ }
4150+ get nextSibling() {
4151+ marshalNode(this);
4152+ C._ts_node_next_sibling_wasm(this.tree[0]);
4153+ return unmarshalNode(this.tree);
4154+ }
4155+ get previousSibling() {
4156+ marshalNode(this);
4157+ C._ts_node_prev_sibling_wasm(this.tree[0]);
4158+ return unmarshalNode(this.tree);
4159+ }
4160+ get nextNamedSibling() {
4161+ marshalNode(this);
4162+ C._ts_node_next_named_sibling_wasm(this.tree[0]);
4163+ return unmarshalNode(this.tree);
4164+ }
4165+ get previousNamedSibling() {
4166+ marshalNode(this);
4167+ C._ts_node_prev_named_sibling_wasm(this.tree[0]);
4168+ return unmarshalNode(this.tree);
4169+ }
4170+ get parent() {
4171+ marshalNode(this);
4172+ C._ts_node_parent_wasm(this.tree[0]);
4173+ return unmarshalNode(this.tree);
4174+ }
4175+ descendantForIndex(start, end = start) {
4176+ if (typeof start !== "number" || typeof end !== "number") {
4177+ throw new Error("Arguments must be numbers");
4178+ }
4179+ marshalNode(this);
4180+ let address = TRANSFER_BUFFER + SIZE_OF_NODE;
4181+ setValue(address, start, "i32");
4182+ setValue(address + SIZE_OF_INT, end, "i32");
4183+ C._ts_node_descendant_for_index_wasm(this.tree[0]);
4184+ return unmarshalNode(this.tree);
4185+ }
4186+ namedDescendantForIndex(start, end = start) {
4187+ if (typeof start !== "number" || typeof end !== "number") {
4188+ throw new Error("Arguments must be numbers");
4189+ }
4190+ marshalNode(this);
4191+ let address = TRANSFER_BUFFER + SIZE_OF_NODE;
4192+ setValue(address, start, "i32");
4193+ setValue(address + SIZE_OF_INT, end, "i32");
4194+ C._ts_node_named_descendant_for_index_wasm(this.tree[0]);
4195+ return unmarshalNode(this.tree);
4196+ }
4197+ descendantForPosition(start, end = start) {
4198+ if (!isPoint(start) || !isPoint(end)) {
4199+ throw new Error("Arguments must be {row, column} objects");
4200+ }
4201+ marshalNode(this);
4202+ let address = TRANSFER_BUFFER + SIZE_OF_NODE;
4203+ marshalPoint(address, start);
4204+ marshalPoint(address + SIZE_OF_POINT, end);
4205+ C._ts_node_descendant_for_position_wasm(this.tree[0]);
4206+ return unmarshalNode(this.tree);
4207+ }
4208+ namedDescendantForPosition(start, end = start) {
4209+ if (!isPoint(start) || !isPoint(end)) {
4210+ throw new Error("Arguments must be {row, column} objects");
4211+ }
4212+ marshalNode(this);
4213+ let address = TRANSFER_BUFFER + SIZE_OF_NODE;
4214+ marshalPoint(address, start);
4215+ marshalPoint(address + SIZE_OF_POINT, end);
4216+ C._ts_node_named_descendant_for_position_wasm(this.tree[0]);
4217+ return unmarshalNode(this.tree);
4218+ }
4219+ walk() {
4220+ marshalNode(this);
4221+ C._ts_tree_cursor_new_wasm(this.tree[0]);
4222+ return new TreeCursor(INTERNAL, this.tree);
4223+ }
4224+ toString() {
4225+ marshalNode(this);
4226+ const address = C._ts_node_to_string_wasm(this.tree[0]);
4227+ const result = AsciiToString(address);
4228+ C._free(address);
4229+ return result;
4230+ }
4231+ }
4232+ class TreeCursor {
4233+ constructor(internal, tree) {
4234+ assertInternal(internal);
4235+ this.tree = tree;
4236+ unmarshalTreeCursor(this);
4237+ }
4238+ delete() {
4239+ marshalTreeCursor(this);
4240+ C._ts_tree_cursor_delete_wasm(this.tree[0]);
4241+ this[0] = this[1] = this[2] = 0;
4242+ }
4243+ reset(node) {
4244+ marshalNode(node);
4245+ marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE);
4246+ C._ts_tree_cursor_reset_wasm(this.tree[0]);
4247+ unmarshalTreeCursor(this);
4248+ }
4249+ get nodeType() {
4250+ return this.tree.language.types[this.nodeTypeId] || "ERROR";
4251+ }
4252+ get nodeTypeId() {
4253+ marshalTreeCursor(this);
4254+ return C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]);
4255+ }
4256+ get nodeId() {
4257+ marshalTreeCursor(this);
4258+ return C._ts_tree_cursor_current_node_id_wasm(this.tree[0]);
4259+ }
4260+ get nodeIsNamed() {
4261+ marshalTreeCursor(this);
4262+ return C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]) === 1;
4263+ }
4264+ get nodeIsMissing() {
4265+ marshalTreeCursor(this);
4266+ return C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]) === 1;
4267+ }
4268+ get nodeText() {
4269+ marshalTreeCursor(this);
4270+ const startIndex = C._ts_tree_cursor_start_index_wasm(this.tree[0]);
4271+ const endIndex = C._ts_tree_cursor_end_index_wasm(this.tree[0]);
4272+ return getText(this.tree, startIndex, endIndex);
4273+ }
4274+ get startPosition() {
4275+ marshalTreeCursor(this);
4276+ C._ts_tree_cursor_start_position_wasm(this.tree[0]);
4277+ return unmarshalPoint(TRANSFER_BUFFER);
4278+ }
4279+ get endPosition() {
4280+ marshalTreeCursor(this);
4281+ C._ts_tree_cursor_end_position_wasm(this.tree[0]);
4282+ return unmarshalPoint(TRANSFER_BUFFER);
4283+ }
4284+ get startIndex() {
4285+ marshalTreeCursor(this);
4286+ return C._ts_tree_cursor_start_index_wasm(this.tree[0]);
4287+ }
4288+ get endIndex() {
4289+ marshalTreeCursor(this);
4290+ return C._ts_tree_cursor_end_index_wasm(this.tree[0]);
4291+ }
4292+ currentNode() {
4293+ marshalTreeCursor(this);
4294+ C._ts_tree_cursor_current_node_wasm(this.tree[0]);
4295+ return unmarshalNode(this.tree);
4296+ }
4297+ currentFieldId() {
4298+ marshalTreeCursor(this);
4299+ return C._ts_tree_cursor_current_field_id_wasm(this.tree[0]);
4300+ }
4301+ currentFieldName() {
4302+ return this.tree.language.fields[this.currentFieldId()];
4303+ }
4304+ gotoFirstChild() {
4305+ marshalTreeCursor(this);
4306+ const result = C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);
4307+ unmarshalTreeCursor(this);
4308+ return result === 1;
4309+ }
4310+ gotoNextSibling() {
4311+ marshalTreeCursor(this);
4312+ const result = C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);
4313+ unmarshalTreeCursor(this);
4314+ return result === 1;
4315+ }
4316+ gotoParent() {
4317+ marshalTreeCursor(this);
4318+ const result = C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);
4319+ unmarshalTreeCursor(this);
4320+ return result === 1;
4321+ }
4322+ }
4323+ class Language {
4324+ constructor(internal, address) {
4325+ assertInternal(internal);
4326+ this[0] = address;
4327+ this.types = new Array(C._ts_language_symbol_count(this[0]));
4328+ for (let i = 0, n = this.types.length; i < n; i++) {
4329+ if (C._ts_language_symbol_type(this[0], i) < 2) {
4330+ this.types[i] = UTF8ToString(C._ts_language_symbol_name(this[0], i));
4331+ }
4332+ }
4333+ this.fields = new Array(C._ts_language_field_count(this[0]) + 1);
4334+ for (let i = 0, n = this.fields.length; i < n; i++) {
4335+ const fieldName = C._ts_language_field_name_for_id(this[0], i);
4336+ if (fieldName !== 0) {
4337+ this.fields[i] = UTF8ToString(fieldName);
4338+ } else {
4339+ this.fields[i] = null;
4340+ }
4341+ }
4342+ }
4343+ get version() {
4344+ return C._ts_language_version(this[0]);
4345+ }
4346+ get fieldCount() {
4347+ return this.fields.length - 1;
4348+ }
4349+ fieldIdForName(fieldName) {
4350+ const result = this.fields.indexOf(fieldName);
4351+ if (result !== -1) {
4352+ return result;
4353+ } else {
4354+ return null;
4355+ }
4356+ }
4357+ fieldNameForId(fieldId) {
4358+ return this.fields[fieldId] || null;
4359+ }
4360+ idForNodeType(type, named) {
4361+ const typeLength = lengthBytesUTF8(type);
4362+ const typeAddress = C._malloc(typeLength + 1);
4363+ stringToUTF8(type, typeAddress, typeLength + 1);
4364+ const result = C._ts_language_symbol_for_name(this[0], typeAddress, typeLength, named);
4365+ C._free(typeAddress);
4366+ return result || null;
4367+ }
4368+ get nodeTypeCount() {
4369+ return C._ts_language_symbol_count(this[0]);
4370+ }
4371+ nodeTypeForId(typeId) {
4372+ const name = C._ts_language_symbol_name(this[0], typeId);
4373+ return name ? UTF8ToString(name) : null;
4374+ }
4375+ nodeTypeIsNamed(typeId) {
4376+ return C._ts_language_type_is_named_wasm(this[0], typeId) ? true : false;
4377+ }
4378+ nodeTypeIsVisible(typeId) {
4379+ return C._ts_language_type_is_visible_wasm(this[0], typeId) ? true : false;
4380+ }
4381+ query(source) {
4382+ const sourceLength = lengthBytesUTF8(source);
4383+ const sourceAddress = C._malloc(sourceLength + 1);
4384+ stringToUTF8(source, sourceAddress, sourceLength + 1);
4385+ const address = C._ts_query_new(this[0], sourceAddress, sourceLength, TRANSFER_BUFFER, TRANSFER_BUFFER + SIZE_OF_INT);
4386+ if (!address) {
4387+ const errorId = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4388+ const errorByte = getValue(TRANSFER_BUFFER, "i32");
4389+ const errorIndex = UTF8ToString(sourceAddress, errorByte).length;
4390+ const suffix = source.substr(errorIndex, 100).split("\n")[0];
4391+ let word = suffix.match(QUERY_WORD_REGEX)[0];
4392+ let error;
4393+ switch (errorId) {
4394+ case 2:
4395+ error = new RangeError(`Bad node name '${word}'`);
4396+ break;
4397+
4398+ case 3:
4399+ error = new RangeError(`Bad field name '${word}'`);
4400+ break;
4401+
4402+ case 4:
4403+ error = new RangeError(`Bad capture name @${word}`);
4404+ break;
4405+
4406+ case 5:
4407+ error = new TypeError(`Bad pattern structure at offset ${errorIndex}: '${suffix}'...`);
4408+ word = "";
4409+ break;
4410+
4411+ default:
4412+ error = new SyntaxError(`Bad syntax at offset ${errorIndex}: '${suffix}'...`);
4413+ word = "";
4414+ break;
4415+ }
4416+ error.index = errorIndex;
4417+ error.length = word.length;
4418+ C._free(sourceAddress);
4419+ throw error;
4420+ }
4421+ const stringCount = C._ts_query_string_count(address);
4422+ const captureCount = C._ts_query_capture_count(address);
4423+ const patternCount = C._ts_query_pattern_count(address);
4424+ const captureNames = new Array(captureCount);
4425+ const stringValues = new Array(stringCount);
4426+ for (let i = 0; i < captureCount; i++) {
4427+ const nameAddress = C._ts_query_capture_name_for_id(address, i, TRANSFER_BUFFER);
4428+ const nameLength = getValue(TRANSFER_BUFFER, "i32");
4429+ captureNames[i] = UTF8ToString(nameAddress, nameLength);
4430+ }
4431+ for (let i = 0; i < stringCount; i++) {
4432+ const valueAddress = C._ts_query_string_value_for_id(address, i, TRANSFER_BUFFER);
4433+ const nameLength = getValue(TRANSFER_BUFFER, "i32");
4434+ stringValues[i] = UTF8ToString(valueAddress, nameLength);
4435+ }
4436+ const setProperties = new Array(patternCount);
4437+ const assertedProperties = new Array(patternCount);
4438+ const refutedProperties = new Array(patternCount);
4439+ const predicates = new Array(patternCount);
4440+ const textPredicates = new Array(patternCount);
4441+ for (let i = 0; i < patternCount; i++) {
4442+ const predicatesAddress = C._ts_query_predicates_for_pattern(address, i, TRANSFER_BUFFER);
4443+ const stepCount = getValue(TRANSFER_BUFFER, "i32");
4444+ predicates[i] = [];
4445+ textPredicates[i] = [];
4446+ const steps = [];
4447+ let stepAddress = predicatesAddress;
4448+ for (let j = 0; j < stepCount; j++) {
4449+ const stepType = getValue(stepAddress, "i32");
4450+ stepAddress += SIZE_OF_INT;
4451+ const stepValueId = getValue(stepAddress, "i32");
4452+ stepAddress += SIZE_OF_INT;
4453+ if (stepType === PREDICATE_STEP_TYPE_CAPTURE) {
4454+ steps.push({
4455+ type: "capture",
4456+ name: captureNames[stepValueId]
4457+ });
4458+ } else if (stepType === PREDICATE_STEP_TYPE_STRING) {
4459+ steps.push({
4460+ type: "string",
4461+ value: stringValues[stepValueId]
4462+ });
4463+ } else if (steps.length > 0) {
4464+ if (steps[0].type !== "string") {
4465+ throw new Error("Predicates must begin with a literal value");
4466+ }
4467+ const operator = steps[0].value;
4468+ let isPositive = true;
4469+ switch (operator) {
4470+ case "not-eq?":
4471+ isPositive = false;
4472+
4473+ case "eq?":
4474+ if (steps.length !== 3) throw new Error(`Wrong number of arguments to \`#eq?\` predicate. Expected 2, got ${steps.length - 1}`);
4475+ if (steps[1].type !== "capture") throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${steps[1].value}"`);
4476+ if (steps[2].type === "capture") {
4477+ const captureName1 = steps[1].name;
4478+ const captureName2 = steps[2].name;
4479+ textPredicates[i].push(function(captures) {
4480+ let node1, node2;
4481+ for (const c of captures) {
4482+ if (c.name === captureName1) node1 = c.node;
4483+ if (c.name === captureName2) node2 = c.node;
4484+ }
4485+ if (node1 === undefined || node2 === undefined) return true;
4486+ return node1.text === node2.text === isPositive;
4487+ });
4488+ } else {
4489+ const captureName = steps[1].name;
4490+ const stringValue = steps[2].value;
4491+ textPredicates[i].push(function(captures) {
4492+ for (const c of captures) {
4493+ if (c.name === captureName) {
4494+ return c.node.text === stringValue === isPositive;
4495+ }
4496+ }
4497+ return true;
4498+ });
4499+ }
4500+ break;
4501+
4502+ case "not-match?":
4503+ isPositive = false;
4504+
4505+ case "match?":
4506+ if (steps.length !== 3) throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${steps.length - 1}.`);
4507+ if (steps[1].type !== "capture") throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${steps[1].value}".`);
4508+ if (steps[2].type !== "string") throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${steps[2].value}.`);
4509+ const captureName = steps[1].name;
4510+ const regex = new RegExp(steps[2].value);
4511+ textPredicates[i].push(function(captures) {
4512+ for (const c of captures) {
4513+ if (c.name === captureName) return regex.test(c.node.text) === isPositive;
4514+ }
4515+ return true;
4516+ });
4517+ break;
4518+
4519+ case "set!":
4520+ if (steps.length < 2 || steps.length > 3) throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
4521+ if (steps.some(s => s.type !== "string")) throw new Error(`Arguments to \`#set!\` predicate must be a strings.".`);
4522+ if (!setProperties[i]) setProperties[i] = {};
4523+ setProperties[i][steps[1].value] = steps[2] ? steps[2].value : null;
4524+ break;
4525+
4526+ case "is?":
4527+ case "is-not?":
4528+ if (steps.length < 2 || steps.length > 3) throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
4529+ if (steps.some(s => s.type !== "string")) throw new Error(`Arguments to \`#${operator}\` predicate must be a strings.".`);
4530+ const properties = operator === "is?" ? assertedProperties : refutedProperties;
4531+ if (!properties[i]) properties[i] = {};
4532+ properties[i][steps[1].value] = steps[2] ? steps[2].value : null;
4533+ break;
4534+
4535+ default:
4536+ predicates[i].push({
4537+ operator: operator,
4538+ operands: steps.slice(1)
4539+ });
4540+ }
4541+ steps.length = 0;
4542+ }
4543+ }
4544+ Object.freeze(setProperties[i]);
4545+ Object.freeze(assertedProperties[i]);
4546+ Object.freeze(refutedProperties[i]);
4547+ }
4548+ C._free(sourceAddress);
4549+ return new Query(INTERNAL, address, captureNames, textPredicates, predicates, Object.freeze(setProperties), Object.freeze(assertedProperties), Object.freeze(refutedProperties));
4550+ }
4551+ static load(input) {
4552+ let bytes;
4553+ if (input instanceof Uint8Array) {
4554+ bytes = Promise.resolve(input);
4555+ } else {
4556+ const url = input;
4557+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
4558+ const fs = require("fs");
4559+ bytes = Promise.resolve(fs.readFileSync(url));
4560+ } else {
4561+ bytes = fetch(url).then(response => response.arrayBuffer().then(buffer => {
4562+ if (response.ok) {
4563+ return new Uint8Array(buffer);
4564+ } else {
4565+ const body = new TextDecoder("utf-8").decode(buffer);
4566+ throw new Error(`Language.load failed with status ${response.status}.\n\n${body}`);
4567+ }
4568+ }));
4569+ }
4570+ }
4571+ const loadModule = typeof loadSideModule === "function" ? loadSideModule : loadWebAssemblyModule;
4572+ return bytes.then(bytes => loadModule(bytes, {
4573+ loadAsync: true
4574+ })).then(mod => {
4575+ const symbolNames = Object.keys(mod);
4576+ const functionName = symbolNames.find(key => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
4577+ if (!functionName) {
4578+ console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(symbolNames, null, 2)}`);
4579+ }
4580+ const languageAddress = mod[functionName]();
4581+ return new Language(INTERNAL, languageAddress);
4582+ });
4583+ }
4584+ }
4585+ class Query {
4586+ constructor(internal, address, captureNames, textPredicates, predicates, setProperties, assertedProperties, refutedProperties) {
4587+ assertInternal(internal);
4588+ this[0] = address;
4589+ this.captureNames = captureNames;
4590+ this.textPredicates = textPredicates;
4591+ this.predicates = predicates;
4592+ this.setProperties = setProperties;
4593+ this.assertedProperties = assertedProperties;
4594+ this.refutedProperties = refutedProperties;
4595+ this.exceededMatchLimit = false;
4596+ }
4597+ delete() {
4598+ C._ts_query_delete(this[0]);
4599+ this[0] = 0;
4600+ }
4601+ matches(node, startPosition, endPosition, options) {
4602+ if (!startPosition) startPosition = ZERO_POINT;
4603+ if (!endPosition) endPosition = ZERO_POINT;
4604+ if (!options) options = {};
4605+ let matchLimit = options.matchLimit;
4606+ if (typeof matchLimit === "undefined") {
4607+ matchLimit = 0;
4608+ } else if (typeof matchLimit !== "number") {
4609+ throw new Error("Arguments must be numbers");
4610+ }
4611+ marshalNode(node);
4612+ C._ts_query_matches_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, matchLimit);
4613+ const rawCount = getValue(TRANSFER_BUFFER, "i32");
4614+ const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4615+ const didExceedMatchLimit = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
4616+ const result = new Array(rawCount);
4617+ this.exceededMatchLimit = !!didExceedMatchLimit;
4618+ let filteredCount = 0;
4619+ let address = startAddress;
4620+ for (let i = 0; i < rawCount; i++) {
4621+ const pattern = getValue(address, "i32");
4622+ address += SIZE_OF_INT;
4623+ const captureCount = getValue(address, "i32");
4624+ address += SIZE_OF_INT;
4625+ const captures = new Array(captureCount);
4626+ address = unmarshalCaptures(this, node.tree, address, captures);
4627+ if (this.textPredicates[pattern].every(p => p(captures))) {
4628+ result[filteredCount++] = {
4629+ pattern: pattern,
4630+ captures: captures
4631+ };
4632+ const setProperties = this.setProperties[pattern];
4633+ if (setProperties) result[i].setProperties = setProperties;
4634+ const assertedProperties = this.assertedProperties[pattern];
4635+ if (assertedProperties) result[i].assertedProperties = assertedProperties;
4636+ const refutedProperties = this.refutedProperties[pattern];
4637+ if (refutedProperties) result[i].refutedProperties = refutedProperties;
4638+ }
4639+ }
4640+ result.length = filteredCount;
4641+ C._free(startAddress);
4642+ return result;
4643+ }
4644+ captures(node, startPosition, endPosition, options) {
4645+ if (!startPosition) startPosition = ZERO_POINT;
4646+ if (!endPosition) endPosition = ZERO_POINT;
4647+ if (!options) options = {};
4648+ let matchLimit = options.matchLimit;
4649+ if (typeof matchLimit === "undefined") {
4650+ matchLimit = 0;
4651+ } else if (typeof matchLimit !== "number") {
4652+ throw new Error("Arguments must be numbers");
4653+ }
4654+ marshalNode(node);
4655+ C._ts_query_captures_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, matchLimit);
4656+ const count = getValue(TRANSFER_BUFFER, "i32");
4657+ const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
4658+ const didExceedMatchLimit = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
4659+ const result = [];
4660+ this.exceededMatchLimit = !!didExceedMatchLimit;
4661+ const captures = [];
4662+ let address = startAddress;
4663+ for (let i = 0; i < count; i++) {
4664+ const pattern = getValue(address, "i32");
4665+ address += SIZE_OF_INT;
4666+ const captureCount = getValue(address, "i32");
4667+ address += SIZE_OF_INT;
4668+ const captureIndex = getValue(address, "i32");
4669+ address += SIZE_OF_INT;
4670+ captures.length = captureCount;
4671+ address = unmarshalCaptures(this, node.tree, address, captures);
4672+ if (this.textPredicates[pattern].every(p => p(captures))) {
4673+ const capture = captures[captureIndex];
4674+ const setProperties = this.setProperties[pattern];
4675+ if (setProperties) capture.setProperties = setProperties;
4676+ const assertedProperties = this.assertedProperties[pattern];
4677+ if (assertedProperties) capture.assertedProperties = assertedProperties;
4678+ const refutedProperties = this.refutedProperties[pattern];
4679+ if (refutedProperties) capture.refutedProperties = refutedProperties;
4680+ result.push(capture);
4681+ }
4682+ }
4683+ C._free(startAddress);
4684+ return result;
4685+ }
4686+ predicatesForPattern(patternIndex) {
4687+ return this.predicates[patternIndex];
4688+ }
4689+ didExceedMatchLimit() {
4690+ return this.exceededMatchLimit;
4691+ }
4692+ }
4693+ function getText(tree, startIndex, endIndex) {
4694+ const length = endIndex - startIndex;
4695+ let result = tree.textCallback(startIndex, null, endIndex);
4696+ startIndex += result.length;
4697+ while (startIndex < endIndex) {
4698+ const string = tree.textCallback(startIndex, null, endIndex);
4699+ if (string && string.length > 0) {
4700+ startIndex += string.length;
4701+ result += string;
4702+ } else {
4703+ break;
4704+ }
4705+ }
4706+ if (startIndex > endIndex) {
4707+ result = result.slice(0, length);
4708+ }
4709+ return result;
4710+ }
4711+ function unmarshalCaptures(query, tree, address, result) {
4712+ for (let i = 0, n = result.length; i < n; i++) {
4713+ const captureIndex = getValue(address, "i32");
4714+ address += SIZE_OF_INT;
4715+ const node = unmarshalNode(tree, address);
4716+ address += SIZE_OF_NODE;
4717+ result[i] = {
4718+ name: query.captureNames[captureIndex],
4719+ node: node
4720+ };
4721+ }
4722+ return address;
4723+ }
4724+ function assertInternal(x) {
4725+ if (x !== INTERNAL) throw new Error("Illegal constructor");
4726+ }
4727+ function isPoint(point) {
4728+ return point && typeof point.row === "number" && typeof point.column === "number";
4729+ }
4730+ function marshalNode(node) {
4731+ let address = TRANSFER_BUFFER;
4732+ setValue(address, node.id, "i32");
4733+ address += SIZE_OF_INT;
4734+ setValue(address, node.startIndex, "i32");
4735+ address += SIZE_OF_INT;
4736+ setValue(address, node.startPosition.row, "i32");
4737+ address += SIZE_OF_INT;
4738+ setValue(address, node.startPosition.column, "i32");
4739+ address += SIZE_OF_INT;
4740+ setValue(address, node[0], "i32");
4741+ }
4742+ function unmarshalNode(tree, address = TRANSFER_BUFFER) {
4743+ const id = getValue(address, "i32");
4744+ address += SIZE_OF_INT;
4745+ if (id === 0) return null;
4746+ const index = getValue(address, "i32");
4747+ address += SIZE_OF_INT;
4748+ const row = getValue(address, "i32");
4749+ address += SIZE_OF_INT;
4750+ const column = getValue(address, "i32");
4751+ address += SIZE_OF_INT;
4752+ const other = getValue(address, "i32");
4753+ const result = new Node(INTERNAL, tree);
4754+ result.id = id;
4755+ result.startIndex = index;
4756+ result.startPosition = {
4757+ row: row,
4758+ column: column
4759+ };
4760+ result[0] = other;
4761+ return result;
4762+ }
4763+ function marshalTreeCursor(cursor, address = TRANSFER_BUFFER) {
4764+ setValue(address + 0 * SIZE_OF_INT, cursor[0], "i32"), setValue(address + 1 * SIZE_OF_INT, cursor[1], "i32"),
4765+ setValue(address + 2 * SIZE_OF_INT, cursor[2], "i32");
4766+ }
4767+ function unmarshalTreeCursor(cursor) {
4768+ cursor[0] = getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32"), cursor[1] = getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32"),
4769+ cursor[2] = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
4770+ }
4771+ function marshalPoint(address, point) {
4772+ setValue(address, point.row, "i32");
4773+ setValue(address + SIZE_OF_INT, point.column, "i32");
4774+ }
4775+ function unmarshalPoint(address) {
4776+ return {
4777+ row: getValue(address, "i32"),
4778+ column: getValue(address + SIZE_OF_INT, "i32")
4779+ };
4780+ }
4781+ function marshalRange(address, range) {
4782+ marshalPoint(address, range.startPosition);
4783+ address += SIZE_OF_POINT;
4784+ marshalPoint(address, range.endPosition);
4785+ address += SIZE_OF_POINT;
4786+ setValue(address, range.startIndex, "i32");
4787+ address += SIZE_OF_INT;
4788+ setValue(address, range.endIndex, "i32");
4789+ address += SIZE_OF_INT;
4790+ }
4791+ function unmarshalRange(address) {
4792+ const result = {};
4793+ result.startPosition = unmarshalPoint(address);
4794+ address += SIZE_OF_POINT;
4795+ result.endPosition = unmarshalPoint(address);
4796+ address += SIZE_OF_POINT;
4797+ result.startIndex = getValue(address, "i32");
4798+ address += SIZE_OF_INT;
4799+ result.endIndex = getValue(address, "i32");
4800+ return result;
4801+ }
4802+ function marshalEdit(edit) {
4803+ let address = TRANSFER_BUFFER;
4804+ marshalPoint(address, edit.startPosition);
4805+ address += SIZE_OF_POINT;
4806+ marshalPoint(address, edit.oldEndPosition);
4807+ address += SIZE_OF_POINT;
4808+ marshalPoint(address, edit.newEndPosition);
4809+ address += SIZE_OF_POINT;
4810+ setValue(address, edit.startIndex, "i32");
4811+ address += SIZE_OF_INT;
4812+ setValue(address, edit.oldEndIndex, "i32");
4813+ address += SIZE_OF_INT;
4814+ setValue(address, edit.newEndIndex, "i32");
4815+ address += SIZE_OF_INT;
4816+ }
4817+ for (const name of Object.getOwnPropertyNames(ParserImpl.prototype)) {
4818+ Object.defineProperty(Parser.prototype, name, {
4819+ value: ParserImpl.prototype[name],
4820+ enumerable: false,
4821+ writable: false
4822+ });
4823+ }
4824+ Parser.Language = Language;
4825+ Module.onRuntimeInitialized = (() => {
4826+ ParserImpl.init();
4827+ resolveInitPromise();
4828+ });
4829+ });
4830+ }
4831+ }
4832+ return Parser;
4833+ }();
4834+
4835+ if (typeof exports === "object") {
4836+ module.exports = TreeSitter;
4837+ }
4838 diff --git a/docs/tree-sitter.wasm b/docs/tree-sitter.wasm
4839new file mode 100644
4840index 0000000..e93f28c
4841 Binary files /dev/null and b/docs/tree-sitter.wasm differ
4842 diff --git a/tree-sitter-git_diff.wasm b/tree-sitter-git_diff.wasm
4843index 5d0dcfc..92ae9d7 100755
4844 Binary files a/tree-sitter-git_diff.wasm and b/tree-sitter-git_diff.wasm differ