k-l-lambda commited on
Commit
d605f27
·
1 Parent(s): 4cadbaf

commit lotus dist.

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +1 -0
  2. Dockerfile +15 -0
  3. backend/advancedEngraver.ts +169 -0
  4. backend/canvas.ts +26 -0
  5. backend/constants.ts +13 -0
  6. backend/dirServer.ts +41 -0
  7. backend/index.ts +155 -0
  8. backend/lilyAddon.ts +104 -0
  9. backend/lilyCommands.ts +438 -0
  10. backend/loadJisonParserNode.ts +22 -0
  11. backend/loadLilyParserNode.ts +8 -0
  12. backend/scoreMaker.ts +359 -0
  13. backend/scoreMaker.ts.old +665 -0
  14. backend/statStorage.ts +34 -0
  15. backend/walkDir.ts +35 -0
  16. backend/xmlTools.ts +214 -0
  17. dist/e5c1442134f1e7dfb9dd.worker.js +0 -0
  18. dist/favicon.ico +0 -0
  19. dist/index.html +1 -0
  20. dist/js/chunk-04395031.dbff2f6b.js +0 -0
  21. dist/js/chunk-0c4e36c8.95d70738.js +16 -0
  22. dist/js/chunk-0cbfe13e.73856287.js +2 -0
  23. dist/js/chunk-117382e0.d47336d3.js +2 -0
  24. dist/js/chunk-2d0c53c7.d24941b8.js +2 -0
  25. dist/js/chunk-2d0db258.a4804a7a.js +2 -0
  26. dist/js/chunk-40965e1a.74707226.js +2 -0
  27. dist/js/chunk-48b5b2a0.3db5a0aa.js +0 -0
  28. dist/js/chunk-a06ef50c.1caef24f.js +2 -0
  29. dist/js/chunk-ae402692.003457bc.js +0 -0
  30. dist/js/chunk-vendors.20f7f886.js +8 -0
  31. dist/js/index.cbb15892.js +2 -0
  32. dist/soundfont/acoustic_grand_piano-mp3.js +0 -0
  33. dist/soundfont/acoustic_grand_piano-ogg.js +0 -0
  34. inc/DictArray.ts +35 -0
  35. inc/asyncCall.ts +11 -0
  36. inc/constants.ts +38 -0
  37. inc/domUtils.ts +49 -0
  38. inc/jisonWrapper.ts +34 -0
  39. inc/jsonRecovery.ts +41 -0
  40. inc/lilyNotation/fuzzyMatch.ts +125 -0
  41. inc/lilyNotation/implicitType.ts +16 -0
  42. inc/lilyNotation/index.ts +27 -0
  43. inc/lilyNotation/matcher.ts +191 -0
  44. inc/lilyNotation/notation.ts +675 -0
  45. inc/lilyNotation/scheduler.ts +167 -0
  46. inc/lilyParser/idioms.ts +51 -0
  47. inc/lilyParser/index.ts +28 -0
  48. inc/lilyParser/lilyDocument.ts +1062 -0
  49. inc/lilyParser/lilyInterpreter.ts +1476 -0
  50. inc/lilyParser/lilyTerms.ts +2991 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.map
Dockerfile CHANGED
@@ -24,6 +24,21 @@ WORKDIR /app
24
  # Copy the entire project including node_modules
25
  COPY . .
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  # Expose port
28
  EXPOSE 7860
29
 
 
24
  # Copy the entire project including node_modules
25
  COPY . .
26
 
27
+ # Remove .env.local if exists
28
+ RUN rm -f .env.local
29
+
30
+ # Set all environment variables
31
+ ENV PORT=7860
32
+ ENV HOST=0.0.0.0
33
+ ENV LILYPOND_DATADIR=/app/node-addon-lilypond/output/share/lilypond/current/
34
+ ENV GUILE_LOAD_PATH=/app/node-addon-lilypond/output/share/guile/1.8
35
+ ENV LD_LIBRARY_PATH=/app/node-addon-lilypond/output
36
+ ENV LILYPOND_ADDON=/app/node-addon-lilypond/output/lilypond.node
37
+
38
+ ENV TEMP_DIR=./temp/
39
+ ENV LILYPOND_DIR=""
40
+ ENV MIDI_FILE_EXTEND=midi
41
+
42
  # Expose port
43
  EXPOSE 7860
44
 
backend/advancedEngraver.ts ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {Writable} from "stream";
3
+ import {MusicNotation} from "@k-l-lambda/music-widgets";
4
+ import {DOMParser} from "xmldom";
5
+
6
+ import {LilyDocument, docLocationSet} from "../inc/lilyParser";
7
+ import {engraveSvg} from "./lilyCommands";
8
+ import {SingleLock} from "../inc/mutex";
9
+ import * as staffSvg from "../inc/staffSvg";
10
+ import * as LilyNotation from "../inc/lilyNotation";
11
+ import LogRecorder from "../inc/logRecorder";
12
+
13
+
14
+
15
+ type StaffArguments = {attributes: staffSvg.StaffAttributes, tieLocations?: Set<string>, briefChordLocations?: Set<string>, lyricLocations?: Set<string>};
16
+
17
+
18
+ interface EngraverOptions {
19
+ streamSeparator: string;
20
+
21
+ includeFolders: string[];
22
+ withMIDI: boolean;
23
+ withNotation: boolean;
24
+ withLilyDoc: boolean;
25
+ withLilyNotation: boolean;
26
+ logger: LogRecorder;
27
+
28
+ lilyNotation: LilyNotation.Notation;
29
+ staffArgs: StaffArguments;
30
+ };
31
+
32
+
33
+ interface GrammarParser {
34
+ parse (source: string): any;
35
+ };
36
+
37
+
38
+ const STREAM_SEPARATOR = "\n\n\n\n";
39
+
40
+
41
+ const advancedEngrave = async (source: string, lilyParser: GrammarParser, output: Writable, options: Partial<EngraverOptions> = {}) => {
42
+ const {streamSeparator = STREAM_SEPARATOR} = options;
43
+
44
+ const outputJSON = data => setImmediate(() => {
45
+ output.write(JSON.stringify(data));
46
+ output.write(streamSeparator);
47
+ });
48
+
49
+ const t0 = Date.now();
50
+
51
+ const notatioinGen = new SingleLock<LilyNotation.Notation>(true);
52
+ const argsGen = new SingleLock<StaffArguments>(true);
53
+
54
+ const hashKeys = new Set<string>();
55
+
56
+ const engraving = await engraveSvg(source, {
57
+ includeFolders: options.includeFolders,
58
+
59
+ // do some work during lilypond process running to save time
60
+ onProcStart: () => {
61
+ //console.log("tp.0:", Date.now() - t0);
62
+ if (options.staffArgs)
63
+ argsGen.release(options.staffArgs);
64
+
65
+ if (!options.withLilyNotation && !options.withLilyDoc && options.staffArgs)
66
+ return;
67
+
68
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
69
+
70
+ if (!options.lilyNotation) {
71
+ const interpreter = lilyDocument.interpret();
72
+ options.lilyNotation = interpreter.getNotation();
73
+
74
+ notatioinGen.release(options.lilyNotation);
75
+ //console.log("tp.1:", Date.now() - t0);
76
+ }
77
+
78
+ if (options.withLilyDoc)
79
+ outputJSON({lilyDocument: lilyDocument.root});
80
+
81
+ if (!options.staffArgs) {
82
+ const attributes = lilyDocument.globalAttributes({readonly: true}) as staffSvg.StaffAttributes;
83
+
84
+ const tieLocations = docLocationSet(lilyDocument.getTiedNoteLocations2());
85
+ const briefChordLocations = docLocationSet(lilyDocument.getBriefChordLocations());
86
+ const lyricLocations = docLocationSet(lilyDocument.getLyricLocations());
87
+
88
+ //console.log("tp.2:", Date.now() - t0);
89
+
90
+ options.staffArgs = {attributes, tieLocations, briefChordLocations, lyricLocations};
91
+ argsGen.release(options.staffArgs);
92
+ //console.log("tp.3:", Date.now() - t0);
93
+ }
94
+ },
95
+ onMidiRead: async midi => {
96
+ //console.log("tm.0:", Date.now() - t0);
97
+ if (options.withMIDI)
98
+ outputJSON({midi});
99
+
100
+ if (options.withNotation && midi) {
101
+ const midiNotation = MusicNotation.Notation.parseMidi(midi);
102
+ outputJSON({midiNotation});
103
+ }
104
+
105
+ if (options.withLilyNotation && midi) {
106
+ const lilyNotation = options.lilyNotation || await notatioinGen.wait();
107
+ //console.log("tm.2:", Date.now() - t0);
108
+ await LilyNotation.matchWithExactMIDI(lilyNotation, midi);
109
+ //console.log("tm.3:", Date.now() - t0);
110
+
111
+ outputJSON({lilyNotation});
112
+ }
113
+
114
+ //console.log("tm.4:", Date.now() - t0);
115
+ },
116
+ onSvgRead: async (index, svg) => {
117
+ //console.log("ts.0:", index, Date.now() - t0);
118
+ const args = options.staffArgs || await argsGen.wait();
119
+ //console.log("ts.1:", index, Date.now() - t0);
120
+ const page = staffSvg.parseSvgPage(svg, source, {DOMParser, logger: options.logger, ...args});
121
+
122
+ // select incremental keys to send
123
+ const hashTable = {};
124
+ Object.entries(page.hashTable).forEach(([key, elem]) => {
125
+ if (!hashKeys.has(key))
126
+ hashTable[key] = elem;
127
+ });
128
+
129
+ // rectify page data by lilyNotation
130
+ const lilyNotation = options.lilyNotation || await notatioinGen.wait();
131
+ //console.log("ts.2:", index, Date.now() - t0);
132
+ if (lilyNotation) {
133
+ const sheetDocument = new staffSvg.SheetDocument({pages: [page.structure]}, {initialize: true});
134
+
135
+ sheetDocument.alignTokensWithNotation(options.lilyNotation, {partial: true});
136
+ sheetDocument.updateMatchedTokens(options.lilyNotation.idSet);
137
+ }
138
+
139
+ outputJSON({
140
+ page: index,
141
+ structure: page.structure,
142
+ hashTable,
143
+ });
144
+
145
+ Object.keys(hashTable).forEach(key => hashKeys.add(key));
146
+
147
+ //console.log("ts.3:", index, Date.now() - t0);
148
+ },
149
+ });
150
+
151
+ const tn = Date.now();
152
+ //console.log("tn:", tn - t0);
153
+
154
+ options.logger.append("advancedEngraver.profile.engraving", {cost: tn - t0});
155
+
156
+ await new Promise(resolve => setImmediate(resolve));
157
+
158
+ output.write(JSON.stringify({
159
+ logs: engraving.logs,
160
+ logger: options.logger,
161
+ errorLevel: engraving.errorLevel,
162
+ }));
163
+ };
164
+
165
+
166
+
167
+ export {
168
+ advancedEngrave,
169
+ };
backend/canvas.ts ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //import {loadImage, createCanvas} from "canvas";
3
+ import {PNGStream} from "canvas";
4
+
5
+ const {loadImage, createCanvas}: any = !process.env.MOBILE_MODE ? require("canvas") : {};
6
+
7
+
8
+
9
+ const svgToPng = async (sourceURL: string|Buffer): Promise<PNGStream> => {
10
+ if (process.env.MOBILE_MODE)
11
+ return;
12
+
13
+ const image = await loadImage(sourceURL);
14
+
15
+ const canvas = createCanvas(image.width, image.height);
16
+ const ctx = canvas.getContext("2d");
17
+ ctx.drawImage(image, 0, 0, image.width, image.height);
18
+
19
+ return canvas.createPNGStream();
20
+ };
21
+
22
+
23
+
24
+ export {
25
+ svgToPng,
26
+ };
backend/constants.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import path from "path";
3
+
4
+
5
+
6
+ // @ts-ignore
7
+ const LY_INCLUDE_FOLDERS = ["../ly"].map(folder => path.resolve(process.env.TEMP_DIR, folder));
8
+
9
+
10
+
11
+ export {
12
+ LY_INCLUDE_FOLDERS,
13
+ };
backend/dirServer.ts ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import path from "path";
3
+ import serveHandler from "serve-handler";
4
+
5
+
6
+
7
+ const createHandler = (publicDir: string, apiPath: string) => (req, res) => {
8
+ req.url = "/" + path.relative(`${apiPath}/`, req.baseUrl);
9
+
10
+ // modify link URL origin
11
+ const responseProxy = new Proxy(res, {
12
+ get (res, prop) {
13
+ //console.log("proxy.get:", prop);
14
+ switch (prop) {
15
+ case "end":
16
+ return (content) => {
17
+ //console.log("end with:", content);
18
+ const html = content && content.replace(/href="/g, `href="${apiPath}`);
19
+
20
+ res.end(html);
21
+ };
22
+ }
23
+
24
+ if (typeof res[prop] === "function")
25
+ return res[prop].bind(res);
26
+
27
+ return res[prop];
28
+ },
29
+ });
30
+
31
+ serveHandler(req, responseProxy, {
32
+ public: publicDir,
33
+ //symlinks: true,
34
+ });
35
+ };
36
+
37
+
38
+
39
+ export {
40
+ createHandler,
41
+ };
backend/index.ts ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import formidable from "formidable";
3
+ import {DOMParser} from "xmldom";
4
+ import {MIDI} from "@k-l-lambda/music-widgets";
5
+
6
+ import * as lilyCommands from "./lilyCommands";
7
+ import * as staffSvg from "../inc/staffSvg";
8
+ import loadLilyParser from "./loadLilyParserNode";
9
+ import {LilyDocument} from "../inc/lilyParser";
10
+ import LogRecorder from "../inc/logRecorder";
11
+ import * as ScoreMaker from "./scoreMaker";
12
+ import * as constants from "./constants";
13
+ import {advancedEngrave} from "./advancedEngraver";
14
+
15
+
16
+
17
+ const formidableHandle = (name, req, res, handle) =>
18
+ new formidable.IncomingForm().parse(req, async (err, fields, files) => {
19
+ try {
20
+ if (err)
21
+ throw err;
22
+
23
+ const result = await handle(fields, files);
24
+
25
+ const resultObj = (typeof result === "string" || result instanceof Buffer) ? {body: result} : result;
26
+
27
+ res.writeHead(resultObj.body ? 200 : 404, resultObj.header);
28
+ res.write(resultObj.body);
29
+ res.end();
30
+ }
31
+ catch (error) {
32
+ console.error(`${name} error:`, error);
33
+
34
+ res.writeHead(500);
35
+ res.write(error.toString());
36
+ res.end();
37
+ }
38
+ });
39
+
40
+
41
+ const service = {
42
+ "/musicxml2ly": {
43
+ post: (req, res) => formidableHandle("musicxml2ly", req, res,
44
+ ({xml, options}) => lilyCommands.xml2ly(xml, options && JSON.parse(options))),
45
+ },
46
+
47
+
48
+ "/midi2ly": {
49
+ post: (req, res) => formidableHandle("midi2ly", req, res,
50
+ ({options}, {midi}) => lilyCommands.midi2ly(midi, options && JSON.parse(options))),
51
+ },
52
+
53
+
54
+ "/engrave": {
55
+ post: (req, res) => formidableHandle("engrave", req, res,
56
+ async ({source, tokenize = false, log = false}) => {
57
+ const result = await lilyCommands.engraveSvg(source, {includeFolders: constants.LY_INCLUDE_FOLDERS});
58
+ if (!tokenize)
59
+ return JSON.stringify(result);
60
+
61
+ const lilyParser = await loadLilyParser();
62
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
63
+ //const attributes = lilyDocument.globalAttributes({readonly: true});
64
+ //console.log("attributes:", attributes);
65
+
66
+ lilyDocument.interpret();
67
+
68
+ const logger = new LogRecorder({enabled: log});
69
+
70
+ const {doc, hashTable} = staffSvg.createSheetDocumentFromSvgs(result.svgs, source, lilyDocument, {logger, DOMParser});
71
+
72
+ return JSON.stringify({
73
+ ...result,
74
+ doc,
75
+ hashTable,
76
+ logger,
77
+ });
78
+ }),
79
+ },
80
+
81
+
82
+ "/engraveScm": {
83
+ post: (req, res) => formidableHandle("engraveScm", req, res,
84
+ async ({source}) => {
85
+ const result = await lilyCommands.engraveScm(source, {includeFolders: constants.LY_INCLUDE_FOLDERS});
86
+ return JSON.stringify(result);
87
+ }),
88
+ },
89
+
90
+
91
+ "/engraveMIDI": {
92
+ post: (req, res) => formidableHandle("engraveMIDI", req, res,
93
+ async ({source, articulate = false}) => {
94
+ const lilyParser = await loadLilyParser();
95
+ const midi = await (articulate ? ScoreMaker.makeArticulatedMIDI(source, lilyParser, {includeFolders: constants.LY_INCLUDE_FOLDERS})
96
+ : ScoreMaker.makeMIDI(source, lilyParser, {includeFolders: constants.LY_INCLUDE_FOLDERS}));
97
+ const buffer = Buffer.from(MIDI.encodeMidiFile(midi));
98
+
99
+ return {
100
+ header: {
101
+ "Content-Type": "audio/midi",
102
+ },
103
+ body: buffer,
104
+ };
105
+ }),
106
+ },
107
+
108
+
109
+ "/advanced-engrave": {
110
+ post: (req, res) => new formidable.IncomingForm().parse(req, async (err, fields) => {
111
+ try {
112
+ if (err)
113
+ throw err;
114
+
115
+ const logger = new LogRecorder({enabled: !!fields.log});
116
+
117
+ const lilyParser = await loadLilyParser();
118
+
119
+ const task = advancedEngrave(fields.source, lilyParser, res, {
120
+ includeFolders: constants.LY_INCLUDE_FOLDERS,
121
+ withMIDI: !!fields.withMIDI,
122
+ withNotation: !!fields.withNotation,
123
+ withLilyDoc: !!fields.withLilyDoc,
124
+ withLilyNotation: !!fields.withLilyNotation,
125
+ logger,
126
+ });
127
+
128
+ res.writeHead(200);
129
+
130
+ await task;
131
+ res.end();
132
+ }
133
+ catch (err) {
134
+ console.warn("advanced-engrave error:", err);
135
+
136
+ res.writeHead(500);
137
+ res.write(err.toString());
138
+ res.end();
139
+ }
140
+ }),
141
+ },
142
+ };
143
+
144
+
145
+ const setEnvironment = env => lilyCommands.setEnvironment(env);
146
+
147
+
148
+
149
+ export {
150
+ setEnvironment,
151
+ service,
152
+ lilyCommands,
153
+ ScoreMaker,
154
+ advancedEngrave,
155
+ };
backend/lilyAddon.ts ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {Writable} from "stream";
3
+ import {MIDI} from "@k-l-lambda/music-widgets";
4
+
5
+ import {EngraverOptions, EngraverResult, postProcessSvg} from "./lilyCommands";
6
+
7
+
8
+
9
+ let lilypondEx = null;
10
+
11
+ const loadAddon = (path: string): boolean => {
12
+ lilypondEx = require(path);
13
+
14
+ return !!lilypondEx;
15
+ };
16
+
17
+
18
+ const engraveSvg = async (source: string,
19
+ {onProcStart, onMidiRead, onSvgRead, includeFolders = []}: EngraverOptions = {}): Promise<Partial<EngraverResult>> => {
20
+ if (!lilypondEx)
21
+ throw new Error("Lilypond addon not loaded.");
22
+
23
+ let logs;
24
+ const svgs = [];
25
+ let midi;
26
+
27
+ const engravePromise = lilypondEx.engrave(source, {
28
+ includeFolders,
29
+ log (message) {
30
+ logs = message;
31
+ },
32
+ onSVG (filename, content) {
33
+ const captures = filename.match(/-(\d+)\.svg$/);
34
+ const index = captures ? Number(captures[1]) - 1 : 0;
35
+
36
+ const svg = postProcessSvg(content);
37
+ svgs[index] = svg;
38
+
39
+ onSvgRead && onSvgRead(index, svg);
40
+ },
41
+ onMIDI (_, buffer) {
42
+ midi = MIDI.parseMidiData(buffer);
43
+
44
+ onMidiRead && onMidiRead(midi);
45
+ },
46
+ });
47
+
48
+ await onProcStart && onProcStart();
49
+
50
+ const errorLevel = await engravePromise;
51
+
52
+ return {
53
+ logs,
54
+ svgs,
55
+ midi,
56
+ errorLevel,
57
+ };
58
+ };
59
+
60
+
61
+ const engraveSvgWithStream = async (source: string,
62
+ output: Writable, {includeFolders = []}: {includeFolders?: string[]} = {},
63
+ ): Promise<Partial<EngraverResult>> => {
64
+ let logs;
65
+ //let midi;
66
+
67
+ //const tasks = [];
68
+
69
+ const errorLevel = await lilypondEx.engrave(source, {
70
+ includeFolders,
71
+ log (message) {
72
+ logs = message;
73
+ },
74
+ onSVG (_, content) {
75
+ // Write stream in non-main thread may result in blocking, so post a task to event looping.
76
+ //tasks.push(new Promise(resolve => ));
77
+ setImmediate(() => {
78
+ output.write(content);
79
+ output.write("\n\n\n\n");
80
+ });
81
+ },
82
+ //onMIDI (_, buffer) {
83
+ // midi = MIDI.parseMidiData(buffer);
84
+ //},
85
+ });
86
+
87
+ //await Promise.all(tasks);
88
+ await new Promise(resolve => setImmediate(resolve));
89
+
90
+ return {
91
+ logs,
92
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from "fs";
4
+ import path from "path";
5
+ import child_process from "child-process-promise";
6
+ import {MIDI} from "@k-l-lambda/music-widgets";
7
+ import {Writable} from "stream";
8
+
9
+ import asyncCall from "../inc/asyncCall";
10
+ import {SingleLock} from "../inc/mutex";
11
+ import {preprocessXml} from "./xmlTools";
12
+ import * as lilyAddon from "./lilyAddon";
13
+
14
+
15
+
16
+ let MUSICXML2LY_PATH;
17
+ let MIDI2LY_PATH;
18
+ let LILYPOND_PATH;
19
+
20
+
21
+ let env; // setEnvironment must be called before use commands
22
+ const setEnvironment = e => {
23
+ env = e;
24
+
25
+ MUSICXML2LY_PATH = filePathResolve(env.LILYPOND_DIR, "musicxml2ly");
26
+ MIDI2LY_PATH = filePathResolve(env.LILYPOND_DIR, "midi2ly");
27
+ LILYPOND_PATH = filePathResolve(env.LILYPOND_DIR, "lilypond");
28
+
29
+ emptyCache();
30
+
31
+ if (env.LILYPOND_ADDON) {
32
+ if (env.LILYPOND_ADDON_ASSETS_DIR) {
33
+ process.env.LILYPOND_PATH = path.join(env.LILYPOND_ADDON_ASSETS_DIR, "bin/lilypond");
34
+ process.env.GUILE_LOAD_PATH = path.join(env.LILYPOND_ADDON_ASSETS_DIR, "share/guile/1.8");
35
+ process.env.FONTCONFIG_PATH = path.join(env.LILYPOND_ADDON_ASSETS_DIR, "share/fonts");
36
+ }
37
+
38
+ lilyAddon.loadAddon(env.LILYPOND_ADDON);
39
+ }
40
+ };
41
+
42
+
43
+ const _WINDOWS = process.platform === "win32";
44
+
45
+
46
+ const genHashString = (len = 8) => Buffer.from(Math.random().toString()).toString("base64").substr(3, 3 + len);
47
+
48
+
49
+ const filePathResolve = (...parts: string[]): string => {
50
+ const result = path.join(...parts);
51
+ return _WINDOWS ? `"${result}"` : result;
52
+ };
53
+
54
+
55
+ const emptyCache = async () => {
56
+ // empty temporary directory
57
+ try {
58
+ if (env.TEMP_DIR) {
59
+ if (_WINDOWS)
60
+ await child_process.exec(`del /q "${env.TEMP_DIR}*"`);
61
+ else
62
+ await child_process.exec(`rm ${env.TEMP_DIR}*`);
63
+ console.log("Temporary directory clear.");
64
+ }
65
+ }
66
+ catch (err) {
67
+ if (_WINDOWS)
68
+ console.log("emptyCache error:", err);
69
+ }
70
+ };
71
+
72
+
73
+ export interface LilyProcessOptions {
74
+ // xml
75
+ language?: string;
76
+ removeMeasureImplicit?: boolean;
77
+ replaceEncoding?: boolean;
78
+ removeNullDynamics?: boolean;
79
+ fixHeadMarkup?: boolean;
80
+ fixBackSlashes?: boolean;
81
+ roundTempo?: boolean;
82
+ escapedWordsDoubleQuotation?: boolean;
83
+ removeTrivialRests?: boolean;
84
+ removeBadMetronome?: boolean;
85
+ removeInvalidHarmonies?: boolean;
86
+ removeAllHarmonies?: boolean;
87
+ fixChordVoice?: boolean;
88
+ fixBarlines?: boolean;
89
+ removeInvalidClef?: boolean;
90
+
91
+ // lilypond
92
+ pointClick?: boolean;
93
+ midi?: boolean;
94
+ removeBreak?: boolean;
95
+ removePageBreak?: boolean;
96
+ removeInstrumentName?: boolean;
97
+ removeTempo?: boolean;
98
+ tupletReplace?: boolean;
99
+ };
100
+
101
+
102
+
103
+
104
+ const postProcessLy = (ly: string, {
105
+ pointClick = true,
106
+ midi = true,
107
+ removeBreak = false,
108
+ removePageBreak = false,
109
+ removeInstrumentName = false,
110
+ removeTempo = false,
111
+ tupletReplace = false,
112
+ } = {}): string => {
113
+ let result = ly;
114
+
115
+ if (pointClick)
116
+ result = result.replace(/\\pointAndClickOff\n/g, "");
117
+
118
+ if (midi)
119
+ result = result.replace(/% \\midi/g, "\\midi");
120
+
121
+ if (removeBreak)
122
+ result = result.replace(/\s\\break\s/g, " ");
123
+
124
+ if (removePageBreak)
125
+ result = result.replace(/\s\\pageBreak\s/g, " ");
126
+
127
+ if (removeInstrumentName)
128
+ result = result.replace(/\\set Staff\.instrumentName/g, "% \\set Staff.instrumentName");
129
+
130
+ if (removeTempo)
131
+ result = result.replace(/\\tempo /g, "% \\tempo ");
132
+
133
+ if (tupletReplace) {
134
+ result = result
135
+ .replace(/4\*128\/384/g, "8*2/3")
136
+ .replace(/4\*64\/384/g, "16*2/3");
137
+ }
138
+
139
+ return result;
140
+ };
141
+
142
+
143
+ const xml2ly = async (xml: string, {language = "english", ...options}: LilyProcessOptions): Promise<string> => {
144
+ xml = preprocessXml(xml, options);
145
+ //console.log("xml:", options, xml.substr(0, 100));
146
+
147
+ const hash = genHashString();
148
+ const xmlFileName = `${env.TEMP_DIR}xml2ly-${hash}.xml`;
149
+ await asyncCall(fs.writeFile, xmlFileName, xml);
150
+
151
+ const lyFileName = `${env.TEMP_DIR}xml2ly-${hash}.ly`;
152
+
153
+ if (env.MUSICXML2LY_BY_PYTHON) {
154
+ await child_process.spawn(path.resolve(env.LILYPOND_DIR, "python"), [
155
+ path.resolve(env.LILYPOND_DIR, "musicxml2ly.py"), xmlFileName, "-o", lyFileName,
156
+ ...(language ? ["-l", language] : []),
157
+ ]);
158
+ }
159
+ else
160
+ await child_process.exec(`${MUSICXML2LY_PATH} ${xmlFileName} -o ${lyFileName} ${language ? "-l " + language : ""}`, {maxBuffer: 0x80000});
161
+ //console.log("musicxml2ly:", result.stdout, result.stderr);
162
+
163
+ const ly = await asyncCall(fs.readFile, lyFileName);
164
+
165
+ return postProcessLy(ly.toString(), options);
166
+ };
167
+
168
+
169
+ const midi2ly = async (midi, options: LilyProcessOptions): Promise<string> => {
170
+ const hash = genHashString();
171
+ //const midiFileName = `${env.TEMP_DIR}midi2ly-${hash}.midi`;
172
+ //await asyncCall(fs.writeFile, midiFileName, midi);
173
+
174
+ const lyFileName = `${env.TEMP_DIR}midi2ly-${hash}-midi.ly`;
175
+
176
+ let result;
177
+ if (env.MUSICXML2LY_BY_PYTHON) {
178
+ result = await child_process.spawn(path.resolve(env.LILYPOND_DIR, "python"),
179
+ [path.resolve(env.LILYPOND_DIR, "midi2ly.py"), midi.path, "-o", lyFileName]);
180
+ }
181
+ else
182
+ result = await child_process.exec(`${MIDI2LY_PATH} ${midi.path} -o ${lyFileName}`);
183
+ console.log("midi2ly:", result.stdout, result.stderr);
184
+
185
+ const ly = await asyncCall(fs.readFile, lyFileName);
186
+
187
+ return postProcessLy(ly.toString(), options);
188
+ };
189
+
190
+
191
+ const postProcessSvg = (svg: string): string => {
192
+ return svg.replace(/textedit:[^"]+:(\d+:\d+:\d+)/g, "textedit:$1");
193
+ };
194
+
195
+
196
+ //const nameNumber = name => Number(name.match(/-(\d+)\./)[1]);
197
+
198
+
199
+ // lilypond command line output file pattern
200
+ const FILE_BORN_OUPUT_PATTERN = /output\sto\s`(.+)'/;
201
+
202
+
203
+ export interface EngraverOptions {
204
+ onProcStart?: () => void|Promise<void>;
205
+ onMidiRead?: (content: MIDI.MidiData, options?: {filePath: string}) => void|Promise<void>;
206
+ onSvgRead?: (index: number, content: string, options?: {filePath: string}) => void|Promise<void>;
207
+ includeFolders?: string[]; // include folder path should be relative to TEMP_DIR
208
+ };
209
+
210
+ export interface EngraverResult {
211
+ logs: string;
212
+ svgs: string[];
213
+ midi: MIDI.MidiData;
214
+ errorLevel: number;
215
+ };
216
+
217
+
218
+ const engraveSvgCli = async (source: string,
219
+ {onProcStart, onMidiRead, onSvgRead, includeFolders = []}: EngraverOptions = {},
220
+ ): Promise<Partial<EngraverResult>> => {
221
+ const hash = genHashString();
222
+ const sourceFilename = `${env.TEMP_DIR}engrave-${hash}.ly`;
223
+
224
+ await asyncCall(fs.writeFile, sourceFilename, source);
225
+ //console.log("ly source written:", sourceFilename);
226
+
227
+ let midi = null;
228
+ const svgs = [];
229
+
230
+ const fileReady = new SingleLock<string>();
231
+
232
+ const loadFile = async filename => {
233
+ //console.log("loadFile:", filename);
234
+
235
+ // wait for file writing finished
236
+ //await new Promise(resolve => setTimeout(resolve, 100));
237
+
238
+ const captures = filename.match(/\.(\w+)$/);
239
+ if (!captures) {
240
+ console.warn("invalid filename:", filename);
241
+ return;
242
+ }
243
+ const [_, ext] = captures;
244
+
245
+ const filePath = path.resolve(env.TEMP_DIR, filename);
246
+ //console.log("file output:", filePath, ext);
247
+
248
+ switch (ext) {
249
+ case env.MIDI_FILE_EXTEND: {
250
+ // wait extra time for MIDI file
251
+ //await fileReady.lock();
252
+ await new Promise(resolve => setTimeout(resolve, 100));
253
+
254
+ const buffer = await asyncCall(fs.readFile, filePath);
255
+ if (!buffer.length)
256
+ console.warn("empty MIDI buffer:", filename);
257
+
258
+ midi = MIDI.parseMidiData(buffer);
259
+
260
+ await onMidiRead && onMidiRead(midi, {filePath});
261
+ }
262
+
263
+ break;
264
+ case "svg": {
265
+ // eslint-disable-next-line
266
+ const captures = filename.match(/(\d+)\.svg$/);
267
+ const index = captures ? Number(captures[1]) - 1 : 0;
268
+
269
+ const buffer = await asyncCall(fs.readFile, filePath);
270
+ if (!buffer.length)
271
+ console.warn("empty SVG buffer:", filename);
272
+
273
+ const svg = postProcessSvg(buffer.toString());
274
+ svgs[index] = svg;
275
+
276
+ //console.log("svg load:", filePath);
277
+ await onSvgRead && onSvgRead(index, svg, {filePath});
278
+ }
279
+
280
+ break;
281
+ }
282
+ };
283
+
284
+ const loadProcs: Promise<void>[] = [];
285
+
286
+ const checkFile = async (line: string) => {
287
+ fileReady.release(line);
288
+
289
+ // skip error messages in command line output
290
+ if (FILE_BORN_OUPUT_PATTERN.test(line)) {
291
+ let newLine = await fileReady.lock();
292
+ while (/error|warning/.test(newLine))
293
+ newLine = await fileReady.lock();
294
+
295
+ let captures;
296
+ const exp = new RegExp(FILE_BORN_OUPUT_PATTERN.source, "g");
297
+ while (captures = exp.exec(line))
298
+ loadProcs.push(loadFile(captures[1]));
299
+ }
300
+ };
301
+
302
+ const includeParameters = includeFolders.map(folder => `--include=${folder}`).join(" ");
303
+
304
+ const proc: any = child_process.exec(`${LILYPOND_PATH} -dbackend=svg -o ${env.TEMP_DIR} ${includeParameters} ${sourceFilename}`,
305
+ {maxBuffer: 0x100000});
306
+ //const proc = child_process.spawn(LILYPOND_PATH, ["-dbackend=svg", `-o ${env.TEMP_DIR}`, sourceFilename]);
307
+ proc.childProcess.stdout.on("data", checkFile);
308
+ proc.childProcess.stderr.on("data", checkFile);
309
+
310
+ const startPromise = onProcStart && onProcStart();
311
+ if (startPromise)
312
+ loadProcs.push(startPromise);
313
+
314
+ const result = await proc;
315
+
316
+ fileReady.release();
317
+
318
+ await Promise.all(loadProcs);
319
+
320
+ //console.log("svgs:", svgs.length);
321
+
322
+ const validCount = svgs.filter(svg => svg).length;
323
+ if (validCount < svgs.length)
324
+ console.warn("svg loading incompleted: ", validCount, svgs.length);
325
+
326
+ return {
327
+ logs: result.stderr,
328
+ svgs,
329
+ midi,
330
+ };
331
+ };
332
+
333
+
334
+ const engraveSvgWithStreamCli = async (source: string, output: Writable, {includeFolders = []}: {includeFolders?: string[]} = {}) => {
335
+ const hash = genHashString();
336
+ const sourceFilename = `${env.TEMP_DIR}engrave-${hash}.ly`;
337
+
338
+ await asyncCall(fs.writeFile, sourceFilename, source);
339
+
340
+ const writing = new SingleLock();
341
+ const fileReady = new SingleLock();
342
+
343
+ const loadFile = async line => {
344
+ const [_, filename] = line.match(FILE_BORN_OUPUT_PATTERN);
345
+ const [__, ext] = filename.match(/\.(\w+)$/);
346
+
347
+ switch (ext) {
348
+ case "svg": {
349
+ await fileReady.lock();
350
+ await writing.wait();
351
+
352
+ writing.lock();
353
+
354
+ const filePath = path.resolve(env.TEMP_DIR, filename);
355
+ const fileStream = fs.createReadStream(filePath);
356
+ fileStream.pipe(output, {end: false});
357
+
358
+ fileStream.on("close", () => output.write("\n\n\n\n"));
359
+
360
+ writing.release();
361
+ }
362
+
363
+ break;
364
+ }
365
+ };
366
+
367
+ const checkFile = line => {
368
+ fileReady.release();
369
+
370
+ if (FILE_BORN_OUPUT_PATTERN.test(line))
371
+ loadFile(line);
372
+ };
373
+
374
+ const includeParameters = includeFolders.map(folder => `--include=${folder}`).join(" ");
375
+
376
+ const proc: any = child_process.exec(`${LILYPOND_PATH} -dbackend=svg -o ${env.TEMP_DIR} ${includeParameters} ${sourceFilename}`);
377
+ proc.childProcess.stdout.on("data", checkFile);
378
+ proc.childProcess.stderr.on("data", checkFile);
379
+
380
+ proc.then(() => fileReady.release());
381
+
382
+ return proc;
383
+ };
384
+
385
+
386
+ const engraveScm = async (source: string, {onProcStart, includeFolders = []}: {
387
+ onProcStart?: () => void|Promise<void>,
388
+ includeFolders?: string[], // include folder path should be relative to TEMP_DIR
389
+ } = {}): Promise<{
390
+ logs: string,
391
+ scm: string,
392
+ }> => {
393
+ const hash = genHashString();
394
+ const sourceFilename = `${env.TEMP_DIR}engrave-${hash}.ly`;
395
+ const targetFilename = `${env.TEMP_DIR}engrave-${hash}.scm`;
396
+
397
+ await fs.promises.writeFile(sourceFilename, source);
398
+ //console.log("ly source written:", sourceFilename);
399
+
400
+ const includeParameters = includeFolders.map(folder => `--include=${folder}`).join(" ");
401
+
402
+ const proc = child_process.exec(`${LILYPOND_PATH} -dbackend=scm -o ${env.TEMP_DIR} ${includeParameters} ${sourceFilename}`,
403
+ {maxBuffer: 0x100000});
404
+
405
+ await onProcStart && onProcStart();
406
+
407
+ const result = await proc;
408
+
409
+ const scmBuffer = await fs.promises.readFile(targetFilename);
410
+
411
+ return {
412
+ logs: result.stderr,
413
+ scm: scmBuffer.toString(),
414
+ };
415
+ };
416
+
417
+
418
+ const engraveSvg = async (source: string, options: EngraverOptions = {}): Promise<Partial<EngraverResult>> =>
419
+ (env.LILYPOND_ADDON ? lilyAddon.engraveSvg : engraveSvgCli)(source, options);
420
+
421
+
422
+ const engraveSvgWithStream = async (source: string, output: Writable, options: {includeFolders?: string[]} = {}) =>
423
+ (env.LILYPOND_ADDON ? lilyAddon.engraveSvgWithStream : engraveSvgWithStreamCli)(source, output, options);
424
+
425
+
426
+
427
+ export {
428
+ xml2ly,
429
+ midi2ly,
430
+ engraveSvg,
431
+ engraveSvgCli,
432
+ engraveSvgWithStream,
433
+ engraveSvgWithStreamCli,
434
+ engraveScm,
435
+ setEnvironment,
436
+ emptyCache,
437
+ postProcessSvg,
438
+ };
backend/loadJisonParserNode.ts ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import fs from "fs";
3
+
4
+ import {Parser} from "../inc/jisonWrapper";
5
+
6
+
7
+
8
+ const parsers = new Map<string, Parser>();
9
+
10
+
11
+
12
+ export default async function load (jison): Promise<Parser> {
13
+ if (!parsers.get(jison)) {
14
+ const grammar = (await fs.promises.readFile(jison)).toString();
15
+
16
+ //console.log("grammar:", grammar);
17
+
18
+ parsers.set(jison, new Parser(grammar)) ;
19
+ }
20
+
21
+ return parsers.get(jison);
22
+ };
backend/loadLilyParserNode.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ import loadJisonParser from "./loadJisonParserNode";
3
+
4
+ import {Parser} from "../inc/jisonWrapper";
5
+
6
+
7
+
8
+ export default (): Promise<Parser> => loadJisonParser("./jison/lilypond.jison");
backend/scoreMaker.ts ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {DOMParser, XMLSerializer} from "xmldom";
3
+ import {MusicNotation} from "@k-l-lambda/music-widgets";
4
+ import {MIDI} from "@k-l-lambda/music-widgets";
5
+ import {Readable} from "stream";
6
+ import CRC32 from "crc-32";
7
+
8
+ import npmPackage from "../package.json";
9
+ import {xml2ly, engraveSvg, LilyProcessOptions} from "./lilyCommands";
10
+ import {LilyDocument, LilyTerms, docLocationSet} from "../inc/lilyParser";
11
+ import * as staffSvg from "../inc/staffSvg";
12
+ import {SingleLock} from "../inc/mutex";
13
+ import * as LilyNotation from "../inc/lilyNotation";
14
+ import {svgToPng} from "./canvas";
15
+ import LogRecorder from "../inc/logRecorder";
16
+ import ScoreJSON from "../inc/scoreJSON";
17
+ import {LilyDocumentAttributeReadOnly} from "../inc/lilyParser/lilyDocument";
18
+ import {Block} from "../inc/lilyParser/lilyTerms";
19
+
20
+
21
+
22
+ interface GrammarParser {
23
+ parse (source: string): any;
24
+ };
25
+
26
+
27
+ const markupLily = (source: string, markup: string, lilyParser: GrammarParser): string => {
28
+ const docMarkup = new LilyDocument(lilyParser.parse(markup));
29
+ const docSource = new LilyDocument(lilyParser.parse(source));
30
+
31
+ /*// copy attributes
32
+ const attrS = docSource.globalAttributes() as LilyDocumentAttribute;
33
+ const attrM = docMarkup.globalAttributes({readonly: true}) as LilyDocumentAttributeReadOnly;
34
+
35
+ [
36
+ "staffSize", "paperWidth", "paperHeight",
37
+ "topMargin", "bottomMargin", "leftMargin", "rightMargin",
38
+ "systemSpacing", "topMarkupSpacing", "raggedLast", "raggedBottom", "raggedLastBottom",
39
+ "printPageNumber",
40
+ ].forEach(field => {
41
+ if (attrM[field] !== undefined) {
42
+ if (typeof attrS[field].value === "object" && attrS[field].value && (attrS[field].value as any).set)
43
+ (attrS[field].value as any).set(attrM[field]);
44
+ else
45
+ attrS[field].value = attrM[field];
46
+ }
47
+ });
48
+
49
+ // execute commands list
50
+ const commands = docMarkup.root.getField("LotusCommands");
51
+ const cmdList = commands && commands.value && commands.value.args && commands.value.args[0].body;
52
+ if (cmdList && Array.isArray(cmdList)) {
53
+ for (const command of cmdList) {
54
+ if (command.exp && docSource[command.exp])
55
+ docSource[command.exp]();
56
+ else
57
+ console.warn("unexpected markup command:", command);
58
+ }
59
+ }
60
+
61
+ // copy LotusOption assignments
62
+ const assignments = docMarkup.root.entries.filter(term => term instanceof LilyTerms.Assignment && /^LotusOption\..+/.test(term.key.toString()));
63
+ assignments.forEach(assignment => docSource.root.sections.push(assignment.clone()));*/
64
+ docSource.markup(docMarkup);
65
+
66
+ return docSource.toString();
67
+ };
68
+
69
+
70
+ const xmlBufferToLy = async (xml: Buffer, options: LilyProcessOptions = {}): Promise<string> => {
71
+ const bom = (xml[0] << 8 | xml[1]);
72
+ const utf16 = bom === 0xfffe;
73
+ const content = xml.toString(utf16 ? "utf16le" : "utf8");
74
+
75
+ return await xml2ly(content, {replaceEncoding: utf16, ...options});
76
+ };
77
+
78
+
79
+ const unescapeStringExp = exp => exp && exp.toString();
80
+
81
+
82
+ interface SheetNotationResult extends Partial<ScoreJSON> {
83
+ midi: MIDI.MidiData;
84
+ midiNotation: MusicNotation.NotationData;
85
+ //sheetNotation: staffSvg.StaffNotation.SheetNotation;
86
+ lilyDocument: LilyDocument;
87
+ bakingImages?: Readable[];
88
+ };
89
+
90
+
91
+ const makeSheetNotation = async (source: string, lilyParser: GrammarParser, {withNotation = false, logger, lilyDocument, includeFolders, baking}: {
92
+ withNotation?: boolean,
93
+ logger?: LogRecorder,
94
+ lilyDocument?: LilyDocument,
95
+ includeFolders?: string[],
96
+ baking?: boolean,
97
+ } = {}): Promise<SheetNotationResult> => {
98
+ let midi = null;
99
+ let midiNotation = null;
100
+
101
+ const pages = [];
102
+ const hashTable = {};
103
+ const bakingImages = [];
104
+
105
+ const t0 = Date.now();
106
+
107
+ type ParserArguments = {
108
+ attributes: LilyDocumentAttributeReadOnly,
109
+ tieLocations: Set<string>,
110
+ briefChordLocations: Set<string>,
111
+ lyricLocations: Set<string>,
112
+ };
113
+
114
+ const argsGen = new SingleLock<ParserArguments>(true);
115
+
116
+ const engraving = await engraveSvg(source, {
117
+ includeFolders,
118
+ // do some work during lilypond process running to save time
119
+ onProcStart: () => {
120
+ //console.log("tp.0:", Date.now() - t0);
121
+ if (!lilyDocument) {
122
+ lilyDocument = new LilyDocument(lilyParser.parse(source));
123
+ lilyDocument.interpret();
124
+ }
125
+
126
+ const attributes = lilyDocument.globalAttributes({readonly: true}) as LilyDocumentAttributeReadOnly;
127
+
128
+ const tieLocations = docLocationSet(lilyDocument.getTiedNoteLocations2());
129
+ const briefChordLocations = docLocationSet(lilyDocument.getBriefChordLocations());
130
+ const lyricLocations = docLocationSet(lilyDocument.getLyricLocations());
131
+
132
+ argsGen.release({attributes, tieLocations, briefChordLocations, lyricLocations});
133
+ //console.log("tp.1:", Date.now() - t0);
134
+ },
135
+ onMidiRead: midi_ => {
136
+ //console.log("tm.0:", Date.now() - t0);
137
+ midi = midi_;
138
+ if (withNotation)
139
+ midiNotation = midi && MusicNotation.Notation.parseMidi(midi);
140
+ //console.log("tm.1:", Date.now() - t0);
141
+ },
142
+ onSvgRead: async (index, svg) => {
143
+ //console.log("ts.0:", Date.now() - t0);
144
+ const args = await argsGen.wait();
145
+ const page = staffSvg.parseSvgPage(svg, source, {DOMParser, logger, ...args});
146
+ pages[index] = page.structure;
147
+ Object.assign(hashTable, page.hashTable);
148
+ //console.log("ts.1:", Date.now() - t0);
149
+ },
150
+ });
151
+
152
+ logger.append("scoreMaker.profile.engraving", {cost: Date.now() - t0});
153
+ logger.append("lilypond.log", engraving.logs);
154
+
155
+ const doc = new staffSvg.SheetDocument({pages});
156
+
157
+ staffSvg.postProcessSheetDocument(doc, lilyDocument);
158
+
159
+ if (baking) {
160
+ await Promise.all(engraving.svgs.map(async (svg, index) => {
161
+ const svgText = staffSvg.turnRawSvgWithSheetDocument(svg, pages[index], {DOMParser, XMLSerializer});
162
+ bakingImages[index] = await svgToPng(Buffer.from(svgText));
163
+ }));
164
+ }
165
+
166
+ const midiMusic = lilyDocument.interpret().midiMusic;
167
+
168
+ const {attributes} = await argsGen.wait();
169
+ const meta = {
170
+ title: unescapeStringExp(attributes.title),
171
+ composer: unescapeStringExp(attributes.composer),
172
+ pageSize: doc.pageSize,
173
+ pageCount: doc.pages.length,
174
+ staffSize: attributes.staffSize as number,
175
+ trackInfos: midiMusic && midiMusic.trackContextDicts,
176
+ };
177
+
178
+ /*const t00 = Date.now();
179
+ const sheetNotation = staffSvg.StaffNotation.parseNotationFromSheetDocument(doc, {logger});
180
+
181
+ // correct notation time by location-tick table from lily document
182
+ const tickTable = lilyDocument.getLocationTickTable();
183
+ staffSvg.StaffNotation.assignTickByLocationTable(sheetNotation, tickTable);
184
+ console.log("parseNotationFromSheetDocument cost:", Date.now() - t00);*/
185
+
186
+ return {
187
+ midi,
188
+ bakingImages: baking ? bakingImages : null,
189
+ midiNotation,
190
+ //sheetNotation,
191
+ meta,
192
+ doc,
193
+ hashTable,
194
+ lilyDocument,
195
+ };
196
+ };
197
+
198
+
199
+ interface MakerOptions {
200
+ midi: MIDI.MidiData;
201
+ logger: LogRecorder;
202
+ includeFolders: string[];
203
+ baking: boolean;
204
+ ignoreNotation: boolean;
205
+ };
206
+
207
+
208
+ interface MakerResult {
209
+ bakingImages?: Readable[],
210
+ score: Partial<ScoreJSON>,
211
+ };
212
+
213
+
214
+ // non-negative crc-32
215
+ const hashString = (str: string): number => {
216
+ const value = CRC32.str(str);
217
+ return value < 0 ? 0x100000000 + value : value;
218
+ };
219
+
220
+
221
+ const makeScore = async (
222
+ source: string,
223
+ lilyParser: GrammarParser,
224
+ {midi, logger, baking = false, includeFolders, ignoreNotation = false}: Partial<MakerOptions> = {},
225
+ ): Promise<MakerResult> => {
226
+ const t0 = Date.now();
227
+
228
+ const hash = hashString(source);
229
+
230
+ const foldData = await makeSheetNotation(source, lilyParser, {logger, includeFolders, baking});
231
+ const {meta, doc, hashTable, bakingImages, lilyDocument} = foldData;
232
+
233
+ midi = midi || foldData.midi;
234
+ const lilyNotation = !ignoreNotation && lilyDocument.interpret().getNotation();
235
+
236
+ if (ignoreNotation || !midi || !lilyNotation) {
237
+ if (!ignoreNotation) {
238
+ if (!midi)
239
+ console.warn("Neither lilypond or external arguments did not offer MIDI data, score maker finished incompletely.");
240
+
241
+ if (!lilyNotation)
242
+ console.warn("lilyNotation parsing failed, score maker finished incompletely.");
243
+ }
244
+
245
+ return {
246
+ score: {
247
+ version: npmPackage.version,
248
+ hash,
249
+ meta,
250
+ doc,
251
+ hashTable,
252
+ },
253
+ };
254
+ }
255
+
256
+ const t5 = Date.now();
257
+
258
+ const matcher = await LilyNotation.matchWithExactMIDI(lilyNotation, midi);
259
+
260
+ logger.append("scoreMaker.profile.matching", {cost: Date.now() - t5});
261
+
262
+ if (logger && logger.enabled) {
263
+ const cis = new Set(Array(matcher.criterion.notes.length).keys());
264
+ matcher.path.forEach(ci => cis.delete(ci));
265
+
266
+ const omitC = cis.size;
267
+ const omitS = matcher.path.filter(ci => ci < 0).length;
268
+
269
+ const coverage = ((matcher.criterion.notes.length - omitC) / matcher.criterion.notes.length)
270
+ * ((matcher.sample.notes.length - omitS) / matcher.sample.notes.length);
271
+
272
+ logger.append("makeScore.match", {coverage, omitC, omitS, path: matcher.path});
273
+ }
274
+
275
+ doc.updateMatchedTokens(lilyNotation.idSet);
276
+
277
+ // idTrackMap is useless in bundled score
278
+ delete lilyNotation.idTrackMap;
279
+
280
+ if (baking)
281
+ doc.pruneForBakingMode();
282
+
283
+ logger.append("scoreMaker.profile.full", {cost: Date.now() - t0});
284
+
285
+ return {
286
+ bakingImages,
287
+ score: {
288
+ version: npmPackage.version,
289
+ hash,
290
+ meta,
291
+ doc,
292
+ hashTable: !baking ? hashTable : null,
293
+ lilyNotation,
294
+ },
295
+ };
296
+ };
297
+
298
+
299
+ const makeMIDI = async (source: string, lilyParser: GrammarParser, {unfoldRepeats = false, fixNestedRepeat = false, includeFolders = undefined} = {}): Promise<MIDI.MidiData> => {
300
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
301
+
302
+ if (fixNestedRepeat)
303
+ lilyDocument.fixNestedRepeat();
304
+
305
+ if (unfoldRepeats)
306
+ lilyDocument.unfoldRepeats();
307
+
308
+ const score = lilyDocument.root.getBlock("score");
309
+ if (score) {
310
+ // remove layout block to save time
311
+ score.body = score.body.filter(term => !(term instanceof LilyTerms.Block && term.head === "\\layout"));
312
+
313
+ // remove invalid tempo
314
+ const midi: any = score.body.find(term => term instanceof LilyTerms.Block && term.head === "\\midi");
315
+ if (midi)
316
+ midi.body = midi.body.filter(term => !(term instanceof LilyTerms.Tempo && term.beatsPerMinute > 200));
317
+ }
318
+
319
+ const markupSource = lilyDocument.toString();
320
+ //console.log("markupSource:", markupSource);
321
+
322
+ return new Promise((resolve, reject) => engraveSvg(markupSource, {
323
+ includeFolders,
324
+ onMidiRead: resolve,
325
+ }).catch(reject));
326
+ };
327
+
328
+
329
+ const makeArticulatedMIDI = async (source: string, lilyParser: GrammarParser, {ignoreRepeats = true, includeFolders = undefined} = {}): Promise<MIDI.MidiData> => {
330
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
331
+
332
+ if (ignoreRepeats)
333
+ lilyDocument.removeRepeats();
334
+
335
+ lilyDocument.articulateMIDIOutput();
336
+
337
+ // remove layout block to save time
338
+ lilyDocument.root.sections = lilyDocument.root.sections.filter(section => !(section instanceof Block)
339
+ || !(section.head === "\\score")
340
+ || section.isMIDIDedicated);
341
+
342
+ const markupSource = lilyDocument.toString();
343
+ //console.log("markupSource:", markupSource);
344
+
345
+ return new Promise((resolve, reject) => engraveSvg(markupSource, {
346
+ includeFolders,
347
+ onMidiRead: resolve,
348
+ }).catch(reject));
349
+ };
350
+
351
+
352
+
353
+ export {
354
+ markupLily,
355
+ xmlBufferToLy,
356
+ makeScore,
357
+ makeMIDI,
358
+ makeArticulatedMIDI,
359
+ };
backend/scoreMaker.ts.old ADDED
@@ -0,0 +1,665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // OBSOLETE code, only for archive
3
+ //
4
+
5
+ import _ from "lodash";
6
+ import {DOMParser, XMLSerializer} from "xmldom";
7
+ import {MusicNotation} from "@k-l-lambda/music-widgets";
8
+ import {MIDI} from "@k-l-lambda/music-widgets";
9
+ import {Readable} from "stream";
10
+
11
+ import npmPackage from "../package.json";
12
+ import {xml2ly, engraveSvg, LilyProcessOptions} from "./lilyCommands";
13
+ import {LilyDocument, replaceSourceToken, LilyTerms} from "../inc/lilyParser";
14
+ import * as staffSvg from "../inc/staffSvg";
15
+ import {SingleLock} from "../inc/mutex";
16
+ import {PitchContextTable} from "../inc/pitchContext";
17
+ import * as LilyNotation from "../inc/lilyNotation";
18
+ import {svgToPng} from "./canvas";
19
+ import LogRecorder from "../inc/logRecorder";
20
+ import ScoreJSON, {NoteLinking} from "../inc/scoreJSON";
21
+ import {LilyDocumentAttribute, LilyDocumentAttributeReadOnly} from "../inc/lilyParser/lilyDocument";
22
+ import {Block} from "../inc/lilyParser/lilyTerms";
23
+
24
+
25
+
26
+ interface GrammarParser {
27
+ parse (source: string): any;
28
+ };
29
+
30
+
31
+ const markupLily = (source: string, markup: string, lilyParser: GrammarParser): string => {
32
+ const docMarkup = new LilyDocument(lilyParser.parse(markup));
33
+ const docSource = new LilyDocument(lilyParser.parse(source));
34
+
35
+ // copy attributes
36
+ const attrS = docSource.globalAttributes() as LilyDocumentAttribute;
37
+ const attrM = docMarkup.globalAttributes({readonly: true}) as LilyDocumentAttributeReadOnly;
38
+
39
+ [
40
+ "staffSize", "paperWidth", "paperHeight",
41
+ "topMargin", "bottomMargin", "leftMargin", "rightMargin",
42
+ "systemSpacing", "topMarkupSpacing", "raggedLast", "raggedBottom", "raggedLastBottom",
43
+ "printPageNumber",
44
+ ].forEach(field => {
45
+ if (attrM[field] !== undefined) {
46
+ if (typeof attrS[field].value === "object" && attrS[field].value && (attrS[field].value as any).set)
47
+ (attrS[field].value as any).set(attrM[field]);
48
+ else
49
+ attrS[field].value = attrM[field];
50
+ }
51
+ });
52
+
53
+ // execute commands list
54
+ const commands = docMarkup.root.getField("LotusCommands");
55
+ const cmdList = commands && commands.value && commands.value.args && commands.value.args[0].body;
56
+ if (cmdList && Array.isArray(cmdList)) {
57
+ for (const command of cmdList) {
58
+ if (command.exp && docSource[command.exp])
59
+ docSource[command.exp]();
60
+ else
61
+ console.warn("unexpected markup command:", command);
62
+ }
63
+ }
64
+
65
+ // copy LotusOption assignments
66
+ const assignments = docMarkup.root.entries.filter(term => term instanceof LilyTerms.Assignment && /^LotusOption\..+/.test(term.key.toString()));
67
+ assignments.forEach(assignment => docSource.root.sections.push(assignment.clone()));
68
+
69
+ return docSource.toString();
70
+ };
71
+
72
+
73
+ const xmlBufferToLy = async (xml: Buffer, options: LilyProcessOptions = {}): Promise<string> => {
74
+ const bom = (xml[0] << 8 | xml[1]);
75
+ const utf16 = bom === 0xfffe;
76
+ const content = xml.toString(utf16 ? "utf16le" : "utf8");
77
+
78
+ return await xml2ly(content, {replaceEncoding: utf16, ...options});
79
+ };
80
+
81
+
82
+ const unescapeStringExp = exp => exp && exp.toString();
83
+
84
+
85
+ const makeScoreV1 = async (source: string, lilyParser: GrammarParser, {midi, logger}: {midi?: MIDI.MidiData, logger?: LogRecorder} = {}): Promise<ScoreJSON> => {
86
+ const t0 = Date.now();
87
+
88
+ const engraving = await engraveSvg(source);
89
+
90
+ logger.append("scoreMaker.profile.engraving", {cost: Date.now() - t0});
91
+ logger.append("lilypond.log", engraving.logs);
92
+
93
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
94
+ const {doc, hashTable} = staffSvg.createSheetDocumentFromSvgs(engraving.svgs, source, lilyDocument, {logger, DOMParser});
95
+
96
+ const sheetNotation = staffSvg.StaffNotation.parseNotationFromSheetDocument(doc, {logger});
97
+
98
+ const attributes = lilyDocument.globalAttributes({readonly: true});
99
+
100
+ const meta = {
101
+ title: unescapeStringExp(attributes.title),
102
+ composer: unescapeStringExp(attributes.composer),
103
+ pageSize: doc.pageSize,
104
+ pageCount: doc.pages.length,
105
+ staffSize: attributes.staffSize as number,
106
+ };
107
+
108
+ midi = midi || engraving.midi;
109
+ const midiNotation = MusicNotation.Notation.parseMidi(midi);
110
+
111
+ const t5 = Date.now();
112
+
113
+ const matcher = await staffSvg.StaffNotation.matchNotations(midiNotation, sheetNotation);
114
+
115
+ logger.append("scoreMaker.profile.matching", {cost: Date.now() - t5});
116
+
117
+ if (logger) {
118
+ const cis = new Set(Array(matcher.criterion.notes.length).keys());
119
+ matcher.path.forEach(ci => cis.delete(ci));
120
+
121
+ const omitC = cis.size;
122
+ const omitS = matcher.path.filter(ci => ci < 0).length;
123
+
124
+ const coverage = ((matcher.criterion.notes.length - omitC) / matcher.criterion.notes.length)
125
+ * ((matcher.sample.notes.length - omitS) / matcher.sample.notes.length);
126
+
127
+ logger.append("makeScore.match", {coverage, omitC, omitS, path: matcher.path});
128
+ }
129
+
130
+ const matchedIds: Set<string> = new Set();
131
+ midiNotation.notes.forEach(note => note.ids && note.ids.forEach(id => matchedIds.add(id)));
132
+
133
+ doc.updateMatchedTokens(matchedIds);
134
+
135
+ const pitchContextGroup = PitchContextTable.createPitchContextGroup(sheetNotation.pitchContexts, midiNotation);
136
+
137
+ const noteLinkings = midiNotation.notes.map(note => _.pick(note, ["ids", "staffTrack", "contextIndex"]) as NoteLinking);
138
+
139
+ logger.append("scoreMaker.profile.full", {cost: Date.now() - t0});
140
+
141
+ return {
142
+ meta,
143
+ doc,
144
+ midi,
145
+ hashTable,
146
+ noteLinkings,
147
+ pitchContextGroup,
148
+ };
149
+ };
150
+
151
+
152
+ interface IncompleteScoreJSON {
153
+ meta?: any,
154
+ doc?: any;
155
+ hashTable?: {[key: string]: any};
156
+ midi?: MIDI.MidiData;
157
+ noteLinkings?: NoteLinking;
158
+ pitchContextGroup?: any;
159
+ };
160
+
161
+
162
+ interface SheetNotationResult extends IncompleteScoreJSON {
163
+ midiNotation: MusicNotation.NotationData;
164
+ sheetNotation: staffSvg.StaffNotation.SheetNotation;
165
+ lilyDocument: LilyDocument;
166
+ bakingImages?: Readable[];
167
+ };
168
+
169
+
170
+ const makeScoreV2 = async (source: string, lilyParser: GrammarParser, {midi, logger}: {midi?: MIDI.MidiData, logger?: LogRecorder} = {}): Promise<ScoreJSON | IncompleteScoreJSON> => {
171
+ let midiNotation = null;
172
+
173
+ const pages = [];
174
+ const hashTable = {};
175
+
176
+ const t0 = Date.now();
177
+
178
+ const attrGen = new SingleLock<LilyDocumentAttributeReadOnly>(true);
179
+
180
+ const engraving = await engraveSvg(source, {
181
+ // do some work during lilypond process running to save time
182
+ onProcStart: () => {
183
+ //console.log("tp.0:", Date.now() - t0);
184
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
185
+ attrGen.release(lilyDocument.globalAttributes({readonly: true}) as LilyDocumentAttributeReadOnly);
186
+ //console.log("tp.1:", Date.now() - t0);
187
+ },
188
+ onMidiRead: midi_ => {
189
+ //console.log("tm.0:", Date.now() - t0);
190
+ if (!midi) {
191
+ midi = midi_;
192
+ midiNotation = midi && MusicNotation.Notation.parseMidi(midi);
193
+ }
194
+ //console.log("tm.1:", Date.now() - t0);
195
+ },
196
+ onSvgRead: async svg => {
197
+ //console.log("ts.0:", Date.now() - t0);
198
+ const attributes = await attrGen.wait();
199
+ const page = staffSvg.parseSvgPage(svg, source, {DOMParser, logger, attributes});
200
+ pages.push(page.structure);
201
+ Object.assign(hashTable, page.hashTable);
202
+ //console.log("ts.1:", Date.now() - t0);
203
+ },
204
+ });
205
+
206
+ //console.log("t2:", Date.now() - t0);
207
+
208
+ logger.append("scoreMaker.profile.engraving", {cost: Date.now() - t0});
209
+ logger.append("lilypond.log", engraving.logs);
210
+
211
+ const doc = new staffSvg.SheetDocument({pages});
212
+
213
+ //console.log("t3:", Date.now() - t0);
214
+
215
+ const attributes = await attrGen.wait();
216
+ const meta = {
217
+ title: unescapeStringExp(attributes.title),
218
+ composer: unescapeStringExp(attributes.composer),
219
+ pageSize: doc.pageSize,
220
+ pageCount: doc.pages.length,
221
+ staffSize: attributes.staffSize,
222
+ };
223
+
224
+ if (!midiNotation) {
225
+ console.warn("Neither lilypond or external arguments did not offer MIDI data, score maker finish incompletely.");
226
+ return {
227
+ meta,
228
+ doc,
229
+ midi,
230
+ hashTable,
231
+ };
232
+ }
233
+
234
+ //console.log("t4:", Date.now() - t0);
235
+
236
+ const sheetNotation = staffSvg.StaffNotation.parseNotationFromSheetDocument(doc, {logger});
237
+
238
+ //console.log("t5:", Date.now() - t0);
239
+ const t5 = Date.now();
240
+
241
+ const matcher = await staffSvg.StaffNotation.matchNotations(midiNotation, sheetNotation);
242
+
243
+ //console.log("t6:", Date.now() - t0);
244
+ logger.append("scoreMaker.profile.matching", {cost: Date.now() - t5});
245
+
246
+ if (logger) {
247
+ const cis = new Set(Array(matcher.criterion.notes.length).keys());
248
+ matcher.path.forEach(ci => cis.delete(ci));
249
+
250
+ const omitC = cis.size;
251
+ const omitS = matcher.path.filter(ci => ci < 0).length;
252
+
253
+ const coverage = ((matcher.criterion.notes.length - omitC) / matcher.criterion.notes.length)
254
+ * ((matcher.sample.notes.length - omitS) / matcher.sample.notes.length);
255
+
256
+ logger.append("markScore.match", {coverage, omitC, omitS, path: matcher.path});
257
+ }
258
+
259
+ //console.log("t7:", Date.now() - t0);
260
+
261
+ const matchedIds: Set<string> = new Set();
262
+ midiNotation.notes.forEach(note => note.ids && note.ids.forEach(id => matchedIds.add(id)));
263
+
264
+ //console.log("t8:", Date.now() - t0);
265
+
266
+ doc.updateMatchedTokens(matchedIds);
267
+
268
+ //console.log("t9:", Date.now() - t0);
269
+
270
+ const pitchContextGroup = PitchContextTable.createPitchContextGroup(sheetNotation.pitchContexts, midiNotation);
271
+
272
+ //console.log("t10:", Date.now() - t0);
273
+
274
+ const noteLinkings = midiNotation.notes.map(note => _.pick(note, ["ids", "staffTrack", "contextIndex"]));
275
+
276
+ //console.log("t11:", Date.now() - t0);
277
+ logger.append("scoreMaker.profile.full", {cost: Date.now() - t0});
278
+
279
+ return {
280
+ meta,
281
+ doc,
282
+ midi,
283
+ hashTable,
284
+ noteLinkings,
285
+ pitchContextGroup,
286
+ };
287
+ };
288
+
289
+
290
+ const makeSheetNotation = async (source: string, lilyParser: GrammarParser, {withNotation = true, logger, lilyDocument, includeFolders, baking}: {
291
+ withNotation?: boolean,
292
+ logger?: LogRecorder,
293
+ lilyDocument?: LilyDocument,
294
+ includeFolders?: string[],
295
+ baking?: boolean,
296
+ } = {}): Promise<SheetNotationResult> => {
297
+ let midi = null;
298
+ let midiNotation = null;
299
+
300
+ const pages = [];
301
+ const hashTable = {};
302
+ const bakingImages = [];
303
+
304
+ const t0 = Date.now();
305
+
306
+ type ParserArguments = {attributes: LilyDocumentAttributeReadOnly, tieLocations: {[key: string]: boolean}};
307
+
308
+ const argsGen = new SingleLock<ParserArguments>(true);
309
+
310
+ const engraving = await engraveSvg(source, {
311
+ includeFolders,
312
+ // do some work during lilypond process running to save time
313
+ onProcStart: () => {
314
+ //console.log("tp.0:", Date.now() - t0);
315
+ if (!lilyDocument) {
316
+ lilyDocument = new LilyDocument(lilyParser.parse(source));
317
+ lilyDocument.interpret();
318
+ }
319
+
320
+ const attributes = lilyDocument.globalAttributes({readonly: true}) as LilyDocumentAttributeReadOnly;
321
+
322
+ //const tieLocations = lilyDocument.getTiedNoteLocations(text)
323
+ const tieLocations = lilyDocument.getTiedNoteLocations2()
324
+ .reduce((table, loc) => ((table[`${loc[0]}:${loc[1]}`] = true), table), {});
325
+
326
+ argsGen.release({attributes, tieLocations});
327
+ //console.log("tp.1:", Date.now() - t0);
328
+ },
329
+ onMidiRead: withNotation && (midi_ => {
330
+ //console.log("tm.0:", Date.now() - t0);
331
+ midi = midi_;
332
+ midiNotation = midi && MusicNotation.Notation.parseMidi(midi);
333
+ //console.log("tm.1:", Date.now() - t0);
334
+ }),
335
+ onSvgRead: async (index, svg) => {
336
+ //console.log("ts.0:", Date.now() - t0);
337
+ const args = await argsGen.wait();
338
+ const page = staffSvg.parseSvgPage(svg, source, {DOMParser, logger, ...args});
339
+ pages[index] = page.structure;
340
+ Object.assign(hashTable, page.hashTable);
341
+ //console.log("ts.1:", Date.now() - t0);
342
+ },
343
+ });
344
+
345
+ logger.append("scoreMaker.profile.engraving", {cost: Date.now() - t0});
346
+ logger.append("lilypond.log", engraving.logs);
347
+
348
+ const doc = new staffSvg.SheetDocument({pages});
349
+
350
+ staffSvg.postProcessSheetDocument(doc, lilyDocument);
351
+
352
+ if (baking) {
353
+ await Promise.all(engraving.svgs.map(async (svg, index) => {
354
+ const svgText = staffSvg.turnRawSvgWithSheetDocument(svg, pages[index], {DOMParser, XMLSerializer});
355
+ bakingImages[index] = await svgToPng(Buffer.from(svgText));
356
+ }));
357
+ }
358
+
359
+ const {attributes} = await argsGen.wait();
360
+ const meta = {
361
+ title: unescapeStringExp(attributes.title),
362
+ composer: unescapeStringExp(attributes.composer),
363
+ pageSize: doc.pageSize,
364
+ pageCount: doc.pages.length,
365
+ staffSize: attributes.staffSize,
366
+ };
367
+
368
+ const sheetNotation = staffSvg.StaffNotation.parseNotationFromSheetDocument(doc, {logger});
369
+
370
+ // correct notation time by location-tick table from lily document
371
+ const tickTable = lilyDocument.getLocationTickTable();
372
+ staffSvg.StaffNotation.assignTickByLocationTable(sheetNotation, tickTable);
373
+
374
+ return {
375
+ midi,
376
+ bakingImages: baking ? bakingImages : null,
377
+ midiNotation,
378
+ sheetNotation,
379
+ meta,
380
+ doc,
381
+ hashTable,
382
+ lilyDocument,
383
+ };
384
+ };
385
+
386
+
387
+ const makeScoreV3 = async (source: string, lilyParser: GrammarParser, {midi, logger, unfoldRepeats = false, includeFolders}: {
388
+ midi?: MIDI.MidiData,
389
+ logger?: LogRecorder,
390
+ unfoldRepeats?: boolean,
391
+ includeFolders?: string[],
392
+ } = {}): Promise<ScoreJSON | IncompleteScoreJSON> => {
393
+ const t0 = Date.now();
394
+
395
+ let lilyDocument = null;
396
+ let unfoldSource = null;
397
+
398
+ if (unfoldRepeats) {
399
+ lilyDocument = new LilyDocument(lilyParser.parse(source));
400
+ lilyDocument.interpret();
401
+ if (lilyDocument.containsRepeat()) {
402
+ lilyDocument.unfoldRepeats();
403
+ unfoldSource = lilyDocument.toString();
404
+
405
+ // keep 2 version lilypond source note href uniform
406
+ source = replaceSourceToken(unfoldSource, "\\unfoldRepeats");
407
+ }
408
+ }
409
+
410
+ const foldData = await makeSheetNotation(source, lilyParser, {logger, lilyDocument, withNotation: !midi && !unfoldSource, includeFolders});
411
+ const {meta, doc, hashTable} = foldData;
412
+
413
+ lilyDocument = lilyDocument || foldData.lilyDocument;
414
+ let midiNotation = foldData.midiNotation;
415
+ let sheetNotation = foldData.sheetNotation;
416
+
417
+ if (midi)
418
+ midiNotation = MusicNotation.Notation.parseMidi(midi);
419
+
420
+ if (unfoldSource) {
421
+ const unfoldData = await makeSheetNotation(unfoldSource, lilyParser, {logger, lilyDocument, withNotation: !midi, includeFolders});
422
+
423
+ midi = midi || unfoldData.midi;
424
+ midiNotation = unfoldData.midiNotation;
425
+ sheetNotation = unfoldData.sheetNotation;
426
+ }
427
+
428
+ midi = midi || foldData.midi;
429
+ if (!midi || !sheetNotation) {
430
+ if (!midi)
431
+ console.warn("Neither lilypond or external arguments did not offer MIDI data, score maker finished incompletely.");
432
+
433
+ if (!sheetNotation)
434
+ console.warn("sheetNotation parsing failed, score maker finished incompletely.");
435
+
436
+ return {
437
+ meta,
438
+ doc,
439
+ midi,
440
+ hashTable,
441
+ };
442
+ }
443
+
444
+ const t5 = Date.now();
445
+
446
+ const matcher = await staffSvg.StaffNotation.matchNotations(midiNotation, sheetNotation);
447
+
448
+ logger.append("scoreMaker.profile.matching", {cost: Date.now() - t5});
449
+
450
+ if (logger && logger.enabled) {
451
+ const cis = new Set(Array(matcher.criterion.notes.length).keys());
452
+ matcher.path.forEach(ci => cis.delete(ci));
453
+
454
+ const omitC = cis.size;
455
+ const omitS = matcher.path.filter(ci => ci < 0).length;
456
+
457
+ const coverage = ((matcher.criterion.notes.length - omitC) / matcher.criterion.notes.length)
458
+ * ((matcher.sample.notes.length - omitS) / matcher.sample.notes.length);
459
+
460
+ logger.append("makeScore.match", {coverage, omitC, omitS, path: matcher.path});
461
+ }
462
+
463
+ const matchedIds: Set<string> = new Set();
464
+ midiNotation.notes.forEach(note => note.ids && note.ids.forEach(id => matchedIds.add(id)));
465
+
466
+ doc.updateMatchedTokens(matchedIds);
467
+
468
+ const pitchContextGroup = PitchContextTable.createPitchContextGroup(sheetNotation.pitchContexts, midiNotation);
469
+
470
+ const noteLinkings = midiNotation.notes.map(note => _.pick(note, ["ids", "staffTrack", "contextIndex"]) as NoteLinking);
471
+
472
+ logger.append("scoreMaker.profile.full", {cost: Date.now() - t0});
473
+
474
+ return {
475
+ meta,
476
+ doc,
477
+ midi,
478
+ hashTable,
479
+ noteLinkings,
480
+ pitchContextGroup,
481
+ };
482
+ };
483
+
484
+
485
+ const makeScoreV4 = async (source: string, lilyParser: GrammarParser, {midi, logger, unfoldRepeats = false, baking = false, includeFolders}: {
486
+ midi?: MIDI.MidiData,
487
+ logger?: LogRecorder,
488
+ unfoldRepeats?: boolean,
489
+ includeFolders?: string[],
490
+ baking?: boolean,
491
+ } = {}): Promise<{
492
+ bakingImages?: Readable[],
493
+ score: ScoreJSON | IncompleteScoreJSON,
494
+ }> => {
495
+ const t0 = Date.now();
496
+
497
+ let lilyDocument = null;
498
+ let unfoldSource = null;
499
+
500
+ if (unfoldRepeats) {
501
+ lilyDocument = new LilyDocument(lilyParser.parse(source));
502
+ lilyDocument.interpret();
503
+ if (lilyDocument.containsRepeat()) {
504
+ lilyDocument.unfoldRepeats();
505
+ unfoldSource = lilyDocument.toString();
506
+
507
+ // keep 2 version lilypond source note href uniform
508
+ source = replaceSourceToken(unfoldSource, "\\unfoldRepeats");
509
+ }
510
+ }
511
+
512
+ const foldData = await makeSheetNotation(source, lilyParser, {logger, lilyDocument, withNotation: !midi && !unfoldSource, includeFolders, baking});
513
+ const {meta, doc, hashTable, bakingImages} = foldData;
514
+
515
+ lilyDocument = lilyDocument || foldData.lilyDocument;
516
+ //let sheetNotation = foldData.sheetNotation;
517
+
518
+ const matchingMidi = midi || foldData.midi;
519
+
520
+ if (unfoldSource) {
521
+ const unfoldData = await makeSheetNotation(unfoldSource, lilyParser, {logger, lilyDocument, withNotation: !midi, includeFolders});
522
+
523
+ midi = midi || unfoldData.midi;
524
+ //sheetNotation = unfoldData.sheetNotation;
525
+ }
526
+
527
+ midi = midi || foldData.midi;
528
+ const lilyNotation = lilyDocument.interpret().getNotation();
529
+
530
+ if (!midi || !lilyNotation) {
531
+ if (!midi)
532
+ console.warn("Neither lilypond or external arguments did not offer MIDI data, score maker finished incompletely.");
533
+
534
+ if (!lilyNotation)
535
+ console.warn("sheetNotation parsing failed, score maker finished incompletely.");
536
+
537
+ return {
538
+ score: {
539
+ version: npmPackage.version,
540
+ meta,
541
+ doc,
542
+ midi,
543
+ hashTable,
544
+ },
545
+ };
546
+ }
547
+
548
+ const t5 = Date.now();
549
+
550
+ const matcher = await LilyNotation.matchWithMIDI(lilyNotation, matchingMidi);
551
+
552
+ logger.append("scoreMaker.profile.matching", {cost: Date.now() - t5});
553
+
554
+ if (logger && logger.enabled) {
555
+ const cis = new Set(Array(matcher.criterion.notes.length).keys());
556
+ matcher.path.forEach(ci => cis.delete(ci));
557
+
558
+ const omitC = cis.size;
559
+ const omitS = matcher.path.filter(ci => ci < 0).length;
560
+
561
+ const coverage = ((matcher.criterion.notes.length - omitC) / matcher.criterion.notes.length)
562
+ * ((matcher.sample.notes.length - omitS) / matcher.sample.notes.length);
563
+
564
+ logger.append("makeScore.match", {coverage, omitC, omitS, path: matcher.path});
565
+ }
566
+
567
+ const midiNotation = matcher.sample;
568
+
569
+ const matchedIds: Set<string> = new Set();
570
+ midiNotation.notes.forEach(note => note.ids && note.ids.forEach(id => matchedIds.add(id)));
571
+
572
+ doc.updateMatchedTokens(matchedIds);
573
+
574
+ if (baking)
575
+ doc.pruneForBakingMode();
576
+
577
+ const pitchContextGroup = PitchContextTable.createPitchContextGroup(
578
+ lilyNotation.pitchContextGroup.map(table => table.items.map(item => item.context)), midiNotation);
579
+
580
+ const noteLinkings = midiNotation.notes.map(note => _.pick(note, ["ids", "staffTrack", "contextIndex"]) as NoteLinking);
581
+
582
+ logger.append("scoreMaker.profile.full", {cost: Date.now() - t0});
583
+
584
+ return {
585
+ bakingImages,
586
+ score: {
587
+ version: npmPackage.version,
588
+ meta,
589
+ doc,
590
+ midi,
591
+ hashTable: !baking ? hashTable : null,
592
+ noteLinkings,
593
+ pitchContextGroup,
594
+ },
595
+ };
596
+ };
597
+
598
+
599
+ void makeScoreV1;
600
+ void makeScoreV2;
601
+ void makeScoreV3;
602
+ const makeScore = makeScoreV4;
603
+
604
+
605
+ const makeMIDI = async (source: string, lilyParser: GrammarParser, {unfoldRepeats = false, fixNestedRepeat = false, includeFolders = undefined} = {}): Promise<MIDI.MidiData> => {
606
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
607
+
608
+ if (fixNestedRepeat)
609
+ lilyDocument.fixNestedRepeat();
610
+
611
+ if (unfoldRepeats)
612
+ lilyDocument.unfoldRepeats();
613
+
614
+ const score = lilyDocument.root.getBlock("score");
615
+ if (score) {
616
+ // remove layout block to save time
617
+ score.body = score.body.filter(term => !(term instanceof LilyTerms.Block && term.head === "\\layout"));
618
+
619
+ // remove invalid tempo
620
+ const midi: any = score.body.find(term => term instanceof LilyTerms.Block && term.head === "\\midi");
621
+ if (midi)
622
+ midi.body = midi.body.filter(term => !(term instanceof LilyTerms.Tempo && term.beatsPerMinute > 200));
623
+ }
624
+
625
+ const markupSource = lilyDocument.toString();
626
+ //console.log("markupSource:", markupSource);
627
+
628
+ return new Promise((resolve, reject) => engraveSvg(markupSource, {
629
+ includeFolders,
630
+ onMidiRead: resolve,
631
+ }).catch(reject));
632
+ };
633
+
634
+
635
+ const makeArticulatedMIDI = async (source: string, lilyParser: GrammarParser, {ignoreRepeats = true, includeFolders = undefined} = {}): Promise<MIDI.MidiData> => {
636
+ const lilyDocument = new LilyDocument(lilyParser.parse(source));
637
+
638
+ if (ignoreRepeats)
639
+ lilyDocument.removeRepeats();
640
+
641
+ lilyDocument.articulateMIDIOutput();
642
+
643
+ // remove layout block to save time
644
+ lilyDocument.root.sections = lilyDocument.root.sections.filter(section => !(section instanceof Block)
645
+ || !(section.head === "\\score")
646
+ || section.isMIDIDedicated);
647
+
648
+ const markupSource = lilyDocument.toString();
649
+ //console.log("markupSource:", markupSource);
650
+
651
+ return new Promise((resolve, reject) => engraveSvg(markupSource, {
652
+ includeFolders,
653
+ onMidiRead: resolve,
654
+ }).catch(reject));
655
+ };
656
+
657
+
658
+
659
+ export {
660
+ markupLily,
661
+ xmlBufferToLy,
662
+ makeScore,
663
+ makeMIDI,
664
+ makeArticulatedMIDI,
665
+ };
backend/statStorage.ts ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import YAML from "yaml";
5
+
6
+ import asyncCall from "../inc/asyncCall";
7
+
8
+
9
+
10
+ const exists = async (path: string) => new Promise(resolve => fs.access(path, err => resolve(!err)));
11
+
12
+
13
+ const appendData = async (filePath: string, data: object) => {
14
+ const dir = path.resolve(filePath, "..");
15
+ const filename = path.relative(dir, filePath);
16
+ const statPath = path.resolve(dir, ".lotus_stat.yaml");
17
+
18
+ let stat = {};
19
+ if (await exists(statPath)) {
20
+ const buffer = await asyncCall(fs.readFile, statPath);
21
+ stat = YAML.parse(buffer.toString()) || stat;
22
+ }
23
+
24
+ stat[filename] = stat[filename] || {};
25
+ Object.assign(stat[filename], data);
26
+
27
+ await asyncCall(fs.writeFile, statPath, YAML.stringify(stat));
28
+ };
29
+
30
+
31
+
32
+ export {
33
+ appendData,
34
+ };
backend/walkDir.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import fs from "fs";
3
+ import path from "path";
4
+
5
+
6
+
7
+ const walkDir = (dir, pattern, {recursive = false} = {}) => {
8
+ const list = fs.readdirSync(dir);
9
+ //console.log("files:", files);
10
+
11
+ const subdirs = [];
12
+
13
+ const files = list.map(filename => {
14
+ const file = path.resolve(dir, filename);
15
+ const stat = fs.statSync(file);
16
+
17
+ if (stat.isDirectory())
18
+ subdirs.push(file);
19
+
20
+ return {file, filename, stat};
21
+ }).filter(({filename, stat}) => !stat.isDirectory() && (!pattern || pattern.test(filename)))
22
+ .map(({file}) => file);
23
+
24
+ if (recursive) {
25
+ subdirs.forEach(subdir => {
26
+ files.push(...walkDir(subdir, pattern, {recursive}));
27
+ });
28
+ }
29
+
30
+ return files;
31
+ };
32
+
33
+
34
+
35
+ export default walkDir;
backend/xmlTools.ts ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {DOMParser, XMLSerializer} from "xmldom";
3
+
4
+ import * as domUtils from "../inc/domUtils";
5
+
6
+
7
+
8
+ const isWordDirection = direction => {
9
+ const directionTypes = domUtils.childrenWithTag(direction, "direction-type");
10
+
11
+ for (const dt of directionTypes) {
12
+ if (domUtils.hasChildrenWithTag(dt, "words"))
13
+ return true;
14
+ }
15
+
16
+ return false;
17
+ };
18
+
19
+
20
+ const moveWordDirection = measure => {
21
+ //console.log("measure:", measure);
22
+ const words = [];
23
+
24
+ for (let i = 0; i < measure.childNodes.length; ++i) {
25
+ const child = measure.childNodes[i];
26
+ switch (child.tagName) {
27
+ case "direction":
28
+ if (isWordDirection(child)) {
29
+ words.push(child);
30
+ measure.removeChild(child);
31
+ }
32
+
33
+ break;
34
+ case "note":
35
+ const next = measure.childNodes[i + 1];
36
+ words.forEach(word => {
37
+ if (next)
38
+ measure.insertBefore(word, next);
39
+ else
40
+ measure.appendChild(word);
41
+ });
42
+
43
+ return;
44
+ }
45
+ }
46
+ };
47
+
48
+
49
+ const preprocessXml = (xml: string, {
50
+ removeMeasureImplicit = true,
51
+ replaceEncoding = true,
52
+ removeNullDynamics = true,
53
+ fixHeadMarkup = true,
54
+ fixBackSlashes = true,
55
+ roundTempo = true,
56
+ escapedWordsDoubleQuotation = true,
57
+ removeTrivialRests = true,
58
+ removeBadMetronome = true,
59
+ removeInvalidHarmonies = true,
60
+ removeAllHarmonies = false,
61
+ fixChordVoice = true,
62
+ fixBarlines = true,
63
+ removeInvalidClef = true,
64
+ } = {}): string => {
65
+ if (!removeMeasureImplicit && !replaceEncoding && !removeNullDynamics && !fixHeadMarkup && !fixBackSlashes && !roundTempo
66
+ && !escapedWordsDoubleQuotation && !removeTrivialRests && !removeBadMetronome && !removeInvalidHarmonies && !removeAllHarmonies
67
+ && !fixChordVoice && !fixBarlines)
68
+ return xml;
69
+
70
+ // @ts-ignore
71
+ const dom = new DOMParser().parseFromString(xml, "text/xml");
72
+
73
+ if (replaceEncoding) {
74
+ const headNode = Array.prototype.find.call(dom.childNodes, node => node.tagName === "xml");
75
+ if (headNode)
76
+ headNode.data = headNode.data.replace(/UTF-16/, "UTF-8");
77
+ }
78
+
79
+ const needTraverse = removeMeasureImplicit || removeNullDynamics || fixHeadMarkup || fixBackSlashes || roundTempo
80
+ || escapedWordsDoubleQuotation || removeTrivialRests || removeBadMetronome || removeInvalidHarmonies || removeAllHarmonies
81
+ || fixChordVoice || fixBarlines;
82
+ if (needTraverse) {
83
+ domUtils.traverse(dom, node => {
84
+ if (removeMeasureImplicit) {
85
+ if (node.tagName === "measure")
86
+ node.removeAttribute("implicit");
87
+ }
88
+
89
+ if (removeNullDynamics) {
90
+ if (node.tagName === "other-dynamics") {
91
+ const content = node.textContent;
92
+ if (!/\w/.test(content))
93
+ node.parentNode.removeChild(node);
94
+ }
95
+ }
96
+
97
+ if (fixHeadMarkup) {
98
+ if (node.tagName === "measure") {
99
+ //console.log("measure:", node);
100
+ moveWordDirection(node);
101
+ }
102
+ }
103
+
104
+ if (fixBackSlashes) {
105
+ if (["words", "credit-words", "text"].includes(node.tagName)) {
106
+ if (/^\\+/.test(node.textContent) || /\\+$/.test(node.textContent)) {
107
+ console.debug("replaced invalid text:", node.textContent);
108
+ node.textContent = node.textContent.replace(/^\\+/, "").replace(/\\+$/, "");
109
+ }
110
+ }
111
+ }
112
+
113
+ if (roundTempo) {
114
+ if (node.tagName === "sound") {
115
+ const tempo = Number(node.getAttribute("tempo"));
116
+ if (Number.isFinite(tempo) && Math.floor(tempo) !== tempo)
117
+ node.setAttribute("tempo", Math.round(tempo).toFixed(0));
118
+ }
119
+ }
120
+
121
+ if (escapedWordsDoubleQuotation) {
122
+ if (["words", "credit-words", "text"].includes(node.tagName)) {
123
+ if (node.textContent && /"/.test(node.textContent))
124
+ node.textContent = node.textContent.replace(/"/g, "'");
125
+ }
126
+ }
127
+
128
+ if (removeTrivialRests) {
129
+ if (node.tagName === "note") {
130
+ if (domUtils.hasChildrenWithTag(node, "rest") && !domUtils.hasChildrenWithTag(node, "type")) {
131
+ // append an empty tag: <type></type>
132
+ const type = dom.createElement("type");
133
+ node.appendChild(type);
134
+ }
135
+ }
136
+ }
137
+
138
+ if (removeBadMetronome) {
139
+ if (node.tagName === "metronome") {
140
+ if (!domUtils.hasChildrenWithTag(node, "per-minute")) {
141
+ console.debug("metronome without 'per-minute' removed:", node.toString());
142
+ node.parentNode.removeChild(node);
143
+ }
144
+ }
145
+ }
146
+
147
+ if (removeInvalidHarmonies || removeAllHarmonies) {
148
+ if (node.tagName === "harmony") {
149
+ if (removeAllHarmonies)
150
+ node.parentNode.removeChild(node);
151
+ else {
152
+ let next = node.nextSibling;
153
+ while (next && !next.tagName)
154
+ next = next.nextSibling;
155
+
156
+ //console.log("sibling:", next);
157
+ if (!next || next.tagName !== "note") {
158
+ node.parentNode.removeChild(node);
159
+ console.debug("invalid harmony removed:", next && next.tagName);
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ if (fixChordVoice) {
166
+ if (node.tagName === "note" && domUtils.hasChildrenWithTag(node, "chord") && !domUtils.hasChildrenWithTag(node, "voice")) {
167
+ //console.log("bad note:", node);
168
+ const previousNote = domUtils.findPreviousSibling(node, "note");
169
+ if (previousNote) {
170
+ const voice = domUtils.childrenWithTag(previousNote, "voice")[0];
171
+ //console.log("chord voice:", node, voice);
172
+ if (voice)
173
+ node.appendChild(voice.cloneNode(true));
174
+ }
175
+ }
176
+ }
177
+
178
+ if (fixBarlines) {
179
+ if (node.tagName === "barline") {
180
+ if ((node.getAttribute("location") === "right" || domUtils.hasChildrenWithTag(node, "bar-style"))
181
+ && domUtils.findNextSibling(node, "backup")) {
182
+ // move the barline to the end of this measure
183
+ node.parentNode.removeChild(node);
184
+ node.parentNode.appendChild(node);
185
+ }
186
+ }
187
+ }
188
+
189
+ if(removeInvalidClef) {
190
+ if (node.tagName === "attributes") {
191
+ const clef = domUtils.childrenWithTag(node, "clef")[0];
192
+ if (clef) {
193
+ const n = Number(clef.getAttribute("number"));
194
+ if (!domUtils.findPreviousSibling(node, "backup") && n > 1) {
195
+ node.parentNode.removeChild(node);
196
+ console.debug("invalid clef removed:", n);
197
+ }
198
+ }
199
+ }
200
+ }
201
+ });
202
+ }
203
+
204
+ //console.log("dom:", dom);
205
+
206
+ // @ts-ignore
207
+ return new XMLSerializer().serializeToString(dom);
208
+ };
209
+
210
+
211
+
212
+ export {
213
+ preprocessXml,
214
+ };
dist/e5c1442134f1e7dfb9dd.worker.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/favicon.ico ADDED
dist/index.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <!DOCTYPE html><html><head><title>Lotus</title><link href="js/chunk-04395031.dbff2f6b.js" rel="prefetch"><link href="js/chunk-0c4e36c8.95d70738.js" rel="prefetch"><link href="js/chunk-0cbfe13e.73856287.js" rel="prefetch"><link href="js/chunk-117382e0.d47336d3.js" rel="prefetch"><link href="js/chunk-2d0c53c7.d24941b8.js" rel="prefetch"><link href="js/chunk-2d0db258.a4804a7a.js" rel="prefetch"><link href="js/chunk-40965e1a.74707226.js" rel="prefetch"><link href="js/chunk-48b5b2a0.3db5a0aa.js" rel="prefetch"><link href="js/chunk-a06ef50c.1caef24f.js" rel="prefetch"><link href="js/chunk-ae402692.003457bc.js" rel="prefetch"><link href="js/chunk-vendors.20f7f886.js" rel="preload" as="script"><link href="js/index.cbb15892.js" rel="preload" as="script"></head><body><script src="js/chunk-vendors.20f7f886.js"></script><script src="js/index.cbb15892.js"></script></body></html>
dist/js/chunk-04395031.dbff2f6b.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/js/chunk-0c4e36c8.95d70738.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0c4e36c8"],{"010e":function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var a=n("9e5c"),i=n.n(a);const r=new Map;async function s(e){if(!r.get(e)){const t=performance.now(),{default:n}=await e,a=await(await fetch(n)).text(),s=performance.now(),o=new i.a;r.set(e,await new o.Parser(a));const l=performance.now();console.debug("Jison parser loading cost:",s-t,l-s)}return r.get(e)}},"0794":function(e,t,n){e.exports=function(){return new Worker(n.p+"e5c1442134f1e7dfb9dd.worker.js")}},"0e06":function(e,t,n){var a=n("7407");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("b061a5c4",a,!0,{sourceMap:!1,shadowMode:!1})},"13c4":function(e,t,n){var a=n("b437");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("155344be",a,!0,{sourceMap:!1,shadowMode:!1})},"1c08":function(e,t){(function(e){for(var t=/\((?:[^();"#\\]|\\[\s\S]|;.*(?!.)|"(?:[^"\\]|\\.)*"|#(?:\{(?:(?!#\})[\s\S])*#\}|[^{])|<expr>)*\)/.source,n=5,a=0;a<n;a++)t=t.replace(/<expr>/g,(function(){return t}));t=t.replace(/<expr>/g,/[^\s\S]/.source);var i=e.languages.lilypond={comment:/%(?:(?!\{).*|\{[\s\S]*?%\})/,"embedded-scheme":{pattern:RegExp(/(^|[=\s])#(?:"(?:[^"\\]|\\.)*"|[^\s()"]*(?:[^\s()]|<expr>))/.source.replace(/<expr>/g,(function(){return t})),"m"),lookbehind:!0,greedy:!0,inside:{scheme:{pattern:/^(#)[\s\S]+$/,lookbehind:!0,alias:"language-scheme",inside:{"embedded-lilypond":{pattern:/#\{[\s\S]*?#\}/,greedy:!0,inside:{punctuation:/^#\{|#\}$/,lilypond:{pattern:/[\s\S]+/,alias:"language-lilypond",inside:null}}},rest:e.languages.scheme}},punctuation:/#/}},string:{pattern:/"(?:[^"\\]|\\.)*"/,greedy:!0},"class-name":{pattern:/(\\new\s+)[\w-]+/,lookbehind:!0},keyword:{pattern:/\\[a-z][-\w]*/i,inside:{punctuation:/^\\/}},operator:/[=|]|<<|>>/,punctuation:{pattern:/(^|[a-z\d])(?:'+|,+|[_^]?-[_^]?(?:[-+^!>._]|(?=\d))|[_^]\.?|[.!])|[{}()[\]<>^~]|\\[()[\]<>\\!]|--|__/,lookbehind:!0},number:/\b\d+(?:\/\d+)?\b/};i["embedded-scheme"].inside["scheme"].inside["embedded-lilypond"].inside["lilypond"].inside=i,e.languages.ly=i})(Prism)},2669:function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,".source-editor[data-v-d4e36058]{display:inline-block}.prism-editor-wrapper[data-v-d4e36058]{background-color:#f4f2f0;resize:horizontal;width:50em;height:100%;font-family:monospace;font-size:16px;line-height:19px;overflow:auto}",""]),e.exports=t},3122:function(e,t,n){"use strict";var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"source-editor",on:{click:e.onClick}},[t("PrismEditor",{attrs:{lineNumbers:!0,highlight:e.highlighter,readonly:e.disabled,tabSize:4},model:{value:e.editText,callback:function(t){e.editText=t},expression:"editText"}})],1)},i=[],r=(n("cabf"),n("13c4"),n("c197")),s=(n("1c08"),n("2b0e"));function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},o.apply(this,arguments)}var l=13,u=9,c=8,d=89,p=90,g=77,h=57,f=219,m=222,y=192,v=27,b=100,k=3e3,w="undefined"!==typeof window&&navigator&&/Win/i.test(navigator.platform),x="undefined"!==typeof window&&navigator&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),_=s["a"].extend({props:{lineNumbers:{type:Boolean,default:!1},autoStyleLineNumbers:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},value:{type:String,default:""},highlight:{type:Function,required:!0},tabSize:{type:Number,default:2},insertSpaces:{type:Boolean,default:!0},ignoreTabKey:{type:Boolean,default:!1},placeholder:{type:String,default:""}},data:function(){return{capture:!0,history:{stack:[],offset:-1},lineNumbersHeight:"20px",codeData:""}},watch:{value:{immediate:!0,handler:function(e){this.codeData=e||""}},content:{immediate:!0,handler:function(){var e=this;this.lineNumbers&&this.$nextTick((function(){e.setLineNumbersHeight()}))}},lineNumbers:function(){var e=this;this.$nextTick((function(){e.styleLineNumbers(),e.setLineNumbersHeight()}))}},computed:{isEmpty:function(){return 0===this.codeData.length},content:function(){var e=this.highlight(this.codeData)+"<br />";return e},lineNumbersCount:function(){var e=this.codeData.split(/\r\n|\n/).length;return e}},mounted:function(){this._recordCurrentState(),this.styleLineNumbers()},methods:{setLineNumbersHeight:function(){this.lineNumbersHeight=getComputedStyle(this.$refs.pre).height},styleLineNumbers:function(){if(this.lineNumbers&&this.autoStyleLineNumbers){var e=this.$refs.pre,t=this.$el.querySelector(".prism-editor__line-numbers"),n=window.getComputedStyle(e);this.$nextTick((function(){var a="border-top-left-radius",i="border-bottom-left-radius";if(t){t.style[a]=n[a],t.style[i]=n[i],e.style[a]="0",e.style[i]="0";var r=["background-color","margin-top","padding-top","font-family","font-size","line-height"];r.forEach((function(e){t.style[e]=n[e]})),t.style["margin-bottom"]="-"+n["padding-top"]}}))}},_recordCurrentState:function(){var e=this.$refs.textarea;if(e){var t=e.value,n=e.selectionStart,a=e.selectionEnd;this._recordChange({value:t,selectionStart:n,selectionEnd:a})}},_getLines:function(e,t){return e.substring(0,t).split("\n")},_applyEdits:function(e){var t=this.$refs.textarea,n=this.history.stack[this.history.offset];n&&t&&(this.history.stack[this.history.offset]=o({},n,{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd})),this._recordChange(e),this._updateInput(e)},_recordChange:function(e,t){void 0===t&&(t=!1);var n=this.history,a=n.stack,i=n.offset;if(a.length&&i>-1){this.history.stack=a.slice(0,i+1);var r=this.history.stack.length;if(r>b){var s=r-b;this.history.stack=a.slice(s,r),this.history.offset=Math.max(this.history.offset-s,0)}}var l=Date.now();if(t){var u=this.history.stack[this.history.offset];if(u&&l-u.timestamp<k){var c,d,p=/[^a-z0-9]([a-z0-9]+)$/i,g=null===(c=this._getLines(u.value,u.selectionStart).pop())||void 0===c?void 0:c.match(p),h=null===(d=this._getLines(e.value,e.selectionStart).pop())||void 0===d?void 0:d.match(p);if(g&&h&&h[1].startsWith(g[1]))return void(this.history.stack[this.history.offset]=o({},e,{timestamp:l}))}}this.history.stack.push(o({},e,{timestamp:l})),this.history.offset++},_updateInput:function(e){var t=this.$refs.textarea;t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd,this.$emit("input",e.value))},handleChange:function(e){var t=e.target,n=t.value,a=t.selectionStart,i=t.selectionEnd;this._recordChange({value:n,selectionStart:a,selectionEnd:i},!0),this.$emit("input",n)},_undoEdit:function(){var e=this.history,t=e.stack,n=e.offset,a=t[n-1];a&&(this._updateInput(a),this.history.offset=Math.max(n-1,0))},_redoEdit:function(){var e=this.history,t=e.stack,n=e.offset,a=t[n+1];a&&(this._updateInput(a),this.history.offset=Math.min(n+1,t.length-1))},handleKeyDown:function(e){var t=this.tabSize,n=this.insertSpaces,a=this.ignoreTabKey;if(!this.$listeners.keydown||(this.$emit("keydown",e),!e.defaultPrevented)){e.keyCode===v&&(e.target.blur(),this.$emit("blur",e));var i=e.target,r=i.value,s=i.selectionStart,o=i.selectionEnd,b=(n?" ":"\t").repeat(t);if(e.keyCode===u&&!a&&this.capture)if(e.preventDefault(),e.shiftKey){var k=this._getLines(r,s),_=k.length-1,E=this._getLines(r,o).length-1,F=r.split("\n").map((function(e,t){return t>=_&&t<=E&&e.startsWith(b)?e.substring(b.length):e})).join("\n");if(r!==F){var A=k[_];this._applyEdits({value:F,selectionStart:A.startsWith(b)?s-b.length:s,selectionEnd:o-(r.length-F.length)})}}else if(s!==o){var S=this._getLines(r,s),$=S.length-1,C=this._getLines(r,o).length-1,z=S[$];this._applyEdits({value:r.split("\n").map((function(e,t){return t>=$&&t<=C?b+e:e})).join("\n"),selectionStart:/\S/.test(z)?s+b.length:s,selectionEnd:o+b.length*(C-$+1)})}else{var M=s+b.length;this._applyEdits({value:r.substring(0,s)+b+r.substring(o),selectionStart:M,selectionEnd:M})}else if(e.keyCode===c){var L=s!==o,T=r.substring(0,s);if(T.endsWith(b)&&!L){e.preventDefault();var j=s-b.length;this._applyEdits({value:r.substring(0,s-b.length)+r.substring(o),selectionStart:j,selectionEnd:j})}}else if(e.keyCode===l){if(s===o){var P=this._getLines(r,s).pop(),N=null===P||void 0===P?void 0:P.match(/^\s+/);if(N&&N[0]){e.preventDefault();var O="\n"+N[0],D=s+O.length;this._applyEdits({value:r.substring(0,s)+O+r.substring(o),selectionStart:D,selectionEnd:D})}}}else if(e.keyCode===h||e.keyCode===f||e.keyCode===m||e.keyCode===y){var R;e.keyCode===h&&e.shiftKey?R=["(",")"]:e.keyCode===f?R=e.shiftKey?["{","}"]:["[","]"]:e.keyCode===m?R=e.shiftKey?['"','"']:["'","'"]:e.keyCode!==y||e.shiftKey||(R=["`","`"]),s!==o&&R&&(e.preventDefault(),this._applyEdits({value:r.substring(0,s)+R[0]+r.substring(s,o)+R[1]+r.substring(o),selectionStart:s,selectionEnd:o+2}))}else!(x?e.metaKey&&e.keyCode===p:e.ctrlKey&&e.keyCode===p)||e.shiftKey||e.altKey?(x?e.metaKey&&e.keyCode===p&&e.shiftKey:w?e.ctrlKey&&e.keyCode===d:e.ctrlKey&&e.keyCode===p&&e.shiftKey)&&!e.altKey?(e.preventDefault(),this._redoEdit()):e.keyCode!==g||!e.ctrlKey||x&&!e.shiftKey||(e.preventDefault(),this.capture=!this.capture):(e.preventDefault(),this._undoEdit())}}},render:function(e){var t=this,n=e("div",{attrs:{class:"prism-editor__line-width-calc",style:"height: 0px; visibility: hidden; pointer-events: none;"}},"999"),a=e("div",{staticClass:"prism-editor__line-numbers",style:{"min-height":this.lineNumbersHeight},attrs:{"aria-hidden":"true"}},[n,Array.from(Array(this.lineNumbersCount).keys()).map((function(t,n){return e("div",{attrs:{class:"prism-editor__line-number token comment"}},""+ ++n)}))]),i=e("textarea",{ref:"textarea",on:{input:this.handleChange,keydown:this.handleKeyDown,click:function(e){t.$emit("click",e)},keyup:function(e){t.$emit("keyup",e)},focus:function(e){t.$emit("focus",e)},blur:function(e){t.$emit("blur",e)}},staticClass:"prism-editor__textarea",class:{"prism-editor__textarea--empty":this.isEmpty},attrs:{spellCheck:"false",autocapitalize:"off",autocomplete:"off",autocorrect:"off","data-gramm":"false",placeholder:this.placeholder,"data-testid":"textarea",readonly:this.readonly},domProps:{value:this.codeData}}),r=e("pre",{ref:"pre",staticClass:"prism-editor__editor",attrs:{"data-testid":"preview"},domProps:{innerHTML:this.content}}),s=e("div",{staticClass:"prism-editor__container"},[i,r]);return e("div",{staticClass:"prism-editor-wrapper"},[this.lineNumbers&&a,s])}}),E={name:"source-editor",props:{source:String,disabled:Boolean},components:{PrismEditor:_},data(){return{editText:this.source}},methods:{highlighter(e){return Object(r["highlight"])(e,r["languages"].lilypond)},onClick(){document.activeElement&&"TEXTAREA"===document.activeElement.tagName||this.$el.querySelector("textarea").focus()}},watch:{editText(e){this.source!==e&&this.$emit("update:source",e)},source(e){this.editText=e}}},F=E,A=(n("afdd"),n("b2c1"),n("2877")),S=Object(A["a"])(F,a,i,!1,null,"d4e36058",null);t["a"]=S.exports},"3d15":function(e,t,n){"use strict";n.r(t),n.d(t,"createEndpoint",(function(){return i})),n.d(t,"expose",(function(){return g})),n.d(t,"finalizer",(function(){return s})),n.d(t,"proxy",(function(){return $})),n.d(t,"proxyMarker",(function(){return a})),n.d(t,"releaseProxy",(function(){return r})),n.d(t,"transfer",(function(){return S})),n.d(t,"transferHandlers",(function(){return d})),n.d(t,"windowEndpoint",(function(){return C})),n.d(t,"wrap",(function(){return m}));
2
+ /**
3
+ * @license
4
+ * Copyright 2019 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ const a=Symbol("Comlink.proxy"),i=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),s=Symbol("Comlink.finalizer"),o=Symbol("Comlink.thrown"),l=e=>"object"===typeof e&&null!==e||"function"===typeof e,u={canHandle:e=>l(e)&&e[a],serialize(e){const{port1:t,port2:n}=new MessageChannel;return g(e,t),[n,[n]]},deserialize(e){return e.start(),m(e)}},c={canHandle:e=>l(e)&&o in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}},d=new Map([["proxy",u],["throw",c]]);function p(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}function g(e,t=globalThis,n=["*"]){t.addEventListener("message",(function a(i){if(!i||!i.data)return;if(!p(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:r,type:l,path:u}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(M);let d;try{const t=u.slice(0,-1).reduce((e,t)=>e[t],e),n=u.reduce((e,t)=>e[t],e);switch(l){case"GET":d=n;break;case"SET":t[u.slice(-1)[0]]=M(i.data.value),d=!0;break;case"APPLY":d=n.apply(t,c);break;case"CONSTRUCT":{const e=new n(...c);d=$(e)}break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;g(e,n),d=S(t,[t])}break;case"RELEASE":d=void 0;break;default:return}}catch(h){d={value:h,[o]:0}}Promise.resolve(d).catch(e=>({value:e,[o]:0})).then(n=>{const[i,o]=z(n);t.postMessage(Object.assign(Object.assign({},i),{id:r}),o),"RELEASE"===l&&(t.removeEventListener("message",a),f(t),s in e&&"function"===typeof e[s]&&e[s]())}).catch(e=>{const[n,a]=z({value:new TypeError("Unserializable return value"),[o]:0});t.postMessage(Object.assign(Object.assign({},n),{id:r}),a)})})),t.start&&t.start()}function h(e){return"MessagePort"===e.constructor.name}function f(e){h(e)&&e.close()}function m(e,t){const n=new Map;return e.addEventListener("message",(function(e){const{data:t}=e;if(!t||!t.id)return;const a=n.get(t.id);if(a)try{a(t)}finally{n.delete(t.id)}})),_(e,n,[],t)}function y(e){if(e)throw new Error("Proxy has been released and is not useable")}function v(e){return L(e,new Map,{type:"RELEASE"}).then(()=>{f(e)})}const b=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(b.get(e)||0)-1;b.set(e,t),0===t&&v(e)});function w(e,t){const n=(b.get(t)||0)+1;b.set(t,n),k&&k.register(e,t,e)}function x(e){k&&k.unregister(e)}function _(e,t,n=[],a=function(){}){let s=!1;const o=new Proxy(a,{get(a,i){if(y(s),i===r)return()=>{x(o),v(e),t.clear(),s=!0};if("then"===i){if(0===n.length)return{then:()=>o};const a=L(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(M);return a.then.bind(a)}return _(e,t,[...n,i])},set(a,i,r){y(s);const[o,l]=z(r);return L(e,t,{type:"SET",path:[...n,i].map(e=>e.toString()),value:o},l).then(M)},apply(a,r,o){y(s);const l=n[n.length-1];if(l===i)return L(e,t,{type:"ENDPOINT"}).then(M);if("bind"===l)return _(e,t,n.slice(0,-1));const[u,c]=F(o);return L(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:u},c).then(M)},construct(a,i){y(s);const[r,o]=F(i);return L(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:r},o).then(M)}});return w(o,e),o}function E(e){return Array.prototype.concat.apply([],e)}function F(e){const t=e.map(z);return[t.map(e=>e[0]),E(t.map(e=>e[1]))]}const A=new WeakMap;function S(e,t){return A.set(e,t),e}function $(e){return Object.assign(e,{[a]:!0})}function C(e,t=globalThis,n="*"){return{postMessage:(t,a)=>e.postMessage(t,n,a),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function z(e){for(const[t,n]of d)if(n.canHandle(e)){const[a,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:a},i]}return[{type:"RAW",value:e},A.get(e)||[]]}function M(e){switch(e.type){case"HANDLER":return d.get(e.name).deserialize(e.value);case"RAW":return e.value}}function L(e,t,n,a){return new Promise(i=>{const r=T();t.set(r,i),e.start&&e.start(),e.postMessage(Object.assign({id:r},n),a)})}function T(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}},"3f8a":function(e,t,n){"use strict";n("9e2c")},"488d":function(e,t,n){"use strict";var a=function(){var e=this;e._self._c;return e._m(0)},i=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"loading-dots"},[t("div",{staticClass:"ellipsis"},[t("div"),t("div"),t("div"),t("div")])])}],r={name:"loading-dots"},s=r,o=(n("b214"),n("2877")),l=Object(o["a"])(s,a,i,!1,null,"077207e4",null);t["a"]=l.exports},"563b":function(e,t,n){var a=n("6eaa");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("069f7faa",a,!0,{sourceMap:!1,shadowMode:!1})},"6eaa":function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,".loading-dots[data-v-077207e4]{position:absolute;top:0;left:0;width:100%;height:100%;background-color:hsla(0,0%,100%,.26666666666666666)}.ellipsis[data-v-077207e4]{display:inline-block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:80px;height:80px}.ellipsis div[data-v-077207e4]{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:hsla(0,0%,40%,.8);animation-timing-function:cubic-bezier(0,1,1,0)}.ellipsis div[data-v-077207e4]:first-child{left:8px;animation:ellipsis1-077207e4 .6s infinite}.ellipsis div[data-v-077207e4]:nth-child(2){left:8px;animation:ellipsis2-077207e4 .6s infinite}.ellipsis div[data-v-077207e4]:nth-child(3){left:32px;animation:ellipsis2-077207e4 .6s infinite}.ellipsis div[data-v-077207e4]:nth-child(4){left:56px;animation:ellipsis3-077207e4 .6s infinite}@keyframes ellipsis1-077207e4{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes ellipsis3-077207e4{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes ellipsis2-077207e4{0%{transform:translate(0)}to{transform:translate(24px)}}",""]),e.exports=t},7407:function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,".prism-editor-wrapper pre,.prism-editor-wrapper textarea{white-space:pre!important}.prism-editor-wrapper textarea:focus{outline:0}.prism-editor__line-numbers{-webkit-user-select:none;-moz-user-select:none;user-select:none}.prism-editor__container{overflow:unset!important;width:1000%!important}",""]),e.exports=t},8661:function(e,t,n){var a=n("2669");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("769f8f1d",a,!0,{sourceMap:!1,shadowMode:!1})},"919f":function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,".sheet[data-v-682d3448]{white-space:nowrap}.page[data-v-682d3448],.sheet[data-v-682d3448]{display:inline-block}.page[data-v-682d3448]{margin:0 1em;background-color:#f6faff}",""]),e.exports=t},"94c1":function(e,t,n){"use strict";var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"sheet"},e._l(e.documents,(function(n,a){return t("span",{key:a,staticClass:"page",domProps:{innerHTML:e._s(n)}})})),0)},i=[],r={name:"sheet-simple",props:{documents:Array},mounted(){this.bindLinks()},updated(){this.$nextTick(()=>this.bindLinks())},methods:{bindLinks(){const e=this.$el.querySelectorAll("a");for(const t of e)t.onclick=e=>this.$emit("linkClick",e,t.href.baseVal)}}},s=r,o=(n("3f8a"),n("2877")),l=Object(o["a"])(s,a,i,!1,null,"682d3448",null);t["a"]=l.exports},"9e2c":function(e,t,n){var a=n("919f");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("3136d68c",a,!0,{sourceMap:!1,shadowMode:!1})},"9e5c":function(e,t,n){var a,i=n("3d15").wrap,r=n("0794");e.exports=function e(){return this instanceof e?i(r()):a||(a=i(r()))}},ac16:function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,".prism-editor-wrapper{width:100%;height:100%;display:flex;align-items:flex-start;overflow:auto;-o-tab-size:1.5em;tab-size:1.5em;-moz-tab-size:1.5em}@media (-ms-high-contrast:active),(-ms-high-contrast:none){.prism-editor-wrapper .prism-editor__textarea{color:transparent!important}.prism-editor-wrapper .prism-editor__textarea::-moz-selection{background-color:#accef7!important;color:transparent!important}.prism-editor-wrapper .prism-editor__textarea::selection{background-color:#accef7!important;color:transparent!important}}.prism-editor-wrapper .prism-editor__container{position:relative;text-align:left;box-sizing:border-box;padding:0;overflow:hidden;width:100%}.prism-editor-wrapper .prism-editor__line-numbers{height:100%;overflow:hidden;flex-shrink:0;padding-top:4px;margin-top:0;margin-right:10px}.prism-editor-wrapper .prism-editor__line-number{text-align:right;white-space:nowrap}.prism-editor-wrapper .prism-editor__textarea{position:absolute;top:0;left:0;height:100%;width:100%;resize:none;color:inherit;overflow:hidden;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-text-fill-color:transparent}.prism-editor-wrapper .prism-editor__editor,.prism-editor-wrapper .prism-editor__textarea{margin:0;border:0;background:none;box-sizing:inherit;display:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-variant-ligatures:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;-moz-tab-size:inherit;-o-tab-size:inherit;tab-size:inherit;text-indent:inherit;text-rendering:inherit;text-transform:inherit;white-space:pre-wrap;word-wrap:keep-all;overflow-wrap:break-word;padding:0}.prism-editor-wrapper .prism-editor__textarea--empty{-webkit-text-fill-color:inherit!important}.prism-editor-wrapper .prism-editor__editor{position:relative;pointer-events:none}",""]),e.exports=t},afdd:function(e,t,n){"use strict";n("8661")},b214:function(e,t,n){"use strict";n("563b")},b2c1:function(e,t,n){"use strict";n("0e06")},b437:function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,"code[class*=language-],pre[class*=language-]{color:#657b83;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;hyphens:none}code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection{background:#073642}code[class*=language-]::selection,code[class*=language-] ::selection,pre[class*=language-]::selection,pre[class*=language-] ::selection{background:#073642}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background-color:#fdf6e3}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#93a1a1}.token.punctuation{color:#586e75}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#268bd2}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string,.token.url{color:#2aa198}.token.entity{color:#657b83;background:#eee8d5}.token.atrule,.token.attr-value,.token.keyword{color:#859900}.token.class-name,.token.function{color:#b58900}.token.important,.token.regex,.token.variable{color:#cb4b16}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}",""]),e.exports=t},c197:function(e,t,n){(function(t){var n="undefined"!==typeof window?window:"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},a=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,a={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof r?new r(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e["__id"]||Object.defineProperty(e,"__id",{value:++n}),e["__id"]},clone:function e(t,n){var a,r;switch(n=n||{},i.util.type(t)){case"Object":if(r=i.util.objId(t),n[r])return n[r];for(var s in a={},n[r]=a,t)t.hasOwnProperty(s)&&(a[s]=e(t[s],n));return a;case"Array":return r=i.util.objId(t),n[r]?n[r]:(a=[],n[r]=a,t.forEach((function(t,i){a[i]=e(t,n)})),a);default:return t}},getLanguage:function(e){while(e){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"===typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(a){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(a.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){var a="no-"+t;while(e){var i=e.classList;if(i.contains(t))return!0;if(i.contains(a))return!1;e=e.parentElement}return!!n}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){a=a||i.languages;var r=a[e],s={};for(var o in r)if(r.hasOwnProperty(o)){if(o==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(o)||(s[o]=r[o])}var u=a[e];return a[e]=s,i.languages.DFS(i.languages,(function(t,n){n===u&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,a,r){r=r||{};var s=i.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],a||o);var l=t[o],u=i.util.type(l);"Object"!==u||r[s(l)]?"Array"!==u||r[s(l)]||(r[s(l)]=!0,e(l,n,o,r)):(r[s(l)]=!0,e(l,n,null,r))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),i.hooks.run("before-all-elements-highlight",a);for(var r,s=0;r=a.elements[s++];)i.highlightElement(r,!0===t,a.callback)},highlightElement:function(t,n,a){var r=i.util.getLanguage(t),s=i.languages[r];i.util.setLanguage(t,r);var o=t.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&i.util.setLanguage(o,r);var l=t.textContent,u={element:t,language:r,grammar:s,code:l};function c(e){u.highlightedCode=e,i.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i.hooks.run("after-highlight",u),i.hooks.run("complete",u),a&&a.call(u.element)}if(i.hooks.run("before-sanity-check",u),o=u.element.parentElement,o&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!u.code)return i.hooks.run("complete",u),void(a&&a.call(u.element));if(i.hooks.run("before-highlight",u),u.grammar)if(n&&e.Worker){var d=new Worker(i.filename);d.onmessage=function(e){c(e.data)},d.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else c(i.highlight(u.code,u.grammar,u.language));else c(i.util.encode(u.code))},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(i.hooks.run("before-tokenize",a),!a.grammar)throw new Error('The language "'+a.language+'" has no grammar.');return a.tokens=i.tokenize(a.code,a.grammar),i.hooks.run("after-tokenize",a),r.stringify(i.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest}var i=new l;return u(i,i.head,e),o(e,i,t,i.head,0),d(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}},Token:r};function r(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function s(e,t,n,a){e.lastIndex=t;var i=e.exec(n);if(i&&a&&i[1]){var r=i[1].length;i.index+=r,i[0]=i[0].slice(r)}return i}function o(e,t,n,a,l,d){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var g=n[p];g=Array.isArray(g)?g:[g];for(var h=0;h<g.length;++h){if(d&&d.cause==p+","+h)return;var f=g[h],m=f.inside,y=!!f.lookbehind,v=!!f.greedy,b=f.alias;if(v&&!f.pattern.global){var k=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,k+"g")}for(var w=f.pattern||f,x=a.next,_=l;x!==t.tail;_+=x.value.length,x=x.next){if(d&&_>=d.reach)break;var E=x.value;if(t.length>e.length)return;if(!(E instanceof r)){var F,A=1;if(v){if(F=s(w,_,e,y),!F||F.index>=e.length)break;var S=F.index,$=F.index+F[0].length,C=_;C+=x.value.length;while(S>=C)x=x.next,C+=x.value.length;if(C-=x.value.length,_=C,x.value instanceof r)continue;for(var z=x;z!==t.tail&&(C<$||"string"===typeof z.value);z=z.next)A++,C+=z.value.length;A--,E=e.slice(_,C),F.index-=_}else if(F=s(w,0,E,y),!F)continue;S=F.index;var M=F[0],L=E.slice(0,S),T=E.slice(S+M.length),j=_+E.length;d&&j>d.reach&&(d.reach=j);var P=x.prev;L&&(P=u(t,P,L),_+=L.length),c(t,P,A);var N=new r(p,m?i.tokenize(M,m):M,b,M);if(x=u(t,P,N),T&&u(t,x,T),A>1){var O={cause:p+","+h,reach:j};o(e,t,n,x.prev,_,O),d&&O.reach>d.reach&&(d.reach=O.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function u(e,t,n){var a=t.next,i={value:n,prev:t,next:a};return t.next=i,a.prev=i,e.length++,i}function c(e,t,n){for(var a=t.next,i=0;i<n&&a!==e.tail;i++)a=a.next;t.next=a,a.prev=t,e.length-=i}function d(e){var t=[],n=e.head.next;while(n!==e.tail)t.push(n.value),n=n.next;return t}if(e.Prism=i,r.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var r={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(r.classes,s):r.classes.push(s)),i.hooks.run("wrap",r);var o="";for(var l in r.attributes)o+=" "+l+'="'+(r.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+o+">"+r.content+"</"+r.tag+">"},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,r=n.code,s=n.immediateClose;e.postMessage(i.highlight(r,i.languages[a],a)),s&&e.close()}),!1),i):i;var p=i.util.currentScript();function g(){i.manual||i.highlightAll()}if(p&&(i.filename=p.src,p.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var h=document.readyState;"loading"===h||"interactive"===h&&p&&p.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return i}(n);
8
+ /**
9
+ * Prism: Lightweight, robust, elegant syntax highlighting
10
+ *
11
+ * @license MIT <https://opensource.org/licenses/MIT>
12
+ * @author Lea Verou <https://lea.verou.me>
13
+ * @namespace
14
+ * @public
15
+ */e.exports&&(e.exports=a),"undefined"!==typeof t&&(t.Prism=a),a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup["tag"].inside["attr-value"].inside["entity"]=a.languages.markup["entity"],a.languages.markup["doctype"].inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes["title"]=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[t]},n["cdata"]=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};i["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var r={};r[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:i},a.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css["atrule"].inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,function(){if("undefined"!==typeof a&&"undefined"!==typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e="Loading…",t=function(e,t){return"✖ Error "+e+" while fetching file: "+t},n="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",s="loading",o="loaded",l="failed",u="pre[data-src]:not(["+r+'="'+o+'"]):not(['+r+'="'+s+'"])';a.hooks.add("before-highlightall",(function(e){e.selector+=", "+u})),a.hooks.add("before-sanity-check",(function(t){var n=t.element;if(n.matches(u)){t.code="",n.setAttribute(r,s);var c=n.appendChild(document.createElement("CODE"));c.textContent=e;var g=n.getAttribute("data-src"),h=t.language;if("none"===h){var f=(/\.(\w+)$/.exec(g)||[,"none"])[1];h=i[f]||f}a.util.setLanguage(c,h),a.util.setLanguage(n,h);var m=a.plugins.autoloader;m&&m.loadLanguages(h),d(g,(function(e){n.setAttribute(r,o);var t=p(n.getAttribute("data-range"));if(t){var i=e.split(/\r\n?|\n/g),s=t[0],l=null==t[1]?i.length:t[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(s,l).join("\n"),n.hasAttribute("data-start")||n.setAttribute("data-start",String(s+1))}c.textContent=e,a.highlightElement(c)}),(function(e){n.setAttribute(r,l),c.textContent=e}))}})),a.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(u),i=0;t=n[i++];)a.highlightElement(t)}};var c=!1;a.fileHighlight=function(){c||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),c=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}}function d(e,a,i){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?a(r.responseText):r.status>=400?i(t(r.status,r.statusText)):i(n))},r.send(null)}function p(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),a=t[2],i=t[3];return a?i?[n,Number(i)]:[n,void 0]:[n,n]}}}()}).call(this,n("c8ba"))},cabf:function(e,t,n){var a=n("ac16");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("499e").default;i("3072be6e",a,!0,{sourceMap:!1,shadowMode:!1})}}]);
16
+ //# sourceMappingURL=chunk-0c4e36c8.95d70738.js.map
dist/js/chunk-0cbfe13e.73856287.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0cbfe13e"],{"00ce":function(e,t,r){"use strict";var o,n=r("a645"),i=r("417f"),a=r("dc99"),s=r("1409"),l=r("67ee"),c=r("0d25"),u=r("67d9"),p=Function,f=function(e){try{return p('"use strict"; return ('+e+").constructor;")()}catch(t){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(L){h=null}var y=function(){throw new c},d=h?function(){try{return y}catch(e){try{return h(arguments,"callee").get}catch(t){return y}}}():y,m=r("5156")(),g=r("0a36")(),b=Object.getPrototypeOf||(g?function(e){return e.__proto__}:null),v={},w="undefined"!==typeof Uint8Array&&b?b(Uint8Array):o,S={__proto__:null,"%AggregateError%":"undefined"===typeof AggregateError?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"===typeof ArrayBuffer?o:ArrayBuffer,"%ArrayIteratorPrototype%":m&&b?b([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"===typeof Atomics?o:Atomics,"%BigInt%":"undefined"===typeof BigInt?o:BigInt,"%BigInt64Array%":"undefined"===typeof BigInt64Array?o:BigInt64Array,"%BigUint64Array%":"undefined"===typeof BigUint64Array?o:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"===typeof DataView?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":i,"%Float32Array%":"undefined"===typeof Float32Array?o:Float32Array,"%Float64Array%":"undefined"===typeof Float64Array?o:Float64Array,"%FinalizationRegistry%":"undefined"===typeof FinalizationRegistry?o:FinalizationRegistry,"%Function%":p,"%GeneratorFunction%":v,"%Int8Array%":"undefined"===typeof Int8Array?o:Int8Array,"%Int16Array%":"undefined"===typeof Int16Array?o:Int16Array,"%Int32Array%":"undefined"===typeof Int32Array?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&b?b(b([][Symbol.iterator]())):o,"%JSON%":"object"===typeof JSON?JSON:o,"%Map%":"undefined"===typeof Map?o:Map,"%MapIteratorPrototype%":"undefined"!==typeof Map&&m&&b?b((new Map)[Symbol.iterator]()):o,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"===typeof Promise?o:Promise,"%Proxy%":"undefined"===typeof Proxy?o:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"===typeof Reflect?o:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"===typeof Set?o:Set,"%SetIteratorPrototype%":"undefined"!==typeof Set&&m&&b?b((new Set)[Symbol.iterator]()):o,"%SharedArrayBuffer%":"undefined"===typeof SharedArrayBuffer?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&b?b(""[Symbol.iterator]()):o,"%Symbol%":m?Symbol:o,"%SyntaxError%":l,"%ThrowTypeError%":d,"%TypedArray%":w,"%TypeError%":c,"%Uint8Array%":"undefined"===typeof Uint8Array?o:Uint8Array,"%Uint8ClampedArray%":"undefined"===typeof Uint8ClampedArray?o:Uint8ClampedArray,"%Uint16Array%":"undefined"===typeof Uint16Array?o:Uint16Array,"%Uint32Array%":"undefined"===typeof Uint32Array?o:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"===typeof WeakMap?o:WeakMap,"%WeakRef%":"undefined"===typeof WeakRef?o:WeakRef,"%WeakSet%":"undefined"===typeof WeakSet?o:WeakSet};if(b)try{null.error}catch(L){var x=b(b(L));S["%Error.prototype%"]=x}var O=function e(t){var r;if("%AsyncFunction%"===t)r=f("async function () {}");else if("%GeneratorFunction%"===t)r=f("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=f("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&b&&(r=b(n.prototype))}return S[t]=r,r},j={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},A=r("0f7c"),P=r("9671"),k=A.call(Function.call,Array.prototype.concat),E=A.call(Function.apply,Array.prototype.splice),I=A.call(Function.call,String.prototype.replace),_=A.call(Function.call,String.prototype.slice),T=A.call(Function.call,RegExp.prototype.exec),N=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C=/\\(\\)?/g,F=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var o=[];return I(e,N,(function(e,t,r,n){o[o.length]=r?I(n,C,"$1"):t||e})),o},R=function(e,t){var r,o=e;if(P(j,o)&&(r=j[o],o="%"+r[0]+"%"),P(S,o)){var n=S[o];if(n===v&&(n=O(o)),"undefined"===typeof n&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new l("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!==typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!==typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=F(e),o=r.length>0?r[0]:"",n=R("%"+o+"%",t),i=n.name,a=n.value,s=!1,u=n.alias;u&&(o=u[0],E(r,k([0,1],u)));for(var p=1,f=!0;p<r.length;p+=1){var y=r[p],d=_(y,0,1),m=_(y,-1);if(('"'===d||"'"===d||"`"===d||'"'===m||"'"===m||"`"===m)&&d!==m)throw new l("property names with quotes must have matching quotes");if("constructor"!==y&&f||(s=!0),o+="."+y,i="%"+o+"%",P(S,i))a=S[i];else if(null!=a){if(!(y in a)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(h&&p+1>=r.length){var g=h(a,y);f=!!g,a=f&&"get"in g&&!("originalValue"in g.get)?g.get:a[y]}else f=P(a,y),a=a[y];f&&!s&&(S[i]=a)}}return a}},"0a36":function(e,t,r){"use strict";var o={__proto__:null,foo:{}},n=Object;e.exports=function(){return{__proto__:o}.foo===o.foo&&!(o instanceof n)}},"0b16":function(e,t,r){"use strict";var o=r("9d88");function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var i=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["<",">",'"',"`"," ","\r","\n","\t"],c=["{","}","|","\\","^","`"].concat(l),u=["'"].concat(c),p=["%","/","?",";","#"].concat(u),f=["/","?","#"],h=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r("184d");function w(e,t,r){if(e&&"object"===typeof e&&e instanceof n)return e;var o=new n;return o.parse(e,t,r),o}function S(e){return"string"===typeof e&&(e=w(e)),e instanceof n?e.format():n.prototype.format.call(e)}function x(e,t){return w(e,!1,!0).resolve(t)}function O(e,t){return e?w(e,!1,!0).resolveObject(t):t}n.prototype.parse=function(e,t,r){if("string"!==typeof e)throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),a=-1!==n&&n<e.indexOf("#")?"?":"#",l=e.split(a),c=/\\/g;l[0]=l[0].replace(c,"/"),e=l.join(a);var w=e;if(w=w.trim(),!r&&1===e.split("#").length){var S=s.exec(w);if(S)return this.path=w,this.href=w,this.pathname=S[1],S[2]?(this.search=S[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var x=i.exec(w);if(x){x=x[0];var O=x.toLowerCase();this.protocol=O,w=w.substr(x.length)}if(r||x||w.match(/^\/\/[^@/]+@[^@/]+/)){var j="//"===w.substr(0,2);!j||x&&g[x]||(w=w.substr(2),this.slashes=!0)}if(!g[x]&&(j||x&&!b[x])){for(var A,P,k=-1,E=0;E<f.length;E++){var I=w.indexOf(f[E]);-1!==I&&(-1===k||I<k)&&(k=I)}P=-1===k?w.lastIndexOf("@"):w.lastIndexOf("@",k),-1!==P&&(A=w.slice(0,P),w=w.slice(P+1),this.auth=decodeURIComponent(A)),k=-1;for(E=0;E<p.length;E++){I=w.indexOf(p[E]);-1!==I&&(-1===k||I<k)&&(k=I)}-1===k&&(k=w.length),this.host=w.slice(0,k),w=w.slice(k),this.parseHost(),this.hostname=this.hostname||"";var _="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!_)for(var T=this.hostname.split(/\./),N=(E=0,T.length);E<N;E++){var C=T[E];if(C&&!C.match(y)){for(var F="",R=0,L=C.length;R<L;R++)C.charCodeAt(R)>127?F+="x":F+=C[R];if(!F.match(y)){var D=T.slice(0,E),M=T.slice(E+1),U=C.match(d);U&&(D.push(U[1]),M.unshift(U[2])),M.length&&(w="/"+M.join(".")+w),this.hostname=D.join(".");break}}}this.hostname.length>h?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=o.toASCII(this.hostname));var B=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+B,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!m[O])for(E=0,N=u.length;E<N;E++){var q=u[E];if(-1!==w.indexOf(q)){var $=encodeURIComponent(q);$===q&&($=escape(q)),w=w.split(q).join($)}}var H=w.indexOf("#");-1!==H&&(this.hash=w.substr(H),w=w.slice(0,H));var G=w.indexOf("?");if(-1!==G?(this.search=w.substr(G),this.query=w.substr(G+1),t&&(this.query=v.parse(this.query)),w=w.slice(0,G)):t&&(this.search="",this.query={}),w&&(this.pathname=w),b[O]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){B=this.pathname||"";var J=this.search||"";this.path=B+J}return this.href=this.format(),this},n.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",o=this.hash||"",n=!1,i="";this.host?n=e+this.host:this.hostname&&(n=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&"object"===typeof this.query&&Object.keys(this.query).length&&(i=v.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||b[t])&&!1!==n?(n="//"+(n||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):n||(n=""),o&&"#"!==o.charAt(0)&&(o="#"+o),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})),a=a.replace("#","%23"),t+n+r+a+o},n.prototype.resolve=function(e){return this.resolveObject(w(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if("string"===typeof e){var t=new n;t.parse(e,!1,!0),e=t}for(var r=new n,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),l=0;l<s.length;l++){var c=s[l];"protocol"!==c&&(r[c]=e[c])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!b[e.protocol]){for(var u=Object.keys(e),p=0;p<u.length;p++){var f=u[p];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||g[e.protocol])r.pathname=e.pathname;else{var h=(e.pathname||"").split("/");while(h.length&&!(e.host=h.shift()));e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var y=r.pathname||"",d=r.search||"";r.path=y+d}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var m=r.pathname&&"/"===r.pathname.charAt(0),v=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=v||m||r.host&&e.pathname,S=w,x=r.pathname&&r.pathname.split("/")||[],O=(h=e.pathname&&e.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(O&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),w=w&&(""===h[0]||""===x[0])),v)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,x=h;else if(h.length)x||(x=[]),x.pop(),x=x.concat(h),r.search=e.search,r.query=e.query;else if(null!=e.search){if(O){r.host=x.shift(),r.hostname=r.host;var j=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");j&&(r.auth=j.shift(),r.hostname=j.shift(),r.host=r.hostname)}return r.search=e.search,r.query=e.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=x.slice(-1)[0],P=(r.host||e.host||x.length>1)&&("."===A||".."===A)||""===A,k=0,E=x.length;E>=0;E--)A=x[E],"."===A?x.splice(E,1):".."===A?(x.splice(E,1),k++):k&&(x.splice(E,1),k--);if(!w&&!S)for(;k--;k)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),P&&"/"!==x.join("/").substr(-1)&&x.push("");var I=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(O){r.hostname=I?"":x.length?x.shift():"",r.host=r.hostname;j=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");j&&(r.auth=j.shift(),r.hostname=j.shift(),r.host=r.hostname)}return w=w||r.host&&x.length,w&&!I&&x.unshift(""),x.length>0?r.pathname=x.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},t.parse=w,t.resolve=x,t.resolveObject=O,t.format=S,t.Url=n},"0d25":function(e,t,r){"use strict";e.exports=TypeError},"0f7c":function(e,t,r){"use strict";var o=r("688e");e.exports=Function.prototype.bind||o},1:function(e,t){},1409:function(e,t,r){"use strict";e.exports=ReferenceError},1696:function(e,t,r){"use strict";e.exports=function(){if("function"!==typeof Symbol||"function"!==typeof Object.getOwnPropertySymbols)return!1;if("symbol"===typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"===typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;var o=42;for(t in e[t]=o,e)return!1;if("function"===typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"===typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"===typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(i.value!==o||!0!==i.enumerable)return!1}return!0}},"184d":function(e,t,r){"use strict";var o=r("f177"),n=r("2500"),i=r("bbc7");e.exports={formats:i,parse:n,stringify:o}},2500:function(e,t,r){"use strict";var o=r("a29f"),n=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},s=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},l=function(e,t){return e&&"string"===typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},c="utf8=%26%2310003%3B",u="utf8=%E2%9C%93",p=function(e,t){var r={__proto__:null},p=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;p=p.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var f,h=t.parameterLimit===1/0?void 0:t.parameterLimit,y=p.split(t.delimiter,h),d=-1,m=t.charset;if(t.charsetSentinel)for(f=0;f<y.length;++f)0===y[f].indexOf("utf8=")&&(y[f]===u?m="utf-8":y[f]===c&&(m="iso-8859-1"),d=f,f=y.length);for(f=0;f<y.length;++f)if(f!==d){var g,b,v=y[f],w=v.indexOf("]="),S=-1===w?v.indexOf("="):w+1;-1===S?(g=t.decoder(v,a.decoder,m,"key"),b=t.strictNullHandling?null:""):(g=t.decoder(v.slice(0,S),a.decoder,m,"key"),b=o.maybeMap(l(v.slice(S+1),t),(function(e){return t.decoder(e,a.decoder,m,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===m&&(b=s(String(b))),v.indexOf("[]=")>-1&&(b=i(b)?[b]:b);var x=n.call(r,g);x&&"combine"===t.duplicates?r[g]=o.combine(r[g],b):x&&"last"!==t.duplicates||(r[g]=b)}return r},f=function(e,t,r,o){for(var n=o?t:l(t,r),i=e.length-1;i>=0;--i){var a,s=e[i];if("[]"===s&&r.parseArrays)a=r.allowEmptyArrays&&(""===n||r.strictNullHandling&&null===n)?[]:[].concat(n);else{a=r.plainObjects?{__proto__:null}:{};var c="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,p=parseInt(u,10);r.parseArrays||""!==u?!isNaN(p)&&s!==u&&String(p)===u&&p>=0&&r.parseArrays&&p<=r.arrayLimit?(a=[],a[p]=n):"__proto__"!==u&&(a[u]=n):a={0:n}}n=a}return n},h=function(e,t,r,o){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,l=r.depth>0&&a.exec(i),c=l?i.slice(0,l.index):i,u=[];if(c){if(!r.plainObjects&&n.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}var p=0;while(r.depth>0&&null!==(l=s.exec(i))&&p<r.depth){if(p+=1,!r.plainObjects&&n.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}if(l){if(!0===r.strictDepth)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");u.push("["+i.slice(l.index)+"]")}return f(u,t,r,o)}},y=function(e){if(!e)return a;if("undefined"!==typeof e.allowEmptyArrays&&"boolean"!==typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if("undefined"!==typeof e.decodeDotInKeys&&"boolean"!==typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&"undefined"!==typeof e.decoder&&"function"!==typeof e.decoder)throw new TypeError("Decoder has to be a function.");if("undefined"!==typeof e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t="undefined"===typeof e.charset?a.charset:e.charset,r="undefined"===typeof e.duplicates?a.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");var n="undefined"===typeof e.allowDots?!0===e.decodeDotInKeys||a.allowDots:!!e.allowDots;return{allowDots:n,allowEmptyArrays:"boolean"===typeof e.allowEmptyArrays?!!e.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"===typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"===typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"===typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"===typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"===typeof e.comma?e.comma:a.comma,decodeDotInKeys:"boolean"===typeof e.decodeDotInKeys?e.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"===typeof e.decoder?e.decoder:a.decoder,delimiter:"string"===typeof e.delimiter||o.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"===typeof e.depth||!1===e.depth?+e.depth:a.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"===typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"===typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"===typeof e.plainObjects?e.plainObjects:a.plainObjects,strictDepth:"boolean"===typeof e.strictDepth?!!e.strictDepth:a.strictDepth,strictNullHandling:"boolean"===typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}};e.exports=function(e,t){var r=y(t);if(""===e||null===e||"undefined"===typeof e)return r.plainObjects?{__proto__:null}:{};for(var n="string"===typeof e?p(e,r):e,i=r.plainObjects?{__proto__:null}:{},a=Object.keys(n),s=0;s<a.length;++s){var l=a[s],c=h(l,n[l],r,"string"===typeof e);i=o.merge(i,c,r)}return!0===r.allowSparse?i:o.compact(i)}},2714:function(e,t,r){(function(t){var o="function"===typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=o&&n&&"function"===typeof n.get?n.get:null,a=o&&Map.prototype.forEach,s="function"===typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&l&&"function"===typeof l.get?l.get:null,u=s&&Set.prototype.forEach,p="function"===typeof WeakMap&&WeakMap.prototype,f=p?WeakMap.prototype.has:null,h="function"===typeof WeakSet&&WeakSet.prototype,y=h?WeakSet.prototype.has:null,d="function"===typeof WeakRef&&WeakRef.prototype,m=d?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,b=Object.prototype.toString,v=Function.prototype.toString,w=String.prototype.match,S=String.prototype.slice,x=String.prototype.replace,O=String.prototype.toUpperCase,j=String.prototype.toLowerCase,A=RegExp.prototype.test,P=Array.prototype.concat,k=Array.prototype.join,E=Array.prototype.slice,I=Math.floor,_="function"===typeof BigInt?BigInt.prototype.valueOf:null,T=Object.getOwnPropertySymbols,N="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?Symbol.prototype.toString:null,C="function"===typeof Symbol&&"object"===typeof Symbol.iterator,F="function"===typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===C||"symbol")?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,L=("function"===typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function D(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||A.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"===typeof e){var o=e<0?-I(-e):I(e);if(o!==e){var n=String(o),i=S.call(t,n.length+1);return x.call(n,r,"$&_")+"."+x.call(x.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return x.call(t,r,"$&_")}var M=r(1),U=M.custom,B=X(U)?U:null,W={__proto__:null,double:'"',single:"'"},q={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function $(e,t,r){var o=r.quoteStyle||t,n=W[o];return n+e+n}function H(e){return x.call(String(e),/"/g,"&quot;")}function G(e){return"[object Array]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function J(e){return"[object Date]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function K(e){return"[object RegExp]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function z(e){return"[object Error]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function V(e){return"[object String]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function Q(e){return"[object Number]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function Z(e){return"[object Boolean]"===re(e)&&(!F||!("object"===typeof e&&F in e))}function X(e){if(C)return e&&"object"===typeof e&&e instanceof Symbol;if("symbol"===typeof e)return!0;if(!e||"object"!==typeof e||!N)return!1;try{return N.call(e),!0}catch(t){}return!1}function Y(e){if(!e||"object"!==typeof e||!_)return!1;try{return _.call(e),!0}catch(t){}return!1}e.exports=function e(r,o,n,s){var l=o||{};if(te(l,"quoteStyle")&&!te(W,l.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(te(l,"maxStringLength")&&("number"===typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var p=!te(l,"customInspect")||l.customInspect;if("boolean"!==typeof p&&"symbol"!==p)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(te(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(te(l,"numericSeparator")&&"boolean"!==typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=l.numericSeparator;if("undefined"===typeof r)return"undefined";if(null===r)return"null";if("boolean"===typeof r)return r?"true":"false";if("string"===typeof r)return pe(r,l);if("number"===typeof r){if(0===r)return 1/0/r>0?"0":"-0";var h=String(r);return f?D(r,h):h}if("bigint"===typeof r){var y=String(r)+"n";return f?D(r,y):y}var d="undefined"===typeof l.depth?5:l.depth;if("undefined"===typeof n&&(n=0),n>=d&&d>0&&"object"===typeof r)return G(r)?"[Array]":"[Object]";var m=ge(l,n);if("undefined"===typeof s)s=[];else if(ne(s,r)>=0)return"[Circular]";function b(t,r,o){if(r&&(s=E.call(s),s.push(r)),o){var i={depth:l.depth};return te(l,"quoteStyle")&&(i.quoteStyle=l.quoteStyle),e(t,i,n+1,s)}return e(t,l,n+1,s)}if("function"===typeof r&&!K(r)){var v=oe(r),w=ve(r,b);return"[Function"+(v?": "+v:" (anonymous)")+"]"+(w.length>0?" { "+k.call(w,", ")+" }":"")}if(X(r)){var O=C?x.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):N.call(r);return"object"!==typeof r||C?O:he(O)}if(ue(r)){for(var A="<"+j.call(String(r.nodeName)),I=r.attributes||[],T=0;T<I.length;T++)A+=" "+I[T].name+"="+$(H(I[T].value),"double",l);return A+=">",r.childNodes&&r.childNodes.length&&(A+="..."),A+="</"+j.call(String(r.nodeName))+">",A}if(G(r)){if(0===r.length)return"[]";var U=ve(r,b);return m&&!me(U)?"["+be(U,m)+"]":"[ "+k.call(U,", ")+" ]"}if(z(r)){var q=ve(r,b);return"cause"in Error.prototype||!("cause"in r)||R.call(r,"cause")?0===q.length?"["+String(r)+"]":"{ ["+String(r)+"] "+k.call(q,", ")+" }":"{ ["+String(r)+"] "+k.call(P.call("[cause]: "+b(r.cause),q),", ")+" }"}if("object"===typeof r&&p){if(B&&"function"===typeof r[B]&&M)return M(r,{depth:d-n});if("symbol"!==p&&"function"===typeof r.inspect)return r.inspect()}if(ie(r)){var ee=[];return a&&a.call(r,(function(e,t){ee.push(b(t,r,!0)+" => "+b(e,r))})),de("Map",i.call(r),ee,m)}if(le(r)){var fe=[];return u&&u.call(r,(function(e){fe.push(b(e,r))})),de("Set",c.call(r),fe,m)}if(ae(r))return ye("WeakMap");if(ce(r))return ye("WeakSet");if(se(r))return ye("WeakRef");if(Q(r))return he(b(Number(r)));if(Y(r))return he(b(_.call(r)));if(Z(r))return he(g.call(r));if(V(r))return he(b(String(r)));if("undefined"!==typeof window&&r===window)return"{ [object Window] }";if("undefined"!==typeof globalThis&&r===globalThis||"undefined"!==typeof t&&r===t)return"{ [object globalThis] }";if(!J(r)&&!K(r)){var we=ve(r,b),Se=L?L(r)===Object.prototype:r instanceof Object||r.constructor===Object,xe=r instanceof Object?"":"null prototype",Oe=!Se&&F&&Object(r)===r&&F in r?S.call(re(r),8,-1):xe?"Object":"",je=Se||"function"!==typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"",Ae=je+(Oe||xe?"["+k.call(P.call([],Oe||[],xe||[]),": ")+"] ":"");return 0===we.length?Ae+"{}":m?Ae+"{"+be(we,m)+"}":Ae+"{ "+k.call(we,", ")+" }"}return String(r)};var ee=Object.prototype.hasOwnProperty||function(e){return e in this};function te(e,t){return ee.call(e,t)}function re(e){return b.call(e)}function oe(e){if(e.name)return e.name;var t=w.call(v.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function ne(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}function ie(e){if(!i||!e||"object"!==typeof e)return!1;try{i.call(e);try{c.call(e)}catch(t){return!0}return e instanceof Map}catch(r){}return!1}function ae(e){if(!f||!e||"object"!==typeof e)return!1;try{f.call(e,f);try{y.call(e,y)}catch(t){return!0}return e instanceof WeakMap}catch(r){}return!1}function se(e){if(!m||!e||"object"!==typeof e)return!1;try{return m.call(e),!0}catch(t){}return!1}function le(e){if(!c||!e||"object"!==typeof e)return!1;try{c.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(r){}return!1}function ce(e){if(!y||!e||"object"!==typeof e)return!1;try{y.call(e,y);try{f.call(e,f)}catch(t){return!0}return e instanceof WeakSet}catch(r){}return!1}function ue(e){return!(!e||"object"!==typeof e)&&("undefined"!==typeof HTMLElement&&e instanceof HTMLElement||"string"===typeof e.nodeName&&"function"===typeof e.getAttribute)}function pe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return pe(S.call(e,0,t.maxStringLength),t)+o}var n=q[t.quoteStyle||"single"];n.lastIndex=0;var i=x.call(x.call(e,n,"\\$1"),/[\x00-\x1f]/g,fe);return $(i,"single",t)}function fe(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+O.call(t.toString(16))}function he(e){return"Object("+e+")"}function ye(e){return e+" { ? }"}function de(e,t,r,o){var n=o?be(r,o):k.call(r,", ");return e+" ("+t+") {"+n+"}"}function me(e){for(var t=0;t<e.length;t++)if(ne(e[t],"\n")>=0)return!1;return!0}function ge(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"===typeof e.indent&&e.indent>0))return null;r=k.call(Array(e.indent+1)," ")}return{base:r,prev:k.call(Array(t+1),r)}}function be(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+k.call(e,","+r)+"\n"+t.prev}function ve(e,t){var r=G(e),o=[];if(r){o.length=e.length;for(var n=0;n<e.length;n++)o[n]=te(e,n)?t(e[n],e):""}var i,a="function"===typeof T?T(e):[];if(C){i={};for(var s=0;s<a.length;s++)i["$"+a[s]]=a[s]}for(var l in e)te(e,l)&&(r&&String(Number(l))===l&&l<e.length||C&&i["$"+l]instanceof Symbol||(A.call(/[^\w$]/,l)?o.push(t(l,e)+": "+t(e[l],e)):o.push(l+": "+t(e[l],e))));if("function"===typeof T)for(var c=0;c<a.length;c++)R.call(e,a[c])&&o.push("["+t(a[c])+"]: "+t(e[a[c]],e));return o}}).call(this,r("c8ba"))},"2aa9":function(e,t,r){"use strict";var o=r("00ce"),n=o("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(i){n=null}e.exports=n},"3eb1":function(e,t,r){"use strict";var o=r("0f7c"),n=r("00ce"),i=r("d009"),a=r("0d25"),s=n("%Function.prototype.apply%"),l=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||o.call(l,s),u=r("71c9"),p=n("%Math.max%");e.exports=function(e){if("function"!==typeof e)throw new a("a function is required");var t=c(o,l,arguments);return i(t,1+p(0,e.length-(arguments.length-1)),!0)};var f=function(){return c(o,s,arguments)};u?u(e.exports,"apply",{value:f}):e.exports.apply=f},"417f":function(e,t,r){"use strict";e.exports=EvalError},4332:function(e,t,r){var o=r("b11f");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);var n=r("499e").default;n("0883be1e",o,!0,{sourceMap:!1,shadowMode:!1})},5156:function(e,t,r){"use strict";var o="undefined"!==typeof Symbol&&Symbol,n=r("1696");e.exports=function(){return"function"===typeof o&&("function"===typeof Symbol&&("symbol"===typeof o("foo")&&("symbol"===typeof Symbol("bar")&&n())))}},5402:function(e,t,r){"use strict";var o=r("00ce"),n=r("545e"),i=r("2714"),a=r("0d25"),s=o("%WeakMap%",!0),l=o("%Map%",!0),c=n("WeakMap.prototype.get",!0),u=n("WeakMap.prototype.set",!0),p=n("WeakMap.prototype.has",!0),f=n("Map.prototype.get",!0),h=n("Map.prototype.set",!0),y=n("Map.prototype.has",!0),d=function(e,t){for(var r,o=e;null!==(r=o.next);o=r)if(r.key===t)return o.next=r.next,r.next=e.next,e.next=r,r},m=function(e,t){var r=d(e,t);return r&&r.value},g=function(e,t,r){var o=d(e,t);o?o.value=r:e.next={key:t,next:e.next,value:r}},b=function(e,t){return!!d(e,t)};e.exports=function(){var e,t,r,o={assert:function(e){if(!o.has(e))throw new a("Side channel does not contain "+i(e))},get:function(o){if(s&&o&&("object"===typeof o||"function"===typeof o)){if(e)return c(e,o)}else if(l){if(t)return f(t,o)}else if(r)return m(r,o)},has:function(o){if(s&&o&&("object"===typeof o||"function"===typeof o)){if(e)return p(e,o)}else if(l){if(t)return y(t,o)}else if(r)return b(r,o);return!1},set:function(o,n){s&&o&&("object"===typeof o||"function"===typeof o)?(e||(e=new s),u(e,o,n)):l?(t||(t=new l),h(t,o,n)):(r||(r={key:{},next:null}),g(r,o,n))}};return o}},"545e":function(e,t,r){"use strict";var o=r("00ce"),n=r("3eb1"),i=n(o("String.prototype.indexOf"));e.exports=function(e,t){var r=o(e,!!t);return"function"===typeof r&&i(e,".prototype.")>-1?n(r):r}},5748:function(e,t,r){"use strict";r.r(t);var o=function(){var e=this,t=e._self._c;return t("div",[t("meta",{attrs:{name:"viewport",content:"width=device-width, initial-scale=0.5, maximum-scale=0.5"}}),t("header",{staticClass:"controls"},[e.disableStore?e._e():t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{sessionKey:"lotus-profilerSourceText"},model:{value:e.sourceText,callback:function(t){e.sourceText=t},expression:"sourceText"}}),e.disableStore?e._e():t("BoolStoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{sessionKey:"lotus-profilerBakingSheet"},model:{value:e.bakingSheet,callback:function(t){e.bakingSheet=t},expression:"bakingSheet"}}),t("input",{attrs:{type:"file"},on:{change:e.onScoreChange}}),t("button",{on:{click:e.homePlayer}},[e._v("⏮")]),t("button",{attrs:{disabled:!e.midiPlayer},on:{click:e.togglePlayer}},[e._v(e._s(e.midiPlayer&&e.midiPlayer.isPlaying?"⏸":"▶"))]),t("CheckButton",{attrs:{content:"&#xa56f;"},model:{value:e.showCursor,callback:function(t){e.showCursor=t},expression:"showCursor"}}),t("CheckButton",{attrs:{content:"&#x2669;"},model:{value:e.noteHighlight,callback:function(t){e.noteHighlight=t},expression:"noteHighlight"}}),t("CheckButton",{attrs:{content:"&#x1f35e;"},model:{value:e.bakingSheet,callback:function(t){e.bakingSheet=t},expression:"bakingSheet"}}),e.fps?t("span",{staticClass:"fps"},[t("em",[e._v(e._s(e.fps.toFixed(1)))]),e._v("fps")]):e._e()],1),t("main",{on:{scroll:e.onScroll}},[!e.bakingSheet&&e.svgHashTable?t("SheetSigns",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"signs",attrs:{hashTable:e.svgHashTable}}):e._e(),e.sheetDocument?t("SheetLive",{ref:"sheet",attrs:{doc:e.sheetDocument,midiNotation:e.midiNotation,pitchContextGroup:e.pitchContextGroup,midiPlayer:e.midiPlayer,scheduler:e.scheduler,showCursor:e.showCursor,noteHighlight:e.noteHighlight,bakingMode:e.bakingSheet,backgroundImages:e.bakingSheet?e.bakingImages:null,showPagesProgressively:e.showPagesProgressively},on:{"update:midiPlayer":function(t){e.midiPlayer=t},"update:midi-player":function(t){e.midiPlayer=t},midi:e.onMidi}}):e._e()],1),t("canvas",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"canvas"})])},n=[],i=r("0b16"),a=r.n(i),s=r("b047"),l=r.n(s),c=(r("8701"),r("5027")),u=r("9224"),p=r("f634"),f=r("32c1"),h=r("1151"),y=r("a31e"),d=r("1c3a"),m=r("c0d2");const g=e=>{if(e){const t=e.match(/\d+/g);if(t){const e=t.map(Number).reverse();return e.reduce((e,t,r)=>e+t*1e3**r,0)}}return-1};class b{constructor({onStatus:e=((...e)=>e)}={}){this.onStatus=e}static fromJSON(e,{measureLayout:t=y["b"].Full,onStatus:r=((...e)=>e),jsonHandle:o=(e=>e)}={}){const n=new b({onStatus:r});return n.scoreJSON=o(Object(p["b"])(e,b.classDict)),n.checkVersion(),n.onStatus("json loaded"),n.scoreJSON.lilyNotation&&(n.matchedIds=n.scoreJSON.lilyNotation.idSet,n.scoreJSON.doc.updateMatchedTokens(n.matchedIds)),t&&n.loadNotation(t),n}loadNotation(e,t){const r=this.scoreJSON.lilyNotation;if(r){const o=r.getMeasureIndices(e);this.midiNotation=r.toPerformingNotationWithEvents(o,{trackList:t}),this.pitchContextGroup=r.getContextGroup(o);const n=r.toPerformingNotation(o,{withRestTied:!0});this.scheduler=y["e"].createFromNotation(n,this.scoreJSON.doc.getTokenMap()),this.onStatus("notation loaded")}}bakeSheet(e){return console.assert(!!this.scoreJSON.doc,"sheetDocument is null."),console.assert(!!this.scoreJSON.hashTable,"hashTable is null."),console.assert(!!this.matchedIds,"matchedIds is null."),this.onStatus("baking sheet"),d["a"]({sheetDocument:this.scoreJSON.doc,hashTable:this.scoreJSON.hashTable,matchedIds:this.matchedIds,canvas:e})}checkVersion(){const e=g(u.version),t=g(this.scoreJSON.version);t<g("0.6.1")&&console.warn(`This score bundle version[${this.scoreJSON.version}] is too low! The current Lotus API version is: ${u.version}.`),t>e&&console.warn(`The current Lotus API version[${u.version}] is behind this score bundle[${this.scoreJSON.version}]. If any score problem encountered, try to upgrade Lotus API.`),t>=0&&t<g("0.8.0")&&this.scoreJSON.doc.pages.forEach(e=>e.systems=e.rows)}}b.classDict={StaffToken:f["StaffToken"],SheetDocument:f["SheetDocument"],LilyNotation:y["d"],...y["c"],DictArray:m["a"],PitchContextTable:h["b"],PitchContext:h["a"]};var v=r("faa1");class w extends v["EventEmitter"]{constructor(e,{separator:t="\n\n\n\n"}={}){super(),this.reader=e,this.separator=t}async read(){let e="";while(1){const{done:t,value:r}=await this.reader.read();if(r){const t=new TextDecoder("utf-8").decode(r);e+=t;while(1){const t=e.indexOf(this.separator);if(!(t>=0))break;{const r=e.substr(0,t);this.emit("data",r),e=e.substr(t+this.separator.length)}}}if(t)break}e&&this.emit("data",e)}}var S=r("a139"),x=r("f7ce"),O=r("cdaf"),j=r("4e72"),A=r("ddcc"),P={name:"profiler",components:{SheetLive:S["a"],SheetSigns:x["a"],StoreInput:O["a"],BoolStoreInput:j["a"],CheckButton:A["a"]},data(){return{sourceText:null,sheetDocument:null,svgHashTable:null,midiNotation:null,scheduler:null,pitchContextGroup:null,midiPlayer:null,showCursor:!0,noteHighlight:!0,bakingSheet:!0,bakingImages:null,sourceBakingImages:null,fps:null,disableStore:!1,showPagesProgressively:!0}},async created(){this.logTime("created"),window.$main=this,this.watchFps();const e=a.a.parse(location.hash.substr(1),!0);e.query.score&&(this.disableStore=!0,this.loadScoreFromURL(e.query.score)),e.query.nobake&&(this.bakingSheet=!1)},methods:{logTime(e){console.log("[PROFILER]",e,performance.now())},onScoreChange(e){const t=e.target.files[0];if(t)return this.loadScoreFile(t)},onScroll:l()((function(){this.$refs.sheet.updatePageVisibility()}),60,{leading:!0}),async loadScoreFile(e){switch(this.logTime("file loading begin"),e.type){case"application/json":this.sourceText=await e.readAs("Text");break;case"application/zip":case"application/x-zip-compressed":{this.sourceText=null,await this.$nextTick();const{default:t}=await r.e("chunk-48b5b2a0").then(r.t.bind(null,"c4e3",7)),o=await t.loadAsync(e);this.sourceBakingImages=null;for(let e=0;1;++e){const t=o.file(`baking${e}.png`);if(!t)break;const r=await t.async("blob"),n=URL.createObjectURL(r);this.sourceBakingImages=this.sourceBakingImages||[],this.sourceBakingImages.push(n)}this.sourceBakingImages&&this.logTime(`baking images loaded [${this.sourceBakingImages.length}]`),this.sourceText=await o.file("score.json").async("text"),this.logTime("sourceText loaded.")}break;case"text/x-lilypond":case"text/lilypond-source":{const t=await e.readAs("Text"),r=new FormData;r.append("source",t),r.append("withLilyNotation",1);const o=await fetch("/advanced-engrave",{method:"POST",body:r});if(!o.ok)return this.error=await o.text(),void console.warn("advanced-engrave failed:",this.error);const n=new w(o.body.getReader());this.constructSheetFromStream(n)}break;default:console.log("unsupported type:",e.type)}},async loadScoreFromURL(e){this.logTime("URL fetching begin");const t=await fetch(e);if(!t.ok)return void console.warn("URL load failed:",await t.text());this.logTime("network responsed");const r=await t.blob();return this.loadScoreFile(r)},async loadSheet(){if(this.sheetDocument=null,this.midiNotation=null,this.scheduler=null,this.pitchContextGroup=null,this.bakingImages=null,this.sourceText){this.showPagesProgressively=!0;const e=b.fromJSON(this.sourceText,{onStatus:e=>this.logTime(e)});if(this.sheetDocument=e.scoreJSON.doc,this.pitchContextGroup=e.pitchContextGroup,this.midiNotation=e.midiNotation,this.scheduler=e.scheduler,this.svgHashTable=e.scoreJSON.hashTable,this.logTime("bundle parsed"),await this.$nextTick(),this.logTime("rendering initialized"),this.sourceBakingImages)this.bakingImages=this.sourceBakingImages,this.sourceBakingImages=null;else if(this.bakingSheet){this.bakingImages=[];const t=e.bakeSheet(this.$refs.canvas);this.logTime("baker loaded");for await(const e of t)this.bakingImages.push(e);this.logTime("baking finished")}await this.$nextTick(),this.logTime("rendering finished"),this.$refs.sheet.updatePageVisibility()}},async constructSheetFromStream(e){this.sheetDocument=null,this.midiNotation=null,this.scheduler=null,this.pitchContextGroup=null,this.bakingImages=null,this.svgHashTable={},this.showPagesProgressively=!1,this.bakingSheet=!1;const t=[];e.on("data",e=>{const r=Object(p["b"])(e,{...f,LilyNotation:y["d"],...y["c"]});if(console.log("data:",r),void 0!==r.page&&(t[r.page]=r.structure,this.svgHashTable={...this.svgHashTable,...r.hashTable},this.sheetDocument=new f["SheetDocument"]({pages:t})),r.lilyNotation){const e=r.lilyNotation,t=e.getMeasureIndices(y["b"].Full);this.midiNotation=e.toPerformingNotationWithEvents(t),this.pitchContextGroup=e.getContextGroup(t);const o=e.toPerformingNotation(t,{withRestTied:!0});this.scheduler=y["e"].createFromNotation(o,this.sheetDocument.getTokenMap())}}),await e.read()},onMidi(){},homePlayer(){this.midiPlayer&&this.midiPlayer.turnCursor(0)},togglePlayer(){this.midiPlayer&&(this.midiPlayer.isPlaying?this.midiPlayer.pause():this.midiPlayer.play())},async watchFps(){let e=performance.now(),t=0;while(1){await Object(c["a"])(),++t;const r=performance.now();r-e>1e3&&(this.fps=1e3*t/(r-e),t=0,e=r)}}},watch:{sourceText:"loadSheet"}},k=P,E=(r("ae16"),r("2877")),I=Object(E["a"])(k,o,n,!1,null,null,null);t["default"]=I.exports},"62e4":function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"64b0":function(e,t,r){"use strict";var o=r("71c9"),n=function(){return!!o};n.hasArrayLengthDefineBug=function(){if(!o)return null;try{return 1!==o([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},"67d9":function(e,t,r){"use strict";e.exports=URIError},"67ee":function(e,t,r){"use strict";e.exports=SyntaxError},"688e":function(e,t,r){"use strict";var o="Function.prototype.bind called on incompatible ",n=Object.prototype.toString,i=Math.max,a="[object Function]",s=function(e,t){for(var r=[],o=0;o<e.length;o+=1)r[o]=e[o];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r},l=function(e,t){for(var r=[],o=t||0,n=0;o<e.length;o+=1,n+=1)r[n]=e[o];return r},c=function(e,t){for(var r="",o=0;o<e.length;o+=1)r+=e[o],o+1<e.length&&(r+=t);return r};e.exports=function(e){var t=this;if("function"!==typeof t||n.apply(t)!==a)throw new TypeError(o+t);for(var r,u=l(arguments,1),p=function(){if(this instanceof r){var o=t.apply(this,s(u,arguments));return Object(o)===o?o:this}return t.apply(e,s(u,arguments))},f=i(0,t.length-u.length),h=[],y=0;y<f;y++)h[y]="$"+y;if(r=Function("binder","return function ("+c(h,",")+"){ return binder.apply(this,arguments); }")(p),t.prototype){var d=function(){};d.prototype=t.prototype,r.prototype=new d,d.prototype=null}return r}},"71c9":function(e,t,r){"use strict";var o=r("00ce"),n=o("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(i){n=!1}e.exports=n},7992:function(e,t,r){"use strict";var o=r("71c9"),n=r("67ee"),i=r("0d25"),a=r("2aa9");e.exports=function(e,t,r){if(!e||"object"!==typeof e&&"function"!==typeof e)throw new i("`obj` must be an object or a function`");if("string"!==typeof t&&"symbol"!==typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!==typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!==typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!==typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!==typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],p=!!a&&a(e,t);if(o)o(e,t,{configurable:null===c&&p?p.configurable:!c,enumerable:null===s&&p?p.enumerable:!s,value:r,writable:null===l&&p?p.writable:!l});else{if(!u&&(s||l||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},9671:function(e,t,r){"use strict";var o=Function.prototype.call,n=Object.prototype.hasOwnProperty,i=r("0f7c");e.exports=i.call(o,n)},"9d88":function(e,t,r){(function(e,o){var n;/*! https://mths.be/punycode v1.4.1 by @mathias */(function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof o&&o;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,c=36,u=1,p=26,f=38,h=700,y=72,d=128,m="-",g=/^xn--/,b=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=c-u,x=Math.floor,O=String.fromCharCode;function j(e){throw new RangeError(w[e])}function A(e,t){var r=e.length,o=[];while(r--)o[r]=t(e[r]);return o}function P(e,t){var r=e.split("@"),o="";r.length>1&&(o=r[0]+"@",e=r[1]),e=e.replace(v,".");var n=e.split("."),i=A(n,t).join(".");return o+i}function k(e){var t,r,o=[],n=0,i=e.length;while(n<i)t=e.charCodeAt(n++),t>=55296&&t<=56319&&n<i?(r=e.charCodeAt(n++),56320==(64512&r)?o.push(((1023&t)<<10)+(1023&r)+65536):(o.push(t),n--)):o.push(t);return o}function E(e){return A(e,(function(e){var t="";return e>65535&&(e-=65536,t+=O(e>>>10&1023|55296),e=56320|1023&e),t+=O(e),t})).join("")}function I(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function T(e,t,r){var o=0;for(e=r?x(e/h):e>>1,e+=x(e/t);e>S*p>>1;o+=c)e=x(e/S);return x(o+(S+1)*e/(e+f))}function N(e){var t,r,o,n,i,a,s,f,h,g,b=[],v=e.length,w=0,S=d,O=y;for(r=e.lastIndexOf(m),r<0&&(r=0),o=0;o<r;++o)e.charCodeAt(o)>=128&&j("not-basic"),b.push(e.charCodeAt(o));for(n=r>0?r+1:0;n<v;){for(i=w,a=1,s=c;;s+=c){if(n>=v&&j("invalid-input"),f=I(e.charCodeAt(n++)),(f>=c||f>x((l-w)/a))&&j("overflow"),w+=f*a,h=s<=O?u:s>=O+p?p:s-O,f<h)break;g=c-h,a>x(l/g)&&j("overflow"),a*=g}t=b.length+1,O=T(w-i,t,0==i),x(w/t)>l-S&&j("overflow"),S+=x(w/t),w%=t,b.splice(w++,0,S)}return E(b)}function C(e){var t,r,o,n,i,a,s,f,h,g,b,v,w,S,A,P=[];for(e=k(e),v=e.length,t=d,r=0,i=y,a=0;a<v;++a)b=e[a],b<128&&P.push(O(b));o=n=P.length,n&&P.push(m);while(o<v){for(s=l,a=0;a<v;++a)b=e[a],b>=t&&b<s&&(s=b);for(w=o+1,s-t>x((l-r)/w)&&j("overflow"),r+=(s-t)*w,t=s,a=0;a<v;++a)if(b=e[a],b<t&&++r>l&&j("overflow"),b==t){for(f=r,h=c;;h+=c){if(g=h<=i?u:h>=i+p?p:h-i,f<g)break;A=f-g,S=c-g,P.push(O(_(g+A%S,0))),f=x(A/S)}P.push(O(_(f,0))),i=T(r,w,o==n),r=0,++o}++r,++t}return P.join("")}function F(e){return P(e,(function(e){return g.test(e)?N(e.slice(4).toLowerCase()):e}))}function R(e){return P(e,(function(e){return b.test(e)?"xn--"+C(e):e}))}s={version:"1.4.1",ucs2:{decode:k,encode:E},decode:N,encode:C,toASCII:R,toUnicode:F},n=function(){return s}.call(t,r,t,e),void 0===n||(e.exports=n)})()}).call(this,r("62e4")(e),r("c8ba"))},a29f:function(e,t,r){"use strict";var o=r("bbc7"),n=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e){while(e.length>1){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var o=[],n=0;n<r.length;++n)"undefined"!==typeof r[n]&&o.push(r[n]);t.obj[t.prop]=o}}},l=function(e,t){for(var r=t&&t.plainObjects?{__proto__:null}:{},o=0;o<e.length;++o)"undefined"!==typeof e[o]&&(r[o]=e[o]);return r},c=function e(t,r,o){if(!r)return t;if("object"!==typeof r&&"function"!==typeof r){if(i(t))t.push(r);else{if(!t||"object"!==typeof t)return[t,r];(o&&(o.plainObjects||o.allowPrototypes)||!n.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!==typeof t)return[t].concat(r);var a=t;return i(t)&&!i(r)&&(a=l(t,o)),i(t)&&i(r)?(r.forEach((function(r,i){if(n.call(t,i)){var a=t[i];a&&"object"===typeof a&&r&&"object"===typeof r?t[i]=e(a,r,o):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var a=r[i];return n.call(t,i)?t[i]=e(t[i],a,o):t[i]=a,t}),a)},u=function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},p=function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(n){return o}},f=1024,h=function(e,t,r,n,i){if(0===e.length)return e;var s=e;if("symbol"===typeof e?s=Symbol.prototype.toString.call(e):"string"!==typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var l="",c=0;c<s.length;c+=f){for(var u=s.length>=f?s.slice(c,c+f):s,p=[],h=0;h<u.length;++h){var y=u.charCodeAt(h);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||i===o.RFC1738&&(40===y||41===y)?p[p.length]=u.charAt(h):y<128?p[p.length]=a[y]:y<2048?p[p.length]=a[192|y>>6]+a[128|63&y]:y<55296||y>=57344?p[p.length]=a[224|y>>12]+a[128|y>>6&63]+a[128|63&y]:(h+=1,y=65536+((1023&y)<<10|1023&u.charCodeAt(h)),p[p.length]=a[240|y>>18]+a[128|y>>12&63]+a[128|y>>6&63]+a[128|63&y])}l+=p.join("")}return l},y=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var n=t[o],i=n.obj[n.prop],a=Object.keys(i),l=0;l<a.length;++l){var c=a[l],u=i[c];"object"===typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:c}),r.push(u))}return s(t),e},d=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},m=function(e){return!(!e||"object"!==typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},g=function(e,t){return[].concat(e,t)},b=function(e,t){if(i(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(t(e[o]));return r}return t(e)};e.exports={arrayToObject:l,assign:u,combine:g,compact:y,decode:p,encode:h,isBuffer:m,isRegExp:d,maybeMap:b,merge:c}},a645:function(e,t,r){"use strict";e.exports=Error},ae16:function(e,t,r){"use strict";r("4332")},b11f:function(e,t,r){var o=r("24fb");t=o(!1),t.push([e.i,'button.working{background-color:#dfd;font-weight:700}button.on{background-color:#efe;font-weight:700;box-shadow:0 0 4px #000}button.off{opacity:.7;filter:grayscale(100%)}button[disabled]{box-shadow:none;cursor:not-allowed!important}.controls fieldset{border:0;padding:0 1em}.controls fieldset,.controls fieldset>span{display:inline-block}.controls fieldset>*{margin:0 .2em}.controls>*,.controls fieldset>*{vertical-align:middle}header.controls{padding:1em;text-align:center;background-color:hsla(0,0%,100%,.6666666666666666)}header.controls button{font-size:24px}header.controls .dirty-badge{width:1em}header.controls .dirty-badge.dirty:before{content:"*"}header .fps{display:inline-block;margin:0 1em;color:#aaa}header .fps em{color:#000;display:inline-block;margin:0 .2em}main{width:100%;overflow:auto}main .sheet.live{white-space:nowrap;display:inline-block}main .sheet.live .page{display:inline-block;margin:1em;background-size:100%}main .sheet.live .cursor{fill:#add8e6}',""]),e.exports=t},bbc7:function(e,t,r){"use strict";var o=String.prototype.replace,n=/%20/g,i={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return o.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}},d009:function(e,t,r){"use strict";var o=r("00ce"),n=r("7992"),i=r("64b0")(),a=r("2aa9"),s=r("0d25"),l=o("%Math.floor%");e.exports=function(e,t){if("function"!==typeof e)throw new s("`fn` is not a function");if("number"!==typeof t||t<0||t>4294967295||l(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],o=!0,c=!0;if("length"in e&&a){var u=a(e,"length");u&&!u.configurable&&(o=!1),u&&!u.writable&&(c=!1)}return(o||c||!r)&&(i?n(e,"length",t,!0,!0):n(e,"length",t)),e}},dc99:function(e,t,r){"use strict";e.exports=RangeError},f177:function(e,t,r){"use strict";var o=r("5402"),n=r("a29f"),i=r("bbc7"),a=Object.prototype.hasOwnProperty,s={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},l=Array.isArray,c=Array.prototype.push,u=function(e,t){c.apply(e,l(t)?t:[t])},p=Date.prototype.toISOString,f=i["default"],h={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:n.encode,encodeValuesOnly:!1,filter:void 0,format:f,formatter:i.formatters[f],indices:!1,serializeDate:function(e){return p.call(e)},skipNulls:!1,strictNullHandling:!1},y=function(e){return"string"===typeof e||"number"===typeof e||"boolean"===typeof e||"symbol"===typeof e||"bigint"===typeof e},d={},m=function e(t,r,i,a,s,c,p,f,m,g,b,v,w,S,x,O,j,A){var P=t,k=A,E=0,I=!1;while(void 0!==(k=k.get(d))&&!I){var _=k.get(t);if(E+=1,"undefined"!==typeof _){if(_===E)throw new RangeError("Cyclic object value");I=!0}"undefined"===typeof k.get(d)&&(E=0)}if("function"===typeof g?P=g(r,P):P instanceof Date?P=w(P):"comma"===i&&l(P)&&(P=n.maybeMap(P,(function(e){return e instanceof Date?w(e):e}))),null===P){if(c)return m&&!O?m(r,h.encoder,j,"key",S):r;P=""}if(y(P)||n.isBuffer(P)){if(m){var T=O?r:m(r,h.encoder,j,"key",S);return[x(T)+"="+x(m(P,h.encoder,j,"value",S))]}return[x(r)+"="+x(String(P))]}var N,C=[];if("undefined"===typeof P)return C;if("comma"===i&&l(P))O&&m&&(P=n.maybeMap(P,m)),N=[{value:P.length>0?P.join(",")||null:void 0}];else if(l(g))N=g;else{var F=Object.keys(P);N=b?F.sort(b):F}var R=f?String(r).replace(/\./g,"%2E"):String(r),L=a&&l(P)&&1===P.length?R+"[]":R;if(s&&l(P)&&0===P.length)return L+"[]";for(var D=0;D<N.length;++D){var M=N[D],U="object"===typeof M&&M&&"undefined"!==typeof M.value?M.value:P[M];if(!p||null!==U){var B=v&&f?String(M).replace(/\./g,"%2E"):String(M),W=l(P)?"function"===typeof i?i(L,B):L:L+(v?"."+B:"["+B+"]");A.set(t,E);var q=o();q.set(d,A),u(C,e(U,W,i,a,s,c,p,f,"comma"===i&&O&&l(P)?null:m,g,b,v,w,S,x,O,j,q))}}return C},g=function(e){if(!e)return h;if("undefined"!==typeof e.allowEmptyArrays&&"boolean"!==typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if("undefined"!==typeof e.encodeDotInKeys&&"boolean"!==typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&"undefined"!==typeof e.encoder&&"function"!==typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if("undefined"!==typeof e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i["default"];if("undefined"!==typeof e.format){if(!a.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o,n=i.formatters[r],c=h.filter;if(("function"===typeof e.filter||l(e.filter))&&(c=e.filter),o=e.arrayFormat in s?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":h.arrayFormat,"commaRoundTrip"in e&&"boolean"!==typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u="undefined"===typeof e.allowDots?!0===e.encodeDotInKeys||h.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"===typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:u,allowEmptyArrays:"boolean"===typeof e.allowEmptyArrays?!!e.allowEmptyArrays:h.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:"boolean"===typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:"undefined"===typeof e.delimiter?h.delimiter:e.delimiter,encode:"boolean"===typeof e.encode?e.encode:h.encode,encodeDotInKeys:"boolean"===typeof e.encodeDotInKeys?e.encodeDotInKeys:h.encodeDotInKeys,encoder:"function"===typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"===typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:c,format:r,formatter:n,serializeDate:"function"===typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"===typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"===typeof e.sort?e.sort:null,strictNullHandling:"boolean"===typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}};e.exports=function(e,t){var r,n,i=e,a=g(t);"function"===typeof a.filter?(n=a.filter,i=n("",i)):l(a.filter)&&(n=a.filter,r=n);var c=[];if("object"!==typeof i||null===i)return"";var p=s[a.arrayFormat],f="comma"===p&&a.commaRoundTrip;r||(r=Object.keys(i)),a.sort&&r.sort(a.sort);for(var h=o(),y=0;y<r.length;++y){var d=r[y],b=i[d];a.skipNulls&&null===b||u(c,m(b,d,p,f,a.allowEmptyArrays,a.strictNullHandling,a.skipNulls,a.encodeDotInKeys,a.encode?a.encoder:null,a.filter,a.sort,a.allowDots,a.serializeDate,a.format,a.formatter,a.encodeValuesOnly,a.charset,h))}var v=c.join(a.delimiter),w=!0===a.addQueryPrefix?"?":"";return a.charsetSentinel&&("iso-8859-1"===a.charset?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),v.length>0?w+v:""}},faa1:function(e,t,r){"use strict";var o,n="object"===typeof Reflect?Reflect:null,i=n&&"function"===typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(e){console&&console.warn&&console.warn(e)}o=n&&"function"===typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!==e};function l(){l.init.call(this)}e.exports=l,e.exports.once=w,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function p(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function f(e,t,r,o){var n,i,s;if(u(r),i=e._events,void 0===i?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"===typeof s?s=i[t]=o?[r,s]:[s,r]:o?s.unshift(r):s.push(r),n=p(e),n>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a(l)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function y(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=h.bind(o);return n.listener=r,o.wrapFn=n,n}function d(e,t,r){var o=e._events;if(void 0===o)return[];var n=o[t];return void 0===n?[]:"function"===typeof n?r?[n.listener||n]:[n]:r?v(n):g(n,n.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function b(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function w(e,t){return new Promise((function(r,o){function n(r){e.removeListener(t,i),o(r)}function i(){"function"===typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}x(e,t,i,{once:!0}),"error"!==t&&S(e,n,{once:!0})}))}function S(e,t,r){"function"===typeof e.on&&x(e,"error",t,r)}function x(e,t,r,o){if("function"===typeof e.on)o.once?e.once(t,r):e.on(t,r);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(i){o.once&&e.removeEventListener(t,n),r(i)}))}}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!==typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),l.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return p(this)},l.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,n=this._events;if(void 0!==n)o=o&&void 0===n.error;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=n[e];if(void 0===l)return!1;if("function"===typeof l)i(l,this,t);else{var c=l.length,u=g(l,c);for(r=0;r<c;++r)i(u[r],this,t)}return!0},l.prototype.addListener=function(e,t){return f(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return f(this,e,t,!0)},l.prototype.once=function(e,t){return u(t),this.on(e,y(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,y(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,o,n,i,a;if(u(t),o=this._events,void 0===o)return this;if(r=o[e],void 0===r)return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!==typeof r){for(n=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():b(r,n),1===r.length&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,a||t)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,r,o;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,i=Object.keys(r);for(o=0;o<i.length;++o)n=i[o],"removeListener"!==n&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],"function"===typeof t)this.removeListener(e,t);else if(void 0!==t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},l.prototype.listeners=function(e){return d(this,e,!0)},l.prototype.rawListeners=function(e){return d(this,e,!1)},l.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},l.prototype.listenerCount=m,l.prototype.eventNames=function(){return this._eventsCount>0?o(this._events):[]}}}]);
2
+ //# sourceMappingURL=chunk-0cbfe13e.73856287.js.map
dist/js/chunk-117382e0.d47336d3.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-117382e0"],{"1e1a":function(e,t,a){"use strict";a("6b05")},"326e":function(e,t,a){var i=a("24fb");t=i(!1),t.push([e.i,".flex-engraver{width:100%;height:100vh}.flex-engraver header{position:absolute;width:100%;height:200px;background:#fafafa;display:flex;flex-direction:row;align-items:center;font-size:36px;overflow:hidden}.flex-engraver header>*{display:inline-block;font-size:inherit;margin:0 .5em}.flex-engraver header .source-list{min-width:8em}.flex-engraver header .gauge-view{height:100%}.flex-engraver header .dirty{font-weight:700;color:orange;cursor:pointer}.flex-engraver main{padding-top:200px;height:100%;background:#eee;white-space:nowrap}.flex-engraver main em{font-weight:700}.flex-engraver main .source-editor{height:calc(100% - 200px);vertical-align:top}.flex-engraver main .viewer{display:inline-block;position:relative;font-size:36px}.flex-engraver main .viewer .sheet-container{display:inline-block;resize:both;margin:2em;outline:1px solid #ccc;overflow:scroll;background:#fff}.flex-engraver main .viewer .sheet-container .sheet .page{margin:0}.flex-engraver main .viewer .sheet-container .loading-dots{background-color:transparent}.flex-engraver main .viewer .sheet-container .loading-dots .ellipsis{zoom:200%}.flex-engraver main .viewer .sheet-container .loading-dots .ellipsis>div{background-color:#4682b4}.flex-engraver main .viewer .container-size{display:inline-block;position:absolute;bottom:0;right:2em}.flex-engraver main .viewer .staff-size{display:inline-block;position:absolute;bottom:0;left:2em}.flex-engraver main .viewer .staff-size input{font-size:inherit}.flex-engraver main .viewer .staff-size .fit-staff-size{border:0}.flex-engraver main .viewer .staff-size .adjuster{display:inline-block;position:relative;margin:0 .6em;zoom:1.5}.flex-engraver main .viewer .staff-size .adjuster .slider{width:200px}.flex-engraver main .viewer .staff-size .adjuster .max,.flex-engraver main .viewer .staff-size .adjuster .min{display:inline-block;position:absolute;font-size:16px;top:3em;text-align:center}.flex-engraver main .viewer .staff-size .adjuster .max input,.flex-engraver main .viewer .staff-size .adjuster .min input{width:2em}.flex-engraver main .viewer .staff-size .adjuster .max .sheet,.flex-engraver main .viewer .staff-size .adjuster .min .sheet{position:absolute;top:120%;left:50%;transform:translate(-50%)}.flex-engraver main .viewer .staff-size .adjuster .min{left:0}.flex-engraver main .viewer .staff-size .adjuster .max{right:-2em}.flex-engraver main .staff-size-viewer{position:absolute;right:0;bottom:0}.flex-engraver main .staff-size-viewer input{width:4em}.flex-engraver.drag-hover header{background-color:#cfc;outline:4px dashed #4f4}",""]),e.exports=t},"6b05":function(e,t,a){var i=a("326e");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var n=a("499e").default;n("44bd81af",i,!0,{sourceMap:!1,shadowMode:!1})},e168:function(e,t,a){"use strict";a.r(t);var i=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-engraver",class:{"drag-hover":e.dragHover},on:{dragover:function(t){t.preventDefault(),e.dragHover=!0},dragleave:function(t){e.dragHover=!1},drop:function(t){return t.preventDefault(),e.onDropFile.apply(null,arguments)}}},[t("header",[t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverContainerWidth"},model:{value:e.containerSize.offsetWidth,callback:function(t){e.$set(e.containerSize,"offsetWidth",t)},expression:"containerSize.offsetWidth"}}),t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverContainerHeight"},model:{value:e.containerSize.offsetHeight,callback:function(t){e.$set(e.containerSize,"offsetHeight",t)},expression:"containerSize.offsetHeight"}}),t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverChosenSourceIndex"},model:{value:e.chosenSourceIndex,callback:function(t){e.chosenSourceIndex=t},expression:"chosenSourceIndex"}}),t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverStaffSizeRangeMin"},model:{value:e.staffSizeRange.min,callback:function(t){e.$set(e.staffSizeRange,"min",t)},expression:"staffSizeRange.min"}}),t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverStaffSizeRangeMaX"},model:{value:e.staffSizeRange.max,callback:function(t){e.$set(e.staffSizeRange,"max",t)},expression:"staffSizeRange.max"}}),t("StoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverFitStaffSize"},model:{value:e.fitStaffSize,callback:function(t){e.fitStaffSize=t},expression:"fitStaffSize"}}),t("BoolStoreInput",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{localKey:"lotus-flexEngraverFixStaffSize"},model:{value:e.fixStaffSize,callback:function(t){e.fixStaffSize=t},expression:"fixStaffSize"}}),t("select",{directives:[{name:"model",rawName:"v-model",value:e.chosenSourceIndex,expression:"chosenSourceIndex"}],staticClass:"source-list",on:{change:function(t){var a=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.chosenSourceIndex=t.target.multiple?a:a[0]}}},e._l(e.sourceList,(function(a,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(a.name))])})),0),t("span",{staticClass:"dirty",on:{click:e.saveSource}},[e._v(e._s(e.sourceDirty?"*":" "))]),t("button",{on:{click:e.removeCurrentSource}},[e._v("🗑")]),t("button",{on:{click:e.gauge}},[e._v("📏")]),t("button",{on:{click:e.renderSheet}},[e._v("🎼")]),t("button",{attrs:{title:"copy lilypond source"},on:{click:e.copySource}},[e._v("⎘")]),t("button",{attrs:{title:"export scores json"},on:{click:e.exportSourceList}},[e._v("⤓")]),e.gaugeSvgDoc?t("div",{staticClass:"gauge-view"},[e.gaugeSvgDoc?t("SheetSimple",{attrs:{documents:[e.gaugeSvgDoc]}}):e._e()],1):e._e()],1),t("main",[e.currentSource?t("SourceEditor",{attrs:{source:e.currentSource.content},on:{"update:source":function(t){return e.$set(e.currentSource,"content",t)}}}):e._e(),t("div",{staticClass:"viewer"},[t("div",{ref:"sheetContainer",staticClass:"sheet-container",style:{width:e.containerSize.offsetWidth+"px",height:e.containerSize.offsetHeight+"px"},on:{mousemove:e.updateContainerSize}},[e.containerSvgs?t("SheetSimple",{attrs:{documents:e.containerSvgs}}):e._e(),t("Loading",{directives:[{name:"show",rawName:"v-show",value:e.containerEngraving,expression:"containerEngraving"}]})],1),t("div",{staticClass:"container-size"},[t("span",[e._v(e._s(e.containerSize.width))]),e._v(" × "),t("span",[e._v(e._s(e.containerSize.height))])]),e.fitStaffSize?t("div",{staticClass:"staff-size"},[t("em",[e._v(e._s(e.fitStaffSize.toFixed(2)))]),e._v(" pt "),t("span",{staticClass:"adjuster"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.fixStaffSize,expression:"fixStaffSize"}],attrs:{type:"checkbox",title:"fix staff size"},domProps:{checked:Array.isArray(e.fixStaffSize)?e._i(e.fixStaffSize,null)>-1:e.fixStaffSize},on:{change:function(t){var a=e.fixStaffSize,i=t.target,n=!!i.checked;if(Array.isArray(a)){var r=null,s=e._i(a,r);i.checked?s<0&&(e.fixStaffSize=a.concat([r])):s>-1&&(e.fixStaffSize=a.slice(0,s).concat(a.slice(s+1)))}else e.fixStaffSize=n}}}),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.fitStaffSize,expression:"fitStaffSize",modifiers:{number:!0}}],staticClass:"slider",attrs:{type:"range",disabled:!e.fixStaffSize,min:e.staffSizeRange.min,max:e.staffSizeRange.max,step:"any"},domProps:{value:e.fitStaffSize},on:{change:e.delayRenderSheet,__r:function(t){e.fitStaffSize=e._n(t.target.value)},blur:function(t){return e.$forceUpdate()}}}),t("span",{staticClass:"min"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.staffSizeRange.min,expression:"staffSizeRange.min"}],attrs:{type:"number"},domProps:{value:e.staffSizeRange.min},on:{change:e.updateStaffSampleMin,input:function(t){t.target.composing||e.$set(e.staffSizeRange,"min",t.target.value)}}}),e.staffSampleSvgMin?t("SheetSimple",{attrs:{documents:[e.staffSampleSvgMin]}}):e._e()],1),t("span",{staticClass:"max"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.staffSizeRange.max,expression:"staffSizeRange.max"}],attrs:{type:"number"},domProps:{value:e.staffSizeRange.max},on:{change:e.updateStaffSampleMax,input:function(t){t.target.composing||e.$set(e.staffSizeRange,"max",t.target.value)}}}),e.staffSampleSvgMax?t("SheetSimple",{attrs:{documents:[e.staffSampleSvgMax]}}):e._e()],1)])]):e._e()])],1)])},n=[],r=a("8701"),s=a("5027"),o=a("010e"),c=a("bc9f"),l=a("f634"),f=a("32c1"),u=a("1f25"),h=a("3122"),g=a("cdaf"),S=a("4e72"),d=a("94c1"),v=a("488d");const m=e=>`\n\t\t#(set-global-staff-size ${e})\n\t\t\\paper {\n\t\t\tpaper-width = ${.16*e}\\cm\n\t\t\tpaper-height = ${.08*e}\\cm\n\t\t\ttop-margin = 0\n\t\t\tbottom-margin = 0\n\t\t\tleft-margin = 0.2\\cm\n\t\t\tright-margin = 0\n\t\t}\n\t\t\\layout\n\t\t{\n\t\t\tindent = 0\n\t\t}\n\t\t{c'1}\n\t`,p=e=>e.replace(/(?:>)[^<>]+lilypond.org(?=<)/g,"");var x={name:"flex-engraver",components:{SourceEditor:h["a"],StoreInput:g["a"],BoolStoreInput:S["a"],SheetSimple:d["a"],Loading:v["a"]},data(){return{containerSize:{width:100,height:100,offsetWidth:1215,offsetHeight:495},dragHover:!1,sourceList:[],chosenSourceIndex:0,sourceDirty:!1,gaugeSvgDoc:null,staffSizeRange:{min:10,max:40},containerSvgs:null,containerEngraving:!1,staffSampleSvgMin:null,staffSampleSvgMax:null,fitStaffSize:24,fixStaffSize:!1}},computed:{currentSource(){return this.sourceList[this.chosenSourceIndex]},currentSourceContent(){return this.currentSource&&this.currentSource.content},containerSizeHash(){return`${this.containerSize.width},${this.containerSize.height}`}},async created(){window.$main=this,this.loadSource(),this.lilyParser=await Object(o["a"])(a.e("chunk-2d0db258").then(a.t.bind(null,"6f2d",7))),console.log("Lilypond parser loaded."),this.updateStaffSamples()},async mounted(){await this.$nextTick(),this.updateContainerSize()},beforeDestroy(){this.checkAndSaveSource()},methods:{updateContainerSize({widthOffset:e=!0}={}){this.containerSize.width=this.$refs.sheetContainer.clientWidth,this.containerSize.height=this.$refs.sheetContainer.clientHeight,e&&(this.containerSize.offsetWidth=this.$refs.sheetContainer.offsetWidth,this.containerSize.offsetHeight=this.$refs.sheetContainer.offsetHeight)},async onDropFile(e){this.dragHover=!1;const t=e.dataTransfer.files[0];if(t)switch(t.type){case"text/x-lilypond":case"text/lilypond-source":const e=await t.readAs("Text"),a=t.name.replace(/\.ly$/,"");this.sourceList.push({name:a,content:e}),this.sourceDirty=!0;break}},removeCurrentSource(){this.sourceList.splice(this.chosenSourceIndex,1),this.chosenSourceIndex=Math.min(this.chosenSourceIndex,this.sourceList.length-1)},loadSource(){localStorage.lotusFlexEngraverSources&&(this.sourceList=JSON.parse(localStorage.lotusFlexEngraverSources),console.log("Source list loaded.")),this.sourceDirty=!1},saveSource(){localStorage.lotusFlexEngraverSources=JSON.stringify(this.sourceList),console.log("Source list saved."),this.sourceDirty=!1},checkAndSaveSource(){this.sourceDirty&&this.saveSource()},async gauge(){const e=20,t=1e4,a=2,i=new c["a"](await this.lilyParser.parse(this.currentSourceContent)),n=i.globalAttributes();n.staffSize.value=e,n.paperWidth.value.number=t,n.paperHeight.value.number=1e3,n.raggedLast.value=!0,n.topMargin.value=0,n.leftMargin.value=0;const r=i.toString();try{const s=await this.engrave(r,{tokenize:!0});this.gaugeSvgDoc=s.svgs[0],console.assert(1===s.svgs.length,"invalid page count:",s);const o=Object(l["b"])(s.doc,{StaffToken:f["StaffToken"],SheetDocument:f["SheetDocument"]}),u=o.pages[0].systems[0],h=t/o.pages[0].viewBox.width/e,g=u.width*h,S=(u.bottom-u.top)*h;n.paperWidth.value.number=a;const d=await this.engrave(i.toString(),{tokenize:!0});console.assert(1===d.svgs.length,"invalid page count:",d);const v=Object(l["b"])(d.doc,{StaffToken:f["StaffToken"],SheetDocument:f["SheetDocument"]}),m=v.pages[0].systems,p=Array(m.length-1).fill(null).map((e,t)=>m[t+1].y-m[t].y),x=Math.max(u.bottom-u.top,...p)*h-S,w=new c["a"](await this.lilyParser.parse(this.currentSourceContent));w.root.appendAssignment("naturalWidth",g),w.root.appendAssignment("naturalHeight",S),w.root.appendAssignment("systemSpacing",x),this.currentSource.content=w.toString(),this.checkAndSaveSource()}catch(s){console.warn("Engraving failed:",s)}},async engrave(e,{tokenize:t}={}){const a=new FormData;a.append("source",e),t&&a.append("tokenize",t);const i=await fetch("/engrave",{method:"POST",body:a});if(!i.ok)throw new Error(await i.text());return i.json()},async fitContainer(){if(!this.lilyParser||!this.currentSourceContent)return null;const e=new c["a"](await this.lilyParser.parse(this.currentSourceContent)),t=e.root.getField("naturalWidth"),a=e.root.getField("naturalHeight"),i=e.root.getField("systemSpacing");if(!t||!a||!i)return console.log("natural size is not set.",t,a),null;const n=t.value,r=a.value,s=i.value+.04,o=e.globalAttributes(),l=this.containerSize.width/u["a"],f=(this.containerSize.height-9)/u["a"],h=e=>o[e].value?o[e].value.number:null,g=h("leftMargin")||u["d"],S=h("rightMargin")||u["d"],d=h("topMargin")||u["f"],v=h("bottomMargin")||u["c"],m=f-d-v,p=l-g-S;let x=1,w=null;if(this.fixStaffSize){w=this.fitStaffSize;const e=(n-u["g"])*w/(p-u["g"]*w);x=Math.ceil(e-.2)}else{for(;x<1e3;++x){const e=m/(r*x+s*(x-1));if(e<this.staffSizeRange.min){Number.isFinite(w)||(w=e),--x,console.log("too samll vertical prefered staff size:",e,x);break}w=Math.min(e,this.staffSizeRange.max);const t=(n-u["g"])*w/(p-u["g"]*w);if(t<0)return void console.warn("Horizontal space too little:",t,p-u["g"]*w);if(t<x+.2){x=Math.max(Math.round(t),1),console.log("proper xsc:",t,x);break}}if(console.log("systemCount:",x,w),w<=this.staffSizeRange.min)return void console.warn("Vertical space too little:",w)}const z=(n-u["g"])*w/(p-u["g"]*w);console.log("horizontalNaturalCount:",z,x);const b=w*(r*x+s*(x-1)),y=Math.max(.9*(f-b)/2,0);if(o.topMargin.value={proto:"NumberUnit",number:y,unit:"\\cm"},1===x){const e=w*n,t=.9*(l-e)/2;t>1&&(o.leftMargin.value={proto:"NumberUnit",number:t,unit:"\\cm"},o.rightMargin.value={proto:"NumberUnit",number:t,unit:"\\cm"})}return o.staffSize.value=w,o.paperWidth.value={proto:"NumberUnit",number:l,unit:"\\cm"},o.paperHeight.value={proto:"NumberUnit",number:f,unit:"\\cm"},o.raggedLast.value=x<=1&&z<.8,this.fixStaffSize||(this.fitStaffSize=w),e.toString()},async renderSheet(){const e=await this.fitContainer();if(!e)return;this.containerEngraving=!0;const t=await this.engrave(e,{tokenize:!1});this.containerSvgs=t.svgs,this.containerSvgs=this.containerSvgs.map(p),this.containerEngraving=!1},async exportScore(){const e=await this.fitContainer();if(!e)return void console.warn("no source.");const t=await this.engrave(e,{tokenize:!0}),a={doc:Object(l["b"])(t.doc,{StaffToken:f["StaffToken"],SheetDocument:f["SheetDocument"]}),midi:t.midi,hashTable:t.hashTable},i=new Blob([JSON.stringify(a)]);Object(r["a"])(URL.createObjectURL(i),"score.json")},async copySource(){const e=await this.fitContainer();navigator.clipboard.writeText(e),console.log("Source copyed.")},async exportSourceList(){const e=JSON.stringify(this.sourceList),t=new Blob([e],{type:"text/plain"});Object(r["a"])(URL.createObjectURL(t),"FlexEngraverSources.json")},async delayRenderSheet(){await Object(s["b"])("renderSheet",500)&&this.renderSheet()},async engraveSample(e){const t=m(e),a=await this.engrave(t);return a.svgs[0]},async updateStaffSampleMin(){this.staffSampleSvgMin=p(await this.engraveSample(this.staffSizeRange.min))},async updateStaffSampleMax(){this.staffSampleSvgMax=p(await this.engraveSample(this.staffSizeRange.max))},updateStaffSamples(){this.updateStaffSampleMin(),this.updateStaffSampleMax()}},watch:{currentSourceContent(e,t){e&&void 0!==t&&(this.sourceDirty=!0)},async chosenSourceIndex(){this.gaugeSvgDoc=null,this.checkAndSaveSource(),await this.$nextTick(),this.sourceDirty=!1,this.renderSheet()},containerSizeHash:"delayRenderSheet",fixStaffSize(e){e||this.delayRenderSheet()}}},w=x,z=(a("1e1a"),a("2877")),b=Object(z["a"])(w,i,n,!1,null,null,null);t["default"]=b.exports}}]);
2
+ //# sourceMappingURL=chunk-117382e0.d47336d3.js.map
dist/js/chunk-2d0c53c7.d24941b8.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c53c7"],{"3ddd":function(C,J){C.exports="data:;base64,CiV7Cgljb25zdCByb290ID0gKHR5cGUsIGRhdGEpID0+ICh7X19wcm90b3R5cGU6ICJNZXNhdXJlTGF5b3V0IiwgdHlwZSwgZGF0YX0pOwoKCWNvbnN0IHNpbmdsZUxheW91dCA9IG4gPT4gKHtfX3Byb3RvdHlwZTogIlNpbmdsZU1MYXlvdXQiLCBtZWFzdXJlOiBOdW1iZXIobil9KTsKCWNvbnN0IGJsb2NrTGF5b3V0ID0gc2VxID0+ICh7X19wcm90b3R5cGU6ICJCbG9ja01MYXlvdXQiLCBzZXF9KTsKCWNvbnN0IHZvbHRhQmxvY2sgPSAodGltZXMsIGJvZHksIGFsdGVybmF0ZXMpID0+ICh7X19wcm90b3R5cGU6ICJWb2x0YU1MYXlvdXQiLCB0aW1lczogTnVtYmV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Jsb2NrTGF5b3V0KFskMV0pO30KCXwgc3dfYmxvY2tfaXRlbQoJCXskJCA9ICQxO30KCXwgc3dfdm9sdGEKCQl7JCQgPSAkMTt9Cgl8IHN3X2FiYQoJCXskJCA9ICQxO30KCTsKCnNlZ21lbnQKCTogVU5TSUdORUQKCQl7JCQgPSBzZWdtZW50KCQxKTt9Cgk7Cgpzd19ibG9ja19pdGVtCgk6IHN3X2Jsb2NrCgkJeyQkID0gYmxvY2tMYXlvdXQoJDEpO30KCTsKCnN3X2Jsb2NrCgk6ICdbJyBzd19zZXF1ZW5jZSAnXScKCQl7JCQgPSAkMjt9Cgk7Cgpzd192b2x0YQoJOiBVTlNJR05FRCAnKicgc3dfYmxvY2sgc3dfb3B0aW9uYWxfYWx0ZXJuYXRlcwoJCXskJCA9IHZvbHRhQmxvY2soJDEsICQzLCAkNCk7fQoJOwoKc3dfb3B0aW9uYWxfYWx0ZXJuYXRlcwoJOiAlZW1wdHkKCQl7JCQgPSBudWxsO30KCXwgc3dfYWx0ZXJuYXRlcwoJCXskJCA9ICQxO30KCTsKCnN3X2FsdGVybmF0ZXMKCTogJ3snIHN3X3NlcXVlbmNlICd9JwoJCXskJCA9IGFsdGVybmF0ZXMoJDIpO30KCTsKCnN3X2FiYQoJOiAnPCcgc3dfaXRlbSBzd19zZXF1ZW5jZSAnPicKCQl7JCQgPSBhYmFCbG9jaygkMiwgJDMpO30KCTsK"}}]);
2
+ //# sourceMappingURL=chunk-2d0c53c7.d24941b8.js.map
dist/js/chunk-2d0db258.a4804a7a.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0db258"],{"6f2d":function(C,J){C.exports="data:;base64,CiV7Cgljb25zdCBwcmVmZXJOdW1iZXIgPSB4ID0+IE51bWJlci5pc0Zpbml0ZShOdW1iZXIoeCkpID8gTnVtYmVyKHgpIDogeDsKCgljb25zdCBsb2NhdGlvbiA9IChiZWdpbiwgZW5kK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W1iZWQoJDMpO30KCXwgIioiCgkJeyQkID0gJDE7fQoJOwoKc2NoZW1lX2FyZ3MKCTogJWVtcHR5CgkJeyQkID0gW107fQoJfCBzY2hlbWVfYXJncyBzY2hlbWVfZXhwcmVzc2lvbgoJCXskJCA9ICQxLmNvbmNhdCgkMik7fQoJOwoKc2NoZW1lX3Rva2VuCgk6IGJhcmVfbnVtYmVyCgkJeyQkID0gJDE7fQoJfCBzeW1ib2wKCQl7JCQgPSAkMTt9Cgl8IHN5bWJvbCAiOiIgc2NoZW1lX3Rva2VuCgkJeyQkID0gJDEgKyAkMiArICQzO30KCXwgc3ltYm9sICI6IiAiOiIgc2NoZW1lX3Rva2VuCgkJeyQkID0gJDEgKyAkMiArICQzICsgJDQ7fQoJOwoKb3B0aW9uYWxfcmVzdAoJOiAlZW1wdHkKCQl7JCQgPSBudWxsO30KCXwgUkVTVAoJCXskJCA9ICQxO30KCTsKCi8vIGV4dHJhIHN5bnRheCwgdGhlIHN1YnN0aXR1dGlvbiBvZiBTVFJJTkcKbGl0ZXJhbF9zdHJpbmcKCTogU1RSSU5HCgkJeyQkID0gc3RyaW5nKCQxKTt9Cgk7Cg=="}}]);
2
+ //# sourceMappingURL=chunk-2d0db258.a4804a7a.js.map
dist/js/chunk-40965e1a.74707226.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-40965e1a"],{"00fd":function(t,e,s){var o=s("9e69"),a=Object.prototype,i=a.hasOwnProperty,n=a.toString,r=o?o.toStringTag:void 0;function c(t){var e=i.call(t,r),s=t[r];try{t[r]=void 0;var o=!0}catch(c){}var a=n.call(t);return o&&(e?t[r]=s:delete t[r]),a}t.exports=c},"0146":function(t,e,s){var o=s("24fb");e=o(!1),e.push([t.i,'@font-face{font-family:lotus-music;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAD7MAA0AAAAAe2wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRl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YN2FdvC92Xo1j9IajnLuiWp9c+z2go2SPYepRjm88o4Sq1rr/zu7nu4dBZVOIbKqdxoU+sMmxMYbV1pTm9PrtXGuqKrC2Uqu3+NOK8JOfZTaTusYjRxXYOfj0IbeVKX9N/sNm+w8JnjafcTXa1NhAEDx86VJbjrSWvdCrXvGJE1ta1y11r231nV7m8Zrk+/Gmxv3rhMHiqBPigtBxT0RVHBrHS0O9EV8UHDjfjb5Bzxwftj4f2+TC2zCJoRIE3bSsOPAiYKLdDLIJAs32eTQgFwa0ojGNKEpzWhOC1rSita0oS3tyKM9HehIJzrTha50ozs96EkvPPTGiw8/+QQooA+FFFFMX4L0oz8DGMggShhMKUMoYyjDGM4IRjKK0YxhLOMYzwQmMonJTGEq05jODGZSzixmM4e5zEMVDuHkNke5wwnWcZNX3OUd1zkjFOES6SKDS1zmAhfZxDnO85ptvOcGZ0WmyOIw69nANfbwgY3sYCv7OMYRatjNT36xnb1s5hZv+MF+jvOH3/zlECd5wD1OUYHGTiqpJcR9HvKURzzmCR+p4hl11HOaMN/ZxUue84L5fOYrW1iATjVRIkgOYLCQGBaLWMwnlrCMpSxnJSu4wkFWs4o1rOUL37gq3CJb5LjjlqppqqXH43rUUMqiqmYa0hE2jURMSUjd6yvy2jWfvzhJwJfCnyI/RSBJQaEiK+IxVQu5PNKwKkNVQadHJiKRYK40ZFQ1q3UZNkNWwpTBf6Wgf18AAAAAAf//AAJ42mNgZGBg4AFiMSBmYmAEwvtAzALmMQAADTMBDgAAAHjaY2BgYGQAgqtL1DlA9A3p9xNhNABAIwaQAAA=) format("woff");font-weight:400;font-style:normal}',""]),t.exports=e},1310:function(t,e){function s(t){return null!=t&&"object"==typeof t}t.exports=s},"1a8c":function(t,e){function s(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=s},"1c3a":function(t,e,s){"use strict";s.d(e,"b",(function(){return h})),s.d(e,"a",(function(){return u}));var o=s("2b0e"),a=s("a139"),i=s("f7ce"),n=s("1f25");const r=o["a"].extend(a["a"]),c=o["a"].extend(i["a"]),l=async(t,e)=>{const s="data:image/svg+xml,"+encodeURIComponent(n["h"]+t),o=await new Promise((t,e)=>{const o=new Image;o.onload=()=>t(o),o.onerror=t=>{console.warn("Error when loading svg image:",s),e(t)},o.src=s});e.width=o.width,e.height=o.height;const a=e.getContext("2d");a.drawImage(o,0,0);const i=await new Promise(t=>e.toBlob(e=>t(e),"image/png"));return URL.createObjectURL(i)},d=(t,e,s)=>{const o=(new DOMParser).parseFromString(t,"text/xml"),a=o.childNodes[0];for(const n of a.childNodes)switch(n.tagName){case"text":/www\.lilypond\.org/.test(n.textContent)&&a.removeChild(n);break;case"a":const t=n.getAttribute("xlink:href"),s=t.match(/:(\d+:\d+:\d+)$/);if(s){const t=s[1];e.has(t)&&a.removeChild(n)}break}const i=a.outerHTML;return l(i,s)},h=async(t,e,s)=>{const o=[];for(const a of t)o.push(await d(a,e,s));return o},f=(t,e)=>{for(const s of t.children)if("use"===s.tagName){const o=s.getAttribute("xlink:href");if(o){const a=o.substr(1),i=e[a];if(i){const e=i.cloneNode(!0);e.classList.add(...s.classList),(e.classList.contains("staff-line")||e.classList.contains("line")||e.classList.contains("slur"))&&e.children[0].setAttribute("stroke","black"),t.insertBefore(e,s),t.removeChild(s)}}}else f(s,e)},u=async function*({sheetDocument:t,signs:e,hashTable:s,matchedIds:o,canvas:a}){console.assert(!!t,"sheetDocument is null."),console.assert(!!o,"matchedIds is null."),console.assert(!!a,"canvas is null."),console.assert(e||s,"signs & hashTable is both null.");const i=new r({propsData:{doc:t,partialVisible:!1}}).$mount(document.createElement("div"));await i.$nextTick(),e||(e=new c({propsData:{hashTable:s}}).$mount(document.createElement("div")));const n=e.$el.children[0],d=[...n.children].reduce((t,e)=>(t[e.id]=e,t),{}),h=[...i.$el.children];for(const r of h)o.forEach(t=>{r.querySelectorAll(`g[data-href='${t}']`).forEach(t=>t.parentElement.removeChild(t))}),f(r,d),yield await l(r.outerHTML,a)}},2462:function(t,e,s){var o=s("6df9");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("6677ab5e",o,!0,{sourceMap:!1,shadowMode:!1})},"29f3":function(t,e){var s=Object.prototype,o=s.toString;function a(t){return o.call(t)}t.exports=a},"2b3e":function(t,e,s){var o=s("585a"),a="object"==typeof self&&self&&self.Object===Object&&self,i=o||a||Function("return this")();t.exports=i},"2be7":function(t,e,s){var o=s("24fb"),a=s("0146");e=o(!1),e.i(a),e.push([t.i,"",""]),t.exports=e},"2bff":function(t,e,s){var o=s("2be7");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("1b71e8f0",o,!0,{sourceMap:!1,shadowMode:!1})},3729:function(t,e,s){var o=s("9e69"),a=s("00fd"),i=s("29f3"),n="[object Null]",r="[object Undefined]",c=o?o.toStringTag:void 0;function l(t){return null==t?void 0===t?r:n:c&&c in Object(t)?a(t):i(t)}t.exports=l},"3ed0":function(t,e,s){var o=s("24fb");e=o(!1),e.push([t.i,":root{--lotus-token-default-color:#000;--lotus-token-on-color:#0af}",""]),t.exports=e},"408c":function(t,e,s){var o=s("2b3e"),a=function(){return o.Date.now()};t.exports=a},"4a93":function(t,e,s){"use strict";s("f7f3")},"4cef":function(t,e){var s=/\s/;function o(t){var e=t.length;while(e--&&s.test(t.charAt(e)));return e}t.exports=o},"50f4":function(t,e,s){"use strict";s("8b2a")},"585a":function(t,e,s){(function(e){var s="object"==typeof e&&e&&e.Object===Object&&e;t.exports=s}).call(this,s("c8ba"))},"5f3d":function(t,e,s){var o=s("b1a2");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("0a968266",o,!0,{sourceMap:!1,shadowMode:!1})},"6c07":function(t,e,s){var o=s("81d1");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("2c493a70",o,!0,{sourceMap:!1,shadowMode:!1})},"6c11":function(t,e,s){"use strict";s("2bff")},"6df9":function(t,e,s){var o=s("24fb"),a=s("3ed0");e=o(!1),e.i(a),e.push([t.i,".token .line[data-v-5fc078a1],.token .slur[data-v-5fc078a1],.token .staff-line[data-v-5fc078a1]{stroke:var(--lotus-token-default-color)}.token use[data-v-5fc078a1]{fill:var(--lotus-token-default-color)}.token.matched use.on[data-v-5fc078a1]{fill:var(--lotus-token-on-color);stroke-width:.1;stroke:var(--lotus-token-on-color)}",""]),t.exports=e},"81d1":function(t,e,s){var o=s("24fb");e=o(!1),e.push([t.i,".check-button[data-v-58f51ec2]{cursor:pointer}",""]),t.exports=e},"8a81":function(t,e,s){"use strict";s("6c07")},"8b2a":function(t,e,s){var o=s("b1f3");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("715033e0",o,!0,{sourceMap:!1,shadowMode:!1})},"8d74":function(t,e,s){var o=s("4cef"),a=/^\s+/;function i(t){return t?t.slice(0,o(t)+1).replace(a,""):t}t.exports=i},"9e69":function(t,e,s){var o=s("2b3e"),a=o.Symbol;t.exports=a},a139:function(t,e,s){"use strict";var o=function(){var t=this,e=t._self._c;return e("div",{staticClass:"sheet live"},t._l(t.shownPages,(function(s,o){return e("svg",{key:o,ref:"pages",refInFor:!0,staticClass:"page",style:{["background-image"]:t.backgroundImages&&t.backgroundImages[o]&&`url(${t.backgroundImages[o]})`},attrs:{xmlns:"http://www.w3.org/2000/svg",width:s.width,height:s.height,viewBox:`${s.viewBox.x} ${s.viewBox.y} ${s.viewBox.width} ${s.viewBox.height}`},on:{DOMNodeInserted:t.onPageChanged}},[t.partialVisible&&s.hidden?t._e():e("g",[t.showMark?e("g",{staticClass:"mark"},[t._l(s.systems,(function(o,a){return e("g",{key:a,staticClass:"system",attrs:{transform:`translate(${o.x}, ${o.y})`},on:{mousemove:function(e){t.enablePointer&&t.onMousemovePad(o,e)},mouseleave:function(e){t.enablePointer&&t.onMouseleavePad(o,e)},click:function(e){return t.onClickPad(o,e)}}},[e("rect",{attrs:{x:0,y:o.top,width:o.width,height:o.bottom-o.top}}),t._t("system",null,{system:o,page:s})],2)})),t._t("page",null,{page:s})],2):t._e(),t.bakingMode?t._e():e("g",[t.watermark?e("g",{staticClass:"wm"},[e("image",{attrs:{href:t.watermark,x:(t.doc.pageSize.width-t.watermarkSize.width)/2/t.svgScale,y:(t.doc.pageSize.height-t.watermarkSize.height)/2/t.svgScale,width:t.watermarkSize.width/2/t.svgScale,height:t.watermarkSize.height/2/t.svgScale}})]):t._e(),e("g",{staticClass:"page-tokens"},t._l(s.tokens,(function(t,s){return e("SheetToken",{key:s,attrs:{token:t}})})),1),t._l(s.systems,(function(o,a){return e("g",{key:a,staticClass:"system",attrs:{transform:`translate(${o.x}, ${o.y})`}},[t.showCursor&&t.cursorPosition&&t.cursorPosition.system===o.index?e("rect",{staticClass:"cursor",attrs:{x:t.cursorPosition.x,y:o.top-.5,width:"1",height:o.bottom-o.top+1}}):t._e(),e("g",t._l(o.tokens,(function(t,s){return e("SheetToken",{key:s,attrs:{token:t}})})),1),t._l(o.staves,(function(a,i){return e("g",{key:i,staticClass:"staff",attrs:{transform:`translate(${a.x}, ${a.y})`}},[e("g",t._l(a.tokens,(function(t,s){return e("SheetToken",{key:s,attrs:{token:t}})})),1),t._l(a.measures,(function(s,o){return e("g",{key:o,staticClass:"measure"},t._l(s.tokens,(function(s,o){return e("SheetToken",{key:o,attrs:{token:s,classes:{matched:t.statusMap.has(s.href),mismatched:s.is("NOTEHEAD")&&!t.statusMap.has(s.href),tied:s.tied,attached:Number.isFinite(s.stemX),highlight:t.highlightSymbol&&s.is(t.highlightSymbol)},showTitle:t.showMark,scale:t.enabledFont?s.scale2:null},on:{click:function(e){return t.$emit("click-token",s,e)}}})})),1)})),t.showMark?e("g",{staticClass:"mark"},[t._t("staff",null,{staff:a,system:o,page:s})],2):t._e(),e("g",{staticClass:"markings"},t._l(a.markings,(function(s){return e("g",{key:s.index,class:s.cls,attrs:{transform:`translate(${s.x}, ${s.y+a.yRoundOffset})`}},[e("text",[t._v(t._s(s.text))]),s.alterText?e("text",{staticClass:"alter",attrs:{x:"-0.2",y:"0"}},[t._v(t._s(s.alterText))]):t._e()])})),0)],2)}))],2)}))],2),t.bakingMode?e("g",{staticClass:"bake"},t._l(s.systems,(function(s,o){return e("g",{key:o,staticClass:"system",attrs:{transform:`translate(${s.x}, ${s.y})`}},[t.showCursor&&t.cursorPosition&&t.cursorPosition.system===s.index?e("rect",{staticClass:"cursor",attrs:{x:t.cursorPosition.x,y:s.top-.5,width:"1",height:s.bottom-s.top+1}}):t._e(),t._l(s.staves,(function(s,o){return e("g",{key:o,staticClass:"staff",attrs:{transform:`translate(${s.x}, ${s.y})`}},[t._l(s.measures,(function(s,o){return e("g",{key:o,staticClass:"measure"},t._l(s.matchedTokens,(function(s,o){return e("g",{key:o,staticClass:"token matched",class:{tied:s.tied},attrs:{transform:`translate(${s.x}, ${s.y})`+(s.scale&&1!==s.scale?` scale(${s.scale})`:""),"data-track":s.track,"data-index":s.index}},[e("text",{attrs:{"data-href":s.href}},[t._v(t._s(s.fontUnicode))])])})),0)})),e("g",{staticClass:"markings"},t._l(s.markings,(function(o){return e("g",{key:o.index,class:o.cls,attrs:{transform:`translate(${o.x}, ${o.y+s.yRoundOffset})`}},[e("text",[t._v(t._s(o.text))]),o.alterText?e("text",{staticClass:"alter",attrs:{x:"-0.2",y:"0"}},[t._v(t._s(o.alterText))]):t._e()])})),0)],2)}))],2)})),0):t._e()])])})),0)},a=[],i=s("2b0e"),n=s("4b63"),r=s("6a98"),c=s("5027");class l{constructor(t=!1){t&&this.lock()}get locked(){return!!this.resolve}lock(){return console.assert(!this.locked,"[SingleLock] duplicated locking, last locking has't been released yet."),this.promise=new Promise(t=>this.resolve=t),this.promise}release(t){this.resolve&&(this.resolve(t),this.resolve=null)}wait(){return this.promise}}class d{constructor(t=Date){this.tasks={},this.handlers={},this.timer=t}clear(){Object.values(this.handlers).forEach(t=>clearTimeout(t)),this.tasks={},this.handlers={}}getTask(t){const e=Math.max(t-this.timer.now(),0);return this.tasks[t]||(this.tasks[t]=new Promise(s=>{this.handlers[t]=setTimeout(s,e)}).then(()=>{delete this.tasks[t],delete this.handlers[t]})),this.tasks[t]}appendTask(t,e){this.tasks[t]=this.getTask(t).then(e)}}var h=function(){var t=this,e=t._self._c;return e("g",{staticClass:"token",class:t.classes,attrs:{transform:`translate(${t.token.x}, ${t.token.y})`+(t.scale?` scale(${t.scale.x}, ${t.scale.y})`:""),"data-index":t.token.index,"data-href":t.token.href,"data-track":t.token.track},on:{click:function(e){return t.$emit("click",e)}}},[e("use",{class:t.token.classes,attrs:{"data-href":t.token.href,"xlink:href":"#sign-"+t.token.hash}}),t.showTitle&&t.token.href?e("title",[t._v(t._s(t.token.href))]):t._e()])},f=[],u={name:"sheet-token",props:{token:Object,classes:Object,showTitle:Boolean,scale:Object}},g=u,A=(s("b30c"),s("2877")),m=Object(A["a"])(g,h,f,!1,null,"5fc078a1",null),k=m.exports;class p{add(){}remove(){}}class y{constructor(t){this.elems=t}add(t){this.elems.forEach(e=>e.classList.add(t))}remove(t){this.elems.forEach(e=>e.classList.remove(t))}get value(){return this.elems[0]&&this.elems[0].value}set value(t){this.elems.forEach(e=>e.value=t)}}const v=(t,e=document)=>{const s=e.querySelectorAll(`.token *[data-href='${t}']`);return 0===s.length?new p:1===s.length?s[0].classList:new y(s)},w=Object({NODE_ENV:"production",BASE_URL:""}).VUE_APP_DEFAULT_WATERMARK;var x={name:"sheet-live",components:{SheetToken:k},props:{doc:Object,midiNotation:Object,pitchContextGroup:Array,showMark:Boolean,showCursor:{type:Boolean,default:!0},noteHighlight:{type:Boolean,default:!0},bakingMode:{type:Boolean,default:!1},backgroundImages:Array,enablePointer:{type:Boolean,default:!1},showPagesProgressively:{type:Boolean,default:!1},partialVisible:{type:Boolean,default:!0},scheduler:Object,watermark:{type:String,default:w},enabledFont:Boolean,highlightSymbol:String},data(){return{midiPlayer:null,statusMap:new Map,shownPages:[],watermarkSize:{width:256,height:256}}},computed:{progressTicks(){return this.midiPlayer&&this.midiPlayer.progressTicks},cursorPosition(){return this.midiPlayer&&this.scheduler?this.scheduler.lookupPosition(this.progressTicks):null},cursorPageIndex(){if(!this.cursorPosition||!this.doc)return null;const t=this.doc.systems[this.cursorPosition.system];return console.assert(t,"invalid cursor system index:",this.cursorPosition),t?t.pageIndex:null},cursorSystemIndex(){return this.cursorPosition&&this.doc?this.cursorPosition.system:null},cursorRowIndex(){return this.cursorSystemIndex},svgScale(){const t=this.doc&&this.doc.pages[0];return t?this.doc.pageSize.width/t.viewBox.width:1},isPlaying(){return this.midiPlayer&&this.midiPlayer.isPlaying}},created(){if(this.pageLoadingLock=new l,this.schedulePool=new d(performance),this.preparePlayer(),this.showPages(),this.watermark){const t=new Image;t.src=this.watermark,t.onload=()=>{this.watermarkSize.width=t.naturalWidth,this.watermarkSize.height=t.naturalHeight}}},methods:{onPlayerMidi(t,e){if(this.$emit("midi",t,e),this.noteHighlight&&t.ids){let s=null;const o=t.ids;switch(t.subtype){case"noteOn":s=()=>o.forEach(t=>{const e=this.statusMap.get(t);e&&e.add("on")});break;case"noteOff":s=()=>o.forEach(t=>{const e=this.statusMap.get(t);e&&e.remove("on")});break}s&&this.schedulePool.appendTask(e,s)}},setNoteStatus(t,e,s){if(this.midiNotation){const o=this.midiNotation.notes[t];o?o.ids&&o.ids.forEach(t=>{const o=this.statusMap.get(t);o&&(s?o.add(e):o.remove(e))}):console.warn("invalid note index:",t,this.midiNotation.notes.length)}},clearNoteStatus(){for(const t of this.statusMap.values())t.value=""},updateTokenStatus(){if(this.midiNotation&&this.noteHighlight)for(const t of this.midiNotation.notes){const e=this.midiPlayer.isPlaying&&this.midiPlayer.progressTime>=t.start&&this.midiPlayer.progressTime<t.start+t.duration;t.ids&&t.ids.forEach(t=>{const s=this.statusMap.get(t);s&&(e?s.add("on"):s.remove("on"))})}},async preparePlayer(){if(this.statusMap.clear(),this.midiPlayer&&(this.midiPlayer.dispose(),this.midiPlayer=null),this.midiNotation&&(this.updateMidiPlayer(),await this.$nextTick(),await this.pageLoadingLock.wait(),this.updateStatusMap(),!this.scheduler)){const t=this.doc&&this.doc.getTokenMap();if(t){for(const s of t.values())i["a"].set(s,"on",s.on||!1);const e=r["a"].createFromNotation(this.midiNotation,t);this.$emit("update:scheduler",e)}}},updateMidiPlayer(){this.midiPlayer&&this.midiPlayer.dispose(),this.midiPlayer=new n["MidiPlayer"](this.midiNotation,{cacheSpan:400,onMidi:(t,e)=>this.onPlayerMidi(t,e),onTurnCursor:()=>this.updateTokenStatus()})},updateStatusMap(){this.midiNotation&&this.midiNotation.notes.forEach(t=>t.ids&&t.ids.forEach(t=>{this.statusMap.get(t)||this.statusMap.set(t,v(t,this.$el))}))},updateStatusMapInPage(t){const e=t.querySelectorAll(".token *[data-href]");e.forEach(e=>{const s=e.dataset.href;this.statusMap.set(s,v(s,t))})},addMarkingByTick(t,e,s,{id:o,cls:a,text:i="",xoffset:n=0}={}){if(!this.pitchContextGroup)return void console.warn("[addMarkingByTick]\tpitchContextGroup is required.");const r=this.pitchContextGroup[s];if(!r)return void console.warn("[addMarkingByTick]\tinvalid staffIndex:",s,this.pitchContextGroup.length);const c=this.scheduler.lookupPosition(t);if(!c)return void console.warn("[addMarkingByTick]\tinvalid tick:",t);const l=r.lookup(t);if(!l)return console.warn("no context at tick:",t,r),null;const{y:d,alter:h}=l.pitchToY(e);return this.doc.addMarking(c.system,s,{x:c.x+n,y:d,text:i,alter:h,id:o,cls:a})},addMarkingByNote(t,e,{id:s=null,cls:o,text:a=""}={}){console.assert(this.midiNotation,"[addMarkingByNote]\tmidiNotation is null.");const i=this.midiNotation.notes[t];if(i){if(!s){if(!i.ids)return null;s=i.ids[0]}return this.addMarkingByTick(i.startTick,e,i.staffTrack,{id:s,cls:o,text:a,xoffset:1.2})}console.warn("[addMarkingByNote]\tinvalid noteIndex:",t,this.midiNotation.notes.length)},removeMarking(t){this.doc.removeMarking(t)},clearMarkings(){this.doc.clearMarkings()},async showPages(){if(this.shownPages=[],this.doc)if(this.showPagesProgressively){await this.pageLoadingLock.wait(),this.pageLoadingLock.lock();for(let t=0;t<this.doc.pages.length;++t)this.shownPages.push(this.doc.pages[t]),await this.$nextTick(),await Object(c["a"])();this.pageLoadingLock.release()}else this.shownPages=this.doc.pages},onDocChanged(){this.clearNoteStatus(),this.clearMarkings(),this.showPages()},eventToSystemPosition(t,e){return{x:e.offsetX/this.svgScale-t.x,y:e.offsetY/this.svgScale-t.y}},eventToPointer(t,e){const s=this.eventToSystemPosition(t,e),o=t.index,a=this.doc.lookupMeasureIndex(o,s.x),i=this.scheduler&&this.scheduler.lookupTick({system:o,x:s.x});return{systemIndex:o,measureIndex:a,tick:i,...s}},onMousemovePad(t,e){this.$emit("pointerUpdate",this.eventToPointer(t,e))},onMouseleavePad(){this.$emit("pointerUpdate",null)},onClickPad(t,e){this.$emit("pointerClick",this.eventToPointer(t,e),e)},updatePageVisibility(){this.$refs.pages?this.$refs.pages.forEach((t,e)=>{const s=t.getBoundingClientRect(),o=this.shownPages[e],a=s.top>window.innerHeight||s.bottom<0||s.left>window.innerWidth||s.right<0;!!o.hidden!==a&&i["a"].set(o,"hidden",a)}):console.log("[updatePageVisibility] $refs.pages is null:",this.$refs.pages)},onPageChanged(t){t.target&&"g"===t.target.nodeName&&this.updateStatusMapInPage(t.target)}},watch:{midiNotation:"preparePlayer",midiPlayer(t){this.$emit("update:midiPlayer",t)},async bakingMode(){await this.$nextTick(),await this.pageLoadingLock.wait(),this.updateStatusMap(),this.updateTokenStatus()},doc:"onDocChanged",cursorPageIndex(t){this.$emit("cursorPageShift",t)},cursorSystemIndex(t){this.$emit("cursorSystemShift",t)},isPlaying(t){t||this.schedulePool.clear()}}},b=x,B=(s("4a93"),s("6c11"),s("50f4"),Object(A["a"])(b,o,a,!1,null,"dc74d054",null));e["a"]=B.exports},b047:function(t,e,s){var o=s("1a8c"),a=s("408c"),i=s("b4b0"),n="Expected a function",r=Math.max,c=Math.min;function l(t,e,s){var l,d,h,f,u,g,A=0,m=!1,k=!1,p=!0;if("function"!=typeof t)throw new TypeError(n);function y(e){var s=l,o=d;return l=d=void 0,A=e,f=t.apply(o,s),f}function v(t){return A=t,u=setTimeout(b,e),m?y(t):f}function w(t){var s=t-g,o=t-A,a=e-s;return k?c(a,h-o):a}function x(t){var s=t-g,o=t-A;return void 0===g||s>=e||s<0||k&&o>=h}function b(){var t=a();if(x(t))return B(t);u=setTimeout(b,w(t))}function B(t){return u=void 0,p&&l?y(t):(l=d=void 0,f)}function C(){void 0!==u&&clearTimeout(u),A=0,l=g=d=u=void 0}function M(){return void 0===u?f:B(a())}function P(){var t=a(),s=x(t);if(l=arguments,d=this,g=t,s){if(void 0===u)return v(g);if(k)return clearTimeout(u),u=setTimeout(b,e),y(g)}return void 0===u&&(u=setTimeout(b,e)),f}return e=i(e)||0,o(s)&&(m=!!s.leading,k="maxWait"in s,h=k?r(i(s.maxWait)||0,e):h,p="trailing"in s?!!s.trailing:p),P.cancel=C,P.flush=M,P}t.exports=l},b1a2:function(t,e,s){var o=s("24fb");e=o(!1),e.push([t.i,".sign line[data-v-7dcb4590],.sign polygon[data-v-7dcb4590]{stroke:inherit}.sign path[data-v-7dcb4590],.sign polygon[data-v-7dcb4590],.sign rect[data-v-7dcb4590]{fill:inherit}.sign path[data-v-7dcb4590]{stroke:inherit}.sign .font-char[data-v-7dcb4590]{font-family:var(--music-font-family);font-size:var(--music-font-size)}",""]),t.exports=e},b1f3:function(t,e,s){var o=s("24fb"),a=s("3ed0");e=o(!1),e.i(a),e.push([t.i,".sheet .bake .token text{fill:var(--lotus-token-default-color)}.sheet .bake .token text.on{fill:var(--lotus-token-on-color);stroke-width:.1;stroke:var(--lotus-token-on-color)}",""]),t.exports=e},b30c:function(t,e,s){"use strict";s("2462")},b4b0:function(t,e,s){var o=s("8d74"),a=s("1a8c"),i=s("ffd6"),n=NaN,r=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=parseInt;function h(t){if("number"==typeof t)return t;if(i(t))return n;if(a(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=a(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=o(t);var s=c.test(t);return s||l.test(t)?d(t.slice(2),s?2:8):r.test(t)?n:+t}t.exports=h},ddcc:function(t,e,s){"use strict";var o=function(){var t=this,e=t._self._c;return e("button",{class:`check-button ${t.classes} ${t.value?"on":"off"}`,domProps:{innerHTML:t._s(t.content)},on:{click:t.onClick}})},a=[],i={name:"check-button",props:{value:Boolean,classes:{type:String,default:""},content:String},methods:{onClick(){this.$emit("input",!this.value)}}},n=i,r=(s("8a81"),s("2877")),c=Object(r["a"])(n,o,a,!1,null,"58f51ec2",null);e["a"]=c.exports},e179:function(t,e,s){var o=s("24fb"),a=s("3ed0");e=o(!1),e.i(a),e.push([t.i,".sheet .mark[data-v-dc74d054]{opacity:0}.sheet .mark .locator text[data-v-dc74d054]{font-size:2px;text-anchor:start;pointer-events:none}.sheet .mark rect[data-v-dc74d054]{fill:transparent}.sheet .cursor[data-v-dc74d054],.sheet .wm[data-v-dc74d054]{pointer-events:none}.sheet .bake[data-v-dc74d054]{font-family:var(--music-font-family)}.sheet .bake .token text[data-v-dc74d054]{pointer-events:none}.sheet .bake .token text[data-v-dc74d054],.sheet .markings text[data-v-dc74d054]{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:var(--music-font-size)}.sheet .markings text[data-v-dc74d054]{font-family:var(--music-font-family)}.sheet .markings .alter[data-v-dc74d054]{text-anchor:end}",""]),t.exports=e},eaac:function(t,e,s){"use strict";s("5f3d")},f7ce:function(t,e,s){"use strict";var o=function(){var t=this,e=t._self._c;return e("svg",{staticClass:"sheet-signs",attrs:{xmlns:"http://www.w3.org/2000/svg"}},[e("defs",t._l(t.signs,(function(s){return e("g",{key:s.id,staticClass:"sign",attrs:{id:"sign-"+s.id,transform:s.def.scale&&!s.glyph&&`scale(${s.def.scale.x}, ${s.def.scale.y})`}},[s.glyph?e("text",{staticClass:"font-char",attrs:{"text-anchor":"start"},domProps:{innerHTML:t._s(s.glyph)}}):t._e(),"path"!==s.def.type||s.glyph?t._e():e("path",{attrs:{d:s.def.d,"stroke-width":s.def["stroke-width"]}}),"rect"===s.def.type?e("rect",{attrs:{x:s.def.width>=0?0:s.def.width,y:s.def.height>=0?0:s.def.height,width:Math.abs(s.def.width),height:Math.abs(s.def.height)}}):t._e(),"line"===s.def.type?e("line",{attrs:{x1:"0",y1:"0",x2:s.def.width,y2:s.def.height,"stroke-width":s.def["stroke-width"],"stroke-dasharray":s.def["stroke-dasharray"]}}):t._e(),"polygon"===s.def.type?e("polygon",{attrs:{points:s.def.points,"stroke-width":s.def["stroke-width"]}}):t._e(),"text"===s.def.type?e("text",{attrs:{"font-size":s.def["font-size"],"font-weight":s.def["font-weight"],"font-style":s.def["font-style"],"text-anchor":s.def["text-anchor"],fill:s.def.color}},[e("tspan",[t._v(t._s(s.def.text))])]):t._e()])})),0)])},a=[],i=s("32c1"),n={name:"sheet-signs",props:{hashTable:Object,enabledFont:Boolean},computed:{signs(){return this.hashTable?Object.entries(this.hashTable).map(([t,e])=>({id:t,def:e,glyph:this.enabledFont?i["glyph"].glyphHash[t]&&i["glyph"].GlyphUnicode[i["glyph"].glyphHash[t]]:null})):[]}}},r=n,c=(s("eaac"),s("2877")),l=Object(c["a"])(r,o,a,!1,null,"7dcb4590",null);e["a"]=l.exports},f7f3:function(t,e,s){var o=s("e179");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=s("499e").default;a("7daddbf7",o,!0,{sourceMap:!1,shadowMode:!1})},ffd6:function(t,e,s){var o=s("3729"),a=s("1310"),i="[object Symbol]";function n(t){return"symbol"==typeof t||a(t)&&o(t)==i}t.exports=n}}]);
2
+ //# sourceMappingURL=chunk-40965e1a.74707226.js.map
dist/js/chunk-48b5b2a0.3db5a0aa.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/js/chunk-a06ef50c.1caef24f.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a06ef50c"],{1773:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return c})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return u})),n.d(t,"b",(function(){return f}));var r=n("27e2"),o=n("43fb"),a=n("6977");function s(e,t){let n=t;for(;;){if(!Array.isArray(n))break;{if(0===n.length)break;n=Object(o["i"])(e,n);const t=Object(r["d"])(n[0]);if(!t)break;{const r=Object(o["h"])(e,t,n);if(!r)break;n=r.fn(r.actualArgs)}}Object(a["d"])(e)}return n}function l(e,t){if(!Array.isArray(t)||!Object(r["d"])(t[0],e.config.reservedNames.quote))throw new Error("[SX] stripQuote: token is not quoted.");return t[1]}function c(e,t){return Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.quote)?t[1]:t}function i(e){return function(){return Object(o["e"])(e)}}function u(e,t){return Object(a["b"])("(compiler)resolveValueSymbol_dynamic",t),function(){return Object(o["j"])(e,{symbol:t})}}function f(e){return function(t){return Object(a["b"])(e,t)}}},"27e2":function(e,t,n){"use strict";function r(e,t){return[{symbol:e.config.reservedNames.quote},t]}function o(e,t){if(Array.isArray(t)&&0<t.length){const n=f(t);if(n&&n.symbol===e.config.reservedNames.quote)return!0}return!1}function a(e,t){return[{symbol:e.config.reservedNames.backquote},t]}function s(e,t){if(Array.isArray(t)&&0<t.length){const n=f(t);if(n&&n.symbol===e.config.reservedNames.backquote)return!0}return!1}function l(e,t){return[{symbol:e.config.reservedNames.unquote},t]}function c(e,t){if(Array.isArray(t)&&0<t.length){const n=f(t);if(n&&n.symbol===e.config.reservedNames.unquote)return!0}return!1}function i(e,t){return[{symbol:e.config.reservedNames.spread},t]}function u(e,t){return[{symbol:e.config.reservedNames.splice},t]}function f(e,t){return e&&"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,"symbol")?void 0!==t?e.symbol===t?e:null:e:null}n.d(t,"f",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return s})),n.d(t,"i",(function(){return l})),n.d(t,"e",(function(){return c})),n.d(t,"h",(function(){return i})),n.d(t,"g",(function(){return u})),n.d(t,"d",(function(){return f}))},"43fb":function(e,t,n){"use strict";n.d(t,"l",(function(){return a})),n.d(t,"i",(function(){return l})),n.d(t,"h",(function(){return c})),n.d(t,"k",(function(){return u})),n.d(t,"j",(function(){return f})),n.d(t,"a",(function(){return m})),n.d(t,"c",(function(){return b})),n.d(t,"f",(function(){return $})),n.d(t,"m",(function(){return p})),n.d(t,"e",(function(){return _})),n.d(t,"d",(function(){return d})),n.d(t,"g",(function(){return g})),n.d(t,"b",(function(){return j}));var r=n("27e2"),o=n("6977");function a(e){switch(typeof e){case"object":case"symbol":case"function":return NaN;default:return Number(e)}}function s(e,t){for(let n=0;n<t.length;n++){const o=Array.isArray(t[n])&&Object(r["d"])(t[n][0],e.config.reservedNames.unquote);o&&(t=t.slice(0,n).concat([j(e,t[n][1])],t.slice(n+1))),Array.isArray(t[n])&&(t=t.slice(0),t[n]=s(e,t[n]))}return l(e,t)}function l(e,t){if(e.config.enableSplice)for(let n=t.length-1;n>=0;n--){const o=Array.isArray(t[n])&&Object(r["d"])(t[n][0],e.config.reservedNames.splice);o&&(t=t.slice(0,n).concat(t[n][1],t.slice(n+1)))}return t}function c(e,t,n){const r=e.macroMap.get(t.symbol);let o=null;if(r){let a=r;const s=n.slice(1);while(a){if(!a.formalArgs)return{fn:a.fn(e,t.symbol),actualArgs:n};{const r=y(e,t.symbol,a.formalArgs,Boolean(a.lastIsSpread),s);if(!r.error)return{fn:a.fn(e,t.symbol,r.formalArgs),actualArgs:n.slice(0,1).concat(r.actualArgs)};o=r.error,a=a.next}}if(o)throw new Error(o)}return!1}function i(e,t){if("function"===typeof t)return t;const n=e.funcMap.get(t.symbol);if(n)return n.fn(e,t.symbol);{const n=f(e,t);if("function"===typeof n)return n;if(e.config.funcSymbolResolverFallback)return e.config.funcSymbolResolverFallback(e,t.symbol);if(e.config.raiseOnUnresolvedSymbol)throw new Error(`[SX] resolveFunctionSymbol: Unresolved symbol: ${t.symbol}.`);return t.symbol}}function u(e,t,n){for(let o=e.scopes.length-1;o>0;o--){const n=e.scopes[o];if(n&&Object.prototype.hasOwnProperty.call(n.scope,t.symbol))return n.scope;if(n.capturedScopes&&Object.prototype.hasOwnProperty.call(n.capturedScopes,t.symbol))return n.capturedScopes[t.symbol];if(!n.isBlockLocal)break}const r=d(e);return Object.prototype.hasOwnProperty.call(r.scope,t.symbol)?r.scope:n?null:_(e).scope}function f(e,t){const n=u(e,t,!0);if(n)return n[t.symbol];const r=e.symbolMap.get(t.symbol);if(r)return r.fn(e,t.symbol);if(e.config.valueSymbolResolverFallback)return e.config.valueSymbolResolverFallback(e,t.symbol);if(e.config.raiseOnUnresolvedSymbol)throw new Error(`[SX] resolveValueSymbol: Unresolved symbol: ${t.symbol}.`);return t.symbol}function m(e,t){const n={};for(const r of t){const t=u(e,r,!0);if(null===t)throw new Error("[SX] collectCapturedVariables: Unresolved symbols "+r);Object(o["c"])("collectCapturedVariables",n,r.symbol),n[r.symbol]=t}return n}function b(e){const t=[];for(let n=e.scopes.length-1;n>0;n--){const r=e.scopes[n];if(r.capturedScopes&&t.unshift(r.capturedScopes),!r.isBlockLocal)break}return t.length>0?Object.assign({},...t):void 0}function $(e,t,n,r){e.scopes.push({isBlockLocal:n,scope:t,capturedScopes:r})}function p(e){if(e.scopes.length<2)throw new Error("[SX] uninstallScope: Unable to pop stack.");return e.scopes.pop()}function _(e){return e.scopes[e.scopes.length-1]}function d(e){return e.scopes[0]}function y(e,t,n,o,a){if(n=n.slice(0),a=a.slice(0),a.length+(o?1:0)<n.length)return{error:`[SX] macro call (${t}): Actual args too short: actual ${a.length} / formal ${n.length}.`};for(let s=n.length-(o?2:1);s>=0;s--){let e=n[s].symbol;if(e.startsWith("!")){if(n[s].symbol=n[s].symbol.slice(1),e=n[s].symbol,!Object(r["d"])(a[s]))return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not symbol.`}}else if(e.startsWith("<")&&e.endsWith(">")){if(n[s].symbol=n[s].symbol.slice(1,-1),e=n[s].symbol,!Object(r["d"])(a[s],e))return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not expected symbol.`};n=n.slice(0,s).concat(n.slice(s+1)),a=a.slice(0,s).concat(a.slice(s+1))}else{const o=e.lastIndexOf(":");if(0<o){const l=e.slice(o+1);switch(l){case"number":if("number"!==typeof a[s])return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not number.`};break;case"string":if("string"!==typeof a[s])return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not string.`};break;case"function":if(!Array.isArray(a[s])||!Object(r["d"])(a[s][0]))return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not function.`};break;case"list":if(!Array.isArray(a[s]))return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not list.`};break;case"symbol":if(!Object(r["d"])(a[s]))return{error:`[SX] macro call (${t}): Actual arg(${s}: ${e}) is not symbol.`};break;case"any":break;default:return{error:`[SX] macro call (${t}): Formal arg(${s}: ${e}) is unknown type ${l}.`}}n[s].symbol=n[s].symbol.slice(0,o)}}}return{formalArgs:n,actualArgs:a}}function g(e,t,n){if(Array.isArray(n[n.length-1])){const r=n.slice(0,n.length-1),o=n[n.length-1];if(o&&"object"===typeof o[0]&&o[0].symbol===e.config.reservedNames.if&&Array.isArray(o[3])&&"object"===typeof o[3][0]&&o[3][0].symbol===e.config.reservedNames.self){const n=`$__tempvar__$$ec${e.evalCount++}$$_`,a=t.map((e,t)=>({symbol:`${n}_$i${t}_${e.symbol}`}));return[[{symbol:e.config.reservedNames.until},o[1],[{symbol:e.config.reservedNames.let},[...a],...r,...o[3].slice(1).map((t,n)=>[{symbol:e.config.reservedNames.set},a[n],t]),...a.map((n,r)=>[{symbol:e.config.reservedNames.set},t[r],n])]],...r,o[2]]}}return n}function j(e,t){if(Object(o["d"])(e),null===t||void 0===t)return t;let n=t;for(;;){if(!Array.isArray(n))break;{if(0===n.length)return n;n=l(e,n);const t=Object(r["d"])(n[0]);if(!t)break;{const r=c(e,t,n);if(!r)break;n=r.fn(r.actualArgs)}}Object(o["d"])(e)}if(Array.isArray(n)){if(n=n.slice(0),0<n.length){const t=Object(r["d"])(n[0]);if(t){if(t.symbol===e.config.reservedNames.quote)return n.slice(1,2)[0];if(t.symbol===e.config.reservedNames.backquote)return n=n.slice(1,2)[0],Array.isArray(n)&&(n=s(e,n)),n;if(t.symbol===e.config.reservedNames.eval)return j(e,j(e,n.slice(1,2)[0]))}const o=[];for(let s=1;s<n.length;s++){const t=Array.isArray(n[s])&&Object(r["d"])(n[s][0],e.config.reservedNames.spread);if(t){o.push(s);const t=j(e,n[s][1]);n[s]=Array.isArray(t)?t:[t]}else n[s]=j(e,n[s])}for(const e of o.reverse())n=n.slice(0,e).concat(n[e],n.slice(e+1));let a;if(a="function"===typeof n[0]?n[0]:t?i(e,t):j(e,n[0]),"function"!==typeof a)throw new Error(`[SX] evaluate: First item of list is not a function: ${JSON.stringify(n)}.`);n=a(...n.slice(1))}}else if(e.config.wrapExternalValue&&Object.prototype.hasOwnProperty.call(n,"value"))n=n.value;else if(Object.prototype.hasOwnProperty.call(n,"symbol"))n=f(e,n);else if(Object.prototype.hasOwnProperty.call(n,"car")){const t=j(e,n.car),r=j(e,n.cdr);if(Array.isArray(r)){const e=r.slice(0);e.unshift(t),n=e}else n={car:t,cdr:r}}else Object.prototype.hasOwnProperty.call(n,"dotted")?n=[j(e,n.dotted)]:Object.prototype.hasOwnProperty.call(n,"comment")&&(n=[]);return n}},6921:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=Function("return this")()},6977:function(e,t,n){"use strict";n.d(t,"d",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n("c541"),o=n("6921");function a(e){if(e.evalCount++,e.config.maxEvalCount&&e.config.maxEvalCount<e.evalCount)throw new r["b"]}function s(e,t,n,r){if(t.length<n)throw new Error(`[SX] ${e}: Invalid argument length: expected: ${n} / args: ${t.length}.`);if(r&&r<t.length)throw new Error(`[SX] ${e}: Invalid argument length: expected: ${r} / args: ${t.length}.`);return t}const l={}.constructor,c=Function;function i(e,t){if("__proto__"===t||"__defineGetter__"===t||"__defineSetter__"===t||"__lookupGetter__"===t||"__lookupSetter__"===t)throw new Error(`[SX] ${e}: Invalid var name ${t}.`);if("prototype"===t||"constructor"===t)throw new Error(`[SX] ${e}: Invalid var name ${t}.`);if(l.hasOwnProperty(t))throw new Error(`[SX] ${e}: Invalid var name ${t}.`);if("call"===t||"arguments"===t||"caller"===t)throw new Error(`[SX] ${e}: Invalid var name ${t}.`);return t}function u(e,t,n){if(t===o["a"]||"__proto__"===n||"__defineGetter__"===n||"__defineSetter__"===n||"__lookupGetter__"===n||"__lookupSetter__"===n)throw new Error(`[SX] ${e}: Invalid var name ${n}.`);if(("prototype"===n||"constructor"===n)&&(null===t||void 0===t||"function"===typeof t))throw new Error(`[SX] ${e}: Invalid var name ${n}.`);if((null===t||void 0===t||t===l)&&l.hasOwnProperty(n))throw new Error(`[SX] ${e}: Invalid var name ${n}.`);if(null===t||void 0===t||t===c){let t=c;while(t){if(t.hasOwnProperty(n))throw new Error(`[SX] ${e}: Invalid var name ${n}.`);t=t.__proto__}}if("function"===typeof t&&!t.hasOwnProperty(n))throw new Error(`[SX] ${e}: Invalid var name ${n}.`);return n}},7941:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return compileLambda}));var _ast__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("27e2"),_evaluate__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("43fb"),_errors__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("6977"),_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("1773"),_compile_ops__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("d8d6");function compileCore(e,t,n,r,o){function a(e){const t=new Map;for(const n of c.varNames.entries())t.set(n[0],n[1]);e(),c.varNames=t}function s(e){let t="";if(null===e)t+="(null)";else if(void 0===e)t+="(void 0)";else switch(typeof e){case"boolean":case"number":t+=`(${String(e)})`;break;case"object":if(Object(_ast__WEBPACK_IMPORTED_MODULE_0__["d"])(e)){const n=e;Object(_errors__WEBPACK_IMPORTED_MODULE_2__["c"])("(compiler)compileValue",c.varNames,n.symbol),c.varNames.has(n.symbol)?t+=`(${c.varNames.get(n.symbol)})`:(o[c.varsCount]=n.symbol,t+=`(_$_vars[${String(c.varsCount++)}])`);break}default:o[c.varsCount]=e,t+=`(_$_vars[${String(c.varsCount++)}])`;break}return t}function l(t,n){let r="";const a=t[n];if(Array.isArray(a))if(0<a.length){const t=Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["a"])(e,a);if(Array.isArray(t))if(0<t.length)if(Object(_ast__WEBPACK_IMPORTED_MODULE_0__["d"])(t[0])){const n=t[0],a=t.slice(1);Object(_errors__WEBPACK_IMPORTED_MODULE_2__["c"])("(compiler)compileToken",i,n.symbol),i.has(n.symbol)?r+=i.get(n.symbol)(t,a):n.symbol===e.config.reservedNames.spread?r+=`...(${a.map(t=>l([Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["f"])(e,t)],0)).join(",")})`:e.funcMap.has(n.symbol)?(o[c.varsCount]=e.funcMap.get(n.symbol).fn(e,""),r+=`((_$_vars[${String(c.varsCount++)}])(${a.map(t=>l([Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["f"])(e,t)],0)).join(",")}))`):c.varNames.has(n.symbol)?r+=`(${String(c.varNames.get(n.symbol))})(${a.map(t=>l([Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["f"])(e,t)],0)).join(",")})`:(o[c.varsCount]=Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["d"])(e,n.symbol),r+=`((_$_vars[${String(c.varsCount++)}])()(${a.map(t=>l([Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["f"])(e,t)],0)).join(",")}))`)}else switch(typeof t[0]){case"function":o[c.varsCount]=t[0],r+=`((_$_vars[${String(c.varsCount++)}])(${t.slice(1).map((t,n,r)=>l([Object(_compile_ops_helpers__WEBPACK_IMPORTED_MODULE_3__["f"])(e,t)],0)).join(",")}))`;break;default:throw new Error(`[SX] compileToken: First item of list is not a function: ${JSON.stringify(t[0])}.`)}else r+="([])";else r+=s(a)}else r+="([])";else r+=s(a);return r}const c={_$_vars:o,varsCount:1,varNames:new Map,varNamesCount:0,varDefs:"var x0;",ops:new Map,makeScope:a,compileToken:l};Object(_compile_ops__WEBPACK_IMPORTED_MODULE_4__["a"])(e,c);const i=c.ops;e.config.enableTailCallOptimization&&(r=Object(_evaluate__WEBPACK_IMPORTED_MODULE_1__["g"])(e,t,r)),c.varNames.set(e.config.reservedNames.thiz,"(this===(Function('return this')())?null:(this===void 0?null:this))");const u=Object(_evaluate__WEBPACK_IMPORTED_MODULE_1__["c"])(e);if(u)for(const b in u)Object.prototype.hasOwnProperty.call(u,b)&&(o[c.varsCount++]=b,o[c.varsCount]=u[b],c.varNames.set(b,`(_$_vars[${String(c.varsCount)}][_$_vars[${String(c.varsCount-1)}]])`),c.varsCount++);const f=""+t.map((e,r)=>(c.varNames.set(t[r].symbol,"a"+r),`${n&&r===t.length-1?"...":""}a${r}`)).join(","),m=`return(${r.map((e,t)=>l(r,t)).join(",")})`;return`(function(${f}){"strict";${c.varDefs}${m}})`}function evalCompiledLambda(_$_state,_$_vars,code){return _$_vars[0]=eval(code),_$_vars[0]}function compileLambda(e,t,n,r){const o=[];return evalCompiledLambda(e,o,compileCore(e,t,n,r,o))}},c541:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return a}));class r extends Error{constructor(e){super(e)}}class o extends r{constructor(){super("[SX] evaluate: The maximum count of evaluations has been exceeded.")}}class a extends r{constructor(e){super(`[SX] ${e}: Unexpected termination of script.`)}}},d8d6:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n("27e2"),o=n("6977"),a=n("1773");function s(e,t){const{_$_vars:n,ops:s,makeScope:l,compileToken:c}=t;s.set(e.config.reservedNames.quote,(function(e,r){let o="";return n[t.varsCount]=e[1],o+=`(_$_vars[${String(t.varsCount++)}])`,o})),s.set(e.config.reservedNames.self,(function(t,n){let r="";return r+=`((_$_vars[0])(${n.map(t=>c([Object(a["f"])(e,t)],0)).join(",")}))`,r})),s.set("$__if",(function(t,n){let r="";return Object(o["a"])("compileToken:$__if",n,2,3),r+=`(${c(t,1)}?(${c([Object(a["e"])(e,t[2])],0)}):(${c([Object(a["e"])(e,t[3])],0)}))`,r})),s.set("$__if-null",(function(t,n){let r="";return Object(o["a"])("compileToken:$__if-null",n,2,2),r+=`((()=>{let _$_rv=${c(t,1)};return _$_rv?_$_rv:(${c([Object(a["e"])(e,t[2])],0)}});})())`,r})),s.set("$__cond",(function(t,n){let r="";Object(o["a"])("compileToken:$__cond",n,1),r+="(";for(let o=0;o<n.length;o+=2)r+=`${c([Object(a["e"])(e,n[o])],0)}?(${c([Object(a["e"])(e,n[o+1])],0)}):(`;r+="null";for(let e=0;e<n.length;e+=2)r+=")";return r+=")",r})),s.set("$__while",(function(t,n){let r="";return Object(o["a"])("compileToken:$__while",n,1),r+=`((()=>{let _$_rv=null;while(${c([Object(a["e"])(e,t[1])],0)}){_$_rv=${t.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}return _$_rv})())`,r})),s.set("$__do-while",(function(t,n){let r="";return Object(o["a"])("compileToken:$__do-until",n,1),r+=`((()=>{let _$_rv=null;do{_$_rv=${t.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}}while(${c([Object(a["e"])(e,t[1])],0)})return _$_rv)())`,r})),s.set("$__until",(function(t,n){let r="";return Object(o["a"])("compileToken:$__until",n,1),r+=`((()=>{let _$_rv=null;while(!${c([Object(a["e"])(e,t[1])],0)}){_$_rv=${t.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}return _$_rv})())`,r})),s.set("$__do-until",(function(t,n){let r="";return Object(o["a"])("compileToken:$__do-until",n,1),r+=`((()=>{let _$_rv=null;do{_$_rv=${t.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}}while(!${c([Object(a["e"])(e,t[1])],0)})return _$_rv)())`,r})),s.set("$__repeat",(function(n,s){let i="";if(Object(o["a"])("compileToken:$__repeat",s,2),!Object(r["d"])(s[0]))throw new Error("[SX] compileToken: $__repeat : args[0] is not symbol.");return l(()=>{const r="v"+t.varNamesCount++;t.varNames.set(s[0].symbol,r),i+=`(((_$_n)=>{let _$_rv=null;for(let ${r}=0;${r}<_$_n;${r}++){_$_rv=${n.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}return _$_rv})(${c(s,1)}))`}),i})),s.set("$__for",(function(n,s){let i="";if(Object(o["a"])("compileToken:$__for",s,2),!Object(r["d"])(s[0]))throw new Error("[SX] compileToken: $__for : args[0] is not symbol.");return l(()=>{const r="v"+t.varNamesCount++;t.varNames.set(s[0].symbol,r),i+=`(((_$_l)=>{let _$_rv=null;for(const ${r} of _$_l){_$_rv=${n.slice(2).map(t=>c([Object(a["e"])(e,t)],0)).join(",")}}return _$_rv})(${c(s,1)}))`}),i})),s.set("$__scope",(function(n,s){let i="";if(Object(o["a"])("compileToken:$__scope",s,2),!Array.isArray(n[3]))throw new Error("[SX] compileToken: $__scope : args[2] is not array.");return l(()=>{for(const s of Object(a["e"])(e,n[3])){let e="";if(Array.isArray(s)){if(s.length<1)throw new Error("[SX] compileToken: $__scope : args[0][?] is too short.");if(!Object(r["d"])(s[0]))throw new Error("[SX] compileToken: $__scope : args[0][?][0] is not symbol.");e=s[0].symbol,i+=`(${"v"+t.varNamesCount}=${c(s,1)})`}else{if(!Object(r["d"])(s))throw new Error("[SX] compileToken: $__scope : args[0][?] is not symbol.");e=s.symbol}t.varDefs+=`var v${t.varNamesCount}=void 0;`,t.varNames.set(e,"v"+t.varNamesCount++)}const o=""+n.slice(4).map(t=>c([Object(a["e"])(e,t)],0)).join(",");i+=n[2]?`[${o}]`:`(${o})`}),i})),s.set("$__try",(function(r,s){let i="";return Object(o["a"])("compileToken:$__try",s,1,2),i+=`((()=>{try{${c([Object(a["e"])(e,r[1])],0)}}catch(e${t.varNamesCount}){let e${t.varNamesCount+1}=(_$_vars[${String(t.varsCount)}])();`,n[t.varsCount++]=Object(a["c"])(e),l(()=>{t.varNames.set("$error","e"+t.varNamesCount++),t.varNames.set("$parent","e"+t.varNamesCount++),i+=c([Object(a["e"])(e,r[2])],0)+"}})())"}),i})),s.set(e.config.reservedNames.raise,(function(t,n){let r="";return r+=`((()=>{throw ${c([Object(a["f"])(e,t[1])],0)}})())`,r})),s.set("$boolean",(function(e,t){let n="";return Object(o["a"])("compileToken:$boolean",t,1,1),n+=`((x0=${c(t,0)}),(Array.isArray(x0)&&x0.length===0?false:boolean(x0)))`,n})),s.set("$__get",(function(s,l){let i="";Object(o["a"])("compileToken:$__get",l,1);const u=Object(a["e"])(e,s[1]),f=Object(r["d"])(u)?u.symbol:"string"===typeof u?u:null;if("string"!==typeof f)throw new Error(`[SX] compileToken: $__get : operand is not symbol: ${JSON.stringify(s[1])}.`);let m="";t.varNames.has(f)?m=t.varNames.get(f):(n[t.varsCount]=Object(a["d"])(e,f),m=`_$_vars[${String(t.varsCount++)}]`);const b=e=>(n[t.varsCount]=e,`_$_vars[${String(t.varsCount++)}]`);return i+=`((${m})${s.slice(2).map((e,t,n)=>`[${Object(r["d"])(n[t])?b(n[t].symbol):c(n,t)}]`).join("")})`,i})),s.set("$__let",(function(n,s){let l="";Object(o["a"])("compileToken:$__let",s,2,2);const i=Object(a["e"])(e,n[1]),u=Object(r["d"])(i)?i.symbol:"string"===typeof i?i:null;if("string"!==typeof u)throw new Error(`[SX] compileToken: $__let : operand is not rvalue: ${JSON.stringify(n[1])}.`);return t.varNames.has(u)||(t.varDefs+=`var v${t.varNamesCount}=void 0;`,t.varNames.set(u,"v"+t.varNamesCount++)),l+=`(${t.varNames.get(u)}=${c(n,2)})`,l})),s.set("$__set",(function(s,l){let i="";Object(o["a"])("compileToken:$__set",l,2);const u=Object(a["e"])(e,s[1]),f=Object(r["d"])(u)?u.symbol:"string"===typeof u?u:Array.isArray(u)?Object(r["d"])(u[0])?u[0].symbol:"string"===typeof u[0]?u[0]:null:null;if("string"!==typeof f)throw new Error(`[SX] compileToken: $__set : operand is not rvalue: ${JSON.stringify(s[1])}.`);let m="";t.varNames.has(f)?m=t.varNames.get(f):(n[t.varsCount]=Object(a["d"])(e,f),m=`_$_vars[${String(t.varsCount++)}]`);const b=e=>(n[t.varsCount]=Object(o["b"])("compileToken:$__set",e),`_$_vars[${String(t.varsCount++)}]`);let $=!1,p="";const _=e=>($||(n[t.varsCount]=Object(a["b"])("compileToken:$__set"),p=String(t.varsCount++),$=!0),`(_$_vars[${p}](${e}))`);return i+=`((${m})${(Array.isArray(u)?u.slice(1):[]).map((e,t,n)=>`[${Object(r["d"])(n[t])?b(n[t].symbol):_(c(n,t))}]`).join("")}=${c(s,2)})`,i})),s.set(e.config.reservedNames.not,(function(e,t){let n="";return Object(o["a"])("compileToken:$not",t,1,1),n+=`(!${c(t,0)})`,n})),s.set("$__and",(function(t,n){let r="";return Object(o["a"])("compileToken:$__and",n,1),r+=`(${n.map(t=>c([Object(a["e"])(e,t)],0)).join("&&")})`,r})),s.set("$__or",(function(t,n){let r="";return Object(o["a"])("compileToken:$__or",n,1),r+=`(${n.map(t=>c([Object(a["e"])(e,t)],0)).join("||")})`,r})),s.set("===",(function(e,t){let n="";return Object(o["a"])("compileToken:===",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("===")})`,n})),s.set("!==",(function(e,t){let n="";return Object(o["a"])("compileToken:!==",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("!==")})`,n})),s.set("==",(function(e,t){let n="";return Object(o["a"])("compileToken:==",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("==")})`,n})),s.set("!=",(function(e,t){let n="";return Object(o["a"])("compileToken:!=",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("!=")})`,n})),s.set("<",(function(e,t){let n="";return Object(o["a"])("compileToken:<",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("<")})`,n})),s.set("<=",(function(e,t){let n="";return Object(o["a"])("compileToken:<=",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("<=")})`,n})),s.set(">",(function(e,t){let n="";return Object(o["a"])("compileToken:>",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join(">")})`,n})),s.set(">=",(function(e,t){let n="";return Object(o["a"])("compileToken:<=",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join(">=")})`,n})),s.set("$concat",(function(t,n){let a="";Object(o["a"])("compileToken:$concat",n,1);let s="";if(Array.isArray(n[0])&&Object(r["d"])(n[0][0],e.config.reservedNames.spread)){const e=c(n[0],1);s=`(${e}[0]).concat((${e}.length>1?${e}[1]:(typeof ${e}[0]==='string'?'':[])),`}else s=c(n,0)+".concat(";return a+=`(${s}${n.slice(1).map((e,t,n)=>c(n,t)).join(",")}))`,a})),s.set("+",(function(t,n){let a="";Object(o["a"])("compileToken:+",n,1);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return _$_rv.reduce((x,y)=>x+y);})())`:`(${n.map((e,t,n)=>c(n,t)).join("+")})`,a})),s.set("-",(function(t,n){let a="";Object(o["a"])("compileToken:-",n,1);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return (_$_rv.length>1?(_$_rv.reduce((x,y)=>x-y)):(_$_rv.length>0?-_$_rv[0]:NaN));})())`:`(${t.length>2?n.map((e,t,n)=>c(n,t)).join("-"):`-(${String(c(t,1))})`})`,a})),s.set("*",(function(t,n){let a="";Object(o["a"])("compileToken:*",n,2);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return _$_rv.reduce((x,y)=>x*y);})())`:`(${n.map((e,t,n)=>c(n,t)).join("*")})`,a})),s.set("**",(function(t,n){let a="";Object(o["a"])("compileToken:**",n,2);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return _$_rv.reduce((x,y)=>x**y);})())`:`(${n.map((e,t,n)=>c(n,t)).join("**")})`,a})),s.set("/",(function(t,n){let a="";Object(o["a"])("compileToken:/",n,2);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return _$_rv.reduce((x,y)=>x/y);})())`:`(${n.map((e,t,n)=>c(n,t)).join("/")})`,a})),s.set("%",(function(t,n){let a="";Object(o["a"])("compileToken:%",n,2);let s=!1;return n.map((t,n,o)=>{Array.isArray(t)&&Object(r["d"])(t[0],e.config.reservedNames.spread)&&(s=!0)}),a+=s?`((()=>{let _$_rv=[];${n.map((e,t,n)=>`_$_rv.push(${c(n,t)})`).join(";")};return _$_rv.reduce((x,y)=>x%y);})())`:`(${n.map((e,t,n)=>c(n,t)).join("%")})`,a})),s.set("<<",(function(e,t){let n="";return Object(o["a"])("compileToken:<<",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("<<")})`,n})),s.set(">>",(function(e,t){let n="";return Object(o["a"])("compileToken:>>",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join(">>")})`,n})),s.set(">>>",(function(e,t){let n="";return Object(o["a"])("compileToken:>>>",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join(">>>")})`,n})),s.set("$bit-not",(function(e,t){let n="";return Object(o["a"])("compileToken:$bit-not",t,1,1),n+=`(~(${c(e,1)}))`,n})),s.set("$bit-and",(function(e,t){let n="";return Object(o["a"])("compileToken:$bit-and",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("&")})`,n})),s.set("$bit-or",(function(e,t){let n="";return Object(o["a"])("compileToken:$bit-or",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("|")})`,n})),s.set("$bit-xor",(function(e,t){let n="";return Object(o["a"])("compileToken:$bit-xor",t,2,2),n+=`(${t.map((e,t,n)=>c(n,t)).join("^")})`,n}))}},f587:function(e,t,n){"use strict";n.r(t),n.d(t,"FatalError",(function(){return r["a"]})),n.d(t,"MaxEvaluationCountError",(function(){return r["b"]})),n.d(t,"ScriptTerminationError",(function(){return r["c"]})),n.d(t,"quote",(function(){return o["f"]})),n.d(t,"isQuoted",(function(){return o["c"]})),n.d(t,"backquote",(function(){return o["a"]})),n.d(t,"isBackquoted",(function(){return o["b"]})),n.d(t,"wrapByUnquote",(function(){return o["i"]})),n.d(t,"isUnquoted",(function(){return o["e"]})),n.d(t,"spread",(function(){return o["h"]})),n.d(t,"splice",(function(){return o["g"]})),n.d(t,"isSymbol",(function(){return o["d"]})),n.d(t,"defaultReservedNames",(function(){return a})),n.d(t,"defaultConfig",(function(){return s})),n.d(t,"SExpression",(function(){return T})),n.d(t,"SExpressionAsync",(function(){return X})),n.d(t,"S",(function(){return x})),n.d(t,"L",(function(){return Qn})),n.d(t,"LS",(function(){return Zn})),n.d(t,"lisp",(function(){return er})),n.d(t,"L_async",(function(){return tr})),n.d(t,"LS_async",(function(){return nr})),n.d(t,"lisp_async",(function(){return rr})),n.d(t,"LM",(function(){return or})),n.d(t,"LM_async",(function(){return ar})),n.d(t,"LSX",(function(){return gr})),n.d(t,"LSX_async",(function(){return jr})),n.d(t,"runScriptTags",(function(){return Or})),n.d(t,"installCore",(function(){return St})),n.d(t,"installArithmetic",(function(){return Zt})),n.d(t,"installSequence",(function(){return Dn})),n.d(t,"installJsx",(function(){return yr})),n.d(t,"installConcurrent",(function(){return Yn})),n.d(t,"builtinOperators",(function(){return hr})),n.d(t,"builtinMacros",(function(){return vr})),n.d(t,"builtinSymbols",(function(){return wr}));var r=n("c541"),o=n("27e2");const a={eval:"$eval",quote:"$quote",backquote:"$backquote",unquote:"$unquote",spread:"$spread",splice:"$splice",car:"$car",cdr:"$cdr",cons:"$cons",atom:"$atom",eq:"$eq",list:"$list",let:"$clisp-let",lambda:"$lambda",self:"$self",defun:"$defun",thiz:"$this",if:"$if",cond:"$cond",while:"$while",doWhile:"$do-while",until:"$until",doUntil:"$do-until",get:"$get",defvar:"$clisp-defvar",setq:"$clisp-setq",set:"$set",call:"$call",not:"$not",and:"$and",or:"$or",isSymbol:"$is-symbol",gensym:"$gensym",raise:"$raise",catch:"$catch",Template:"Template"},s={raiseOnUnresolvedSymbol:!1,enableEvaluate:!0,enableHereDoc:!0,enableSpread:!0,enableSplice:!0,enableShorthands:!0,enableVerbatimStringLiteral:!0,enableTailCallOptimization:!0,enableRegExpMatchOperators:!0,enableCompilationOperators:!0,stripComments:!1,wrapExternalValue:!0,returnMultipleRoot:!1,maxEvalCount:0,reservedNames:a,symbols:[],macros:[],funcs:[]};function l(e){return"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,"eof")}function c(e){return"string"===typeof e&&0===e.trim().length}function i(e){return"string"===typeof e&&/^[0-9\+\-]$/.test(e)}function u(e){return"string"===typeof e&&/^[0-9]$/.test(e)}function f(e){return"string"===typeof e&&!c(e)&&!i(e)}function m(e){return`line: ${e.line} / strings: ${e.index} / pos: ${e.pos} :${e.strings.length>e.index?e.strings[e.index].slice(e.pos,e.pos+20):""}`}function b(e,t,n){if(e.strings.length<=e.index)return{eof:!0};if(e.strings[e.index].length<=e.pos){if(!e.values||e.values.length<=e.index)return e.pos=0,e.index++,b(e);{const t={value:e.values[e.index]};return e.pos=0,e.index++,t}}if(t)for(const r of t){const t=e.strings[e.index].slice(e.pos,e.pos+r.length);if(t===r)return e.pos+=r.length,e.line+=t.split("\n").length-1,{eof:!1,eofSeq:r}}{let t=e.strings[e.index].slice(e.pos,e.pos+1);if(e.pos++,"\n"===t&&e.line++,!n&&"\\"===t){if(e.strings[e.index].length<=e.pos)throw new Error(`[SX] getChar: Invalid syntax at: ${m(e)}.`);switch(t=e.strings[e.index].slice(e.pos,e.pos+1),e.pos++,t){case"b":t="\b";break;case"t":t="\t";break;case"n":t="\n";break;case"v":t="\v";break;case"f":t="\f";break;case"r":t="\r";break;case"U":case"u":if("{"===e.strings[e.index].slice(e.pos,e.pos+1)){let n="";for(let t=0;t<6;t++){const r=e.strings[e.index].slice(e.pos+t,e.pos+1+t);if("}"===r){if(0===t)throw new Error(`[SX] getChar: Invalid syntax at: ${m(e)}.`);e.pos+=t;break}if(!/^[0-9A-Fa-f]{1}$/.test(n))throw new Error(`[SX] getChar: Invalid syntax at: ${m(e)}.`);n+=r}if("}"!==e.strings[e.index].slice(e.pos,e.pos+1))throw new Error(`[SX] getChar: Invalid syntax at: ${m(e)}.`);e.pos++,t=String.fromCodePoint(Number.parseInt(n,16))}else{const n=e.strings[e.index].slice(e.pos,e.pos+4);if(!/^[0-9A-Fa-f]{4}$/.test(n))throw new Error(`[SX] getChar: Invalid syntax at: ${m(e)}.`);e.pos+=4,t=String.fromCodePoint(Number.parseInt(n,16))}break}}return t}}function $(e,t,n,r){const o=e.index,a=e.pos,s=e.line,l=[];try{for(let o=0;o<t;o++)l.push(b(e,n,r))}finally{e.index=o,e.pos=a,e.line=s}return l}function p(e,t,n){const r=e.index,o=e.pos,a=e.line;let s;try{s=b(e,t,n)}finally{e.index=r,e.pos=o,e.line=a}return s}function _(e){let t=p(e);while(!l(t)&&c(t))b(e),t=p(e)}function d(e,t){let n="",r=p(e,t);while(!l(r)){if("string"!==typeof r)break;if(/^0[XxOoBb][0-9]*$/.test(n+r))b(e,t),n+=r;else{if(!/^[0-9\+\-\.EeInfinityNaN]+$/.test(n+r))break;b(e,t),n+=r}r=p(e,t)}if(!/^([\+\-]?\d*\.?\d+(?:[Ee][\+\-]?\d+)?)|(0[XxOoBb][0-9]+)|([\+\-]Infinity)|(NaN)$/.test(n))throw new Error(`[SX] parseNumber: Invalid syntax at: ${m(e)}.`);return Number(n)}function y(e,t){let n="",r=p(e,t);while(!l(r)){if("string"===typeof r){if(c(r))break;if("#"===r&&"|"===$(e,2,t)[1])break;if(!/^[^.;()"]+$/.test(n+r))break;b(e,t),n+=r}else{if("object"!==typeof r||!Object.prototype.hasOwnProperty.call(r,"value"))throw new Error(`[SX] parseSymbol: Invalid syntax at: ${m(e)}.`);b(e,t);r.value;n+=String(r)}r=p(e,t)}if(e.config.enableShorthands){let t=null;if(t=n.match(/^:((?:\:[^=:]+?)+?)=$/)){const n=t[1].slice(1).split(":"),r=[{symbol:e.config.reservedNames.splice},[{symbol:e.config.reservedNames.set},n]];return r}if(t=n.match(/^:((?:\:[^@:]+?)+?)@([^@:]+?)$/)){const n=t[1].slice(1).split(":"),r=[{symbol:e.config.reservedNames.splice},[{symbol:e.config.reservedNames.call},[{symbol:e.config.reservedNames.get},...n],{symbol:t[2]}]];return r}if(t=n.match(/^:((?:\:[^:]+?)+?)$/)){const n=t[1].slice(1).split(":"),r=[{symbol:e.config.reservedNames.get},...n];return r}}return{symbol:n}}function g(e,t,n,o,a,s){const c=n?[...t,n]:t,i=[],u=[];for(;;){let t="",f=p(e,c,a);while(!l(f)){if("string"===typeof f)b(e,c,a),t+=f;else{if("object"!==typeof f||!Object.prototype.hasOwnProperty.call(f,"value"))throw new Error(`[SX] parseStringOrComment: Invalid syntax at: ${m(e)}.`);b(e,c,a);f.value;t+=String(f)}f=p(e,c,a)}if(b(e,c,a),!0===f.eof&&!s)throw new r["c"]("parseStringOrComment");if(i.push(t),f.eofSeq!==n)break;u.push(S(e,o,[]))}return{strings:i,values:u}}function j(e,t){return g(e,['"'],null,")",t,!1).strings[0]}function O(e,t,n){const r=[t];n&&r.push(n);const o=g(e,['"""'],"%%%(",")",!1,!1);for(let a=0;a<o.strings.length;a++)r.push(o.strings[a]),a<o.values.length&&r.push(o.values[a]);return r}function h(e){return{comment:g(e,["\r","\n"],null,")",!1,!0).strings[0]}}function v(e){return{comment:g(e,["|#"],null,")",!1,!1).strings[0]}}function w(e){_(e);let t=p(e);while(!l(t)){switch(t){case")":throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`);case"(":return b(e),S(e,")",[]);case"'":case"`":case",":{b(e);const n=p(e);let r=!1;","===t&&"@"===n&&(b(e),r=!0),_(e);const a=("'"===t?o["f"]:"`"===t?o["a"]:o["i"])(e,w(e));return r?Object(o["g"])(e,a):a}case".":{b(e);const t=$(e,2);return e.config.enableSpread&&"."===t[0]&&"."===t[1]?(b(e),b(e),_(e),Object(o["h"])(e,w(e))):(_(e),{dotted:w(e)})}case";":return b(e),h(e);case"#":{const t=$(e,2);return"|"===t[1]?(b(e),b(e),v(e)):y(e)}case'"':{b(e);const t=$(e,4);if(e.config.enableHereDoc&&'"'===t[0]&&'"'===t[1]){let n=!0;l(t[2])||c(t[2])||(i(t[2])?"+"!==t[2]&&"-"!==t[2]||u(t[3])||(n=!1):f(t[2])&&(n=!1)),b(e),b(e);let r=null,o=null;if(n)r={symbol:e.config.reservedNames.Template};else{if(r=y(e,["@"]),null===r)throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`);if("number"===typeof r)throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`);const t=$(e,2);if("@"===t[0]){if("{"!==t[1])throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`);b(e),b(e);const n=S(e,"}",[{symbol:"@"}]);Array.isArray(n)&&(o=n)}}return O(e,r,o)}return j(e,!1)}case"@":if(e.config.enableVerbatimStringLiteral){const t=$(e,2);if('"'===t[1])return b(e),b(e),j(e,!0)}default:if("string"!==typeof t){if("object"===typeof t&&Object.prototype.hasOwnProperty.call(t,"value"))return b(e),e.config.wrapExternalValue?t:t.value;throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`)}if(c(t))break;if(i(t)){if("+"===t||"-"===t){const t=$(e,2);if(!u(t[1]))return y(e)}return d(e)}if(f(t))return y(e);throw new Error(`[SX] parseOneToken: Invalid syntax at: ${m(e)}.`)}_(e),t=p(e)}throw new r["c"]("parseOneToken")}function S(e,t,n){const o=n.slice(0);let a=!1;_(e);let s=p(e);while(!l(s)){switch(s){case t:return b(e),a?o[0]:o;default:{const t=w(e);if("object"===typeof t&&Object.prototype.hasOwnProperty.call(t,"dotted")){if(1!==o.length)throw new Error(`[SX] parseList: Invalid syntax at: ${m(e)}.`);a=!0,Array.isArray(t)?(t.unshift(o.pop()),o.push(t)):o.push({car:o.pop(),cdr:t.dotted})}else if("object"===typeof t&&Object.prototype.hasOwnProperty.call(t,"comment"))e.config.stripComments||o.push(t);else{if(a)throw new Error(`[SX] parseList: Invalid syntax at: ${m(e)}.`);o.push(t)}}break}_(e),s=p(e)}throw new r["c"]("parseList")}function A(e){const t=[];_(e);let n=p(e);while(!l(n)){switch(n){case"(":b(e),t.push(S(e,")",[]));break;case"'":case"`":for(b(e),_(e);;){const r=w(e);if("object"!==typeof r||!Object.prototype.hasOwnProperty.call(r,"comment")){t.push(("'"===n?o["f"]:o["a"])(e,r));break}e.config.stripComments||t.push(r)}break;case";":b(e),e.config.stripComments?h(e):t.push(h(e));break;case"#":{const n=$(e,2);"|"===n[1]?(b(e),b(e),e.config.stripComments?v(e):t.push(v(e))):(b(e),e.config.stripComments?h(e):t.push(h(e)))}break;case'"':{const n=$(e,3);if('"'===n[1]&&'"'===n[2]){t.push(w(e));break}}default:throw new Error(`[SX] parseInitialState: Invalid syntax at: ${m(e)}.`)}_(e),n=p(e)}return t}var E=n("43fb"),N=function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function s(e){try{c(r.next(e))}catch(t){a(t)}}function l(e){try{c(r["throw"](e))}catch(t){a(t)}}function c(e){e.done?n(e.value):o(e.value).then(s,l)}c((r=r.apply(e,t||[])).next())}))};function I(e,t,n,r){return{strings:"string"===typeof n?[n]:n,values:r||[],index:0,pos:0,line:0,evalCount:0,scopes:[{isBlockLocal:!1,scope:t}],macroMap:new Map(e.macros.map(e=>[e.name,e])),funcMap:new Map(e.funcs.map(e=>[e.name,e])),symbolMap:new Map(e.symbols.map(e=>[e.name,e])),config:e}}function k(e,t,n){return e.strings="string"===typeof t?[t]:t,e.values=n||[],e.index=0,e.pos=0,e.line=0,e.evalCount=0,e}function T(e){let t=e||Object.assign({},s),n={},r=[];const o=(e,n)=>{if(t.enableEvaluate)for(let t=0;t<n.length;t++)n[t]=Object(E["b"])(e,n[t]);return t.returnMultipleRoot?1===n.length?n[0]:n:n[n.length-1]},a=(e,...a)=>{const s=I(t,Object.assign({},n),e,a);return o(s,r.concat(A(s)))};return a.evaluateAST=e=>{const a=I(t,Object.assign({},n),"");return o(a,r.concat(e))},a.repl=()=>{const e=I(t,Object.assign({},n),"");o(e,r.slice(0));const a=(t,...n)=>(k(e,t,n),o(e,A(e)));return a.sync=a,a},a.setGlobals=e=>(n=Object.assign({},e||{}),a),a.appendGlobals=e=>(n=Object.assign({},n,e||{}),a),a.setStartup=(e,...o)=>{const s=I(t,Object.assign({},n),e,o);return r=A(s),a},a.setStartupAST=e=>(r=e,a),a.appendStartup=(e,...o)=>{const s=I(t,Object.assign({},n),e,o);return r=r.concat(A(s)),a},a.appendStartupAST=e=>(r=r.concat(e),a),a.install=e=>(t=e(t),a),a}function X(e){let t=e||Object.assign({},s),n={},r=[];const o=(e,n)=>N(this,void 0,void 0,(function*(){if(t.enableEvaluate)for(let t=0;t<n.length;t++)n[t]=Object(E["b"])(e,n[t]),"object"===typeof n[t]&&null!==n[t]&&"function"===typeof n[t].then&&(n[t]=yield n[t]);return t.returnMultipleRoot?1===n.length?n[0]:n:n[n.length-1]})),a=(e,...a)=>N(this,void 0,void 0,(function*(){const s=I(t,Object.assign({},n),e,a);return o(s,r.concat(A(s)))}));return a.evaluateAST=e=>{const a=I(t,Object.assign({},n),"");return o(a,r.concat(e))},a.repl=()=>{const e=(e,n)=>{if(t.enableEvaluate)for(let t=0;t<n.length;t++)n[t]=Object(E["b"])(e,n[t]);return t.returnMultipleRoot?1===n.length?n[0]:n:n[n.length-1]},a=I(t,Object.assign({},n),"");o(a,r.slice(0));const s=(e,...t)=>N(this,void 0,void 0,(function*(){return k(a,e,t),o(a,A(a))})),l=(t,...n)=>(k(a,t,n),e(a,A(a)));return s.sync=l,s},a.setGlobals=e=>(n=Object.assign({},e||{}),a),a.appendGlobals=e=>(n=Object.assign({},n,e||{}),a),a.setStartup=(e,...o)=>{const s=I(t,Object.assign({},n),e,o);return r=A(s),a},a.setStartupAST=e=>(r=e,a),a.appendStartup=(e,...o)=>{const s=I(t,Object.assign({},n),e,o);return r=r.concat(A(s)),a},a.appendStartupAST=e=>(r=r.concat(e),a),a.install=e=>(t=e(t),a),a}const x=(()=>{const e=Object.assign({},s);return e.enableEvaluate=!1,e.returnMultipleRoot=!0,T(e)})();var C=n("6921"),M=n("7941"),P=n("6977");const D=(e,t)=>(...e)=>{Object(P["a"])("$car",e,1,1);const t=R(...e);if(!Array.isArray(t))throw new Error("[SX] $car: Invalid argument(s): args[0] is not array.");if(0===t.length)throw new Error("[SX] $car: Invalid argument(s): args[0] is nil.");return t[0]},L=(D(null,null),(e,t)=>(...e)=>{Object(P["a"])("$cdr",e,1,1);const t=R(...e);if(!Array.isArray(t))throw new Error("[SX] $cdr: Invalid argument(s): args[0] is not array.");if(0===t.length)throw new Error("[SX] $cdr: Invalid argument(s): args[0] is nil.");return t.slice(1)}),q=(L(null,null),(e,t)=>(...e)=>{Object(P["a"])("$cons",e,2,2);let{car:t,cdr:n}=G(...e);return null===t&&(t=[]),null===n&&(n=[]),Array.isArray(n)?(n=n.slice(0),n.unshift(t),n):{car:t,cdr:n}}),U=(q(null,null),(e,t)=>(...e)=>{const t=e.slice(0,1);return 1===t.length?t[0]:null}),R=U(null,null),F=(e,t)=>(...e)=>{const t=e.slice(1,2);return 1===t.length?t[0]:null},B=F(null,null),W=(e,t)=>(...e)=>{const t=e.slice(e.length-1,e.length);return 1===t.length?t[0]:null},K=(W(null,null),(e,t)=>(...e)=>{const t=e.slice(1);return 0<t.length?t:null}),V=(K(null,null),(e,t)=>(...e)=>{let t=e.slice(0,1);t=1===t.length?t[0]:null;let n=e.slice(1,2);return n=1===n.length?n[0]:null,{car:t,cdr:n}}),G=V(null,null),J=(e,t)=>(...e)=>{Object(P["a"])("$atom",e,1,1);const t=R(...e);if(null===t||void 0===t)return!0;if(Array.isArray(t))return 0===t.length;switch(typeof t){case"number":case"string":case"function":case"boolean":return!0;case"object":return!!Object(o["d"])(t)}return!1},H=(J(null,null),(e,t)=>(...e)=>{Object(P["a"])("$eq",e,2,2);const{car:t,cdr:n}=G(...e);return t===n}),z=(H(null,null),(e,t)=>(...e)=>{Object(P["a"])("$notEq",e,2,2);const{car:t,cdr:n}=G(...e);return t!==n}),Y=(z(null,null),(e,t)=>(...e)=>e.slice(0)),Q=(Y(null,null),(e,t,n)=>(...t)=>{Object(P["a"])("$__scope",t,3);const r=R(...t),a=B(...t),{car:s,cdr:l}=G(...t.slice(2));let c=null;const i={};if(Array.isArray(s))for(const n of s)if(Array.isArray(n)){const t=G(...n),r=Object(o["d"])(t.car),a=r?r.symbol:String(t.car);Object(P["c"])("$__scope",i,a),i[a]=Object(E["b"])(e,t.cdr)}else{const e=Object(o["d"])(n),t=e?e.symbol:String(n);Object(P["c"])("$__scope",i,t),i[t]=null}Object(E["f"])(e,i,r,n);try{if(4<t.length)if(a){c=[];for(const n of t.slice(3))c.push(Object(E["b"])(e,n))}else for(const n of t.slice(3))c=Object(E["b"])(e,n);else c=Object(E["b"])(e,l)}finally{Object(E["m"])(e)}return c}),Z=(e,t)=>(...t)=>{Object(P["a"])("$__globalScope",t,1);const n=R(...t),r=B(...t);let o=null;Object(E["f"])(e,Object(E["d"])(e).scope,!0);try{if(2<t.length)if(n){o=[];for(const n of t.slice(1))o.push(Object(E["b"])(e,n))}else for(const n of t.slice(1))o=Object(E["b"])(e,n);else o=Object(E["b"])(e,r)}finally{Object(E["m"])(e)}return o},ee=(e,t)=>(...t)=>{Object(P["a"])("$__capture",t,1);const n=t[0];if(!Array.isArray(n))throw new Error("[SX] $__lambda: Invalid argument(s): args[0] is not array.");let r=null;const o=Object(E["a"])(e,n);Object(E["f"])(e,{},!0,o);try{for(const n of t.slice(1))r=Object(E["b"])(e,n)}finally{Object(E["m"])(e)}return r},te=(e,t)=>(...n)=>{Object(P["a"])("$__lambda",n,2);const r=n[0];if(!Array.isArray(r))throw new Error("[SX] $__lambda: Invalid argument(s): args[0] is not array.");let a=!1;for(let t=0;t<r.length;t++){const n=r[t];if(t===r.length-1&&e.config.enableSpread&&Array.isArray(n)&&Object(o["d"])(n[0],e.config.reservedNames.spread)){if(!Object(o["d"])(n[1]))throw new Error(`[SX] $__lambda: Invalid formal argument(s): item(s) of args[${t}] is not symbol.`);r[t]=n[1],a=!0}else if(!Object(o["d"])(n))throw new Error(`[SX] $__lambda: Invalid formal argument(s): item(s) of args[${t}] is not symbol.`)}let s=n.slice(1);e.config.enableTailCallOptimization&&(s=Object(E["g"])(e,r,s));const l=Object(E["c"])(e),c=function(...n){if(n.length+(a?1:0)<r.length)throw new Error(`[SX] func call: Actual args too short: actual ${n.length} / formal ${r.length}.`);return Q(e,t,l)(!1,!1,[[e.config.reservedNames.self,c],[e.config.reservedNames.thiz,this===C["a"]||void 0===this?null:Object(o["f"])(e,this)],...r.map((t,s)=>[t.symbol,Object(o["f"])(e,a&&s===r.length-1?n.slice(s):n[s])])],...s)};return c},ne=(e,t)=>(...t)=>{Object(P["a"])("$$__lambda",t,2);const n=t[0];if(!Array.isArray(n))throw new Error("[SX] $$__lambda: Invalid argument(s): args[0] is not array.");let r=!1;for(let s=0;s<n.length;s++){const t=n[s];if(s===n.length-1&&e.config.enableSpread&&Array.isArray(t)&&Object(o["d"])(t[0],e.config.reservedNames.spread)){if(!Object(o["d"])(t[1]))throw new Error(`[SX] $$__lambda: Invalid formal argument(s): item(s) of args[${s}] is not symbol.`);n[s]=t[1],r=!0}else if(!Object(o["d"])(t))throw new Error(`[SX] $$__lambda: Invalid formal argument(s): item(s) of args[${s}] is not symbol.`)}const a=t.slice(1);return Object(M["a"])(e,n,r,a)},re=(e,t)=>(...n)=>{Object(P["a"])("$__defun",n,3);const r=R(...n),o=te(e,t)(...n.slice(1));return Object(P["c"])("$__defun",e.funcMap,r.symbol),e.funcMap.set(r.symbol,{name:r.symbol,fn:(e,t)=>o}),o},oe=(e,t)=>(...n)=>{Object(P["a"])("$$__defun",n,3);const r=R(...n),o=ne(e,t)(...n.slice(1));return Object(P["c"])("$$__defun",e.funcMap,r.symbol),e.funcMap.set(r.symbol,{name:r.symbol,fn:(e,t)=>o}),o},ae=(e,t)=>(...t)=>{Object(P["a"])("$__refun",t,1,1);const n=R(...t);Object(P["c"])("$__refun",e.funcMap,n.symbol);const r=e.funcMap.get(n.symbol);if(!r)throw new Error(`[SX] $__refun: function ${n.symbol} is not defined.`);return r.fn(e,n.symbol)},se=(e,t)=>(...n)=>{Object(P["a"])("$__defmacro",n,3);const r=R(...n),a=n[1];if(!Array.isArray(a))throw new Error("[SX] $__defmacro: Invalid argument(s): args[1] is not array.");let s=!1;for(let t=0;t<a.length;t++){const n=a[t];if(t===a.length-1&&e.config.enableSpread&&Array.isArray(n)&&Object(o["d"])(n[0],e.config.reservedNames.spread)){if(!Object(o["d"])(n[1]))throw new Error(`[SX] $__defmacro: Invalid formal argument(s): item(s) of args[${t}] is not symbol.`);a[t]=n[1],s=!0}else if(!Object(o["d"])(n))throw new Error(`[SX] $__defmacro: Invalid formal argument(s): item(s) of args[${t}] is not symbol.`)}const l=n.slice(2),c=Object(E["c"])(e),i=n=>(...r)=>Q(e,t,c)(!1,!1,[[e.config.reservedNames.self,i],...n.map((t,a)=>[t.symbol,Object(o["f"])(e,s&&a===n.length-1?r.slice(a):r[a])])],...l),u={name:r.symbol,fn:(e,t,n)=>e=>i(n)(...e.slice(1)),formalArgs:a,lastIsSpread:s};if(Object(P["c"])("$__defmacro",e.macroMap,r.symbol),e.macroMap.has(r.symbol)){let t=e.macroMap.get(r.symbol);if(t.next=u,t&&t.formalArgs)if(t.formalArgs.length<a.length)e.macroMap.set(r.symbol,u),u.next=t;else{let e=t;t=t.next;while(t){if(t.formalArgs&&t.formalArgs.length<a.length){e.next=u,u.next=t;break}e=t,t=t.next}}}else e.macroMap.set(r.symbol,u);return i},le=(e,t)=>(...e)=>{Object(P["a"])("$apply",e,1);const t=R(...e);if("function"!==typeof t)throw new Error("[SX] $apply: Invalid argument(s): args[0] is not function.");return(...n)=>t.apply(null,e.slice(1).concat(n))},ce=(le(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__call",t,2);const{car:n,cdr:r}=G(...t),a=Object(o["d"])(r),s=a?a.symbol:Object(E["b"])(e,r);return Object(P["c"])("$__call",n,s),Function.prototype.apply.call(n[s],n,t.slice(2))}),ie=(e,t)=>(...n)=>{Object(P["a"])("$__try",n,1,2);let a=[];try{a=Object(E["b"])(e,n[0])}catch(s){if(s instanceof r["a"])throw s;a=1<n.length?Q(e,t)(!0,!1,[["$error",Object(o["f"])(e,s)],["$parent",Object(o["f"])(e,Object(E["e"])(e))]],n[1]):null}return a},ue=(e,t)=>(...e)=>{const t=R(...e);throw t},fe=(ue(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__if",t,2,3);const n=R(...t);let r=[];return r=Se(n)?Object(E["b"])(e,t[1]):2<t.length?Object(E["b"])(e,t[2]):null,r}),me=(e,t)=>(...t)=>{Object(P["a"])("$__ifNull",t,2,2);const{car:n,cdr:r}=G(...t);let o=[];return o=Te(n,null)?Object(E["b"])(e,r):n,o},be=(e,t)=>(...t)=>{Object(P["a"])("$__cond",t,1);for(let n=0;n<t.length-1;n+=2){const r=t[n],o=t[n+1];if(Se(Object(E["b"])(e,r)))return Object(E["b"])(e,o)}return null},$e=(e,t)=>(...t)=>{Object(P["a"])("$__while",t,1);const n=R(...t),r=t.slice(1);let o=null;while(Se(Object(E["b"])(e,n)))for(const t of r)o=Object(E["b"])(e,t);return o},pe=(e,t)=>(...t)=>{Object(P["a"])("$__doWhile",t,1);const n=R(...t),r=t.slice(1);let o=null;do{for(const t of r)o=Object(E["b"])(e,t)}while(Se(Object(E["b"])(e,n)));return o},_e=(e,t)=>(...t)=>{Object(P["a"])("$__until",t,1);const n=R(...t),r=t.slice(1);let o=null;while(Ee(Object(E["b"])(e,n)))for(const t of r)o=Object(E["b"])(e,t);return o},de=(e,t)=>(...t)=>{Object(P["a"])("$__doUntil",t,1);const n=R(...t),r=t.slice(1);let o=null;do{for(const t of r)o=Object(E["b"])(e,t)}while(Ee(Object(E["b"])(e,n)));return o},ye=(e,t)=>(...t)=>{Object(P["a"])("$__repeat",t,2);const n=Object(o["d"])(R(...t));if(!n)throw new Error("[SX] $__repeat: Invalid argument(s): item(s) of args[0] is not symbol.");Object(P["c"])("$__repeat",{},n.symbol);const r=Object(E["k"])(e,n,!1),a=Object(E["l"])(B(...t)),s=t.slice(2);let l=null;for(let o=0;o<a;o++){r[n.symbol]=o;for(const t of s)l=Object(E["b"])(e,t)}return l},ge=(e,t)=>(...t)=>{Object(P["a"])("$__for",t,2);const n=Object(o["d"])(R(...t));if(!n)throw new Error("[SX] $__for: Invalid argument(s): item(s) of args[0] is not symbol.");Object(P["c"])("$__for",{},n.symbol);const r=Object(E["k"])(e,n,!1),a=B(...t);if(!Array.isArray(a))throw new Error("[SX] $__for: Invalid argument(s): item(s) of args[1] is not array.");const s=t.slice(2);let l=null;for(const o of a){r[n.symbol]=o;for(const t of s)l=Object(E["b"])(e,t)}return l},je=(e,t)=>(...e)=>{Object(P["a"])("$pipe",e,1);let t=e[0];for(let n=1;n<e.length;n++)t=e[n](t);return t},Oe=(je(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__get",t,1);let n=null,r=Object(o["d"])(t[0]);if(!r)switch(typeof t[0]){case"string":case"number":r={symbol:String(t[0])};break;default:n=Object(E["b"])(e,t[0]);break}if(r){const t=Object(E["k"])(e,r,!0);if(!t)throw new Error(`[SX] $__get: Invalid argument(s): args[0]: symbol "${r.symbol}" is not defined.`);n=t[r.symbol]}for(let a=1;a<t.length;a++){let s=t[a],l=!0;while(l)switch(typeof s){case"function":n=s(n),l=!1;break;case"object":if(Array.isArray(s))s=Object(E["b"])(e,s);else if(r=Object(o["d"])(s),r)s=r.symbol;else{if(!Object.prototype.hasOwnProperty.call(s,"value"))throw new Error("[SX] $__get: Invalid argument(s): invalid name path.");s=Object(E["b"])(e,s)}break;case"number":s<0&&(s=n.length+s);case"string":Object(P["c"])("$__get",n,s),n=n[s],l=!1;break;default:throw new Error("[SX] $__get: Invalid argument(s): invalid name path.")}}return n}),he=(e,t)=>(...t)=>{Object(P["a"])("$__let",t,2,2);let n=Object(o["d"])(R(...t));if(!n){if("string"!==typeof t[0])throw new Error("[SX] $__let: Invalid argument(s): invalid name.");n={symbol:t[0]}}Object(P["c"])("$__let",{},n.symbol);const r=Object(E["k"])(e,n,!1);return r[n.symbol]=t[1],t[1]},ve=(e,t)=>(...t)=>{Object(P["a"])("$__set",t,2,2);let n=[];Array.isArray(t[0])?n=t[0]:n.push(t[0]);let r=Object(o["d"])(n[0]);if(!r){if("string"!==typeof n[0])throw new Error("[SX] $__set: Invalid argument(s): invalid name.");Object(P["c"])("$__set",{},n[0]),r={symbol:n[0]}}let a=Object(E["k"])(e,r,!0);if(null===a)throw new Error(`[SX] $__set: Unresolved symbol: ${r.symbol}.`);let s=!1;for(let l=0;l<n.length;l++){let c=n[l],i=!0;const u=l===n.length-1;while(i)switch(typeof c){case"function":a=c(a),i=!1;break;case"object":if(Array.isArray(c))c=Object(E["b"])(e,c);else if(r=Object(o["d"])(c),r)c=r.symbol;else{if(!Object.prototype.hasOwnProperty.call(c,"value"))throw new Error("[SX] $__set: Invalid argument(s): invalid name.");c=Object(E["b"])(e,c)}break;case"number":c<0&&(c=a.length+c);case"string":Object(P["c"])("$__set",a,c),u?(a[c]=t[1],s=!0):a=a[c],i=!1;break;default:throw new Error("[SX] $__set: Invalid argument(s): invalid name.")}}if(!s)throw new Error("[SX] $__set: Invalid argument(s): last path is not lvalue.");return t[1]},we=(e,t)=>(...e)=>{Object(P["a"])("$boolean",e,1,1);const t=R(...e);return(!Array.isArray(t)||0!==t.length)&&Boolean(t)},Se=we(null,null),Ae=(e,t)=>(...e)=>(Object(P["a"])("$not",e,1,1),!Se(...e)),Ee=Ae(null,null),Ne=(e,t)=>(...t)=>{Object(P["a"])("$__and",t,1);let n=null;for(let r=0;r<t.length;r++){const o=Object(E["b"])(e,t[r]);if(!Se(o))return o;n=o}return n},Ie=(Ne(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__or",t,1);let n=null;for(let r=0;r<t.length;r++){const o=Object(E["b"])(e,t[r]);if(Se(o))return o;n=o}return n}),ke=(Ie(null,null),(e,t)=>(...e)=>{Object(P["a"])("$ambiguousEq",e,2,2);let{car:t,cdr:n}=G(...e);return Array.isArray(t)&&0===t.length&&(t=null),Array.isArray(n)&&0===n.length&&(n=null),void 0===t&&(t=null),void 0===n&&(n=null),t==n}),Te=ke(null,null),Xe=(e,t)=>(...e)=>!Te(...e),xe=(Xe(null,null),(e,t)=>(...e)=>{Object(P["a"])("$lt",e,2,2);const{car:t,cdr:n}=G(...e);return Object(E["l"])(t)<Object(E["l"])(n)}),Ce=(xe(null,null),(e,t)=>(...e)=>{Object(P["a"])("$le",e,2,2);const{car:t,cdr:n}=G(...e);return Object(E["l"])(t)<=Object(E["l"])(n)}),Me=(Ce(null,null),(e,t)=>(...e)=>{Object(P["a"])("$gt",e,2,2);const{car:t,cdr:n}=G(...e);return Object(E["l"])(t)>Object(E["l"])(n)}),Pe=(Me(null,null),(e,t)=>(...e)=>{Object(P["a"])("$ge",e,2,2);const{car:t,cdr:n}=G(...e);return Object(E["l"])(t)>=Object(E["l"])(n)}),De=(Pe(null,null),(e,t)=>(...e)=>{Object(P["a"])("$typeof",e,1,1);const t=R(...e);if(null===t)return"null";const n=typeof t;switch(n){case"object":return Array.isArray(t)?"list":"object";case"symbol":return"js-symbol";default:return n}}),Le=(De(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$symbol",e,1,1),"string"===typeof e[0])return{symbol:e[0]};throw new Error("[SX] $symbol: Invalid argument(s): item(s) of args[0] is not string.")}),qe=(Le(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__gensym",t,0,1);const n=`$__tempvar__$$ec${e.evalCount++}$$_`,r={symbol:n+"_$gensym"};if(1===t.length){const n=Object(o["d"])(t[0]);if(n)he(e,"")(n,r);else{if("string"!==typeof t[0])throw new Error("[SX] $__gensym: Invalid argument(s): item(s) of args[0] is not symbol.");he(e,"")({symbol:t[0]},r)}}return r}),Ue=(e,t)=>(...e)=>{if(Object(P["a"])("$isSymbol",e,1,2),1===e.length)return!!Object(o["d"])(e[0]);if("string"===typeof e[1])return!!Object(o["d"])(e[0],e[1]);throw new Error("[SX] $isSymbol: Invalid argument(s): item(s) of args[1] is not string.")},Re=(Ue(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isNull",e,1,1),null===R(...e))),Fe=(Re(null,null),(e,t)=>(...e)=>{Object(P["a"])("$isNil",e,1,1);const t=R(...e);return Array.isArray(t)&&0===t.length}),Be=(Fe(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isUndefined",e,1,1),void 0===R(...e))),We=(Be(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isList",e,1,1),Array.isArray(R(...e)))),Ke=(We(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isString",e,1,1),"string"===typeof R(...e))),Ve=(Ke(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isNumber",e,1,1),"number"===typeof R(...e))),Ge=(Ve(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isNaN",e,1,1),Number.isNaN(R(...e)))),Je=(Ge(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isFinite",e,1,1),Number.isFinite(R(...e)))),He=(Je(null,null),(e,t)=>(...e)=>(Object(P["a"])("$isInteger",e,1,1),Number.isInteger(R(...e)))),ze=(He(null,null),(e,t)=>(...e)=>(Object(P["a"])("$toString",e,1,1),String(R(...e)))),Ye=(ze(null,null),(e,t)=>(...e)=>(Object(P["a"])("$toNumber",e,1,1),Object(E["l"])(R(...e)))),Qe=(Ye(null,null),(e,t)=>(...t)=>{const n={};for(const r of t){if(!(Array.isArray(r)&&0<r.length))throw new Error("[SX] $__toObject: Invalid argument(s): args[?] is not array.");{const t=Object(o["d"])(r[0]),a=t?t.symbol:String(Object(E["b"])(e,r[0]));Object(P["c"])("$__#",n,a),1===r.length?n[a]=!0:2===r.length?n[a]=Object(E["b"])(e,r[1]):n[a]=Object(E["b"])(e,[{symbol:e.config.reservedNames.list}].concat(r.slice(1)))}}return n}),Ze=[C["a"],Object.__proto__,{}.__proto__,Function.__proto__],et=(e,t)=>(...e)=>{if(Object(P["a"])("$objectAssign",e,1),Ze.includes(e[0]))throw new Error("[SX] $objectAssign: Invalid argument: args[0] is blacklisted object.");return Object.assign(e[0],...e.slice(1))},tt=(et(null,null),(e,t)=>(...e)=>(Object(P["a"])("$jsonStringify",e,1,1),JSON.stringify(R(...e)))),nt=(tt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$jsonParse",e,1,1);const t=R(...e);if("string"!==typeof t)throw new Error("[SX] $jsonParse: Invalid argument(s): args[0] is not string.");return JSON.parse(t)}),rt=(nt(null,null),(e,t)=>(...e)=>Date.now()),ot=(rt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetimeFromIso",e,1,1);const t=R(...e);if("string"!==typeof t)throw new Error("[SX] $datetimeFromIso: Invalid argument(s): args[0] is not string.");if(!/^(?:(?:-[0-9]{6,})|[0-9]{4,})-(?:[0-1][0-9])-(?:[0-3][0-9])(?:T(?:[0-2][0-9])(?:[:](?:[0-6][0-9])(?:[:](?:[0-6][0-9])(?:.[0-9]{1,})?)?)?(?:Z|[-+][0-9]{2}(?:[:]?[0-6][0-9])?)?)?$/.test(t))throw new Error(`[SX] $datetimeFromIso: Invalid datetime (pattern unmatched): ${t}.`);const n=new Date(t).getTime();if(Number.isNaN(n))throw new Error(`[SX] $datetimeFromIso: Invalid datetime: ${t}.`);return n}),at=(ot(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetime",e,3,7);let t="";const n=Number(e[0]);t+=n>=0?String(n).padStart(4,"0"):"-"+String(-n).padStart(6,"0"),t+="-"+String(Number(e[1])).padStart(2,"0"),t+="-"+String(Number(e[2])).padStart(2,"0"),e.length>=4&&(t+="T"+String(Number(e[3])).padStart(2,"0"),e.length>=5?t+=":"+String(Number(e[4])).padStart(2,"0"):t+=":00",e.length>=6&&(t+=":"+String(Number(e[5])).padStart(2,"0")),e.length>=7&&(t+="."+String(Number(e[6])).padStart(3,"0").slice(0,3)),t+="Z");const r=new Date(t).getTime();if(Number.isNaN(r))throw new Error(`[SX] $datetime: Invalid datetime: ${t}.`);return r}),st=(at(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetimeLc",e,3,7);let t="";const n=Number(e[0]);t+=n>=0?String(n).padStart(4,"0"):"-"+String(-n).padStart(6,"0"),t+="-"+String(Number(e[1])).padStart(2,"0"),t+="-"+String(Number(e[2])).padStart(2,"0"),e.length>=4?(t+="T"+String(Number(e[3])).padStart(2,"0"),e.length>=5?t+=":"+String(Number(e[4])).padStart(2,"0"):t+=":00",e.length>=6&&(t+=":"+String(Number(e[5])).padStart(2,"0")),e.length>=7&&(t+="."+String(Number(e[6])).padStart(3,"0").slice(0,3))):t+="T00:00:00.000";const r=new Date(t).getTime();if(Number.isNaN(r))throw new Error(`[SX] $datetimeLc: Invalid datetime: ${t}.`);return r}),lt=(st(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetimeToIsoString",e,1,1);const t=R(...e);if("number"!==typeof t)throw new Error("[SX] $datetimeToIsoString: Invalid argument(s): args[0] is not number.");const n=new Date(t);if(Number.isNaN(n.getTime()))throw new Error(`[SX] $datetimeToIsoString: Invalid datetime: ${t}.`);return n.toISOString()}),ct=(lt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetimeToComponents",e,1,1);const t=R(...e);if("number"!==typeof t)throw new Error("[SX] $datetimeToComponents: Invalid argument(s): args[0] is not number.");const n=new Date(t);if(Number.isNaN(n.getTime()))throw new Error(`[SX] $datetimeToComponents: Invalid datetime: ${t}.`);return[n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds(),0,n.getUTCDay()]}),it=(ct(null,null),(e,t)=>(...e)=>{Object(P["a"])("$datetimeToComponentsLc",e,1,1);const t=R(...e);if("number"!==typeof t)throw new Error("[SX] $datetimeToComponentsLc: Invalid argument(s): args[0] is not number.");const n=new Date(t);if(Number.isNaN(n.getTime()))throw new Error(`[SX] $datetimeToComponentsLc: Invalid datetime: ${t}.`);return[n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds(),-n.getTimezoneOffset(),n.getDay()]}),ut=(it(null,null),(e,t)=>(...t)=>{if(Object(P["a"])("$match",t,2,3),!e.config.enableRegExpMatchOperators)throw new Error("[SX] $match: Operator is disabled by configuration.");if(2===t.length){const e=new RegExp(t[0]);return e.exec(t[1])}{const e=new RegExp(t[0],t[1]);return e.exec(t[2])}}),ft=(ut(null,null),(e,t)=>(...e)=>(console.log(...e),null)),mt=(ft(null,null),(e,t)=>(...e)=>(console.error(...e),null)),bt=(mt(null,null),(e,t)=>(...e)=>(console.trace(...e),null)),$t=(bt(null,null),(e,t)=>(...e)=>(console.time(...e),null)),pt=($t(null,null),(e,t)=>(...e)=>(console.timeEnd(...e),null)),_t=(pt(null,null),(e,t)=>(...e)=>(console.timeLog(...e),null)),dt=(_t(null,null),[{name:"$car",fn:D},{name:"$cdr",fn:L},{name:"$cons",fn:q},{name:"$first",fn:U},{name:"$second",fn:F},{name:"$last",fn:W},{name:"$progn",fn:W},{name:"$rest",fn:K},{name:"$first-and-second",fn:V},{name:"$atom",fn:J},{name:"$eq",fn:H},{name:"===",fn:H},{name:"$not-eq",fn:z},{name:"!==",fn:z},{name:"$list",fn:Y},{name:"$__scope",fn:Q},{name:"$__global",fn:Z},{name:"$__capture",fn:ee},{name:"$__lambda",fn:te},{name:"$__defun",fn:re},{name:"$__refun",fn:ae},{name:"$__defmacro",fn:se},{name:"$apply",fn:le},{name:"$__call",fn:ce},{name:"$__try",fn:ie},{name:"$raise",fn:ue},{name:"$__if",fn:fe},{name:"$__if-null",fn:me},{name:"$__cond",fn:be},{name:"$__while",fn:$e},{name:"$__do-while",fn:pe},{name:"$__until",fn:_e},{name:"$__do-until",fn:de},{name:"$__repeat",fn:ye},{name:"$__for",fn:ge},{name:"$pipe",fn:je},{name:"$__get",fn:Oe},{name:"$__let",fn:he},{name:"$__set",fn:ve},{name:"$boolean",fn:we},{name:"$not",fn:Ae},{name:"$__and",fn:Ne},{name:"$__or",fn:Ie},{name:"==",fn:ke},{name:"!=",fn:Xe},{name:"<",fn:xe},{name:"<=",fn:Ce},{name:">",fn:Me},{name:">=",fn:Pe},{name:"$typeof",fn:De},{name:"$symbol",fn:Le},{name:"$__gensym",fn:qe},{name:"$is-symbol",fn:Ue},{name:"$is-null",fn:Re},{name:"$is-nil",fn:Fe},{name:"$is-undefined",fn:Be},{name:"$is-list",fn:We},{name:"$is-string",fn:Ke},{name:"$is-number",fn:Ve},{name:"$is-NaN",fn:Ge},{name:"$is-finite",fn:Je},{name:"$is-integer",fn:He},{name:"$to-string",fn:ze},{name:"$to-number",fn:Ye},{name:"$__#",fn:Qe},{name:"$object-assign",fn:et},{name:"$json-stringify",fn:tt},{name:"$now",fn:rt},{name:"$datetime-from-iso",fn:ot},{name:"$datetime",fn:at},{name:"$datetime-lc",fn:st},{name:"$datetime-to-iso-string",fn:lt},{name:"$datetime-to-components",fn:ct},{name:"$datetime-to-components-lc",fn:it},{name:"$json-parse",fn:nt},{name:"$match",fn:ut},{name:"$console-log",fn:ft},{name:"$console-error",fn:mt},{name:"$console-trace",fn:bt},{name:"$console-time",fn:$t},{name:"$console-time-end",fn:pt},{name:"$console-time-log",fn:_t}]),yt=[{name:"$$__lambda",fn:ne},{name:"$$__defun",fn:oe}];var gt=[].concat(dt,yt);const jt=[{name:"$scope",fn:(e,t)=>t=>[{symbol:"$__scope"},t[1],t[2],...t.slice(3).map(t=>Object(o["f"])(e,t))]},{name:"$local",fn:(e,t)=>t=>[{symbol:"$__scope"},!0,!1,...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$global",fn:(e,t)=>t=>[{symbol:"$__global"},!1,...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$clisp-let",fn:(e,t)=>t=>[{symbol:"$__scope"},!0,!1,...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$capture",fn:(e,t)=>t=>[{symbol:"$__capture"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$closure",fn:(e,t)=>t=>{const n=Object(o["d"])(t[2],"use");if(!n)throw new Error("[SX] $closure: Invalid syntax: missing 'use' keyword.");return[{symbol:"$__capture"},Object(o["f"])(e,t[3]),Object(o["f"])(e,[{symbol:"$__lambda"},Object(o["f"])(e,t[1]),...t.slice(4).map(t=>Object(o["f"])(e,t))])]}},{name:"|->",fn:(e,t)=>e=>[{symbol:"$closure"},...e.slice(1)]},{name:"$lambda",fn:(e,t)=>t=>[{symbol:"$__lambda"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"->",fn:(e,t)=>t=>[{symbol:"$__lambda"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$defun",fn:(e,t)=>t=>[{symbol:"$__defun"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$refun",fn:(e,t)=>t=>[{symbol:"$__refun"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"<-",fn:(e,t)=>t=>[{symbol:"$__refun"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$defmacro",fn:(e,t)=>t=>[{symbol:"$__defmacro"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$call",fn:(e,t)=>t=>(Object(P["a"])("$call",t,3),[{symbol:"$__call"},t[1],Object(o["f"])(e,t[2]),...t.slice(3)])},{name:"$try",fn:(e,t)=>t=>[{symbol:"$__try"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$if",fn:(e,t)=>t=>[{symbol:"$__if"},t[1],...t.slice(2).map(t=>Object(o["f"])(e,t))]},{name:"$if-null",fn:(e,t)=>t=>[{symbol:"$__if-null"},t[1],...t.slice(2).map(t=>Object(o["f"])(e,t))]},{name:"??",fn:(e,t)=>t=>[{symbol:"$__if-null"},t[1],...t.slice(2).map(t=>Object(o["f"])(e,t))]},{name:"$cond",fn:(e,t)=>t=>[{symbol:"$__cond"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$while",fn:(e,t)=>t=>[{symbol:"$__while"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$do-while",fn:(e,t)=>t=>[{symbol:"$__do-while"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$until",fn:(e,t)=>t=>[{symbol:"$__until"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$do-until",fn:(e,t)=>t=>[{symbol:"$__do-until"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$repeat",fn:(e,t)=>t=>{const n=Object(o["d"])(t[2],"of");if(!n)throw new Error("[SX] $repeat: Invalid syntax: missing 'of' keyword.");return[{symbol:"$__repeat"},Object(o["f"])(e,t[1]),t[3],...t.slice(4).map(t=>Object(o["f"])(e,t))]}},{name:"$for",fn:(e,t)=>t=>{const n=Object(o["d"])(t[2],"of");if(!n)throw new Error("[SX] $for: Invalid syntax: missing 'of' keyword.");return[{symbol:"$__for"},Object(o["f"])(e,t[1]),t[3],...t.slice(4).map(t=>Object(o["f"])(e,t))]}},{name:"$get",fn:(e,t)=>t=>[{symbol:"$__get"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$let",fn:(e,t)=>t=>(Object(P["a"])("$let",t,3,3),[{symbol:"$__let"},Object(o["f"])(e,t[1]),t[2]])},{name:"$clisp-defvar",fn:(e,t)=>t=>(Object(P["a"])("$clisp-defvar",t,3,3),[{symbol:"$global"},[{symbol:"$__let"},Object(o["f"])(e,t[1]),t[2]]])},{name:"$set",fn:(e,t)=>t=>(Object(P["a"])("$set",t,3,3),[{symbol:"$__set"},Object(o["f"])(e,t[1]),t[2]])},{name:"$clisp-setq",fn:(e,t)=>t=>(Object(P["a"])("$clisp-setq",t,3,3),[{symbol:"$__set"},Object(o["f"])(e,t[1]),t[2]])},{name:"$and",fn:(e,t)=>t=>[{symbol:"$__and"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$or",fn:(e,t)=>t=>[{symbol:"$__or"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$gensym",fn:(e,t)=>t=>[{symbol:"$__gensym"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"#",fn:(e,t)=>t=>[{symbol:"$__#"},...t.slice(1).map(t=>Object(o["f"])(e,t))]}],Ot=[{name:"$$closure",fn:(e,t)=>t=>{const n=Object(o["d"])(t[2],"use");if(!n)throw new Error("[SX] $closure: Invalid syntax: missing 'use' keyword.");return[{symbol:"$__capture"},Object(o["f"])(e,t[3]),Object(o["f"])(e,[{symbol:"$$__lambda"},Object(o["f"])(e,t[1]),...t.slice(4).map(t=>Object(o["f"])(e,t))])]}},{name:"|=>",fn:(e,t)=>e=>[{symbol:"$$closure"},...e.slice(1)]},{name:"$$lambda",fn:(e,t)=>t=>[{symbol:"$$__lambda"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"=>",fn:(e,t)=>t=>[{symbol:"$$__lambda"},...t.slice(1).map(t=>Object(o["f"])(e,t))]},{name:"$$defun",fn:(e,t)=>t=>[{symbol:"$$__defun"},...t.slice(1).map(t=>Object(o["f"])(e,t))]}];var ht=[].concat(jt,Ot);const vt=[{name:"nil",fn:(e,t)=>[]},{name:"null",fn:(e,t)=>null},{name:"undefined",fn:(e,t)=>{}},{name:"true",fn:(e,t)=>!0},{name:"#true",fn:(e,t)=>!0},{name:"#t",fn:(e,t)=>!0},{name:"false",fn:(e,t)=>!1},{name:"#false",fn:(e,t)=>!1},{name:"#f",fn:(e,t)=>!1},{name:"#Number:Infinity",fn:(e,t)=>Number.POSITIVE_INFINITY},{name:"+Infinity",fn:(e,t)=>Number.POSITIVE_INFINITY},{name:"-Infinity",fn:(e,t)=>Number.NEGATIVE_INFINITY},{name:"#Number:Epsilon",fn:(e,t)=>Number.EPSILON},{name:"#Number:MaxValue",fn:(e,t)=>Number.MAX_VALUE},{name:"#Number:MinValue",fn:(e,t)=>Number.MIN_VALUE},{name:"#Number:MinSafeInteger",fn:(e,t)=>Number.MAX_SAFE_INTEGER},{name:"#Number:MinSafeInteger",fn:(e,t)=>Number.MIN_SAFE_INTEGER},{name:"NaN",fn:(e,t)=>Number.NaN}];var wt=vt;function St(e){return e.funcs=(e.funcs||[]).concat(dt).concat(e.enableCompilationOperators?yt:[]),e.macros=(e.macros||[]).concat(jt).concat(e.enableCompilationOperators?Ot:[]),e.symbols=(e.symbols||[]).concat(wt),e}const At=(e,t)=>(...e)=>{Object(P["a"])("$bitLShift",e,2,2);let{car:t,cdr:n}=G(...e);return t=Object(E["l"])(t),n=Object(E["l"])(n),0<=n?n<32?t<<n:0:n>-32?t>>>-n:0},Et=(At(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitSRShift",e,2,2);let{car:t,cdr:n}=G(...e);return t=Object(E["l"])(t),n=Object(E["l"])(n),0<=n?n<32?t>>n:2147483648&t?-1:0:n>-32?t<<-n:0}),Nt=(Et(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitURShift",e,2,2);let{car:t,cdr:n}=G(...e);return t=Object(E["l"])(t),n=Object(E["l"])(n),0<=n?n<32?t>>>n:0:n>-32?t<<-n:0}),It=(Nt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitNot",e,1,1);const t=R(...e);return~Object(E["l"])(t)}),kt=(It(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitAnd",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)&Object(E["l"])(t),Object(E["l"])(t))}),Tt=(kt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitOr",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)|Object(E["l"])(t),Object(E["l"])(t))}),Xt=(Tt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$bitXor",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)^Object(E["l"])(t),Object(E["l"])(t))}),xt=(Xt(null,null),(e,t)=>(...e)=>(Object(P["a"])("$add",e,1),e.reduce((e,t)=>Object(E["l"])(e)+Object(E["l"])(t),0))),Ct=(xt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$sub",e,1);const t=R(...e),n=e.slice(1);return 0===n.length?-Object(E["l"])(t):e.slice(1).reduce((e,t)=>Object(E["l"])(e)-Object(E["l"])(t),Object(E["l"])(t))}),Mt=(Ct(null,null),(e,t)=>(...e)=>{Object(P["a"])("$mul",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)*Object(E["l"])(t),Object(E["l"])(t))}),Pt=(Mt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$sup",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Math.pow(Object(E["l"])(e),Object(E["l"])(t)),Object(E["l"])(t))}),Dt=(Pt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$div",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)/Object(E["l"])(t),Object(E["l"])(t))}),Lt=(Dt(null,null),(e,t)=>(...e)=>{Object(P["a"])("$mod",e,2);const t=R(...e);return e.slice(1).reduce((e,t)=>Object(E["l"])(e)%Object(E["l"])(t),Object(E["l"])(t))}),qt=(Lt(null,null),(e,t)=>(...e)=>Math.max(...e.map(e=>Object(E["l"])(e)))),Ut=(qt(null,null),(e,t)=>(...e)=>Math.min(...e.map(e=>Object(E["l"])(e)))),Rt=(Ut(null,null),(e,t)=>(...e)=>{const t=e.map(e=>Object(E["l"])(e));return t.length>0?t.reduce((e,t)=>e+t,0)/t.length:NaN}),Ft=(Rt(null,null),(e,t)=>(...e)=>(Object(P["a"])("$floor",e,1,1),Math.floor(Object(E["l"])(R(...e))))),Bt=(Ft(null,null),(e,t)=>(...e)=>(Object(P["a"])("$ceil",e,1,1),Math.ceil(Object(E["l"])(R(...e))))),Wt=(Bt(null,null),(e,t)=>(...e)=>(Object(P["a"])("$round",e,1,1),Math.round(Object(E["l"])(R(...e))))),Kt=(Wt(null,null),(e,t)=>(...e)=>(Object(P["a"])("$abs",e,1,1),Math.abs(Object(E["l"])(R(...e))))),Vt=(Kt(null,null),(e,t)=>(...e)=>(Object(P["a"])("$sign",e,1,1),Math.sign(Object(E["l"])(R(...e))))),Gt=(Vt(null,null),[{name:"<<",fn:At},{name:"$bit-l-shift",fn:At},{name:">>",fn:Et},{name:"$bit-sr-shift",fn:Et},{name:">>>",fn:Nt},{name:"$bit-ur-shift",fn:Nt},{name:"$bit-not",fn:It},{name:"$bit-and",fn:kt},{name:"$bit-or",fn:Tt},{name:"$bit-xor",fn:Xt},{name:"+",fn:xt},{name:"$add",fn:xt},{name:"$sum",fn:xt},{name:"-",fn:Ct},{name:"$sub",fn:Ct},{name:"$neg",fn:Ct},{name:"*",fn:Mt},{name:"$mul",fn:Mt},{name:"**",fn:Pt},{name:"$sup",fn:Pt},{name:"/",fn:Dt},{name:"$div",fn:Dt},{name:"%",fn:Lt},{name:"$mod",fn:Lt},{name:"$max",fn:qt},{name:"$min",fn:Ut},{name:"$avg",fn:Rt},{name:"$floor",fn:Ft},{name:"$ceil",fn:Bt},{name:"$round",fn:Wt},{name:"$abs",fn:Kt},{name:"$sign",fn:Vt}]);var Jt=Gt;const Ht=[{name:"$incl",fn:(e,t)=>e=>(Object(P["a"])("$incl",e,2,2),[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],1]])},{name:"++",fn:(e,t)=>e=>(Object(P["a"])("++",e,2,2),[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],1]])},{name:"$decl",fn:(e,t)=>e=>(Object(P["a"])("$decl",e,2,2),[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],-1]])},{name:"--",fn:(e,t)=>e=>(Object(P["a"])("--",e,2,2),[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],-1]])},{name:"$incln",fn:(e,t)=>e=>{if(Object(P["a"])("$incln",e,3,3),"number"!==typeof e[2])throw new Error("[SX] $incln: Invalid parameter: arg(1) is not number.");return[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],e[2]]]}},{name:"+=",fn:(e,t)=>e=>{if(Object(P["a"])("+=",e,3,3),"number"!==typeof e[2])throw new Error("[SX] +=: Invalid parameter: arg(1) is not number.");return[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],e[2]]]}},{name:"$decln",fn:(e,t)=>e=>{if(Object(P["a"])("$decln",e,3,3),"number"!==typeof e[2])throw new Error("[SX] $decln: Invalid parameter: arg(1) is not number.");return[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],-e[2]]]}},{name:"-=",fn:(e,t)=>e=>{if(Object(P["a"])("-=",e,3,3),"number"!==typeof e[2])throw new Error("[SX] -=: Invalid parameter: arg(1) is not number.");return[{symbol:"$set"},e[1],[{symbol:"$add"},e[1],-e[2]]]}}];var zt=Ht;const Yt=[];var Qt=Yt;function Zt(e){return e.funcs=(e.funcs||[]).concat(Jt),e.macros=(e.macros||[]).concat(zt),e.symbols=(e.symbols||[]).concat(Qt),e}class en{constructor(e){this.data=e}orderBy(e){let t;return t=Array.isArray(e)?(t,n)=>{for(const r of e)if("string"===typeof r){if(t[r]>n[r])return 1;if(t[r]<n[r])return-1}else{const e="desc"===r[1]?-1:1;if(t[r[0]]>n[r[0]])return 1*e;if(t[r[0]]<n[r[0]])return-1*e}return 0}:e,new en(this.data.slice(0).sort(t))}groupBy(e){let t;t=Array.isArray(e)?(t,n)=>{for(const r of e)if(t[r]!==n[r])return!1;return!0}:e;const n=[];let r=0,o=1;for(;o<this.data.length;o++)t(this.data[r],this.data[o],o,this.data)||(n.push(this.data.slice(r,o)),r=o);return n.push(this.data.slice(r,o)),new en(n)}groupEvery(e){if("number"===typeof e)return this.groupBy((t,n,r,o)=>r%e!==0);{const t=Object.assign({first:e.intermediate,last:e.intermediate},e),n=this.groupBy((e,n,r,o)=>t.single>=o.length?r%t.single!==0:r<=t.first?r%t.first!==0:(r-t.first)%t.intermediate!==0);return 1===n.data.length?t.single<n.data[0].length&&n.data.push([]):t.first<n.data[0].length&&n.data.unshift([]),n.data.length>1&&n.data[n.data.length-1].length>t.last&&n.data.push([]),n}}where(e){return new en(this.data.filter(e))}select(e){return e?this.data.map(e):this.data}}function tn(e){return new en(e)}const nn=(e,t)=>(...t)=>{Object(P["a"])("$range",t,2,3);const{car:n,cdr:r}=G(...t),o=Object(E["l"])(n)||0,a=Object(E["l"])(r)||0,s=t.length>2&&Object(E["l"])(t[2])||(o<=a?1:-1),l=Math.sign(a-o)+Math.sign(s)!==0?Math.floor(Math.abs(a-o)/Math.abs(s))+1:0;return e.evalCount+=l,Object(E["b"])(e,0),Array.from({length:l},(e,t)=>o+t*s)},rn=(e,t)=>(...e)=>{Object(P["a"])("$length",e,1,1);const t=R(...e);switch(typeof t){case"object":if(!("length"in t))break;case"string":return t.length}throw new Error("[SX] $length: Invalid argument type: object has no property 'length'.")},on=(rn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$trim",e,1,1);const t=R(...e);if("string"===typeof t)return t.trim();throw new Error("[SX] $trim: Invalid argument type: args[0] is not string.")}),an=(on(null,null),(e,t)=>(...e)=>{Object(P["a"])("$trimHead",e,1,1);const t=R(...e);if("string"===typeof t)return t.trimLeft();throw new Error("[SX] $trimHead: Invalid argument type: args[0] is not string.")}),sn=(an(null,null),(e,t)=>(...e)=>{Object(P["a"])("$trimTail",e,1,1);const t=R(...e);if("string"===typeof t)return t.trimRight();throw new Error("[SX] $trimTail: Invalid argument type: args[0] is not string.")}),ln=(sn(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$replaceAll",e,3,3),"string"===typeof e[0]&&"string"===typeof e[1]&&"string"===typeof e[2])return e[0].split(e[1]).join(e[2]);throw new Error("[SX] $replaceAll: Invalid argument type: args[0] or [1] or [2] is not string.")}),cn=(ln(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$split",e,2,2),"string"===typeof e[0]&&"string"===typeof e[1])return e[0].split(e[1]);throw new Error("[SX] $split: Invalid argument type: args[0] or [1] is not string.")}),un=(cn(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$join",e,1,2),Array.isArray(e[0]),e.length>1){if("string"===typeof e[1])return e[0].join(e[1]);throw new Error("[SX] $join: Invalid argument type: args[1] is not string.")}return e[0].join()}),fn=(un(null,null),(e,t)=>(...e)=>{Object(P["a"])("$concat",e,1);const t=R(...e);switch(typeof t){case"object":if(!("concat"in t))break;case"string":return t.concat(...e.slice(1))}throw new Error("[SX] $concat: Invalid argument type: object has no property 'concat'.")}),mn=(fn(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$slice",e,2,3),3===e.length&&("string"===typeof e[2]||Array.isArray(e[2])))return e[2].slice(Object(E["l"])(e[0]),Object(E["l"])(e[1]));if(2===e.length&&("string"===typeof e[1]||Array.isArray(e[1])))return e[1].slice(Object(E["l"])(e[0]));throw new Error(`[SX] $slice: Invalid argument type: args[${e.length-1}] is not string or array.`)}),bn=(mn(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$top",e,2,2),"string"===typeof e[1]||Array.isArray(e[1]))return e[1].slice(0,Object(E["l"])(e[0]));throw new Error("[SX] $top: Invalid argument type: args[1] is not string or array.")}),$n=(bn(null,null),(e,t)=>(...e)=>{if(Object(P["a"])("$tail",e,2,2),"string"===typeof e[1]||Array.isArray(e[1])){const t=-Object(E["l"])(e[0]);return e[1].slice(t>=0||Number.isNaN(t)?e[1].length:t)}throw new Error("[SX] $tail: Invalid argument type: args[1] is not string or array.")}),pn=($n(null,null),(e,t)=>(...e)=>(Object(P["a"])("$push",e,2,2),Array.isArray(e[0]),e[0].push(e[1]),e[0])),_n=(pn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$pop",e,1,1),Array.isArray(e[0]);{const t=e[0].pop();return t}}),dn=(_n(null,null),(e,t)=>(...e)=>{Object(P["a"])("$__at",e,2,2);const{car:t,cdr:n}=G(...e);return n[t]}),yn=(dn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$reverse",e,1,1);const t=R(...e);if(Array.isArray(t))return t.slice(0).reverse();throw new Error("[SX] $reverse: Invalid argument type: args[0] is not array.")}),gn=(yn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$reverse!",e,1,1);const t=R(...e);if(Array.isArray(t))return t.reverse();throw new Error("[SX] $reverse!: Invalid argument type: args[0] is not array.")}),jn=(gn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$find",e,2,2);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return t.find(n);throw new Error("[SX] $find: Invalid argument type: args[0] is not array.")}),On=(jn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$filter",e,2,2);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return t.filter(n);throw new Error("[SX] $filter: Invalid argument type: args[0] is not array.")}),hn=(On(null,null),(e,t)=>(...e)=>{Object(P["a"])("$map",e,2,2);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return t.map(n);throw new Error("[SX] $map: Invalid argument type: args[0] is not array.")}),vn=(hn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$reduce",e,2,3);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return e.length<3?t.reduce(n):t.reduce(n,e[2]);throw new Error("[SX] $reduce: Invalid argument type: args[0] is not array.")}),wn=(vn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$reduceFromTail",e,2,3);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return e.length<3?t.reduceRight(n):t.reduceRight(n,e[2]);throw new Error("[SX] $reduceFromTail: Invalid argument type: args[0] is not array.")}),Sn=(wn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$sort",e,2,2);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return t.slice(0).sort(n);throw new Error("[SX] $sort: Invalid argument type: args[0] is not array.")}),An=(Sn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$sort!",e,2,2);const{car:t,cdr:n}=G(...e);if(Array.isArray(t))return t.sort(n);throw new Error("[SX] $sort!: Invalid argument type: args[0] is not array.")}),En=(An(null,null),(e,t)=>(...e)=>{Object(P["a"])("$group-every",e,2,2);const{car:t,cdr:n}=G(...e);if(!Array.isArray(n))throw new Error("[SX] $group-every: Invalid argument type: args[1] is not array.");return tn(n).groupEvery(t).select()}),Nn=(En(null,null),(e,t)=>(...e)=>{Object(P["a"])("$group-by",e,2,2);const{car:t,cdr:n}=G(...e);if(!Array.isArray(n))throw new Error("[SX] $group-by: Invalid argument type: args[1] is not array.");return tn(n).groupBy(t).select()}),In=(Nn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$order-by",e,2,2);const{car:t,cdr:n}=G(...e);if(!Array.isArray(n))throw new Error("[SX] $order-by: Invalid argument type: args[1] is not array.");return tn(n).orderBy(t).select()}),kn=(In(null,null),(e,t)=>(...e)=>{Object(P["a"])("$where",e,2,2);const{car:t,cdr:n}=G(...e);if("function"!==typeof e[0])throw new Error("[SX] $where: Invalid argument type: args[0] is not function.");if(!Array.isArray(n))throw new Error("[SX] $where: Invalid argument type: args[1] is not array.");return tn(n).where(t).select()}),Tn=(kn(null,null),[{name:"$range",fn:nn},{name:"$length",fn:rn},{name:"$trim",fn:on},{name:"$trim-head",fn:an},{name:"$trim-tail",fn:sn},{name:"$replace-all",fn:ln},{name:"$split",fn:cn},{name:"$join",fn:un},{name:"$concat",fn:fn},{name:"$slice",fn:mn},{name:"$top",fn:bn},{name:"$tail",fn:$n},{name:"$push",fn:pn},{name:"$pop",fn:_n},{name:"$__at",fn:dn},{name:"$reverse",fn:yn},{name:"$reverse!",fn:gn},{name:"$find",fn:jn},{name:"$filter",fn:On},{name:"$map",fn:hn},{name:"$reduce",fn:vn},{name:"$reduce-from-head",fn:vn},{name:"$reduce-from-tail",fn:wn},{name:"$sort",fn:Sn},{name:"$sort!",fn:An},{name:"$group-every",fn:En},{name:"$group-by",fn:Nn},{name:"$order-by",fn:In},{name:"$where",fn:kn}]);var Xn=Tn;const xn=[{name:"$[",fn:(e,t)=>e=>{const t=Object(o["d"])(e[2],"]");if(!t)throw new Error("[SX] $repeat: Invalid syntax: missing ']' keyword.");return[{symbol:"$__at"},e[1],e[3]]}}];var Cn=xn;const Mn=[];var Pn=Mn;function Dn(e){return e.funcs=(e.funcs||[]).concat(Xn),e.macros=(e.macros||[]).concat(Cn),e.symbols=(e.symbols||[]).concat(Pn),e}const Ln=(e,t)=>(...t)=>{Object(P["a"])("$__letAsync",t,2,2);let n=t[1];return"object"===typeof n&&"function"===typeof n.then||(n=Promise.resolve(n)),n=n.then(n=>{try{return he(e,"")(t[0],n),n}catch(r){return Promise.reject(r)}}),n},qn=(Ln(null,null),(e,t)=>(...t)=>{Object(P["a"])("$__setAsync",t,2,2);let n=t[1];return"object"===typeof n&&"function"===typeof n.then||(n=Promise.resolve(n)),n=n.then(n=>{try{return ve(e,"")(t[0],n),n}catch(r){return Promise.reject(r)}}),n}),Un=(qn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$then",e,2,3);let t=e[0];if("object"===typeof t&&"function"===typeof t.then||(t=Promise.resolve(t)),"function"===typeof e[2])t=t.then(e[1],e[2]);else{if("function"!==typeof e[1])throw new Error("[SX] $then: Invalid argument(s): args[1] is not function.");t=t.then(e[1])}return t}),Rn=(Un(null,null),(e,t)=>(...e)=>{const t=e.slice(0);for(let n=0;n<t.length;n++)"object"===typeof t[n]&&"function"===typeof t[n].then||(t[n]=Promise.resolve(t[n]));return Promise.all(t)}),Fn=(Rn(null,null),(e,t)=>(...e)=>{const t=e.slice(0);for(let o=0;o<t.length;o++)"object"===typeof t[o]&&"function"===typeof t[o].then||(t[o]=Promise.resolve(t[o]));const n=e=>new Promise((t,n)=>e.then(n,t)),r=e=>n(Promise.all(e.map(n)));return r(t)}),Bn=(Fn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$resolvePipe",e,1);let t=e[0];"object"===typeof t&&"function"===typeof t.then||(t=Promise.resolve(t));const n=e.slice(1);for(let o=0;o<n.length;o++)if("function"!==typeof n[o]){const e=n[o];n[o]=()=>e}let r=t;for(const o of n)r=r.then(o);return r}),Wn=(Bn(null,null),(e,t)=>(...e)=>{Object(P["a"])("$resolveFork",e,1);let t=e[0];"object"===typeof t&&"function"===typeof t.then||(t=Promise.resolve(t));const n=e.slice(1);for(let s=0;s<n.length;s++)if("function"!==typeof n[s]){const e=n[s];n[s]=()=>e}const r=new Array(n.length),o=new Array(n.length),a=[];for(let s=0;s<n.length;s++)a.push(new Promise((e,t)=>{r[s]=r=>{let o=n[s](r);"object"===typeof o&&"function"===typeof o.then||(o=Promise.resolve(o)),o.then(t=>e(t)).catch(e=>t(e))},o[s]=t}));return t.then(e=>r.forEach(t=>t(e)),e=>o.forEach(t=>t(e))),a}),Kn=(Wn(null,null),[{name:"$__let-async",fn:Ln},{name:"$__set-async",fn:qn},{name:"$then",fn:Un},{name:"$resolve-all",fn:Rn},{name:"$resolve-any",fn:Fn},{name:"$resolve-pipe",fn:Bn},{name:"$resolve-fork",fn:Wn}]);var Vn=Kn;const Gn=[{name:"$let-async",fn:(e,t)=>t=>(Object(P["a"])("$let-async",t,3,3),[{symbol:"$__let-async"},Object(o["f"])(e,t[1]),t[2]])},{name:"$set-async",fn:(e,t)=>t=>(Object(P["a"])("$set-async",t,3,3),[{symbol:"$__set-async"},Object(o["f"])(e,t[1]),t[2]])}];var Jn=Gn;const Hn=[];var zn=Hn;function Yn(e){return e.funcs=(e.funcs||[]).concat(Vn),e.macros=(e.macros||[]).concat(Jn),e.symbols=(e.symbols||[]).concat(zn),e}const Qn=(()=>{let e=Object.assign({},s);return e.reservedNames=Object.assign({},e.reservedNames,{Template:"$concat"}),e=St(e),e=Zt(e),e=Dn(e),e=Yn(e),e.stripComments=!0,T(e)})(),Zn=Qn,er=Qn,tr=(()=>{let e=Object.assign({},s);return e.reservedNames=Object.assign({},e.reservedNames,{Template:"$concat"}),e=St(e),e=Zt(e),e=Dn(e),e=Yn(e),e.stripComments=!0,X(e)})(),nr=tr,rr=tr,or=(()=>{let e=Object.assign({},s);return e.reservedNames=Object.assign({},e.reservedNames,{Template:"$concat"}),e=St(e),e=Zt(e),e=Dn(e),e=Yn(e),e.stripComments=!0,e.returnMultipleRoot=!0,T(e)})(),ar=(()=>{let e=Object.assign({},s);return e.reservedNames=Object.assign({},e.reservedNames,{Template:"$concat"}),e=St(e),e=Zt(e),e=Dn(e),e=Yn(e),e.stripComments=!0,e.returnMultipleRoot=!0,X(e)})(),sr=(e,t)=>(...t)=>{Object(P["a"])("$__outputIf",t,2);const{car:n,cdr:r}=G(...t);let o=[];return Se(n)&&(2<t.length?(o.push({symbol:e.config.reservedNames.Template},...t.slice(1)),o=Object(E["b"])(e,o)):o=Object(E["b"])(e,r)),o},lr=(e,t)=>(...n)=>{Object(P["a"])("$__outputForOf",n,2);const r=R(...n),a=[];if(!Array.isArray(r))throw new Error("[SX] $__outputForOf: Invalid argument(s): args[0] is not array.");for(let s=0;s<r.length;s++){const l=r[s],c=Q(e,t)(!0,!0,[["$data",Object(o["f"])(e,l)],["$index",s],["$array",Object(o["f"])(e,r)],["$parent",Object(o["f"])(e,Object(E["e"])(e).scope)]],...n.slice(1));2<n.length&&Array.isArray(c)?a.push(...c):a.push(c)}return Object(E["b"])(e,[{symbol:e.config.reservedNames.Template}].concat(a.map(t=>[{symbol:e.config.reservedNames.quote},t])))},cr=(e,t)=>(...t)=>{const n={};for(const r of t){if(!(Array.isArray(r)&&0<r.length))throw new Error("[SX] $jsxProps: Invalid argument(s): args[?] is not array.");{const t=Object(o["d"])(r[0]),a=t?t.symbol:String(Object(E["b"])(e,r[0]));switch(a){case"style":if(1===r.length)n[a]="";else if(r.length>=2){const t={};for(const n of r.slice(1))if(Array.isArray(n)&&1<n.length){const r=String(Object(E["b"])(e,n[0]));Object(P["c"])("$jsxProps",t,r),t[r]=String(Object(E["b"])(e,n[1]))}else if("string"===typeof n)for(const e of n.split(";")){const n=/^\s*(\S+)\s*:\s*(.*?)\s*$/.exec(e);n&&(Object(P["c"])("$jsxProps",t,n[1]),t[n[1]]=n[2])}n[a]=t}break;case"class":case"styleClass":if(1===r.length)n[a]=[];else if(r.length>=2){let t=[];for(const n of r.slice(1))Array.isArray(n)?t=t.concat(n.map(t=>Object(E["b"])(e,t))):"string"===typeof n&&(t=t.concat(n.split(" ")));const o=[],s=e=>e.forEach(e=>null===e||void 0===e?void 0:Array.isArray(e)?s(e):o.push(String(e)));s(t),n[a]=o}break;case"className":if(1===r.length)n[a]="";else if(r.length>=2){let t="";for(const n of r.slice(1)){let r="";if(Array.isArray(n)){const t=[],o=n=>n.map(t=>Object(E["b"])(e,t)).forEach(e=>null===e||void 0===e?void 0:Array.isArray(e)?o(e):t.push(String(e)));o(n),r=t.join(" ")}else"string"===typeof n&&(r=n);0<t.length?t+=" "+r:t=r}n[a]=t}break;case"dangerouslySetInnerHTML":1===r.length?n[a]={__html:""}:r.length>=2?n[a]={__html:Object(E["b"])(e,r[1])}:n[a]={__html:Object(E["b"])(e,[{symbol:e.config.reservedNames.list}].concat(r.slice(1)))};break;case"setInnerText":1===r.length?n[a]={__text:""}:r.length>=2?n[a]={__text:Object(E["b"])(e,r[1])}:n[a]={__text:Object(E["b"])(e,[{symbol:e.config.reservedNames.list}].concat(r.slice(1)))};break;default:Object(P["c"])("$jsxProps",n,a),1===r.length?n[a]=!0:2===r.length?n[a]=Object(E["b"])(e,r[1]):n[a]=Object(E["b"])(e,[{symbol:e.config.reservedNames.list}].concat(r.slice(1)));break}}}return n};function ir(e,...t){let n=t,r={};if(0<t.length&&Array.isArray(t[0])){const a=Object(o["d"])(t[0][0],"@");a&&(r=cr(e,"")(...t[0].slice(1)),n=n.slice(1))}return{props:r,children:n}}const ur=(e,t)=>(...n)=>{const{props:r,children:o}=ir(e,...n);return e.config.jsx(t,r,...o)},fr=e=>(t,n)=>(...n)=>{const{props:r,children:o}=ir(t,...n);return t.config.jsx(e,r,...o)},mr=[{name:"$=__if",fn:sr},{name:"$=__for",fn:lr}];var br=mr;const $r=[{name:"@",fn:(e,t)=>t=>Object(o["f"])(e,t)},{name:"$=if",fn:(e,t)=>t=>[{symbol:"$=__if"},t[1],...t.slice(2).map(t=>Object(o["f"])(e,t))]},{name:"$=for",fn:(e,t)=>t=>[{symbol:"$=__for"},t[1],...t.slice(2).map(t=>Object(o["f"])(e,t))]}];var pr=$r;const _r=[];var dr=_r;function yr(e,t){e.funcs=(e.funcs||[]).concat(br),e.macros=(e.macros||[]).concat(pr),e.symbols=(e.symbols||[]).concat(dr);const n=Object.entries(t.components).map(e=>({name:e[0],fn:fr(e[1])}));return e.funcs=e.funcs.concat({name:e.reservedNames.Template,fn:fr(t.jsxFlagment)},...n),e.funcSymbolResolverFallback=ur,e.jsx=t.jsx,e.JsxFragment=t.jsxFlagment,e}function gr(e){let t=Object.assign({},s);return t=St(t),t=Zt(t),t=Dn(t),t=Yn(t),t=yr(t,e),t.stripComments=!0,T(t)}function jr(e){let t=Object.assign({},s);return t=St(t),t=Zt(t),t=Dn(t),t=Yn(t),t=yr(t,e),t.stripComments=!0,X(t)}function Or(e,t,n="text/lisp"){const r=document.querySelectorAll(`script[type="${n}"]`),o=[];for(let a=0;a<r.length;a++)o.push(r[a].innerHTML);return e=e.appendGlobals(t||{}),e(o.join("\n"))}const hr={core:gt,arithmetic:Jt,sequence:Xn,jsx:br,concurrent:Vn},vr={core:ht,arithmetic:zt,sequence:Cn,jsx:pr,concurrent:Jn},wr={core:wt,arithmetic:Qt,sequence:Pn,jsx:dr,concurrent:zn}}}]);
2
+ //# sourceMappingURL=chunk-a06ef50c.1caef24f.js.map
dist/js/chunk-ae402692.003457bc.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/js/chunk-vendors.20f7f886.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-vendors"],{"24fb":function(t,e,n){"use strict";function r(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"===typeof btoa){var i=o(r),a=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[n].concat(a).concat([i]).join("\n")}return[n].join("\n")}function o(t){var e=btoa(unescape(encodeURIComponent(JSON.stringify(t)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(e);return"/*# ".concat(n," */")}t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=r(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"===typeof t&&(t=[[null,t,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var s=0;s<t.length;s++){var c=[].concat(t[s]);r&&o[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),e.push(c))}},e}},2877:function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var c,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},"2b0e":function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return Qr}));
2
+ /*!
3
+ * Vue.js v2.7.16
4
+ * (c) 2014-2023 Evan You
5
+ * Released under the MIT License.
6
+ */
7
+ var r=Object.freeze({}),o=Array.isArray;function i(t){return void 0===t||null===t}function a(t){return void 0!==t&&null!==t}function s(t){return!0===t}function c(t){return!1===t}function u(t){return"string"===typeof t||"number"===typeof t||"symbol"===typeof t||"boolean"===typeof t}function l(t){return"function"===typeof t}function f(t){return null!==t&&"object"===typeof t}var d=Object.prototype.toString;function p(t){return"[object Object]"===d.call(t)}function v(t){return"[object RegExp]"===d.call(t)}function h(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function m(t){return a(t)&&"function"===typeof t.then&&"function"===typeof t.catch}function _(t){return null==t?"":Array.isArray(t)||p(t)&&t.toString===d?JSON.stringify(t,y,2):String(t)}function y(t,e){return e&&e.__v_isRef?e.value:e}function g(t){var e=parseFloat(t);return isNaN(e)?t:e}function b(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return e?function(t){return n[t.toLowerCase()]}:function(t){return n[t]}}b("slot,component",!0);var w=b("key,ref,slot,slot-scope,is");function C(t,e){var n=t.length;if(n){if(e===t[n-1])return void(t.length=n-1);var r=t.indexOf(e);if(r>-1)return t.splice(r,1)}}var $=Object.prototype.hasOwnProperty;function x(t,e){return $.call(t,e)}function k(t){var e=Object.create(null);return function(n){var r=e[n];return r||(e[n]=t(n))}}var O=/-(\w)/g,S=k((function(t){return t.replace(O,(function(t,e){return e?e.toUpperCase():""}))})),j=k((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),T=/\B([A-Z])/g,A=k((function(t){return t.replace(T,"-$1").toLowerCase()}));function E(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function I(t,e){return t.bind(e)}var P=Function.prototype.bind?I:E;function N(t,e){e=e||0;var n=t.length-e,r=new Array(n);while(n--)r[n]=t[n+e];return r}function D(t,e){for(var n in e)t[n]=e[n];return t}function M(t){for(var e={},n=0;n<t.length;n++)t[n]&&D(e,t[n]);return e}function L(t,e,n){}var F=function(t,e,n){return!1},R=function(t){return t};function U(t,e){if(t===e)return!0;var n=f(t),r=f(e);if(!n||!r)return!n&&!r&&String(t)===String(e);try{var o=Array.isArray(t),i=Array.isArray(e);if(o&&i)return t.length===e.length&&t.every((function(t,n){return U(t,e[n])}));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(o||i)return!1;var a=Object.keys(t),s=Object.keys(e);return a.length===s.length&&a.every((function(n){return U(t[n],e[n])}))}catch(c){return!1}}function B(t,e){for(var n=0;n<t.length;n++)if(U(t[n],e))return n;return-1}function V(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}}function H(t,e){return t===e?0===t&&1/t!==1/e:t===t||e===e}var z="data-server-rendered",W=["component","directive","filter"],q=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch","renderTracked","renderTriggered"],K={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:F,isReservedAttr:F,isUnknownElement:F,getTagNamespace:L,parsePlatformTagName:R,mustUseProp:F,async:!0,_lifecycleHooks:q},G=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function J(t){var e=(t+"").charCodeAt(0);return 36===e||95===e}function X(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var Z=new RegExp("[^".concat(G.source,".$_\\d]"));function Q(t){if(!Z.test(t)){var e=t.split(".");return function(t){for(var n=0;n<e.length;n++){if(!t)return;t=t[e[n]]}return t}}}var Y="__proto__"in{},tt="undefined"!==typeof window,et=tt&&window.navigator.userAgent.toLowerCase(),nt=et&&/msie|trident/.test(et),rt=et&&et.indexOf("msie 9.0")>0,ot=et&&et.indexOf("edge/")>0;et&&et.indexOf("android");var it=et&&/iphone|ipad|ipod|ios/.test(et);et&&/chrome\/\d+/.test(et),et&&/phantomjs/.test(et);var at,st=et&&et.match(/firefox\/(\d+)/),ct={}.watch,ut=!1;if(tt)try{var lt={};Object.defineProperty(lt,"passive",{get:function(){ut=!0}}),window.addEventListener("test-passive",null,lt)}catch(Ya){}var ft=function(){return void 0===at&&(at=!tt&&"undefined"!==typeof t&&(t["process"]&&"server"===t["process"].env.VUE_ENV)),at},dt=tt&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function pt(t){return"function"===typeof t&&/native code/.test(t.toString())}var vt,ht="undefined"!==typeof Symbol&&pt(Symbol)&&"undefined"!==typeof Reflect&&pt(Reflect.ownKeys);vt="undefined"!==typeof Set&&pt(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var mt=null;function _t(t){void 0===t&&(t=null),t||mt&&mt._scope.off(),mt=t,t&&t._scope.on()}var yt=function(){function t(t,e,n,r,o,i,a,s){this.tag=t,this.data=e,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1}return Object.defineProperty(t.prototype,"child",{get:function(){return this.componentInstance},enumerable:!1,configurable:!0}),t}(),gt=function(t){void 0===t&&(t="");var e=new yt;return e.text=t,e.isComment=!0,e};function bt(t){return new yt(void 0,void 0,void 0,String(t))}function wt(t){var e=new yt(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}"function"===typeof SuppressedError&&SuppressedError;var Ct=0,$t=[],xt=function(){for(var t=0;t<$t.length;t++){var e=$t[t];e.subs=e.subs.filter((function(t){return t})),e._pending=!1}$t.length=0},kt=function(){function t(){this._pending=!1,this.id=Ct++,this.subs=[]}return t.prototype.addSub=function(t){this.subs.push(t)},t.prototype.removeSub=function(t){this.subs[this.subs.indexOf(t)]=null,this._pending||(this._pending=!0,$t.push(this))},t.prototype.depend=function(e){t.target&&t.target.addDep(this)},t.prototype.notify=function(t){var e=this.subs.filter((function(t){return t}));for(var n=0,r=e.length;n<r;n++){var o=e[n];0,o.update()}},t}();kt.target=null;var Ot=[];function St(t){Ot.push(t),kt.target=t}function jt(){Ot.pop(),kt.target=Ot[Ot.length-1]}var Tt=Array.prototype,At=Object.create(Tt),Et=["push","pop","shift","unshift","splice","sort","reverse"];Et.forEach((function(t){var e=Tt[t];X(At,t,(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o,i=e.apply(this,n),a=this.__ob__;switch(t){case"push":case"unshift":o=n;break;case"splice":o=n.slice(2);break}return o&&a.observeArray(o),a.dep.notify(),i}))}));var It=Object.getOwnPropertyNames(At),Pt={},Nt=!0;function Dt(t){Nt=t}var Mt={notify:L,depend:L,addSub:L,removeSub:L},Lt=function(){function t(t,e,n){if(void 0===e&&(e=!1),void 0===n&&(n=!1),this.value=t,this.shallow=e,this.mock=n,this.dep=n?Mt:new kt,this.vmCount=0,X(t,"__ob__",this),o(t)){if(!n)if(Y)t.__proto__=At;else for(var r=0,i=It.length;r<i;r++){var a=It[r];X(t,a,At[a])}e||this.observeArray(t)}else{var s=Object.keys(t);for(r=0;r<s.length;r++){a=s[r];Rt(t,a,Pt,void 0,e,n)}}}return t.prototype.observeArray=function(t){for(var e=0,n=t.length;e<n;e++)Ft(t[e],!1,this.mock)},t}();function Ft(t,e,n){return t&&x(t,"__ob__")&&t.__ob__ instanceof Lt?t.__ob__:!Nt||!n&&ft()||!o(t)&&!p(t)||!Object.isExtensible(t)||t.__v_skip||qt(t)||t instanceof yt?void 0:new Lt(t,e,n)}function Rt(t,e,n,r,i,a,s){void 0===s&&(s=!1);var c=new kt,u=Object.getOwnPropertyDescriptor(t,e);if(!u||!1!==u.configurable){var l=u&&u.get,f=u&&u.set;l&&!f||n!==Pt&&2!==arguments.length||(n=t[e]);var d=i?n&&n.__ob__:Ft(n,!1,a);return Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){var e=l?l.call(t):n;return kt.target&&(c.depend(),d&&(d.dep.depend(),o(e)&&Vt(e))),qt(e)&&!i?e.value:e},set:function(e){var r=l?l.call(t):n;if(H(r,e)){if(f)f.call(t,e);else{if(l)return;if(!i&&qt(r)&&!qt(e))return void(r.value=e);n=e}d=i?e&&e.__ob__:Ft(e,!1,a),c.notify()}}}),c}}function Ut(t,e,n){if(!Wt(t)){var r=t.__ob__;return o(t)&&h(e)?(t.length=Math.max(t.length,e),t.splice(e,1,n),r&&!r.shallow&&r.mock&&Ft(n,!1,!0),n):e in t&&!(e in Object.prototype)?(t[e]=n,n):t._isVue||r&&r.vmCount?n:r?(Rt(r.value,e,n,void 0,r.shallow,r.mock),r.dep.notify(),n):(t[e]=n,n)}}function Bt(t,e){if(o(t)&&h(e))t.splice(e,1);else{var n=t.__ob__;t._isVue||n&&n.vmCount||Wt(t)||x(t,e)&&(delete t[e],n&&n.dep.notify())}}function Vt(t){for(var e=void 0,n=0,r=t.length;n<r;n++)e=t[n],e&&e.__ob__&&e.__ob__.dep.depend(),o(e)&&Vt(e)}function Ht(t){return zt(t,!0),X(t,"__v_isShallow",!0),t}function zt(t,e){if(!Wt(t)){Ft(t,e,ft());0}}function Wt(t){return!(!t||!t.__v_isReadonly)}function qt(t){return!(!t||!0!==t.__v_isRef)}function Kt(t,e,n){Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:function(){var t=e[n];if(qt(t))return t.value;var r=t&&t.__ob__;return r&&r.dep.depend(),t},set:function(t){var r=e[n];qt(r)&&!qt(t)?r.value=t:e[n]=t}})}var Gt="watcher";"".concat(Gt," callback"),"".concat(Gt," getter"),"".concat(Gt," cleanup");var Jt;var Xt=function(){function t(t){void 0===t&&(t=!1),this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=Jt,!t&&Jt&&(this.index=(Jt.scopes||(Jt.scopes=[])).push(this)-1)}return t.prototype.run=function(t){if(this.active){var e=Jt;try{return Jt=this,t()}finally{Jt=e}}else 0},t.prototype.on=function(){Jt=this},t.prototype.off=function(){Jt=this.parent},t.prototype.stop=function(t){if(this.active){var e=void 0,n=void 0;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].teardown();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){var r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0,this.active=!1}},t}();function Zt(t,e){void 0===e&&(e=Jt),e&&e.active&&e.effects.push(t)}function Qt(){return Jt}function Yt(t){var e=t._provided,n=t.$parent&&t.$parent._provided;return n===e?t._provided=Object.create(n):e}var te=k((function(t){var e="&"===t.charAt(0);t=e?t.slice(1):t;var n="~"===t.charAt(0);t=n?t.slice(1):t;var r="!"===t.charAt(0);return t=r?t.slice(1):t,{name:t,once:n,capture:r,passive:e}}));function ee(t,e){function n(){var t=n.fns;if(!o(t))return Ze(t,null,arguments,e,"v-on handler");for(var r=t.slice(),i=0;i<r.length;i++)Ze(r[i],null,arguments,e,"v-on handler")}return n.fns=t,n}function ne(t,e,n,r,o,a){var c,u,l,f;for(c in t)u=t[c],l=e[c],f=te(c),i(u)||(i(l)?(i(u.fns)&&(u=t[c]=ee(u,a)),s(f.once)&&(u=t[c]=o(f.name,u,f.capture)),n(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,t[c]=l));for(c in e)i(t[c])&&(f=te(c),r(f.name,e[c],f.capture))}function re(t,e,n){var r;t instanceof yt&&(t=t.data.hook||(t.data.hook={}));var o=t[e];function c(){n.apply(this,arguments),C(r.fns,c)}i(o)?r=ee([c]):a(o.fns)&&s(o.merged)?(r=o,r.fns.push(c)):r=ee([o,c]),r.merged=!0,t[e]=r}function oe(t,e,n){var r=e.options.props;if(!i(r)){var o={},s=t.attrs,c=t.props;if(a(s)||a(c))for(var u in r){var l=A(u);ie(o,c,u,l,!0)||ie(o,s,u,l,!1)}return o}}function ie(t,e,n,r,o){if(a(e)){if(x(e,n))return t[n]=e[n],o||delete e[n],!0;if(x(e,r))return t[n]=e[r],o||delete e[r],!0}return!1}function ae(t){for(var e=0;e<t.length;e++)if(o(t[e]))return Array.prototype.concat.apply([],t);return t}function se(t){return u(t)?[bt(t)]:o(t)?ue(t):void 0}function ce(t){return a(t)&&a(t.text)&&c(t.isComment)}function ue(t,e){var n,r,c,l,f=[];for(n=0;n<t.length;n++)r=t[n],i(r)||"boolean"===typeof r||(c=f.length-1,l=f[c],o(r)?r.length>0&&(r=ue(r,"".concat(e||"","_").concat(n)),ce(r[0])&&ce(l)&&(f[c]=bt(l.text+r[0].text),r.shift()),f.push.apply(f,r)):u(r)?ce(l)?f[c]=bt(l.text+r):""!==r&&f.push(bt(r)):ce(r)&&ce(l)?f[c]=bt(l.text+r.text):(s(t._isVList)&&a(r.tag)&&i(r.key)&&a(e)&&(r.key="__vlist".concat(e,"_").concat(n,"__")),f.push(r)));return f}function le(t,e){var n,r,i,s,c=null;if(o(t)||"string"===typeof t)for(c=new Array(t.length),n=0,r=t.length;n<r;n++)c[n]=e(t[n],n);else if("number"===typeof t)for(c=new Array(t),n=0;n<t;n++)c[n]=e(n+1,n);else if(f(t))if(ht&&t[Symbol.iterator]){c=[];var u=t[Symbol.iterator](),l=u.next();while(!l.done)c.push(e(l.value,c.length)),l=u.next()}else for(i=Object.keys(t),c=new Array(i.length),n=0,r=i.length;n<r;n++)s=i[n],c[n]=e(t[s],s,n);return a(c)||(c=[]),c._isVList=!0,c}function fe(t,e,n,r){var o,i=this.$scopedSlots[t];i?(n=n||{},r&&(n=D(D({},r),n)),o=i(n)||(l(e)?e():e)):o=this.$slots[t]||(l(e)?e():e);var a=n&&n.slot;return a?this.$createElement("template",{slot:a},o):o}function de(t){return kr(this.$options,"filters",t,!0)||R}function pe(t,e){return o(t)?-1===t.indexOf(e):t!==e}function ve(t,e,n,r,o){var i=K.keyCodes[e]||n;return o&&r&&!K.keyCodes[e]?pe(o,r):i?pe(i,t):r?A(r)!==e:void 0===t}function he(t,e,n,r,i){if(n)if(f(n)){o(n)&&(n=M(n));var a=void 0,s=function(o){if("class"===o||"style"===o||w(o))a=t;else{var s=t.attrs&&t.attrs.type;a=r||K.mustUseProp(e,s,o)?t.domProps||(t.domProps={}):t.attrs||(t.attrs={})}var c=S(o),u=A(o);if(!(c in a)&&!(u in a)&&(a[o]=n[o],i)){var l=t.on||(t.on={});l["update:".concat(o)]=function(t){n[o]=t}}};for(var c in n)s(c)}else;return t}function me(t,e){var n=this._staticTrees||(this._staticTrees=[]),r=n[t];return r&&!e||(r=n[t]=this.$options.staticRenderFns[t].call(this._renderProxy,this._c,this),ye(r,"__static__".concat(t),!1)),r}function _e(t,e,n){return ye(t,"__once__".concat(e).concat(n?"_".concat(n):""),!0),t}function ye(t,e,n){if(o(t))for(var r=0;r<t.length;r++)t[r]&&"string"!==typeof t[r]&&ge(t[r],"".concat(e,"_").concat(r),n);else ge(t,e,n)}function ge(t,e,n){t.isStatic=!0,t.key=e,t.isOnce=n}function be(t,e){if(e)if(p(e)){var n=t.on=t.on?D({},t.on):{};for(var r in e){var o=n[r],i=e[r];n[r]=o?[].concat(o,i):i}}else;return t}function we(t,e,n,r){e=e||{$stable:!n};for(var i=0;i<t.length;i++){var a=t[i];o(a)?we(a,e,n):a&&(a.proxy&&(a.fn.proxy=!0),e[a.key]=a.fn)}return r&&(e.$key=r),e}function Ce(t,e){for(var n=0;n<e.length;n+=2){var r=e[n];"string"===typeof r&&r&&(t[e[n]]=e[n+1])}return t}function $e(t,e){return"string"===typeof t?e+t:t}function xe(t){t._o=_e,t._n=g,t._s=_,t._l=le,t._t=fe,t._q=U,t._i=B,t._m=me,t._f=de,t._k=ve,t._b=he,t._v=bt,t._e=gt,t._u=we,t._g=be,t._d=Ce,t._p=$e}function ke(t,e){if(!t||!t.length)return{};for(var n={},r=0,o=t.length;r<o;r++){var i=t[r],a=i.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,i.context!==e&&i.fnContext!==e||!a||null==a.slot)(n.default||(n.default=[])).push(i);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===i.tag?c.push.apply(c,i.children||[]):c.push(i)}}for(var u in n)n[u].every(Oe)&&delete n[u];return n}function Oe(t){return t.isComment&&!t.asyncFactory||" "===t.text}function Se(t){return t.isComment&&t.asyncFactory}function je(t,e,n,o){var i,a=Object.keys(n).length>0,s=e?!!e.$stable:!a,c=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(s&&o&&o!==r&&c===o.$key&&!a&&!o.$hasNormal)return o;for(var u in i={},e)e[u]&&"$"!==u[0]&&(i[u]=Te(t,n,u,e[u]))}else i={};for(var l in n)l in i||(i[l]=Ae(n,l));return e&&Object.isExtensible(e)&&(e._normalized=i),X(i,"$stable",s),X(i,"$key",c),X(i,"$hasNormal",a),i}function Te(t,e,n,r){var i=function(){var e=mt;_t(t);var n=arguments.length?r.apply(null,arguments):r({});n=n&&"object"===typeof n&&!o(n)?[n]:se(n);var i=n&&n[0];return _t(e),n&&(!i||1===n.length&&i.isComment&&!Se(i))?void 0:n};return r.proxy&&Object.defineProperty(e,n,{get:i,enumerable:!0,configurable:!0}),i}function Ae(t,e){return function(){return t[e]}}function Ee(t){var e=t.$options,n=e.setup;if(n){var r=t._setupContext=Ie(t);_t(t),St();var o=Ze(n,null,[t._props||Ht({}),r],t,"setup");if(jt(),_t(),l(o))e.render=o;else if(f(o))if(t._setupState=o,o.__sfc){var i=t._setupProxy={};for(var a in o)"__sfc"!==a&&Kt(i,o,a)}else for(var a in o)J(a)||Kt(t,o,a);else 0}}function Ie(t){return{get attrs(){if(!t._attrsProxy){var e=t._attrsProxy={};X(e,"_v_attr_proxy",!0),Pe(e,t.$attrs,r,t,"$attrs")}return t._attrsProxy},get listeners(){if(!t._listenersProxy){var e=t._listenersProxy={};Pe(e,t.$listeners,r,t,"$listeners")}return t._listenersProxy},get slots(){return De(t)},emit:P(t.$emit,t),expose:function(e){e&&Object.keys(e).forEach((function(n){return Kt(t,e,n)}))}}}function Pe(t,e,n,r,o){var i=!1;for(var a in e)a in t?e[a]!==n[a]&&(i=!0):(i=!0,Ne(t,a,r,o));for(var a in t)a in e||(i=!0,delete t[a]);return i}function Ne(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){return n[r][e]}})}function De(t){return t._slotsProxy||Me(t._slotsProxy={},t.$scopedSlots),t._slotsProxy}function Me(t,e){for(var n in e)t[n]=e[n];for(var n in t)n in e||delete t[n]}function Le(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,o=n&&n.context;t.$slots=ke(e._renderChildren,o),t.$scopedSlots=n?je(t.$parent,n.data.scopedSlots,t.$slots):r,t._c=function(e,n,r,o){return qe(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return qe(t,e,n,r,o,!0)};var i=n&&n.data;Rt(t,"$attrs",i&&i.attrs||r,null,!0),Rt(t,"$listeners",e._parentListeners||r,null,!0)}var Fe=null;function Re(t){xe(t.prototype),t.prototype.$nextTick=function(t){return ln(t,this)},t.prototype._render=function(){var t=this,e=t.$options,n=e.render,r=e._parentVnode;r&&t._isMounted&&(t.$scopedSlots=je(t.$parent,r.data.scopedSlots,t.$slots,t.$scopedSlots),t._slotsProxy&&Me(t._slotsProxy,t.$scopedSlots)),t.$vnode=r;var i,a=mt,s=Fe;try{_t(t),Fe=t,i=n.call(t._renderProxy,t.$createElement)}catch(Ya){Xe(Ya,t,"render"),i=t._vnode}finally{Fe=s,_t(a)}return o(i)&&1===i.length&&(i=i[0]),i instanceof yt||(i=gt()),i.parent=r,i}}function Ue(t,e){return(t.__esModule||ht&&"Module"===t[Symbol.toStringTag])&&(t=t.default),f(t)?e.extend(t):t}function Be(t,e,n,r,o){var i=gt();return i.asyncFactory=t,i.asyncMeta={data:e,context:n,children:r,tag:o},i}function Ve(t,e){if(s(t.error)&&a(t.errorComp))return t.errorComp;if(a(t.resolved))return t.resolved;var n=Fe;if(n&&a(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n),s(t.loading)&&a(t.loadingComp))return t.loadingComp;if(n&&!a(t.owners)){var r=t.owners=[n],o=!0,c=null,u=null;n.$on("hook:destroyed",(function(){return C(r,n)}));var l=function(t){for(var e=0,n=r.length;e<n;e++)r[e].$forceUpdate();t&&(r.length=0,null!==c&&(clearTimeout(c),c=null),null!==u&&(clearTimeout(u),u=null))},d=V((function(n){t.resolved=Ue(n,e),o?r.length=0:l(!0)})),p=V((function(e){a(t.errorComp)&&(t.error=!0,l(!0))})),v=t(d,p);return f(v)&&(m(v)?i(t.resolved)&&v.then(d,p):m(v.component)&&(v.component.then(d,p),a(v.error)&&(t.errorComp=Ue(v.error,e)),a(v.loading)&&(t.loadingComp=Ue(v.loading,e),0===v.delay?t.loading=!0:c=setTimeout((function(){c=null,i(t.resolved)&&i(t.error)&&(t.loading=!0,l(!1))}),v.delay||200)),a(v.timeout)&&(u=setTimeout((function(){u=null,i(t.resolved)&&p(null)}),v.timeout)))),o=!1,t.loading?t.loadingComp:t.resolved}}function He(t){if(o(t))for(var e=0;e<t.length;e++){var n=t[e];if(a(n)&&(a(n.componentOptions)||Se(n)))return n}}var ze=1,We=2;function qe(t,e,n,r,i,a){return(o(n)||u(n))&&(i=r,r=n,n=void 0),s(a)&&(i=We),Ke(t,e,n,r,i)}function Ke(t,e,n,r,i){if(a(n)&&a(n.__ob__))return gt();if(a(n)&&a(n.is)&&(e=n.is),!e)return gt();var s,c;if(o(r)&&l(r[0])&&(n=n||{},n.scopedSlots={default:r[0]},r.length=0),i===We?r=se(r):i===ze&&(r=ae(r)),"string"===typeof e){var u=void 0;c=t.$vnode&&t.$vnode.ns||K.getTagNamespace(e),s=K.isReservedTag(e)?new yt(K.parsePlatformTagName(e),n,r,void 0,void 0,t):n&&n.pre||!a(u=kr(t.$options,"components",e))?new yt(e,n,r,void 0,void 0,t):cr(u,n,t,r,e)}else s=cr(e,n,t,r);return o(s)?s:a(s)?(a(c)&&Ge(s,c),a(n)&&Je(n),s):gt()}function Ge(t,e,n){if(t.ns=e,"foreignObject"===t.tag&&(e=void 0,n=!0),a(t.children))for(var r=0,o=t.children.length;r<o;r++){var c=t.children[r];a(c.tag)&&(i(c.ns)||s(n)&&"svg"!==c.tag)&&Ge(c,e,n)}}function Je(t){f(t.style)&&hn(t.style),f(t.class)&&hn(t.class)}function Xe(t,e,n){St();try{if(e){var r=e;while(r=r.$parent){var o=r.$options.errorCaptured;if(o)for(var i=0;i<o.length;i++)try{var a=!1===o[i].call(r,t,e,n);if(a)return}catch(Ya){Qe(Ya,r,"errorCaptured hook")}}}Qe(t,e,n)}finally{jt()}}function Ze(t,e,n,r,o){var i;try{i=n?t.apply(e,n):t.call(e),i&&!i._isVue&&m(i)&&!i._handled&&(i.catch((function(t){return Xe(t,r,o+" (Promise/async)")})),i._handled=!0)}catch(Ya){Xe(Ya,r,o)}return i}function Qe(t,e,n){if(K.errorHandler)try{return K.errorHandler.call(null,t,e,n)}catch(Ya){Ya!==t&&Ye(Ya,null,"config.errorHandler")}Ye(t,e,n)}function Ye(t,e,n){if(!tt||"undefined"===typeof console)throw t;console.error(t)}var tn,en=!1,nn=[],rn=!1;function on(){rn=!1;var t=nn.slice(0);nn.length=0;for(var e=0;e<t.length;e++)t[e]()}if("undefined"!==typeof Promise&&pt(Promise)){var an=Promise.resolve();tn=function(){an.then(on),it&&setTimeout(L)},en=!0}else if(nt||"undefined"===typeof MutationObserver||!pt(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())tn="undefined"!==typeof setImmediate&&pt(setImmediate)?function(){setImmediate(on)}:function(){setTimeout(on,0)};else{var sn=1,cn=new MutationObserver(on),un=document.createTextNode(String(sn));cn.observe(un,{characterData:!0}),tn=function(){sn=(sn+1)%2,un.data=String(sn)},en=!0}function ln(t,e){var n;if(nn.push((function(){if(t)try{t.call(e)}catch(Ya){Xe(Ya,e,"nextTick")}else n&&n(e)})),rn||(rn=!0,tn()),!t&&"undefined"!==typeof Promise)return new Promise((function(t){n=t}))}function fn(t){return function(e,n){if(void 0===n&&(n=mt),n)return dn(n,t,e)}}function dn(t,e,n){var r=t.$options;r[e]=_r(r[e],n)}fn("beforeMount"),fn("mounted"),fn("beforeUpdate"),fn("updated"),fn("beforeDestroy"),fn("destroyed"),fn("activated"),fn("deactivated"),fn("serverPrefetch"),fn("renderTracked"),fn("renderTriggered"),fn("errorCaptured");var pn="2.7.16";var vn=new vt;function hn(t){return mn(t,vn),vn.clear(),t}function mn(t,e){var n,r,i=o(t);if(!(!i&&!f(t)||t.__v_skip||Object.isFrozen(t)||t instanceof yt)){if(t.__ob__){var a=t.__ob__.dep.id;if(e.has(a))return;e.add(a)}if(i){n=t.length;while(n--)mn(t[n],e)}else if(qt(t))mn(t.value,e);else{r=Object.keys(t),n=r.length;while(n--)mn(t[r[n]],e)}}}var _n,yn=0,gn=function(){function t(t,e,n,r,o){Zt(this,Jt&&!Jt._vm?Jt:t?t._scope:void 0),(this.vm=t)&&o&&(t._watcher=this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++yn,this.active=!0,this.post=!1,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new vt,this.newDepIds=new vt,this.expression="",l(e)?this.getter=e:(this.getter=Q(e),this.getter||(this.getter=L)),this.value=this.lazy?void 0:this.get()}return t.prototype.get=function(){var t;St(this);var e=this.vm;try{t=this.getter.call(e,e)}catch(Ya){if(!this.user)throw Ya;Xe(Ya,e,'getter for watcher "'.concat(this.expression,'"'))}finally{this.deep&&hn(t),jt(),this.cleanupDeps()}return t},t.prototype.addDep=function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))},t.prototype.cleanupDeps=function(){var t=this.deps.length;while(t--){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},t.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():Zn(this)},t.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||f(t)||this.deep){var e=this.value;if(this.value=t,this.user){var n='callback for watcher "'.concat(this.expression,'"');Ze(this.cb,this.vm,[t,e],this.vm,n)}else this.cb.call(this.vm,t,e)}}},t.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},t.prototype.depend=function(){var t=this.deps.length;while(t--)this.deps[t].depend()},t.prototype.teardown=function(){if(this.vm&&!this.vm._isBeingDestroyed&&C(this.vm._scope.effects,this),this.active){var t=this.deps.length;while(t--)this.deps[t].removeSub(this);this.active=!1,this.onStop&&this.onStop()}},t}();function bn(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&xn(t,e)}function wn(t,e){_n.$on(t,e)}function Cn(t,e){_n.$off(t,e)}function $n(t,e){var n=_n;return function r(){var o=e.apply(null,arguments);null!==o&&n.$off(t,r)}}function xn(t,e,n){_n=t,ne(e,n||{},wn,Cn,$n,t),_n=void 0}function kn(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(o(t))for(var i=0,a=t.length;i<a;i++)r.$on(t[i],n);else(r._events[t]||(r._events[t]=[])).push(n),e.test(t)&&(r._hasHookEvent=!0);return r},t.prototype.$once=function(t,e){var n=this;function r(){n.$off(t,r),e.apply(n,arguments)}return r.fn=e,n.$on(t,r),n},t.prototype.$off=function(t,e){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(o(t)){for(var r=0,i=t.length;r<i;r++)n.$off(t[r],e);return n}var a,s=n._events[t];if(!s)return n;if(!e)return n._events[t]=null,n;var c=s.length;while(c--)if(a=s[c],a===e||a.fn===e){s.splice(c,1);break}return n},t.prototype.$emit=function(t){var e=this,n=e._events[t];if(n){n=n.length>1?N(n):n;for(var r=N(arguments,1),o='event handler for "'.concat(t,'"'),i=0,a=n.length;i<a;i++)Ze(n[i],e,r,e,o)}return e}}var On=null;function Sn(t){var e=On;return On=t,function(){On=e}}function jn(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){while(n.$options.abstract&&n.$parent)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._provided=n?n._provided:Object.create(null),t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}function Tn(t){t.prototype._update=function(t,e){var n=this,r=n.$el,o=n._vnode,i=Sn(n);n._vnode=t,n.$el=o?n.__patch__(o,t):n.__patch__(n.$el,t,e,!1),i(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n);var a=n;while(a&&a.$vnode&&a.$parent&&a.$vnode===a.$parent._vnode)a.$parent.$el=a.$el,a=a.$parent},t.prototype.$forceUpdate=function(){var t=this;t._watcher&&t._watcher.update()},t.prototype.$destroy=function(){var t=this;if(!t._isBeingDestroyed){Dn(t,"beforeDestroy"),t._isBeingDestroyed=!0;var e=t.$parent;!e||e._isBeingDestroyed||t.$options.abstract||C(e.$children,t),t._scope.stop(),t._data.__ob__&&t._data.__ob__.vmCount--,t._isDestroyed=!0,t.__patch__(t._vnode,null),Dn(t,"destroyed"),t.$off(),t.$el&&(t.$el.__vue__=null),t.$vnode&&(t.$vnode.parent=null)}}}function An(t,e,n){var r;t.$el=e,t.$options.render||(t.$options.render=gt),Dn(t,"beforeMount"),r=function(){t._update(t._render(),n)};var o={before:function(){t._isMounted&&!t._isDestroyed&&Dn(t,"beforeUpdate")}};new gn(t,r,L,o,!0),n=!1;var i=t._preWatchers;if(i)for(var a=0;a<i.length;a++)i[a].run();return null==t.$vnode&&(t._isMounted=!0,Dn(t,"mounted")),t}function En(t,e,n,o,i){var a=o.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==r&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key||!a&&t.$scopedSlots.$key),u=!!(i||t.$options._renderChildren||c),l=t.$vnode;t.$options._parentVnode=o,t.$vnode=o,t._vnode&&(t._vnode.parent=o),t.$options._renderChildren=i;var f=o.data.attrs||r;t._attrsProxy&&Pe(t._attrsProxy,f,l.data&&l.data.attrs||r,t,"$attrs")&&(u=!0),t.$attrs=f,n=n||r;var d=t.$options._parentListeners;if(t._listenersProxy&&Pe(t._listenersProxy,n,d||r,t,"$listeners"),t.$listeners=t.$options._parentListeners=n,xn(t,n,d),e&&t.$options.props){Dt(!1);for(var p=t._props,v=t.$options._propKeys||[],h=0;h<v.length;h++){var m=v[h],_=t.$options.props;p[m]=Or(m,_,e,t)}Dt(!0),t.$options.propsData=e}u&&(t.$slots=ke(i,o.context),t.$forceUpdate())}function In(t){while(t&&(t=t.$parent))if(t._inactive)return!0;return!1}function Pn(t,e){if(e){if(t._directInactive=!1,In(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(var n=0;n<t.$children.length;n++)Pn(t.$children[n]);Dn(t,"activated")}}function Nn(t,e){if((!e||(t._directInactive=!0,!In(t)))&&!t._inactive){t._inactive=!0;for(var n=0;n<t.$children.length;n++)Nn(t.$children[n]);Dn(t,"deactivated")}}function Dn(t,e,n,r){void 0===r&&(r=!0),St();var o=mt,i=Qt();r&&_t(t);var a=t.$options[e],s="".concat(e," hook");if(a)for(var c=0,u=a.length;c<u;c++)Ze(a[c],t,n||null,t,s);t._hasHookEvent&&t.$emit("hook:"+e),r&&(_t(o),i&&i.on()),jt()}var Mn=[],Ln=[],Fn={},Rn=!1,Un=!1,Bn=0;function Vn(){Bn=Mn.length=Ln.length=0,Fn={},Rn=Un=!1}var Hn=0,zn=Date.now;if(tt&&!nt){var Wn=window.performance;Wn&&"function"===typeof Wn.now&&zn()>document.createEvent("Event").timeStamp&&(zn=function(){return Wn.now()})}var qn=function(t,e){if(t.post){if(!e.post)return 1}else if(e.post)return-1;return t.id-e.id};function Kn(){var t,e;for(Hn=zn(),Un=!0,Mn.sort(qn),Bn=0;Bn<Mn.length;Bn++)t=Mn[Bn],t.before&&t.before(),e=t.id,Fn[e]=null,t.run();var n=Ln.slice(),r=Mn.slice();Vn(),Xn(n),Gn(r),xt(),dt&&K.devtools&&dt.emit("flush")}function Gn(t){var e=t.length;while(e--){var n=t[e],r=n.vm;r&&r._watcher===n&&r._isMounted&&!r._isDestroyed&&Dn(r,"updated")}}function Jn(t){t._inactive=!1,Ln.push(t)}function Xn(t){for(var e=0;e<t.length;e++)t[e]._inactive=!0,Pn(t[e],!0)}function Zn(t){var e=t.id;if(null==Fn[e]&&(t!==kt.target||!t.noRecurse)){if(Fn[e]=!0,Un){var n=Mn.length-1;while(n>Bn&&Mn[n].id>t.id)n--;Mn.splice(n+1,0,t)}else Mn.push(t);Rn||(Rn=!0,ln(Kn))}}function Qn(t){var e=t.$options.provide;if(e){var n=l(e)?e.call(t):e;if(!f(n))return;for(var r=Yt(t),o=ht?Reflect.ownKeys(n):Object.keys(n),i=0;i<o.length;i++){var a=o[i];Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(n,a))}}}function Yn(t){var e=tr(t.$options.inject,t);e&&(Dt(!1),Object.keys(e).forEach((function(n){Rt(t,n,e[n])})),Dt(!0))}function tr(t,e){if(t){for(var n=Object.create(null),r=ht?Reflect.ownKeys(t):Object.keys(t),o=0;o<r.length;o++){var i=r[o];if("__ob__"!==i){var a=t[i].from;if(a in e._provided)n[i]=e._provided[a];else if("default"in t[i]){var s=t[i].default;n[i]=l(s)?s.call(e):s}else 0}}return n}}function er(t,e,n,i,a){var c,u=this,l=a.options;x(i,"_uid")?(c=Object.create(i),c._original=i):(c=i,i=i._original);var f=s(l._compiled),d=!f;this.data=t,this.props=e,this.children=n,this.parent=i,this.listeners=t.on||r,this.injections=tr(l.inject,i),this.slots=function(){return u.$slots||je(i,t.scopedSlots,u.$slots=ke(n,i)),u.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return je(i,t.scopedSlots,this.slots())}}),f&&(this.$options=l,this.$slots=this.slots(),this.$scopedSlots=je(i,t.scopedSlots,this.$slots)),l._scopeId?this._c=function(t,e,n,r){var a=qe(c,t,e,n,r,d);return a&&!o(a)&&(a.fnScopeId=l._scopeId,a.fnContext=i),a}:this._c=function(t,e,n,r){return qe(c,t,e,n,r,d)}}function nr(t,e,n,i,s){var c=t.options,u={},l=c.props;if(a(l))for(var f in l)u[f]=Or(f,l,e||r);else a(n.attrs)&&or(u,n.attrs),a(n.props)&&or(u,n.props);var d=new er(n,u,s,i,t),p=c.render.call(null,d._c,d);if(p instanceof yt)return rr(p,n,d.parent,c,d);if(o(p)){for(var v=se(p)||[],h=new Array(v.length),m=0;m<v.length;m++)h[m]=rr(v[m],n,d.parent,c,d);return h}}function rr(t,e,n,r,o){var i=wt(t);return i.fnContext=n,i.fnOptions=r,e.slot&&((i.data||(i.data={})).slot=e.slot),i}function or(t,e){for(var n in e)t[S(n)]=e[n]}function ir(t){return t.name||t.__name||t._componentTag}xe(er.prototype);var ar={init:function(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){var n=t;ar.prepatch(n,n)}else{var r=t.componentInstance=ur(t,On);r.$mount(e?t.elm:void 0,e)}},prepatch:function(t,e){var n=e.componentOptions,r=e.componentInstance=t.componentInstance;En(r,n.propsData,n.listeners,e,n.children)},insert:function(t){var e=t.context,n=t.componentInstance;n._isMounted||(n._isMounted=!0,Dn(n,"mounted")),t.data.keepAlive&&(e._isMounted?Jn(n):Pn(n,!0))},destroy:function(t){var e=t.componentInstance;e._isDestroyed||(t.data.keepAlive?Nn(e,!0):e.$destroy())}},sr=Object.keys(ar);function cr(t,e,n,r,o){if(!i(t)){var c=n.$options._base;if(f(t)&&(t=c.extend(t)),"function"===typeof t){var u;if(i(t.cid)&&(u=t,t=Ve(u,c),void 0===t))return Be(u,e,n,r,o);e=e||{},Xr(t),a(e.model)&&dr(t.options,e);var l=oe(e,t,o);if(s(t.options.functional))return nr(t,l,e,n,r);var d=e.on;if(e.on=e.nativeOn,s(t.options.abstract)){var p=e.slot;e={},p&&(e.slot=p)}lr(e);var v=ir(t.options)||o,h=new yt("vue-component-".concat(t.cid).concat(v?"-".concat(v):""),e,void 0,void 0,void 0,n,{Ctor:t,propsData:l,listeners:d,tag:o,children:r},u);return h}}}function ur(t,e){var n={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;return a(r)&&(n.render=r.render,n.staticRenderFns=r.staticRenderFns),new t.componentOptions.Ctor(n)}function lr(t){for(var e=t.hook||(t.hook={}),n=0;n<sr.length;n++){var r=sr[n],o=e[r],i=ar[r];o===i||o&&o._merged||(e[r]=o?fr(i,o):i)}}function fr(t,e){var n=function(n,r){t(n,r),e(n,r)};return n._merged=!0,n}function dr(t,e){var n=t.model&&t.model.prop||"value",r=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[n]=e.model.value;var i=e.on||(e.on={}),s=i[r],c=e.model.callback;a(s)?(o(s)?-1===s.indexOf(c):s!==c)&&(i[r]=[c].concat(s)):i[r]=c}var pr=L,vr=K.optionMergeStrategies;function hr(t,e,n){if(void 0===n&&(n=!0),!e)return t;for(var r,o,i,a=ht?Reflect.ownKeys(e):Object.keys(e),s=0;s<a.length;s++)r=a[s],"__ob__"!==r&&(o=t[r],i=e[r],n&&x(t,r)?o!==i&&p(o)&&p(i)&&hr(o,i):Ut(t,r,i));return t}function mr(t,e,n){return n?function(){var r=l(e)?e.call(n,n):e,o=l(t)?t.call(n,n):t;return r?hr(r,o):o}:e?t?function(){return hr(l(e)?e.call(this,this):e,l(t)?t.call(this,this):t)}:e:t}function _r(t,e){var n=e?t?t.concat(e):o(e)?e:[e]:t;return n?yr(n):n}function yr(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}function gr(t,e,n,r){var o=Object.create(t||null);return e?D(o,e):o}vr.data=function(t,e,n){return n?mr(t,e,n):e&&"function"!==typeof e?t:mr(t,e)},q.forEach((function(t){vr[t]=_r})),W.forEach((function(t){vr[t+"s"]=gr})),vr.watch=function(t,e,n,r){if(t===ct&&(t=void 0),e===ct&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;var i={};for(var a in D(i,t),e){var s=i[a],c=e[a];s&&!o(s)&&(s=[s]),i[a]=s?s.concat(c):o(c)?c:[c]}return i},vr.props=vr.methods=vr.inject=vr.computed=function(t,e,n,r){if(!t)return e;var o=Object.create(null);return D(o,t),e&&D(o,e),o},vr.provide=function(t,e){return t?function(){var n=Object.create(null);return hr(n,l(t)?t.call(this):t),e&&hr(n,l(e)?e.call(this):e,!1),n}:e};var br=function(t,e){return void 0===e?t:e};function wr(t,e){var n=t.props;if(n){var r,i,a,s={};if(o(n)){r=n.length;while(r--)i=n[r],"string"===typeof i&&(a=S(i),s[a]={type:null})}else if(p(n))for(var c in n)i=n[c],a=S(c),s[a]=p(i)?i:{type:i};else 0;t.props=s}}function Cr(t,e){var n=t.inject;if(n){var r=t.inject={};if(o(n))for(var i=0;i<n.length;i++)r[n[i]]={from:n[i]};else if(p(n))for(var a in n){var s=n[a];r[a]=p(s)?D({from:a},s):{from:s}}else 0}}function $r(t){var e=t.directives;if(e)for(var n in e){var r=e[n];l(r)&&(e[n]={bind:r,update:r})}}function xr(t,e,n){if(l(e)&&(e=e.options),wr(e,n),Cr(e,n),$r(e),!e._base&&(e.extends&&(t=xr(t,e.extends,n)),e.mixins))for(var r=0,o=e.mixins.length;r<o;r++)t=xr(t,e.mixins[r],n);var i,a={};for(i in t)s(i);for(i in e)x(t,i)||s(i);function s(r){var o=vr[r]||br;a[r]=o(t[r],e[r],n,r)}return a}function kr(t,e,n,r){if("string"===typeof n){var o=t[e];if(x(o,n))return o[n];var i=S(n);if(x(o,i))return o[i];var a=j(i);if(x(o,a))return o[a];var s=o[n]||o[i]||o[a];return s}}function Or(t,e,n,r){var o=e[t],i=!x(n,t),a=n[t],s=Er(Boolean,o.type);if(s>-1)if(i&&!x(o,"default"))a=!1;else if(""===a||a===A(t)){var c=Er(String,o.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=Sr(r,o,t);var u=Nt;Dt(!0),Ft(a),Dt(u)}return a}function Sr(t,e,n){if(x(e,"default")){var r=e.default;return t&&t.$options.propsData&&void 0===t.$options.propsData[n]&&void 0!==t._props[n]?t._props[n]:l(r)&&"Function"!==Tr(e.type)?r.call(t):r}}var jr=/^\s*function (\w+)/;function Tr(t){var e=t&&t.toString().match(jr);return e?e[1]:""}function Ar(t,e){return Tr(t)===Tr(e)}function Er(t,e){if(!o(e))return Ar(e,t)?0:-1;for(var n=0,r=e.length;n<r;n++)if(Ar(e[n],t))return n;return-1}var Ir={enumerable:!0,configurable:!0,get:L,set:L};function Pr(t,e,n){Ir.get=function(){return this[e][n]},Ir.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Ir)}function Nr(t){var e=t.$options;if(e.props&&Dr(t,e.props),Ee(t),e.methods&&Hr(t,e.methods),e.data)Mr(t);else{var n=Ft(t._data={});n&&n.vmCount++}e.computed&&Rr(t,e.computed),e.watch&&e.watch!==ct&&zr(t,e.watch)}function Dr(t,e){var n=t.$options.propsData||{},r=t._props=Ht({}),o=t.$options._propKeys=[],i=!t.$parent;i||Dt(!1);var a=function(i){o.push(i);var a=Or(i,e,n,t);Rt(r,i,a,void 0,!0),i in t||Pr(t,"_props",i)};for(var s in e)a(s);Dt(!0)}function Mr(t){var e=t.$options.data;e=t._data=l(e)?Lr(e,t):e||{},p(e)||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);while(o--){var i=n[o];0,r&&x(r,i)||J(i)||Pr(t,"_data",i)}var a=Ft(e);a&&a.vmCount++}function Lr(t,e){St();try{return t.call(e,e)}catch(Ya){return Xe(Ya,e,"data()"),{}}finally{jt()}}var Fr={lazy:!0};function Rr(t,e){var n=t._computedWatchers=Object.create(null),r=ft();for(var o in e){var i=e[o],a=l(i)?i:i.get;0,r||(n[o]=new gn(t,a||L,L,Fr)),o in t||Ur(t,o,i)}}function Ur(t,e,n){var r=!ft();l(n)?(Ir.get=r?Br(e):Vr(n),Ir.set=L):(Ir.get=n.get?r&&!1!==n.cache?Br(e):Vr(n.get):L,Ir.set=n.set||L),Object.defineProperty(t,e,Ir)}function Br(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),kt.target&&e.depend(),e.value}}function Vr(t){return function(){return t.call(this,this)}}function Hr(t,e){t.$options.props;for(var n in e)t[n]="function"!==typeof e[n]?L:P(e[n],t)}function zr(t,e){for(var n in e){var r=e[n];if(o(r))for(var i=0;i<r.length;i++)Wr(t,n,r[i]);else Wr(t,n,r)}}function Wr(t,e,n,r){return p(n)&&(r=n,n=n.handler),"string"===typeof n&&(n=t[n]),t.$watch(e,n,r)}function qr(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Ut,t.prototype.$delete=Bt,t.prototype.$watch=function(t,e,n){var r=this;if(p(e))return Wr(r,t,e,n);n=n||{},n.user=!0;var o=new gn(r,t,e,n);if(n.immediate){var i='callback for immediate watcher "'.concat(o.expression,'"');St(),Ze(e,r,[o.value],r,i),jt()}return function(){o.teardown()}}}var Kr=0;function Gr(t){t.prototype._init=function(t){var e=this;e._uid=Kr++,e._isVue=!0,e.__v_skip=!0,e._scope=new Xt(!0),e._scope.parent=void 0,e._scope._vm=!0,t&&t._isComponent?Jr(e,t):e.$options=xr(Xr(e.constructor),t||{},e),e._renderProxy=e,e._self=e,jn(e),bn(e),Le(e),Dn(e,"beforeCreate",void 0,!1),Yn(e),Nr(e),Qn(e),Dn(e,"created"),e.$options.el&&e.$mount(e.$options.el)}}function Jr(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}function Xr(t){var e=t.options;if(t.super){var n=Xr(t.super),r=t.superOptions;if(n!==r){t.superOptions=n;var o=Zr(t);o&&D(t.extendOptions,o),e=t.options=xr(n,t.extendOptions),e.name&&(e.components[e.name]=t)}}return e}function Zr(t){var e,n=t.options,r=t.sealedOptions;for(var o in n)n[o]!==r[o]&&(e||(e={}),e[o]=n[o]);return e}function Qr(t){this._init(t)}function Yr(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=N(arguments,1);return n.unshift(this),l(t.install)?t.install.apply(t,n):l(t)&&t.apply(null,n),e.push(t),this}}function to(t){t.mixin=function(t){return this.options=xr(this.options,t),this}}function eo(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r=n.cid,o=t._Ctor||(t._Ctor={});if(o[r])return o[r];var i=ir(t)||ir(n.options);var a=function(t){this._init(t)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=e++,a.options=xr(n.options,t),a["super"]=n,a.options.props&&no(a),a.options.computed&&ro(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,W.forEach((function(t){a[t]=n[t]})),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=D({},a.options),o[r]=a,a}}function no(t){var e=t.options.props;for(var n in e)Pr(t.prototype,"_props",n)}function ro(t){var e=t.options.computed;for(var n in e)Ur(t.prototype,n,e[n])}function oo(t){W.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&p(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&l(n)&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}function io(t){return t&&(ir(t.Ctor.options)||t.tag)}function ao(t,e){return o(t)?t.indexOf(e)>-1:"string"===typeof t?t.split(",").indexOf(e)>-1:!!v(t)&&t.test(e)}function so(t,e){var n=t.cache,r=t.keys,o=t._vnode,i=t.$vnode;for(var a in n){var s=n[a];if(s){var c=s.name;c&&!e(c)&&co(n,a,r,o)}}i.componentOptions.children=void 0}function co(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,C(n,e)}Gr(Qr),qr(Qr),kn(Qr),Tn(Qr),Re(Qr);var uo=[String,RegExp,Array],lo={name:"keep-alive",abstract:!0,props:{include:uo,exclude:uo,max:[String,Number]},methods:{cacheVNode:function(){var t=this,e=t.cache,n=t.keys,r=t.vnodeToCache,o=t.keyToCache;if(r){var i=r.tag,a=r.componentInstance,s=r.componentOptions;e[o]={name:io(s),tag:i,componentInstance:a},n.push(o),this.max&&n.length>parseInt(this.max)&&co(e,n[0],n,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)co(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",(function(e){so(t,(function(t){return ao(e,t)}))})),this.$watch("exclude",(function(e){so(t,(function(t){return!ao(e,t)}))}))},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=He(t),n=e&&e.componentOptions;if(n){var r=io(n),o=this,i=o.include,a=o.exclude;if(i&&(!r||!ao(i,r))||a&&r&&ao(a,r))return e;var s=this,c=s.cache,u=s.keys,l=null==e.key?n.Ctor.cid+(n.tag?"::".concat(n.tag):""):e.key;c[l]?(e.componentInstance=c[l].componentInstance,C(u,l),u.push(l)):(this.vnodeToCache=e,this.keyToCache=l),e.data.keepAlive=!0}return e||t&&t[0]}},fo={KeepAlive:lo};function po(t){var e={get:function(){return K}};Object.defineProperty(t,"config",e),t.util={warn:pr,extend:D,mergeOptions:xr,defineReactive:Rt},t.set=Ut,t.delete=Bt,t.nextTick=ln,t.observable=function(t){return Ft(t),t},t.options=Object.create(null),W.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,D(t.options.components,fo),Yr(t),to(t),eo(t),oo(t)}po(Qr),Object.defineProperty(Qr.prototype,"$isServer",{get:ft}),Object.defineProperty(Qr.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Qr,"FunctionalRenderContext",{value:er}),Qr.version=pn;var vo=b("style,class"),ho=b("input,textarea,option,select,progress"),mo=function(t,e,n){return"value"===n&&ho(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},_o=b("contenteditable,draggable,spellcheck"),yo=b("events,caret,typing,plaintext-only"),go=function(t,e){return xo(e)||"false"===e?"false":"contenteditable"===t&&yo(e)?e:"true"},bo=b("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),wo="http://www.w3.org/1999/xlink",Co=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},$o=function(t){return Co(t)?t.slice(6,t.length):""},xo=function(t){return null==t||!1===t};function ko(t){var e=t.data,n=t,r=t;while(a(r.componentInstance))r=r.componentInstance._vnode,r&&r.data&&(e=Oo(r.data,e));while(a(n=n.parent))n&&n.data&&(e=Oo(e,n.data));return So(e.staticClass,e.class)}function Oo(t,e){return{staticClass:jo(t.staticClass,e.staticClass),class:a(t.class)?[t.class,e.class]:e.class}}function So(t,e){return a(t)||a(e)?jo(t,To(e)):""}function jo(t,e){return t?e?t+" "+e:t:e||""}function To(t){return Array.isArray(t)?Ao(t):f(t)?Eo(t):"string"===typeof t?t:""}function Ao(t){for(var e,n="",r=0,o=t.length;r<o;r++)a(e=To(t[r]))&&""!==e&&(n&&(n+=" "),n+=e);return n}function Eo(t){var e="";for(var n in t)t[n]&&(e&&(e+=" "),e+=n);return e}var Io={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Po=b("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),No=b("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Do=function(t){return Po(t)||No(t)};function Mo(t){return No(t)?"svg":"math"===t?"math":void 0}var Lo=Object.create(null);function Fo(t){if(!tt)return!0;if(Do(t))return!1;if(t=t.toLowerCase(),null!=Lo[t])return Lo[t];var e=document.createElement(t);return t.indexOf("-")>-1?Lo[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Lo[t]=/HTMLUnknownElement/.test(e.toString())}var Ro=b("text,number,password,search,email,tel,url");function Uo(t){if("string"===typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}function Bo(t,e){var n=document.createElement(t);return"select"!==t||e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n}function Vo(t,e){return document.createElementNS(Io[t],e)}function Ho(t){return document.createTextNode(t)}function zo(t){return document.createComment(t)}function Wo(t,e,n){t.insertBefore(e,n)}function qo(t,e){t.removeChild(e)}function Ko(t,e){t.appendChild(e)}function Go(t){return t.parentNode}function Jo(t){return t.nextSibling}function Xo(t){return t.tagName}function Zo(t,e){t.textContent=e}function Qo(t,e){t.setAttribute(e,"")}var Yo=Object.freeze({__proto__:null,createElement:Bo,createElementNS:Vo,createTextNode:Ho,createComment:zo,insertBefore:Wo,removeChild:qo,appendChild:Ko,parentNode:Go,nextSibling:Jo,tagName:Xo,setTextContent:Zo,setStyleScope:Qo}),ti={create:function(t,e){ei(e)},update:function(t,e){t.data.ref!==e.data.ref&&(ei(t,!0),ei(e))},destroy:function(t){ei(t,!0)}};function ei(t,e){var n=t.data.ref;if(a(n)){var r=t.context,i=t.componentInstance||t.elm,s=e?null:i,c=e?void 0:i;if(l(n))Ze(n,r,[s],r,"template ref function");else{var u=t.data.refInFor,f="string"===typeof n||"number"===typeof n,d=qt(n),p=r.$refs;if(f||d)if(u){var v=f?p[n]:n.value;e?o(v)&&C(v,i):o(v)?v.includes(i)||v.push(i):f?(p[n]=[i],ni(r,n,p[n])):n.value=[i]}else if(f){if(e&&p[n]!==i)return;p[n]=c,ni(r,n,s)}else if(d){if(e&&n.value!==i)return;n.value=s}else 0}}}function ni(t,e,n){var r=t._setupState;r&&x(r,e)&&(qt(r[e])?r[e].value=n:r[e]=n)}var ri=new yt("",{},[]),oi=["create","activate","update","remove","destroy"];function ii(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&(t.tag===e.tag&&t.isComment===e.isComment&&a(t.data)===a(e.data)&&ai(t,e)||s(t.isAsyncPlaceholder)&&i(e.asyncFactory.error))}function ai(t,e){if("input"!==t.tag)return!0;var n,r=a(n=t.data)&&a(n=n.attrs)&&n.type,o=a(n=e.data)&&a(n=n.attrs)&&n.type;return r===o||Ro(r)&&Ro(o)}function si(t,e,n){var r,o,i={};for(r=e;r<=n;++r)o=t[r].key,a(o)&&(i[o]=r);return i}function ci(t){var e,n,r={},c=t.modules,l=t.nodeOps;for(e=0;e<oi.length;++e)for(r[oi[e]]=[],n=0;n<c.length;++n)a(c[n][oi[e]])&&r[oi[e]].push(c[n][oi[e]]);function f(t){return new yt(l.tagName(t).toLowerCase(),{},[],void 0,t)}function d(t,e){function n(){0===--n.listeners&&p(t)}return n.listeners=e,n}function p(t){var e=l.parentNode(t);a(e)&&l.removeChild(e,t)}function v(t,e,n,r,o,i,c){if(a(t.elm)&&a(i)&&(t=i[c]=wt(t)),t.isRootInsert=!o,!h(t,e,n,r)){var u=t.data,f=t.children,d=t.tag;a(d)?(t.elm=t.ns?l.createElementNS(t.ns,d):l.createElement(d,t),$(t),g(t,f,e),a(u)&&C(t,e),y(n,t.elm,r)):s(t.isComment)?(t.elm=l.createComment(t.text),y(n,t.elm,r)):(t.elm=l.createTextNode(t.text),y(n,t.elm,r))}}function h(t,e,n,r){var o=t.data;if(a(o)){var i=a(t.componentInstance)&&o.keepAlive;if(a(o=o.hook)&&a(o=o.init)&&o(t,!1),a(t.componentInstance))return m(t,e),y(n,t.elm,r),s(i)&&_(t,e,n,r),!0}}function m(t,e){a(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,w(t)?(C(t,e),$(t)):(ei(t),e.push(t))}function _(t,e,n,o){var i,s=t;while(s.componentInstance)if(s=s.componentInstance._vnode,a(i=s.data)&&a(i=i.transition)){for(i=0;i<r.activate.length;++i)r.activate[i](ri,s);e.push(s);break}y(n,t.elm,o)}function y(t,e,n){a(t)&&(a(n)?l.parentNode(n)===t&&l.insertBefore(t,e,n):l.appendChild(t,e))}function g(t,e,n){if(o(e)){0;for(var r=0;r<e.length;++r)v(e[r],n,t.elm,null,!0,e,r)}else u(t.text)&&l.appendChild(t.elm,l.createTextNode(String(t.text)))}function w(t){while(t.componentInstance)t=t.componentInstance._vnode;return a(t.tag)}function C(t,n){for(var o=0;o<r.create.length;++o)r.create[o](ri,t);e=t.data.hook,a(e)&&(a(e.create)&&e.create(ri,t),a(e.insert)&&n.push(t))}function $(t){var e;if(a(e=t.fnScopeId))l.setStyleScope(t.elm,e);else{var n=t;while(n)a(e=n.context)&&a(e=e.$options._scopeId)&&l.setStyleScope(t.elm,e),n=n.parent}a(e=On)&&e!==t.context&&e!==t.fnContext&&a(e=e.$options._scopeId)&&l.setStyleScope(t.elm,e)}function x(t,e,n,r,o,i){for(;r<=o;++r)v(n[r],i,t,e,!1,n,r)}function k(t){var e,n,o=t.data;if(a(o))for(a(e=o.hook)&&a(e=e.destroy)&&e(t),e=0;e<r.destroy.length;++e)r.destroy[e](t);if(a(e=t.children))for(n=0;n<t.children.length;++n)k(t.children[n])}function O(t,e,n){for(;e<=n;++e){var r=t[e];a(r)&&(a(r.tag)?(S(r),k(r)):p(r.elm))}}function S(t,e){if(a(e)||a(t.data)){var n,o=r.remove.length+1;for(a(e)?e.listeners+=o:e=d(t.elm,o),a(n=t.componentInstance)&&a(n=n._vnode)&&a(n.data)&&S(n,e),n=0;n<r.remove.length;++n)r.remove[n](t,e);a(n=t.data.hook)&&a(n=n.remove)?n(t,e):e()}else p(t.elm)}function j(t,e,n,r,o){var s,c,u,f,d=0,p=0,h=e.length-1,m=e[0],_=e[h],y=n.length-1,g=n[0],b=n[y],w=!o;while(d<=h&&p<=y)i(m)?m=e[++d]:i(_)?_=e[--h]:ii(m,g)?(A(m,g,r,n,p),m=e[++d],g=n[++p]):ii(_,b)?(A(_,b,r,n,y),_=e[--h],b=n[--y]):ii(m,b)?(A(m,b,r,n,y),w&&l.insertBefore(t,m.elm,l.nextSibling(_.elm)),m=e[++d],b=n[--y]):ii(_,g)?(A(_,g,r,n,p),w&&l.insertBefore(t,_.elm,m.elm),_=e[--h],g=n[++p]):(i(s)&&(s=si(e,d,h)),c=a(g.key)?s[g.key]:T(g,e,d,h),i(c)?v(g,r,t,m.elm,!1,n,p):(u=e[c],ii(u,g)?(A(u,g,r,n,p),e[c]=void 0,w&&l.insertBefore(t,u.elm,m.elm)):v(g,r,t,m.elm,!1,n,p)),g=n[++p]);d>h?(f=i(n[y+1])?null:n[y+1].elm,x(t,f,n,p,y,r)):p>y&&O(e,d,h)}function T(t,e,n,r){for(var o=n;o<r;o++){var i=e[o];if(a(i)&&ii(t,i))return o}}function A(t,e,n,o,c,u){if(t!==e){a(e.elm)&&a(o)&&(e=o[c]=wt(e));var f=e.elm=t.elm;if(s(t.isAsyncPlaceholder))a(e.asyncFactory.resolved)?P(t.elm,e,n):e.isAsyncPlaceholder=!0;else if(s(e.isStatic)&&s(t.isStatic)&&e.key===t.key&&(s(e.isCloned)||s(e.isOnce)))e.componentInstance=t.componentInstance;else{var d,p=e.data;a(p)&&a(d=p.hook)&&a(d=d.prepatch)&&d(t,e);var v=t.children,h=e.children;if(a(p)&&w(e)){for(d=0;d<r.update.length;++d)r.update[d](t,e);a(d=p.hook)&&a(d=d.update)&&d(t,e)}i(e.text)?a(v)&&a(h)?v!==h&&j(f,v,h,n,u):a(h)?(a(t.text)&&l.setTextContent(f,""),x(f,null,h,0,h.length-1,n)):a(v)?O(v,0,v.length-1):a(t.text)&&l.setTextContent(f,""):t.text!==e.text&&l.setTextContent(f,e.text),a(p)&&a(d=p.hook)&&a(d=d.postpatch)&&d(t,e)}}}function E(t,e,n){if(s(n)&&a(t.parent))t.parent.data.pendingInsert=e;else for(var r=0;r<e.length;++r)e[r].data.hook.insert(e[r])}var I=b("attrs,class,staticClass,staticStyle,key");function P(t,e,n,r){var o,i=e.tag,c=e.data,u=e.children;if(r=r||c&&c.pre,e.elm=t,s(e.isComment)&&a(e.asyncFactory))return e.isAsyncPlaceholder=!0,!0;if(a(c)&&(a(o=c.hook)&&a(o=o.init)&&o(e,!0),a(o=e.componentInstance)))return m(e,n),!0;if(a(i)){if(a(u))if(t.hasChildNodes())if(a(o=c)&&a(o=o.domProps)&&a(o=o.innerHTML)){if(o!==t.innerHTML)return!1}else{for(var l=!0,f=t.firstChild,d=0;d<u.length;d++){if(!f||!P(f,u[d],n,r)){l=!1;break}f=f.nextSibling}if(!l||f)return!1}else g(e,u,n);if(a(c)){var p=!1;for(var v in c)if(!I(v)){p=!0,C(e,n);break}!p&&c["class"]&&hn(c["class"])}}else t.data!==e.text&&(t.data=e.text);return!0}return function(t,e,n,o){if(!i(e)){var c=!1,u=[];if(i(t))c=!0,v(e,u);else{var d=a(t.nodeType);if(!d&&ii(t,e))A(t,e,u,null,null,o);else{if(d){if(1===t.nodeType&&t.hasAttribute(z)&&(t.removeAttribute(z),n=!0),s(n)&&P(t,e,u))return E(e,u,!0),t;t=f(t)}var p=t.elm,h=l.parentNode(p);if(v(e,u,p._leaveCb?null:h,l.nextSibling(p)),a(e.parent)){var m=e.parent,_=w(e);while(m){for(var y=0;y<r.destroy.length;++y)r.destroy[y](m);if(m.elm=e.elm,_){for(var g=0;g<r.create.length;++g)r.create[g](ri,m);var b=m.data.hook.insert;if(b.merged)for(var C=b.fns.slice(1),$=0;$<C.length;$++)C[$]()}else ei(m);m=m.parent}}a(h)?O([t],0,0):a(t.tag)&&k(t)}}return E(e,u,c),e.elm}a(t)&&k(t)}}var ui={create:li,update:li,destroy:function(t){li(t,ri)}};function li(t,e){(t.data.directives||e.data.directives)&&fi(t,e)}function fi(t,e){var n,r,o,i=t===ri,a=e===ri,s=pi(t.data.directives,t.context),c=pi(e.data.directives,e.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,hi(o,"update",e,t),o.def&&o.def.componentUpdated&&l.push(o)):(hi(o,"bind",e,t),o.def&&o.def.inserted&&u.push(o));if(u.length){var f=function(){for(var n=0;n<u.length;n++)hi(u[n],"inserted",e,t)};i?re(e,"insert",f):f()}if(l.length&&re(e,"postpatch",(function(){for(var n=0;n<l.length;n++)hi(l[n],"componentUpdated",e,t)})),!i)for(n in s)c[n]||hi(s[n],"unbind",t,t,a)}var di=Object.create(null);function pi(t,e){var n,r,o=Object.create(null);if(!t)return o;for(n=0;n<t.length;n++){if(r=t[n],r.modifiers||(r.modifiers=di),o[vi(r)]=r,e._setupState&&e._setupState.__sfc){var i=r.def||kr(e,"_setupState","v-"+r.name);r.def="function"===typeof i?{bind:i,update:i}:i}r.def=r.def||kr(e.$options,"directives",r.name,!0)}return o}function vi(t){return t.rawName||"".concat(t.name,".").concat(Object.keys(t.modifiers||{}).join("."))}function hi(t,e,n,r,o){var i=t.def&&t.def[e];if(i)try{i(n.elm,t,n,r,o)}catch(Ya){Xe(Ya,n.context,"directive ".concat(t.name," ").concat(e," hook"))}}var mi=[ti,ui];function _i(t,e){var n=e.componentOptions;if((!a(n)||!1!==n.Ctor.options.inheritAttrs)&&(!i(t.data.attrs)||!i(e.data.attrs))){var r,o,c,u=e.elm,l=t.data.attrs||{},f=e.data.attrs||{};for(r in(a(f.__ob__)||s(f._v_attr_proxy))&&(f=e.data.attrs=D({},f)),f)o=f[r],c=l[r],c!==o&&yi(u,r,o,e.data.pre);for(r in(nt||ot)&&f.value!==l.value&&yi(u,"value",f.value),l)i(f[r])&&(Co(r)?u.removeAttributeNS(wo,$o(r)):_o(r)||u.removeAttribute(r))}}function yi(t,e,n,r){r||t.tagName.indexOf("-")>-1?gi(t,e,n):bo(e)?xo(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):_o(e)?t.setAttribute(e,go(e,n)):Co(e)?xo(n)?t.removeAttributeNS(wo,$o(e)):t.setAttributeNS(wo,e,n):gi(t,e,n)}function gi(t,e,n){if(xo(n))t.removeAttribute(e);else{if(nt&&!rt&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var bi={create:_i,update:_i};function wi(t,e){var n=e.elm,r=e.data,o=t.data;if(!(i(r.staticClass)&&i(r.class)&&(i(o)||i(o.staticClass)&&i(o.class)))){var s=ko(e),c=n._transitionClasses;a(c)&&(s=jo(s,To(c))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Ci,$i={create:wi,update:wi},xi="__r",ki="__c";function Oi(t){if(a(t[xi])){var e=nt?"change":"input";t[e]=[].concat(t[xi],t[e]||[]),delete t[xi]}a(t[ki])&&(t.change=[].concat(t[ki],t.change||[]),delete t[ki])}function Si(t,e,n){var r=Ci;return function o(){var i=e.apply(null,arguments);null!==i&&Ai(t,o,n,r)}}var ji=en&&!(st&&Number(st[1])<=53);function Ti(t,e,n,r){if(ji){var o=Hn,i=e;e=i._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=o||t.timeStamp<=0||t.target.ownerDocument!==document)return i.apply(this,arguments)}}Ci.addEventListener(t,e,ut?{capture:n,passive:r}:n)}function Ai(t,e,n,r){(r||Ci).removeEventListener(t,e._wrapper||e,n)}function Ei(t,e){if(!i(t.data.on)||!i(e.data.on)){var n=e.data.on||{},r=t.data.on||{};Ci=e.elm||t.elm,Oi(n),ne(n,r,Ti,Ai,Si,e.context),Ci=void 0}}var Ii,Pi={create:Ei,update:Ei,destroy:function(t){return Ei(t,ri)}};function Ni(t,e){if(!i(t.data.domProps)||!i(e.data.domProps)){var n,r,o=e.elm,c=t.data.domProps||{},u=e.data.domProps||{};for(n in(a(u.__ob__)||s(u._v_attr_proxy))&&(u=e.data.domProps=D({},u)),c)n in u||(o[n]="");for(n in u){if(r=u[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),r===c[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var l=i(r)?"":String(r);Di(o,l)&&(o.value=l)}else if("innerHTML"===n&&No(o.tagName)&&i(o.innerHTML)){Ii=Ii||document.createElement("div"),Ii.innerHTML="<svg>".concat(r,"</svg>");var f=Ii.firstChild;while(o.firstChild)o.removeChild(o.firstChild);while(f.firstChild)o.appendChild(f.firstChild)}else if(r!==c[n])try{o[n]=r}catch(Ya){}}}}function Di(t,e){return!t.composing&&("OPTION"===t.tagName||Mi(t,e)||Li(t,e))}function Mi(t,e){var n=!0;try{n=document.activeElement!==t}catch(Ya){}return n&&t.value!==e}function Li(t,e){var n=t.value,r=t._vModifiers;if(a(r)){if(r.number)return g(n)!==g(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}var Fi={create:Ni,update:Ni},Ri=k((function(t){var e={},n=/;(?![^(]*\))/g,r=/:(.+)/;return t.split(n).forEach((function(t){if(t){var n=t.split(r);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}));function Ui(t){var e=Bi(t.style);return t.staticStyle?D(t.staticStyle,e):e}function Bi(t){return Array.isArray(t)?M(t):"string"===typeof t?Ri(t):t}function Vi(t,e){var n,r={};if(e){var o=t;while(o.componentInstance)o=o.componentInstance._vnode,o&&o.data&&(n=Ui(o.data))&&D(r,n)}(n=Ui(t.data))&&D(r,n);var i=t;while(i=i.parent)i.data&&(n=Ui(i.data))&&D(r,n);return r}var Hi,zi=/^--/,Wi=/\s*!important$/,qi=function(t,e,n){if(zi.test(e))t.style.setProperty(e,n);else if(Wi.test(n))t.style.setProperty(A(e),n.replace(Wi,""),"important");else{var r=Gi(e);if(Array.isArray(n))for(var o=0,i=n.length;o<i;o++)t.style[r]=n[o];else t.style[r]=n}},Ki=["Webkit","Moz","ms"],Gi=k((function(t){if(Hi=Hi||document.createElement("div").style,t=S(t),"filter"!==t&&t in Hi)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n<Ki.length;n++){var r=Ki[n]+e;if(r in Hi)return r}}));function Ji(t,e){var n=e.data,r=t.data;if(!(i(n.staticStyle)&&i(n.style)&&i(r.staticStyle)&&i(r.style))){var o,s,c=e.elm,u=r.staticStyle,l=r.normalizedStyle||r.style||{},f=u||l,d=Bi(e.data.style)||{};e.data.normalizedStyle=a(d.__ob__)?D({},d):d;var p=Vi(e,!0);for(s in f)i(p[s])&&qi(c,s,"");for(s in p)o=p[s],qi(c,s,null==o?"":o)}}var Xi={create:Ji,update:Ji},Zi=/\s+/;function Qi(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Zi).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" ".concat(t.getAttribute("class")||""," ");n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Yi(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Zi).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{var n=" ".concat(t.getAttribute("class")||""," "),r=" "+e+" ";while(n.indexOf(r)>=0)n=n.replace(r," ");n=n.trim(),n?t.setAttribute("class",n):t.removeAttribute("class")}}function ta(t){if(t){if("object"===typeof t){var e={};return!1!==t.css&&D(e,ea(t.name||"v")),D(e,t),e}return"string"===typeof t?ea(t):void 0}}var ea=k((function(t){return{enterClass:"".concat(t,"-enter"),enterToClass:"".concat(t,"-enter-to"),enterActiveClass:"".concat(t,"-enter-active"),leaveClass:"".concat(t,"-leave"),leaveToClass:"".concat(t,"-leave-to"),leaveActiveClass:"".concat(t,"-leave-active")}})),na=tt&&!rt,ra="transition",oa="animation",ia="transition",aa="transitionend",sa="animation",ca="animationend";na&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ia="WebkitTransition",aa="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(sa="WebkitAnimation",ca="webkitAnimationEnd"));var ua=tt?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function la(t){ua((function(){ua(t)}))}function fa(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Qi(t,e))}function da(t,e){t._transitionClasses&&C(t._transitionClasses,e),Yi(t,e)}function pa(t,e,n){var r=ha(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===ra?aa:ca,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout((function(){c<a&&u()}),i+1),t.addEventListener(s,l)}var va=/\b(transform|all)(,|$)/;function ha(t,e){var n,r=window.getComputedStyle(t),o=(r[ia+"Delay"]||"").split(", "),i=(r[ia+"Duration"]||"").split(", "),a=ma(o,i),s=(r[sa+"Delay"]||"").split(", "),c=(r[sa+"Duration"]||"").split(", "),u=ma(s,c),l=0,f=0;e===ra?a>0&&(n=ra,l=a,f=i.length):e===oa?u>0&&(n=oa,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?ra:oa:null,f=n?n===ra?i.length:c.length:0);var d=n===ra&&va.test(r[ia+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:d}}function ma(t,e){while(t.length<e.length)t=t.concat(t);return Math.max.apply(null,e.map((function(e,n){return _a(e)+_a(t[n])})))}function _a(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function ya(t,e){var n=t.elm;a(n._leaveCb)&&(n._leaveCb.cancelled=!0,n._leaveCb());var r=ta(t.data.transition);if(!i(r)&&!a(n._enterCb)&&1===n.nodeType){var o=r.css,s=r.type,c=r.enterClass,u=r.enterToClass,d=r.enterActiveClass,p=r.appearClass,v=r.appearToClass,h=r.appearActiveClass,m=r.beforeEnter,_=r.enter,y=r.afterEnter,b=r.enterCancelled,w=r.beforeAppear,C=r.appear,$=r.afterAppear,x=r.appearCancelled,k=r.duration,O=On,S=On.$vnode;while(S&&S.parent)O=S.context,S=S.parent;var j=!O._isMounted||!t.isRootInsert;if(!j||C||""===C){var T=j&&p?p:c,A=j&&h?h:d,E=j&&v?v:u,I=j&&w||m,P=j&&l(C)?C:_,N=j&&$||y,D=j&&x||b,M=g(f(k)?k.enter:k);0;var L=!1!==o&&!rt,F=wa(P),R=n._enterCb=V((function(){L&&(da(n,E),da(n,A)),R.cancelled?(L&&da(n,T),D&&D(n)):N&&N(n),n._enterCb=null}));t.data.show||re(t,"insert",(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];r&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),P&&P(n,R)})),I&&I(n),L&&(fa(n,T),fa(n,A),la((function(){da(n,T),R.cancelled||(fa(n,E),F||(ba(M)?setTimeout(R,M):pa(n,s,R)))}))),t.data.show&&(e&&e(),P&&P(n,R)),L||F||R()}}}function ga(t,e){var n=t.elm;a(n._enterCb)&&(n._enterCb.cancelled=!0,n._enterCb());var r=ta(t.data.transition);if(i(r)||1!==n.nodeType)return e();if(!a(n._leaveCb)){var o=r.css,s=r.type,c=r.leaveClass,u=r.leaveToClass,l=r.leaveActiveClass,d=r.beforeLeave,p=r.leave,v=r.afterLeave,h=r.leaveCancelled,m=r.delayLeave,_=r.duration,y=!1!==o&&!rt,b=wa(p),w=g(f(_)?_.leave:_);0;var C=n._leaveCb=V((function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[t.key]=null),y&&(da(n,u),da(n,l)),C.cancelled?(y&&da(n,c),h&&h(n)):(e(),v&&v(n)),n._leaveCb=null}));m?m($):$()}function $(){C.cancelled||(!t.data.show&&n.parentNode&&((n.parentNode._pending||(n.parentNode._pending={}))[t.key]=t),d&&d(n),y&&(fa(n,c),fa(n,l),la((function(){da(n,c),C.cancelled||(fa(n,u),b||(ba(w)?setTimeout(C,w):pa(n,s,C)))}))),p&&p(n,C),y||b||C())}}function ba(t){return"number"===typeof t&&!isNaN(t)}function wa(t){if(i(t))return!1;var e=t.fns;return a(e)?wa(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function Ca(t,e){!0!==e.data.show&&ya(e)}var $a=tt?{create:Ca,activate:Ca,remove:function(t,e){!0!==t.data.show?ga(t,e):e()}}:{},xa=[bi,$i,Pi,Fi,Xi,$a],ka=xa.concat(mi),Oa=ci({nodeOps:Yo,modules:ka});rt&&document.addEventListener("selectionchange",(function(){var t=document.activeElement;t&&t.vmodel&&Na(t,"input")}));var Sa={inserted:function(t,e,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?re(n,"postpatch",(function(){Sa.componentUpdated(t,e,n)})):ja(t,e,n.context),t._vOptions=[].map.call(t.options,Ea)):("textarea"===n.tag||Ro(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",Ia),t.addEventListener("compositionend",Pa),t.addEventListener("change",Pa),rt&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){ja(t,e,n.context);var r=t._vOptions,o=t._vOptions=[].map.call(t.options,Ea);if(o.some((function(t,e){return!U(t,r[e])}))){var i=t.multiple?e.value.some((function(t){return Aa(t,o)})):e.value!==e.oldValue&&Aa(e.value,o);i&&Na(t,"change")}}}};function ja(t,e,n){Ta(t,e,n),(nt||ot)&&setTimeout((function(){Ta(t,e,n)}),0)}function Ta(t,e,n){var r=e.value,o=t.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,c=t.options.length;s<c;s++)if(a=t.options[s],o)i=B(r,Ea(a))>-1,a.selected!==i&&(a.selected=i);else if(U(Ea(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function Aa(t,e){return e.every((function(e){return!U(e,t)}))}function Ea(t){return"_value"in t?t._value:t.value}function Ia(t){t.target.composing=!0}function Pa(t){t.target.composing&&(t.target.composing=!1,Na(t.target,"input"))}function Na(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Da(t){return!t.componentInstance||t.data&&t.data.transition?t:Da(t.componentInstance._vnode)}var Ma={bind:function(t,e,n){var r=e.value;n=Da(n);var o=n.data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,ya(n,(function(){t.style.display=i}))):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value,o=e.oldValue;if(!r!==!o){n=Da(n);var i=n.data&&n.data.transition;i?(n.data.show=!0,r?ya(n,(function(){t.style.display=t.__vOriginalDisplay})):ga(n,(function(){t.style.display="none"}))):t.style.display=r?t.__vOriginalDisplay:"none"}},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}},La={model:Sa,show:Ma},Fa={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Ra(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Ra(He(e.children)):t}function Ua(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var r in o)e[S(r)]=o[r];return e}function Ba(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function Va(t){while(t=t.parent)if(t.data.transition)return!0}function Ha(t,e){return e.key===t.key&&e.tag===t.tag}var za=function(t){return t.tag||Se(t)},Wa=function(t){return"show"===t.name},qa={name:"transition",props:Fa,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(za),n.length)){0;var r=this.mode;0;var o=n[0];if(Va(this.$vnode))return o;var i=Ra(o);if(!i)return o;if(this._leaving)return Ba(t,o);var a="__transition-".concat(this._uid,"-");i.key=null==i.key?i.isComment?a+"comment":a+i.tag:u(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=Ua(this),c=this._vnode,l=Ra(c);if(i.data.directives&&i.data.directives.some(Wa)&&(i.data.show=!0),l&&l.data&&!Ha(i,l)&&!Se(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=D({},s);if("out-in"===r)return this._leaving=!0,re(f,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Ba(t,o);if("in-out"===r){if(Se(i))return c;var d,p=function(){d()};re(s,"afterEnter",p),re(s,"enterCancelled",p),re(f,"delayLeave",(function(t){d=t}))}}return o}}},Ka=D({tag:String,moveClass:String},Fa);delete Ka.mode;var Ga={props:Ka,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Sn(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=Ua(this),s=0;s<o.length;s++){var c=o[s];if(c.tag)if(null!=c.key&&0!==String(c.key).indexOf("__vlist"))i.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a;else;}if(r){var u=[],l=[];for(s=0;s<r.length;s++){c=r[s];c.data.transition=a,c.data.pos=c.elm.getBoundingClientRect(),n[c.key]?u.push(c):l.push(c)}this.kept=t(e,null,u),this.removed=l}return t(e,null,i)},updated:function(){var t=this.prevChildren,e=this.moveClass||(this.name||"v")+"-move";t.length&&this.hasMove(t[0].elm,e)&&(t.forEach(Ja),t.forEach(Xa),t.forEach(Za),this._reflow=document.body.offsetHeight,t.forEach((function(t){if(t.data.moved){var n=t.elm,r=n.style;fa(n,e),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(aa,n._moveCb=function t(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(aa,t),n._moveCb=null,da(n,e))})}})))},methods:{hasMove:function(t,e){if(!na)return!1;if(this._hasMove)return this._hasMove;var n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach((function(t){Yi(n,t)})),Qi(n,e),n.style.display="none",this.$el.appendChild(n);var r=ha(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}};function Ja(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function Xa(t){t.data.newPos=t.elm.getBoundingClientRect()}function Za(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate(".concat(r,"px,").concat(o,"px)"),i.transitionDuration="0s"}}var Qa={Transition:qa,TransitionGroup:Ga};Qr.config.mustUseProp=mo,Qr.config.isReservedTag=Do,Qr.config.isReservedAttr=vo,Qr.config.getTagNamespace=Mo,Qr.config.isUnknownElement=Fo,D(Qr.options.directives,La),D(Qr.options.components,Qa),Qr.prototype.__patch__=tt?Oa:L,Qr.prototype.$mount=function(t,e){return t=t&&tt?Uo(t):void 0,An(this,t,e)},tt&&setTimeout((function(){K.devtools&&dt&&dt.emit("init",Qr)}),0)}).call(this,n("c8ba"))},"499e":function(t,e,n){"use strict";function r(t,e){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],a=i[0],s=i[1],c=i[2],u=i[3],l={id:t+":"+o,css:s,media:c,sourceMap:u};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}n.r(e),n.d(e,"default",(function(){return v}));var o="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var i={},a=o&&(document.head||document.getElementsByTagName("head")[0]),s=null,c=0,u=!1,l=function(){},f=null,d="data-vue-ssr-id",p="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function v(t,e,n,o){u=n,f=o||{};var a=r(t,e);return h(a),function(e){for(var n=[],o=0;o<a.length;o++){var s=a[o],c=i[s.id];c.refs--,n.push(c)}e?(a=r(t,e),h(a)):a=[];for(o=0;o<n.length;o++){c=n[o];if(0===c.refs){for(var u=0;u<c.parts.length;u++)c.parts[u]();delete i[c.id]}}}}function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=i[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(_(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var a=[];for(o=0;o<n.parts.length;o++)a.push(_(n.parts[o]));i[n.id]={id:n.id,refs:1,parts:a}}}}function m(){var t=document.createElement("style");return t.type="text/css",a.appendChild(t),t}function _(t){var e,n,r=document.querySelector("style["+d+'~="'+t.id+'"]');if(r){if(u)return l;r.parentNode.removeChild(r)}if(p){var o=c++;r=s||(s=m()),e=g.bind(null,r,o,!1),n=g.bind(null,r,o,!0)}else r=m(),e=b.bind(null,r),n=function(){r.parentNode.removeChild(r)};return e(t),function(r){if(r){if(r.css===t.css&&r.media===t.media&&r.sourceMap===t.sourceMap)return;e(t=r)}else n()}}var y=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function g(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=y(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function b(t,e){var n=e.css,r=e.media,o=e.sourceMap;if(r&&t.setAttribute("media",r),f.ssrId&&t.setAttribute(d,e.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{while(t.firstChild)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}},c8ba:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n}}]);
8
+ //# sourceMappingURL=chunk-vendors.20f7f886.js.map
dist/js/index.cbb15892.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ (function(e){function n(n){for(var t,u,c=n[0],i=n[1],l=n[2],s=0,h=[];s<c.length;s++)u=c[s],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&h.push(o[u][0]),o[u]=0;for(t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);f&&f(n);while(h.length)h.shift()();return a.push.apply(a,l||[]),r()}function r(){for(var e,n=0;n<a.length;n++){for(var r=a[n],t=!0,u=1;u<r.length;u++){var i=r[u];0!==o[i]&&(t=!1)}t&&(a.splice(n--,1),e=c(c.s=r[0]))}return e}var t={},o={index:0},a=[];function u(e){return c.p+"js/"+({}[e]||e)+"."+{"chunk-ae402692":"003457bc","chunk-0c4e36c8":"95d70738","chunk-117382e0":"d47336d3","chunk-40965e1a":"74707226","chunk-04395031":"dbff2f6b","chunk-0cbfe13e":"73856287","chunk-2d0db258":"a4804a7a","chunk-2d0c53c7":"d24941b8","chunk-48b5b2a0":"3db5a0aa","chunk-a06ef50c":"1caef24f"}[e]+".js"}function c(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,c),r.l=!0,r.exports}c.e=function(e){var n=[],r=o[e];if(0!==r)if(r)n.push(r[2]);else{var t=new Promise((function(n,t){r=o[e]=[n,t]}));n.push(r[2]=t);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,c.nc&&i.setAttribute("nonce",c.nc),i.src=u(e);var l=new Error;a=function(n){i.onerror=i.onload=null,clearTimeout(s);var r=o[e];if(0!==r){if(r){var t=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;l.message="Loading chunk "+e+" failed.\n("+t+": "+a+")",l.name="ChunkLoadError",l.type=t,l.request=a,r[1](l)}o[e]=void 0}};var s=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(n)},c.m=e,c.c=t,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},c.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,n){if(1&n&&(e=c(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(c.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)c.d(r,t,function(n){return e[n]}.bind(null,t));return r},c.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="",c.oe=function(e){throw console.error(e),e};var i=window["webpackJsonp"]=window["webpackJsonp"]||[],l=i.push.bind(i);i.push=n,i=i.slice();for(var s=0;s<i.length;s++)n(i[s]);var f=l;a.push([0,"chunk-vendors"]),r()})({0:function(e,n,r){e.exports=r("c7c3")},6786:function(e,n,r){"use strict";r("97cc")},"828f":function(e,n,r){var t=r("24fb");n=t(!1),n.push([e.i,"body{margin:0;overflow:hidden}",""]),e.exports=n},"97cc":function(e,n,r){var t=r("828f");t.__esModule&&(t=t.default),"string"===typeof t&&(t=[[e.i,t,""]]),t.locals&&(e.exports=t.locals);var o=r("499e").default;o("a0b5d278",t,!0,{sourceMap:!1,shadowMode:!1})},aa4a:function(e,n,r){var t={"./flex-engraver.vue":["e168","chunk-ae402692","chunk-0c4e36c8","chunk-117382e0"],"./playground.vue":["1140","chunk-ae402692","chunk-0c4e36c8","chunk-40965e1a","chunk-04395031"],"./profiler.vue":["5748","chunk-ae402692","chunk-40965e1a","chunk-0cbfe13e"]};function o(e){if(!r.o(t,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=t[e],o=n[0];return Promise.all(n.slice(1).map(r.e)).then((function(){return r(o)}))}o.keys=function(){return Object.keys(t)},o.id="aa4a",e.exports=o},c7c3:function(e,n,r){"use strict";r.r(n);var t=r("2b0e"),o=function(){var e=this,n=e._self._c;return n("body",[e.view?n(e.view,{tag:"component"}):e._e()],1)},a=[];const u=["playground","profiler","flex-engraver"];u.forEach(e=>t["a"].component(e,()=>r("aa4a")(`./${e}.vue`)));var c={name:"lotus",data(){return{view:null}},mounted(){this.onHashChange(),window.onhashchange=()=>this.onHashChange()},methods:{onHashChange(){this.view=(location.hash.substr(1)||"playground").replace(/\?.*/,"")}}},i=c,l=(r("6786"),r("2877")),s=Object(l["a"])(i,o,a,!1,null,null,null),f=s.exports;new t["a"]({render:e=>e(f)}).$mount("body")}});
2
+ //# sourceMappingURL=index.cbb15892.js.map
dist/soundfont/acoustic_grand_piano-mp3.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/soundfont/acoustic_grand_piano-ogg.js ADDED
The diff for this file is too large to render. See raw diff
 
inc/DictArray.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class DictArray extends Array {
3
+ constructor (jsonObj?: object) {
4
+ super();
5
+
6
+ if (jsonObj) {
7
+ console.assert(typeof jsonObj === "object", "invalid input type:", jsonObj);
8
+
9
+ if (Array.isArray(jsonObj))
10
+ Object.keys(jsonObj).forEach(index => this[index] = jsonObj[index]);
11
+ else
12
+ Object.entries(jsonObj).forEach(([key, value]) => this[key] = value);
13
+ }
14
+ }
15
+
16
+
17
+ toJSON () {
18
+ return Object.keys(this).reduce((dict, index) => (dict[index] = this[index], dict), {__prototype: "DictArray"});
19
+ }
20
+
21
+
22
+ clear () {
23
+ Object.keys(this).forEach(index => delete this[index]);
24
+ this.length = 0;
25
+ }
26
+
27
+
28
+ clone () {
29
+ return new DictArray(this);
30
+ }
31
+ };
32
+
33
+
34
+
35
+ export default DictArray;
inc/asyncCall.ts ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ const asyncCall = (func, ...args): Promise<any> => new Promise((resolve, reject) => func(...args, (err, data) => {
3
+ if (err)
4
+ reject(err);
5
+ else
6
+ resolve(data);
7
+ }));
8
+
9
+
10
+
11
+ export default asyncCall;
inc/constants.ts ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ const LILYPOND_VERSION = "2.20.0";
3
+
4
+
5
+ const CM_TO_PX = 37.794;
6
+
7
+ const LILY_TOP_MARGIN_DEFAULT = 0.5;
8
+ const LILY_BOTTOM_MARGIN_DEFAULT = 0.6;
9
+ const LILY_HORIZONTAL_MARGIN_DEFAULT = 1;
10
+ const LILY_STAFF_SIZE_DEFAULT = 20;
11
+
12
+ //const SYSTEM_SYSTEM_SPACING = 0.08;
13
+
14
+ const STAFF_HEAD_DEDUCTION = 0.06; // extra width augment when system wrap added, cm per staff size
15
+
16
+
17
+ const SVG_DTD = `<?xml version="1.0" standalone="no"?>
18
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
19
+ [<!ENTITY quot "&#34;"> <!ENTITY amp "&#38;"> <!ENTITY apos "&#39;"> <!ENTITY lt "&#60;"> <!ENTITY gt "&#62;"> <!ENTITY nbsp "&#160;"> <!ENTITY iexcl "&#161;"> <!ENTITY cent "&#162;"> <!ENTITY pound "&#163;"> <!ENTITY curren "&#164;"> <!ENTITY yen "&#165;"> <!ENTITY brvbar "&#166;"> <!ENTITY sect "&#167;"> <!ENTITY uml "&#168;"> <!ENTITY copy "&#169;"> <!ENTITY ordf "&#170;"> <!ENTITY laquo "&#171;"> <!ENTITY not "&#172;"> <!ENTITY shy "&#173;"> <!ENTITY reg "&#174;"> <!ENTITY macr "&#175;"> <!ENTITY deg "&#176;"> <!ENTITY plusmn "&#177;"> <!ENTITY sup2 "&#178;"> <!ENTITY sup3 "&#179;"> <!ENTITY acute "&#180;"> <!ENTITY micro "&#181;"> <!ENTITY para "&#182;"> <!ENTITY middot "&#183;"> <!ENTITY cedil "&#184;"> <!ENTITY sup1 "&#185;"> <!ENTITY ordm "&#186;"> <!ENTITY raquo "&#187;"> <!ENTITY frac14 "&#188;"> <!ENTITY frac12 "&#189;"> <!ENTITY frac34 "&#190;"> <!ENTITY iquest "&#191;"> <!ENTITY Agrave "&#192;"> <!ENTITY Aacute "&#193;"> <!ENTITY Acirc "&#194;"> <!ENTITY Atilde "&#195;"> <!ENTITY Auml "&#196;"> <!ENTITY Aring "&#197;"> <!ENTITY AElig "&#198;"> <!ENTITY Ccedil "&#199;"> <!ENTITY Egrave "&#200;"> <!ENTITY Eacute "&#201;"> <!ENTITY Ecirc "&#202;"> <!ENTITY Euml "&#203;"> <!ENTITY Igrave "&#204;"> <!ENTITY Iacute "&#205;"> <!ENTITY Icirc "&#206;"> <!ENTITY Iuml "&#207;"> <!ENTITY ETH "&#208;"> <!ENTITY Ntilde "&#209;"> <!ENTITY Ograve "&#210;"> <!ENTITY Oacute "&#211;"> <!ENTITY Ocirc "&#212;"> <!ENTITY Otilde "&#213;"> <!ENTITY Ouml "&#214;"> <!ENTITY times "&#215;"> <!ENTITY Oslash "&#216;"> <!ENTITY Ugrave "&#217;"> <!ENTITY Uacute "&#218;"> <!ENTITY Ucirc "&#219;"> <!ENTITY Uuml "&#220;"> <!ENTITY Yacute "&#221;"> <!ENTITY THORN "&#222;"> <!ENTITY szlig "&#223;"> <!ENTITY agrave "&#224;"> <!ENTITY aacute "&#225;"> <!ENTITY acirc "&#226;"> <!ENTITY atilde "&#227;"> <!ENTITY auml "&#228;"> <!ENTITY aring "&#229;"> <!ENTITY aelig "&#230;"> <!ENTITY ccedil "&#231;"> <!ENTITY egrave "&#232;"> <!ENTITY eacute "&#233;"> <!ENTITY ecirc "&#234;"> <!ENTITY euml "&#235;"> <!ENTITY igrave "&#236;"> <!ENTITY iacute "&#237;"> <!ENTITY icirc "&#238;"> <!ENTITY iuml "&#239;"> <!ENTITY eth "&#240;"> <!ENTITY ntilde "&#241;"> <!ENTITY ograve "&#242;"> <!ENTITY oacute "&#243;"> <!ENTITY ocirc "&#244;"> <!ENTITY otilde "&#245;"> <!ENTITY ouml "&#246;"> <!ENTITY divide "&#247;"> <!ENTITY oslash "&#248;"> <!ENTITY ugrave "&#249;"> <!ENTITY uacute "&#250;"> <!ENTITY ucirc "&#251;"> <!ENTITY uuml "&#252;"> <!ENTITY yacute "&#253;"> <!ENTITY thorn "&#254;"> <!ENTITY yuml "&#255;"> <!ENTITY OElig "&#338;"> <!ENTITY oelig "&#339;"> <!ENTITY Scaron "&#352;"> <!ENTITY scaron "&#353;"> <!ENTITY Yuml "&#376;"> <!ENTITY fnof "&#402;"> <!ENTITY circ "&#710;"> <!ENTITY tilde "&#732;"> <!ENTITY Alpha "&#913;"> <!ENTITY Beta "&#914;"> <!ENTITY Gamma "&#915;"> <!ENTITY Delta "&#916;"> <!ENTITY Epsilon "&#917;"> <!ENTITY Zeta "&#918;"> <!ENTITY Eta "&#919;"> <!ENTITY Theta "&#920;"> <!ENTITY Iota "&#921;"> <!ENTITY Kappa "&#922;"> <!ENTITY Lambda "&#923;"> <!ENTITY Mu "&#924;"> <!ENTITY Nu "&#925;"> <!ENTITY Xi "&#926;"> <!ENTITY Omicron "&#927;"> <!ENTITY Pi "&#928;"> <!ENTITY Rho "&#929;"> <!ENTITY Sigma "&#931;"> <!ENTITY Tau "&#932;"> <!ENTITY Upsilon "&#933;"> <!ENTITY Phi "&#934;"> <!ENTITY Chi "&#935;"> <!ENTITY Psi "&#936;"> <!ENTITY Omega "&#937;"> <!ENTITY alpha "&#945;"> <!ENTITY beta "&#946;"> <!ENTITY gamma "&#947;"> <!ENTITY delta "&#948;"> <!ENTITY epsilon "&#949;"> <!ENTITY zeta "&#950;"> <!ENTITY eta "&#951;"> <!ENTITY theta "&#952;"> <!ENTITY iota "&#953;"> <!ENTITY kappa "&#954;"> <!ENTITY lambda "&#955;"> <!ENTITY mu "&#956;"> <!ENTITY nu "&#957;"> <!ENTITY xi "&#958;"> <!ENTITY omicron "&#959;"> <!ENTITY pi "&#960;"> <!ENTITY rho "&#961;"> <!ENTITY sigmaf "&#962;"> <!ENTITY sigma "&#963;"> <!ENTITY tau "&#964;"> <!ENTITY upsilon "&#965;"> <!ENTITY phi "&#966;"> <!ENTITY chi "&#967;"> <!ENTITY psi "&#968;"> <!ENTITY omega "&#969;"> <!ENTITY thetasym "&#977;"> <!ENTITY upsih "&#978;"> <!ENTITY piv "&#982;"> <!ENTITY ensp "&#8194;"> <!ENTITY emsp "&#8195;"> <!ENTITY thinsp "&#8201;"> <!ENTITY zwnj "&#8204;"> <!ENTITY zwj "&#8205;"> <!ENTITY lrm "&#8206;"> <!ENTITY rlm "&#8207;"> <!ENTITY ndash "&#8211;"> <!ENTITY mdash "&#8212;"> <!ENTITY lsquo "&#8216;"> <!ENTITY rsquo "&#8217;"> <!ENTITY sbquo "&#8218;"> <!ENTITY ldquo "&#8220;"> <!ENTITY rdquo "&#8221;"> <!ENTITY bdquo "&#8222;"> <!ENTITY dagger "&#8224;"> <!ENTITY Dagger "&#8225;"> <!ENTITY bull "&#8226;"> <!ENTITY hellip "&#8230;"> <!ENTITY permil "&#8240;"> <!ENTITY prime "&#8242;"> <!ENTITY Prime "&#8243;"> <!ENTITY lsaquo "&#8249;"> <!ENTITY rsaquo "&#8250;"> <!ENTITY oline "&#8254;"> <!ENTITY frasl "&#8260;"> <!ENTITY euro "&#8364;"> <!ENTITY image "&#8465;"> <!ENTITY weierp "&#8472;"> <!ENTITY real "&#8476;"> <!ENTITY trade "&#8482;"> <!ENTITY alefsym "&#8501;"> <!ENTITY larr "&#8592;"> <!ENTITY uarr "&#8593;"> <!ENTITY rarr "&#8594;"> <!ENTITY darr "&#8595;"> <!ENTITY harr "&#8596;"> <!ENTITY crarr "&#8629;"> <!ENTITY lArr "&#8656;"> <!ENTITY uArr "&#8657;"> <!ENTITY rArr "&#8658;"> <!ENTITY dArr "&#8659;"> <!ENTITY hArr "&#8660;"> <!ENTITY forall "&#8704;"> <!ENTITY part "&#8706;"> <!ENTITY exist "&#8707;"> <!ENTITY empty "&#8709;"> <!ENTITY nabla "&#8711;"> <!ENTITY isin "&#8712;"> <!ENTITY notin "&#8713;"> <!ENTITY ni "&#8715;"> <!ENTITY prod "&#8719;"> <!ENTITY sum "&#8721;"> <!ENTITY minus "&#8722;"> <!ENTITY lowast "&#8727;"> <!ENTITY radic "&#8730;"> <!ENTITY prop "&#8733;"> <!ENTITY infin "&#8734;"> <!ENTITY ang "&#8736;"> <!ENTITY and "&#8743;"> <!ENTITY or "&#8744;"> <!ENTITY cap "&#8745;"> <!ENTITY cup "&#8746;"> <!ENTITY int "&#8747;"> <!ENTITY there4 "&#8756;"> <!ENTITY sim "&#8764;"> <!ENTITY cong "&#8773;"> <!ENTITY asymp "&#8776;"> <!ENTITY ne "&#8800;"> <!ENTITY equiv "&#8801;"> <!ENTITY le "&#8804;"> <!ENTITY ge "&#8805;"> <!ENTITY sub "&#8834;"> <!ENTITY sup "&#8835;"> <!ENTITY nsub "&#8836;"> <!ENTITY sube "&#8838;"> <!ENTITY supe "&#8839;"> <!ENTITY oplus "&#8853;"> <!ENTITY otimes "&#8855;"> <!ENTITY perp "&#8869;"> <!ENTITY sdot "&#8901;"> <!ENTITY lceil "&#8968;"> <!ENTITY rceil "&#8969;"> <!ENTITY lfloor "&#8970;"> <!ENTITY rfloor "&#8971;"> <!ENTITY lang "&#9001;"> <!ENTITY rang "&#9002;"> <!ENTITY loz "&#9674;"> <!ENTITY spades "&#9824;"> <!ENTITY clubs "&#9827;"> <!ENTITY hearts "&#9829;"> <!ENTITY diams "&#9830;">]>
20
+ `;
21
+
22
+
23
+
24
+ export {
25
+ LILYPOND_VERSION,
26
+
27
+ CM_TO_PX,
28
+
29
+ LILY_TOP_MARGIN_DEFAULT,
30
+ LILY_BOTTOM_MARGIN_DEFAULT,
31
+ LILY_HORIZONTAL_MARGIN_DEFAULT,
32
+ LILY_STAFF_SIZE_DEFAULT,
33
+ //SYSTEM_SYSTEM_SPACING,
34
+
35
+ STAFF_HEAD_DEDUCTION,
36
+
37
+ SVG_DTD,
38
+ };
inc/domUtils.ts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ const traverse = (node, handle) => {
3
+ handle(node);
4
+
5
+ if (node.childNodes) {
6
+ for (let i = 0; i < node.childNodes.length; ++i)
7
+ traverse(node.childNodes[i], handle);
8
+ }
9
+ };
10
+
11
+
12
+ const childrenWithTag = (node: any, tagName: string): any[] => {
13
+ const children = Array.from(node.childNodes);
14
+ return children.filter((node: any) => node.tagName === tagName);
15
+ };
16
+
17
+
18
+ const hasChildrenWithTag = (node: any, tagName: string): boolean => {
19
+ const children = Array.from(node.childNodes);
20
+ return children.some((node: any) => node.tagName === tagName);
21
+ };
22
+
23
+
24
+ const findPreviousSibling = (node: any, tagName: string): any => {
25
+ let sibling = node.previousSibling;
26
+ while (sibling && sibling.tagName !== tagName)
27
+ sibling = sibling.previousSibling;
28
+
29
+ return sibling;
30
+ };
31
+
32
+
33
+ const findNextSibling = (node: any, tagName: string): any => {
34
+ let sibling = node.nextSibling;
35
+ while (sibling && sibling.tagName !== tagName)
36
+ sibling = sibling.nextSibling;
37
+
38
+ return sibling;
39
+ };
40
+
41
+
42
+
43
+ export {
44
+ traverse,
45
+ childrenWithTag,
46
+ hasChildrenWithTag,
47
+ findPreviousSibling,
48
+ findNextSibling,
49
+ };
inc/jisonWrapper.ts ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import jison from "jison";
3
+
4
+
5
+
6
+ export class Parser {
7
+ parser: any;
8
+
9
+
10
+ constructor (grammar: string) {
11
+ // mute jison logs during grammar loading
12
+ const logs = [];
13
+ jison.print = log => logs.push(log);
14
+
15
+ this.parser = jison.Parser(grammar);
16
+ if (!this.parser) {
17
+ console.warn("jison logs:", logs);
18
+ throw new Error("jison parser loading failed");
19
+ }
20
+
21
+ jison.print = (...args) => console.log("[JISON]", ...args);
22
+ }
23
+
24
+
25
+ parse (source: string): object {
26
+ //console.log("parse:", source.length);
27
+ return this.parser.parse(source);
28
+ }
29
+
30
+
31
+ generate (): string {
32
+ return this.parser.generate();
33
+ }
34
+ };
inc/jsonRecovery.ts ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ const recoverJSON = (json: string | object, classDict) => {
4
+ if (typeof json === "object")
5
+ json = JSON.stringify(json);
6
+
7
+ return JSON.parse(json, (_, value) => {
8
+ if (value && (typeof value === "object") && value.__prototype) {
9
+ const Class = classDict[value.__prototype];
10
+ if (Class) {
11
+ const {__prototype, ...fields} = value;
12
+ return new Class(fields);
13
+ }
14
+ }
15
+
16
+ return value;
17
+ });
18
+ };
19
+
20
+
21
+ class SimpleClass {
22
+ constructor (data?: object) {
23
+ if (data)
24
+ Object.assign(this, data);
25
+ }
26
+
27
+
28
+ toJSON () {
29
+ return {
30
+ __prototype: (this.constructor as any).className,
31
+ ...this,
32
+ };
33
+ }
34
+ };
35
+
36
+
37
+
38
+ export {
39
+ recoverJSON,
40
+ SimpleClass,
41
+ };
inc/lilyNotation/fuzzyMatch.ts ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // eslint-disable-next-line
3
+ import {MusicNotation} from "@k-l-lambda/music-widgets";
4
+
5
+
6
+
7
+ interface Note {
8
+ index: number;
9
+ pitch: number;
10
+ softIndex: number;
11
+ baseCsi?: number;
12
+ };
13
+
14
+
15
+ const notePitchDistance = (n1: Note, n2: Note): number => {
16
+ let differ = Math.abs(n1.pitch - n2.pitch);
17
+ if (differ > 7)
18
+ differ -= 11.5;
19
+
20
+ return differ * 2;
21
+ };
22
+
23
+
24
+ const fuzzyMatchNotes = (path: number[], cnotes: Note[], snotes: Note[], pitchTolerance: number, offsetTolerance = 2): {fixed: number, matched: number} => {
25
+ const candidates: {[key: number]: {si: number, distance: number}} = {};
26
+
27
+ const matched = snotes.reduce((count, snote) => {
28
+ const pcan = cnotes.filter(cnote => notePitchDistance(cnote, snote) <= pitchTolerance
29
+ && Math.abs(snote.baseCsi - cnote.softIndex) < offsetTolerance)
30
+ .sort((n1, n2) => Math.abs(snote.baseCsi - n1.softIndex) - Math.abs(snote.baseCsi - n2.softIndex));
31
+
32
+ if (pcan.length) {
33
+ const bestDistance = notePitchDistance(pcan[0], snote);
34
+ const last = candidates[pcan[0].index];
35
+ if (!last || bestDistance < last.distance)
36
+ candidates[pcan[0].index] = {si: snote.index, distance: bestDistance};
37
+
38
+ ++count;
39
+ }
40
+
41
+ return count;
42
+ }, 0);
43
+
44
+ const fixed = Object.entries(candidates).map(([ci, {si}]) => {
45
+ path[si] = Number(ci);
46
+
47
+ return [si, Number(ci)];
48
+ });
49
+ //console.debug("fuzzyMatch.fixed:", fixed.map(pair => pair.join()));
50
+
51
+ return {fixed: fixed.length, matched};
52
+ };
53
+
54
+
55
+ const fuzzyMatchNotations = (path: number[], criterion: MusicNotation.NotationData, sample: MusicNotation.NotationData, {pitchToleranceMax = 4} = {}) => {
56
+ // unmatch overlapped indices
57
+ const overlapped = new Set();
58
+ path.reduce((set, ci) => {
59
+ if (ci >= 0) {
60
+ if (set.has(ci))
61
+ overlapped.add(ci);
62
+ else
63
+ set.add(ci);
64
+ }
65
+
66
+ return set;
67
+ }, new Set());
68
+ //console.debug("overlapped:", overlapped, [...path]);
69
+ path.forEach((ci, si) => {
70
+ if (overlapped.has(ci))
71
+ path[si] = -1;
72
+ });
73
+
74
+ // assign base offset on sample notes
75
+ let offset = null;
76
+ for (let i = 0; i < sample.notes.length; ++i) {
77
+ const note = sample.notes[i];
78
+ const ci = path[i];
79
+
80
+ if (ci < 0)
81
+ (note as any).baseOffset = offset;
82
+ else
83
+ offset = note.softIndex - criterion.notes[ci].softIndex;
84
+ }
85
+ for (let i = sample.notes.length - 1; i >= 0; --i) {
86
+ const note = sample.notes[i];
87
+ const ci = path[i];
88
+
89
+ if (ci < 0) {
90
+ const lastOffset = (note as any).baseOffset;
91
+ (note as any).baseOffset = Number.isFinite(lastOffset) ? (lastOffset + offset) / 2 : offset;
92
+ }
93
+ else
94
+ offset = note.softIndex - criterion.notes[ci].softIndex;
95
+ }
96
+
97
+ let pitchTolerance = 0;
98
+ while (true) {
99
+ const cnotes = criterion.notes.filter(note => !path.some(ci => ci === note.index)).map(note => ({index: note.index, pitch: note.pitch, softIndex: note.softIndex}));
100
+ const snotes = sample.notes.filter(note => path[note.index] < 0 && Number.isFinite((note as any).baseOffset))
101
+ .map(note => ({index: note.index, pitch: note.pitch, softIndex: note.softIndex, baseCsi: note.softIndex - (note as any).baseOffset}));
102
+
103
+ //console.debug("fuzzyMatch.notes:", cnotes.map(note => note.index), snotes.map(note => note.index));
104
+
105
+ if (!cnotes.length || !snotes.length)
106
+ break;
107
+
108
+ const {fixed, matched} = fuzzyMatchNotes(path, cnotes, snotes, pitchTolerance);
109
+ if (matched)
110
+ console.debug("fuzzyMatch.pass:", `c:${cnotes.length}, s:${snotes.length},`, pitchTolerance, `${fixed}/${matched}`);
111
+
112
+ if (fixed >= matched) {
113
+ ++pitchTolerance;
114
+ if (pitchTolerance > pitchToleranceMax)
115
+ break;
116
+ }
117
+ }
118
+ //console.debug("fuzzyMatch.path:", path);
119
+ };
120
+
121
+
122
+
123
+ export {
124
+ fuzzyMatchNotations,
125
+ };
inc/lilyNotation/implicitType.ts ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // implicit note (from expressive marks) types
3
+ enum ImplicitType {
4
+ None = 0,
5
+
6
+ Mordent = "mordent",
7
+ Prall = "prall",
8
+ Turn = "turn",
9
+ Trill = "trill",
10
+ Tremolo = "tremolo",
11
+ Arpeggio = "arpeggio",
12
+ };
13
+
14
+
15
+
16
+ export default ImplicitType;
inc/lilyNotation/index.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {Note, Notation, assignNotationEventsIds} from "./notation";
3
+ import {fuzzyMatchNotations} from "./fuzzyMatch";
4
+ import {matchWithMIDI, matchWithExactMIDI} from "./matcher";
5
+ import Scheduler from "./scheduler";
6
+ import ImplicitType from "./implicitType";
7
+ import * as measureLayout from "../measureLayout";
8
+ import {LayoutType} from "../measureLayout";
9
+
10
+
11
+
12
+ const {...MLayoutClasses} = measureLayout;
13
+
14
+
15
+
16
+ export {
17
+ Note,
18
+ Notation,
19
+ fuzzyMatchNotations,
20
+ assignNotationEventsIds,
21
+ matchWithMIDI,
22
+ matchWithExactMIDI,
23
+ Scheduler,
24
+ ImplicitType,
25
+ LayoutType,
26
+ MLayoutClasses,
27
+ };
inc/lilyNotation/matcher.ts ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {MusicNotation, Matcher} from "@k-l-lambda/music-widgets";
3
+ import {MIDI} from "@k-l-lambda/music-widgets";
4
+
5
+ import {WHOLE_DURATION_MAGNITUDE} from "../lilyParser/utils";
6
+ import {Notation} from "./notation";
7
+ import ImplicitType from "./implicitType";
8
+
9
+
10
+
11
+ export interface MatcherResult {
12
+ criterion: MusicNotation.NotationData,
13
+ sample: MusicNotation.NotationData,
14
+ path: number[], // S to C
15
+ trackMap?: number[], // S to C
16
+ };
17
+
18
+
19
+ const matchWithMIDI = async (lilyNotation: Notation, target: MIDI.MidiData): Promise<MatcherResult> => {
20
+ const midiTickFactor = (WHOLE_DURATION_MAGNITUDE / 4) / target.header.ticksPerBeat;
21
+
22
+ const midiNotation = MusicNotation.Notation.parseMidi(target);
23
+
24
+ const criterion = lilyNotation.toPerformingNotation();
25
+
26
+ Matcher.genNotationContext(criterion, {softIndexFactor: 1e3});
27
+ Matcher.genNotationContext(midiNotation, {softIndexFactor: midiTickFactor * 1e3});
28
+ //console.debug("notations:", criterion, midiNotation);
29
+
30
+ for (const note of midiNotation.notes)
31
+ Matcher.makeMatchNodes(note, criterion);
32
+
33
+ const navigator = await Matcher.runNavigation(criterion, midiNotation);
34
+ const path = navigator.path();
35
+
36
+ const matcher = {criterion, sample: midiNotation, path};
37
+ lilyNotation.assignMatcher(matcher);
38
+
39
+ return matcher;
40
+ };
41
+
42
+
43
+ const IMPLICIT_PITCH_BIAS = {
44
+ [ImplicitType.Mordent]: [0, -1, -2],
45
+ [ImplicitType.Prall]: [0, 1, 2],
46
+ [ImplicitType.Turn]: [-2, -1, 0, 1, 2],
47
+ [ImplicitType.Trill]: [0, 1, 2],
48
+ };
49
+
50
+
51
+ const alignNotationTicks = (source: MusicNotation.Notation, criterion: MusicNotation.Notation, {midiTrackTickBias}: {midiTrackTickBias?: number[]}) => {
52
+ const midiTickFactor = criterion.ticksPerBeat / source.ticksPerBeat;
53
+
54
+ source.ticksPerBeat = criterion.ticksPerBeat;
55
+ source.notes.forEach(note => {
56
+ note.startTick *= midiTickFactor;
57
+ note.endTick *= midiTickFactor;
58
+
59
+ const bias = midiTrackTickBias && midiTrackTickBias[note.track];
60
+ if (bias) {
61
+ note.startTick += bias;
62
+ note.endTick += bias;
63
+ }
64
+ });
65
+
66
+ source.events.forEach(event => {
67
+ event.ticks *= midiTickFactor;
68
+
69
+ const bias = midiTrackTickBias && midiTrackTickBias[event.track];
70
+ if (bias)
71
+ event.ticks += bias;
72
+ });
73
+ source.events.sort((e1, e2) => e1.ticks - e2.ticks);
74
+ };
75
+
76
+
77
+ const matchWithExactMIDI = async (lilyNotation: Notation, target: MIDI.MidiData): Promise<MatcherResult> => {
78
+ const criterion = lilyNotation.toPerformingNotation();
79
+
80
+ const trackTickBiasMap = lilyNotation.trackTickBias;
81
+ const targetTrackNames = target.tracks.map(events => {
82
+ const nameEvent = events.find(event => event.subtype === "trackName");
83
+ return nameEvent ? nameEvent.text : null;
84
+ });
85
+ const trackIndexC2S = lilyNotation.trackNames.map(name => targetTrackNames.indexOf(name));
86
+ //if (trackIndexC2S.includes(-1))
87
+ // console.debug("mismatched track found:", trackIndexC2S, lilyNotation.trackNames, targetTrackNames);
88
+
89
+ const midiTrackTickBias = targetTrackNames.map(name => name ? (trackTickBiasMap[name] || 0) : 0);
90
+ //console.log("midiTrackTickBias:", midiTrackTickBias);
91
+
92
+ const midiNotation = MusicNotation.Notation.parseMidi(target, {fixOverlap: false});
93
+ alignNotationTicks(midiNotation, criterion, {midiTrackTickBias});
94
+
95
+ // 1st pass: ordinary notes exact matching
96
+ const noteKey = note => `${note.track}|${Math.round(note.startTick)}|${note.pitch}`;
97
+
98
+ const snoteMap: {[key: string]: MusicNotation.Note} = {};
99
+ midiNotation.notes.forEach(note => {
100
+ snoteMap[noteKey(note)] = note;
101
+ });
102
+
103
+ const path = Array(midiNotation.notes.length).fill(-1);
104
+
105
+ const restCNotes = [];
106
+ criterion.notes.forEach(note => {
107
+ const implicit = !!(note as any).implicitType;
108
+
109
+ const key = noteKey({...note, track: trackIndexC2S[note.track - 1]});
110
+ const sn = snoteMap[key];
111
+ if (sn) {
112
+ path[sn.index] = note.index;
113
+ delete snoteMap[key];
114
+
115
+ if (!implicit)
116
+ return;
117
+ }
118
+
119
+ restCNotes.push(note);
120
+ });
121
+
122
+ // 2nd pass: implicit notes matching
123
+ const restCNotes2 = [];
124
+ const restSNotes = Object.values(snoteMap);
125
+ restCNotes.forEach(note => {
126
+ if (note.implicitType) {
127
+ const pbs = IMPLICIT_PITCH_BIAS[note.implicitType];
128
+ if (pbs) {
129
+ const matches = restSNotes.filter(sn => {
130
+ const tick = Math.round(sn.startTick);
131
+ const pb = sn.pitch - note.pitch;
132
+ return tick >= note.startTick && tick <= note.endTick && pbs.includes(pb);
133
+ });
134
+
135
+ if (matches.length) {
136
+ matches.forEach(sn => {
137
+ path[sn.index] = note.index;
138
+ delete snoteMap[noteKey(sn)];
139
+ });
140
+
141
+ return;
142
+ }
143
+ }
144
+ }
145
+
146
+ restCNotes2.push(note);
147
+ });
148
+
149
+ // 3rd pass: rest fuzzy matching
150
+ const restCNotes3 = [];
151
+ restCNotes2.forEach(note => {
152
+ const sn = restSNotes.find(sn => sn.pitch === note.pitch && Math.abs(sn.startTick - note.startTick) < 4);
153
+ if (sn) {
154
+ path[sn.index] = note.index;
155
+ delete snoteMap[noteKey(sn)];
156
+ }
157
+ else
158
+ restCNotes3.push(note);
159
+ });
160
+
161
+ // 4th pass: nearest matching
162
+ const restSNotes3 = Object.values(snoteMap);
163
+ //console.log("restCNotes3:", restCNotes3.map(n => n.index));
164
+ //console.log("restSNotes3:", restSNotes3.map(n => n.index));
165
+ restSNotes3.forEach(note => {
166
+ const cn = restCNotes3.reduce((best, cn) => {
167
+ if (cn.pitch === note.pitch) {
168
+ if (!best || Math.abs(cn.startTick - note.startTick) < Math.abs(best.startTick - note.startTick))
169
+ return cn;
170
+ }
171
+
172
+ return best;
173
+ }, null);
174
+ if (cn)
175
+ path[note.index] = cn.index;
176
+ });
177
+
178
+ const trackMap = Object.entries(trackIndexC2S).reduce((map, [ct, st]) => ((st >= 0 && (map[st] = Number(ct) + 1)), map), []);
179
+
180
+ const matcher = {criterion, sample: midiNotation, path, trackMap};
181
+ lilyNotation.assignMatcher(matcher);
182
+
183
+ return matcher;
184
+ };
185
+
186
+
187
+
188
+ export {
189
+ matchWithMIDI,
190
+ matchWithExactMIDI,
191
+ };
inc/lilyNotation/notation.ts ADDED
@@ -0,0 +1,675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {MusicNotation, MIDI} from "@k-l-lambda/music-widgets";
3
+
4
+ import {WHOLE_DURATION_MAGNITUDE} from "../lilyParser/utils";
5
+ import {PitchContextTable} from "../pitchContext";
6
+ import {MatcherResult} from "./matcher";
7
+ import {MeasureLayout, LayoutType} from "../measureLayout";
8
+ import ImplicitType from "./implicitType";
9
+ import npmPackage from "../../package.json";
10
+ import pick from "../pick";
11
+
12
+
13
+
14
+ const TICKS_PER_BEAT = WHOLE_DURATION_MAGNITUDE / 4;
15
+
16
+ const ARPEGGIO_REFERENCE_DURATION = 240;
17
+
18
+ // import WHOLE_DURATION_MAGNITUDE from "../lilyParser" may result in null error in nodejs
19
+ console.assert(Number.isFinite(TICKS_PER_BEAT), "TICKS_PER_BEAT is invalid:", TICKS_PER_BEAT);
20
+
21
+
22
+ export interface ChordPosition {
23
+ index: number;
24
+ count: number;
25
+ };
26
+
27
+
28
+ interface StaffNoteProperties {
29
+ rest: boolean;
30
+ tied: boolean;
31
+ overlapped: boolean;
32
+ implicitType: ImplicitType;
33
+ afterGrace: boolean;
34
+ chordPosition: ChordPosition;
35
+ division: number;
36
+
37
+ contextIndex: number;
38
+ staffTrack: number;
39
+ };
40
+
41
+
42
+ export interface Note extends MusicNotation.Note, Partial<StaffNoteProperties> {
43
+ id: string;
44
+ measure: number;
45
+ endTick: number;
46
+ outMeasure?: boolean;
47
+ };
48
+
49
+
50
+ interface SubNote {
51
+ startTick: number;
52
+ endTick: number;
53
+ pitch: number;
54
+ velocity?: number;
55
+ };
56
+
57
+
58
+ interface MeasureNote extends Partial<StaffNoteProperties> {
59
+ tick: number;
60
+ pitch: number;
61
+ duration: number;
62
+ chordPosition: ChordPosition;
63
+
64
+ track: number;
65
+ channel: number;
66
+ id: string;
67
+ ids: string[];
68
+
69
+ subNotes: SubNote[];
70
+ };
71
+
72
+
73
+ interface MeasureEvent {
74
+ data: any;
75
+ track: number;
76
+ ticks?: number;
77
+ };
78
+
79
+
80
+ interface Measure {
81
+ tick: number;
82
+ duration: number;
83
+
84
+ notes: MeasureNote[];
85
+ events?: MeasureEvent[];
86
+ };
87
+
88
+
89
+ interface PerformOptions {
90
+ withRestTied?: boolean;
91
+ };
92
+
93
+
94
+ /*interface NotationData {
95
+ pitchContextGroup: PitchContextTable[];
96
+ measures: Measure[];
97
+ };*/
98
+
99
+
100
+ const EXTRA_NOTE_FIELDS = ["rest", "tied", "overlapped", "implicitType", "afterGrace", "contextIndex", "staffTrack", "chordPosition", "division"];
101
+ const COMMON_NOTE_FIELDS = ["id", "ids", "pitch", "velocity", "track", "channel", ...EXTRA_NOTE_FIELDS];
102
+
103
+
104
+ export class Notation {
105
+ pitchContextGroup: PitchContextTable[];
106
+ measureLayout: MeasureLayout;
107
+ measures: Measure[];
108
+
109
+ trackNames: string[];
110
+ idTrackMap: {[key: string]: number};
111
+
112
+ ripe: boolean = false;
113
+
114
+
115
+ static fromAbsoluteNotes (notes: Note[], measureHeads: number[], data?: Partial<Notation>): Notation {
116
+ const notation = new Notation(data);
117
+
118
+ notation.measures = Array(measureHeads.length).fill(null).map((__, i) => {
119
+ const tick = measureHeads[i];
120
+ const duration = measureHeads[i + 1] ? (measureHeads[i + 1] - tick) : 0;
121
+
122
+ const mnotes = notes.filter(note => note.measure === i + 1).map(note => ({
123
+ tick: note.startTick - tick,
124
+ duration: note.endTick - note.startTick,
125
+ ...pick(note, COMMON_NOTE_FIELDS),
126
+ subNotes: [],
127
+ } as MeasureNote));
128
+
129
+ // reduce note data size
130
+ mnotes.forEach(mn => ["rest", "tied", "implicitType", "afterGrace"].forEach(field => {
131
+ if (!mn[field])
132
+ delete mn[field];
133
+ }));
134
+
135
+ return {
136
+ tick,
137
+ duration,
138
+ notes: mnotes,
139
+ };
140
+ });
141
+
142
+ notation.idTrackMap = notes.reduce((map, note) => {
143
+ if (note.id)
144
+ map[note.id] = note.track;
145
+
146
+ return map;
147
+ }, {});
148
+
149
+ return notation;
150
+ }
151
+
152
+
153
+ static performAbsoluteNotes (abNotes: Note[], {withRestTied = false}: PerformOptions = {}): MusicNotation.Note[] {
154
+ const notes = abNotes.filter(note => (withRestTied || (!note.rest && !note.tied)) && !note.overlapped).map(note => ({
155
+ measure: note.measure,
156
+ channel: note.channel,
157
+ track: note.track,
158
+ start: note.start,
159
+ startTick: note.startTick,
160
+ endTick: note.endTick,
161
+ pitch: note.pitch,
162
+ duration: note.duration,
163
+ velocity: note.velocity || 127,
164
+ id: note.id,
165
+ ids: note.ids,
166
+ staffTrack: note.staffTrack,
167
+ contextIndex: note.contextIndex,
168
+ implicitType: note.implicitType,
169
+ chordPosition: note.chordPosition,
170
+ outMeasure: note.outMeasure,
171
+ }));
172
+
173
+ const noteMap = notes.reduce((map, note) => {
174
+ const key = `${note.channel}|${note.start}|${note.pitch}`;
175
+ const priorNote = map[key];
176
+ if (priorNote)
177
+ priorNote.ids.push(...note.ids);
178
+ else
179
+ map[key] = note;
180
+
181
+ return map;
182
+ }, {});
183
+
184
+ return Object.values(noteMap);
185
+ }
186
+
187
+
188
+ constructor (data?: Partial<Notation>) {
189
+ if (data)
190
+ Object.assign(this, data);
191
+ }
192
+
193
+
194
+ get ordinaryMeasureIndices (): number[] {
195
+ if (this.measureLayout)
196
+ return this.measureLayout.serialize(LayoutType.Ordinary);
197
+
198
+ return Array(this.measures.length).fill(null).map((_, i) => i + 1);
199
+ }
200
+
201
+
202
+ // In Lilypond 2.20.0, minus tick value at the head of a track result in MIDI event time bias,
203
+ // So store the bias values to correct MIDI time from lilyond.
204
+ get trackTickBias (): {[key: string]: number} {
205
+ const headMeasure = this.measures[0];
206
+ return this.trackNames.reduce((map, name, track) => {
207
+ map[name] = 0;
208
+ if (headMeasure) {
209
+ const note = headMeasure.notes.find(note => note.track === track);
210
+ if (note)
211
+ map[name] = Math.min(note.tick, 0);
212
+ }
213
+
214
+ return map;
215
+ }, {});
216
+ }
217
+
218
+
219
+ get idSet (): Set<string> {
220
+ return this.measures.reduce((set, measure) =>
221
+ (measure.notes.filter(note => !note.rest).forEach(note => note.ids.forEach(id => set.add(id))), set), new Set<string>());
222
+ }
223
+
224
+
225
+ toJSON () {
226
+ return {
227
+ __prototype: "LilyNotation",
228
+ pitchContextGroup: this.pitchContextGroup,
229
+ measureLayout: this.measureLayout,
230
+ measures: this.measures,
231
+ idTrackMap: this.idTrackMap,
232
+ trackNames: this.trackNames,
233
+ ripe: this.ripe,
234
+ };
235
+ }
236
+
237
+
238
+ toAbsoluteNotes (measureIndices: number[] = this.ordinaryMeasureIndices): Note[] {
239
+ let measureTick = 0;
240
+ const measureNotes: Note[][] = measureIndices.map(index => {
241
+ const measure = this.measures[index - 1];
242
+ console.assert(!!measure, "invalid measure index:", index, this.measures.length);
243
+
244
+ const notes = measure.notes.map(mnote => {
245
+ const outMeasure = mnote.tick < 0 || mnote.tick >= measure.duration;
246
+
247
+ return {
248
+ startTick: measureTick + mnote.tick,
249
+ endTick: measureTick + mnote.tick + mnote.duration,
250
+ start: measureTick + mnote.tick,
251
+ duration: mnote.duration,
252
+ measure: index,
253
+ outMeasure,
254
+ ...pick(mnote, COMMON_NOTE_FIELDS),
255
+ } as Note;
256
+ });
257
+
258
+ measureTick += measure.duration;
259
+
260
+ return notes;
261
+ });
262
+
263
+ return [].concat(...measureNotes);
264
+ }
265
+
266
+
267
+ getMeasureIndices (type: LayoutType) {
268
+ return this.measureLayout.serialize(type);
269
+ }
270
+
271
+
272
+ toPerformingNotation (measureIndices: number[] = this.ordinaryMeasureIndices, options: PerformOptions = {}): MusicNotation.Notation {
273
+ //console.debug("toPerformingNotation:", this, measureIndices);
274
+ const abNotes = this.toAbsoluteNotes(measureIndices);
275
+ const notes = Notation.performAbsoluteNotes(abNotes, options);
276
+
277
+ //const lastNote = notes[notes.length - 1];
278
+ const endTime = Math.max(...notes.map(note => note.start + note.duration));
279
+
280
+ const endTick = measureIndices.reduce((tick, index) => tick + this.measures[index - 1].duration, 0);
281
+
282
+ const notation = new MusicNotation.Notation({
283
+ ticksPerBeat: TICKS_PER_BEAT,
284
+ meta: {},
285
+ tempos: [], // TODO
286
+ channels: [notes],
287
+ endTime,
288
+ endTick,
289
+ });
290
+
291
+ return notation;
292
+ }
293
+
294
+
295
+ toPerformingMIDI (measureIndices: number[], {trackList}: {trackList?: boolean[]} = {}): MIDI.MidiData & {zeroTick: number} {
296
+ if (!measureIndices.length)
297
+ return null;
298
+
299
+ // to avoid begin minus tick
300
+ const zeroTick = -Math.min(0,
301
+ ...(this.measures[0] ? this.measures[0].events.map((e) => e.ticks) : []),
302
+ ...(this.measures[0] ? this.measures[0].notes.map((note) => note.tick) : []));
303
+
304
+ let measureTick = zeroTick;
305
+ const measureEvents: MeasureEvent[][] = measureIndices.map(index => {
306
+ const measure = this.measures[index - 1];
307
+ console.assert(!!measure, "invalid measure index:", index, this.measures.length);
308
+
309
+ const events = measure.events.map(mevent => ({
310
+ ticks: measureTick + mevent.ticks,
311
+ track: mevent.track,
312
+ data: {
313
+ ...mevent.data,
314
+ measure: index,
315
+ },
316
+ }));
317
+
318
+ measureTick += measure.duration;
319
+
320
+ return events;
321
+ });
322
+
323
+ interface MidiEvent extends MIDI.MidiEvent {
324
+ ticks?: number;
325
+ measure?: number;
326
+ ids?: string[];
327
+ staffTrack?: number;
328
+ };
329
+ type MidiTrack = MidiEvent[];
330
+
331
+ const eventPriority = (event: MidiEvent): number => event.ticks + (event.subtype === "noteOff" ? -1e-4 : 0);
332
+
333
+ const tracks: MidiTrack[] = [].concat(...measureEvents).reduce((tracks, mevent) => {
334
+ tracks[mevent.track] = tracks[mevent.track] || [];
335
+ tracks[mevent.track].push({
336
+ ticks: mevent.ticks,
337
+ ...mevent.data,
338
+ });
339
+
340
+ return tracks;
341
+ }, []);
342
+
343
+ tracks[0] = tracks[0] || [];
344
+ tracks[0].push({
345
+ ticks: 0,
346
+ type: "meta",
347
+ subtype: "text",
348
+ text: `${npmPackage.name} ${npmPackage.version}`,
349
+ });
350
+
351
+ // append note events
352
+ measureTick = zeroTick;
353
+ measureIndices.map(index => {
354
+ const measure = this.measures[index - 1];
355
+ console.assert(!!measure, "invalid measure index:", index, this.measures.length);
356
+
357
+ measure.notes.forEach(note => {
358
+ if (trackList && !trackList[note.track])
359
+ return;
360
+
361
+ if (note.rest)
362
+ return;
363
+
364
+ const tick = measureTick + note.tick;
365
+
366
+ const track = tracks[note.track] = tracks[note.track] || [];
367
+
368
+ note.subNotes.forEach(subnote => {
369
+ track.push({
370
+ ticks: tick + subnote.startTick,
371
+ measure: index,
372
+ ids: note.ids,
373
+ type: "channel",
374
+ subtype: "noteOn",
375
+ channel: note.channel,
376
+ noteNumber: subnote.pitch,
377
+ velocity: subnote.velocity,
378
+ staffTrack: note.staffTrack,
379
+ });
380
+
381
+ track.push({
382
+ ticks: tick + subnote.endTick,
383
+ measure: index,
384
+ ids: note.ids,
385
+ type: "channel",
386
+ subtype: "noteOff",
387
+ channel: note.channel,
388
+ noteNumber: subnote.pitch,
389
+ velocity: 0,
390
+ staffTrack: note.staffTrack,
391
+ });
392
+ });
393
+ });
394
+
395
+ measureTick += measure.duration;
396
+ });
397
+
398
+ const finalTick = measureTick;
399
+
400
+ // ensure no empty track
401
+ for (let t = 0; t < tracks.length; ++t)
402
+ tracks[t] = tracks[t] || [];
403
+
404
+ // sort & make deltaTime
405
+ tracks.forEach(events => {
406
+ events.sort((e1, e2) => eventPriority(e1) - eventPriority(e2));
407
+
408
+ let ticks = 0;
409
+ events.forEach(event => {
410
+ event.deltaTime = event.ticks - ticks;
411
+ ticks = event.ticks;
412
+ });
413
+
414
+ events.push({deltaTime: Math.max(finalTick - ticks, 0), type: "meta", subtype: "endOfTrack"});
415
+ });
416
+
417
+ return {
418
+ header: {
419
+ formatType: 0,
420
+ ticksPerBeat: TICKS_PER_BEAT,
421
+ },
422
+ tracks,
423
+ zeroTick,
424
+ };
425
+ }
426
+
427
+
428
+ toPerformingNotationWithEvents (measureIndices: number[], options: {trackList?: boolean[]} = {}): MusicNotation.Notation {
429
+ if (!measureIndices.length)
430
+ return null;
431
+
432
+ const {zeroTick, ...midi} = this.toPerformingMIDI(measureIndices, options);
433
+ const notation = MusicNotation.Notation.parseMidi(midi);
434
+
435
+ assignNotationNoteDataFromEvents(notation);
436
+
437
+ let tick = zeroTick;
438
+
439
+ notation.measures = measureIndices.map(index => {
440
+ const startTick = tick;
441
+ tick += this.measures[index - 1].duration;
442
+
443
+ return {
444
+ index,
445
+ startTick,
446
+ endTick: tick,
447
+ };
448
+ });
449
+
450
+ return notation;
451
+ }
452
+
453
+
454
+ getContextGroup (measureIndices: number[]): PitchContextTable[] {
455
+ const contextGroup = this.pitchContextGroup.map(table => table.items.map(item => item.context));
456
+ const midiNotation = this.toPerformingNotation(measureIndices);
457
+
458
+ return PitchContextTable.createPitchContextGroup(contextGroup, midiNotation);
459
+ }
460
+
461
+
462
+ assignMatcher (matcher: MatcherResult): this {
463
+ const tickFactor = TICKS_PER_BEAT / matcher.sample.ticksPerBeat;
464
+
465
+ matcher.path.forEach((ci, si) => {
466
+ if (ci >= 0) {
467
+ const cn = matcher.criterion.notes[ci] as Note;
468
+ const sn = matcher.sample.notes[si] as Note;
469
+ sn.ids = cn.ids || [cn.id];
470
+ sn.measure = cn.measure;
471
+ }
472
+ });
473
+ assignNotationEventsIds(matcher.sample, ["ids", "measure"]);
474
+
475
+ // assign sub notes
476
+ const c2sIndices = Array(matcher.criterion.notes.length).fill(null).map(() => []);
477
+ matcher.path.forEach((ci, si) => ci >= 0 && c2sIndices[ci].push(si));
478
+
479
+ const velocities: {[key: number]: number} = {};
480
+ c2sIndices.forEach((indices, ci) => {
481
+ const cn = matcher.criterion.notes[ci] as any;
482
+ const measure = this.measures[cn.measure - 1];
483
+ console.assert(!!measure, "cannot find measure for c note:", cn, this.measures.length);
484
+
485
+ //const mn = measure.notes.find(note => note.tick === cn.startTick - measure.tick && note.pitch === cn.pitch);
486
+ const mn = measure.notes.find(note => note.id === cn.id && note.pitch === cn.pitch);
487
+ console.assert(!!mn, "cannot find measure note for c note:", cn, measure);
488
+
489
+ let bias = 0;
490
+
491
+ // arpeggio time bias
492
+ if (mn.implicitType === "arpeggio" && mn.chordPosition) {
493
+ const referenceDuration = Math.min(mn.duration * 0.5, ARPEGGIO_REFERENCE_DURATION);
494
+ bias = Math.round(mn.chordPosition.index * referenceDuration / mn.chordPosition.count);
495
+ }
496
+
497
+ const snotes = indices
498
+ .map(si => matcher.sample.notes[si])
499
+ .filter((sn, i) => Math.abs(sn.startTick - cn.startTick) < WHOLE_DURATION_MAGNITUDE
500
+ && (!mn.afterGrace || i < 1)); // lilypond's afterGrace MIDI parsing is ill, clip notes to avoid error matching
501
+
502
+ if (!snotes.length) {
503
+ //const track = matcher.trackMap[mn.track];
504
+
505
+ mn.subNotes = [{
506
+ //track,
507
+ startTick: bias,
508
+ endTick: mn.duration,
509
+ pitch: mn.pitch,
510
+ velocity: velocities[mn.track] || 90,
511
+ }];
512
+ }
513
+ else {
514
+ const referenceTick = measure.tick + mn.tick;
515
+ //const referenceTick = snotes[0].startTick;
516
+ //console.log("mn bias:", mn.id, measure.tick + mn.tick - snotes[0].startTick);
517
+
518
+ mn.subNotes = snotes.map(sn => {
519
+ velocities[sn.track] = sn.velocity;
520
+
521
+ console.assert(sn.endTick > sn.startTick, "midi note duration is zero or negative:", sn);
522
+
523
+ // fix bad subnote duration
524
+ const duration = sn.endTick - sn.startTick;
525
+ if (duration > mn.duration * 2)
526
+ sn.endTick = sn.startTick + mn.duration;
527
+
528
+ return {
529
+ //track: sn.track,
530
+ startTick: Math.round(sn.startTick - referenceTick + bias),
531
+ endTick: Math.round(sn.endTick - referenceTick),
532
+ pitch: sn.pitch,
533
+ velocity: sn.velocity,
534
+ };
535
+ });
536
+ }
537
+ });
538
+
539
+ // assign events
540
+ this.measures.forEach(measure => measure.events = []);
541
+
542
+ //console.debug("matcher.trackMap:", matcher.trackMap);
543
+ (matcher.sample.events as MeasureEvent[]).forEach(event => {
544
+ // exclude note events
545
+ if (["noteOn", "noteOff"].includes(event.data.subtype))
546
+ return;
547
+
548
+ let track = matcher.trackMap[event.track];
549
+ if (!Number.isFinite(track)) {
550
+ const id = event.data.ids && event.data.ids[0];
551
+ track = id ? (this.idTrackMap[id] || 0) : 0;
552
+ }
553
+
554
+ if (Number.isInteger(event.data.measure)) {
555
+ const measure = this.measures[event.data.measure - 1];
556
+ console.assert(!!measure, "measure index is invalid:", event.data.measure, this.measures.length);
557
+
558
+ measure.events.push({
559
+ data: event.data,
560
+ track,
561
+ ticks: Math.round(event.ticks * tickFactor - measure.tick),
562
+ });
563
+ }
564
+ else {
565
+ switch (event.data.subtype) {
566
+ case "setTempo":
567
+ case "timeSignature":
568
+ case "keySignature": {
569
+ // find container measure by tick range
570
+ const tick = event.ticks * tickFactor;
571
+ const measure = this.measures.find(measure => tick >= measure.tick && tick < measure.tick + measure.duration);
572
+ if (measure) {
573
+ measure.events.push({
574
+ data: event.data,
575
+ track,
576
+ ticks: Math.round(tick - measure.tick),
577
+ });
578
+ }
579
+ }
580
+
581
+ break;
582
+ }
583
+ }
584
+ });
585
+
586
+ this.ripe = true;
587
+
588
+ return this;
589
+ }
590
+
591
+
592
+ // find the MIDI event of setTempo in measures data, and change the value of microsecondsPerBeat
593
+ setTempo (bpm: number): boolean {
594
+ let found = false;
595
+ for (const measure of this.measures) {
596
+ for (const event of measure.events) {
597
+ if (event.data.subtype === "setTempo") {
598
+ event.data.microsecondsPerBeat = 60e+6 / bpm;
599
+ found = true;
600
+ }
601
+ }
602
+ }
603
+
604
+ return found;
605
+ }
606
+ };
607
+
608
+
609
+ export const assignNotationEventsIds = (midiNotation: MusicNotation.NotationData, fields = ["ids"]) => {
610
+ const events = midiNotation.notes.reduce((events, note) => {
611
+ const dict = pick(note, fields);
612
+ events.push({ticks: note.startTick, subtype: "noteOn", channel: note.channel, pitch: note.pitch, dict});
613
+ events.push({ticks: note.endTick, subtype: "noteOff", channel: note.channel, pitch: note.pitch, dict});
614
+
615
+ ["setTempo", "timeSignature", "keySignature"].forEach(subtype => events.push({ticks: note.startTick, subtype, dict}));
616
+
617
+ return events;
618
+ }, []).sort((e1, e2) => e1.ticks - e2.ticks);
619
+
620
+ let index = -1;
621
+ let ticks = -Infinity;
622
+ for (const event of midiNotation.events) {
623
+ console.assert(Number.isFinite(event.ticks), "invalid event ticks:", event);
624
+
625
+ while (event.ticks > ticks && index < events.length) {
626
+ ++index;
627
+ ticks = events[index] && events[index].ticks;
628
+ }
629
+
630
+ if (index >= events.length)
631
+ break;
632
+
633
+ if (event.ticks < ticks)
634
+ continue;
635
+
636
+ for (let i = index; i < events.length; ++i) {
637
+ const ne = events[i];
638
+ if (!ne) {
639
+ console.warn("null event:", i, events.length);
640
+ break;
641
+ }
642
+
643
+ if (ne.ticks > ticks)
644
+ break;
645
+ else {
646
+ if (event.data.subtype === ne.subtype && event.data.channel === ne.channel && event.data.noteNumber === ne.pitch) {
647
+ Object.assign(event.data, ne.dict);
648
+ break;
649
+ }
650
+ }
651
+ }
652
+ }
653
+ };
654
+
655
+
656
+ const assignNotationNoteDataFromEvents = (midiNotation: MusicNotation.NotationData, fields = ["ids", "measure", "staffTrack"]) => {
657
+ const noteId = (channel: number, pitch: number, tick: number): string => `${channel}|${pitch}|${tick}`;
658
+
659
+ const noteMap = midiNotation.notes.reduce((map, note) => {
660
+ map[noteId(note.channel, note.pitch, note.startTick)] = note;
661
+
662
+ return map;
663
+ }, {});
664
+
665
+ midiNotation.events.forEach(event => {
666
+ if (event.data.subtype === "noteOn") {
667
+ const id = noteId(event.data.channel, event.data.noteNumber, event.ticks);
668
+ const note = noteMap[id];
669
+ console.assert(!!note, "cannot find note of", id);
670
+
671
+ if (note)
672
+ Object.assign(note, pick(event.data, fields));
673
+ }
674
+ });
675
+ };
inc/lilyNotation/scheduler.ts ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {MusicNotation} from "@k-l-lambda/music-widgets";
3
+
4
+ import {ChordPosition} from "./notation";
5
+
6
+
7
+
8
+ declare class StaffToken {
9
+ system?: number;
10
+ measure?: number;
11
+ x: number;
12
+ endX?: number;
13
+ };
14
+
15
+
16
+ interface TickItem {
17
+ tick: number;
18
+ endTick?: number;
19
+ system: number;
20
+ measure: number;
21
+ x: number;
22
+ endX: number;
23
+ };
24
+
25
+
26
+ interface SheetPosition {
27
+ system: number,
28
+ x: number,
29
+ };
30
+
31
+
32
+ interface Note extends MusicNotation.Note {
33
+ chordPosition?: ChordPosition;
34
+ measure?: number;
35
+ outMeasure?: boolean;
36
+ };
37
+
38
+
39
+ interface Notation {
40
+ notes: Note[];
41
+ endTick: number;
42
+ };
43
+
44
+
45
+
46
+ export default class Scheduler {
47
+ tickTable: TickItem[];
48
+
49
+
50
+ static createFromNotation (midiNotation: Notation, tokenMap: Map<string, StaffToken>): Scheduler {
51
+ const tokenTable: {[key: number]: StaffToken[]} = {};
52
+ const idSet = new Set<string>();
53
+ let measureIndex = 0;
54
+
55
+ midiNotation.notes.filter(note => !note.outMeasure && (!note.chordPosition || note.chordPosition.index === 0)).forEach(note => {
56
+ if (note.ids) {
57
+ if (note.measure !== measureIndex) {
58
+ idSet.clear();
59
+ measureIndex = note.measure;
60
+ }
61
+ else if (note.ids.some(id => idSet.has(id)))
62
+ return;
63
+ note.ids.forEach(idSet.add.bind(idSet));
64
+
65
+ tokenTable[note.startTick] = tokenTable[note.startTick] || [];
66
+ const tokens = note.ids.map(id => tokenMap.get(id)).filter(t => t);
67
+ tokenTable[note.startTick].push(...tokens);
68
+ }
69
+ });
70
+ //console.log("tokenTable:", tokenTable);
71
+
72
+ return Scheduler.createFromTokenTable(tokenTable, midiNotation.endTick);
73
+ }
74
+
75
+
76
+ static createFromTokenTable (tokenTable: {[key: number]: StaffToken[]}, endTick: number): Scheduler {
77
+ const tickTable: TickItem[] = Object.entries(tokenTable).map(([tick, tokens]) => {
78
+ if (!tokens.length)
79
+ return null;
80
+
81
+ tokens.sort((t1, t2) => t1.system === t2.system ? t1.x - t2.x : t1.system - t2.system);
82
+ const token = tokens[0];
83
+
84
+ return {
85
+ tick: Number(tick),
86
+ system: token.system,
87
+ measure: token.measure,
88
+ x: token.x,
89
+ endX: token.endX,
90
+ };
91
+ }).filter(Boolean).sort((i1, i2) => i1.tick - i2.tick);
92
+ //console.log("sequence:", sequence);
93
+
94
+ tickTable.forEach((item, i) => {
95
+ const nextItem = tickTable[i + 1];
96
+
97
+ item.endTick = nextItem ? nextItem.tick : endTick;
98
+ console.assert(item.endTick > item.tick, "invalid tick item, tick span is non-positive:", item, tokenTable[item.tick]);
99
+
100
+ if (nextItem && item.system === nextItem.system && [0, 1].includes(nextItem.measure - item.measure))
101
+ item.endX = nextItem.x;
102
+ });
103
+
104
+ return new Scheduler({
105
+ tickTable,
106
+ });
107
+ }
108
+
109
+
110
+ constructor ({tickTable}: {tickTable: TickItem[]}) {
111
+ console.assert(tickTable.length > 0, "invalid tick table:", tickTable);
112
+
113
+ this.tickTable = tickTable;
114
+ }
115
+
116
+
117
+ get startTick (): number {
118
+ if (!this.tickTable[0])
119
+ return null;
120
+
121
+ return this.tickTable[0].tick;
122
+ }
123
+
124
+
125
+ get endTick (): number {
126
+ if (!this.tickTable[0])
127
+ return null;
128
+
129
+ return this.tickTable[this.tickTable.length - 1].endTick;
130
+ }
131
+
132
+
133
+ lookupPosition (tick: number): SheetPosition {
134
+ tick = Math.max(Math.min(tick, this.endTick), this.startTick);
135
+
136
+ const item = this.tickTable.find(item => item.tick <= tick && item.endTick > tick) || this.tickTable[this.tickTable.length - 1];
137
+ if (!item) {
138
+ console.warn("cannot find tick item:", tick, this.tickTable);
139
+ return null;
140
+ }
141
+
142
+ const x = item.x + (tick - item.tick) * (item.endX - item.x) / (item.endTick - item.tick);
143
+
144
+ return {
145
+ system: item.system,
146
+ x,
147
+ };
148
+ }
149
+
150
+
151
+ lookupTick (position: SheetPosition): number {
152
+ const rowItems = this.tickTable.filter(item => item.system === position.system).sort((i1, i2) => i1.x - i2.x);
153
+ let item = rowItems.find(item => item.x <= position.x && item.endX >= position.x);
154
+ if (!item) {
155
+ const firstItem = rowItems[0];
156
+ if (firstItem && position.x < firstItem.endX)
157
+ item = firstItem;
158
+ else
159
+ //console.warn("lookup position out of range:", position, this.tickTable);
160
+ return null;
161
+ }
162
+
163
+ const tick = item.tick + Math.max(position.x - item.x, 0) * (item.endTick - item.tick) / (item.endX - item.x);
164
+
165
+ return tick;
166
+ }
167
+ };
inc/lilyParser/idioms.ts ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ const PHONETS = "cdefgab";
3
+ const PHONETS_ALIAS = {
4
+ h: "b",
5
+ };
6
+
7
+ const phonetDifferToShift = differ => differ > 3 ? -1 : (differ < -3 ? 1 : 0);
8
+
9
+ const PHONET_VALUES = {
10
+ c: 0, d: 2, e: 4, f: 5, g: 7, a: 9, b: 11,
11
+ };
12
+
13
+
14
+ const SHARP_ALTERS = [
15
+ "is", "d", "s", "iss", "k", "sharp",
16
+ ];
17
+ const FLAT_ALTERS = [
18
+ "es", "b", "f", "ess", "flat",
19
+ ];
20
+ // in Dutch, 'as', 'es' means a flat/e flat, that's not supported here
21
+
22
+ const DOUBLE_SHARP_ALTERS = [
23
+ ...SHARP_ALTERS.map(word => word + word), "x",
24
+ ];
25
+ const DOUBLE_FLAT_ALTERS = [
26
+ ...FLAT_ALTERS.map(word => word + word), "ses",
27
+ ];
28
+
29
+ const alterTablize = (list, value) => list.reduce((table, word) => ((table[word] = value), table), {});
30
+
31
+
32
+ const ALTER_VALUES = {
33
+ ...alterTablize(SHARP_ALTERS, 1),
34
+ ...alterTablize(FLAT_ALTERS, -1),
35
+ ...alterTablize(DOUBLE_SHARP_ALTERS, 2),
36
+ ...alterTablize(DOUBLE_FLAT_ALTERS, -2),
37
+ };
38
+
39
+
40
+ const FIFTH_PHONETS = "fcgdaeb";
41
+
42
+
43
+
44
+ export {
45
+ PHONETS,
46
+ PHONETS_ALIAS,
47
+ phonetDifferToShift,
48
+ PHONET_VALUES,
49
+ ALTER_VALUES,
50
+ FIFTH_PHONETS,
51
+ };
inc/lilyParser/index.ts ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {termDictionary, getDurationSubdivider, BaseTerm, MusicEvent} from "./lilyTerms";
3
+ import LilyDocument from "./lilyDocument";
4
+ import LilyInterpreter, {MusicTrack, TrackContext, TremoloType} from "./lilyInterpreter";
5
+ export * from "./utils";
6
+
7
+ import * as measures from "./measures";
8
+ import {createPianoRhythm} from "./pianoRhythm";
9
+
10
+
11
+
12
+ const LilyTerms = termDictionary;
13
+
14
+
15
+
16
+ export {
17
+ LilyDocument,
18
+ LilyInterpreter,
19
+ MusicTrack,
20
+ TrackContext,
21
+ TremoloType,
22
+ BaseTerm,
23
+ MusicEvent,
24
+ LilyTerms,
25
+ getDurationSubdivider,
26
+ measures,
27
+ createPianoRhythm,
28
+ };
inc/lilyParser/lilyDocument.ts ADDED
@@ -0,0 +1,1062 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import TextSource from "../textSource";
3
+ import {LILY_STAFF_SIZE_DEFAULT} from "../constants";
4
+ import {
5
+ parseRaw,
6
+ BaseTerm, Assignment, LiteralString, Command, Variable, MarkupCommand, Grace, AfterGrace, Include, Version, Block, InlineBlock,
7
+ Scheme, Chord, BriefChord, Lyric, MusicBlock, SimultaneousList, ContextedMusic, Divide, Tempo, PostEvent, Primitive, ChordElement, MusicEvent,
8
+ SchemePointer, Comment, Language, StemDirection,
9
+ } from "./lilyTerms";
10
+ import LilyInterpreter from "./lilyInterpreter";
11
+ import {MAIN_SCORE_NAME, DocLocation} from "./utils";
12
+
13
+ // eslint-disable-next-line
14
+ import {Root} from "./lilyTerms";
15
+
16
+
17
+
18
+ type AttributeValue = number | boolean | string | BaseTerm;
19
+
20
+ interface AttributeValueHandle {
21
+ value: AttributeValue;
22
+ };
23
+
24
+
25
+ export interface LilyDocumentAttribute {
26
+ [key: string]: AttributeValueHandle
27
+ };
28
+
29
+ export interface LilyDocumentAttributeReadOnly {
30
+ staffSize: number;
31
+ [key: string]: AttributeValue
32
+ };
33
+
34
+
35
+
36
+ export default class LilyDocument {
37
+ root: Root;
38
+
39
+ cacheInterpreter?: LilyInterpreter;
40
+
41
+ reservedVariables?: Set<string>;
42
+
43
+
44
+ constructor (data: object) {
45
+ //console.log("raw data:", data);
46
+ this.root = parseRaw(data);
47
+ }
48
+
49
+
50
+ toString () {
51
+ return this.root.join();
52
+ //return this.root.serialize();
53
+ }
54
+
55
+
56
+ interpret ({useCached = true} = {}): LilyInterpreter {
57
+ if (!useCached || !this.cacheInterpreter) {
58
+ this.cacheInterpreter = new LilyInterpreter();
59
+ this.cacheInterpreter.interpretDocument(this);
60
+ }
61
+
62
+ return this.cacheInterpreter;
63
+ }
64
+
65
+
66
+ globalAttributes ({readonly = false} = {}): LilyDocumentAttribute | LilyDocumentAttributeReadOnly {
67
+ const globalStaffSize = this.root.getField("set-global-staff-size");
68
+ const header = this.root.getBlock("header");
69
+ let paper = this.root.getBlock("paper");
70
+ const layoutStaffSize = paper && paper.getField("layout-set-staff-size");
71
+ let staffSize = globalStaffSize || layoutStaffSize;
72
+
73
+ if (!readonly) {
74
+ let sectionsDirty = false;
75
+
76
+ if (!staffSize) {
77
+ this.root.sections.push(new Scheme({exp: {proto: "SchemeFunction", func: "set-global-staff-size", args: [LILY_STAFF_SIZE_DEFAULT]}}));
78
+ staffSize = this.root.getField("set-global-staff-size");
79
+
80
+ sectionsDirty = true;
81
+ }
82
+
83
+ // A4 paper size
84
+ const DEFAULT_PAPER_WIDTH = {
85
+ proto: "Assignment",
86
+ key: "paper-width",
87
+ value: {proto: "NumberUnit", number: 21, unit: "\\cm"},
88
+ };
89
+ const DEFAULT_PAPER_HEIGHT = {
90
+ proto: "Assignment",
91
+ key: "paper-height",
92
+ value: {proto: "NumberUnit", number: 29.71, unit: "\\cm"},
93
+ };
94
+
95
+ if (!paper) {
96
+ paper = new Block({
97
+ block: "score",
98
+ head: "\\paper",
99
+ body: [DEFAULT_PAPER_WIDTH, DEFAULT_PAPER_HEIGHT],
100
+ });
101
+ this.root.sections.push(paper);
102
+
103
+ sectionsDirty = true;
104
+ }
105
+
106
+ if (!paper.getField("paper-width"))
107
+ paper.body.push(parseRaw(DEFAULT_PAPER_WIDTH));
108
+
109
+ if (!paper.getField("paper-height"))
110
+ paper.body.push(parseRaw(DEFAULT_PAPER_HEIGHT));
111
+
112
+ if (sectionsDirty)
113
+ this.root.reorderSections();
114
+ }
115
+ else
116
+ staffSize = staffSize || {value: LILY_STAFF_SIZE_DEFAULT};
117
+
118
+ const blockPropertyCommon = (block: Block, key: string) => ({
119
+ get value () {
120
+ if (!block)
121
+ return undefined;
122
+
123
+ const item = block.getField(key);
124
+ if (!item)
125
+ return undefined;
126
+
127
+ return item.value;
128
+ },
129
+
130
+ set value (value) {
131
+ console.assert(!!block, "block is null.");
132
+
133
+ if (value === undefined) // delete field
134
+ block.body = block.body.filter(assign => !(assign instanceof Assignment) || assign.key !== key);
135
+ else {
136
+ const item = block.getField(key);
137
+ if (item)
138
+ item.value = parseRaw(value);
139
+ else
140
+ block.body.push(new Assignment({key, value}));
141
+ }
142
+ },
143
+ });
144
+ const paperPropertyCommon = key => blockPropertyCommon(paper, key);
145
+
146
+ const paperPropertySchemeToken = key => ({
147
+ get value () {
148
+ if (!paper)
149
+ return undefined;
150
+
151
+ const item = paper.getField(key);
152
+ if (!item)
153
+ return undefined;
154
+
155
+ return item.value.exp;
156
+ },
157
+
158
+ set value (value) {
159
+ console.assert(!!paper, "paper is null.");
160
+
161
+ const item = paper.getField(key);
162
+ if (item)
163
+ item.value.exp = value;
164
+ else
165
+ paper.body.push(new Assignment({key, value: {proto: "Scheme", exp: value}}));
166
+ },
167
+ });
168
+
169
+ let midiBlock = null;
170
+ const scores = this.root.sections.filter(section => section instanceof Block && section.head === "\\score") as Block[];
171
+ for (const score of scores) {
172
+ midiBlock = score.body.find(term => term instanceof Block && term.head === "\\midi");
173
+ if (midiBlock)
174
+ break;
175
+ }
176
+
177
+ const midiTempo = {
178
+ get value (): Tempo {
179
+ return midiBlock && midiBlock.body.find(term => term instanceof Tempo);
180
+ },
181
+
182
+ set value (value: Tempo) {
183
+ if (!midiBlock) {
184
+ const score = this.root.getBlock("score");
185
+ if (score) {
186
+ midiBlock = new Block({block: "score", head: "\\midi", body: []});
187
+ score.body.push(midiBlock);
188
+ }
189
+ else
190
+ console.warn("no score block, midiTempo assign failed.");
191
+ }
192
+
193
+ if (midiBlock) {
194
+ midiBlock.body = midiBlock.body.filter(term => !(term instanceof Tempo));
195
+ midiBlock.body.push(value);
196
+ }
197
+ },
198
+ };
199
+
200
+ const assignments = this.root.entries.filter(term => term instanceof Assignment) as Assignment[];
201
+ const assignmentTable = assignments.reduce((table, assign) => ((table[assign.key.toString()] = assign.query(assign.key)), table), {});
202
+
203
+ const headerFields = [
204
+ "title", "subtitle", "subsubtitle", "composer", "poet", "arranger", "opus", "copyright", "instrument", "dedication", "tagline",
205
+ ].reduce((dict, field) => ((dict[field] = blockPropertyCommon(header, field)), dict), {});
206
+
207
+ const attributes = {
208
+ staffSize,
209
+ midiTempo,
210
+ ...headerFields,
211
+ paperWidth: paperPropertyCommon("paper-width"),
212
+ paperHeight: paperPropertyCommon("paper-height"),
213
+ topMargin: paperPropertyCommon("top-margin"),
214
+ bottomMargin: paperPropertyCommon("bottom-margin"),
215
+ leftMargin: paperPropertyCommon("left-margin"),
216
+ rightMargin: paperPropertyCommon("right-margin"),
217
+ systemSpacing: paperPropertySchemeToken("system-system-spacing.basic-distance"),
218
+ topMarkupSpacing: paperPropertySchemeToken("top-markup-spacing.basic-distance"),
219
+ raggedLast: paperPropertySchemeToken("ragged-last"),
220
+ raggedBottom: paperPropertySchemeToken("ragged-bottom"),
221
+ raggedLastBottom: paperPropertySchemeToken("ragged-last-bottom"),
222
+ printPageNumber: paperPropertySchemeToken("print-page-number"),
223
+ ...assignmentTable,
224
+ };
225
+
226
+ if (readonly)
227
+ Object.keys(attributes).forEach(key => attributes[key] = attributes[key] && attributes[key].value);
228
+
229
+ return attributes;
230
+ }
231
+
232
+
233
+ globalAttributesReadOnly (): LilyDocumentAttributeReadOnly {
234
+ const attributes = this.globalAttributes() as any;
235
+ Object.keys(attributes).forEach(key => attributes[key] = attributes[key] && attributes[key].value);
236
+
237
+ return attributes;
238
+ }
239
+
240
+
241
+ markup (docMarkup: LilyDocument) {
242
+ // copy attributes
243
+ const attrS = this.globalAttributes() as LilyDocumentAttribute;
244
+ const attrM = docMarkup.globalAttributesReadOnly();
245
+
246
+ [
247
+ "staffSize", "midiTempo", "paperWidth", "paperHeight",
248
+ "topMargin", "bottomMargin", "leftMargin", "rightMargin",
249
+ "systemSpacing", "topMarkupSpacing", "raggedLast", "raggedBottom", "raggedLastBottom",
250
+ "printPageNumber",
251
+ ].forEach(field => {
252
+ if (attrM[field] !== undefined) {
253
+ if (typeof attrS[field].value === "object" && attrS[field].value && (attrS[field].value as any).set)
254
+ (attrS[field].value as any).set(attrM[field]);
255
+ else
256
+ attrS[field].value = attrM[field];
257
+ }
258
+ });
259
+
260
+ // execute commands list
261
+ const commands = docMarkup.root.getField("LotusCommands");
262
+ const cmdList = commands && commands.value && commands.value.args && commands.value.args[0].body;
263
+ if (cmdList && Array.isArray(cmdList)) {
264
+ for (const command of cmdList) {
265
+ if (command.exp && this[command.exp])
266
+ this[command.exp]();
267
+ else
268
+ console.warn("unexpected markup command:", command);
269
+ }
270
+ }
271
+
272
+ // copy LotusOption assignments
273
+ const assignments = docMarkup.root.entries.filter(term => term instanceof Assignment && /^LotusOption\..+/.test(term.key.toString()));
274
+ assignments.forEach(assignment => this.root.sections.push(assignment.clone()));
275
+
276
+ // copy score blocks
277
+ const layoutBody = [];
278
+ const midiBody = [];
279
+ const score = docMarkup.root.getBlock("score");
280
+ if (score) {
281
+ const layout = score.body.find(term => term instanceof Block && term.head === "\\layout") as Block;
282
+ if (layout)
283
+ layout.body.forEach(term => layoutBody.push(term.clone()));
284
+
285
+ const midi = score.body.find(term => term instanceof Block && term.head === "\\midi") as Block;
286
+ if (midi)
287
+ midi.body.forEach(term => midiBody.push(term.clone()));
288
+ }
289
+ if (layoutBody.length || midiBody.length) {
290
+ const thisScore = this.root.getBlock("score");
291
+ if (thisScore) {
292
+ const layout = thisScore.body.find(term => term instanceof Block && term.head === "\\layout") as Block;
293
+ if (layout)
294
+ layout.body.push(...layoutBody);
295
+
296
+ const midi = thisScore.body.find(term => term instanceof Block && term.head === "\\midi") as Block;
297
+ if (midi)
298
+ midi.body.push(...midiBody);
299
+ }
300
+ }
301
+ }
302
+
303
+
304
+ getVariables (): Set<string> {
305
+ return new Set(this.root.findAll(Variable).map(variable => variable.name));
306
+ }
307
+
308
+
309
+ // deprecated
310
+ getMusicTracks ({expand = false} = {}): MusicBlock[] {
311
+ const score = this.root.getBlock("score");
312
+ if (!score)
313
+ return null;
314
+
315
+ let tracks = [];
316
+
317
+ // extract sequential music blocks from score block
318
+ score.forEachTopTerm(MusicBlock, block => {
319
+ tracks.push(block);
320
+ });
321
+
322
+ // expand variables in tracks
323
+ if (expand)
324
+ tracks = tracks.map(track => track.clone().expandVariables(this.root));
325
+
326
+ return tracks;
327
+ }
328
+
329
+
330
+ getLocationTickTable (): {[key: string]: number} {
331
+ const notes = this.root.findAll(term => (term instanceof ChordElement) || (term instanceof MusicEvent));
332
+
333
+ return notes.reduce((table, note) => {
334
+ if (note._location && Number.isFinite(note._tick))
335
+ table[`${note._location.lines[0]}:${note._location.columns[0]}`] = note._tick;
336
+
337
+ return table;
338
+ }, {});
339
+ }
340
+
341
+
342
+ // update terms' _location data according to a serialized source
343
+ relocate (source: string = this.toString()) {
344
+ this.root.relocate(source);
345
+ }
346
+
347
+
348
+ appendIncludeFile (filename: string) {
349
+ if (!this.root.includeFiles.includes(filename)) {
350
+ const versionPos = this.root.sections.findIndex(term => term instanceof Version);
351
+ this.root.sections.splice(versionPos + 1, 0,
352
+ new Include({cmd: "include", args: [LiteralString.fromString(filename)]}));
353
+ }
354
+ }
355
+
356
+
357
+ removeStaffGroup () {
358
+ const score = this.root.getBlock("score");
359
+ if (score) {
360
+ score.body.forEach(item => {
361
+ if (item instanceof SimultaneousList)
362
+ item.removeStaffGroup();
363
+ });
364
+ }
365
+ }
366
+
367
+
368
+ fixTinyTrillSpans () {
369
+ // TODO: replace successive \startTrillSpan & \stopTrillSpan with ^\trill
370
+ }
371
+
372
+
373
+ removeMusicCommands (cmds: string | string[]) {
374
+ cmds = Array.isArray(cmds) ? cmds : [cmds];
375
+
376
+ const isToRemoved = item => (item instanceof Command) && cmds.includes(item.cmd);
377
+
378
+ this.root.forEachTerm(MusicBlock, block => {
379
+ block.body = block.body.filter(item => !isToRemoved(item));
380
+ });
381
+ }
382
+
383
+
384
+ removeTrillSpans () {
385
+ this.removeMusicCommands(["startTrillSpan", "stopTrillSpan"]);
386
+ }
387
+
388
+
389
+ removeBreaks () {
390
+ this.removeMusicCommands("break");
391
+ }
392
+
393
+
394
+ removePageBreaks () {
395
+ this.removeMusicCommands("pageBreak");
396
+ }
397
+
398
+
399
+ scoreBreakBefore (enabled = true) {
400
+ const score = this.root.getBlock("score");
401
+ if (score) {
402
+ let header = score.entries.find((entry: any) => entry.head === "\\header") as Block;
403
+ if (!header) {
404
+ header = new Block({head: "\\header", body: []});
405
+ score.body.push(header);
406
+ }
407
+
408
+ let breakbefore = header.getField("breakbefore");
409
+ if (breakbefore)
410
+ breakbefore = breakbefore.value;
411
+
412
+ else {
413
+ breakbefore = new Scheme({exp: true});
414
+ header.body.push(new Assignment({key: "breakbefore", value: breakbefore}));
415
+ }
416
+
417
+ breakbefore.exp = enabled;
418
+ }
419
+ else
420
+ console.warn("no score block");
421
+ }
422
+
423
+
424
+ unfoldRepeats () {
425
+ const score = this.root.getBlock("score");
426
+ const musicList = score ? score.body : this.root.sections;
427
+
428
+ let count = 0;
429
+
430
+ musicList.forEach((term, i) => {
431
+ if (term.isMusic && (term as Command).cmd !== "unfoldRepeats") {
432
+ const unfold = new Command({cmd: "unfoldRepeats", args: [term]});
433
+ musicList.splice(i, 1, unfold);
434
+
435
+ ++count;
436
+ }
437
+ });
438
+
439
+ if (!count)
440
+ console.warn("no music term to unfold");
441
+
442
+ return count;
443
+ }
444
+
445
+
446
+ containsRepeat (): boolean {
447
+ const termContainsRepeat = (term: BaseTerm): boolean => {
448
+ if (!term.entries)
449
+ return false;
450
+
451
+ const subTerms = term.entries.filter(term => term instanceof BaseTerm);
452
+
453
+ for (const term of subTerms) {
454
+ if ((term as Command).cmd === "repeat")
455
+ return true;
456
+ }
457
+
458
+ for (const term of subTerms) {
459
+ if (termContainsRepeat(term))
460
+ return true;
461
+ }
462
+
463
+ return false;
464
+ };
465
+
466
+ return termContainsRepeat(this.root);
467
+ }
468
+
469
+
470
+ removeEmptySubMusicBlocks () {
471
+ this.root.forEachTerm(MusicBlock, block => {
472
+ block.body = block.body.filter(term => !(term instanceof MusicBlock && term.body.length === 0));
473
+ });
474
+ }
475
+
476
+
477
+ mergeContinuousGraces () {
478
+ this.removeEmptySubMusicBlocks();
479
+
480
+ const isGraceCommand = term => term instanceof Grace;
481
+ const isGraceInnerTerm = term => isGraceCommand(term) || term instanceof Divide || term instanceof PostEvent;
482
+
483
+ this.root.forEachTerm(MusicBlock, block => {
484
+ const groups = [];
485
+ let currentGroup = null;
486
+
487
+ block.body.forEach((term, i) => {
488
+ if (currentGroup) {
489
+ if (isGraceInnerTerm(term)) {
490
+ currentGroup.count++;
491
+
492
+ if (currentGroup.count === 2)
493
+ groups.push(currentGroup);
494
+ }
495
+ else
496
+ currentGroup = null;
497
+ }
498
+ else {
499
+ if (isGraceCommand(term))
500
+ currentGroup = {start: i, count: 1};
501
+ }
502
+ });
503
+
504
+ let offset = 0;
505
+ groups.forEach(group => {
506
+ const startIndex = group.start + offset;
507
+ const mainBody = new MusicBlock({body: []});
508
+
509
+ for (let i = startIndex; i < startIndex + group.count; ++ i) {
510
+ const term = block.body[i];
511
+ const music = isGraceCommand(term) ? term.args[0] : term;
512
+ if (music instanceof MusicBlock)
513
+ mainBody.body.push(...music.body);
514
+ else
515
+ mainBody.body.push(music);
516
+ }
517
+
518
+ block.body[startIndex].args[0] = mainBody;
519
+ block.body.splice(startIndex + 1, group.count - 1);
520
+
521
+ offset -= group.count - 1;
522
+ });
523
+ });
524
+ }
525
+
526
+
527
+ mergeContinuousEmptyAfterGraces () {
528
+ const isEmptyAfterGrace = term => term instanceof AfterGrace && term.args[0] instanceof MusicBlock && term.args[0].body.length === 0;
529
+ const isGraceInnerTerm = term => isEmptyAfterGrace(term) || term instanceof Divide || term instanceof PostEvent;
530
+
531
+ this.root.forEachTerm(MusicBlock, block => {
532
+ const groups = [];
533
+ let currentGroup = null;
534
+
535
+ block.body.forEach((term, i) => {
536
+ if (currentGroup) {
537
+ if (isGraceInnerTerm(term)) {
538
+ currentGroup.count++;
539
+
540
+ if (currentGroup.count === 2)
541
+ groups.push(currentGroup);
542
+ }
543
+ else
544
+ currentGroup = null;
545
+ }
546
+ else {
547
+ if (isEmptyAfterGrace(term))
548
+ currentGroup = {start: i, count: 1};
549
+ }
550
+ });
551
+
552
+ let offset = 0;
553
+ groups.forEach(group => {
554
+ const startIndex = group.start + offset;
555
+ const mainBody = new MusicBlock({body: []});
556
+
557
+ for (let i = startIndex; i < startIndex + group.count; ++ i) {
558
+ const term = block.body[i];
559
+ const music = isEmptyAfterGrace(term) ? term.args[1] : term;
560
+ if (music instanceof MusicBlock)
561
+ mainBody.body.push(...music.body);
562
+ else
563
+ mainBody.body.push(music);
564
+ }
565
+
566
+ block.body[startIndex].args[1] = mainBody;
567
+ block.body.splice(startIndex + 1, group.count - 1);
568
+
569
+ offset -= group.count - 1;
570
+ });
571
+ });
572
+ }
573
+
574
+
575
+ fixInvalidKeys (mode = "major") {
576
+ this.root.forEachTerm(Command, cmd => {
577
+ if (cmd.cmd === "key") {
578
+ if (cmd.args[1] === "\\none")
579
+ cmd.args[1] = "\\" + mode;
580
+ }
581
+ });
582
+ }
583
+
584
+
585
+ fixInvalidBriefChords () {
586
+ this.root.forEachTerm(BriefChord, chord => {
587
+ const items = chord.body.items;
588
+ if (items) {
589
+ // merge multiple ^ items
590
+ while (items.filter(item => item === "^").length > 1) {
591
+ const index = items.lastIndexOf("^");
592
+ items.splice(index, 1, ".");
593
+ }
594
+ }
595
+ });
596
+ }
597
+
598
+
599
+ fixInvalidMarkupWords () {
600
+ this.root.forEachTerm(MarkupCommand, cmd => {
601
+ //console.log("markup:", cmd);
602
+ cmd.forEachTerm(InlineBlock, block => {
603
+ // replace scheme expression by literal string
604
+ block.body = block.body.map(term => {
605
+ if (term instanceof Scheme)
606
+ return LiteralString.fromString(term.join().replace(/\s+$/, ""));
607
+
608
+ if (typeof term === "string" && term.includes("$"))
609
+ return LiteralString.fromString(term);
610
+
611
+ return term;
612
+ });
613
+ });
614
+ });
615
+ }
616
+
617
+
618
+ fixNestedRepeat () {
619
+ // \repeat { \repeat { P1 } \alternative { {P2} } } \alternative { {P3} }
620
+ // ->
621
+ // \repeat { P1 } \alternative { {P2} {P3} }
622
+ this.root.forEachTerm(Command, cmd => {
623
+ if (cmd.isRepeatWithAlternative) {
624
+ const block = cmd.args[2];
625
+ const alternative = cmd.args[3].args[0];
626
+ const lastMusic = block.body[block.body.length - 1];
627
+ if (lastMusic && lastMusic.isRepeatWithAlternative) {
628
+ block.body.splice(block.body.length - 1, 1, ...lastMusic.args[2].body);
629
+ alternative.body = [...lastMusic.args[3].args[0].body, ...alternative.body];
630
+ }
631
+ }
632
+ });
633
+ }
634
+
635
+
636
+ fixEmptyContextedStaff () {
637
+ // staff.1 << >> staff.2 << voice.1 {} voice.2 {} >>
638
+ // ->
639
+ // staff.1 << voice.1 {} >> staff.2 << voice.2 {} >>
640
+ const subMusics = (simul: SimultaneousList) => simul.list.filter(term => term instanceof ContextedMusic);
641
+
642
+ const score = this.root.getBlock("score");
643
+ score.forEachTerm(SimultaneousList, simul => {
644
+ const staves = simul.list.filter(term => term instanceof ContextedMusic && term.body instanceof SimultaneousList);
645
+ if (staves.length > 1) {
646
+ const staff1 = staves[0].body;
647
+ const staff2 = staves[1].body;
648
+
649
+ if (subMusics(staff1).length === 0 && subMusics(staff2).length > 1) {
650
+ const index = staff2.list.findIndex(term => term instanceof ContextedMusic);
651
+ const [music] = staff2.list.splice(index, 1);
652
+ staff1.list.push(music);
653
+ }
654
+ }
655
+ });
656
+ }
657
+
658
+
659
+ removeEmptyContextedStaff () {
660
+ const subMusics = (simul: SimultaneousList) => simul.list.filter(term => term instanceof ContextedMusic);
661
+
662
+ const score = this.root.getBlock("score");
663
+ score.forEachTerm(SimultaneousList, simul => {
664
+ simul.list = simul.list.filter(term => !(term instanceof ContextedMusic) || !(term.body instanceof SimultaneousList)
665
+ || subMusics(term.body).length > 0);
666
+ });
667
+ }
668
+
669
+
670
+ redivide () {
671
+ this.root.forEachTopTerm(MusicBlock, (block: MusicBlock) => block.redivide());
672
+ }
673
+
674
+
675
+ makeMIDIDedicatedScore (): Block {
676
+ const block = this.root.findFirst(term => term instanceof Block && term.head === "\\score" && term.isMIDIDedicated) as Block;
677
+ if (block)
678
+ return block;
679
+
680
+ const score = this.root.getBlock("score");
681
+ const newScore = score.clone();
682
+
683
+ newScore.body = newScore.body.filter(term => !(term instanceof Block && term.head === "\\layout"));
684
+ score.body = score.body.filter(term => !(term instanceof Block && term.head === "\\midi"));
685
+
686
+ this.root.sections.push(newScore);
687
+
688
+ return newScore;
689
+ }
690
+
691
+
692
+ excludeChordTracksFromMIDI () {
693
+ // if there is chord mode music in score, duplicate score block as a dedicated MIDI score which excludes chord mode music.
694
+ let contains = false;
695
+
696
+ const isChordMusic = term => term instanceof ContextedMusic
697
+ && term.head instanceof Command && term.head.args[0] === "ChordNames";
698
+
699
+ const isBlock = (head, term) => term instanceof Block && term.head === head;
700
+
701
+ // TODO: midiMusic forked in interpreter issue
702
+ //this.abstractMainScore();
703
+
704
+ const score = this.root.getBlock("score");
705
+ const newScore = score.clone() as Block;
706
+ newScore.forEachTerm(SimultaneousList, simul => {
707
+ const trimmedList = simul.list.filter(term => !isChordMusic(term));
708
+ if (trimmedList.length < simul.list.length) {
709
+ simul.list = trimmedList;
710
+ contains = true;
711
+ }
712
+ });
713
+ newScore._headComment = Comment.createSingle(" midi output");
714
+
715
+ if (contains) {
716
+ const trimmedBody = score.body.filter(term => !isBlock("\\midi", term));
717
+ if (trimmedBody.length < score.body.length) {
718
+ score.body = trimmedBody;
719
+
720
+ newScore.body = newScore.body.filter(term => !isBlock("\\layout", term));
721
+ this.root.sections.push(newScore);
722
+ }
723
+ }
724
+ }
725
+
726
+
727
+ // [deprecated]
728
+ // generate tied notehead location candidates
729
+ getTiedNoteLocations (source: TextSource): DocLocation[] {
730
+ const chordPairs: [Chord, Chord][] = [];
731
+
732
+ const hasMusicBlock = term => {
733
+ if (term instanceof MusicBlock)
734
+ return true;
735
+
736
+ if (term instanceof Command)
737
+ return term.args.filter(arg => arg instanceof MusicBlock).length > 0;
738
+
739
+ return false;
740
+ };
741
+
742
+ this.root.forEachTerm(MusicBlock, (block: MusicBlock) => {
743
+ for (const voice of block.voices) {
744
+ let lastChord: Chord = null;
745
+ let tying = false;
746
+ let afterBlock = false;
747
+ let atHead = true;
748
+
749
+ for (const chunk of voice.body) {
750
+ for (const term of chunk.terms) {
751
+ if (term instanceof Primitive && term.exp === "~") {
752
+ tying = true;
753
+ afterBlock = false;
754
+ }
755
+ else if (hasMusicBlock(term)) {
756
+ afterBlock = true;
757
+ tying = false;
758
+ //console.log("afterBlock:", term);
759
+ }
760
+ else if (term instanceof Chord) {
761
+ if (tying && lastChord)
762
+ chordPairs.push([lastChord, term]);
763
+ // maybe there is a tie at tail of the last block
764
+ else if (afterBlock)
765
+ chordPairs.push([null, term]);
766
+ // maybe there is a tie before the current block
767
+ else if (atHead)
768
+ chordPairs.push([null, term]);
769
+
770
+ // PENDING: maybe some user-defined command block contains tie at tail.
771
+
772
+ atHead = false;
773
+ afterBlock = false;
774
+ tying = false;
775
+ lastChord = term;
776
+
777
+ if (term.post_events) {
778
+ for (const event of term.post_events) {
779
+ if (event instanceof PostEvent && event.arg === "~")
780
+ tying = true;
781
+ }
782
+ }
783
+ }
784
+ }
785
+ }
786
+ }
787
+ });
788
+
789
+ //console.log("chordPairs:", chordPairs);
790
+
791
+ const locations = [];
792
+
793
+ chordPairs.forEach(pair => {
794
+ const forePitches = pair[0] && new Set(pair[0].pitchNames);
795
+
796
+ const chordSource = source.slice(pair[1]._location.lines, pair[1]._location.columns);
797
+ const pitchColumns = TextSource.matchPositions(/\w+/g, chordSource);
798
+
799
+ pair[1].pitchNames
800
+ .map((pitch, index) => ({pitch, index}))
801
+ .filter(({pitch}) => !forePitches || forePitches.has(pitch) || pitch === "q")
802
+ .forEach(({index}) => locations.push([
803
+ pair[1]._location.lines[0], // line
804
+ pair[1]._location.columns[0] + pitchColumns[index], // column
805
+ ]));
806
+ });
807
+
808
+ return locations;
809
+ }
810
+
811
+
812
+ // generate tied notehead location candidates
813
+ getTiedNoteLocations2 (): DocLocation[] {
814
+ const locations = [];
815
+
816
+ this.root.forEachTerm(Chord, chord => chord.pitches.forEach(pitch => {
817
+ if (pitch._tied)
818
+ locations.push([pitch._location.lines[0], pitch._location.columns[0]]);
819
+ }));
820
+
821
+ return locations;
822
+ }
823
+
824
+
825
+ getBriefChordLocations (): DocLocation[] {
826
+ const locations = [];
827
+
828
+ this.root.forEachTerm(BriefChord,
829
+ chord => locations.push([chord._location.lines[0], chord._location.columns[0]]));
830
+
831
+ return locations;
832
+ }
833
+
834
+
835
+ getLyricLocations (): DocLocation[] {
836
+ const locations = [];
837
+
838
+ this.root.forEachTerm(Lyric,
839
+ lyric => locations.push([lyric._location.lines[0], lyric._location.columns[0]]));
840
+
841
+ return locations;
842
+ }
843
+
844
+
845
+ /*removeAloneSpacer () {
846
+ this.root.forEachTopTerm(MusicBlock, block => {
847
+ const aloneSpacers = cc(block.musicChunks.filter(chunk => chunk.size === 1 && chunk.terms[0].isSpacer).map(chunk => chunk.terms));
848
+ //console.log("aloneSpacers:", aloneSpacers.map(s => s._location));
849
+
850
+ if (aloneSpacers.length) {
851
+ const removeInBlock = block => block.body = block.body.filter(term => !aloneSpacers.includes(term));
852
+
853
+ removeInBlock(block);
854
+ block.forEachTerm(MusicBlock, removeInBlock);
855
+ }
856
+ });
857
+ }*/
858
+
859
+
860
+ unfoldDurationMultipliers () {
861
+ this.root.forEachTerm(MusicBlock, block => {
862
+ block.unfoldDurationMultipliers();
863
+ });
864
+ }
865
+
866
+
867
+ appendMIDIInstrumentsFromName () {
868
+ const isSet = (term: BaseTerm, keyPattern: RegExp): boolean => term instanceof Command && term.cmd === "set" && keyPattern.test((term.args[0] as Assignment).key.toString());
869
+ const append = (body: BaseTerm[]) => {
870
+ const ntIndex = body.findIndex(term => isSet(term, /\.instrumentName/));
871
+ if (ntIndex >= 0 && !body.some(term => isSet(term, /\.midiInstrument/))) {
872
+ const nameAssign = (body[ntIndex] as Command).args[0] as Assignment;
873
+ const key = nameAssign.key.toString().replace(/\.instrumentName/, ".midiInstrument");
874
+ body.splice(ntIndex + 1, 0, Command.createSet(key, nameAssign.value));
875
+ }
876
+ };
877
+
878
+ this.root.forEachTopTerm(Block, block => {
879
+ if (block.head === "\\score") {
880
+ block.forEachTerm(SimultaneousList, simu => append(simu.list));
881
+ block.forEachTerm(MusicBlock, musicBlock => append(musicBlock.body));
882
+ }
883
+ });
884
+ }
885
+
886
+
887
+ useMidiInstrumentChannelMapping () {
888
+ this.appendMIDIInstrumentsFromName();
889
+
890
+ const midiBlock = this.root.findFirst(term => term instanceof Block && term.head === "\\midi") as Block;
891
+ if (!midiBlock) {
892
+ console.warn("no MIDI block found.");
893
+ return;
894
+ }
895
+
896
+ const channelMapping = midiBlock.findFirst(term => term instanceof Assignment && term.key === "midiChannelMapping") as Assignment;
897
+ if (channelMapping)
898
+ channelMapping.value = new Scheme({exp: new SchemePointer({value: "instrument"})});
899
+ else {
900
+ midiBlock.body.push(parseRaw({
901
+ proto: "Block",
902
+ block: "context",
903
+ head: "\\context",
904
+ body: [
905
+ {proto: "Command",cmd: "Score",args: []},
906
+ {proto: "Assignment", key: "midiChannelMapping", value: {proto: "Scheme", exp: {proto: "SchemePointer", value: "instrument"}}},
907
+ ],
908
+ }));
909
+ }
910
+ }
911
+
912
+
913
+ formalize () {
914
+ if (!this.root.findFirst(Version))
915
+ this.root.sections.unshift(Version.default);
916
+
917
+ if (!this.root.findFirst(Language))
918
+ this.root.sections.splice(1, 0, Language.make("english"));
919
+
920
+ if (!this.root.getBlock("header"))
921
+ this.root.sections.splice(2, 0, new Block({block: "header", head: "\\header", body:[]}));
922
+
923
+ if (!this.root.getBlock("score")) {
924
+ const topMusics = this.root.sections.filter(section => section.isMusic);
925
+ this.root.sections = this.root.sections.filter(section => !section.isMusic);
926
+
927
+ const score = new Block({block: "score", head: "\\score", body: [
928
+ ...topMusics,
929
+ new Block({block: "score", head: "\\layout", body: []}),
930
+ new Block({block: "score", head: "\\midi", body: []}),
931
+ ]});
932
+
933
+ this.root.sections.push(score);
934
+ }
935
+ }
936
+
937
+
938
+ convertStaffToPianoStaff () {
939
+ const score = this.root.getBlock("score");
940
+ if (score) {
941
+ const pstaff = score.findFirst(term => term instanceof ContextedMusic && term.head.cmd === "new" && term.head.args[0] === "Staff") as ContextedMusic;
942
+ if (pstaff) {
943
+ pstaff.head.args[0] = "PianoStaff";
944
+
945
+ if (pstaff.body instanceof SimultaneousList) {
946
+ pstaff.body.list = [].concat(...pstaff.body.list.map(term => {
947
+ if (term instanceof ContextedMusic) {
948
+ const subMusics = term.list.filter(sub => sub instanceof ContextedMusic);
949
+
950
+ return subMusics.map(music => {
951
+ const staff = term.clone();
952
+ staff.list = [
953
+ ...term.list.filter(sub => !(sub instanceof ContextedMusic)),
954
+ music,
955
+ ];
956
+
957
+ staff.head.cmd = "new";
958
+
959
+ return staff;
960
+ });
961
+ }
962
+ else
963
+ return [term];
964
+ }));
965
+ }
966
+ }
967
+ }
968
+ }
969
+
970
+
971
+ pruneStemDirections () {
972
+ this.root.forEachTerm(MusicBlock, block => {
973
+ let direction = null;
974
+ const redundants = [];
975
+
976
+ block.body.forEach(term => {
977
+ if (term instanceof StemDirection) {
978
+ if (term.direction === direction)
979
+ redundants.push(term);
980
+ else
981
+ direction = term.direction;
982
+ }
983
+ else if (term instanceof Command && term.findFirst(MusicBlock))
984
+ direction = null;
985
+ });
986
+
987
+ block.body = block.body.filter(term => !redundants.includes(term));
988
+ });
989
+ }
990
+
991
+
992
+ removeRepeats () {
993
+ this.root.forEachTerm(MusicBlock, block => block.spreadRepeatBlocks());
994
+ }
995
+
996
+
997
+ articulateMIDIOutput () {
998
+ const ARTICULATE_FILENAME = "articulate-lotus.ly";
999
+
1000
+ this.abstractMainScore();
1001
+ const midiScore = this.makeMIDIDedicatedScore();
1002
+
1003
+ if (!this.root.includeFiles.includes(ARTICULATE_FILENAME)) {
1004
+ let pos = this.root.sections.indexOf(midiScore);
1005
+ if (pos < 0)
1006
+ pos = Math.min(this.root.sections.length, 3);
1007
+ this.root.sections.splice(pos, 0, Include.create(ARTICULATE_FILENAME));
1008
+ }
1009
+
1010
+ midiScore.body = midiScore.body.map(term => {
1011
+ if (term.isMusic && !(term instanceof Command && term.cmd === "articulate"))
1012
+ return new Command({cmd: "articulate", args: [term]});
1013
+
1014
+ return term;
1015
+ });
1016
+ }
1017
+
1018
+
1019
+ removeInvalidExpressionsOnRests (): number {
1020
+ const isInvalidPostEvent = (event: PostEvent | string): boolean =>
1021
+ [".", "!", "_"].includes(event instanceof PostEvent ? event.arg as string : event);
1022
+
1023
+ let count = 0;
1024
+ this.root.forEachTerm(MusicEvent, (term: MusicEvent) => {
1025
+ if (term.isRest) {
1026
+ if (term.post_events.some(isInvalidPostEvent)) {
1027
+ term.post_events = term.post_events.filter(event => !isInvalidPostEvent(event));
1028
+ ++count;
1029
+ }
1030
+ }
1031
+ });
1032
+
1033
+ return count;
1034
+ }
1035
+
1036
+
1037
+ abstractMainScore () {
1038
+ const score = this.root.getBlock("score");
1039
+ const music = score.body.find(term => term.isMusic);
1040
+ if (music && !(music instanceof Variable)) {
1041
+ const sectionIndex = this.root.sections.indexOf(score);
1042
+ const assignment = new Assignment({
1043
+ key: MAIN_SCORE_NAME,
1044
+ value: music,
1045
+ });
1046
+ this.root.sections.splice(sectionIndex, 0, assignment);
1047
+
1048
+ score.body = score.body.map(term => term === music ? new Variable({name: MAIN_SCORE_NAME}) : term);
1049
+ }
1050
+ }
1051
+
1052
+
1053
+ absoluteBlocksToRelative () {
1054
+ this.root.forEachTopTerm(Assignment, assignment => {
1055
+ if (assignment.value instanceof MusicBlock) {
1056
+ const relative = assignment.value.absoluteToRelative();
1057
+ if (relative)
1058
+ assignment.value = relative;
1059
+ }
1060
+ });
1061
+ }
1062
+ };
inc/lilyParser/lilyInterpreter.ts ADDED
@@ -0,0 +1,1476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {romanize} from "../romanNumeral";
3
+ import {WHOLE_DURATION_MAGNITUDE, GRACE_DURATION_FACTOR, FUNCTIONAL_VARIABLE_NAME_PATTERN, MAIN_SCORE_NAME, lcmMulti, lcm} from "./utils";
4
+ import {parseRaw, getDurationSubdivider, MusicChunk, constructMusicFromMeasureLayout, StemDirection} from "./lilyTerms";
5
+ import LogRecorder from "../logRecorder";
6
+ import {StaffContext, PitchContextTable} from "../pitchContext";
7
+ import * as idioms from "./idioms";
8
+ import LilyDocument from "./lilyDocument";
9
+ import * as LilyNotation from "../lilyNotation";
10
+
11
+ import {
12
+ BaseTerm,
13
+ Root, Block, MusicEvent, Repeat, Relative, TimeSignature, Partial, Times, Tuplet, Grace, AfterGrace, Clef, Scheme, Include, Rest,
14
+ KeySignature, OctaveShift, Duration, Chord, MusicBlock, Assignment, Variable, Command, SimultaneousList, ContextedMusic, Primitive, Version,
15
+ ChordMode, LyricMode, ChordElement, Language, PostEvent, Transposition, ParallelMusic,
16
+ } from "./lilyTerms";
17
+ import {MeasureLayout, BlockMLayout, SingleMLayout} from "../measureLayout";
18
+
19
+
20
+
21
+ interface DurationContextStackStatus {
22
+ factor?: {value: number};
23
+ tickBias?: number;
24
+ tremoloDuration?: Duration;
25
+ };
26
+
27
+
28
+ type MusicTransformer = (music: BaseTerm, context: TrackContext) => BaseTerm[];
29
+ type MusicListener = (music: BaseTerm, context: TrackContext) => void;
30
+
31
+
32
+ type ContextDict = {[key: string]: string};
33
+
34
+
35
+ export enum TremoloType {
36
+ None,
37
+ Single,
38
+ Pitcher,
39
+ Catcher,
40
+ };
41
+
42
+
43
+ interface PitchContextTerm {
44
+ staffName: string;
45
+ track?: number;
46
+ //voiceName?: string;
47
+
48
+ tick?: number;
49
+ event: MusicEvent;
50
+
51
+ clef?: {
52
+ y: number,
53
+ value: number,
54
+ };
55
+ octaveShift?: number;
56
+ key?: number;
57
+ newMeasure?: boolean;
58
+ pitches?: ChordElement[];
59
+ tickBias?: number;
60
+ rest?: boolean;
61
+ tremoloType?: TremoloType;
62
+ };
63
+
64
+
65
+ class LilyStaffContext extends StaffContext {
66
+ staffTrack: number;
67
+ notes: LilyNotation.Note[] = [];
68
+
69
+ channelMap: number[] = [];
70
+
71
+
72
+ executeTerm (term: PitchContextTerm) {
73
+ //console.log("executeTerm:", term);
74
+
75
+ if (term.newMeasure)
76
+ this.resetAlters();
77
+
78
+ if (term.clef)
79
+ this.setClef(term.clef.y, term.clef.value);
80
+ if (Number.isFinite(term.octaveShift))
81
+ this.setOctaveShift(-term.octaveShift);
82
+ if (Number.isFinite(term.key)) {
83
+ this.resetKeyAlters();
84
+
85
+ if (term.key) {
86
+ const step = term.key > 0 ? 1 : -1;
87
+ for (let p = step; p / term.key <= 1; p += step) {
88
+ const index = ((step > 0 ? p - 1 : p) + 70) % 7;
89
+ const note = idioms.PHONETS.indexOf(idioms.FIFTH_PHONETS[index]);
90
+
91
+ this.keyAlters[note] = (this.keyAlters[note] || 0) + step;
92
+ }
93
+ this.dirty = true;
94
+ }
95
+ }
96
+
97
+ if (term.pitches) {
98
+ // accidental alters
99
+ term.pitches.forEach(pitch => {
100
+ const note = pitch.absoluteNotePosition;
101
+ const alter = this.alterOnNote(note);
102
+ if (pitch.alterValue !== alter) {
103
+ this.alters[note] = pitch.alterValue;
104
+ this.dirty = true;
105
+ }
106
+ });
107
+
108
+ const event = term.event;
109
+ const contextIndex = this.snapshot({tick: event._tick});
110
+
111
+ const implicitType = event.implicitType || (term.tremoloType ? LilyNotation.ImplicitType.Tremolo : LilyNotation.ImplicitType.None);
112
+
113
+ this.notes.push(...term.pitches.map((pitch, index) => ({
114
+ track: term.track,
115
+ channel: this.channelMap[term.track] || 0,
116
+ measure: event._measure,
117
+ start: event._tick,
118
+ duration: event.durationMagnitude,
119
+ division: event.division,
120
+ startTick: event._tick,
121
+ endTick: event._tick + event.durationMagnitude,
122
+ pitch: pitch.absolutePitchValue + (pitch._transposition || 0),
123
+ velocity: 127,
124
+ id: pitch.href,
125
+ ids: [pitch.href],
126
+ tied: !!pitch._tied,
127
+ rest: event.isRest,
128
+ afterGrace: !!term.tickBias,
129
+ implicitType,
130
+ staffTrack: this.staffTrack,
131
+ contextIndex,
132
+ // TODO: consider connected arpeggio & downward arpeggio
133
+ chordPosition: {
134
+ index,
135
+ count: term.pitches.length,
136
+ },
137
+ })));
138
+
139
+ term.pitches.forEach(pitch => {
140
+ const tiedParent = pitch.tiedParent;
141
+ if (tiedParent) {
142
+ const note = this.notes.find(note => note.id === tiedParent.href);
143
+ if (note)
144
+ note.ids.push(pitch.href);
145
+ }
146
+ });
147
+ }
148
+ else if (term.rest) {
149
+ const event = term.event;
150
+ const contextIndex = this.snapshot({tick: event._tick});
151
+
152
+ this.notes.push({
153
+ track: term.track,
154
+ channel: this.channelMap[term.track] || 0,
155
+ measure: event._measure,
156
+ start: event._tick,
157
+ duration: event.durationMagnitude,
158
+ startTick: event._tick,
159
+ endTick: event._tick + event.durationMagnitude,
160
+ pitch: null,
161
+ velocity: 0,
162
+ id: event.href,
163
+ ids: [event.href],
164
+ tied: false,
165
+ rest: true,
166
+ afterGrace: !!term.tickBias,
167
+ implicitType: event.implicitType,
168
+ staffTrack: this.staffTrack,
169
+ contextIndex,
170
+ });
171
+ }
172
+ }
173
+
174
+
175
+ get pitchContextTable (): PitchContextTable {
176
+ const items = this.track.contexts.map(context => ({
177
+ tick: context.tick,
178
+ endTick: null,
179
+ context,
180
+ }));
181
+ items.forEach((item, i) => {
182
+ item.endTick = (i + 1 < items.length ? items[i + 1].tick : Infinity);
183
+ });
184
+
185
+ return new PitchContextTable({items});
186
+ }
187
+ };
188
+
189
+
190
+
191
+ export class MusicTrack {
192
+ block: MusicBlock;
193
+ anchorPitch: ChordElement;
194
+ contextDict?: ContextDict = null;
195
+
196
+ name?: string;
197
+ measureHeads: number[];
198
+
199
+
200
+ static fromBlockAnchor (block: MusicBlock, anchorPitch: ChordElement): MusicTrack {
201
+ const track = new MusicTrack;
202
+
203
+ track.block = block;
204
+ track.anchorPitch = anchorPitch;
205
+
206
+ const context = new TrackContext(track);
207
+ context.execute(track.music);
208
+
209
+ return track;
210
+ }
211
+
212
+
213
+ get music (): BaseTerm {
214
+ if (!this.block._parent) {
215
+ this.block._parent = new Relative({cmd: "relative", args: this.anchorPitch ? [this.anchorPitch.clone(), this.block] : [this.block]});
216
+ this.block.updateChordAnchors();
217
+ }
218
+
219
+ return this.block._parent;
220
+ }
221
+
222
+
223
+ get noteDurationSubdivider (): number {
224
+ return getDurationSubdivider(this.block);
225
+ }
226
+
227
+
228
+ get durationMagnitude (): number {
229
+ return this.block && this.block.durationMagnitude;
230
+ }
231
+
232
+
233
+ get isLyricMode (): boolean {
234
+ return (this.music instanceof LyricMode) || !!this.block.findFirst(term => term instanceof LyricMode);
235
+ }
236
+
237
+
238
+ get isChordMode (): boolean {
239
+ return (this.music instanceof ChordMode) || !!this.block.findFirst(term => term instanceof ChordMode);
240
+ }
241
+
242
+
243
+ get measureLayoutCode (): string {
244
+ let code = this.block.measureLayout.code;
245
+ if (/^\[.*\]$/.test(code))
246
+ code = code.match(/\[(.*)\]/)[1];
247
+
248
+ return code;
249
+ }
250
+
251
+
252
+ transform (transformer: MusicTransformer) {
253
+ new TrackContext(this, {transformer}).execute(this.music);
254
+ }
255
+
256
+
257
+ clarifyDurations () {
258
+ this.transform(term => {
259
+ if (term instanceof MusicEvent) {
260
+ if (!term.duration)
261
+ term.duration = term.durationValue;
262
+ }
263
+
264
+ return [term];
265
+ });
266
+ }
267
+
268
+
269
+ splitLongRests () {
270
+ this.clarifyDurations();
271
+
272
+ this.transform((term, context) => {
273
+ if (!(term instanceof MusicEvent) || (!term.withMultiplier && !(term instanceof Rest)))
274
+ return [term];
275
+
276
+ const timeDenominator = context.time ? context.time.value.denominator : 4;
277
+ const duration = term.durationValue;
278
+ const denominator = Math.max(duration.denominator, timeDenominator);
279
+
280
+ const isR = !(term as Rest).isSpacer;
281
+
282
+ if (term.withMultiplier) {
283
+ const factor = duration.multipliers.reduce((factor, multiplier) => factor * Number(multiplier), 1);
284
+ if (!Number.isInteger(factor) || factor <= 0) {
285
+ console.warn("invalid multiplier:", factor, duration.multipliers);
286
+ return [term];
287
+ }
288
+
289
+ const event = term.clone() as MusicEvent;
290
+ event.duration.multipliers = [];
291
+
292
+ // break duration into multiple rest events
293
+ const restCount = (event.duration.magnitude / WHOLE_DURATION_MAGNITUDE) * (factor - 1) * denominator;
294
+ if (!Number.isInteger(restCount))
295
+ console.warn("Rest count is not integear:", restCount, denominator, event.duration.magnitude, factor);
296
+
297
+ const rests = Array(Math.floor(restCount)).fill(null).map(() =>
298
+ new Rest({name: "s", duration: new Duration({number: denominator, dots: 0})}));
299
+
300
+ return [event, ...rests];
301
+ }
302
+ else {
303
+ const divider = lcm(duration.subdivider, denominator);
304
+ const restCount = term.durationMagnitude * divider / WHOLE_DURATION_MAGNITUDE;
305
+ console.assert(Number.isInteger(restCount), "rest count is not an integer:", restCount);
306
+
307
+ if (isR && restCount > 1)
308
+ console.warn("splitLongRests: 'r' was splitted into", restCount, "parts.", term._location);
309
+
310
+ const list = Array(restCount).fill(null).map(() =>
311
+ new Rest({name: isR ? "r" : "s", duration: new Duration({number: divider, dots: 0})}));
312
+
313
+ if (term.post_events)
314
+ list[list.length - 1].post_events = term.post_events.map(e => e instanceof BaseTerm ? e.clone() : e);
315
+
316
+ return list;
317
+ }
318
+ });
319
+ }
320
+
321
+
322
+ spreadMusicBlocks (): boolean {
323
+ let has = false;
324
+
325
+ this.transform((term) => {
326
+ if (term instanceof MusicBlock) {
327
+ has = true;
328
+ return term.body;
329
+ }
330
+ else
331
+ return [term];
332
+ });
333
+
334
+ return has;
335
+ }
336
+
337
+
338
+ spreadRelativeBlocks (): boolean {
339
+ // check if traverse is nessary
340
+ if (!this.block.findFirst(Relative))
341
+ return false;
342
+
343
+ this.transform((term, context) => {
344
+ if (term instanceof Relative) {
345
+ if (term.music instanceof MusicBlock)
346
+ term.music.updateChordAnchors();
347
+
348
+ const terms = term.shiftBody(context.pitch);
349
+
350
+ // initialize anchor pitch for track head chord
351
+ if (!context.event || !context.event.getPreviousT(Chord)) {
352
+ const tempBlock = new MusicBlock({body: []});
353
+ tempBlock.body = terms;
354
+ const head = tempBlock.findFirst(Chord);
355
+ if (head)
356
+ //head._anchorPitch = this.anchorPitch;
357
+ head._anchorPitch = context.pitch;
358
+ }
359
+
360
+ return terms;
361
+ }
362
+ else
363
+ return [term];
364
+ });
365
+
366
+ return true;
367
+ }
368
+
369
+
370
+ spreadRepeatBlocks ({ignoreRepeat = true, keepTailPass = false} = {}): boolean {
371
+ // check if traverse is nessary
372
+ if (!this.block.findFirst(Repeat))
373
+ return false;
374
+
375
+ this.transform(term => {
376
+ if (term instanceof Repeat) {
377
+ if (!ignoreRepeat)
378
+ return term.getUnfoldTerms();
379
+ else if (keepTailPass)
380
+ return term.getTailPassTerms();
381
+ else
382
+ return term.getPlainTerms();
383
+ }
384
+ else if (term instanceof Variable && term.name === "lotusRepeatABA")
385
+ return [];
386
+ else
387
+ return [term];
388
+ });
389
+
390
+ return true;
391
+ }
392
+
393
+
394
+ flatten ({spreadRepeats = false} = {}) {
395
+ this.splitLongRests();
396
+ this.spreadRelativeBlocks();
397
+
398
+ if (spreadRepeats) {
399
+ while (this.spreadRepeatBlocks())
400
+ ;
401
+
402
+ // expand all music blocks
403
+ while (this.spreadMusicBlocks());
404
+ }
405
+ }
406
+
407
+
408
+ sliceMeasures (start: number, count: number): MusicTrack {
409
+ this.flatten({spreadRepeats: true});
410
+
411
+ const context = new TrackContext(this);
412
+ context.pitch = this.anchorPitch;
413
+ this.block.updateChordAnchors();
414
+
415
+ for (const term of this.block.body) {
416
+ if (Number.isInteger(term._measure)) {
417
+ if (term._measure < start)
418
+ context.execute(term);
419
+ else
420
+ break;
421
+ }
422
+ }
423
+
424
+ const terms = context.declarations.concat(this.block.body.filter(term => term._measure >= start && term._measure < start + count));
425
+ const newBlock = MusicBlock.fromTerms(terms);
426
+
427
+ return MusicTrack.fromBlockAnchor(newBlock, context.pitch);
428
+ }
429
+
430
+
431
+ redivide () {
432
+ this.block.redivide({measureHeads: this.measureHeads});
433
+ }
434
+
435
+
436
+ applyMeasureLayout (layout: MeasureLayout, {flatten = true} = {}) {
437
+ //console.log("applyMeasureLayout:", this, layout);
438
+
439
+ if (flatten)
440
+ this.flatten({spreadRepeats: true});
441
+
442
+ const chunks = this.block.measureChunkMap;
443
+
444
+ // validate layout value
445
+ const indices = layout.serialize(LilyNotation.LayoutType.Ordinary);
446
+ indices.forEach(index => {
447
+ if (!chunks.get(index))
448
+ throw new Error(`applyMeasureLayout: measure[${index}] missed in chunk map.`);
449
+ });
450
+
451
+ // append zero-duration tail chunk, e.g. \bar "|."
452
+ const tailIndex = Math.max(...indices) + 1;
453
+ const tailChunk = chunks.get(tailIndex);
454
+ if (tailChunk && !tailChunk.durationMagnitude && layout instanceof BlockMLayout)
455
+ //layout.seq.push(SingleMLayout.from(tailIndex));
456
+ layout = BlockMLayout.fromSeq([...layout.seq, SingleMLayout.from(tailIndex)]);
457
+
458
+ this.block.body = constructMusicFromMeasureLayout(layout, chunks).terms;
459
+
460
+ this.redivide();
461
+ }
462
+
463
+
464
+ generateStaffTracks (): PitchContextTerm[] {
465
+ const pcTerms: PitchContextTerm[] = [];
466
+
467
+ let currentTerm = null;
468
+ const commitTerm = () => {
469
+ if (currentTerm) {
470
+ pcTerms.push(currentTerm);
471
+ currentTerm = null;
472
+ }
473
+ };
474
+ const getCurrentTerm = (staffName: string): PitchContextTerm => {
475
+ if (currentTerm && currentTerm.staffName !== staffName)
476
+ commitTerm();
477
+
478
+ if (!currentTerm)
479
+ currentTerm = {staffName};
480
+
481
+ return currentTerm;
482
+ };
483
+
484
+ let measureIndex = 0;
485
+
486
+ const listener = (term: BaseTerm, track: TrackContext) => {
487
+ getCurrentTerm(track.staffName).tick = term._tick;
488
+
489
+ if (term._measure !== measureIndex) {
490
+ getCurrentTerm(track.staffName).newMeasure = true;
491
+ commitTerm();
492
+
493
+ measureIndex = term._measure;
494
+ }
495
+
496
+ if (term instanceof Chord) {
497
+ const pcTerm = getCurrentTerm(track.staffName);
498
+ pcTerm.event = term;
499
+ pcTerm.pitches = term.pitchesValue.filter(pitch => pitch instanceof ChordElement) as ChordElement[];
500
+ pcTerm.pitches = [...pcTerm.pitches].sort((p1, p2) => p1.absolutePitchValue - p2.absolutePitchValue);
501
+
502
+ if (track.tickBias)
503
+ pcTerm.tickBias = track.tickBias;
504
+
505
+ pcTerm.tremoloType = track.tremoloType;
506
+
507
+ commitTerm();
508
+ }
509
+ else if (term instanceof Rest && term.name !== "s") {
510
+ const pcTerm = getCurrentTerm(track.staffName);
511
+ pcTerm.event = term;
512
+ pcTerm.rest = true;
513
+
514
+ commitTerm();
515
+ }
516
+ else if (term instanceof Clef) {
517
+ //console.log("clef:", term.clefName);
518
+ switch (term.clefName) {
519
+ case "treble":
520
+ // a treble (G4) on the 2nd staff line
521
+ getCurrentTerm(track.staffName).clef = {y: 1, value: 4};
522
+
523
+ break;
524
+ case "bass":
525
+ // a bass (F3) on the 4th staff line
526
+ getCurrentTerm(track.staffName).clef = {y: -1, value: -4};
527
+
528
+ break;
529
+ case "tenor":
530
+ // a tenor (C4) on the 3rd staff line
531
+ getCurrentTerm(track.staffName).clef = {y: 0, value: 0};
532
+
533
+ break;
534
+ }
535
+ }
536
+ else if (term instanceof KeySignature)
537
+ getCurrentTerm(track.staffName).key = term.key;
538
+ else if (term instanceof OctaveShift)
539
+ getCurrentTerm(track.staffName).octaveShift = term.value;
540
+ };
541
+ new TrackContext(this, {listener}).execute(this.music);
542
+
543
+ return pcTerms;
544
+ }
545
+ };
546
+
547
+
548
+ export class TrackContext {
549
+ track: MusicTrack;
550
+ transformer?: MusicTransformer;
551
+ listener?: MusicListener;
552
+
553
+ stack: DurationContextStackStatus[] = [];
554
+
555
+ // declarations
556
+ staff: Command = null;
557
+ clef: Clef = null;
558
+ key: KeySignature = null;
559
+ time: TimeSignature = null;
560
+ octave: OctaveShift = null;
561
+
562
+ pitch: ChordElement = null;
563
+
564
+ staffName: string = null;
565
+ voiceName: string = null;
566
+ transposition: number = 0;
567
+
568
+ // time status
569
+ tick: number = 0;
570
+ tickInMeasure: number = 0;
571
+ measureSpan: number = WHOLE_DURATION_MAGNITUDE;
572
+ measureIndex: number = 1;
573
+ partialDuration: Duration = null;
574
+ measureHeads: number[] = [0];
575
+
576
+ event: MusicEvent = null;
577
+ tying: MusicEvent = null;
578
+ staccato: boolean = false;
579
+ inGrace: boolean = false;
580
+ stemDirection: string = null;
581
+ beamOn: boolean = false;
582
+
583
+ tremoloType: TremoloType = TremoloType.None;
584
+
585
+
586
+ constructor (track = new MusicTrack, {transformer = null, listener = null, contextDict = null}:
587
+ {
588
+ transformer?: MusicTransformer,
589
+ listener?: MusicListener,
590
+ contextDict?: ContextDict,
591
+ } = {}) {
592
+ this.track = track;
593
+ this.track.contextDict = contextDict || this.track.contextDict;
594
+ this.track.measureHeads = this.measureHeads;
595
+
596
+ this.transformer = transformer;
597
+ this.listener = listener;
598
+
599
+ if (this.track.contextDict) {
600
+ this.staffName = this.track.contextDict.Staff;
601
+ this.voiceName = this.track.contextDict.Voice;
602
+ }
603
+ //console.debug("contextDict:", contextDict);
604
+ }
605
+
606
+
607
+ clone (): this {
608
+ const ctx = {...this};
609
+ Object.setPrototypeOf(ctx, Object.getPrototypeOf(this));
610
+
611
+ return ctx;
612
+ }
613
+
614
+
615
+ mergeParallelClones (contexts: TrackContext[]) {
616
+ const frontContext = contexts.reduce((front, context) => {
617
+ const next = !front || context.tick > front.tick ? context : front;
618
+ next.tying = next.tying || context.tying;
619
+ next.staccato = next.staccato || context.staccato;
620
+
621
+ return next;
622
+ }, null);
623
+ const lastContext = contexts[contexts.length - 1];
624
+
625
+ this.tick = frontContext.tick;
626
+ this.tickInMeasure = frontContext.tickInMeasure;
627
+ this.measureIndex = frontContext.measureIndex;
628
+ this.partialDuration = frontContext.partialDuration;
629
+ this.tying = frontContext.tying;
630
+ this.staccato = frontContext.staccato;
631
+
632
+ this.pitch = lastContext.pitch;
633
+ this.event = lastContext.event;
634
+ }
635
+
636
+
637
+ get factor (): {value: number} {
638
+ for (let i = this.stack.length - 1; i >= 0; i--) {
639
+ const status = this.stack[i];
640
+ if (status.factor)
641
+ return status.factor;
642
+ }
643
+
644
+ return null;
645
+ }
646
+
647
+
648
+ get tremoloDuration (): Duration {
649
+ for (let i = this.stack.length - 1; i >= 0; i--) {
650
+ const status = this.stack[i];
651
+ if (status.tremoloDuration)
652
+ return status.tremoloDuration;
653
+ }
654
+
655
+ return null;
656
+ }
657
+
658
+
659
+ get tickBias (): number {
660
+ for (let i = this.stack.length - 1; i >= 0; i--) {
661
+ const status = this.stack[i];
662
+ if (status.tickBias)
663
+ return status.tickBias;
664
+ }
665
+
666
+ return 0;
667
+ }
668
+
669
+
670
+ get measureIndexBias (): number {
671
+ if (this.tickInMeasure + this.tickBias < -1)
672
+ return -1;
673
+
674
+ return 0;
675
+ }
676
+
677
+
678
+ get factorValue (): number {
679
+ return this.factor && Number.isFinite(this.factor.value) ? this.factor.value : 1;
680
+ }
681
+
682
+
683
+ get currentMeasureSpan (): number {
684
+ return Math.round(this.partialDuration ? this.partialDuration.magnitude : this.measureSpan);
685
+ }
686
+
687
+
688
+ setPitch (pitch: ChordElement) {
689
+ if (!this.track.anchorPitch)
690
+ this.track.anchorPitch = pitch;
691
+
692
+ this.pitch = pitch;
693
+ }
694
+
695
+
696
+ newMeasure (measureSpan: number) {
697
+ console.assert(Number.isFinite(this.measureHeads[this.measureIndex - 1]), "invalid measureHeads at", this.measureIndex - 1, this.measureHeads);
698
+ this.measureHeads[this.measureIndex] = this.measureHeads[this.measureIndex - 1] + measureSpan;
699
+
700
+ ++this.measureIndex;
701
+ this.tickInMeasure -= measureSpan;
702
+
703
+ this.partialDuration = null;
704
+ }
705
+
706
+
707
+ checkIncompleteMeasure () {
708
+ if (this.tickInMeasure) {
709
+ console.warn("incomplete measure trunated:", this.measureIndex, `${this.tickInMeasure}/${this.currentMeasureSpan}`);
710
+ this.newMeasure(this.tickInMeasure);
711
+ }
712
+ }
713
+
714
+
715
+ elapse (duration: number) {
716
+ const increment = duration * this.factorValue;
717
+
718
+ this.tick += increment;
719
+
720
+ this.tickInMeasure += increment;
721
+ while (Math.round(this.tickInMeasure) >= this.currentMeasureSpan)
722
+ this.newMeasure(this.currentMeasureSpan);
723
+ }
724
+
725
+
726
+ push (status: DurationContextStackStatus) {
727
+ this.stack.push(status);
728
+ }
729
+
730
+
731
+ pop () {
732
+ this.stack.pop();
733
+ }
734
+
735
+
736
+ processGrace (music: BaseTerm, factor = GRACE_DURATION_FACTOR) {
737
+ // pull back grace notes' ticks
738
+ let events = [music];
739
+ if (!(music instanceof MusicEvent))
740
+ events = music.findAll(MusicEvent);
741
+
742
+ let tick = this.tick;
743
+ events.reverse().forEach(event => {
744
+ tick -= Math.round(event.durationMagnitude * factor * this.factorValue);
745
+ event._tick = tick;
746
+
747
+ event.findAll(ChordElement).forEach(note => note._tick = tick);
748
+ });
749
+ }
750
+
751
+
752
+ execute (term: BaseTerm) {
753
+ if (!term) {
754
+ console.warn("null term:", term);
755
+ return;
756
+ }
757
+
758
+ if (!(term instanceof BaseTerm))
759
+ return;
760
+
761
+ term._measure = this.measureIndex + this.measureIndexBias;
762
+ term._tick = this.tick;
763
+
764
+ if (term instanceof MusicEvent) {
765
+ term._previous = this.event;
766
+
767
+ if (term instanceof Chord) {
768
+ if (!this.track.anchorPitch)
769
+ this.track.anchorPitch = ChordElement.default.clone();
770
+
771
+ this.setPitch(term.absolutePitch);
772
+
773
+ term.pitches.forEach(pitch => {
774
+ this.execute(pitch);
775
+
776
+ if (pitch instanceof ChordElement)
777
+ pitch._transposition = this.transposition;
778
+ });
779
+
780
+ // update tied for ChordElement
781
+ // TODO: staccato trigger condition?
782
+ if (this.tying /*&& !this.staccato*/ && this.event && this.event instanceof Chord) {
783
+ const pitches = new Set(this.event.pitchElements.map(pitch => pitch.absolutePitch.pitch));
784
+ term.pitchElements.forEach(pitch => {
785
+ if (pitches.has(pitch.absolutePitch.pitch))
786
+ pitch._tied = this.tying;
787
+ //else
788
+ // console.log("missed tie:", `${pitch._location.lines[0]}:${pitch._location.columns[0]}`, pitch.absolutePitch.pitch, pitches);
789
+ });
790
+
791
+ if (this.staccato)
792
+ console.warn("tie on staccato note:", term.href);
793
+ }
794
+ //console.log("chord:", term.pitches[0]);
795
+ }
796
+
797
+ if (term.beamOn)
798
+ this.beamOn = true;
799
+ else if (term.beamOff)
800
+ this.beamOn = false;
801
+
802
+ this.event = term;
803
+
804
+ this.elapse(term.durationMagnitude);
805
+
806
+ term._lastMeasure = this.tickInMeasure > 0 ? this.measureIndex : this.measureIndex - 1;
807
+
808
+ this.tying = null;
809
+ this.staccato = false;
810
+
811
+ if (term.isTying)
812
+ this.tying = term;
813
+ if (term.isStaccato)
814
+ this.staccato = true;
815
+ }
816
+ else if (term instanceof ChordElement) {
817
+ // ignore
818
+ }
819
+ else if (term instanceof MusicBlock) {
820
+ if (!this.track.block)
821
+ this.track.block = term;
822
+
823
+ term.updateChordAnchors();
824
+
825
+ if (this.transformer) {
826
+ const body = [];
827
+ for (const subterm of term.body) {
828
+ const terms = this.transformer(subterm, this);
829
+ terms.forEach(t => this.execute(t));
830
+
831
+ body.push(...terms);
832
+ }
833
+
834
+ term.body = body;
835
+ }
836
+ else {
837
+ for (const subterm of term.body)
838
+ this.execute(subterm);
839
+ }
840
+ }
841
+ else if (term instanceof Command && term.cmd === "numericTimeSignature")
842
+ this.execute(term.args[0]);
843
+ else if (term instanceof TimeSignature) {
844
+ this.time = term;
845
+ this.measureSpan = term.value.value * WHOLE_DURATION_MAGNITUDE;
846
+ }
847
+ else if (term instanceof Partial)
848
+ this.partialDuration = term.duration;
849
+ else if (term instanceof Repeat) {
850
+ switch (term.type) {
851
+ case "volta":
852
+ this.checkIncompleteMeasure();
853
+
854
+ this.execute(term.bodyBlock);
855
+
856
+ this.checkIncompleteMeasure();
857
+
858
+ if (term.alternativeBlocks) {
859
+ for (const block of term.alternativeBlocks) {
860
+ this.execute(block);
861
+
862
+ this.checkIncompleteMeasure();
863
+ }
864
+ }
865
+
866
+ break;
867
+ case "tremolo":
868
+ this.push({factor: {value: term.times}, tremoloDuration: term.sumDuration});
869
+ this.tremoloType = term.singleTremolo ? TremoloType.Single : TremoloType.Pitcher;
870
+ this.execute(term.bodyBlock);
871
+ this.tremoloType = TremoloType.None;
872
+ this.pop();
873
+
874
+ break;
875
+ default:
876
+ console.warn("unsupported repeat type:", term.type);
877
+ }
878
+ }
879
+ else if (term instanceof Relative) {
880
+ if (term.anchor)
881
+ this.setPitch(term.anchor);
882
+
883
+ this.execute(term.music);
884
+ }
885
+ else if (term instanceof LyricMode) {
886
+ // ignore lyric mode
887
+ }
888
+ else if (term instanceof Command && term.cmd === "lyricsto") {
889
+ // ignore lyric mode
890
+ }
891
+ else if (term instanceof ChordMode) {
892
+ // ignore chord mode
893
+ }
894
+ else if (term instanceof Transposition)
895
+ this.transposition = term.transposition;
896
+ else if (term instanceof Times) {
897
+ this.push({factor: term.factor});
898
+ this.execute(term.music);
899
+ this.pop();
900
+ }
901
+ else if (term instanceof Tuplet) {
902
+ this.push({factor: term.divider.reciprocal});
903
+ this.execute(term.music);
904
+ this.pop();
905
+ }
906
+ else if (term instanceof Grace) {
907
+ this.inGrace = true;
908
+ this.push({factor: {value: 0}});
909
+ this.execute(term.music);
910
+ this.pop();
911
+ this.inGrace = false;
912
+
913
+ this.processGrace(term.music);
914
+ }
915
+ else if (term instanceof AfterGrace) {
916
+ this.execute(term.body);
917
+
918
+ this.inGrace = true;
919
+ this.push({factor: {value: 0}, tickBias: -term.body.durationMagnitude});
920
+ this.execute(term.grace);
921
+ this.pop();
922
+ this.inGrace = false;
923
+
924
+ this.processGrace(term.grace);
925
+ }
926
+ else if (term instanceof Clef)
927
+ this.clef = term;
928
+ else if (term instanceof KeySignature)
929
+ this.key = term;
930
+ else if (term instanceof OctaveShift)
931
+ this.octave = term;
932
+ else if (term instanceof Command && term.cmd === "change") {
933
+ const pair = term.getAssignmentPair();
934
+ if (pair) {
935
+ switch (pair.key) {
936
+ case "Staff":
937
+ this.staffName = pair.value.toString();
938
+ this.staff = term;
939
+
940
+ break;
941
+ case "Voice":
942
+ this.voiceName = pair.value.toString();
943
+
944
+ break;
945
+ }
946
+ }
947
+ }
948
+ else if (term instanceof Primitive) {
949
+ if (term.exp === "~")
950
+ this.tying = this.event;
951
+ }
952
+ else if (term instanceof PostEvent) {
953
+ if (term.isStaccato)
954
+ this.staccato = true;
955
+ }
956
+ else if (term instanceof SimultaneousList) {
957
+ const contexts: TrackContext[] = [];
958
+ let lastContext = this;
959
+ for (const subterm of term.list) {
960
+ const context = this.clone();
961
+ context.pitch = lastContext.pitch;
962
+ context.event = lastContext.event;
963
+
964
+ context.execute(subterm);
965
+ contexts.push(context);
966
+ lastContext = context;
967
+ }
968
+
969
+ this.mergeParallelClones(contexts);
970
+ }
971
+ else if (term instanceof ContextedMusic) {
972
+ // TODO: process contextDict
973
+
974
+ this.execute(term.body);
975
+ }
976
+ else if (term instanceof StemDirection)
977
+ this.stemDirection = term.direction;
978
+ else {
979
+ if (term.isMusic)
980
+ console.warn("[TrackContext] unexpected music term:", term);
981
+ }
982
+
983
+ if (this.listener)
984
+ this.listener(term, this);
985
+
986
+ if (term instanceof MusicEvent && this.tremoloType === TremoloType.Pitcher)
987
+ this.tremoloType = TremoloType.Catcher;
988
+ }
989
+
990
+
991
+ get declarations (): BaseTerm[] {
992
+ return [this.staff, this.clef, this.key, this.time, this.octave].filter(term => term);
993
+ }
994
+ };
995
+
996
+
997
+ class MusicPerformance {
998
+ staffNames: string[] = [];
999
+ musicTracks: MusicTrack[] = [];
1000
+
1001
+
1002
+ get mainTrack (): MusicTrack {
1003
+ // find the longest track
1004
+ const trackPrior = (track: MusicTrack, index: number): number => -track.block.durationMagnitude + index * 1e-3;
1005
+ const priorTracks = this.musicTracks
1006
+ .filter(track => track.block._parent && !track.isChordMode && !track.isLyricMode)
1007
+ .map((track, index) => ({track, index}))
1008
+ .sort((t1, t2) => trackPrior(t1.track, t1.index) - trackPrior(t2.track, t2.index));
1009
+
1010
+ return priorTracks[0] ? priorTracks[0].track : null;
1011
+ }
1012
+
1013
+
1014
+ get trackNames (): string[] {
1015
+ return this.musicTracks.map(track => `${track.contextDict.Staff}:${track.contextDict.Voice}`);
1016
+ }
1017
+
1018
+
1019
+ get trackContextDicts (): ContextDict[] {
1020
+ const dicts = this.musicTracks.map(track => track.contextDict);
1021
+ dicts.unshift(undefined); // zero placeholder for track index from 1 in notation & SheetDocument
1022
+
1023
+ return dicts;
1024
+ }
1025
+
1026
+
1027
+ get trackInstruments (): string[] {
1028
+ return this.musicTracks.map(track => {
1029
+ const instrumentKey = Object.keys(track.contextDict).find(key => /\.instrumentName/.test(key));
1030
+ if (instrumentKey)
1031
+ return track.contextDict[instrumentKey];
1032
+
1033
+ return null;
1034
+ });
1035
+ }
1036
+
1037
+
1038
+ get instrumentList (): string[] {
1039
+ return Array.from(new Set(this.trackInstruments));
1040
+ }
1041
+
1042
+
1043
+ get channelMap (): number[] {
1044
+ const instrumentList = this.instrumentList;
1045
+ const channels = this.trackInstruments.map(instrument => instrumentList.indexOf(instrument) + 1);
1046
+ channels.unshift(0);
1047
+
1048
+ return channels;
1049
+ }
1050
+
1051
+
1052
+ get measureLayoutCode (): string {
1053
+ return this.mainTrack && this.mainTrack.measureLayoutCode;
1054
+ }
1055
+
1056
+
1057
+ applyMeasureLayout (layout: MeasureLayout) {
1058
+ this.musicTracks.forEach(track => track.applyMeasureLayout(layout));
1059
+ }
1060
+
1061
+
1062
+ getNotation ({logger = new LogRecorder()} = {}): LilyNotation.Notation {
1063
+ const pcTerms: PitchContextTerm[] = [].concat(...this.musicTracks.map((track, i) =>
1064
+ track.generateStaffTracks().map(term => ({track: i + 1, ...term}))));
1065
+ //console.log("pcTerms:", pcTerms);
1066
+
1067
+ const termsToContexts = (staffTerms: PitchContextTerm[], trackIndex: number): LilyStaffContext => {
1068
+ staffTerms.forEach(term => {
1069
+ if (term.event)
1070
+ term.tick = term.event._tick;
1071
+ });
1072
+ staffTerms.sort((t1, t2) => t1.tick - t2.tick);
1073
+
1074
+ const context = new LilyStaffContext({logger});
1075
+ context.staffTrack = trackIndex;
1076
+ context.channelMap = this.channelMap;
1077
+
1078
+ logger.append("staffTerms", staffTerms);
1079
+ //console.debug("staffTerms:", staffTerms);
1080
+ staffTerms.forEach(term => context.executeTerm(term));
1081
+
1082
+ return context;
1083
+ };
1084
+
1085
+ const staffContexts: LilyStaffContext[] = [];
1086
+ if (this.staffNames.length) {
1087
+ this.staffNames.forEach((name, trackIndex) => {
1088
+ const staffTerms = pcTerms.filter(term => term.staffName === name);
1089
+ staffContexts.push(termsToContexts(staffTerms, trackIndex));
1090
+ });
1091
+ }
1092
+ else
1093
+ staffContexts.push(termsToContexts(pcTerms, 0));
1094
+
1095
+ const notes = []
1096
+ .concat(...staffContexts.map(context => context.notes))
1097
+ .sort((n1, n2) => n1.startTick - n2.startTick);
1098
+
1099
+ // append duration of tied notes to root note
1100
+ const pitchMap = {};
1101
+ notes.forEach(note => {
1102
+ if (note.tied) {
1103
+ const root = pitchMap[note.pitch];
1104
+ if (root) {
1105
+ root.endTick = Math.max(root.endTick, note.endTick);
1106
+ root.duration = root.endTick - root.startTick;
1107
+ }
1108
+ }
1109
+ else
1110
+ pitchMap[note.pitch] = note;
1111
+ });
1112
+
1113
+ const pitchContextGroup = staffContexts.map(context => context.pitchContextTable);
1114
+
1115
+ const mainTrack = this.mainTrack;
1116
+
1117
+ const measureHeads = mainTrack && mainTrack.measureHeads;
1118
+ const measureLayout = mainTrack && mainTrack.block.measureLayout;
1119
+
1120
+ return LilyNotation.Notation.fromAbsoluteNotes(notes, measureHeads, {pitchContextGroup, measureLayout, trackNames: this.trackNames});
1121
+ }
1122
+
1123
+
1124
+ getNoteDurationSubdivider (): number {
1125
+ const subdivider = lcmMulti(...this.musicTracks.map(track => track.noteDurationSubdivider));
1126
+
1127
+ return subdivider;
1128
+ }
1129
+
1130
+
1131
+ sliceMeasures (start: number, count: number) {
1132
+ this.musicTracks = this.musicTracks.map(track => {
1133
+ const newTrack = track.sliceMeasures(start, count);
1134
+ newTrack.name = track.name; // inherit name
1135
+
1136
+ return newTrack;
1137
+ });
1138
+ }
1139
+ };
1140
+
1141
+
1142
+
1143
+ export default class LilyInterpreter {
1144
+ variableTable: Map<string, BaseTerm> = new Map();
1145
+
1146
+ // temporary status
1147
+ musicTracks: MusicTrack[] = [];
1148
+ staffNames: string[] = [];
1149
+ musicTrackIndex: number = 0;
1150
+ musicPerformance: MusicPerformance;
1151
+ mainPerformance: MusicPerformance;
1152
+
1153
+ version: Version = null;
1154
+ language: Language = null;
1155
+ header: Block = null;
1156
+ includeFiles: Set<string> = new Set;
1157
+ statements: BaseTerm[] = [];
1158
+ paper: Block = null;
1159
+ layout: Block = null;
1160
+ scores: Block[] = [];
1161
+
1162
+ layoutMusic: MusicPerformance;
1163
+ midiMusic: MusicPerformance;
1164
+
1165
+ functionalCommand?: Variable;
1166
+
1167
+ reservedVariables: Set<string> = new Set();
1168
+
1169
+
1170
+ static trackName (index: number): string {
1171
+ return `Voice_${romanize(index)}`;
1172
+ };
1173
+
1174
+
1175
+ /*eval (term: BaseTerm): BaseTerm {
1176
+ return this.execute(term.clone());
1177
+ }*/
1178
+
1179
+
1180
+ get mainScore (): BaseTerm {
1181
+ return this.variableTable.get(MAIN_SCORE_NAME);
1182
+ };
1183
+
1184
+
1185
+ interpretMusic (music: BaseTerm, contextDict: ContextDict): Variable {
1186
+ //console.log("interpretMusic:", music);
1187
+ const context = new TrackContext(undefined, {contextDict});
1188
+ //context.execute(music.clone());
1189
+ context.execute(music);
1190
+
1191
+ context.track.spreadRelativeBlocks();
1192
+ this.musicTracks.push(context.track);
1193
+
1194
+ const varName = LilyInterpreter.trackName(++this.musicTrackIndex);
1195
+
1196
+ context.track.name = varName;
1197
+
1198
+ return new Variable({name: varName});
1199
+ }
1200
+
1201
+
1202
+ interpretDocument (doc: LilyDocument): this {
1203
+ if (doc.reservedVariables)
1204
+ this.appendReservedVariables(doc.reservedVariables);
1205
+
1206
+ this.execute(doc.root);
1207
+
1208
+ return this;
1209
+ }
1210
+
1211
+
1212
+ createMusicPerformance () {
1213
+ if (this.musicTracks.length) {
1214
+ if (!this.musicPerformance)
1215
+ this.musicPerformance = new MusicPerformance();
1216
+
1217
+ this.staffNames.forEach(name => {
1218
+ if (!this.musicPerformance.staffNames.some(sn => sn === name))
1219
+ this.musicPerformance.staffNames.push(name);
1220
+ else if (!name)
1221
+ console.warn("[LilyInterpreter] Multiple empty context staff name may cause error pitchContextTable:", this.musicPerformance.staffNames);
1222
+ });
1223
+ this.musicTracks.forEach(track => this.musicPerformance.musicTracks.push(track));
1224
+
1225
+ this.staffNames = [];
1226
+ this.musicTracks = [];
1227
+ }
1228
+ }
1229
+
1230
+
1231
+ execute (term: BaseTerm, {execMusic = false, contextDict = {}}: {execMusic?: boolean, contextDict?: ContextDict} = {}): BaseTerm {
1232
+ if (!term)
1233
+ return term;
1234
+
1235
+ if (this.functionalCommand && term.isMusic) {
1236
+ term._functional = this.functionalCommand.name;
1237
+ this.functionalCommand = null;
1238
+ }
1239
+
1240
+ if (term instanceof Root) {
1241
+ for (const section of term.sections) {
1242
+ const sec = this.execute(section, {execMusic: true});
1243
+ if (sec instanceof Version)
1244
+ this.version = sec;
1245
+ else if (sec instanceof Language)
1246
+ this.language = sec;
1247
+ else if (sec instanceof Scheme)
1248
+ this.statements.push(sec);
1249
+ else if (sec instanceof Block) {
1250
+ switch (sec.head) {
1251
+ case "\\header":
1252
+ this.header = sec;
1253
+
1254
+ break;
1255
+ case "\\paper":
1256
+ this.paper = sec;
1257
+
1258
+ break;
1259
+ case "\\layout":
1260
+ this.layout = sec;
1261
+
1262
+ break;
1263
+ case "\\score":
1264
+ this.scores.push(sec);
1265
+
1266
+ break;
1267
+ }
1268
+ }
1269
+ }
1270
+
1271
+ this.createMusicPerformance();
1272
+
1273
+ if (this.musicPerformance) {
1274
+ this.layoutMusic = this.musicPerformance;
1275
+ this.midiMusic = this.musicPerformance;
1276
+
1277
+ this.musicPerformance = null;
1278
+ }
1279
+ }
1280
+ else if (term instanceof Assignment) {
1281
+ if (term.key) {
1282
+ const name = term.key as string;
1283
+ const isMainScore = name === MAIN_SCORE_NAME;
1284
+ if (isMainScore)
1285
+ this.musicPerformance = null;
1286
+
1287
+ const value = this.execute(term.value, {execMusic: isMainScore});
1288
+
1289
+ this.variableTable.set(name, value);
1290
+
1291
+ if (isMainScore)
1292
+ this.mainPerformance = this.musicPerformance;
1293
+ }
1294
+ }
1295
+ else if (term instanceof Block) {
1296
+ switch (term.head) {
1297
+ case "\\score":
1298
+ const body = term.body.map(subterm => this.execute(subterm, {execMusic: true}));
1299
+
1300
+ this.musicPerformance = null;
1301
+
1302
+ return new Block({
1303
+ block: term.block,
1304
+ head: term.head,
1305
+ body,
1306
+ });
1307
+ case "\\layout":
1308
+ this.layoutMusic = this.musicPerformance;
1309
+
1310
+ break;
1311
+ case "\\midi":
1312
+ this.midiMusic = this.musicPerformance;
1313
+
1314
+ break;
1315
+ }
1316
+ }
1317
+ else if (term instanceof Variable) {
1318
+ const result = this.variableTable.get(term.name);
1319
+ if (!result) {
1320
+ if (FUNCTIONAL_VARIABLE_NAME_PATTERN.test(term.name)) {
1321
+ this.functionalCommand = term;
1322
+
1323
+ return term;
1324
+ }
1325
+ else if (this.reservedVariables.has(term.name)) {
1326
+ // ignore reserved variables
1327
+ }
1328
+ else
1329
+ console.warn("uninitialized variable is referred:", term);
1330
+ }
1331
+
1332
+ if (term.name === MAIN_SCORE_NAME) {
1333
+ this.musicPerformance = this.mainPerformance;
1334
+
1335
+ return term;
1336
+ }
1337
+
1338
+ return this.execute(result, {execMusic, contextDict});
1339
+ }
1340
+ else if (term instanceof MusicBlock) {
1341
+ const result = new MusicBlock({
1342
+ _parent: term._parent,
1343
+ _functional: term._functional,
1344
+ body: term.body.map(subterm => this.execute(subterm)).filter(Boolean),
1345
+ });
1346
+
1347
+ this.functionalCommand = null;
1348
+
1349
+ if (execMusic) {
1350
+ const variable = this.interpretMusic(result, contextDict);
1351
+ return new MusicBlock({body: [variable]});
1352
+ }
1353
+
1354
+ return result;
1355
+ }
1356
+ else if (term instanceof SimultaneousList) {
1357
+ const list = term.list.map(subterm => this.execute(subterm, {execMusic, contextDict})).filter(term => term);
1358
+ this.createMusicPerformance();
1359
+
1360
+ return new SimultaneousList({list});
1361
+ }
1362
+ else if (term instanceof ContextedMusic) {
1363
+ if (term.contextDict && typeof term.contextDict.Staff === "string")
1364
+ this.staffNames.push(term.contextDict.Staff);
1365
+
1366
+ return new ContextedMusic({
1367
+ head: this.execute(term.head),
1368
+ lyrics: this.execute(term.lyrics),
1369
+ body: this.execute(term.body, {execMusic, contextDict: {...contextDict, ...term.contextDict}}),
1370
+ });
1371
+ }
1372
+ else if (term instanceof ParallelMusic) {
1373
+ term.voices.forEach(voice => {
1374
+ const block = new MusicBlock({
1375
+ body: MusicChunk.join(voice.body),
1376
+ });
1377
+
1378
+ const value = this.execute(block);
1379
+ this.variableTable.set(voice.name, value);
1380
+ });
1381
+ }
1382
+ else if (term instanceof Include)
1383
+ this.includeFiles.add(term.filename);
1384
+ else if (term instanceof Command) {
1385
+ switch (term.cmd) {
1386
+ case "set":
1387
+ if (term.args[0] instanceof Assignment) {
1388
+ const assign = term.args[0];
1389
+ contextDict[assign.key.toString()] = assign.value.toString();
1390
+ }
1391
+
1392
+ break;
1393
+ }
1394
+
1395
+ return parseRaw({proto: term.proto, cmd: term.cmd, args: term.args.map(arg => this.execute(arg, {execMusic, contextDict}))});
1396
+ }
1397
+
1398
+ return term;
1399
+ }
1400
+
1401
+
1402
+ updateTrackAssignments () {
1403
+ if (this.layoutMusic)
1404
+ this.layoutMusic.musicTracks.forEach(track => this.variableTable.set(track.name, track.music));
1405
+
1406
+ if (this.midiMusic && this.midiMusic !== this.layoutMusic)
1407
+ this.midiMusic.musicTracks.forEach(track => this.variableTable.set(track.name, track.music));
1408
+
1409
+ // update main score variable order in table
1410
+ const mainScore = this.mainScore;
1411
+ if (mainScore) {
1412
+ this.variableTable.delete(MAIN_SCORE_NAME);
1413
+ this.variableTable.set(MAIN_SCORE_NAME, mainScore);
1414
+ }
1415
+ }
1416
+
1417
+
1418
+ toDocument (): LilyDocument {
1419
+ this.updateTrackAssignments();
1420
+
1421
+ const variables = [].concat(...[this.paper, this.layout, ...this.scores, this.mainScore].filter(block => block).map(block => block.findAll(Variable).map(variable => variable.name)));
1422
+ const variablesUnique = Array.from(new Set(variables));
1423
+
1424
+ // sort variables by order in variable table
1425
+ const vars = [...this.variableTable.keys()];
1426
+ variablesUnique.sort((v1, v2) => vars.indexOf(v1) - vars.indexOf(v2));
1427
+
1428
+ const assignments = variablesUnique.filter(name => this.variableTable.get(name)).map(name => new Assignment({key: name, value: this.variableTable.get(name)}));
1429
+ const includes = Array.from(this.includeFiles).map(filename => Include.create(filename));
1430
+
1431
+ const root = new Root({sections: [
1432
+ this.version,
1433
+ this.language,
1434
+ this.header,
1435
+ ...includes,
1436
+ ...this.statements,
1437
+ this.paper,
1438
+ this.layout,
1439
+ ...assignments,
1440
+ ...this.scores,
1441
+ ].filter(section => section)});
1442
+
1443
+ const doc = new LilyDocument(root);
1444
+ doc.reservedVariables = this.reservedVariables;
1445
+
1446
+ return doc;
1447
+ }
1448
+
1449
+
1450
+ sliceMeasures (start: number, count: number) {
1451
+ if (this.layoutMusic)
1452
+ this.layoutMusic.sliceMeasures(start, count);
1453
+
1454
+ if (this.midiMusic && this.midiMusic !== this.layoutMusic)
1455
+ this.midiMusic.sliceMeasures(start, count);
1456
+ }
1457
+
1458
+
1459
+ addIncludeFile (filename: string) {
1460
+ this.includeFiles.add(filename);
1461
+ }
1462
+
1463
+
1464
+ appendReservedVariables (names: Iterable<string>) {
1465
+ for (const name of names)
1466
+ this.reservedVariables.add(name);
1467
+ }
1468
+
1469
+
1470
+ getNotation ({logger = new LogRecorder()} = {}): LilyNotation.Notation {
1471
+ if (this.midiMusic)
1472
+ return this.midiMusic.getNotation({logger});
1473
+
1474
+ return null;
1475
+ }
1476
+ };
inc/lilyParser/lilyTerms.ts ADDED
@@ -0,0 +1,2991 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {WHOLE_DURATION_MAGNITUDE, FractionNumber, lcmMulti, gcd, MAIN_SCORE_NAME} from "./utils";
3
+ import * as idioms from "./idioms";
4
+ import {LILYPOND_VERSION} from "../constants";
5
+ import * as measureLayout from "../measureLayout";
6
+ import ImplicitType from "../lilyNotation/implicitType";
7
+ import pick from "../pick";
8
+
9
+
10
+
11
+ interface Location {
12
+ lines: [number, number];
13
+ columns: [number, number];
14
+ };
15
+
16
+
17
+ abstract class Locator {
18
+ location: Location;
19
+
20
+
21
+ constructor (term: BaseTerm) {
22
+ term._location = term._location || {lines: [0, 0], columns: [0, 0]};
23
+ this.location = term._location;
24
+ }
25
+
26
+ abstract set (line: number, column: number): void;
27
+ };
28
+
29
+
30
+ class OpenLocator extends Locator {
31
+ set (line: number, column: number) {
32
+ this.location.lines[0] = line;
33
+ this.location.columns[0] = column;
34
+ }
35
+ };
36
+
37
+
38
+ class CloseLocator extends Locator {
39
+ set (line: number, column: number) {
40
+ this.location.lines[1] = line;
41
+ this.location.columns[1] = column;
42
+ }
43
+ };
44
+
45
+
46
+ // concat array of array
47
+ const cc = <T>(arrays: T[][]): T[] => [].concat(...arrays);
48
+
49
+
50
+ export class MusicChunk {
51
+ parent: MusicBlock;
52
+ terms: BaseTerm[];
53
+
54
+
55
+ static join (chunks: MusicChunk[]): BaseTerm[] {
56
+ return cc(chunks.map((chunk, i) => i === chunks.length - 1 ? chunk.terms : [...chunk.terms, new Divide({})]));
57
+ }
58
+
59
+
60
+ constructor (parent: MusicBlock, terms: BaseTerm[] = []) {
61
+ this.parent = parent;
62
+ this.terms = terms;
63
+ }
64
+
65
+
66
+ push (term: BaseTerm) {
67
+ this.terms.push(term);
68
+ }
69
+
70
+
71
+ get size () {
72
+ return this.terms.length;
73
+ }
74
+
75
+
76
+ get durationMagnitude () {
77
+ return this.terms.reduce((magnitude, term) => magnitude + term.durationMagnitude, 0);
78
+ }
79
+ };
80
+
81
+
82
+ interface MusicVoice {
83
+ name?: string;
84
+ body: MusicChunk[];
85
+ };
86
+
87
+
88
+ type MusicChunkMap = Map<number, MusicChunk>;
89
+
90
+
91
+ const isNullItem = item => item === "" || item === undefined || item === null || (Array.isArray(item) && !item.length);
92
+ const compact = items => cc(items.map((item, index) => isNullItem(item) ? [] : [index > 0 ? "\b" : null, item]));
93
+
94
+
95
+ export const getDurationSubdivider = (term: BaseTerm): number => {
96
+ if (term instanceof MusicEvent) {
97
+ if (!(term instanceof Rest) || !term.isSpacer)
98
+ return term.durationValue.subdivider;
99
+ }
100
+ else if (term instanceof MusicBlock)
101
+ return lcmMulti(...term.body.map(getDurationSubdivider));
102
+ else if (term instanceof MusicChunk)
103
+ return lcmMulti(...term.terms.map(getDurationSubdivider));
104
+ else if ((term instanceof Times) || (term instanceof Tuplet)) {
105
+ const divider = term instanceof Tuplet ? term.divider : term.factor.reciprocal;
106
+ divider.numerator *= getDurationSubdivider(term.music);
107
+
108
+ return divider.reduced.numerator;
109
+ }
110
+ else if (term instanceof Repeat)
111
+ return getDurationSubdivider(term.bodyBlock);
112
+ else if (term instanceof Relative)
113
+ return getDurationSubdivider(term.music);
114
+ else if (term.isMusic)
115
+ console.warn("[getDurationSubdivider] unexpected music term:", term);
116
+
117
+ return 1;
118
+ };
119
+
120
+
121
+ export const constructMusicFromMeasureLayout = (layout: measureLayout.MeasureLayout, chunks: MusicChunkMap): MusicChunk => {
122
+ const joinMeasureSeq = (seq: measureLayout.MeasureSeq): BaseTerm[] => MusicChunk.join(seq.map(sublayout => constructMusicFromMeasureLayout(sublayout, chunks)));
123
+
124
+ if (layout instanceof measureLayout.SingleMLayout) {
125
+ const chunk = chunks.get(layout.measure);
126
+ console.assert(!!chunk, "no chunk for measure:", layout.measure);
127
+
128
+ return chunk;
129
+ }
130
+ else if (layout instanceof measureLayout.BlockMLayout) {
131
+ const terms = joinMeasureSeq(layout.seq);
132
+
133
+ return new MusicChunk(null, terms);
134
+ }
135
+ else if (layout instanceof measureLayout.VoltaMLayout) {
136
+ const bodyTerms = joinMeasureSeq(layout.body);
137
+ const alternative = layout.alternates && layout.alternates.map(alternate => new MusicBlock({body: joinMeasureSeq(alternate)}));
138
+
139
+ const repeat = Repeat.createVolta(layout.times.toString(), new MusicBlock({body: bodyTerms}), alternative);
140
+
141
+ return new MusicChunk(null, [repeat]);
142
+ }
143
+ else if (layout instanceof measureLayout.ABAMLayout) {
144
+ const mainList = constructMusicFromMeasureLayout(layout.main, chunks);
145
+ const main = mainList.terms.length === 1 ? mainList.terms[0] : new MusicBlock({body: mainList.terms});
146
+ const restTerms = joinMeasureSeq(layout.rest);
147
+
148
+ const block = new MusicBlock({body: [main, ...restTerms]});
149
+
150
+ return new MusicChunk(null, [new Variable({name: "lotusRepeatABA"}), block]);
151
+ }
152
+ };
153
+
154
+
155
+ export class BaseTerm {
156
+ _location?: Location;
157
+ _measure?: number;
158
+ _tick?: number;
159
+ _previous?: BaseTerm;
160
+ _anchorPitch?: ChordElement;
161
+ _parent?: BaseTerm;
162
+
163
+ _headComment: Comment;
164
+ _tailComment: Comment;
165
+
166
+ // lotus extensional function modifier
167
+ _functional: string;
168
+
169
+
170
+ constructor (data: object) {
171
+ //Object.assign(this, data);
172
+ for (const key in data)
173
+ this[key] = parseRaw(data[key]);
174
+ }
175
+
176
+
177
+ serialize (): any[] {
178
+ console.warn("unimplemented serilization:", this);
179
+ return [];
180
+ }
181
+
182
+
183
+ join (): string {
184
+ let words = this.serialize().filter(word => ["string", "number"].includes(typeof word)).map(word => word.toString()) as string[];
185
+ words = words.filter((word, i) => !(i && words[i - 1] === "\n" && word === "\n"));
186
+
187
+ let indent = 0;
188
+ const result: string[] = [];
189
+
190
+ const pop = char => {
191
+ if (!char || result[result.length - 1] === char) {
192
+ result.pop();
193
+ return true;
194
+ }
195
+ };
196
+
197
+ for (const word of words) {
198
+ switch (word) {
199
+ case "\b":
200
+ // remove last space
201
+ pop(" ");
202
+ continue;
203
+
204
+ case "\b\n":
205
+ // remove last newline
206
+ while (pop("\t")) {}
207
+ pop("\n");
208
+ continue;
209
+
210
+ case "\n":
211
+ // no space at line tail
212
+ pop(" ");
213
+ }
214
+
215
+ if (/^(\}|>>)/.test(word))
216
+ pop("\t"); // remove the last tab
217
+
218
+ result.push(word);
219
+
220
+ if (/\n$/.test(word)) {
221
+ if (/(\{|<<)\n$/.test(word))
222
+ ++indent;
223
+ else if (/^(\}|>>)/.test(word))
224
+ --indent;
225
+
226
+ if (indent)
227
+ result.push(...Array(indent).fill("\t"));
228
+ }
229
+ else
230
+ result.push(" ");
231
+ }
232
+
233
+ return result.join("");
234
+ }
235
+
236
+
237
+ relocate (source: string = this.join()) {
238
+ const words = this.serialize()
239
+ .filter(word => word !== null && word !== undefined
240
+ && (typeof word !== "string" || (/\S/.test(word) && !word.includes("\b"))))
241
+ .map(word => typeof word === "string" ? word.replace(/\n/g, "") : word);
242
+
243
+ const chars = source.split("");
244
+ let line = 1;
245
+ let column = 0;
246
+
247
+ let wordIndex = 0;
248
+
249
+ for (let i = 0; i < chars.length; ++i) {
250
+ if (wordIndex >= words.length)
251
+ break;
252
+
253
+ const char = chars[i];
254
+
255
+ switch (char) {
256
+ case "\n":
257
+ ++line;
258
+ column = 0;
259
+
260
+ break;
261
+ case " ":
262
+ case "\t":
263
+ ++column;
264
+
265
+ break;
266
+ default:
267
+ let word = words[wordIndex];
268
+ while (word instanceof Locator) {
269
+ word.set(line, column);
270
+
271
+ ++wordIndex;
272
+ word = words[wordIndex];
273
+ }
274
+
275
+ if (wordIndex >= words.length)
276
+ break;
277
+
278
+ word = word.toString();
279
+ if (char === word[0]) {
280
+ i += word.length - 1;
281
+ column += word.length;
282
+ ++wordIndex;
283
+ }
284
+ else {
285
+ //debugger;
286
+ throw new Error(`unexpected char in source: [${i}]'${char}', expect: ${word}`);
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+
293
+ clone (): this {
294
+ return parseRaw(JSON.parse(JSON.stringify(this)));
295
+ }
296
+
297
+
298
+ get entries (): BaseTerm[] {
299
+ return null;
300
+ }
301
+
302
+
303
+ get isMusic (): boolean {
304
+ return false;
305
+ }
306
+
307
+
308
+ get musicChunks (): MusicChunk[] {
309
+ if (!this.isMusic || !this.entries)
310
+ return [];
311
+
312
+ return [].concat(...this.entries.map(entry => entry.musicChunks));
313
+ }
314
+
315
+
316
+ get measures (): number[] {
317
+ const indices = [this._measure].concat(...(this.entries || []).map(entry => entry.measures)).filter(index => Number.isInteger(index));
318
+
319
+ return Array.from(new Set(indices));
320
+ }
321
+
322
+
323
+ get durationMagnitude (): number {
324
+ return 0;
325
+ }
326
+
327
+
328
+ get proto () {
329
+ return termProtoMap.get(Object.getPrototypeOf(this));
330
+ }
331
+
332
+
333
+ get href (): string {
334
+ if (this._location)
335
+ return `${this._location.lines[0]}:${this._location.columns[0]}:${this._location.columns[1]}`;
336
+
337
+ return null;
338
+ }
339
+
340
+
341
+ get measureLayout (): measureLayout.MeasureLayout {
342
+ return null;
343
+ }
344
+
345
+
346
+ getField (key): any {
347
+ console.assert(!!this.entries, "[BaseTerm.getField] term's entries is null:", this);
348
+
349
+ for (const entry of this.entries) {
350
+ const result = entry.query(key);
351
+ if (result)
352
+ return result;
353
+ }
354
+ }
355
+
356
+
357
+ query (key: string): any {
358
+ void(key);
359
+ //console.warn("term.query not implemented:", this);
360
+ }
361
+
362
+
363
+ appendAssignment (key, value) {
364
+ console.assert(!!this.entries, "no entries on this term.");
365
+
366
+ const assign = this.getField(key);
367
+ if (assign)
368
+ assign.value = value;
369
+ else {
370
+ this.entries.push(parseRaw({
371
+ proto: "Assignment",
372
+ key,
373
+ value: value,
374
+ }));
375
+ }
376
+ }
377
+
378
+
379
+ findFirst (condition: Function): BaseTerm {
380
+ if (!this.entries)
381
+ return null;
382
+
383
+ if (BaseTerm.isPrototypeOf(condition)) {
384
+ const termClass = condition;
385
+ condition = term => term instanceof termClass;
386
+ }
387
+
388
+ for (const entry of this.entries) {
389
+ if (condition(entry))
390
+ return entry;
391
+
392
+ if (entry instanceof BaseTerm) {
393
+ const result = entry.findFirst(condition);
394
+ if (result)
395
+ return result;
396
+ }
397
+ }
398
+ }
399
+
400
+
401
+ findLast (condition: any): BaseTerm {
402
+ if (!this.entries)
403
+ return null;
404
+
405
+ if (BaseTerm.isPrototypeOf(condition)) {
406
+ const termClass = condition;
407
+ condition = term => term instanceof termClass;
408
+ }
409
+
410
+ const reversedEntries = [...this.entries];
411
+ reversedEntries.reverse();
412
+
413
+ for (const entry of reversedEntries) {
414
+ if (condition(entry))
415
+ return entry;
416
+
417
+ if (entry instanceof BaseTerm) {
418
+ const result = entry.findLast(condition);
419
+ if (result)
420
+ return result;
421
+ }
422
+ }
423
+ }
424
+
425
+
426
+ findAll (condition: any): any[] {
427
+ if (!this.entries)
428
+ return [];
429
+
430
+ if (BaseTerm.isPrototypeOf(condition)) {
431
+ const termClass = condition;
432
+ condition = term => term instanceof termClass;
433
+ }
434
+
435
+ const result = [];
436
+
437
+ for (const entry of this.entries) {
438
+ if (condition(entry))
439
+ result.push(entry);
440
+
441
+ if (entry instanceof BaseTerm)
442
+ result.push(...entry.findAll(condition));
443
+ }
444
+
445
+ return result;
446
+ }
447
+
448
+
449
+ forEachTerm (termClass, handle) {
450
+ if (!this.entries)
451
+ return;
452
+
453
+ for (const entry of this.entries) {
454
+ if (entry instanceof termClass)
455
+ handle(entry);
456
+
457
+ if (entry instanceof BaseTerm)
458
+ entry.forEachTerm(termClass, handle);
459
+ }
460
+ }
461
+
462
+
463
+ forEachTopTerm (termClass, handle) {
464
+ if (!this.entries)
465
+ return;
466
+
467
+ for (const entry of this.entries) {
468
+ if (entry instanceof termClass)
469
+ handle(entry);
470
+ else if (entry instanceof BaseTerm)
471
+ entry.forEachTopTerm(termClass, handle);
472
+ }
473
+ }
474
+
475
+
476
+ toJSON () {
477
+ // exlude meta fields in JSON
478
+ const fields = Object.keys(this).filter(key => !/^_/.test(key));
479
+ const data = pick(this, fields);
480
+
481
+ Object.entries(data).forEach(([key, value]) => {
482
+ if (value && typeof value === "object" && !Array.isArray(value) && !(value instanceof BaseTerm))
483
+ data[key] = {proto: "_PLAIN", ...value};
484
+ });
485
+
486
+ return {
487
+ proto: this.proto,
488
+ ...data,
489
+ };
490
+ }
491
+
492
+
493
+ static isTerm (x): boolean {
494
+ return typeof x === "object" && x instanceof BaseTerm;
495
+ }
496
+
497
+
498
+ static optionalSerialize (item: any): any[] {
499
+ //return BaseTerm.isTerm(item) ? (item as BaseTerm).serialize() : (item === undefined ? [] : [item]);
500
+ if (!BaseTerm.isTerm(item))
501
+ return item === undefined ? [] : [item];
502
+
503
+ return [
504
+ ...BaseTerm.optionalSerialize(item._headComment),
505
+ ...item.serialize(),
506
+ ...(item._tailComment ? ["\b\n", "\t"] : []),
507
+ ...BaseTerm.optionalSerialize(item._tailComment),
508
+ ];
509
+ }
510
+
511
+
512
+ static serializeScheme (item: any): any[] {
513
+ if (typeof item === "boolean")
514
+ item = item ? "#t" : "#f";
515
+
516
+ return BaseTerm.optionalSerialize(item);
517
+ }
518
+ }
519
+
520
+
521
+ export class Root extends BaseTerm {
522
+ sections: BaseTerm[];
523
+
524
+
525
+ serialize () {
526
+ return cc(this.sections.map(section => [...BaseTerm.optionalSerialize(section), "\n\n"]));
527
+ }
528
+
529
+
530
+ get entries (): BaseTerm[] {
531
+ return this.sections;
532
+ }
533
+
534
+
535
+ getBlock (head): Block {
536
+ return this.entries.find((entry: any) => entry.head === head || (entry.head === "\\" + head)) as Block;
537
+ }
538
+
539
+
540
+ get includeFiles (): string[] {
541
+ return this.sections.filter(section => section instanceof Include).map((include: Include) => include.filename);
542
+ }
543
+
544
+
545
+ static priorityForSection (term: BaseTerm): number {
546
+ if (term instanceof Version)
547
+ return 0;
548
+
549
+ if (term instanceof Language)
550
+ return 1;
551
+
552
+ if (term instanceof Scheme)
553
+ return 3;
554
+
555
+ if (term instanceof Assignment)
556
+ return 7;
557
+
558
+ if (term instanceof Block) {
559
+ switch (term.head) {
560
+ case "\\header":
561
+ return 2;
562
+
563
+ case "\\paper":
564
+ return 4;
565
+
566
+ case "\\layout":
567
+ return 5;
568
+
569
+ case "\\score":
570
+ return 10;
571
+ }
572
+ }
573
+
574
+ return Infinity;
575
+ }
576
+
577
+
578
+ reorderSections () {
579
+ this.sections.sort((s1, s2) => Root.priorityForSection(s1) - Root.priorityForSection(s2));
580
+ }
581
+ };
582
+
583
+
584
+ export class Primitive extends BaseTerm {
585
+ exp: string | number;
586
+
587
+
588
+ serialize () {
589
+ return [this.exp];
590
+ }
591
+ };
592
+
593
+
594
+ export class LiteralString extends BaseTerm {
595
+ exp: string
596
+
597
+
598
+ static fromString (content: string): LiteralString {
599
+ return new LiteralString({exp: JSON.stringify(content)});
600
+ }
601
+
602
+
603
+ serialize () {
604
+ return [this.exp];
605
+ }
606
+
607
+
608
+ toString () {
609
+ try {
610
+ return eval(this.exp);
611
+ }
612
+ catch (err) {
613
+ console.warn("invalid lilypond string exp:", this.exp);
614
+ return this.exp;
615
+ }
616
+ }
617
+ };
618
+
619
+
620
+ export class Command extends BaseTerm {
621
+ cmd: string;
622
+ args: any[];
623
+
624
+
625
+ static createSet (key: string|BaseTerm, value: BaseTerm): Command {
626
+ return new Command({cmd: "set", args: [new Assignment({key, value})]});
627
+ }
628
+
629
+
630
+ constructor (data) {
631
+ super(data);
632
+
633
+ this.args.forEach(term => {
634
+ if (term instanceof MusicBlock || term instanceof Block)
635
+ term._parent = this;
636
+ });
637
+ }
638
+
639
+
640
+ serialize () {
641
+ return [
642
+ "\\" + this.cmd,
643
+ ...[].concat(...this.args.map(BaseTerm.optionalSerialize)),
644
+ ["break", "pageBreak", "overrideProperty"].includes(this.cmd) ? "\n" : null,
645
+ ];
646
+ }
647
+
648
+
649
+ get entries () {
650
+ return this.args.filter(arg => arg instanceof BaseTerm);
651
+ }
652
+
653
+
654
+ get isMusic (): boolean {
655
+ return this.args.some(arg => arg.isMusic);
656
+ }
657
+
658
+
659
+ get musicChunks (): MusicChunk[] {
660
+ if (this.cmd === "alternative")
661
+ return [].concat(...this.args[0].body.map(term => term.musicChunks));
662
+
663
+ return [].concat(...this.entries.map(entry => entry.musicChunks));
664
+ }
665
+
666
+
667
+ get isRepeatWithAlternative () {
668
+ return this.cmd === "repeat"
669
+ && this.args[2] instanceof MusicBlock
670
+ && this.args[3]
671
+ && this.args[3].cmd === "alternative";
672
+ }
673
+
674
+
675
+ get durationMagnitude (): number {
676
+ switch (this.cmd) {
677
+ // TODO: refine this in Times
678
+ case "times": {
679
+ const factor = eval(this.args[0]);
680
+ return this.args[1].durationMagnitude * factor;
681
+ }
682
+
683
+ // TODO: refine this in Tuplet
684
+ case "tuplet": {
685
+ const factor = 1 / eval(this.args[0]);
686
+ return this.args[this.args.length - 1].durationMagnitude * factor;
687
+ }
688
+
689
+ case "afterGrace":
690
+ return this.args[0].durationMagnitude;
691
+
692
+ default:
693
+ if (this instanceof Grace)
694
+ return 0;
695
+
696
+ return this.args.filter(arg => arg instanceof BaseTerm).reduce((magnitude, term) => magnitude + term.durationMagnitude, 0);
697
+ }
698
+ }
699
+
700
+
701
+ get measureLayout (): measureLayout.MeasureLayout {
702
+ const args = [...this.args].reverse();
703
+ for (const arg of args) {
704
+ const layout = arg instanceof BaseTerm && arg.measureLayout;
705
+ if (layout)
706
+ return layout;
707
+ }
708
+
709
+ return null;
710
+ }
711
+
712
+
713
+ getAssignmentPair (): {key: any, value: any} {
714
+ if (this.args[0] instanceof Assignment)
715
+ return {key: this.args[0].key, value: this.args[0].value};
716
+
717
+ if (this.args[1] instanceof Assignment)
718
+ return {key: this.args[0], value: this.args[1].value};
719
+
720
+ if (typeof this.args[0] === "string")
721
+ return {key: this.args[0], value: ""};
722
+
723
+ return null;
724
+ }
725
+ };
726
+
727
+
728
+ export class Variable extends Command {
729
+ name: string
730
+
731
+
732
+ constructor ({name}) {
733
+ super({cmd: name, args: []});
734
+
735
+ this.name = name;
736
+ }
737
+
738
+
739
+ toJSON (): any {
740
+ return {
741
+ proto: this.proto,
742
+ name: this.name,
743
+ };
744
+ }
745
+
746
+
747
+ queryValue (dict: BaseTerm): any {
748
+ const field = dict.getField(this.name);
749
+
750
+ return field && field.value;
751
+ }
752
+
753
+
754
+ get isMusic (): boolean {
755
+ if ([MAIN_SCORE_NAME].includes(this.name))
756
+ return true;
757
+
758
+ return false;
759
+ }
760
+ };
761
+
762
+
763
+ export class MarkupCommand extends Command {
764
+ toString () {
765
+ const strs = [];
766
+ this.forEachTerm(LiteralString, term => strs.push(term.toString()));
767
+
768
+ return strs.join("\n");
769
+ }
770
+ };
771
+
772
+
773
+ export class Repeat extends Command {
774
+ static createVolta (times: string, body: MusicBlock, alternative?: MusicBlock[]): Repeat {
775
+ const args: any[] = [
776
+ "volta",
777
+ times,
778
+ body,
779
+ ];
780
+
781
+ if (alternative) {
782
+ args.push(new Command({
783
+ cmd: "alternative",
784
+ args: [new MusicBlock({body: alternative})],
785
+ }));
786
+ }
787
+
788
+ return new Repeat({cmd: "repeat", args});
789
+ }
790
+
791
+
792
+ get type (): string {
793
+ return this.args[0];
794
+ }
795
+
796
+
797
+ get times () {
798
+ return Number(this.args[1]);
799
+ }
800
+
801
+
802
+ get bodyBlock (): MusicBlock {
803
+ return this.args[2];
804
+ }
805
+
806
+
807
+ get alternativeBlocks (): MusicBlock[] {
808
+ return this.args[3] && this.args[3].args[0].body;
809
+ }
810
+
811
+
812
+ // this result length equal to times, if not null
813
+ get completeAlternativeBlocks (): MusicBlock[] {
814
+ if (!this.alternativeBlocks || !this.alternativeBlocks.length)
815
+ return null;
816
+
817
+ if (this.alternativeBlocks.length >= this.times)
818
+ return this.alternativeBlocks.slice(0, this.times);
819
+
820
+ const list = [];
821
+ for (let i = 0; i < this.times - this.alternativeBlocks.length; ++ i)
822
+ list.push(this.alternativeBlocks[0]);
823
+ list.push(...this.alternativeBlocks);
824
+
825
+ return list;
826
+ }
827
+
828
+
829
+ get measureLayout (): measureLayout.MeasureLayout {
830
+ switch (this.type) {
831
+ case "volta": {
832
+ const layout = new measureLayout.VoltaMLayout();
833
+ layout.times = this.times;
834
+ layout.body = this.bodyBlock.measureLayout.seq;
835
+ layout.alternates = this.alternativeBlocks && this.alternativeBlocks.map(block => block.measureLayout.seq);
836
+
837
+ return layout;
838
+ }
839
+
840
+ case "tremolo":
841
+ return this.bodyBlock.measureLayout;
842
+
843
+ default:
844
+ console.warn("unsupported repeat type:", this.type);
845
+ }
846
+
847
+ return null;
848
+ }
849
+
850
+
851
+ // for tremolo
852
+ get sumDuration (): Duration {
853
+ if (this.bodyBlock instanceof MusicEvent)
854
+ return Duration.fromMagnitude(this.args[2].durationMagnitude * this.times);
855
+ else if (this.bodyBlock instanceof MusicBlock) {
856
+ const events = this.bodyBlock.body.filter(term => term instanceof MusicEvent);
857
+ const magnitude = events.reduce((m, event) => m + event.durationMagnitude, 0) * this.times;
858
+
859
+ return Duration.fromMagnitude(magnitude);
860
+ }
861
+
862
+ return null;
863
+ }
864
+
865
+
866
+ get singleTremolo (): boolean {
867
+ if (this.type === "tremolo") {
868
+ if (this.bodyBlock instanceof MusicEvent)
869
+ return true;
870
+
871
+ if (this.bodyBlock instanceof MusicBlock) {
872
+ const events = this.bodyBlock.body.filter(term => term instanceof MusicEvent);
873
+ return events.length === 1;
874
+ }
875
+ }
876
+
877
+ return false;
878
+ }
879
+
880
+
881
+ // \repeat {body} \alternative {{alter1} {alter2}} => body alter1 body alter2
882
+ getUnfoldTerms (): BaseTerm[] {
883
+ const completeAlternativeBlocks = this.completeAlternativeBlocks;
884
+
885
+ const list = [];
886
+ for (let i = 0; i < this.times; ++i) {
887
+ list.push(...this.bodyBlock.clone().body);
888
+
889
+ if (completeAlternativeBlocks)
890
+ list.push(...completeAlternativeBlocks[i].clone().body);
891
+ }
892
+
893
+ return list;
894
+ }
895
+
896
+
897
+ // \repeat {body} \alternative {{alter1} {alter2}} => body alter1 alter2
898
+ getPlainTerms (): BaseTerm[] {
899
+ const list = [...this.bodyBlock.clone().body];
900
+
901
+ const alternativeBlocks = this.alternativeBlocks;
902
+ if (alternativeBlocks)
903
+ alternativeBlocks.forEach(block => list.push(...block.clone().body));
904
+
905
+ return list;
906
+ }
907
+
908
+
909
+ // \repeat {body} \alternative {{alter1} {alter2}} => body alter2
910
+ getTailPassTerms (): BaseTerm[] {
911
+ const list = [...this.bodyBlock.clone().body];
912
+
913
+ const alternativeBlocks = this.alternativeBlocks;
914
+ if (alternativeBlocks)
915
+ list.push(...alternativeBlocks[alternativeBlocks.length - 1].clone().body);
916
+
917
+ return list;
918
+ }
919
+ };
920
+
921
+
922
+ export class Relative extends Command {
923
+ static makeBlock (block: MusicBlock, {anchor}: {anchor?: ChordElement} = {}): Relative {
924
+ if (!anchor) {
925
+ const chord = block.findFirst(Chord) as Chord;
926
+ anchor = chord && chord.anchorPitch;
927
+ }
928
+
929
+ return new Relative({cmd: "relative", args: [anchor, block].filter(term => term)});
930
+ }
931
+
932
+
933
+ get anchor (): ChordElement {
934
+ if (this.args[0] instanceof ChordElement)
935
+ return this.args[0];
936
+
937
+ return null;
938
+ }
939
+
940
+
941
+ get music (): BaseTerm {
942
+ return this.args[this.args.length - 1];
943
+ }
944
+
945
+
946
+ get headChord (): Chord {
947
+ return this.findFirst(Chord) as Chord;
948
+ }
949
+
950
+
951
+ get tailPitch (): ChordElement {
952
+ const tail = this.findLast(Chord) as Chord;
953
+
954
+ return tail && tail.absolutePitch;
955
+ }
956
+
957
+
958
+ // with side effect
959
+ shiftBody (newAnchor?: ChordElement): BaseTerm[] {
960
+ const headChord = this.headChord;
961
+ if (newAnchor && headChord) {
962
+ headChord.shiftAnchor(newAnchor);
963
+ headChord._anchorPitch = null;
964
+ //console.log("shiftAnchor.post:", headChord.join(), headChord);
965
+ }
966
+
967
+ const music = this.music;
968
+ if (music instanceof MusicBlock) {
969
+ //music.clearPitchCache();
970
+ return music.body;
971
+ }
972
+
973
+ return [music];
974
+ }
975
+ }
976
+
977
+
978
+ export class ParallelMusic extends Command {
979
+ get varNames (): string[] {
980
+ return ((this.args[0].exp as SchemePointer).value as SchemeFunction).asList as string[];
981
+ }
982
+
983
+
984
+ get body (): MusicBlock {
985
+ return this.args[1];
986
+ }
987
+
988
+
989
+ get voices (): MusicVoice[] {
990
+ const voiceNames = this.varNames;
991
+ const chunks = this.body.musicChunks;
992
+ const measureCount = Math.ceil(chunks.length / voiceNames.length);
993
+
994
+ return voiceNames.map((name, index) => ({
995
+ name: name.toString(),
996
+ body: Array(measureCount).fill(null).map((_, m) => chunks[m * voiceNames.length + index]).filter(Boolean),
997
+ }));
998
+ }
999
+ };
1000
+
1001
+
1002
+ export class TimeSignature extends Command {
1003
+ get value (): FractionNumber {
1004
+ return FractionNumber.fromExpression(this.args[0]);
1005
+ }
1006
+ };
1007
+
1008
+
1009
+ export class Partial extends Command {
1010
+ get duration (): Duration {
1011
+ return this.args[0];
1012
+ }
1013
+ };
1014
+
1015
+
1016
+ export class Times extends Command {
1017
+ get factor (): FractionNumber {
1018
+ return FractionNumber.fromExpression(this.args[0]);
1019
+ }
1020
+
1021
+
1022
+ get music (): BaseTerm {
1023
+ return this.args[this.args.length - 1];
1024
+ }
1025
+ };
1026
+
1027
+
1028
+ export class Tuplet extends Command {
1029
+ get divider (): FractionNumber {
1030
+ return FractionNumber.fromExpression(this.args[0]);
1031
+ }
1032
+
1033
+
1034
+ get music (): BaseTerm {
1035
+ return this.args[this.args.length - 1];
1036
+ }
1037
+ };
1038
+
1039
+
1040
+ export class Grace extends Command {
1041
+ get music (): BaseTerm {
1042
+ return this.args[this.args.length - 1];
1043
+ }
1044
+ };
1045
+
1046
+
1047
+ export class AfterGrace extends Command {
1048
+ get body (): BaseTerm {
1049
+ return this.args[0];
1050
+ }
1051
+
1052
+ get grace (): BaseTerm {
1053
+ return this.args[1];
1054
+ }
1055
+
1056
+
1057
+ get measureLayout (): measureLayout.MeasureLayout {
1058
+ return measureLayout.BlockMLayout.fromSeq([
1059
+ this.body.measureLayout,
1060
+ this.grace.measureLayout,
1061
+ ]);
1062
+ }
1063
+ };
1064
+
1065
+
1066
+ export class Clef extends Command {
1067
+ get clefName (): string {
1068
+ return this.args[0].toString();
1069
+ }
1070
+ };
1071
+
1072
+
1073
+ export class KeySignature extends Command {
1074
+ get keyPitch (): ChordElement {
1075
+ return new ChordElement({pitch: this.args[0], options: {proto: "_PLAIN"}});
1076
+ }
1077
+
1078
+
1079
+ get key (): number {
1080
+ const keyPitch = this.keyPitch;
1081
+ const minor = this.args[1] === "\\minor";
1082
+ const phonetOrder = idioms.FIFTH_PHONETS.indexOf(keyPitch.phonet);
1083
+
1084
+ return phonetOrder + (minor ? -4 : -1) + keyPitch.alterValue * 7;
1085
+ }
1086
+ };
1087
+
1088
+
1089
+ export class OctaveShift extends Command {
1090
+ get value (): number {
1091
+ return this.args[0].exp;
1092
+ }
1093
+ };
1094
+
1095
+
1096
+ export class Include extends Command {
1097
+ static create (filename: string): Include {
1098
+ return new Include({cmd: "include", args: [LiteralString.fromString(filename)]});
1099
+ }
1100
+
1101
+
1102
+ get filename (): string {
1103
+ return this.args[0].toString();
1104
+ }
1105
+ };
1106
+
1107
+
1108
+ export class Version extends Command {
1109
+ static get default (): Version {
1110
+ return new Version({cmd: "version", args: [LiteralString.fromString(LILYPOND_VERSION)]});
1111
+ }
1112
+
1113
+
1114
+ get version (): string {
1115
+ return this.args[0].toString();
1116
+ }
1117
+ };
1118
+
1119
+
1120
+ export class Language extends Command {
1121
+ static make (language: string): Language {
1122
+ return new Language({cmd: "language", args: [LiteralString.fromString(language)]});
1123
+ }
1124
+
1125
+
1126
+ get language (): string {
1127
+ return this.args[0].toString();
1128
+ }
1129
+ };
1130
+
1131
+
1132
+ export class LyricMode extends Command {
1133
+ get block (): MusicBlock {
1134
+ return this.args[0];
1135
+ }
1136
+ };
1137
+
1138
+
1139
+ export class ChordMode extends Command {
1140
+ get block (): MusicBlock {
1141
+ return this.args[0];
1142
+ }
1143
+ };
1144
+
1145
+
1146
+ export class Transposition extends Command {
1147
+ get transposition (): number {
1148
+ return this.args[0].pitchValue - 60;
1149
+ }
1150
+ };
1151
+
1152
+
1153
+ export class StemDirection extends Command {
1154
+ get direction (): string {
1155
+ return this.cmd.substr(4);
1156
+ }
1157
+ };
1158
+
1159
+
1160
+ export class Change extends Command {
1161
+ get key (): string {
1162
+ return this.args[0].toString();
1163
+ }
1164
+
1165
+
1166
+ get value (): string {
1167
+ return this.args[1].toString();
1168
+ }
1169
+ };
1170
+
1171
+
1172
+ export class Block extends BaseTerm {
1173
+ block: string;
1174
+ head: (string|string[]);
1175
+ body: BaseTerm[];
1176
+
1177
+
1178
+ constructor (data) {
1179
+ super(data);
1180
+
1181
+ this.body = this.body.map(parseRawEnforce);
1182
+ }
1183
+
1184
+
1185
+ serialize () {
1186
+ const heads = Array.isArray(this.head) ? this.head : (this.head ? [this.head] : []);
1187
+
1188
+ return [
1189
+ ...heads,
1190
+ "{\n",
1191
+ ...cc(this.body.map(section => [...BaseTerm.optionalSerialize(section), "\n"])),
1192
+ "}\n",
1193
+ ];
1194
+ }
1195
+
1196
+
1197
+ get entries () {
1198
+ return this.body;
1199
+ }
1200
+
1201
+
1202
+ get isMIDIDedicated () {
1203
+ const subBlocks = this.body.filter(term => term instanceof Block) as Block[];
1204
+
1205
+ return subBlocks.some(term => term.head === "\\midi")
1206
+ && !subBlocks.some(term => term.head === "\\layout");
1207
+ }
1208
+
1209
+
1210
+ get assignmentDict (): {[key: string]: string} {
1211
+ const assignments = this.body.filter(term => term instanceof Assignment) as Assignment[];
1212
+
1213
+ return assignments.reduce((dict, assignment) => ((dict[assignment.key.toString()] = assignment.value.toString()), dict), {});
1214
+ }
1215
+ };
1216
+
1217
+
1218
+ export class InlineBlock extends Block {
1219
+ serialize () {
1220
+ return [
1221
+ "{",
1222
+ ...cc(this.body.map(BaseTerm.optionalSerialize)),
1223
+ "}",
1224
+ ];
1225
+ }
1226
+ };
1227
+
1228
+
1229
+ export class MusicBlock extends BaseTerm {
1230
+ body: BaseTerm[];
1231
+
1232
+
1233
+ static fromTerms (terms: BaseTerm[]): MusicBlock {
1234
+ const block = new MusicBlock({body: [...terms]});
1235
+ block.clarifyHead();
1236
+
1237
+ return block;
1238
+ }
1239
+
1240
+
1241
+ constructor (data) {
1242
+ super(data);
1243
+
1244
+ this.body = this.body.map(parseRawEnforce);
1245
+ }
1246
+
1247
+
1248
+ serialize () {
1249
+ return [
1250
+ "{\n",
1251
+ ...cc(this.body.map(BaseTerm.optionalSerialize)),
1252
+ "\n",
1253
+ "}\n",
1254
+ ];
1255
+ }
1256
+
1257
+
1258
+ clone (): this {
1259
+ if (this._parent) {
1260
+ const parent = this._parent.clone();
1261
+ const block = parent.findFirst(MusicBlock);
1262
+ console.assert(block && block._parent === parent, "invalid block-parent relation", parent, block);
1263
+
1264
+ return block as this;
1265
+ }
1266
+
1267
+ return BaseTerm.prototype.clone.call(this) as this;
1268
+ }
1269
+
1270
+
1271
+ get entries () {
1272
+ return this.body;
1273
+ }
1274
+
1275
+
1276
+ get isMusic (): boolean {
1277
+ return true;
1278
+ }
1279
+
1280
+
1281
+ get musicChunks (): MusicChunk[] {
1282
+ const chunks = [];
1283
+ let currentChunk = new MusicChunk(this);
1284
+
1285
+ const dumpChunk = () => {
1286
+ if (currentChunk.size)
1287
+ chunks.push(currentChunk);
1288
+
1289
+ currentChunk = new MusicChunk(this);
1290
+ };
1291
+
1292
+ for (const term of this.entries) {
1293
+ if (term instanceof Repeat) {
1294
+ dumpChunk();
1295
+ chunks.push(...term.musicChunks);
1296
+ }
1297
+ else if (term instanceof Divide)
1298
+ dumpChunk();
1299
+ else
1300
+ currentChunk.push(term);
1301
+ }
1302
+
1303
+ dumpChunk();
1304
+
1305
+ return chunks;
1306
+ }
1307
+
1308
+
1309
+ // [deprecated]
1310
+ // for parallelMusic only
1311
+ get voiceNames () {
1312
+ const header = this._parent as Command;
1313
+ if (header && header.cmd === "parallelMusic") {
1314
+ if (header.args[0] instanceof Scheme && header.args[0].exp instanceof SchemePointer && header.args[0].exp.value instanceof SchemeFunction) {
1315
+ const voices = header.args[0].exp.value.asList;
1316
+ return voices;
1317
+ }
1318
+ }
1319
+
1320
+ return null;
1321
+ }
1322
+
1323
+
1324
+ // [deprecated]
1325
+ get voices (): MusicVoice[] {
1326
+ const voiceNames = this.voiceNames;
1327
+ if (!voiceNames)
1328
+ return [{body: this.musicChunks}];
1329
+
1330
+ const chunks = this.musicChunks;
1331
+ const measureCount = Math.ceil(chunks.length / voiceNames.length);
1332
+
1333
+ return voiceNames.map((name, index) => ({
1334
+ name: name.toString(),
1335
+ body: Array(measureCount).fill(null).map((_, m) => chunks[m * voiceNames.length + index]).filter(chunk => chunk),
1336
+ }));
1337
+ }
1338
+
1339
+
1340
+ get durationMagnitude (): number {
1341
+ return this.body.reduce((magnitude, term) => magnitude + term.durationMagnitude, 0);
1342
+ }
1343
+
1344
+
1345
+ get isRelative (): boolean {
1346
+ return this._parent instanceof Relative;
1347
+ }
1348
+
1349
+
1350
+ get anchorPitch (): ChordElement {
1351
+ if (this.isRelative)
1352
+ return (this._parent as Relative).anchor;
1353
+
1354
+ return null;
1355
+ }
1356
+
1357
+
1358
+ get measures (): number[] {
1359
+ // make a continouse indices list
1360
+ const subterms = this.findAll(term => term.isMusic);
1361
+ const subIndices = [].concat(...subterms.map(term => term.measures)).filter(index => Number.isInteger(index));
1362
+ if (!subIndices.length)
1363
+ return [];
1364
+
1365
+ const min = Math.min(...subIndices);
1366
+ const max = Math.max(...subIndices);
1367
+
1368
+ return Array(max + 1 - min).fill(null).map((_, i) => i + min);
1369
+ }
1370
+
1371
+
1372
+ get notes (): Chord[] {
1373
+ const notes = this.body.filter(term => term instanceof Chord && !term.isRest) as Chord[];
1374
+ this.forEachTopTerm(MusicBlock, block => notes.push(...block.notes));
1375
+
1376
+ return notes;
1377
+ }
1378
+
1379
+
1380
+ get sonicNotes (): Chord[] {
1381
+ return this.notes.filter(note => !note.completeTied);
1382
+ }
1383
+
1384
+
1385
+ get noteTicks (): number[] {
1386
+ const ticks = this.sonicNotes.map(note => note._tick);
1387
+ return Array.from(new Set(ticks)).sort((t1, t2) => t1 - t2);
1388
+ }
1389
+
1390
+
1391
+ get measureTicks (): [number, number][] {
1392
+ const tickTable: {[key: string]: number} = {};
1393
+
1394
+ this.body.forEach(term => {
1395
+ if (Number.isFinite(term._measure) && Number.isFinite(term._tick)) {
1396
+ if (!Number.isFinite(tickTable[term._measure]))
1397
+ tickTable[term._measure] = term._tick;
1398
+ }
1399
+ });
1400
+
1401
+ return Object.entries(tickTable).map(([measure, tick]) => [Number(measure), tick]);
1402
+ }
1403
+
1404
+
1405
+ get measureLayout (): measureLayout.MeasureLayout {
1406
+ const seq = this.body.filter(term => term.isMusic).map(term => term.measureLayout).filter(Boolean);
1407
+
1408
+ if (this._functional === "lotusRepeatABA") {
1409
+ const [main, ...rest] = seq;
1410
+
1411
+ const layout = new measureLayout.ABAMLayout();
1412
+ layout.main = main;
1413
+ layout.rest = measureLayout.BlockMLayout.trimSeq(rest);
1414
+
1415
+ return layout;
1416
+ }
1417
+
1418
+ return measureLayout.BlockMLayout.fromSeq(seq);
1419
+ }
1420
+
1421
+
1422
+ get measureChunkMap (): MusicChunkMap {
1423
+ const map = new Map<number, MusicChunk>();
1424
+ this.body.forEach(term => {
1425
+ if (Number.isInteger(term._measure) && !(term instanceof Divide)) {
1426
+ if (!map.get(term._measure))
1427
+ map.set(term._measure, new MusicChunk(this));
1428
+
1429
+ const chunk = map.get(term._measure);
1430
+ chunk.terms.push(term);
1431
+ }
1432
+ });
1433
+
1434
+ return map;
1435
+ }
1436
+
1437
+
1438
+ clearPitchCache () {
1439
+ this.forEachTerm(ChordElement, pitch => {
1440
+ pitch._absolutePitch = null;
1441
+ //pitch._previous = null;
1442
+ });
1443
+ }
1444
+
1445
+
1446
+ updateChordAnchors () {
1447
+ const chord = this.findFirst(Chord) as Chord;
1448
+ if (chord)
1449
+ chord._anchorPitch = chord._anchorPitch || this.anchorPitch;
1450
+
1451
+ this.clearPitchCache();
1452
+ }
1453
+
1454
+
1455
+ // deprecated
1456
+ updateChordChains () {
1457
+ let previous: MusicEvent = null;
1458
+
1459
+ this.updateChordAnchors();
1460
+
1461
+ this.forEachTerm(MusicBlock, block => block.updateChordAnchors());
1462
+
1463
+ this.forEachTerm(MusicEvent, event => {
1464
+ event._previous = previous;
1465
+
1466
+ previous = event;
1467
+ });
1468
+ }
1469
+
1470
+
1471
+ // with side effect
1472
+ spreadRepeatBlocks ({ignoreRepeat = true, keepTailPass = false} = {}): this {
1473
+ this.forEachTerm(MusicBlock, block => block.spreadRepeatBlocks());
1474
+
1475
+ this.body = cc(this.body.map(term => {
1476
+ if (term instanceof Repeat) {
1477
+ if (!ignoreRepeat)
1478
+ return term.getUnfoldTerms();
1479
+ else if (keepTailPass)
1480
+ return term.getTailPassTerms();
1481
+ else
1482
+ return term.getPlainTerms();
1483
+ }
1484
+ else
1485
+ return [term];
1486
+ }));
1487
+
1488
+ return this;
1489
+ }
1490
+
1491
+
1492
+ /*// with side effect
1493
+ spreadRelativeBlocks (): this {
1494
+ this.forEachTerm(MusicBlock, block => block.spreadRelativeBlocks());
1495
+
1496
+ let anchorPitch = null;
1497
+
1498
+ this.body = cc(this.body.map(term => {
1499
+ if (term instanceof Relative) {
1500
+ const list = term.shiftBody(anchorPitch);
1501
+
1502
+ anchorPitch = term.tailPitch || anchorPitch;
1503
+
1504
+ return list;
1505
+ }
1506
+ else
1507
+ return [term];
1508
+ }));
1509
+
1510
+ return this;
1511
+ }*/
1512
+
1513
+
1514
+ // with side effect
1515
+ unfoldDurationMultipliers (): this {
1516
+ let timeDenominator = 4;
1517
+
1518
+ const unfoldMultipliers = (term): BaseTerm[] => {
1519
+ if (term instanceof TimeSignature)
1520
+ timeDenominator = term.value.denominator;
1521
+
1522
+ if (!(term instanceof MusicEvent) || !term.duration || !term.duration.multipliers || !term.duration.multipliers.length)
1523
+ return [term];
1524
+
1525
+ const factor = term.duration.multipliers.reduce((factor, multiplier) => factor * Number(multiplier), 1);
1526
+ if (!Number.isInteger(factor) || factor <= 0)
1527
+ return [term];
1528
+
1529
+ const denominator = Math.max(term.duration.denominator, timeDenominator);
1530
+
1531
+ const event = term.clone() as MusicEvent;
1532
+ event.duration.multipliers = [];
1533
+
1534
+ // break duration into multiple rest events
1535
+ const restCount = (event.duration.magnitude / WHOLE_DURATION_MAGNITUDE) * (factor - 1) * denominator;
1536
+ if (!Number.isInteger(restCount))
1537
+ console.warn("Rest count is not integear:", restCount, denominator, event.duration.magnitude, factor);
1538
+
1539
+ const rests = Array(Math.floor(restCount)).fill(null).map(() =>
1540
+ new Rest({name: "s", duration: new Duration({number: denominator, dots: 0})}));
1541
+
1542
+ return [event, ...rests];
1543
+ };
1544
+
1545
+ this.body = cc(this.body.map(unfoldMultipliers));
1546
+
1547
+ return this;
1548
+ }
1549
+
1550
+
1551
+ /*// pure
1552
+ flatten ({spreadRepeats = false} = {}): Relative {
1553
+ this.updateChordChains();
1554
+
1555
+ const chord = this.findFirst(Chord) as Chord;
1556
+ const anchor = this.anchorPitch || (chord && chord.anchorPitch);
1557
+
1558
+ const block = this.clone();
1559
+ if (spreadRepeats)
1560
+ block.spreadRepeatBlocks();
1561
+ block.spreadRelativeBlocks();
1562
+ block.unfoldDurationMultipliers();
1563
+
1564
+ return Relative.makeBlock(block, {anchor: anchor && anchor.clone()});
1565
+ }*/
1566
+
1567
+
1568
+ // with side effect
1569
+ expandVariables (dict: BaseTerm): this {
1570
+ this.body = this.body.map(term => {
1571
+ if (term instanceof Variable) {
1572
+ const value = term.queryValue(dict);
1573
+ const clonedValue = value instanceof BaseTerm ? value.clone() : value;
1574
+
1575
+ if (clonedValue instanceof BaseTerm) {
1576
+ clonedValue.forEachTerm(MusicBlock, block => block.expandVariables(dict));
1577
+
1578
+ if (clonedValue instanceof MusicBlock)
1579
+ clonedValue.expandVariables(dict);
1580
+ }
1581
+
1582
+ return clonedValue;
1583
+ }
1584
+
1585
+ return term;
1586
+ });
1587
+
1588
+ return this;
1589
+ }
1590
+
1591
+
1592
+ // with side effects
1593
+ redivide ({recursive = true, measureHeads = null}: {recursive?: boolean, measureHeads?: number[]} = {}) {
1594
+ if (recursive) {
1595
+ this.forEachTerm(MusicBlock, block => {
1596
+ if (!block._parent || block._parent.cmd !== "alternative")
1597
+ block.redivide({recursive, measureHeads});
1598
+ });
1599
+ }
1600
+
1601
+ // split rests
1602
+ if (measureHeads) {
1603
+ this.body = [].concat(...this.body.map(term => {
1604
+ if (!(term instanceof Rest) || term.name !== "s" || !Number.isInteger(term._measure))
1605
+ return [term];
1606
+
1607
+ const nextHead = measureHeads[term._measure];
1608
+ const endTick = term._tick + term.durationMagnitude;
1609
+ if (nextHead > 0 && endTick > nextHead) {
1610
+ const post_events = term.post_events;
1611
+
1612
+ let startTick = term._tick;
1613
+ const rests = [];
1614
+ let nextMeasure;
1615
+ for (nextMeasure = term._measure; nextMeasure < measureHeads.length && endTick > measureHeads[nextMeasure]; ++nextMeasure) {
1616
+ const duration = Duration.fromMagnitude(measureHeads[nextMeasure] - startTick);
1617
+ if (!duration) {
1618
+ console.warn("invalid middle rest duration, splitting gave up:", measureHeads[nextMeasure] - startTick, term);
1619
+ return [term];
1620
+ }
1621
+
1622
+ const rest = new Rest({name: "s", duration, post_events: []});
1623
+ rest._measure = nextMeasure;
1624
+ rest._lastMeasure = nextMeasure;
1625
+ rests.push(rest);
1626
+
1627
+ console.assert(!!rest.duration, "middle splitted rest duration invalid:", measureHeads[nextMeasure] - startTick);
1628
+
1629
+ startTick = measureHeads[nextMeasure];
1630
+ }
1631
+
1632
+ const duration = Duration.fromMagnitude(endTick - startTick);
1633
+ if (!duration) {
1634
+ console.warn("invalid tail rest duration, splitting gave up:", endTick - startTick, term);
1635
+ return [term];
1636
+ }
1637
+
1638
+ const rest = new Rest({name: "s", duration, post_events: post_events && [...post_events]});
1639
+ rest._measure = nextMeasure;
1640
+ rest._lastMeasure = nextMeasure;
1641
+ rests.push(rest);
1642
+
1643
+ console.assert(rests.reduce((sum, rest) => sum + rest.durationMagnitude, 0) === term.durationMagnitude, "duration splitting error:", rests, term);
1644
+ //if (rests.reduce((sum, rest) => sum + rest.durationMagnitude, 0) !== term.durationMagnitude)
1645
+ // debugger;
1646
+
1647
+ return rests;
1648
+ }
1649
+
1650
+ return [term];
1651
+ }));
1652
+ }
1653
+
1654
+ const isPostTerm = term => !term
1655
+ || term instanceof PostEvent
1656
+ || (term as Primitive).exp === "~"
1657
+ || ["bar", "arpeggio", "glissando", "sustainOff", "sustainOn"].includes((term as Command).cmd)
1658
+ ;
1659
+
1660
+ const list = this.body.filter(term => !(term instanceof Divide));
1661
+ let measure = null;
1662
+ for (const term of list) {
1663
+ if (Number.isInteger(measure) && isPostTerm(term))
1664
+ term._measure = measure;
1665
+ else
1666
+ measure = term._measure;
1667
+ }
1668
+
1669
+ const body: BaseTerm[] = [];
1670
+ const measures = new Set();
1671
+
1672
+ list.reverse().forEach(term => {
1673
+ if (term instanceof BaseTerm) {
1674
+ const newMeasures = term.measures.filter(m => !measures.has(m));
1675
+ if (newMeasures.length) {
1676
+ const comment = " " + newMeasures[0] + (newMeasures.length > 1 ? "-" + Math.max(...newMeasures) : "");
1677
+
1678
+ if (body.length)
1679
+ body.push(new Divide({_tailComment: Comment.createSingle(comment)}));
1680
+
1681
+ newMeasures.forEach(m => measures.add(m));
1682
+ }
1683
+ }
1684
+
1685
+ body.push(term);
1686
+ });
1687
+
1688
+ this.body = body.reverse();
1689
+ }
1690
+
1691
+
1692
+ clarifyHead () {
1693
+ const terms = this.body;
1694
+
1695
+ const head = terms.find(term => term.isMusic);
1696
+ if (head instanceof MusicEvent) {
1697
+ // clarify the first music event content
1698
+ const firstEventIndex = terms.indexOf(head);
1699
+ if (firstEventIndex >= 0) {
1700
+ const firstEvent = terms[firstEventIndex] as MusicEvent;
1701
+ //console.log("firstEvent:", firstEvent);
1702
+ if (firstEvent._previous) {
1703
+ const clarified = firstEvent.clarified;
1704
+
1705
+ terms.splice(firstEventIndex, 1, clarified);
1706
+ //console.log("terms:", firstEventIndex, terms, clarified);
1707
+ }
1708
+ }
1709
+ }
1710
+ else if (head) {
1711
+ const block = head.findFirst(MusicBlock) as MusicBlock;
1712
+ if (block)
1713
+ block.clarifyHead();
1714
+ else
1715
+ console.warn("[MusicBlock.clarifyHead] unexpected music head:", head);
1716
+ }
1717
+ }
1718
+
1719
+
1720
+ absoluteToRelative (): Relative {
1721
+ const anchor = this.findFirst(Chord) as Chord;
1722
+ if (!anchor)
1723
+ return null;
1724
+
1725
+ const anchorPitch = anchor.absolutePitch;
1726
+ let pitch = anchorPitch;
1727
+
1728
+ const newBody = this.clone();
1729
+ newBody.forEachTerm(Chord, chord => {
1730
+ const newPitch = chord.absolutePitch;
1731
+ chord.makeRelativeTo(pitch);
1732
+
1733
+ pitch = newPitch;
1734
+ });
1735
+
1736
+ return Relative.makeBlock(newBody, {anchor: anchorPitch});
1737
+ }
1738
+ };
1739
+
1740
+
1741
+ export class SimultaneousList extends BaseTerm {
1742
+ list: BaseTerm[];
1743
+
1744
+
1745
+ serialize () {
1746
+ return [
1747
+ "<<\n",
1748
+ ...cc(this.list.map(item => [...BaseTerm.optionalSerialize(item), "\n"])),
1749
+ ">>\n",
1750
+ ];
1751
+ }
1752
+
1753
+
1754
+ removeStaffGroup () {
1755
+ for (let i = 0; i < this.list.length; ++i) {
1756
+ const item: any = this.list[i];
1757
+ if (item.head instanceof Command && item.head.args && item.head.args[0] === "StaffGroup")
1758
+ this.list[i] = item.body;
1759
+ }
1760
+
1761
+ this.list.forEach(item => {
1762
+ if (item instanceof SimultaneousList)
1763
+ item.removeStaffGroup();
1764
+ });
1765
+ }
1766
+
1767
+
1768
+ get isMusic (): boolean {
1769
+ return true;
1770
+ }
1771
+
1772
+
1773
+ get entries () {
1774
+ return this.list;
1775
+ }
1776
+
1777
+
1778
+ get durationMagnitude (): number {
1779
+ return Math.max(...this.list.filter(term => term instanceof BaseTerm).map(term => term.durationMagnitude));
1780
+ }
1781
+
1782
+
1783
+ get measureLayout (): measureLayout.MeasureLayout {
1784
+ const track = this.list.find(term => term instanceof BaseTerm && term.measureLayout);
1785
+ return track && track.measureLayout;
1786
+ }
1787
+ };
1788
+
1789
+
1790
+ export class ContextedMusic extends BaseTerm {
1791
+ head: Command;
1792
+ body: BaseTerm;
1793
+ lyrics?: BaseTerm;
1794
+
1795
+
1796
+ serialize () {
1797
+ return [
1798
+ ...BaseTerm.optionalSerialize(this.head),
1799
+ ...BaseTerm.optionalSerialize(this.body),
1800
+ ...BaseTerm.optionalSerialize(this.lyrics),
1801
+ ];
1802
+ }
1803
+
1804
+
1805
+ get isMusic (): boolean {
1806
+ return true;
1807
+ }
1808
+
1809
+
1810
+ get entries () {
1811
+ return [this.head, this.body];
1812
+ }
1813
+
1814
+
1815
+ get type (): string {
1816
+ return this.head.args[0];
1817
+ }
1818
+
1819
+
1820
+ get durationMagnitude (): number {
1821
+ return this.body.durationMagnitude;
1822
+ }
1823
+
1824
+
1825
+ get withClause (): Command {
1826
+ if (this.head.args[2] && this.head.args[2] instanceof Command && this.head.args[2].cmd === "with")
1827
+ return this.head.args[2];
1828
+ }
1829
+
1830
+
1831
+ get contextDict (): {[key: string]: string} {
1832
+ const withEntries = this.withClause ? Object.entries((this.withClause.args[0] as Block).assignmentDict) : [];
1833
+ const entries = withEntries.map(([key, value]) => [`${this.type}.${key}`, value]);
1834
+
1835
+ const pair = this.head.getAssignmentPair();
1836
+ if (pair)
1837
+ entries.push([pair.key.toString(), pair.value.toString()]);
1838
+
1839
+ return entries.reduce((dict, [key, value]) => ((dict[key] = value), dict), {});
1840
+ }
1841
+
1842
+
1843
+ get list (): BaseTerm[] {
1844
+ if (this.body instanceof SimultaneousList)
1845
+ return this.body.list;
1846
+
1847
+ return null;
1848
+ }
1849
+
1850
+
1851
+ set list (value: BaseTerm[]) {
1852
+ if (this.body instanceof SimultaneousList)
1853
+ this.body.list = value;
1854
+ }
1855
+
1856
+
1857
+ get measureLayout (): measureLayout.MeasureLayout {
1858
+ return this.body.measureLayout;
1859
+ }
1860
+ };
1861
+
1862
+
1863
+ export class Divide extends BaseTerm {
1864
+ serialize () {
1865
+ return ["|", "\n"];
1866
+ }
1867
+ }
1868
+
1869
+
1870
+ export class Scheme extends BaseTerm {
1871
+ exp: (boolean|BaseTerm);
1872
+
1873
+
1874
+ serialize () {
1875
+ if (BaseTerm.isTerm(this.exp))
1876
+ return ["#", "\b", ...(this.exp as BaseTerm).serialize()];
1877
+ else if (typeof this.exp === "boolean")
1878
+ return ["#", "\b", this.exp ? "#t" : "#f"];
1879
+ // TODO: enhance grammar to parse empty scheme list
1880
+ //else if (this.exp === null)
1881
+ // return ["#", "\b", "'()"];
1882
+ else
1883
+ return ["#", "\b", this.exp];
1884
+ }
1885
+
1886
+
1887
+ query (key: string): any {
1888
+ if (this.exp instanceof SchemeFunction)
1889
+ return this.exp.query(key);
1890
+ }
1891
+
1892
+
1893
+ get entries () {
1894
+ if (this.exp instanceof BaseTerm)
1895
+ return [this.exp];
1896
+
1897
+ return [];
1898
+ }
1899
+ };
1900
+
1901
+
1902
+ export class SchemeFunction extends BaseTerm {
1903
+ func: (string | BaseTerm);
1904
+ args: (boolean | string | BaseTerm)[];
1905
+
1906
+
1907
+ serialize () {
1908
+ return [
1909
+ "(", "\b",
1910
+ ...BaseTerm.optionalSerialize(this.func),
1911
+ ...cc(this.args.map(BaseTerm.serializeScheme)),
1912
+ "\b", ")",
1913
+ ];
1914
+ }
1915
+
1916
+
1917
+ query (key: string): any {
1918
+ if (key === this.func) {
1919
+ const term = this;
1920
+
1921
+ return {
1922
+ get value () {
1923
+ return term.args.length === 1 ? term.args[0] : term.args;
1924
+ },
1925
+
1926
+ set value (value) {
1927
+ if (term.args.length === 1)
1928
+ term.args[0] = value as string|BaseTerm;
1929
+ else
1930
+ term.args = value as (string|BaseTerm)[];
1931
+ },
1932
+ };
1933
+ }
1934
+ }
1935
+
1936
+
1937
+ get asList (): (boolean | string | BaseTerm)[] {
1938
+ return [this.func, ...this.args];
1939
+ }
1940
+
1941
+
1942
+ get entries () {
1943
+ return this.asList.filter(term => term instanceof BaseTerm) as BaseTerm[];
1944
+ }
1945
+ };
1946
+
1947
+
1948
+ export class SchemePair extends BaseTerm {
1949
+ left: any;
1950
+ right: any;
1951
+
1952
+
1953
+ serialize () {
1954
+ return [
1955
+ "(", "\b",
1956
+ ...BaseTerm.optionalSerialize(this.left), ".", ...BaseTerm.optionalSerialize(this.right),
1957
+ "\b", ")",
1958
+ ];
1959
+ }
1960
+ };
1961
+
1962
+
1963
+ export class SchemePointer extends BaseTerm {
1964
+ value: any;
1965
+
1966
+
1967
+ serialize () {
1968
+ const content = this.value === null ? ["()"] : BaseTerm.optionalSerialize(this.value);
1969
+
1970
+ return [
1971
+ "'", "\b", ...content,
1972
+ ];
1973
+ }
1974
+
1975
+
1976
+ get entries () {
1977
+ if (this.value instanceof BaseTerm)
1978
+ return [this.value];
1979
+
1980
+ return [];
1981
+ }
1982
+ };
1983
+
1984
+
1985
+ export class SchemeEmbed extends BaseTerm {
1986
+ value: Root;
1987
+
1988
+
1989
+ serialize () {
1990
+ return [
1991
+ "#{",
1992
+ ...BaseTerm.optionalSerialize(this.value),
1993
+ "#}",
1994
+ ];
1995
+ }
1996
+ };
1997
+
1998
+
1999
+ export class Assignment extends BaseTerm {
2000
+ key: (string|any[]);
2001
+ value: any;
2002
+
2003
+
2004
+ constructor (data) {
2005
+ super(data);
2006
+
2007
+ if (this.value instanceof BaseTerm)
2008
+ this.value._parent = this;
2009
+ }
2010
+
2011
+
2012
+ serialize () {
2013
+ const keys = (Array.isArray(this.key) ? this.key : [this.key]).map(BaseTerm.optionalSerialize);
2014
+ const values = (Array.isArray(this.value) ? this.value : [this.value]).map(BaseTerm.optionalSerialize);
2015
+
2016
+ return [
2017
+ ...cc(keys),
2018
+ "=",
2019
+ ...cc(values),
2020
+ ];
2021
+ }
2022
+
2023
+
2024
+ get entries () {
2025
+ if (this.value instanceof BaseTerm)
2026
+ return [this.value];
2027
+
2028
+ return null;
2029
+ }
2030
+
2031
+
2032
+ query (key) {
2033
+ if (this.key === key) {
2034
+ const term = this;
2035
+
2036
+ return {
2037
+ get value () {
2038
+ return term.value;
2039
+ },
2040
+
2041
+ set value (value) {
2042
+ term.value = value;
2043
+ },
2044
+ };
2045
+ }
2046
+ }
2047
+ };
2048
+
2049
+
2050
+ export class MusicEvent extends BaseTerm {
2051
+ duration?: Duration;
2052
+ post_events?: (string | PostEvent)[];
2053
+
2054
+ declare _previous?: MusicEvent;
2055
+ //_anchorPitch?: ChordElement;
2056
+ _lastMeasure?: number;
2057
+
2058
+
2059
+ constructor (data: object) {
2060
+ super(data);
2061
+
2062
+ if (this.post_events)
2063
+ this.post_events = this.post_events.map(parseRaw);
2064
+ }
2065
+
2066
+
2067
+ getPreviousT (T) {
2068
+ if (this._previous instanceof T)
2069
+ return this._previous;
2070
+
2071
+ if (this._previous)
2072
+ return this._previous.getPreviousT(T);
2073
+ }
2074
+
2075
+
2076
+ get durationValue (): Duration {
2077
+ return this.duration || (this._previous ? this._previous.durationValue : Duration.default);
2078
+ }
2079
+
2080
+
2081
+ get durationMagnitude (): number {
2082
+ return this.durationValue.magnitude;
2083
+ }
2084
+
2085
+
2086
+ get division (): number {
2087
+ return this.durationValue.division;
2088
+ }
2089
+
2090
+
2091
+ get withMultiplier () {
2092
+ return this.duration && this.duration.withMultiplier;
2093
+ }
2094
+
2095
+
2096
+ get isMusic (): boolean {
2097
+ return true;
2098
+ }
2099
+
2100
+
2101
+ get isTying (): boolean {
2102
+ return this.post_events && this.post_events.some(event => event instanceof PostEvent && event.isTying);
2103
+ }
2104
+
2105
+
2106
+ get isStaccato (): boolean {
2107
+ return this.post_events && this.post_events.some(event => event instanceof PostEvent && event.isStaccato);
2108
+ }
2109
+
2110
+
2111
+ // to be implement in derived classes
2112
+ get isRest (): boolean {
2113
+ return null;
2114
+ }
2115
+
2116
+
2117
+ get beamOn (): boolean {
2118
+ return this.post_events && this.post_events.includes("[");
2119
+ }
2120
+
2121
+
2122
+ get beamOff (): boolean {
2123
+ return this.post_events && this.post_events.includes("]");
2124
+ }
2125
+
2126
+
2127
+ get measures (): number[] {
2128
+ if (!Number.isFinite(this._measure) || !Number.isFinite(this._lastMeasure))
2129
+ return [];
2130
+
2131
+ return Array(this._lastMeasure + 1 - this._measure).fill(null).map((_, i) => this._measure + i);
2132
+ }
2133
+
2134
+
2135
+ get measureLayout (): measureLayout.MeasureLayout {
2136
+ if (this.measures.length > 1)
2137
+ return measureLayout.BlockMLayout.fromSeq(this.measures.map(measure => measureLayout.SingleMLayout.from(measure)));
2138
+
2139
+ if (this.measures.length === 1)
2140
+ return measureLayout.SingleMLayout.from(this._measure);
2141
+
2142
+ return null;
2143
+ }
2144
+
2145
+
2146
+ get implicitType (): ImplicitType {
2147
+ if (this.post_events) {
2148
+ for (const event of this.post_events) {
2149
+ if (event instanceof PostEvent && event.arg instanceof Command) {
2150
+ switch (event.arg.cmd) {
2151
+ case "startTrillSpan":
2152
+ case "trill":
2153
+ return ImplicitType.Trill;
2154
+
2155
+ case "turn":
2156
+ return ImplicitType.Turn;
2157
+
2158
+ case "mordent":
2159
+ return ImplicitType.Mordent;
2160
+
2161
+ case "prall":
2162
+ return ImplicitType.Prall;
2163
+
2164
+ // Arpeggio is not implemented in 'articulate.ly' yet
2165
+ case "arpeggio":
2166
+ return ImplicitType.Arpeggio;
2167
+ }
2168
+ }
2169
+ }
2170
+ }
2171
+
2172
+ return ImplicitType.None;
2173
+ }
2174
+
2175
+
2176
+ get clarified (): MusicEvent {
2177
+ const clarified = this instanceof Chord ? this.clarifiedChord : this.clone();
2178
+ clarified.duration = this.durationValue && this.durationValue.clone();
2179
+
2180
+ return clarified;
2181
+ }
2182
+ };
2183
+
2184
+
2185
+ export class Chord extends MusicEvent {
2186
+ pitches: (ChordElement | Command)[];
2187
+ options: {
2188
+ exclamations?: string[],
2189
+ questions?: string[],
2190
+ rest?: string,
2191
+ withAngle?: boolean,
2192
+ };
2193
+
2194
+
2195
+ constructor (data) {
2196
+ super(data);
2197
+
2198
+ this.connectPitches();
2199
+ }
2200
+
2201
+
2202
+ connectPitches () {
2203
+ if (this.basePitch)
2204
+ this.basePitch._parent = this;
2205
+ for (let i = 1; i < this.pitchElements.length; ++i)
2206
+ this.pitchElements[i]._previous = this.pitchElements[i - 1];
2207
+ }
2208
+
2209
+
2210
+ get single (): boolean {
2211
+ return this.pitches.length === 1;
2212
+ }
2213
+
2214
+
2215
+ get entries () {
2216
+ const list: any[] = [...this.pitches];
2217
+ if (Array.isArray(this.post_events))
2218
+ list.push(...this.post_events);
2219
+
2220
+ return list;
2221
+ }
2222
+
2223
+
2224
+ serialize () {
2225
+ const innerPitches = this.pitches.map(BaseTerm.optionalSerialize);
2226
+ const pitches = (this.single && !this.options.withAngle) ? cc(innerPitches) : [
2227
+ "<", "\b", ...cc(innerPitches), "\b", ">",
2228
+ ];
2229
+
2230
+ const {exclamations, questions, rest} = this.options;
2231
+ const postfix = cc([...(exclamations || []), ...(questions || []), ...BaseTerm.optionalSerialize(this.duration), rest]
2232
+ .filter(item => item)
2233
+ .map(item => ["\b", item]),
2234
+ ).concat(...(this.post_events || []).map(BaseTerm.optionalSerialize));
2235
+
2236
+ return [
2237
+ new OpenLocator(this),
2238
+ ...pitches,
2239
+ ...postfix,
2240
+ new CloseLocator(this),
2241
+ ];
2242
+ }
2243
+
2244
+
2245
+ get pitchElements (): ChordElement[] {
2246
+ return this.pitches.filter(pitch => pitch instanceof ChordElement) as ChordElement[];
2247
+ }
2248
+
2249
+
2250
+ get pitchNames (): string[] {
2251
+ return this.pitchElements.map((elem: ChordElement) => elem.pitch.replace(/'|,/g, ""));
2252
+ }
2253
+
2254
+
2255
+ get basePitch (): ChordElement {
2256
+ return this.pitchElements[0];
2257
+ }
2258
+
2259
+
2260
+ get absolutePitch (): ChordElement {
2261
+ console.assert(!!this.basePitch, "absolutePitch on non pitch:", this.join());
2262
+ return this.basePitch.absolutePitch;
2263
+ }
2264
+
2265
+
2266
+ get anchorPitch (): ChordElement {
2267
+ if (this._anchorPitch)
2268
+ return this._anchorPitch;
2269
+
2270
+ const previous = this.getPreviousT(Chord);
2271
+ if (previous)
2272
+ return previous.absolutePitch;
2273
+
2274
+ return this.basePitch;
2275
+ }
2276
+
2277
+
2278
+ get isRest (): boolean {
2279
+ return !!this.options.rest;
2280
+ }
2281
+
2282
+
2283
+ get completeTied (): boolean {
2284
+ return this.pitchElements.filter(pitch => !pitch._tied).length === 0;
2285
+ }
2286
+
2287
+
2288
+ get pitchesValue (): (ChordElement | Command)[] {
2289
+ if (this._previous instanceof Chord && this.basePitch.pitch === "q") {
2290
+ const pitches = this._previous.pitchesValue.map(pitch => {
2291
+ const newPitch = pitch.clone();
2292
+ if (newPitch instanceof ChordElement) {
2293
+ newPitch._location = this.basePitch._location;
2294
+ newPitch._tied = this.basePitch._tied;
2295
+ newPitch._parent = (pitch as ChordElement)._parent && this;
2296
+ newPitch._previous = (pitch as ChordElement)._previous;
2297
+ }
2298
+
2299
+ return newPitch;
2300
+ });
2301
+ const base = pitches.find(pitch => pitch instanceof ChordElement) as ChordElement;
2302
+ if (base)
2303
+ base.pitch = base.pitch.replace(/[,']/g, "");
2304
+
2305
+ return pitches;
2306
+ }
2307
+
2308
+ return this.pitches;
2309
+ }
2310
+
2311
+
2312
+ get clarifiedChord (): MusicEvent {
2313
+ const clarified = this.clone();
2314
+ clarified.pitches = this.pitchesValue.filter(pitch => !(pitch as ChordElement)._tied).map(pitch => pitch.clone());
2315
+ clarified.connectPitches();
2316
+
2317
+ // replace by rest if all pitches tied
2318
+ if (!clarified.pitches.length)
2319
+ return new Rest({name: "r", duration: this.duration});
2320
+
2321
+ return clarified;
2322
+ }
2323
+
2324
+
2325
+ shiftAnchor (newAnchor: ChordElement) {
2326
+ //console.warn("shiftAnchor:", this.join(), newAnchor.join(), this.absolutePitch.pitchValue, newAnchor.pitchValue, this.anchorPitch.pitchValue);
2327
+ const _location = this.basePitch._location;
2328
+ const shift = idioms.phonetDifferToShift(this.basePitch.phonetStep - newAnchor.phonetStep);
2329
+ const relativeOctave = this.basePitch.absoluteOctave(this.anchorPitch) - newAnchor.octave - shift;
2330
+ //console.log("_location:", _location);
2331
+
2332
+ this.pitches[0] = ChordElement.from({
2333
+ phonet: this.basePitch.phonet,
2334
+ alters: this.basePitch.alters,
2335
+ octave: relativeOctave,
2336
+ });
2337
+
2338
+ this.pitches[0]._location = _location;
2339
+ this.pitches[0]._parent = this;
2340
+
2341
+ this.connectPitches();
2342
+
2343
+ //console.log("shiftAnchor.1:", this.join(), this.absolutePitch.pitchValue, {relativeOctave, shift, "newAnchor.octave": newAnchor.octave});
2344
+ }
2345
+
2346
+
2347
+ makeRelativeTo (from: ChordElement) {
2348
+ const _location = this.basePitch._location;
2349
+
2350
+ const octave = this.basePitch.relativeOctave(from);
2351
+ this.pitches[0] = ChordElement.from({
2352
+ phonet: this.basePitch.phonet,
2353
+ alters: this.basePitch.alters,
2354
+ octave,
2355
+ });
2356
+
2357
+ this.pitches[0]._location = _location;
2358
+ this.pitches[0]._parent = this;
2359
+ }
2360
+ };
2361
+
2362
+
2363
+ export class Rest extends MusicEvent {
2364
+ name: string;
2365
+
2366
+
2367
+ serialize () {
2368
+ return [
2369
+ new OpenLocator(this),
2370
+ ...compact([
2371
+ this.name,
2372
+ ...BaseTerm.optionalSerialize(this.duration),
2373
+ ]),
2374
+ ...cc((this.post_events || []).map(BaseTerm.optionalSerialize)),
2375
+ new CloseLocator(this),
2376
+ ];
2377
+ }
2378
+
2379
+
2380
+ get isSpacer () {
2381
+ return this.name === "s";
2382
+ }
2383
+
2384
+
2385
+ get isRest (): boolean {
2386
+ return true;
2387
+ }
2388
+ };
2389
+
2390
+
2391
+ export class ChordElement extends BaseTerm {
2392
+ pitch: string;
2393
+ options: {
2394
+ exclamations?: string[],
2395
+ questions?: string[],
2396
+ post_events?: PostEvent[],
2397
+ };
2398
+
2399
+ declare _parent?: Chord;
2400
+ declare _previous?: ChordElement;
2401
+ _tied?: MusicEvent;
2402
+ _transposition?: number;
2403
+
2404
+ // cache for property of absolutePitch
2405
+ _absolutePitch?: ChordElement;
2406
+
2407
+
2408
+ static from ({phonet, alters = "", octave, options = {}}): ChordElement {
2409
+ const octaveString = octave ? Array(Math.abs(octave)).fill(octave > 0 ? "'" : ",").join("") : "";
2410
+ const pitch = phonet + (alters || "") + octaveString;
2411
+
2412
+ return new ChordElement({pitch, options: {...options, proto: "_PLAIN"}});
2413
+ }
2414
+
2415
+
2416
+ static get default (): ChordElement {
2417
+ return ChordElement.from({phonet: "c", octave: 0});
2418
+ }
2419
+
2420
+
2421
+ constructor (data: object) {
2422
+ super(data);
2423
+
2424
+ if (this.options.post_events)
2425
+ this.options.post_events = this.options.post_events.map(parseRaw);
2426
+
2427
+ if (!this.pitch)
2428
+ console.log("null pitch:", this);
2429
+ }
2430
+
2431
+
2432
+ serialize () {
2433
+ const {exclamations, questions, post_events} = this.options;
2434
+ const postfix = [].concat(...[...(exclamations || []), ...(questions || [])]
2435
+ .filter(item => item)
2436
+ .map(item => ["\b", item]),
2437
+ ).concat(...(post_events || []).map(item => ["\b", ...BaseTerm.optionalSerialize(item)]));
2438
+
2439
+ return [
2440
+ new OpenLocator(this),
2441
+ this.pitch,
2442
+ ...postfix,
2443
+ new CloseLocator(this),
2444
+ ];
2445
+ }
2446
+
2447
+
2448
+ get octave (): number {
2449
+ const positive = (this.pitch.match(/'/g) || []).length;
2450
+ const negative = (this.pitch.match(/,/g) || []).length;
2451
+
2452
+ return positive - negative;
2453
+ }
2454
+
2455
+
2456
+ get phonet (): string {
2457
+ const ph = this.pitch.substr(0, 1);
2458
+
2459
+ return idioms.PHONETS_ALIAS[ph] || ph;
2460
+ }
2461
+
2462
+
2463
+ get phonetStep (): number {
2464
+ return idioms.PHONETS.indexOf(this.phonet);
2465
+ }
2466
+
2467
+
2468
+ get alters (): string {
2469
+ const captures = this.pitch.substr(1).match(/^\w+/);
2470
+ return captures && captures[0];
2471
+ }
2472
+
2473
+
2474
+ get alteredPhonet (): string {
2475
+ const captures = this.pitch.match(/^\w+/);
2476
+ return captures && captures[0];
2477
+ }
2478
+
2479
+
2480
+ get anchorPitch (): ChordElement {
2481
+ if (this._previous)
2482
+ return this._previous.absolutePitch;
2483
+
2484
+ if (this._parent)
2485
+ return this._parent.anchorPitch;
2486
+
2487
+ return ChordElement.from({phonet: this.phonet, octave: 0});
2488
+ }
2489
+
2490
+
2491
+ getAbsolutePitch (): ChordElement {
2492
+ if (this.phonet === "q")
2493
+ return this.anchorPitch;
2494
+
2495
+ if (this.anchorPitch === this)
2496
+ return this;
2497
+
2498
+ const octave = this.absoluteOctave(this.anchorPitch);
2499
+
2500
+ return ChordElement.from({phonet: this.phonet, alters: this.alters, octave});
2501
+ }
2502
+
2503
+
2504
+ get absolutePitch (): ChordElement {
2505
+ if (!this._absolutePitch)
2506
+ this._absolutePitch = this.getAbsolutePitch();
2507
+
2508
+ return this._absolutePitch;
2509
+ }
2510
+
2511
+
2512
+ absoluteOctave (anchor: ChordElement): number {
2513
+ if (this.phonet === "q")
2514
+ return anchor.octave;
2515
+
2516
+ const phonetDiffer = this.phonetStep - anchor.phonetStep;
2517
+ const shift = idioms.phonetDifferToShift(phonetDiffer);
2518
+
2519
+ return anchor.octave + shift + this.octave;
2520
+ }
2521
+
2522
+
2523
+ relativeOctave (from: ChordElement): number {
2524
+ if (this.phonet === "q") {
2525
+ if (this.anchorPitch)
2526
+ return this.anchorPitch.relativeOctave(from);
2527
+ else
2528
+ return 0;
2529
+ }
2530
+
2531
+ const phonetDiffer = this.phonetStep - from.phonetStep;
2532
+ const shift = idioms.phonetDifferToShift(phonetDiffer);
2533
+
2534
+ return this.octave - shift - from.octave;
2535
+ }
2536
+
2537
+
2538
+ get alterValue (): number {
2539
+ return idioms.ALTER_VALUES[this.alters] || 0;
2540
+ }
2541
+
2542
+
2543
+ get pitchValue (): number {
2544
+ const phonetValue = idioms.PHONET_VALUES[this.phonet];
2545
+ console.assert(Number.isInteger(phonetValue), "invalid phonet:", this.phonet);
2546
+ console.assert(!this.alters || idioms.ALTER_VALUES[this.alters], "invalid alters:", this.alters);
2547
+
2548
+ return 48 + this.octave * 12 + phonetValue + this.alterValue;
2549
+ }
2550
+
2551
+
2552
+ get absolutePitchValue (): number {
2553
+ return this.absolutePitch.pitchValue;
2554
+ }
2555
+
2556
+
2557
+ // middle C is zero
2558
+ get notePosition (): number {
2559
+ const phonet = idioms.PHONETS.indexOf(this.phonet);
2560
+
2561
+ return (this.octave - 1) * 7 + phonet;
2562
+ }
2563
+
2564
+
2565
+ get absoluteNotePosition (): number {
2566
+ return this.absolutePitch.notePosition;
2567
+ }
2568
+
2569
+
2570
+ get tiedParent (): ChordElement {
2571
+ if (!this._tied || !(this._tied instanceof Chord))
2572
+ return null;
2573
+
2574
+ const pitch = this._tied.pitchElements.find(p => p.absolutePitchValue === this.absolutePitchValue);
2575
+ if (!pitch)
2576
+ return null;
2577
+
2578
+ if (pitch._tied)
2579
+ return pitch.tiedParent;
2580
+
2581
+ return pitch;
2582
+ }
2583
+ };
2584
+
2585
+
2586
+ export class Duration extends BaseTerm {
2587
+ number: string;
2588
+ dots: number;
2589
+ multipliers?: string[];
2590
+
2591
+
2592
+ static _default: Duration;
2593
+ static get default (): Duration {
2594
+ if (!Duration._default)
2595
+ Duration._default = new Duration({number: 4, dots: 0});
2596
+
2597
+ return Duration._default;
2598
+ }
2599
+
2600
+
2601
+ static fromMagnitude (magnitude: number): Duration {
2602
+ const MULTI = 1024;
2603
+ const MULTI_DURATION_MAGNITUDE = WHOLE_DURATION_MAGNITUDE * MULTI;
2604
+ const multiMag = magnitude * MULTI;
2605
+ if (!Number.isInteger(multiMag)) {
2606
+ console.warn("magnitude must be integer:", magnitude);
2607
+ return null;
2608
+ }
2609
+
2610
+ const di = gcd(multiMag, MULTI_DURATION_MAGNITUDE);
2611
+ const denominator = MULTI_DURATION_MAGNITUDE / di;
2612
+ const numerator = multiMag / di;
2613
+ if (!Number.isInteger(Math.log2(denominator)))
2614
+ return new Duration({number: 1, dots: 0, multipliers: [`${numerator}/${denominator}`]});
2615
+
2616
+ switch (numerator) {
2617
+ case 1:
2618
+ return new Duration({number: denominator, dots: 0});
2619
+
2620
+ case 3:
2621
+ return new Duration({number: denominator / 2, dots: 1});
2622
+
2623
+ case 7:
2624
+ return new Duration({number: denominator / 4, dots: 2});
2625
+
2626
+ default:
2627
+ return new Duration({number: denominator, dots: 0, multipliers: [numerator.toString()]});
2628
+ }
2629
+ }
2630
+
2631
+
2632
+ serialize () {
2633
+ const dots = Array(this.dots).fill(".").join("");
2634
+ const multipliers = this.multipliers && this.multipliers.map(multiplier => `*${multiplier}`).join("");
2635
+
2636
+ return compact([
2637
+ this.number, dots, multipliers,
2638
+ ]);
2639
+ }
2640
+
2641
+
2642
+ get withMultiplier () {
2643
+ return this.multipliers && this.multipliers.length > 0;
2644
+ }
2645
+
2646
+
2647
+ get denominator (): number {
2648
+ switch (this.number) {
2649
+ case "\\breve":
2650
+ return 0.5;
2651
+
2652
+ case "\\longa":
2653
+ return 0.25;
2654
+ }
2655
+
2656
+ return Number(this.number);
2657
+ }
2658
+
2659
+
2660
+ get division (): number {
2661
+ return Math.log2(this.denominator);
2662
+ }
2663
+
2664
+
2665
+ // how many smallest rhythm unit in a whole note
2666
+ get subdivider (): number {
2667
+ return this.denominator * (2 ** this.dots);
2668
+ }
2669
+
2670
+
2671
+ get magnitude (): number {
2672
+ let value = WHOLE_DURATION_MAGNITUDE / this.denominator;
2673
+
2674
+ if (this.dots)
2675
+ value *= 2 - 0.5 ** this.dots;
2676
+
2677
+ if (this.multipliers)
2678
+ this.multipliers.forEach(multiplier => value *= eval(multiplier));
2679
+
2680
+ return value;
2681
+ }
2682
+ };
2683
+
2684
+
2685
+ interface BriefChordBody {
2686
+ pitch: string;
2687
+ duration: Duration;
2688
+ separator: string;
2689
+ items: string[];
2690
+ };
2691
+
2692
+
2693
+ export class BriefChord extends BaseTerm {
2694
+ body: BriefChordBody;
2695
+ post_events: any[];
2696
+
2697
+
2698
+ constructor (data: object) {
2699
+ super(data);
2700
+
2701
+ if (this.body)
2702
+ this.body.duration = parseRaw(this.body.duration);
2703
+ }
2704
+
2705
+
2706
+ serialize () {
2707
+ const {pitch, duration, separator, items} = this.body;
2708
+
2709
+ return [
2710
+ ...compact(cc([pitch, duration, separator, ...(items || [])].map(BaseTerm.optionalSerialize))),
2711
+ ...cc((this.post_events || []).map(BaseTerm.optionalSerialize)),
2712
+ ];
2713
+ }
2714
+
2715
+
2716
+ get isMusic (): boolean {
2717
+ return true;
2718
+ }
2719
+
2720
+
2721
+ get durationMagnitude (): number {
2722
+ if (this.body.duration)
2723
+ return this.body.duration.magnitude;
2724
+
2725
+ return 0;
2726
+ }
2727
+ };
2728
+
2729
+
2730
+ export class NumberUnit extends BaseTerm {
2731
+ number: number;
2732
+ unit: string;
2733
+
2734
+
2735
+ serialize () {
2736
+ return [this.number, "\b", this.unit];
2737
+ }
2738
+
2739
+
2740
+ set ({number, unit}) {
2741
+ this.number = Number(number.toFixed(2));
2742
+
2743
+ if (unit !== undefined)
2744
+ this.unit = unit;
2745
+ }
2746
+ }
2747
+
2748
+
2749
+ export class Tempo extends BaseTerm {
2750
+ beatsPerMinute?: number;
2751
+ unit?: Duration;
2752
+ text?: string;
2753
+
2754
+
2755
+ static fromNoteBpm (note: number, bpm: number): Tempo {
2756
+ return new Tempo ({
2757
+ unit: new Duration({number: note.toString(), dots: 0}),
2758
+ beatsPerMinute: bpm,
2759
+ });
2760
+ }
2761
+
2762
+
2763
+ serialize () {
2764
+ const assignment = Number.isFinite(this.beatsPerMinute) ? [...BaseTerm.optionalSerialize(this.unit), "=", this.beatsPerMinute] : [];
2765
+
2766
+ return [
2767
+ "\\tempo",
2768
+ ...BaseTerm.optionalSerialize(this.text),
2769
+ ...assignment,
2770
+ ];
2771
+ }
2772
+ }
2773
+
2774
+
2775
+ const DIRECTION_CHAR = {
2776
+ up: "^",
2777
+ down: "_",
2778
+ middle: "-",
2779
+ };
2780
+
2781
+
2782
+ export class PostEvent extends BaseTerm {
2783
+ direction: string;
2784
+ arg: string | BaseTerm;
2785
+
2786
+
2787
+ serialize () {
2788
+ const dir = DIRECTION_CHAR[this.direction];
2789
+ const prefix = dir ? [dir, "\b"] : [];
2790
+
2791
+ return prefix.concat(BaseTerm.optionalSerialize(this.arg));
2792
+ }
2793
+
2794
+
2795
+ get entries () {
2796
+ if (this.arg instanceof BaseTerm)
2797
+ return [this.arg];
2798
+
2799
+ return null;
2800
+ }
2801
+
2802
+
2803
+ get isTying (): boolean {
2804
+ return this.arg === "~";
2805
+ }
2806
+
2807
+
2808
+ get isStaccato (): boolean {
2809
+ if (this.arg instanceof Command)
2810
+ return ["staccato", "staccatissimo", "portato"].includes(this.arg.cmd);
2811
+
2812
+ if ([".", "!"].includes(this.arg as string))
2813
+ return true;
2814
+
2815
+ return false;
2816
+ }
2817
+ };
2818
+
2819
+
2820
+ export class Fingering extends BaseTerm {
2821
+ value: number;
2822
+
2823
+
2824
+ serialize () {
2825
+ return [this.value];
2826
+ }
2827
+ };
2828
+
2829
+
2830
+ export class Markup extends BaseTerm {
2831
+ head: any[];
2832
+ body: (string|BaseTerm);
2833
+
2834
+
2835
+ serialize () {
2836
+ return [
2837
+ ...cc(this.head.map(BaseTerm.optionalSerialize)),
2838
+ ...BaseTerm.optionalSerialize(this.body),
2839
+ ];
2840
+ }
2841
+ };
2842
+
2843
+
2844
+ export class Lyric extends MusicEvent {
2845
+ content: string | LiteralString;
2846
+
2847
+
2848
+ serialize () {
2849
+ return [
2850
+ ...BaseTerm.optionalSerialize(this.content),
2851
+ ...BaseTerm.optionalSerialize(this.duration),
2852
+ ...cc((this.post_events || []).map(BaseTerm.optionalSerialize)),
2853
+ ];
2854
+ }
2855
+ };
2856
+
2857
+
2858
+ export class Comment extends BaseTerm {
2859
+ text: string;
2860
+ scoped: boolean;
2861
+
2862
+
2863
+ serialize () {
2864
+ return [
2865
+ this.text,
2866
+ "\n",
2867
+ ];
2868
+ }
2869
+
2870
+
2871
+ static createSingle (text): Comment {
2872
+ return new Comment({text: "%" + text});
2873
+ }
2874
+
2875
+
2876
+ static createScoped (text): Comment {
2877
+ console.assert(!/%\}/.test(text), "invalid scoped comment text:", text);
2878
+
2879
+ return new Comment({text: `%{${text}%}`, scoped: true});
2880
+ }
2881
+ };
2882
+
2883
+
2884
+ export class Unexpect extends BaseTerm {
2885
+ constructor (data) {
2886
+ super(data);
2887
+
2888
+ console.warn("unexpected term", data);
2889
+ }
2890
+ };
2891
+
2892
+
2893
+ export const termDictionary = {
2894
+ Root,
2895
+ LiteralString,
2896
+ Command,
2897
+ Variable,
2898
+ MarkupCommand,
2899
+ Repeat,
2900
+ Relative,
2901
+ ParallelMusic,
2902
+ TimeSignature,
2903
+ Partial,
2904
+ Times,
2905
+ Tuplet,
2906
+ Grace,
2907
+ AfterGrace,
2908
+ Clef,
2909
+ KeySignature,
2910
+ OctaveShift,
2911
+ Include,
2912
+ Version,
2913
+ Language,
2914
+ LyricMode,
2915
+ ChordMode,
2916
+ Transposition,
2917
+ StemDirection,
2918
+ Change,
2919
+ Block,
2920
+ InlineBlock,
2921
+ Scheme,
2922
+ SchemeFunction,
2923
+ SchemePair,
2924
+ SchemePointer,
2925
+ SchemeEmbed,
2926
+ Assignment,
2927
+ Duration,
2928
+ ChordElement,
2929
+ Chord,
2930
+ Rest,
2931
+ BriefChord,
2932
+ NumberUnit,
2933
+ MusicBlock,
2934
+ SimultaneousList,
2935
+ ContextedMusic,
2936
+ Divide,
2937
+ Tempo,
2938
+ PostEvent,
2939
+ Fingering,
2940
+ Markup,
2941
+ Lyric,
2942
+ Primitive,
2943
+ Comment,
2944
+ };
2945
+
2946
+
2947
+ const termProtoMap: Map<object, string> = Object.entries(termDictionary)
2948
+ .reduce((map, [name, cls]: [string, {prototype: object}]) => (map.set(cls.prototype, name), map), new Map());
2949
+
2950
+
2951
+ const parseRawEnforce = data => {
2952
+ switch (typeof data) {
2953
+ case "string":
2954
+ case "number":
2955
+ return new Primitive({exp: data});
2956
+
2957
+ default:
2958
+ return parseRaw(data);
2959
+ }
2960
+ };
2961
+
2962
+
2963
+ export const parseRaw = data => {
2964
+ if (data instanceof BaseTerm)
2965
+ return data;
2966
+
2967
+ if (!data)
2968
+ return data;
2969
+
2970
+ switch (typeof data) {
2971
+ case "object":
2972
+ if (Array.isArray(data))
2973
+ return data.map(item => parseRaw(item));
2974
+
2975
+ const {proto, ...fields} = data;
2976
+ if (proto) {
2977
+ if (proto === "_PLAIN")
2978
+ return fields;
2979
+
2980
+ const termClass = termDictionary[proto];
2981
+ if (!termClass)
2982
+ throw new Error(`Unexpected term class: ${data.proto}`);
2983
+
2984
+ return new termClass(fields);
2985
+ }
2986
+
2987
+ return new Unexpect(data);
2988
+ }
2989
+
2990
+ return data;
2991
+ };