#!/usr/bin/env bun
import antlr4 from 'antlr4';
import { marked } from 'marked';
import { mkdirSync, writeFileSync, readFileSync, statSync, watch } from 'node:fs';
import { resolve, dirname, extname, basename, join } from 'node:path';

// Generated from java-escape by ANTLR 4.11.1
// jshint ignore: start


const serializedATN$1 = [4,0,75,803,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,
2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,
11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,
2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,
26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,
7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,
40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,
2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,
55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,
7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,
69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,
2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,1,0,1,0,1,1,
4,1,173,8,1,11,1,12,1,174,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,
3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,
4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,
6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,
1,11,1,12,1,12,1,13,1,13,4,13,246,8,13,11,13,12,13,247,1,14,1,14,1,15,1,
15,1,16,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,19,1,20,1,20,
1,21,1,21,1,22,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,
27,1,27,1,28,1,28,1,29,1,29,1,30,1,30,1,31,1,31,1,32,1,32,1,33,1,33,1,34,
1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,
39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,40,1,40,3,40,322,8,40,1,41,
1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,
43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,
1,43,1,43,1,43,1,43,3,43,358,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,
1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,
48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,50,1,50,1,50,
1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,3,50,406,8,50,1,51,1,51,1,51,
1,51,1,52,1,52,1,52,1,53,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,1,54,1,
55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,57,1,57,1,57,1,57,
1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,3,57,452,8,57,
1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,
58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,480,8,58,
1,59,1,59,5,59,484,8,59,10,59,12,59,487,9,59,1,60,1,60,1,61,1,61,5,61,493,
8,61,10,61,12,61,496,9,61,1,62,1,62,1,63,4,63,501,8,63,11,63,12,63,502,1,
64,4,64,506,8,64,11,64,12,64,507,1,64,1,64,5,64,512,8,64,10,64,12,64,515,
9,64,1,64,1,64,4,64,519,8,64,11,64,12,64,520,1,64,1,64,3,64,525,8,64,1,65,
1,65,1,65,3,65,530,8,65,1,66,4,66,533,8,66,11,66,12,66,534,1,66,1,66,5,66,
539,8,66,10,66,12,66,542,9,66,1,66,1,66,4,66,546,8,66,11,66,12,66,547,1,
66,4,66,551,8,66,11,66,12,66,552,3,66,555,8,66,1,66,1,66,1,67,4,67,560,8,
67,11,67,12,67,561,1,67,1,67,5,67,566,8,67,10,67,12,67,569,9,67,1,68,1,68,
1,68,1,68,3,68,575,8,68,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,
1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,
69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,
1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,
69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,
1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,
69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,
1,69,1,69,3,69,676,8,69,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,
1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,
70,1,70,1,70,1,70,1,70,3,70,707,8,70,1,71,1,71,1,71,1,71,1,71,1,71,1,71,
1,71,1,71,1,71,1,71,1,71,1,71,1,71,3,71,723,8,71,1,72,1,72,1,72,1,72,1,72,
3,72,730,8,72,1,73,1,73,1,73,1,73,5,73,736,8,73,10,73,12,73,739,9,73,1,73,
1,73,1,74,1,74,1,74,1,74,5,74,747,8,74,10,74,12,74,750,9,74,1,75,1,75,1,
75,1,75,1,76,1,76,1,76,1,76,5,76,760,8,76,10,76,12,76,763,9,76,1,76,1,76,
1,77,1,77,1,78,5,78,770,8,78,10,78,12,78,773,9,78,1,78,1,78,1,78,1,78,5,
78,779,8,78,10,78,12,78,782,9,78,1,78,1,78,1,79,4,79,787,8,79,11,79,12,79,
788,1,80,1,80,1,80,1,80,1,81,4,81,796,8,81,11,81,12,81,797,1,82,1,82,1,82,
1,82,0,0,83,3,0,5,1,7,2,9,3,11,4,13,5,15,6,17,7,19,8,21,9,23,10,25,11,27,
0,29,12,31,13,33,14,35,15,37,16,39,17,41,18,43,19,45,20,47,21,49,22,51,23,
53,24,55,25,57,26,59,27,61,28,63,29,65,30,67,31,69,32,71,33,73,34,75,35,
77,36,79,37,81,38,83,39,85,40,87,41,89,42,91,43,93,44,95,45,97,46,99,47,
101,48,103,49,105,50,107,51,109,52,111,53,113,54,115,55,117,56,119,57,121,
58,123,59,125,60,127,0,129,61,131,62,133,63,135,64,137,65,139,0,141,0,143,
0,145,0,147,0,149,66,151,67,153,68,155,69,157,70,159,71,161,72,163,73,165,
74,167,75,3,0,1,2,9,2,0,9,9,32,32,3,0,48,57,65,70,97,102,4,0,48,57,65,90,
95,95,97,122,649,0,65,90,95,95,97,122,170,170,181,181,186,186,192,214,216,
246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,
895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,
1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,
1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,
1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,
2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,
2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,
2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,
2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,
2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,
2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,
2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,
2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,
2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,
3133,3133,3160,3162,3165,3165,3168,3169,3200,3200,3205,3212,3214,3216,3218,
3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3313,3314,3332,3340,
3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,
3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,
3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,
3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,
4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,
4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,
4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,
4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,
5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5873,5880,5888,
5905,5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,
6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,
6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6988,
7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,
7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,
7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,
8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,
8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,
8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,
8495,8505,8508,8511,8517,8521,8526,8526,8579,8580,11264,11492,11499,11502,
11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,
11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,
11720,11726,11728,11734,11736,11742,11823,11823,12293,12294,12337,12341,
12347,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,
12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,
42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42725,
42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,
42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,
43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,
43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,
43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,
43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,
43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,
43824,43866,43868,43881,43888,44002,44032,55203,55216,55238,55243,55291,
63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,
64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,
64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,
65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,
65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,
65616,65629,65664,65786,66176,66204,66208,66256,66304,66335,66349,66368,
66370,66377,66384,66421,66432,66461,66464,66499,66504,66511,66560,66717,
66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,
66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,
67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,
67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,
67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,
67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,
68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,
68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,
69248,69289,69296,69297,69376,69404,69415,69415,69424,69445,69488,69505,
69552,69572,69600,69622,69635,69687,69745,69746,69749,69749,69763,69807,
69840,69864,69891,69926,69956,69956,69959,69959,69968,70002,70006,70006,
70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,
70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,
70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,
70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70753,
70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,
71236,71236,71296,71338,71352,71352,71424,71450,71488,71494,71680,71723,
71840,71903,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,
71999,71999,72001,72001,72096,72103,72106,72144,72161,72161,72163,72163,
72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,
72368,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,
72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,
73112,73112,73440,73458,73648,73648,73728,74649,74880,75075,77712,77808,
77824,78894,82944,83526,92160,92728,92736,92766,92784,92862,92880,92909,
92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,
94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,
101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110928,
110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,
113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,
119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,
120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,
120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,
120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,
120712,120714,120744,120746,120770,120772,120779,122624,122654,123136,123180,
123191,123197,123214,123214,123536,123565,123584,123627,124896,124902,124904,
124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,
126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,
126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,
126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,
126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,
126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,
126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,
131072,173791,173824,177976,177984,178205,178208,183969,183984,191456,194560,
195101,196608,201546,693,0,48,57,65,90,95,95,97,122,170,170,181,181,186,
186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,
887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,
1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1632,1641,
1646,1647,1649,1747,1749,1749,1765,1766,1774,1788,1791,1791,1808,1808,1810,
1839,1869,1957,1969,1969,1984,2026,2036,2037,2042,2042,2048,2069,2074,2074,
2084,2084,2088,2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,
2361,2365,2365,2384,2384,2392,2401,2406,2415,2417,2432,2437,2444,2447,2448,
2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,
2529,2534,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,
2613,2614,2616,2617,2649,2652,2654,2654,2662,2671,2674,2676,2693,2701,2703,
2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,
2790,2799,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,
2873,2877,2877,2908,2909,2911,2913,2918,2927,2929,2929,2947,2947,2949,2954,
2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,
3001,3024,3024,3046,3055,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,
3160,3162,3165,3165,3168,3169,3174,3183,3200,3200,3205,3212,3214,3216,3218,
3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3302,3311,3313,3314,
3332,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3430,
3439,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3558,3567,
3585,3632,3634,3635,3648,3654,3664,3673,3713,3714,3716,3716,3718,3722,3724,
3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3792,3801,
3804,3807,3840,3840,3872,3881,3904,3911,3913,3948,3976,3980,4096,4138,4159,
4169,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,
4240,4249,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,
4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,
4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,
5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5873,5880,5888,5905,
5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,6112,
6121,6160,6169,6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,
6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6678,6688,6740,6784,
6793,6800,6809,6823,6823,6917,6963,6981,6988,6992,7001,7043,7072,7086,7141,
7168,7203,7232,7241,7245,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,
7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,
8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,
8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,
8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,
8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,
8526,8526,8579,8580,11264,11492,11499,11502,11506,11507,11520,11557,11559,
11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,
11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,
11742,11823,11823,12293,12294,12337,12341,12347,12348,12353,12438,12445,
12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,
12799,13312,19903,19968,42124,42192,42237,42240,42508,42512,42539,42560,
42606,42623,42653,42656,42725,42775,42783,42786,42888,42891,42954,42960,
42961,42963,42963,42965,42969,42994,43009,43011,43013,43015,43018,43020,
43042,43072,43123,43138,43187,43216,43225,43250,43255,43259,43259,43261,
43262,43264,43301,43312,43334,43360,43388,43396,43442,43471,43481,43488,
43492,43494,43518,43520,43560,43584,43586,43588,43595,43600,43609,43616,
43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,
43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,
43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,
44002,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,
64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,
64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,
64911,64914,64967,65008,65019,65136,65140,65142,65276,65296,65305,65313,
65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,
65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,
65629,65664,65786,66176,66204,66208,66256,66304,66335,66349,66368,66370,
66377,66384,66421,66432,66461,66464,66499,66504,66511,66560,66717,66720,
66729,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,
66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,
67004,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,
67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,
67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,
67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,
68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,
68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,
68899,68912,68921,69248,69289,69296,69297,69376,69404,69415,69415,69424,
69445,69488,69505,69552,69572,69600,69622,69635,69687,69734,69743,69745,
69746,69749,69749,69763,69807,69840,69864,69872,69881,69891,69926,69942,
69951,69956,69956,69959,69959,69968,70002,70006,70006,70019,70066,70081,
70084,70096,70106,70108,70108,70144,70161,70163,70187,70272,70278,70280,
70280,70282,70285,70287,70301,70303,70312,70320,70366,70384,70393,70405,
70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,
70461,70480,70480,70493,70497,70656,70708,70727,70730,70736,70745,70751,
70753,70784,70831,70852,70853,70855,70855,70864,70873,71040,71086,71128,
71131,71168,71215,71236,71236,71248,71257,71296,71338,71352,71352,71360,
71369,71424,71450,71472,71481,71488,71494,71680,71723,71840,71913,71935,
71942,71945,71945,71948,71955,71957,71958,71960,71983,71999,71999,72001,
72001,72016,72025,72096,72103,72106,72144,72161,72161,72163,72163,72192,
72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72368,
72440,72704,72712,72714,72750,72768,72768,72784,72793,72818,72847,72960,
72966,72968,72969,72971,73008,73030,73030,73040,73049,73056,73061,73063,
73064,73066,73097,73112,73112,73120,73129,73440,73458,73648,73648,73728,
74649,74880,75075,77712,77808,77824,78894,82944,83526,92160,92728,92736,
92766,92768,92777,92784,92862,92864,92873,92880,92909,92928,92975,92992,
92995,93008,93017,93027,93047,93053,93071,93760,93823,93952,94026,94032,
94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,101632,
101640,110576,110579,110581,110587,110589,110590,110592,110882,110928,110930,
110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,
113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,
119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,
120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,
120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,
120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,
120714,120744,120746,120770,120772,120779,120782,120831,122624,122654,123136,
123180,123191,123197,123200,123209,123214,123214,123536,123565,123584,123627,
123632,123641,124896,124902,124904,124907,124909,124910,124912,124926,124928,
125124,125184,125251,125259,125259,125264,125273,126464,126467,126469,126495,
126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,
126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,
126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,
126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,
126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,
126619,126625,126627,126629,126633,126635,126651,130032,130041,131072,173791,
173824,177976,177984,178205,178208,183969,183984,191456,194560,195101,196608,
201546,1,0,48,57,648,0,65,90,97,122,170,170,181,181,186,186,192,214,216,
246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,
895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,
1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,
1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,
1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,
2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,
2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,
2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,
2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,
2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,
2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,
2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,
2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,
2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,
3133,3133,3160,3162,3165,3165,3168,3169,3200,3200,3205,3212,3214,3216,3218,
3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3313,3314,3332,3340,
3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,
3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,
3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,
3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,
4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,
4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,
4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,
4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,
5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5873,5880,5888,
5905,5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,
6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,
6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6988,
7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,
7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,
7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,
8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,
8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,
8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,
8495,8505,8508,8511,8517,8521,8526,8526,8579,8580,11264,11492,11499,11502,
11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,
11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,
11720,11726,11728,11734,11736,11742,11823,11823,12293,12294,12337,12341,
12347,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,
12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,
42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42725,
42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,
42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,
43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,
43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,
43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,
43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,
43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,
43824,43866,43868,43881,43888,44002,44032,55203,55216,55238,55243,55291,
63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,
64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,
64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,
65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,
65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,
65616,65629,65664,65786,66176,66204,66208,66256,66304,66335,66349,66368,
66370,66377,66384,66421,66432,66461,66464,66499,66504,66511,66560,66717,
66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,
66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,
67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,
67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,
67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,
67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,
68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,
68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,
69248,69289,69296,69297,69376,69404,69415,69415,69424,69445,69488,69505,
69552,69572,69600,69622,69635,69687,69745,69746,69749,69749,69763,69807,
69840,69864,69891,69926,69956,69956,69959,69959,69968,70002,70006,70006,
70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,
70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,
70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,
70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70753,
70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,
71236,71236,71296,71338,71352,71352,71424,71450,71488,71494,71680,71723,
71840,71903,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,
71999,71999,72001,72001,72096,72103,72106,72144,72161,72161,72163,72163,
72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,
72368,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,
72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,
73112,73112,73440,73458,73648,73648,73728,74649,74880,75075,77712,77808,
77824,78894,82944,83526,92160,92728,92736,92766,92784,92862,92880,92909,
92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,
94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,
101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110928,
110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,
113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,
119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,
120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,
120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,
120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,
120712,120714,120744,120746,120770,120772,120779,122624,122654,123136,123180,
123191,123197,123214,123214,123536,123565,123584,123627,124896,124902,124904,
124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,
126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,
126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,
126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,
126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,
126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,
126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,
131072,173791,173824,177976,177984,178205,178208,183969,183984,191456,194560,
195101,196608,201546,3,0,10,10,13,13,34,34,2,0,10,10,13,13,874,0,5,1,0,0,
0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,
0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,29,1,0,0,0,0,
31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,
0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,
1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,
0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,
0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,
87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,
0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,
0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,0,
119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0,0,0,0,129,1,0,0,0,0,131,
1,0,0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,149,1,0,0,0,0,151,1,
0,0,0,0,153,1,0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,1,161,1,0,
0,0,1,163,1,0,0,0,2,165,1,0,0,0,2,167,1,0,0,0,3,169,1,0,0,0,5,172,1,0,0,
0,7,178,1,0,0,0,9,186,1,0,0,0,11,197,1,0,0,0,13,206,1,0,0,0,15,214,1,0,0,
0,17,224,1,0,0,0,19,228,1,0,0,0,21,231,1,0,0,0,23,234,1,0,0,0,25,238,1,0,
0,0,27,241,1,0,0,0,29,243,1,0,0,0,31,249,1,0,0,0,33,251,1,0,0,0,35,253,1,
0,0,0,37,256,1,0,0,0,39,259,1,0,0,0,41,262,1,0,0,0,43,265,1,0,0,0,45,267,
1,0,0,0,47,269,1,0,0,0,49,272,1,0,0,0,51,275,1,0,0,0,53,277,1,0,0,0,55,279,
1,0,0,0,57,281,1,0,0,0,59,283,1,0,0,0,61,285,1,0,0,0,63,287,1,0,0,0,65,289,
1,0,0,0,67,291,1,0,0,0,69,293,1,0,0,0,71,295,1,0,0,0,73,297,1,0,0,0,75,299,
1,0,0,0,77,301,1,0,0,0,79,303,1,0,0,0,81,308,1,0,0,0,83,321,1,0,0,0,85,323,
1,0,0,0,87,326,1,0,0,0,89,357,1,0,0,0,91,359,1,0,0,0,93,366,1,0,0,0,95,370,
1,0,0,0,97,374,1,0,0,0,99,380,1,0,0,0,101,384,1,0,0,0,103,405,1,0,0,0,105,
407,1,0,0,0,107,411,1,0,0,0,109,414,1,0,0,0,111,418,1,0,0,0,113,424,1,0,
0,0,115,432,1,0,0,0,117,451,1,0,0,0,119,479,1,0,0,0,121,481,1,0,0,0,123,
488,1,0,0,0,125,490,1,0,0,0,127,497,1,0,0,0,129,500,1,0,0,0,131,524,1,0,
0,0,133,526,1,0,0,0,135,554,1,0,0,0,137,559,1,0,0,0,139,574,1,0,0,0,141,
675,1,0,0,0,143,706,1,0,0,0,145,722,1,0,0,0,147,729,1,0,0,0,149,731,1,0,
0,0,151,742,1,0,0,0,153,751,1,0,0,0,155,755,1,0,0,0,157,766,1,0,0,0,159,
771,1,0,0,0,161,786,1,0,0,0,163,790,1,0,0,0,165,795,1,0,0,0,167,799,1,0,
0,0,169,170,7,0,0,0,170,4,1,0,0,0,171,173,3,3,0,0,172,171,1,0,0,0,173,174,
1,0,0,0,174,172,1,0,0,0,174,175,1,0,0,0,175,176,1,0,0,0,176,177,6,1,0,0,
177,6,1,0,0,0,178,179,5,99,0,0,179,180,5,111,0,0,180,181,5,110,0,0,181,182,
5,115,0,0,182,183,5,116,0,0,183,184,1,0,0,0,184,185,6,2,1,0,185,8,1,0,0,
0,186,187,5,114,0,0,187,188,5,101,0,0,188,189,5,97,0,0,189,190,5,100,0,0,
190,191,5,111,0,0,191,192,5,110,0,0,192,193,5,108,0,0,193,194,5,121,0,0,
194,195,1,0,0,0,195,196,6,3,1,0,196,10,1,0,0,0,197,198,5,115,0,0,198,199,
5,116,0,0,199,200,5,97,0,0,200,201,5,116,0,0,201,202,5,105,0,0,202,203,5,
99,0,0,203,204,1,0,0,0,204,205,6,4,1,0,205,12,1,0,0,0,206,207,5,97,0,0,207,
208,5,119,0,0,208,209,5,97,0,0,209,210,5,105,0,0,210,211,5,116,0,0,211,212,
1,0,0,0,212,213,6,5,1,0,213,14,1,0,0,0,214,215,5,116,0,0,215,216,5,105,0,
0,216,217,5,116,0,0,217,218,5,108,0,0,218,219,5,101,0,0,219,220,1,0,0,0,
220,221,4,6,0,0,221,222,1,0,0,0,222,223,6,6,2,0,223,16,1,0,0,0,224,225,5,
58,0,0,225,226,1,0,0,0,226,227,6,7,3,0,227,18,1,0,0,0,228,229,5,60,0,0,229,
230,5,60,0,0,230,20,1,0,0,0,231,232,5,62,0,0,232,233,5,62,0,0,233,22,1,0,
0,0,234,235,5,45,0,0,235,236,5,45,0,0,236,237,5,62,0,0,237,24,1,0,0,0,238,
239,5,45,0,0,239,240,5,62,0,0,240,26,1,0,0,0,241,242,7,1,0,0,242,28,1,0,
0,0,243,245,5,35,0,0,244,246,3,27,12,0,245,244,1,0,0,0,246,247,1,0,0,0,247,
245,1,0,0,0,247,248,1,0,0,0,248,30,1,0,0,0,249,250,5,91,0,0,250,32,1,0,0,
0,251,252,5,93,0,0,252,34,1,0,0,0,253,254,5,124,0,0,254,255,5,124,0,0,255,
36,1,0,0,0,256,257,5,38,0,0,257,258,5,38,0,0,258,38,1,0,0,0,259,260,5,61,
0,0,260,261,5,61,0,0,261,40,1,0,0,0,262,263,5,33,0,0,263,264,5,61,0,0,264,
42,1,0,0,0,265,266,5,62,0,0,266,44,1,0,0,0,267,268,5,60,0,0,268,46,1,0,0,
0,269,270,5,62,0,0,270,271,5,61,0,0,271,48,1,0,0,0,272,273,5,60,0,0,273,
274,5,61,0,0,274,50,1,0,0,0,275,276,5,43,0,0,276,52,1,0,0,0,277,278,5,45,
0,0,278,54,1,0,0,0,279,280,5,42,0,0,280,56,1,0,0,0,281,282,5,47,0,0,282,
58,1,0,0,0,283,284,5,37,0,0,284,60,1,0,0,0,285,286,5,94,0,0,286,62,1,0,0,
0,287,288,5,33,0,0,288,64,1,0,0,0,289,290,5,59,0,0,290,66,1,0,0,0,291,292,
5,44,0,0,292,68,1,0,0,0,293,294,5,61,0,0,294,70,1,0,0,0,295,296,5,40,0,0,
296,72,1,0,0,0,297,298,5,41,0,0,298,74,1,0,0,0,299,300,5,123,0,0,300,76,
1,0,0,0,301,302,5,125,0,0,302,78,1,0,0,0,303,304,5,116,0,0,304,305,5,114,
0,0,305,306,5,117,0,0,306,307,5,101,0,0,307,80,1,0,0,0,308,309,5,102,0,0,
309,310,5,97,0,0,310,311,5,108,0,0,311,312,5,115,0,0,312,313,5,101,0,0,313,
82,1,0,0,0,314,315,5,110,0,0,315,316,5,105,0,0,316,322,5,108,0,0,317,318,
5,110,0,0,318,319,5,117,0,0,319,320,5,108,0,0,320,322,5,108,0,0,321,314,
1,0,0,0,321,317,1,0,0,0,322,84,1,0,0,0,323,324,5,105,0,0,324,325,5,102,0,
0,325,86,1,0,0,0,326,327,5,101,0,0,327,328,5,108,0,0,328,329,5,115,0,0,329,
330,5,101,0,0,330,88,1,0,0,0,331,332,5,119,0,0,332,333,5,104,0,0,333,334,
5,105,0,0,334,335,5,108,0,0,335,358,5,101,0,0,336,337,5,102,0,0,337,338,
5,111,0,0,338,358,5,114,0,0,339,340,5,102,0,0,340,341,5,111,0,0,341,342,
5,114,0,0,342,343,5,101,0,0,343,344,5,97,0,0,344,345,5,99,0,0,345,358,5,
104,0,0,346,347,5,102,0,0,347,348,5,111,0,0,348,349,5,114,0,0,349,350,5,
69,0,0,350,351,5,97,0,0,351,352,5,99,0,0,352,358,5,104,0,0,353,354,5,108,
0,0,354,355,5,111,0,0,355,356,5,111,0,0,356,358,5,112,0,0,357,331,1,0,0,
0,357,336,1,0,0,0,357,339,1,0,0,0,357,346,1,0,0,0,357,353,1,0,0,0,358,90,
1,0,0,0,359,360,5,114,0,0,360,361,5,101,0,0,361,362,5,116,0,0,362,363,5,
117,0,0,363,364,5,114,0,0,364,365,5,110,0,0,365,92,1,0,0,0,366,367,5,110,
0,0,367,368,5,101,0,0,368,369,5,119,0,0,369,94,1,0,0,0,370,371,5,112,0,0,
371,372,5,97,0,0,372,373,5,114,0,0,373,96,1,0,0,0,374,375,5,103,0,0,375,
376,5,114,0,0,376,377,5,111,0,0,377,378,5,117,0,0,378,379,5,112,0,0,379,
98,1,0,0,0,380,381,5,111,0,0,381,382,5,112,0,0,382,383,5,116,0,0,383,100,
1,0,0,0,384,385,5,99,0,0,385,386,5,114,0,0,386,387,5,105,0,0,387,388,5,116,
0,0,388,389,5,105,0,0,389,390,5,99,0,0,390,391,5,97,0,0,391,392,5,108,0,
0,392,102,1,0,0,0,393,394,5,115,0,0,394,395,5,101,0,0,395,396,5,99,0,0,396,
397,5,116,0,0,397,398,5,105,0,0,398,399,5,111,0,0,399,406,5,110,0,0,400,
401,5,102,0,0,401,402,5,114,0,0,402,403,5,97,0,0,403,404,5,109,0,0,404,406,
5,101,0,0,405,393,1,0,0,0,405,400,1,0,0,0,406,104,1,0,0,0,407,408,5,114,
0,0,408,409,5,101,0,0,409,410,5,102,0,0,410,106,1,0,0,0,411,412,5,97,0,0,
412,413,5,115,0,0,413,108,1,0,0,0,414,415,5,116,0,0,415,416,5,114,0,0,416,
417,5,121,0,0,417,110,1,0,0,0,418,419,5,99,0,0,419,420,5,97,0,0,420,421,
5,116,0,0,421,422,5,99,0,0,422,423,5,104,0,0,423,112,1,0,0,0,424,425,5,102,
0,0,425,426,5,105,0,0,426,427,5,110,0,0,427,428,5,97,0,0,428,429,5,108,0,
0,429,430,5,108,0,0,430,431,5,121,0,0,431,114,1,0,0,0,432,433,5,105,0,0,
433,434,5,110,0,0,434,116,1,0,0,0,435,436,5,64,0,0,436,437,5,83,0,0,437,
438,5,116,0,0,438,439,5,97,0,0,439,440,5,114,0,0,440,441,5,116,0,0,441,442,
5,101,0,0,442,452,5,114,0,0,443,444,5,64,0,0,444,445,5,115,0,0,445,446,5,
116,0,0,446,447,5,97,0,0,447,448,5,114,0,0,448,449,5,116,0,0,449,450,5,101,
0,0,450,452,5,114,0,0,451,435,1,0,0,0,451,443,1,0,0,0,452,118,1,0,0,0,453,
454,5,64,0,0,454,455,5,82,0,0,455,456,5,101,0,0,456,457,5,116,0,0,457,458,
5,117,0,0,458,459,5,114,0,0,459,480,5,110,0,0,460,461,5,64,0,0,461,462,5,
114,0,0,462,463,5,101,0,0,463,464,5,116,0,0,464,465,5,117,0,0,465,466,5,
114,0,0,466,480,5,110,0,0,467,468,5,64,0,0,468,469,5,82,0,0,469,470,5,101,
0,0,470,471,5,112,0,0,471,472,5,108,0,0,472,480,5,121,0,0,473,474,5,64,0,
0,474,475,5,114,0,0,475,476,5,101,0,0,476,477,5,112,0,0,477,478,5,108,0,
0,478,480,5,121,0,0,479,453,1,0,0,0,479,460,1,0,0,0,479,467,1,0,0,0,479,
473,1,0,0,0,480,120,1,0,0,0,481,485,5,64,0,0,482,484,7,2,0,0,483,482,1,0,
0,0,484,487,1,0,0,0,485,483,1,0,0,0,485,486,1,0,0,0,486,122,1,0,0,0,487,
485,1,0,0,0,488,489,5,46,0,0,489,124,1,0,0,0,490,494,7,3,0,0,491,493,7,4,
0,0,492,491,1,0,0,0,493,496,1,0,0,0,494,492,1,0,0,0,494,495,1,0,0,0,495,
126,1,0,0,0,496,494,1,0,0,0,497,498,7,5,0,0,498,128,1,0,0,0,499,501,3,127,
62,0,500,499,1,0,0,0,501,502,1,0,0,0,502,500,1,0,0,0,502,503,1,0,0,0,503,
130,1,0,0,0,504,506,3,127,62,0,505,504,1,0,0,0,506,507,1,0,0,0,507,505,1,
0,0,0,507,508,1,0,0,0,508,509,1,0,0,0,509,513,5,46,0,0,510,512,3,127,62,
0,511,510,1,0,0,0,512,515,1,0,0,0,513,511,1,0,0,0,513,514,1,0,0,0,514,525,
1,0,0,0,515,513,1,0,0,0,516,518,5,46,0,0,517,519,3,127,62,0,518,517,1,0,
0,0,519,520,1,0,0,0,520,518,1,0,0,0,520,521,1,0,0,0,521,522,1,0,0,0,522,
523,4,64,1,0,523,525,1,0,0,0,524,505,1,0,0,0,524,516,1,0,0,0,525,132,1,0,
0,0,526,529,5,36,0,0,527,530,3,129,63,0,528,530,3,131,64,0,529,527,1,0,0,
0,529,528,1,0,0,0,530,134,1,0,0,0,531,533,3,127,62,0,532,531,1,0,0,0,533,
534,1,0,0,0,534,532,1,0,0,0,534,535,1,0,0,0,535,536,1,0,0,0,536,540,5,46,
0,0,537,539,3,127,62,0,538,537,1,0,0,0,539,542,1,0,0,0,540,538,1,0,0,0,540,
541,1,0,0,0,541,555,1,0,0,0,542,540,1,0,0,0,543,545,5,46,0,0,544,546,3,127,
62,0,545,544,1,0,0,0,546,547,1,0,0,0,547,545,1,0,0,0,547,548,1,0,0,0,548,
555,1,0,0,0,549,551,3,127,62,0,550,549,1,0,0,0,551,552,1,0,0,0,552,550,1,
0,0,0,552,553,1,0,0,0,553,555,1,0,0,0,554,532,1,0,0,0,554,543,1,0,0,0,554,
550,1,0,0,0,555,556,1,0,0,0,556,557,3,139,68,0,557,136,1,0,0,0,558,560,3,
127,62,0,559,558,1,0,0,0,560,561,1,0,0,0,561,559,1,0,0,0,561,562,1,0,0,0,
562,563,1,0,0,0,563,567,7,6,0,0,564,566,7,4,0,0,565,564,1,0,0,0,566,569,
1,0,0,0,567,565,1,0,0,0,567,568,1,0,0,0,568,138,1,0,0,0,569,567,1,0,0,0,
570,575,3,141,69,0,571,575,3,143,70,0,572,575,3,145,71,0,573,575,3,147,72,
0,574,570,1,0,0,0,574,571,1,0,0,0,574,572,1,0,0,0,574,573,1,0,0,0,575,140,
1,0,0,0,576,577,5,109,0,0,577,578,5,105,0,0,578,579,5,108,0,0,579,580,5,
108,0,0,580,581,5,105,0,0,581,582,5,115,0,0,582,583,5,101,0,0,583,584,5,
99,0,0,584,585,5,111,0,0,585,586,5,110,0,0,586,587,5,100,0,0,587,676,5,115,
0,0,588,589,5,109,0,0,589,590,5,105,0,0,590,591,5,108,0,0,591,592,5,108,
0,0,592,593,5,105,0,0,593,594,5,115,0,0,594,595,5,101,0,0,595,596,5,99,0,
0,596,597,5,111,0,0,597,598,5,110,0,0,598,676,5,100,0,0,599,600,5,109,0,
0,600,676,5,115,0,0,601,602,5,115,0,0,602,603,5,101,0,0,603,604,5,99,0,0,
604,605,5,111,0,0,605,606,5,110,0,0,606,607,5,100,0,0,607,676,5,115,0,0,
608,609,5,115,0,0,609,610,5,101,0,0,610,611,5,99,0,0,611,612,5,111,0,0,612,
613,5,110,0,0,613,676,5,100,0,0,614,615,5,115,0,0,615,616,5,101,0,0,616,
617,5,99,0,0,617,676,5,115,0,0,618,619,5,115,0,0,619,620,5,101,0,0,620,676,
5,99,0,0,621,676,5,115,0,0,622,623,5,109,0,0,623,624,5,105,0,0,624,625,5,
110,0,0,625,626,5,117,0,0,626,627,5,116,0,0,627,628,5,101,0,0,628,676,5,
115,0,0,629,630,5,109,0,0,630,631,5,105,0,0,631,632,5,110,0,0,632,633,5,
117,0,0,633,634,5,116,0,0,634,676,5,101,0,0,635,636,5,109,0,0,636,637,5,
105,0,0,637,638,5,110,0,0,638,676,5,115,0,0,639,640,5,109,0,0,640,641,5,
105,0,0,641,676,5,110,0,0,642,643,5,104,0,0,643,644,5,111,0,0,644,645,5,
117,0,0,645,646,5,114,0,0,646,676,5,115,0,0,647,648,5,104,0,0,648,649,5,
111,0,0,649,650,5,117,0,0,650,676,5,114,0,0,651,652,5,104,0,0,652,653,5,
114,0,0,653,676,5,115,0,0,654,655,5,104,0,0,655,676,5,114,0,0,656,676,5,
104,0,0,657,658,5,100,0,0,658,659,5,97,0,0,659,660,5,121,0,0,660,676,5,115,
0,0,661,662,5,100,0,0,662,663,5,97,0,0,663,676,5,121,0,0,664,676,5,100,0,
0,665,666,5,119,0,0,666,667,5,101,0,0,667,668,5,101,0,0,668,669,5,107,0,
0,669,676,5,115,0,0,670,671,5,119,0,0,671,672,5,101,0,0,672,673,5,101,0,
0,673,676,5,107,0,0,674,676,5,119,0,0,675,576,1,0,0,0,675,588,1,0,0,0,675,
599,1,0,0,0,675,601,1,0,0,0,675,608,1,0,0,0,675,614,1,0,0,0,675,618,1,0,
0,0,675,621,1,0,0,0,675,622,1,0,0,0,675,629,1,0,0,0,675,635,1,0,0,0,675,
639,1,0,0,0,675,642,1,0,0,0,675,647,1,0,0,0,675,651,1,0,0,0,675,654,1,0,
0,0,675,656,1,0,0,0,675,657,1,0,0,0,675,661,1,0,0,0,675,664,1,0,0,0,675,
665,1,0,0,0,675,670,1,0,0,0,675,674,1,0,0,0,676,142,1,0,0,0,677,678,5,75,
0,0,678,679,5,105,0,0,679,707,5,66,0,0,680,681,5,77,0,0,681,682,5,105,0,
0,682,707,5,66,0,0,683,684,5,71,0,0,684,685,5,105,0,0,685,707,5,66,0,0,686,
687,5,84,0,0,687,688,5,105,0,0,688,707,5,66,0,0,689,690,5,75,0,0,690,707,
5,66,0,0,691,692,5,77,0,0,692,707,5,66,0,0,693,694,5,71,0,0,694,707,5,66,
0,0,695,696,5,84,0,0,696,707,5,66,0,0,697,698,5,107,0,0,698,707,5,98,0,0,
699,700,5,109,0,0,700,707,5,98,0,0,701,702,5,103,0,0,702,707,5,98,0,0,703,
704,5,116,0,0,704,707,5,98,0,0,705,707,5,66,0,0,706,677,1,0,0,0,706,680,
1,0,0,0,706,683,1,0,0,0,706,686,1,0,0,0,706,689,1,0,0,0,706,691,1,0,0,0,
706,693,1,0,0,0,706,695,1,0,0,0,706,697,1,0,0,0,706,699,1,0,0,0,706,701,
1,0,0,0,706,703,1,0,0,0,706,705,1,0,0,0,707,144,1,0,0,0,708,709,5,114,0,
0,709,710,5,101,0,0,710,723,5,109,0,0,711,712,5,101,0,0,712,723,5,109,0,
0,713,714,5,112,0,0,714,723,5,120,0,0,715,716,5,109,0,0,716,723,5,109,0,
0,717,718,5,99,0,0,718,723,5,109,0,0,719,720,5,107,0,0,720,723,5,109,0,0,
721,723,5,109,0,0,722,708,1,0,0,0,722,711,1,0,0,0,722,713,1,0,0,0,722,715,
1,0,0,0,722,717,1,0,0,0,722,719,1,0,0,0,722,721,1,0,0,0,723,146,1,0,0,0,
724,725,5,109,0,0,725,730,5,103,0,0,726,727,5,107,0,0,727,730,5,103,0,0,
728,730,5,103,0,0,729,724,1,0,0,0,729,726,1,0,0,0,729,728,1,0,0,0,730,148,
1,0,0,0,731,737,5,34,0,0,732,733,5,34,0,0,733,736,5,34,0,0,734,736,8,7,0,
0,735,732,1,0,0,0,735,734,1,0,0,0,736,739,1,0,0,0,737,735,1,0,0,0,737,738,
1,0,0,0,738,740,1,0,0,0,739,737,1,0,0,0,740,741,5,34,0,0,741,150,1,0,0,0,
742,748,5,34,0,0,743,744,5,34,0,0,744,747,5,34,0,0,745,747,8,7,0,0,746,743,
1,0,0,0,746,745,1,0,0,0,747,750,1,0,0,0,748,746,1,0,0,0,748,749,1,0,0,0,
749,152,1,0,0,0,750,748,1,0,0,0,751,752,7,8,0,0,752,753,1,0,0,0,753,754,
6,75,0,0,754,154,1,0,0,0,755,756,5,47,0,0,756,757,5,47,0,0,757,761,1,0,0,
0,758,760,8,8,0,0,759,758,1,0,0,0,760,763,1,0,0,0,761,759,1,0,0,0,761,762,
1,0,0,0,762,764,1,0,0,0,763,761,1,0,0,0,764,765,6,76,4,0,765,156,1,0,0,0,
766,767,9,0,0,0,767,158,1,0,0,0,768,770,3,3,0,0,769,768,1,0,0,0,770,773,
1,0,0,0,771,769,1,0,0,0,771,772,1,0,0,0,772,774,1,0,0,0,773,771,1,0,0,0,
774,775,5,61,0,0,775,776,5,61,0,0,776,780,1,0,0,0,777,779,8,8,0,0,778,777,
1,0,0,0,779,782,1,0,0,0,780,778,1,0,0,0,780,781,1,0,0,0,781,783,1,0,0,0,
782,780,1,0,0,0,783,784,4,78,2,0,784,160,1,0,0,0,785,787,8,8,0,0,786,785,
1,0,0,0,787,788,1,0,0,0,788,786,1,0,0,0,788,789,1,0,0,0,789,162,1,0,0,0,
790,791,7,8,0,0,791,792,1,0,0,0,792,793,6,80,5,0,793,164,1,0,0,0,794,796,
8,8,0,0,795,794,1,0,0,0,796,797,1,0,0,0,797,795,1,0,0,0,797,798,1,0,0,0,
798,166,1,0,0,0,799,800,7,8,0,0,800,801,1,0,0,0,801,802,6,82,5,0,802,168,
1,0,0,0,39,0,1,2,174,247,321,357,405,451,479,485,494,502,507,513,520,524,
529,534,540,547,552,554,561,567,574,675,706,722,729,735,737,746,748,761,
771,780,788,797,6,0,1,0,0,3,0,5,2,0,5,1,0,0,2,0,4,0,0];


const atn$1 = new antlr4.atn.ATNDeserializer().deserialize(serializedATN$1);

const decisionsToDFA$1 = atn$1.decisionToState.map( (ds, index) => new antlr4.dfa.DFA(ds, index) );

class sequenceLexer extends antlr4.Lexer {

    static grammarFileName = "sequenceLexer.g4";
    static channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN", "COMMENT_CHANNEL", 
                                                               "MODIFIER_CHANNEL" ];
	static modeNames = [ "DEFAULT_MODE", "EVENT", "TITLE_MODE" ];
	static literalNames = [ null, null, "'const'", "'readonly'", "'static'", 
                         "'await'", null, "':'", "'<<'", "'>>'", "'-->'", 
                         "'->'", null, "'['", "']'", "'||'", "'&&'", "'=='", 
                         "'!='", "'>'", "'<'", "'>='", "'<='", "'+'", "'-'", 
                         "'*'", "'/'", "'%'", "'^'", "'!'", "';'", "','", 
                         "'='", "'('", "')'", "'{'", "'}'", "'true'", "'false'", 
                         null, "'if'", "'else'", null, "'return'", "'new'", 
                         "'par'", "'group'", "'opt'", "'critical'", null, 
                         "'ref'", "'as'", "'try'", "'catch'", "'finally'", 
                         "'in'", null, null, null, "'.'" ];
	static symbolicNames = [ null, "WS", "CONSTANT", "READONLY", "STATIC", 
                          "AWAIT", "TITLE", "COL", "SOPEN", "SCLOSE", "RETURN_ARROW", 
                          "ARROW", "COLOR", "LBRACKET", "RBRACKET", "OR", 
                          "AND", "EQ", "NEQ", "GT", "LT", "GTEQ", "LTEQ", 
                          "PLUS", "MINUS", "MULT", "DIV", "MOD", "POW", 
                          "NOT", "SCOL", "COMMA", "ASSIGN", "OPAR", "CPAR", 
                          "OBRACE", "CBRACE", "TRUE", "FALSE", "NIL", "IF", 
                          "ELSE", "WHILE", "RETURN", "NEW", "PAR", "GROUP", 
                          "OPT", "CRITICAL", "SECTION", "REF", "AS", "TRY", 
                          "CATCH", "FINALLY", "IN", "STARTER_LXR", "ANNOTATION_RET", 
                          "ANNOTATION", "DOT", "ID", "INT", "FLOAT", "MONEY", 
                          "NUMBER_UNIT", "DIGIT_LEADING_NAME", "CSTRING", 
                          "USTRING", "CR", "COMMENT", "OTHER", "DIVIDER", 
                          "EVENT_PAYLOAD_LXR", "EVENT_END", "TITLE_CONTENT", 
                          "TITLE_END" ];
	static ruleNames = [ "HWS", "WS", "CONSTANT", "READONLY", "STATIC", "AWAIT", 
                      "TITLE", "COL", "SOPEN", "SCLOSE", "RETURN_ARROW", 
                      "ARROW", "HEX", "COLOR", "LBRACKET", "RBRACKET", "OR", 
                      "AND", "EQ", "NEQ", "GT", "LT", "GTEQ", "LTEQ", "PLUS", 
                      "MINUS", "MULT", "DIV", "MOD", "POW", "NOT", "SCOL", 
                      "COMMA", "ASSIGN", "OPAR", "CPAR", "OBRACE", "CBRACE", 
                      "TRUE", "FALSE", "NIL", "IF", "ELSE", "WHILE", "RETURN", 
                      "NEW", "PAR", "GROUP", "OPT", "CRITICAL", "SECTION", 
                      "REF", "AS", "TRY", "CATCH", "FINALLY", "IN", "STARTER_LXR", 
                      "ANNOTATION_RET", "ANNOTATION", "DOT", "ID", "DIGIT", 
                      "INT", "FLOAT", "MONEY", "NUMBER_UNIT", "DIGIT_LEADING_NAME", 
                      "KNOWN_UNIT", "TIME_UNIT", "SIZE_UNIT", "LENGTH_UNIT", 
                      "MASS_UNIT", "CSTRING", "USTRING", "CR", "COMMENT", 
                      "OTHER", "DIVIDER", "EVENT_PAYLOAD_LXR", "EVENT_END", 
                      "TITLE_CONTENT", "TITLE_END" ];

    constructor(input) {
        super(input);
        this._interp = new antlr4.atn.LexerATNSimulator(this, atn$1, decisionsToDFA$1, new antlr4.PredictionContextCache());

          // 1. title must be at the beginning
          // 2. title must not be followed by '.', '(', '='
          this.isTitle = function() {
            // Check if 'title' appears at the beginning (only whitespace/comments before it)
            const currentPos = this._tokenStartCharIndex;
            const preceding = this._input.getText(0, currentPos - 1)
              .replace(/\/\/[^\n]*(?:\n|$)/g, '')
              .trim();
            if (preceding.length) return false;

            // Look ahead past 'title' and any whitespace to check what follows
            const SPACE = 32, TAB = 9, EOF = -1, DOT = 46, EQUALS = 61, OPEN_PAREN = 40;
            // Right-edge predicate: input is already past 'title', so LA(1)
            // is the first character after the keyword.
            let pos = 1, next = this._input.LA(pos);

            // Skip past any whitespace
            while (next === SPACE || next === TAB) {
              ++pos;
              next = this._input.LA(pos);
            }

            // Title directive if EOF or not followed by '.', '(', '='
            return next === EOF || (next !== DOT && next !== EQUALS && next !== OPEN_PAREN);
          };

          this.isNameStartAhead = function() {
            const next = this._input.LA(1);
            return next !== -1 && /[\p{L}_]/u.test(String.fromCodePoint(next));
          };

    }

    get atn() {
        return atn$1;
    }
}

sequenceLexer.EOF = antlr4.Token.EOF;
sequenceLexer.WS = 1;
sequenceLexer.CONSTANT = 2;
sequenceLexer.READONLY = 3;
sequenceLexer.STATIC = 4;
sequenceLexer.AWAIT = 5;
sequenceLexer.TITLE = 6;
sequenceLexer.COL = 7;
sequenceLexer.SOPEN = 8;
sequenceLexer.SCLOSE = 9;
sequenceLexer.RETURN_ARROW = 10;
sequenceLexer.ARROW = 11;
sequenceLexer.COLOR = 12;
sequenceLexer.LBRACKET = 13;
sequenceLexer.RBRACKET = 14;
sequenceLexer.OR = 15;
sequenceLexer.AND = 16;
sequenceLexer.EQ = 17;
sequenceLexer.NEQ = 18;
sequenceLexer.GT = 19;
sequenceLexer.LT = 20;
sequenceLexer.GTEQ = 21;
sequenceLexer.LTEQ = 22;
sequenceLexer.PLUS = 23;
sequenceLexer.MINUS = 24;
sequenceLexer.MULT = 25;
sequenceLexer.DIV = 26;
sequenceLexer.MOD = 27;
sequenceLexer.POW = 28;
sequenceLexer.NOT = 29;
sequenceLexer.SCOL = 30;
sequenceLexer.COMMA = 31;
sequenceLexer.ASSIGN = 32;
sequenceLexer.OPAR = 33;
sequenceLexer.CPAR = 34;
sequenceLexer.OBRACE = 35;
sequenceLexer.CBRACE = 36;
sequenceLexer.TRUE = 37;
sequenceLexer.FALSE = 38;
sequenceLexer.NIL = 39;
sequenceLexer.IF = 40;
sequenceLexer.ELSE = 41;
sequenceLexer.WHILE = 42;
sequenceLexer.RETURN = 43;
sequenceLexer.NEW = 44;
sequenceLexer.PAR = 45;
sequenceLexer.GROUP = 46;
sequenceLexer.OPT = 47;
sequenceLexer.CRITICAL = 48;
sequenceLexer.SECTION = 49;
sequenceLexer.REF = 50;
sequenceLexer.AS = 51;
sequenceLexer.TRY = 52;
sequenceLexer.CATCH = 53;
sequenceLexer.FINALLY = 54;
sequenceLexer.IN = 55;
sequenceLexer.STARTER_LXR = 56;
sequenceLexer.ANNOTATION_RET = 57;
sequenceLexer.ANNOTATION = 58;
sequenceLexer.DOT = 59;
sequenceLexer.ID = 60;
sequenceLexer.INT = 61;
sequenceLexer.FLOAT = 62;
sequenceLexer.MONEY = 63;
sequenceLexer.NUMBER_UNIT = 64;
sequenceLexer.DIGIT_LEADING_NAME = 65;
sequenceLexer.CSTRING = 66;
sequenceLexer.USTRING = 67;
sequenceLexer.CR = 68;
sequenceLexer.COMMENT = 69;
sequenceLexer.OTHER = 70;
sequenceLexer.DIVIDER = 71;
sequenceLexer.EVENT_PAYLOAD_LXR = 72;
sequenceLexer.EVENT_END = 73;
sequenceLexer.TITLE_CONTENT = 74;
sequenceLexer.TITLE_END = 75;

sequenceLexer.COMMENT_CHANNEL = 2;
sequenceLexer.MODIFIER_CHANNEL = 3;

sequenceLexer.EVENT = 1;
sequenceLexer.TITLE_MODE = 2;


sequenceLexer.prototype.sempred = function(localctx, ruleIndex, predIndex) {
	switch (ruleIndex) {
		case 6:
			return this.TITLE_sempred(localctx, predIndex);
		case 64:
			return this.FLOAT_sempred(localctx, predIndex);
		case 78:
			return this.DIVIDER_sempred(localctx, predIndex);
    	default:
    		throw "No registered predicate for:" + ruleIndex;
    }
};

sequenceLexer.prototype.TITLE_sempred = function(localctx, predIndex) {
	switch(predIndex) {
		case 0:
			return this.isTitle();
		default:
			throw "No predicate with index:" + predIndex;
	}
};

sequenceLexer.prototype.FLOAT_sempred = function(localctx, predIndex) {
	switch(predIndex) {
		case 1:
			return !this.isNameStartAhead();
		default:
			throw "No predicate with index:" + predIndex;
	}
};

sequenceLexer.prototype.DIVIDER_sempred = function(localctx, predIndex) {
	switch(predIndex) {
		case 2:
			return this._tokenStartColumn === 0;
		default:
			throw "No predicate with index:" + predIndex;
	}
};

// Generated from java-escape by ANTLR 4.11.1
// jshint ignore: start

// This class defines a complete listener for a parse tree produced by sequenceParser.
class sequenceParserListener extends antlr4.tree.ParseTreeListener {

	// Enter a parse tree produced by sequenceParser#prog.
	enterProg(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#prog.
	exitProg(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#title.
	enterTitle(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#title.
	exitTitle(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#head.
	enterHead(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#head.
	exitHead(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#group.
	enterGroup(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#group.
	exitGroup(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#starterExp.
	enterStarterExp(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#starterExp.
	exitStarterExp(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#starter.
	enterStarter(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#starter.
	exitStarter(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#participant.
	enterParticipant(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#participant.
	exitParticipant(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#stereotype.
	enterStereotype(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#stereotype.
	exitStereotype(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#label.
	enterLabel(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#label.
	exitLabel(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#participantType.
	enterParticipantType(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#participantType.
	exitParticipantType(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#name.
	enterName(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#name.
	exitName(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#width.
	enterWidth(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#width.
	exitWidth(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#emoji.
	enterEmoji(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#emoji.
	exitEmoji(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#block.
	enterBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#block.
	exitBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#ret.
	enterRet(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#ret.
	exitRet(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#returnAsyncMessage.
	enterReturnAsyncMessage(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#returnAsyncMessage.
	exitReturnAsyncMessage(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#divider.
	enterDivider(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#divider.
	exitDivider(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#dividerNote.
	enterDividerNote(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#dividerNote.
	exitDividerNote(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#stat.
	enterStat(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#stat.
	exitStat(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#par.
	enterPar(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#par.
	exitPar(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#opt.
	enterOpt(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#opt.
	exitOpt(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#critical.
	enterCritical(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#critical.
	exitCritical(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#section.
	enterSection(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#section.
	exitSection(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#creation.
	enterCreation(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#creation.
	exitCreation(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#ref.
	enterRef(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#ref.
	exitRef(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#creationBody.
	enterCreationBody(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#creationBody.
	exitCreationBody(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#message.
	enterMessage(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#message.
	exitMessage(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#messageBody.
	enterMessageBody(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#messageBody.
	exitMessageBody(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#fromTo.
	enterFromTo(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#fromTo.
	exitFromTo(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#func.
	enterFunc(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#func.
	exitFunc(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#from.
	enterFrom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#from.
	exitFrom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#to.
	enterTo(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#to.
	exitTo(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#signature.
	enterSignature(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#signature.
	exitSignature(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#invocation.
	enterInvocation(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#invocation.
	exitInvocation(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#assignment.
	enterAssignment(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#assignment.
	exitAssignment(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#asyncMessage.
	enterAsyncMessage(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#asyncMessage.
	exitAsyncMessage(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#content.
	enterContent(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#content.
	exitContent(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#construct.
	enterConstruct(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#construct.
	exitConstruct(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#type.
	enterType(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#type.
	exitType(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#assignee.
	enterAssignee(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#assignee.
	exitAssignee(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#methodName.
	enterMethodName(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#methodName.
	exitMethodName(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#parameters.
	enterParameters(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#parameters.
	exitParameters(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#parameter.
	enterParameter(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#parameter.
	exitParameter(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#namedParameter.
	enterNamedParameter(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#namedParameter.
	exitNamedParameter(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#declaration.
	enterDeclaration(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#declaration.
	exitDeclaration(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#tcf.
	enterTcf(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#tcf.
	exitTcf(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#tryBlock.
	enterTryBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#tryBlock.
	exitTryBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#catchBlock.
	enterCatchBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#catchBlock.
	exitCatchBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#finallyBlock.
	enterFinallyBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#finallyBlock.
	exitFinallyBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#alt.
	enterAlt(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#alt.
	exitAlt(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#ifBlock.
	enterIfBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#ifBlock.
	exitIfBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#elseIfBlock.
	enterElseIfBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#elseIfBlock.
	exitElseIfBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#elseBlock.
	enterElseBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#elseBlock.
	exitElseBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#braceBlock.
	enterBraceBlock(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#braceBlock.
	exitBraceBlock(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#loop.
	enterLoop(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#loop.
	exitLoop(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#assignmentExpr.
	enterAssignmentExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#assignmentExpr.
	exitAssignmentExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#funcExpr.
	enterFuncExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#funcExpr.
	exitFuncExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#atomExpr.
	enterAtomExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#atomExpr.
	exitAtomExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#orExpr.
	enterOrExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#orExpr.
	exitOrExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#additiveExpr.
	enterAdditiveExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#additiveExpr.
	exitAdditiveExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#relationalExpr.
	enterRelationalExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#relationalExpr.
	exitRelationalExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#plusExpr.
	enterPlusExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#plusExpr.
	exitPlusExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#notExpr.
	enterNotExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#notExpr.
	exitNotExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#unaryMinusExpr.
	enterUnaryMinusExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#unaryMinusExpr.
	exitUnaryMinusExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#creationExpr.
	enterCreationExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#creationExpr.
	exitCreationExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#parenthesizedExpr.
	enterParenthesizedExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#parenthesizedExpr.
	exitParenthesizedExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#multiplicationExpr.
	enterMultiplicationExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#multiplicationExpr.
	exitMultiplicationExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#equalityExpr.
	enterEqualityExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#equalityExpr.
	exitEqualityExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#andExpr.
	enterAndExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#andExpr.
	exitAndExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#numberAtom.
	enterNumberAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#numberAtom.
	exitNumberAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#numberUnitAtom.
	enterNumberUnitAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#numberUnitAtom.
	exitNumberUnitAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#moneyAtom.
	enterMoneyAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#moneyAtom.
	exitMoneyAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#booleanAtom.
	enterBooleanAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#booleanAtom.
	exitBooleanAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#idAtom.
	enterIdAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#idAtom.
	exitIdAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#digitLeadingNameAtom.
	enterDigitLeadingNameAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#digitLeadingNameAtom.
	exitDigitLeadingNameAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#stringAtom.
	enterStringAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#stringAtom.
	exitStringAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#nilAtom.
	enterNilAtom(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#nilAtom.
	exitNilAtom(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#parExpr.
	enterParExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#parExpr.
	exitParExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#condition.
	enterCondition(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#condition.
	exitCondition(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#inExpr.
	enterInExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#inExpr.
	exitInExpr(ctx) {
	}


	// Enter a parse tree produced by sequenceParser#textExpr.
	enterTextExpr(ctx) {
	}

	// Exit a parse tree produced by sequenceParser#textExpr.
	exitTextExpr(ctx) {
	}



}

// Generated from java-escape by ANTLR 4.11.1
// jshint ignore: start
const serializedATN = [4,1,76,658,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,
4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,
2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,
20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,
7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,
34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,
2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,
49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,
7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,1,0,3,0,124,8,0,1,0,1,0,3,0,
128,8,0,1,0,1,0,1,0,1,0,3,0,134,8,0,1,0,3,0,137,8,0,1,0,1,0,1,0,3,0,142,
8,0,1,1,1,1,3,1,146,8,1,1,1,3,1,149,8,1,1,2,1,2,4,2,153,8,2,11,2,12,2,154,
1,2,1,2,5,2,159,8,2,10,2,12,2,162,9,2,1,2,3,2,165,8,2,1,3,1,3,3,3,169,8,
3,1,3,1,3,5,3,173,8,3,10,3,12,3,176,9,3,1,3,3,3,179,8,3,3,3,181,8,3,1,4,
1,4,1,4,3,4,186,8,4,1,4,3,4,189,8,4,1,4,3,4,192,8,4,1,5,1,5,1,6,3,6,197,
8,6,1,6,3,6,200,8,6,1,6,3,6,203,8,6,1,6,1,6,3,6,207,8,6,1,6,3,6,210,8,6,
1,6,3,6,213,8,6,1,6,1,6,3,6,217,8,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,3,7,226,
8,7,1,7,1,7,3,7,230,8,7,3,7,232,8,7,1,8,1,8,1,8,3,8,237,8,8,1,9,1,9,1,10,
1,10,1,11,1,11,1,12,1,12,1,12,1,12,1,12,3,12,250,8,12,1,13,4,13,253,8,13,
11,13,12,13,254,1,14,1,14,3,14,259,8,14,1,14,3,14,262,8,14,1,14,1,14,1,14,
3,14,267,8,14,1,14,1,14,3,14,271,8,14,3,14,273,8,14,1,15,1,15,1,15,1,15,
1,15,3,15,280,8,15,1,15,1,15,1,15,3,15,285,8,15,3,15,287,8,15,1,16,1,16,
1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,3,18,304,
8,18,1,18,1,18,1,18,3,18,309,8,18,1,19,1,19,3,19,313,8,19,1,19,1,19,3,19,
317,8,19,1,20,1,20,3,20,321,8,20,1,20,1,20,3,20,325,8,20,1,21,1,21,3,21,
329,8,21,1,21,1,21,3,21,333,8,21,1,22,1,22,1,22,3,22,338,8,22,1,22,3,22,
341,8,22,1,22,1,22,1,22,3,22,346,8,22,1,23,1,23,1,23,3,23,351,8,23,1,24,
1,24,1,24,1,24,1,24,5,24,358,8,24,10,24,12,24,361,9,24,5,24,363,8,24,10,
24,12,24,366,9,24,1,24,1,24,3,24,370,8,24,1,25,3,25,373,8,25,1,25,1,25,1,
25,1,25,3,25,379,8,25,1,25,3,25,382,8,25,1,25,3,25,385,8,25,1,25,3,25,388,
8,25,1,26,1,26,1,26,3,26,393,8,26,1,27,1,27,1,27,3,27,398,8,27,1,27,3,27,
401,8,27,1,27,1,27,3,27,405,8,27,1,27,3,27,408,8,27,1,28,1,28,1,28,3,28,
413,8,28,1,28,1,28,1,28,1,29,1,29,1,29,5,29,421,8,29,10,29,12,29,424,9,29,
1,30,3,30,427,8,30,1,30,1,30,1,31,3,31,432,8,31,1,31,1,31,1,32,1,32,3,32,
438,8,32,1,33,1,33,3,33,442,8,33,1,33,1,33,1,34,3,34,447,8,34,1,34,1,34,
1,34,1,35,1,35,1,35,3,35,455,8,35,1,35,1,35,1,35,3,35,460,8,35,1,35,1,35,
1,35,3,35,465,8,35,3,35,467,8,35,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,
1,39,1,39,5,39,479,8,39,10,39,12,39,482,9,39,1,39,1,39,1,39,3,39,487,8,39,
1,40,3,40,490,8,40,1,40,1,40,1,41,1,41,1,41,5,41,497,8,41,10,41,12,41,500,
9,41,1,41,3,41,503,8,41,1,42,1,42,1,42,3,42,508,8,42,1,43,1,43,1,43,3,43,
513,8,43,1,44,1,44,1,44,1,45,1,45,5,45,520,8,45,10,45,12,45,523,9,45,1,45,
3,45,526,8,45,1,46,1,46,1,46,1,47,1,47,3,47,533,8,47,1,47,1,47,1,48,1,48,
1,48,1,49,1,49,5,49,542,8,49,10,49,12,49,545,9,49,1,49,3,49,548,8,49,1,50,
1,50,1,50,3,50,553,8,50,1,51,1,51,1,51,1,51,3,51,559,8,51,1,52,1,52,3,52,
563,8,52,1,53,1,53,3,53,567,8,53,1,53,1,53,1,54,1,54,3,54,573,8,54,1,54,
3,54,576,8,54,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,3,55,587,8,55,
1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,3,55,598,8,55,1,55,1,55,1,55,
1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,
55,1,55,1,55,1,55,5,55,621,8,55,10,55,12,55,624,9,55,1,56,1,56,1,56,1,56,
1,56,1,56,1,56,1,56,3,56,634,8,56,1,57,1,57,3,57,638,8,57,1,57,3,57,641,
8,57,1,58,1,58,1,58,1,58,3,58,647,8,58,1,59,1,59,1,59,1,59,1,60,4,60,654,
8,60,11,60,12,60,655,1,60,0,1,110,61,0,2,4,6,8,10,12,14,16,18,20,22,24,26,
28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,
76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,
118,120,0,13,2,0,8,8,20,20,2,0,9,9,19,19,2,0,60,60,65,67,2,0,11,11,24,24,
2,0,60,60,65,65,1,0,25,27,1,0,23,24,1,0,19,22,1,0,17,18,1,0,61,62,1,0,37,
38,1,0,66,67,2,0,60,60,64,65,741,0,141,1,0,0,0,2,143,1,0,0,0,4,164,1,0,0,
0,6,166,1,0,0,0,8,191,1,0,0,0,10,193,1,0,0,0,12,216,1,0,0,0,14,231,1,0,0,
0,16,236,1,0,0,0,18,238,1,0,0,0,20,240,1,0,0,0,22,242,1,0,0,0,24,249,1,0,
0,0,26,252,1,0,0,0,28,272,1,0,0,0,30,286,1,0,0,0,32,288,1,0,0,0,34,290,1,
0,0,0,36,308,1,0,0,0,38,316,1,0,0,0,40,324,1,0,0,0,42,332,1,0,0,0,44,345,
1,0,0,0,46,347,1,0,0,0,48,352,1,0,0,0,50,387,1,0,0,0,52,389,1,0,0,0,54,407,
1,0,0,0,56,412,1,0,0,0,58,417,1,0,0,0,60,426,1,0,0,0,62,431,1,0,0,0,64,435,
1,0,0,0,66,439,1,0,0,0,68,446,1,0,0,0,70,466,1,0,0,0,72,468,1,0,0,0,74,470,
1,0,0,0,76,472,1,0,0,0,78,486,1,0,0,0,80,489,1,0,0,0,82,493,1,0,0,0,84,507,
1,0,0,0,86,509,1,0,0,0,88,514,1,0,0,0,90,517,1,0,0,0,92,527,1,0,0,0,94,530,
1,0,0,0,96,536,1,0,0,0,98,539,1,0,0,0,100,549,1,0,0,0,102,554,1,0,0,0,104,
560,1,0,0,0,106,564,1,0,0,0,108,570,1,0,0,0,110,597,1,0,0,0,112,633,1,0,
0,0,114,635,1,0,0,0,116,646,1,0,0,0,118,648,1,0,0,0,120,653,1,0,0,0,122,
124,3,2,1,0,123,122,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,142,5,0,
0,1,126,128,3,2,1,0,127,126,1,0,0,0,127,128,1,0,0,0,128,129,1,0,0,0,129,
130,3,4,2,0,130,131,5,0,0,1,131,142,1,0,0,0,132,134,3,2,1,0,133,132,1,0,
0,0,133,134,1,0,0,0,134,136,1,0,0,0,135,137,3,4,2,0,136,135,1,0,0,0,136,
137,1,0,0,0,137,138,1,0,0,0,138,139,3,26,13,0,139,140,5,0,0,1,140,142,1,
0,0,0,141,123,1,0,0,0,141,127,1,0,0,0,141,133,1,0,0,0,142,1,1,0,0,0,143,
145,5,6,0,0,144,146,5,74,0,0,145,144,1,0,0,0,145,146,1,0,0,0,146,148,1,0,
0,0,147,149,5,75,0,0,148,147,1,0,0,0,148,149,1,0,0,0,149,3,1,0,0,0,150,153,
3,6,3,0,151,153,3,12,6,0,152,150,1,0,0,0,152,151,1,0,0,0,153,154,1,0,0,0,
154,152,1,0,0,0,154,155,1,0,0,0,155,165,1,0,0,0,156,159,3,6,3,0,157,159,
3,12,6,0,158,156,1,0,0,0,158,157,1,0,0,0,159,162,1,0,0,0,160,158,1,0,0,0,
160,161,1,0,0,0,161,163,1,0,0,0,162,160,1,0,0,0,163,165,3,8,4,0,164,152,
1,0,0,0,164,160,1,0,0,0,165,5,1,0,0,0,166,168,5,46,0,0,167,169,3,20,10,0,
168,167,1,0,0,0,168,169,1,0,0,0,169,180,1,0,0,0,170,174,5,35,0,0,171,173,
3,12,6,0,172,171,1,0,0,0,173,176,1,0,0,0,174,172,1,0,0,0,174,175,1,0,0,0,
175,178,1,0,0,0,176,174,1,0,0,0,177,179,5,36,0,0,178,177,1,0,0,0,178,179,
1,0,0,0,179,181,1,0,0,0,180,170,1,0,0,0,180,181,1,0,0,0,181,7,1,0,0,0,182,
188,5,56,0,0,183,185,5,33,0,0,184,186,3,10,5,0,185,184,1,0,0,0,185,186,1,
0,0,0,186,187,1,0,0,0,187,189,5,34,0,0,188,183,1,0,0,0,188,189,1,0,0,0,189,
192,1,0,0,0,190,192,5,58,0,0,191,182,1,0,0,0,191,190,1,0,0,0,192,9,1,0,0,
0,193,194,3,20,10,0,194,11,1,0,0,0,195,197,3,18,9,0,196,195,1,0,0,0,196,
197,1,0,0,0,197,199,1,0,0,0,198,200,3,14,7,0,199,198,1,0,0,0,199,200,1,0,
0,0,200,202,1,0,0,0,201,203,3,24,12,0,202,201,1,0,0,0,202,203,1,0,0,0,203,
204,1,0,0,0,204,206,3,20,10,0,205,207,3,22,11,0,206,205,1,0,0,0,206,207,
1,0,0,0,207,209,1,0,0,0,208,210,3,16,8,0,209,208,1,0,0,0,209,210,1,0,0,0,
210,212,1,0,0,0,211,213,5,12,0,0,212,211,1,0,0,0,212,213,1,0,0,0,213,217,
1,0,0,0,214,217,3,14,7,0,215,217,3,18,9,0,216,196,1,0,0,0,216,214,1,0,0,
0,216,215,1,0,0,0,217,13,1,0,0,0,218,219,5,8,0,0,219,220,3,20,10,0,220,221,
5,9,0,0,221,232,1,0,0,0,222,223,5,8,0,0,223,225,3,20,10,0,224,226,5,19,0,
0,225,224,1,0,0,0,225,226,1,0,0,0,226,232,1,0,0,0,227,229,7,0,0,0,228,230,
7,1,0,0,229,228,1,0,0,0,229,230,1,0,0,0,230,232,1,0,0,0,231,218,1,0,0,0,
231,222,1,0,0,0,231,227,1,0,0,0,232,15,1,0,0,0,233,234,5,51,0,0,234,237,
3,20,10,0,235,237,5,51,0,0,236,233,1,0,0,0,236,235,1,0,0,0,237,17,1,0,0,
0,238,239,5,58,0,0,239,19,1,0,0,0,240,241,7,2,0,0,241,21,1,0,0,0,242,243,
5,61,0,0,243,23,1,0,0,0,244,245,5,13,0,0,245,246,3,20,10,0,246,247,5,14,
0,0,247,250,1,0,0,0,248,250,5,76,0,0,249,244,1,0,0,0,249,248,1,0,0,0,250,
25,1,0,0,0,251,253,3,36,18,0,252,251,1,0,0,0,253,254,1,0,0,0,254,252,1,0,
0,0,254,255,1,0,0,0,255,27,1,0,0,0,256,258,5,43,0,0,257,259,3,110,55,0,258,
257,1,0,0,0,258,259,1,0,0,0,259,261,1,0,0,0,260,262,5,30,0,0,261,260,1,0,
0,0,261,262,1,0,0,0,262,273,1,0,0,0,263,264,5,57,0,0,264,266,3,70,35,0,265,
267,5,73,0,0,266,265,1,0,0,0,266,267,1,0,0,0,267,273,1,0,0,0,268,270,3,30,
15,0,269,271,5,73,0,0,270,269,1,0,0,0,270,271,1,0,0,0,271,273,1,0,0,0,272,
256,1,0,0,0,272,263,1,0,0,0,272,268,1,0,0,0,273,29,1,0,0,0,274,275,3,60,
30,0,275,276,5,10,0,0,276,277,3,62,31,0,277,279,5,7,0,0,278,280,3,72,36,
0,279,278,1,0,0,0,279,280,1,0,0,0,280,287,1,0,0,0,281,282,3,60,30,0,282,
284,5,10,0,0,283,285,3,62,31,0,284,283,1,0,0,0,284,285,1,0,0,0,285,287,1,
0,0,0,286,274,1,0,0,0,286,281,1,0,0,0,287,31,1,0,0,0,288,289,3,34,17,0,289,
33,1,0,0,0,290,291,5,71,0,0,291,35,1,0,0,0,292,309,3,98,49,0,293,309,3,38,
19,0,294,309,3,40,20,0,295,309,3,42,21,0,296,309,3,44,22,0,297,309,3,48,
24,0,298,309,3,108,54,0,299,309,3,46,23,0,300,309,3,52,26,0,301,303,3,70,
35,0,302,304,5,73,0,0,303,302,1,0,0,0,303,304,1,0,0,0,304,309,1,0,0,0,305,
309,3,28,14,0,306,309,3,32,16,0,307,309,3,90,45,0,308,292,1,0,0,0,308,293,
1,0,0,0,308,294,1,0,0,0,308,295,1,0,0,0,308,296,1,0,0,0,308,297,1,0,0,0,
308,298,1,0,0,0,308,299,1,0,0,0,308,300,1,0,0,0,308,301,1,0,0,0,308,305,
1,0,0,0,308,306,1,0,0,0,308,307,1,0,0,0,309,37,1,0,0,0,310,312,5,45,0,0,
311,313,3,114,57,0,312,311,1,0,0,0,312,313,1,0,0,0,313,314,1,0,0,0,314,317,
3,106,53,0,315,317,5,45,0,0,316,310,1,0,0,0,316,315,1,0,0,0,317,39,1,0,0,
0,318,320,5,47,0,0,319,321,3,114,57,0,320,319,1,0,0,0,320,321,1,0,0,0,321,
322,1,0,0,0,322,325,3,106,53,0,323,325,5,47,0,0,324,318,1,0,0,0,324,323,
1,0,0,0,325,41,1,0,0,0,326,328,5,48,0,0,327,329,3,114,57,0,328,327,1,0,0,
0,328,329,1,0,0,0,329,330,1,0,0,0,330,333,3,106,53,0,331,333,5,48,0,0,332,
326,1,0,0,0,332,331,1,0,0,0,333,43,1,0,0,0,334,340,5,49,0,0,335,337,5,33,
0,0,336,338,3,112,56,0,337,336,1,0,0,0,337,338,1,0,0,0,338,339,1,0,0,0,339,
341,5,34,0,0,340,335,1,0,0,0,340,341,1,0,0,0,341,342,1,0,0,0,342,346,3,106,
53,0,343,346,3,106,53,0,344,346,5,49,0,0,345,334,1,0,0,0,345,343,1,0,0,0,
345,344,1,0,0,0,346,45,1,0,0,0,347,350,3,50,25,0,348,351,5,30,0,0,349,351,
3,106,53,0,350,348,1,0,0,0,350,349,1,0,0,0,350,351,1,0,0,0,351,47,1,0,0,
0,352,353,5,50,0,0,353,354,5,33,0,0,354,364,3,20,10,0,355,359,5,31,0,0,356,
358,3,20,10,0,357,356,1,0,0,0,358,361,1,0,0,0,359,357,1,0,0,0,359,360,1,
0,0,0,360,363,1,0,0,0,361,359,1,0,0,0,362,355,1,0,0,0,363,366,1,0,0,0,364,
362,1,0,0,0,364,365,1,0,0,0,365,367,1,0,0,0,366,364,1,0,0,0,367,369,5,34,
0,0,368,370,5,30,0,0,369,368,1,0,0,0,369,370,1,0,0,0,370,49,1,0,0,0,371,
373,3,68,34,0,372,371,1,0,0,0,372,373,1,0,0,0,373,374,1,0,0,0,374,375,5,
44,0,0,375,381,3,74,37,0,376,378,5,33,0,0,377,379,3,82,41,0,378,377,1,0,
0,0,378,379,1,0,0,0,379,380,1,0,0,0,380,382,5,34,0,0,381,376,1,0,0,0,381,
382,1,0,0,0,382,388,1,0,0,0,383,385,3,68,34,0,384,383,1,0,0,0,384,385,1,
0,0,0,385,386,1,0,0,0,386,388,5,44,0,0,387,372,1,0,0,0,387,384,1,0,0,0,388,
51,1,0,0,0,389,392,3,54,27,0,390,393,5,30,0,0,391,393,3,106,53,0,392,390,
1,0,0,0,392,391,1,0,0,0,392,393,1,0,0,0,393,53,1,0,0,0,394,400,3,68,34,0,
395,397,3,56,28,0,396,398,3,58,29,0,397,396,1,0,0,0,397,398,1,0,0,0,398,
401,1,0,0,0,399,401,3,58,29,0,400,395,1,0,0,0,400,399,1,0,0,0,400,401,1,
0,0,0,401,408,1,0,0,0,402,404,3,56,28,0,403,405,3,58,29,0,404,403,1,0,0,
0,404,405,1,0,0,0,405,408,1,0,0,0,406,408,3,58,29,0,407,394,1,0,0,0,407,
402,1,0,0,0,407,406,1,0,0,0,408,55,1,0,0,0,409,410,3,60,30,0,410,411,5,11,
0,0,411,413,1,0,0,0,412,409,1,0,0,0,412,413,1,0,0,0,413,414,1,0,0,0,414,
415,3,62,31,0,415,416,5,59,0,0,416,57,1,0,0,0,417,422,3,64,32,0,418,419,
5,59,0,0,419,421,3,64,32,0,420,418,1,0,0,0,421,424,1,0,0,0,422,420,1,0,0,
0,422,423,1,0,0,0,423,59,1,0,0,0,424,422,1,0,0,0,425,427,3,24,12,0,426,425,
1,0,0,0,426,427,1,0,0,0,427,428,1,0,0,0,428,429,3,20,10,0,429,61,1,0,0,0,
430,432,3,24,12,0,431,430,1,0,0,0,431,432,1,0,0,0,432,433,1,0,0,0,433,434,
3,20,10,0,434,63,1,0,0,0,435,437,3,80,40,0,436,438,3,66,33,0,437,436,1,0,
0,0,437,438,1,0,0,0,438,65,1,0,0,0,439,441,5,33,0,0,440,442,3,82,41,0,441,
440,1,0,0,0,441,442,1,0,0,0,442,443,1,0,0,0,443,444,5,34,0,0,444,67,1,0,
0,0,445,447,3,76,38,0,446,445,1,0,0,0,446,447,1,0,0,0,447,448,1,0,0,0,448,
449,3,78,39,0,449,450,5,32,0,0,450,69,1,0,0,0,451,452,3,60,30,0,452,453,
5,11,0,0,453,455,1,0,0,0,454,451,1,0,0,0,454,455,1,0,0,0,455,456,1,0,0,0,
456,457,3,62,31,0,457,459,5,7,0,0,458,460,3,72,36,0,459,458,1,0,0,0,459,
460,1,0,0,0,460,467,1,0,0,0,461,462,3,60,30,0,462,464,7,3,0,0,463,465,3,
62,31,0,464,463,1,0,0,0,464,465,1,0,0,0,465,467,1,0,0,0,466,454,1,0,0,0,
466,461,1,0,0,0,467,71,1,0,0,0,468,469,5,72,0,0,469,73,1,0,0,0,470,471,3,
20,10,0,471,75,1,0,0,0,472,473,3,20,10,0,473,77,1,0,0,0,474,487,3,112,56,
0,475,480,7,4,0,0,476,477,5,31,0,0,477,479,7,4,0,0,478,476,1,0,0,0,479,482,
1,0,0,0,480,478,1,0,0,0,480,481,1,0,0,0,481,487,1,0,0,0,482,480,1,0,0,0,
483,487,5,66,0,0,484,487,5,67,0,0,485,487,5,44,0,0,486,474,1,0,0,0,486,475,
1,0,0,0,486,483,1,0,0,0,486,484,1,0,0,0,486,485,1,0,0,0,487,79,1,0,0,0,488,
490,3,24,12,0,489,488,1,0,0,0,489,490,1,0,0,0,490,491,1,0,0,0,491,492,3,
20,10,0,492,81,1,0,0,0,493,498,3,84,42,0,494,495,5,31,0,0,495,497,3,84,42,
0,496,494,1,0,0,0,497,500,1,0,0,0,498,496,1,0,0,0,498,499,1,0,0,0,499,502,
1,0,0,0,500,498,1,0,0,0,501,503,5,31,0,0,502,501,1,0,0,0,502,503,1,0,0,0,
503,83,1,0,0,0,504,508,3,86,43,0,505,508,3,88,44,0,506,508,3,110,55,0,507,
504,1,0,0,0,507,505,1,0,0,0,507,506,1,0,0,0,508,85,1,0,0,0,509,510,7,4,0,
0,510,512,5,32,0,0,511,513,3,110,55,0,512,511,1,0,0,0,512,513,1,0,0,0,513,
87,1,0,0,0,514,515,3,76,38,0,515,516,7,4,0,0,516,89,1,0,0,0,517,521,3,92,
46,0,518,520,3,94,47,0,519,518,1,0,0,0,520,523,1,0,0,0,521,519,1,0,0,0,521,
522,1,0,0,0,522,525,1,0,0,0,523,521,1,0,0,0,524,526,3,96,48,0,525,524,1,
0,0,0,525,526,1,0,0,0,526,91,1,0,0,0,527,528,5,52,0,0,528,529,3,106,53,0,
529,93,1,0,0,0,530,532,5,53,0,0,531,533,3,66,33,0,532,531,1,0,0,0,532,533,
1,0,0,0,533,534,1,0,0,0,534,535,3,106,53,0,535,95,1,0,0,0,536,537,5,54,0,
0,537,538,3,106,53,0,538,97,1,0,0,0,539,543,3,100,50,0,540,542,3,102,51,
0,541,540,1,0,0,0,542,545,1,0,0,0,543,541,1,0,0,0,543,544,1,0,0,0,544,547,
1,0,0,0,545,543,1,0,0,0,546,548,3,104,52,0,547,546,1,0,0,0,547,548,1,0,0,
0,548,99,1,0,0,0,549,550,5,40,0,0,550,552,3,114,57,0,551,553,3,106,53,0,
552,551,1,0,0,0,552,553,1,0,0,0,553,101,1,0,0,0,554,555,5,41,0,0,555,556,
5,40,0,0,556,558,3,114,57,0,557,559,3,106,53,0,558,557,1,0,0,0,558,559,1,
0,0,0,559,103,1,0,0,0,560,562,5,41,0,0,561,563,3,106,53,0,562,561,1,0,0,
0,562,563,1,0,0,0,563,105,1,0,0,0,564,566,5,35,0,0,565,567,3,26,13,0,566,
565,1,0,0,0,566,567,1,0,0,0,567,568,1,0,0,0,568,569,5,36,0,0,569,107,1,0,
0,0,570,572,5,42,0,0,571,573,3,114,57,0,572,571,1,0,0,0,572,573,1,0,0,0,
573,575,1,0,0,0,574,576,3,106,53,0,575,574,1,0,0,0,575,576,1,0,0,0,576,109,
1,0,0,0,577,578,6,55,-1,0,578,598,3,112,56,0,579,580,5,24,0,0,580,598,3,
110,55,13,581,582,5,29,0,0,582,598,3,110,55,12,583,584,3,62,31,0,584,585,
5,59,0,0,585,587,1,0,0,0,586,583,1,0,0,0,586,587,1,0,0,0,587,588,1,0,0,0,
588,598,3,58,29,0,589,598,3,46,23,0,590,591,5,33,0,0,591,592,3,110,55,0,
592,593,5,34,0,0,593,598,1,0,0,0,594,595,3,68,34,0,595,596,3,110,55,1,596,
598,1,0,0,0,597,577,1,0,0,0,597,579,1,0,0,0,597,581,1,0,0,0,597,586,1,0,
0,0,597,589,1,0,0,0,597,590,1,0,0,0,597,594,1,0,0,0,598,622,1,0,0,0,599,
600,10,11,0,0,600,601,7,5,0,0,601,621,3,110,55,12,602,603,10,10,0,0,603,
604,7,6,0,0,604,621,3,110,55,11,605,606,10,9,0,0,606,607,7,7,0,0,607,621,
3,110,55,10,608,609,10,8,0,0,609,610,7,8,0,0,610,621,3,110,55,9,611,612,
10,7,0,0,612,613,5,16,0,0,613,621,3,110,55,8,614,615,10,6,0,0,615,616,5,
15,0,0,616,621,3,110,55,7,617,618,10,5,0,0,618,619,5,23,0,0,619,621,3,110,
55,6,620,599,1,0,0,0,620,602,1,0,0,0,620,605,1,0,0,0,620,608,1,0,0,0,620,
611,1,0,0,0,620,614,1,0,0,0,620,617,1,0,0,0,621,624,1,0,0,0,622,620,1,0,
0,0,622,623,1,0,0,0,623,111,1,0,0,0,624,622,1,0,0,0,625,634,7,9,0,0,626,
634,5,64,0,0,627,634,5,63,0,0,628,634,7,10,0,0,629,634,5,60,0,0,630,634,
5,65,0,0,631,634,7,11,0,0,632,634,5,39,0,0,633,625,1,0,0,0,633,626,1,0,0,
0,633,627,1,0,0,0,633,628,1,0,0,0,633,629,1,0,0,0,633,630,1,0,0,0,633,631,
1,0,0,0,633,632,1,0,0,0,634,113,1,0,0,0,635,637,5,33,0,0,636,638,3,116,58,
0,637,636,1,0,0,0,637,638,1,0,0,0,638,640,1,0,0,0,639,641,5,34,0,0,640,639,
1,0,0,0,640,641,1,0,0,0,641,115,1,0,0,0,642,647,3,112,56,0,643,647,3,110,
55,0,644,647,3,118,59,0,645,647,3,120,60,0,646,642,1,0,0,0,646,643,1,0,0,
0,646,644,1,0,0,0,646,645,1,0,0,0,647,117,1,0,0,0,648,649,7,4,0,0,649,650,
5,55,0,0,650,651,7,4,0,0,651,119,1,0,0,0,652,654,7,12,0,0,653,652,1,0,0,
0,654,655,1,0,0,0,655,653,1,0,0,0,655,656,1,0,0,0,656,121,1,0,0,0,103,123,
127,133,136,141,145,148,152,154,158,160,164,168,174,178,180,185,188,191,
196,199,202,206,209,212,216,225,229,231,236,249,254,258,261,266,270,272,
279,284,286,303,308,312,316,320,324,328,332,337,340,345,350,359,364,369,
372,378,381,384,387,392,397,400,404,407,412,422,426,431,437,441,446,454,
459,464,466,480,486,489,498,502,507,512,521,525,532,543,547,552,558,562,
566,572,575,586,597,620,622,633,637,640,646,655];


const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);

const decisionsToDFA = atn.decisionToState.map( (ds, index) => new antlr4.dfa.DFA(ds, index) );

const sharedContextCache = new antlr4.PredictionContextCache();

class sequenceParser extends antlr4.Parser {

    static grammarFileName = "java-escape";
    static literalNames = [ null, null, "'const'", "'readonly'", "'static'", 
                            "'await'", null, "':'", "'<<'", "'>>'", "'-->'", 
                            "'->'", null, "'['", "']'", "'||'", "'&&'", 
                            "'=='", "'!='", "'>'", "'<'", "'>='", "'<='", 
                            "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'!'", 
                            "';'", "','", "'='", "'('", "')'", "'{'", "'}'", 
                            "'true'", "'false'", null, "'if'", "'else'", 
                            null, "'return'", "'new'", "'par'", "'group'", 
                            "'opt'", "'critical'", null, "'ref'", "'as'", 
                            "'try'", "'catch'", "'finally'", "'in'", null, 
                            null, null, "'.'" ];
    static symbolicNames = [ null, "WS", "CONSTANT", "READONLY", "STATIC", 
                             "AWAIT", "TITLE", "COL", "SOPEN", "SCLOSE", 
                             "RETURN_ARROW", "ARROW", "COLOR", "LBRACKET", 
                             "RBRACKET", "OR", "AND", "EQ", "NEQ", "GT", 
                             "LT", "GTEQ", "LTEQ", "PLUS", "MINUS", "MULT", 
                             "DIV", "MOD", "POW", "NOT", "SCOL", "COMMA", 
                             "ASSIGN", "OPAR", "CPAR", "OBRACE", "CBRACE", 
                             "TRUE", "FALSE", "NIL", "IF", "ELSE", "WHILE", 
                             "RETURN", "NEW", "PAR", "GROUP", "OPT", "CRITICAL", 
                             "SECTION", "REF", "AS", "TRY", "CATCH", "FINALLY", 
                             "IN", "STARTER_LXR", "ANNOTATION_RET", "ANNOTATION", 
                             "DOT", "ID", "INT", "FLOAT", "MONEY", "NUMBER_UNIT", 
                             "DIGIT_LEADING_NAME", "CSTRING", "USTRING", 
                             "CR", "COMMENT", "OTHER", "DIVIDER", "EVENT_PAYLOAD_LXR", 
                             "EVENT_END", "TITLE_CONTENT", "TITLE_END", 
                             "EMOJI_SHORTCODE" ];
    static ruleNames = [ "prog", "title", "head", "group", "starterExp", 
                         "starter", "participant", "stereotype", "label", 
                         "participantType", "name", "width", "emoji", "block", 
                         "ret", "returnAsyncMessage", "divider", "dividerNote", 
                         "stat", "par", "opt", "critical", "section", "creation", 
                         "ref", "creationBody", "message", "messageBody", 
                         "fromTo", "func", "from", "to", "signature", "invocation", 
                         "assignment", "asyncMessage", "content", "construct", 
                         "type", "assignee", "methodName", "parameters", 
                         "parameter", "namedParameter", "declaration", "tcf", 
                         "tryBlock", "catchBlock", "finallyBlock", "alt", 
                         "ifBlock", "elseIfBlock", "elseBlock", "braceBlock", 
                         "loop", "expr", "atom", "parExpr", "condition", 
                         "inExpr", "textExpr" ];

    constructor(input) {
        super(input);
        this._interp = new antlr4.atn.ParserATNSimulator(this, atn, decisionsToDFA, sharedContextCache);
        this.ruleNames = sequenceParser.ruleNames;
        this.literalNames = sequenceParser.literalNames;
        this.symbolicNames = sequenceParser.symbolicNames;
    }

    get atn() {
        return atn;
    }

    sempred(localctx, ruleIndex, predIndex) {
    	switch(ruleIndex) {
    	case 55:
    	    		return this.expr_sempred(localctx, predIndex);
        default:
            throw "No predicate with index:" + ruleIndex;
       }
    }

    expr_sempred(localctx, predIndex) {
    	switch(predIndex) {
    		case 0:
    			return this.precpred(this._ctx, 11);
    		case 1:
    			return this.precpred(this._ctx, 10);
    		case 2:
    			return this.precpred(this._ctx, 9);
    		case 3:
    			return this.precpred(this._ctx, 8);
    		case 4:
    			return this.precpred(this._ctx, 7);
    		case 5:
    			return this.precpred(this._ctx, 6);
    		case 6:
    			return this.precpred(this._ctx, 5);
    		default:
    			throw "No predicate with index:" + predIndex;
    	}
    };




	prog() {
	    let localctx = new ProgContext$3(this, this._ctx, this.state);
	    this.enterRule(localctx, 0, sequenceParser.RULE_prog);
	    var _la = 0; // Token type
	    try {
	        this.state = 141;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,4,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 123;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===6) {
	                this.state = 122;
	                this.title();
	            }

	            this.state = 125;
	            this.match(sequenceParser.EOF);
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 127;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===6) {
	                this.state = 126;
	                this.title();
	            }

	            this.state = 129;
	            this.head();
	            this.state = 130;
	            this.match(sequenceParser.EOF);
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 133;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===6) {
	                this.state = 132;
	                this.title();
	            }

	            this.state = 136;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,3,this._ctx);
	            if(la_===1) {
	                this.state = 135;
	                this.head();

	            }
	            this.state = 138;
	            this.block();
	            this.state = 139;
	            this.match(sequenceParser.EOF);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	title() {
	    let localctx = new TitleContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 2, sequenceParser.RULE_title);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 143;
	        this.match(sequenceParser.TITLE);
	        this.state = 145;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===74) {
	            this.state = 144;
	            this.match(sequenceParser.TITLE_CONTENT);
	        }

	        this.state = 148;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===75) {
	            this.state = 147;
	            this.match(sequenceParser.TITLE_END);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	head() {
	    let localctx = new HeadContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 4, sequenceParser.RULE_head);
	    try {
	        this.state = 164;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,11,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 152; 
	            this._errHandler.sync(this);
	            var _alt = 1;
	            do {
	            	switch (_alt) {
	            	case 1:
	            		this.state = 152;
	            		this._errHandler.sync(this);
	            		switch(this._input.LA(1)) {
	            		case 46:
	            		    this.state = 150;
	            		    this.group();
	            		    break;
	            		case 8:
	            		case 13:
	            		case 20:
	            		case 58:
	            		case 60:
	            		case 65:
	            		case 66:
	            		case 67:
	            		case 76:
	            		    this.state = 151;
	            		    this.participant();
	            		    break;
	            		default:
	            		    throw new antlr4.error.NoViableAltException(this);
	            		}
	            		break;
	            	default:
	            		throw new antlr4.error.NoViableAltException(this);
	            	}
	            	this.state = 154; 
	            	this._errHandler.sync(this);
	            	_alt = this._interp.adaptivePredict(this._input,8, this._ctx);
	            } while ( _alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER );
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 160;
	            this._errHandler.sync(this);
	            var _alt = this._interp.adaptivePredict(this._input,10,this._ctx);
	            while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	                if(_alt===1) {
	                    this.state = 158;
	                    this._errHandler.sync(this);
	                    switch(this._input.LA(1)) {
	                    case 46:
	                        this.state = 156;
	                        this.group();
	                        break;
	                    case 8:
	                    case 13:
	                    case 20:
	                    case 58:
	                    case 60:
	                    case 65:
	                    case 66:
	                    case 67:
	                    case 76:
	                        this.state = 157;
	                        this.participant();
	                        break;
	                    default:
	                        throw new antlr4.error.NoViableAltException(this);
	                    } 
	                }
	                this.state = 162;
	                this._errHandler.sync(this);
	                _alt = this._interp.adaptivePredict(this._input,10,this._ctx);
	            }

	            this.state = 163;
	            this.starterExp();
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	group() {
	    let localctx = new GroupContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 6, sequenceParser.RULE_group);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 166;
	        this.match(sequenceParser.GROUP);
	        this.state = 168;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,12,this._ctx);
	        if(la_===1) {
	            this.state = 167;
	            this.name();

	        }
	        this.state = 180;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,15,this._ctx);
	        if(la_===1) {
	            this.state = 170;
	            this.match(sequenceParser.OBRACE);
	            this.state = 174;
	            this._errHandler.sync(this);
	            var _alt = this._interp.adaptivePredict(this._input,13,this._ctx);
	            while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	                if(_alt===1) {
	                    this.state = 171;
	                    this.participant(); 
	                }
	                this.state = 176;
	                this._errHandler.sync(this);
	                _alt = this._interp.adaptivePredict(this._input,13,this._ctx);
	            }

	            this.state = 178;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===36) {
	                this.state = 177;
	                this.match(sequenceParser.CBRACE);
	            }


	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	starterExp() {
	    let localctx = new StarterExpContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 8, sequenceParser.RULE_starterExp);
	    var _la = 0; // Token type
	    try {
	        this.state = 191;
	        this._errHandler.sync(this);
	        switch(this._input.LA(1)) {
	        case 56:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 182;
	            this.match(sequenceParser.STARTER_LXR);
	            this.state = 188;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===33) {
	                this.state = 183;
	                this.match(sequenceParser.OPAR);
	                this.state = 185;
	                this._errHandler.sync(this);
	                _la = this._input.LA(1);
	                if(((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 225) !== 0)) {
	                    this.state = 184;
	                    this.starter();
	                }

	                this.state = 187;
	                this.match(sequenceParser.CPAR);
	            }

	            break;
	        case 58:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 190;
	            this.match(sequenceParser.ANNOTATION);
	            break;
	        default:
	            throw new antlr4.error.NoViableAltException(this);
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	starter() {
	    let localctx = new StarterContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 10, sequenceParser.RULE_starter);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 193;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	participant() {
	    let localctx = new ParticipantContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 12, sequenceParser.RULE_participant);
	    var _la = 0; // Token type
	    try {
	        this.state = 216;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,25,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 196;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===58) {
	                this.state = 195;
	                this.participantType();
	            }

	            this.state = 199;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===8 || _la===20) {
	                this.state = 198;
	                this.stereotype();
	            }

	            this.state = 202;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===13 || _la===76) {
	                this.state = 201;
	                this.emoji();
	            }

	            this.state = 204;
	            this.name();
	            this.state = 206;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,22,this._ctx);
	            if(la_===1) {
	                this.state = 205;
	                this.width();

	            }
	            this.state = 209;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===51) {
	                this.state = 208;
	                this.label();
	            }

	            this.state = 212;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===12) {
	                this.state = 211;
	                this.match(sequenceParser.COLOR);
	            }

	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 214;
	            this.stereotype();
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 215;
	            this.participantType();
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	stereotype() {
	    let localctx = new StereotypeContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 14, sequenceParser.RULE_stereotype);
	    var _la = 0; // Token type
	    try {
	        this.state = 231;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,28,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 218;
	            this.match(sequenceParser.SOPEN);
	            this.state = 219;
	            this.name();
	            this.state = 220;
	            this.match(sequenceParser.SCLOSE);
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 222;
	            this.match(sequenceParser.SOPEN);
	            this.state = 223;
	            this.name();
	            this.state = 225;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===19) {
	                this.state = 224;
	                this.match(sequenceParser.GT);
	            }

	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 227;
	            _la = this._input.LA(1);
	            if(!(_la===8 || _la===20)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            this.state = 229;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===9 || _la===19) {
	                this.state = 228;
	                _la = this._input.LA(1);
	                if(!(_la===9 || _la===19)) {
	                this._errHandler.recoverInline(this);
	                }
	                else {
	                	this._errHandler.reportMatch(this);
	                    this.consume();
	                }
	            }

	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	label() {
	    let localctx = new LabelContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 16, sequenceParser.RULE_label);
	    try {
	        this.state = 236;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,29,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 233;
	            this.match(sequenceParser.AS);
	            this.state = 234;
	            this.name();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 235;
	            this.match(sequenceParser.AS);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	participantType() {
	    let localctx = new ParticipantTypeContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 18, sequenceParser.RULE_participantType);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 238;
	        this.match(sequenceParser.ANNOTATION);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	name() {
	    let localctx = new NameContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 20, sequenceParser.RULE_name);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 240;
	        _la = this._input.LA(1);
	        if(!(((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 225) !== 0))) {
	        this._errHandler.recoverInline(this);
	        }
	        else {
	        	this._errHandler.reportMatch(this);
	            this.consume();
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	width() {
	    let localctx = new WidthContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 22, sequenceParser.RULE_width);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 242;
	        this.match(sequenceParser.INT);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	emoji() {
	    let localctx = new EmojiContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 24, sequenceParser.RULE_emoji);
	    try {
	        this.state = 249;
	        this._errHandler.sync(this);
	        switch(this._input.LA(1)) {
	        case 13:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 244;
	            this.match(sequenceParser.LBRACKET);
	            this.state = 245;
	            this.name();
	            this.state = 246;
	            this.match(sequenceParser.RBRACKET);
	            break;
	        case 76:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 248;
	            this.match(sequenceParser.EMOJI_SHORTCODE);
	            break;
	        default:
	            throw new antlr4.error.NoViableAltException(this);
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	block() {
	    let localctx = new BlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 26, sequenceParser.RULE_block);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 252; 
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        do {
	            this.state = 251;
	            this.stat();
	            this.state = 254; 
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	        } while(((((_la - 13)) & ~0x1f) == 0 && ((1 << (_la - 13)) & 4013948929) !== 0) || ((((_la - 45)) & ~0x1f) == 0 && ((1 << (_la - 45)) & 2222952637) !== 0));
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	ret() {
	    let localctx = new RetContext$3(this, this._ctx, this.state);
	    this.enterRule(localctx, 28, sequenceParser.RULE_ret);
	    var _la = 0; // Token type
	    try {
	        this.state = 272;
	        this._errHandler.sync(this);
	        switch(this._input.LA(1)) {
	        case 43:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 256;
	            this.match(sequenceParser.RETURN);
	            this.state = 258;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,32,this._ctx);
	            if(la_===1) {
	                this.state = 257;
	                this.expr(0);

	            }
	            this.state = 261;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===30) {
	                this.state = 260;
	                this.match(sequenceParser.SCOL);
	            }

	            break;
	        case 57:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 263;
	            this.match(sequenceParser.ANNOTATION_RET);
	            this.state = 264;
	            this.asyncMessage();
	            this.state = 266;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===73) {
	                this.state = 265;
	                this.match(sequenceParser.EVENT_END);
	            }

	            break;
	        case 13:
	        case 60:
	        case 65:
	        case 66:
	        case 67:
	        case 76:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 268;
	            this.returnAsyncMessage();
	            this.state = 270;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===73) {
	                this.state = 269;
	                this.match(sequenceParser.EVENT_END);
	            }

	            break;
	        default:
	            throw new antlr4.error.NoViableAltException(this);
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	returnAsyncMessage() {
	    let localctx = new ReturnAsyncMessageContext$2(this, this._ctx, this.state);
	    this.enterRule(localctx, 30, sequenceParser.RULE_returnAsyncMessage);
	    var _la = 0; // Token type
	    try {
	        this.state = 286;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,39,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 274;
	            this.from();
	            this.state = 275;
	            this.match(sequenceParser.RETURN_ARROW);
	            this.state = 276;
	            this.to();
	            this.state = 277;
	            this.match(sequenceParser.COL);
	            this.state = 279;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===72) {
	                this.state = 278;
	                this.content();
	            }

	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 281;
	            this.from();
	            this.state = 282;
	            this.match(sequenceParser.RETURN_ARROW);
	            this.state = 284;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,38,this._ctx);
	            if(la_===1) {
	                this.state = 283;
	                this.to();

	            }
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	divider() {
	    let localctx = new DividerContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 32, sequenceParser.RULE_divider);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 288;
	        this.dividerNote();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	dividerNote() {
	    let localctx = new DividerNoteContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 34, sequenceParser.RULE_dividerNote);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 290;
	        this.match(sequenceParser.DIVIDER);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	stat() {
	    let localctx = new StatContext$3(this, this._ctx, this.state);
	    this.enterRule(localctx, 36, sequenceParser.RULE_stat);
	    var _la = 0; // Token type
	    try {
	        this.state = 308;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,41,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 292;
	            this.alt();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 293;
	            this.par();
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 294;
	            this.opt();
	            break;

	        case 4:
	            this.enterOuterAlt(localctx, 4);
	            this.state = 295;
	            this.critical();
	            break;

	        case 5:
	            this.enterOuterAlt(localctx, 5);
	            this.state = 296;
	            this.section();
	            break;

	        case 6:
	            this.enterOuterAlt(localctx, 6);
	            this.state = 297;
	            this.ref();
	            break;

	        case 7:
	            this.enterOuterAlt(localctx, 7);
	            this.state = 298;
	            this.loop();
	            break;

	        case 8:
	            this.enterOuterAlt(localctx, 8);
	            this.state = 299;
	            this.creation();
	            break;

	        case 9:
	            this.enterOuterAlt(localctx, 9);
	            this.state = 300;
	            this.message();
	            break;

	        case 10:
	            this.enterOuterAlt(localctx, 10);
	            this.state = 301;
	            this.asyncMessage();
	            this.state = 303;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===73) {
	                this.state = 302;
	                this.match(sequenceParser.EVENT_END);
	            }

	            break;

	        case 11:
	            this.enterOuterAlt(localctx, 11);
	            this.state = 305;
	            this.ret();
	            break;

	        case 12:
	            this.enterOuterAlt(localctx, 12);
	            this.state = 306;
	            this.divider();
	            break;

	        case 13:
	            this.enterOuterAlt(localctx, 13);
	            this.state = 307;
	            this.tcf();
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	par() {
	    let localctx = new ParContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 38, sequenceParser.RULE_par);
	    var _la = 0; // Token type
	    try {
	        this.state = 316;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,43,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 310;
	            this.match(sequenceParser.PAR);
	            this.state = 312;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===33) {
	                this.state = 311;
	                this.parExpr();
	            }

	            this.state = 314;
	            this.braceBlock();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 315;
	            this.match(sequenceParser.PAR);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	opt() {
	    let localctx = new OptContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 40, sequenceParser.RULE_opt);
	    var _la = 0; // Token type
	    try {
	        this.state = 324;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,45,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 318;
	            this.match(sequenceParser.OPT);
	            this.state = 320;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===33) {
	                this.state = 319;
	                this.parExpr();
	            }

	            this.state = 322;
	            this.braceBlock();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 323;
	            this.match(sequenceParser.OPT);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	critical() {
	    let localctx = new CriticalContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 42, sequenceParser.RULE_critical);
	    var _la = 0; // Token type
	    try {
	        this.state = 332;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,47,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 326;
	            this.match(sequenceParser.CRITICAL);
	            this.state = 328;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===33) {
	                this.state = 327;
	                this.parExpr();
	            }

	            this.state = 330;
	            this.braceBlock();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 331;
	            this.match(sequenceParser.CRITICAL);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	section() {
	    let localctx = new SectionContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 44, sequenceParser.RULE_section);
	    var _la = 0; // Token type
	    try {
	        this.state = 345;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,50,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 334;
	            this.match(sequenceParser.SECTION);
	            this.state = 340;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===33) {
	                this.state = 335;
	                this.match(sequenceParser.OPAR);
	                this.state = 337;
	                this._errHandler.sync(this);
	                _la = this._input.LA(1);
	                if(((((_la - 37)) & ~0x1f) == 0 && ((1 << (_la - 37)) & 2139095047) !== 0)) {
	                    this.state = 336;
	                    this.atom();
	                }

	                this.state = 339;
	                this.match(sequenceParser.CPAR);
	            }

	            this.state = 342;
	            this.braceBlock();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 343;
	            this.braceBlock();
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 344;
	            this.match(sequenceParser.SECTION);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	creation() {
	    let localctx = new CreationContext$8(this, this._ctx, this.state);
	    this.enterRule(localctx, 46, sequenceParser.RULE_creation);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 347;
	        this.creationBody();
	        this.state = 350;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,51,this._ctx);
	        if(la_===1) {
	            this.state = 348;
	            this.match(sequenceParser.SCOL);

	        } else if(la_===2) {
	            this.state = 349;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	ref() {
	    let localctx = new RefContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 48, sequenceParser.RULE_ref);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 352;
	        this.match(sequenceParser.REF);
	        this.state = 353;
	        this.match(sequenceParser.OPAR);

	        this.state = 354;
	        this.name();
	        this.state = 364;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        while(_la===31) {
	            this.state = 355;
	            this.match(sequenceParser.COMMA);
	            this.state = 359;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            while(((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 225) !== 0)) {
	                this.state = 356;
	                this.name();
	                this.state = 361;
	                this._errHandler.sync(this);
	                _la = this._input.LA(1);
	            }
	            this.state = 366;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	        }
	        this.state = 367;
	        this.match(sequenceParser.CPAR);
	        this.state = 369;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===30) {
	            this.state = 368;
	            this.match(sequenceParser.SCOL);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	creationBody() {
	    let localctx = new CreationBodyContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 50, sequenceParser.RULE_creationBody);
	    var _la = 0; // Token type
	    try {
	        this.state = 387;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,59,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 372;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,55,this._ctx);
	            if(la_===1) {
	                this.state = 371;
	                this.assignment();

	            }
	            this.state = 374;
	            this.match(sequenceParser.NEW);
	            this.state = 375;
	            this.construct();
	            this.state = 381;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,57,this._ctx);
	            if(la_===1) {
	                this.state = 376;
	                this.match(sequenceParser.OPAR);
	                this.state = 378;
	                this._errHandler.sync(this);
	                _la = this._input.LA(1);
	                if(((((_la - 13)) & ~0x1f) == 0 && ((1 << (_la - 13)) & 2266040321) !== 0) || ((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 65791) !== 0)) {
	                    this.state = 377;
	                    this.parameters();
	                }

	                this.state = 380;
	                this.match(sequenceParser.CPAR);

	            }
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 384;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,58,this._ctx);
	            if(la_===1) {
	                this.state = 383;
	                this.assignment();

	            }
	            this.state = 386;
	            this.match(sequenceParser.NEW);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	message() {
	    let localctx = new MessageContext$8(this, this._ctx, this.state);
	    this.enterRule(localctx, 52, sequenceParser.RULE_message);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 389;
	        this.messageBody();
	        this.state = 392;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,60,this._ctx);
	        if(la_===1) {
	            this.state = 390;
	            this.match(sequenceParser.SCOL);

	        } else if(la_===2) {
	            this.state = 391;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	messageBody() {
	    let localctx = new MessageBodyContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 54, sequenceParser.RULE_messageBody);
	    try {
	        this.state = 407;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,64,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 394;
	            this.assignment();
	            this.state = 400;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,62,this._ctx);
	            if(la_===1) {
	                this.state = 395;
	                this.fromTo();
	                this.state = 397;
	                this._errHandler.sync(this);
	                var la_ = this._interp.adaptivePredict(this._input,61,this._ctx);
	                if(la_===1) {
	                    this.state = 396;
	                    this.func();

	                }

	            } else if(la_===2) {
	                this.state = 399;
	                this.func();

	            }
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 402;
	            this.fromTo();
	            this.state = 404;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,63,this._ctx);
	            if(la_===1) {
	                this.state = 403;
	                this.func();

	            }
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 406;
	            this.func();
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	fromTo() {
	    let localctx = new FromToContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 56, sequenceParser.RULE_fromTo);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 412;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,65,this._ctx);
	        if(la_===1) {
	            this.state = 409;
	            this.from();
	            this.state = 410;
	            this.match(sequenceParser.ARROW);

	        }
	        this.state = 414;
	        this.to();
	        this.state = 415;
	        this.match(sequenceParser.DOT);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	func() {
	    let localctx = new FuncContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 58, sequenceParser.RULE_func);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 417;
	        this.signature();
	        this.state = 422;
	        this._errHandler.sync(this);
	        var _alt = this._interp.adaptivePredict(this._input,66,this._ctx);
	        while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	            if(_alt===1) {
	                this.state = 418;
	                this.match(sequenceParser.DOT);
	                this.state = 419;
	                this.signature(); 
	            }
	            this.state = 424;
	            this._errHandler.sync(this);
	            _alt = this._interp.adaptivePredict(this._input,66,this._ctx);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	from() {
	    let localctx = new FromContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 60, sequenceParser.RULE_from);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 426;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===13 || _la===76) {
	            this.state = 425;
	            this.emoji();
	        }

	        this.state = 428;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	to() {
	    let localctx = new ToContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 62, sequenceParser.RULE_to);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 431;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===13 || _la===76) {
	            this.state = 430;
	            this.emoji();
	        }

	        this.state = 433;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	signature() {
	    let localctx = new SignatureContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 64, sequenceParser.RULE_signature);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 435;
	        this.methodName();
	        this.state = 437;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,69,this._ctx);
	        if(la_===1) {
	            this.state = 436;
	            this.invocation();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	invocation() {
	    let localctx = new InvocationContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 66, sequenceParser.RULE_invocation);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 439;
	        this.match(sequenceParser.OPAR);
	        this.state = 441;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(((((_la - 13)) & ~0x1f) == 0 && ((1 << (_la - 13)) & 2266040321) !== 0) || ((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 65791) !== 0)) {
	            this.state = 440;
	            this.parameters();
	        }

	        this.state = 443;
	        this.match(sequenceParser.CPAR);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	assignment() {
	    let localctx = new AssignmentContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 68, sequenceParser.RULE_assignment);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 446;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,71,this._ctx);
	        if(la_===1) {
	            this.state = 445;
	            this.type();

	        }
	        this.state = 448;
	        this.assignee();
	        this.state = 449;
	        this.match(sequenceParser.ASSIGN);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	asyncMessage() {
	    let localctx = new AsyncMessageContext$3(this, this._ctx, this.state);
	    this.enterRule(localctx, 70, sequenceParser.RULE_asyncMessage);
	    var _la = 0; // Token type
	    try {
	        this.state = 466;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,75,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 454;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,72,this._ctx);
	            if(la_===1) {
	                this.state = 451;
	                this.from();
	                this.state = 452;
	                this.match(sequenceParser.ARROW);

	            }
	            this.state = 456;
	            this.to();
	            this.state = 457;
	            this.match(sequenceParser.COL);
	            this.state = 459;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            if(_la===72) {
	                this.state = 458;
	                this.content();
	            }

	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 461;
	            this.from();
	            this.state = 462;
	            _la = this._input.LA(1);
	            if(!(_la===11 || _la===24)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            this.state = 464;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,74,this._ctx);
	            if(la_===1) {
	                this.state = 463;
	                this.to();

	            }
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	content() {
	    let localctx = new ContentContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 72, sequenceParser.RULE_content);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 468;
	        this.match(sequenceParser.EVENT_PAYLOAD_LXR);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	construct() {
	    let localctx = new ConstructContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 74, sequenceParser.RULE_construct);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 470;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	type() {
	    let localctx = new TypeContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 76, sequenceParser.RULE_type);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 472;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	assignee() {
	    let localctx = new AssigneeContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 78, sequenceParser.RULE_assignee);
	    var _la = 0; // Token type
	    try {
	        this.state = 486;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,77,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 474;
	            this.atom();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 475;
	            _la = this._input.LA(1);
	            if(!(_la===60 || _la===65)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            this.state = 480;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	            while(_la===31) {
	                this.state = 476;
	                this.match(sequenceParser.COMMA);
	                this.state = 477;
	                _la = this._input.LA(1);
	                if(!(_la===60 || _la===65)) {
	                this._errHandler.recoverInline(this);
	                }
	                else {
	                	this._errHandler.reportMatch(this);
	                    this.consume();
	                }
	                this.state = 482;
	                this._errHandler.sync(this);
	                _la = this._input.LA(1);
	            }
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 483;
	            this.match(sequenceParser.CSTRING);
	            break;

	        case 4:
	            this.enterOuterAlt(localctx, 4);
	            this.state = 484;
	            this.match(sequenceParser.USTRING);
	            break;

	        case 5:
	            this.enterOuterAlt(localctx, 5);
	            this.state = 485;
	            this.match(sequenceParser.NEW);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	methodName() {
	    let localctx = new MethodNameContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 80, sequenceParser.RULE_methodName);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 489;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===13 || _la===76) {
	            this.state = 488;
	            this.emoji();
	        }

	        this.state = 491;
	        this.name();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	parameters() {
	    let localctx = new ParametersContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 82, sequenceParser.RULE_parameters);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 493;
	        this.parameter();
	        this.state = 498;
	        this._errHandler.sync(this);
	        var _alt = this._interp.adaptivePredict(this._input,79,this._ctx);
	        while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	            if(_alt===1) {
	                this.state = 494;
	                this.match(sequenceParser.COMMA);
	                this.state = 495;
	                this.parameter(); 
	            }
	            this.state = 500;
	            this._errHandler.sync(this);
	            _alt = this._interp.adaptivePredict(this._input,79,this._ctx);
	        }

	        this.state = 502;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===31) {
	            this.state = 501;
	            this.match(sequenceParser.COMMA);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	parameter() {
	    let localctx = new ParameterContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 84, sequenceParser.RULE_parameter);
	    try {
	        this.state = 507;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,81,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 504;
	            this.namedParameter();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 505;
	            this.declaration();
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 506;
	            this.expr(0);
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	namedParameter() {
	    let localctx = new NamedParameterContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 86, sequenceParser.RULE_namedParameter);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 509;
	        _la = this._input.LA(1);
	        if(!(_la===60 || _la===65)) {
	        this._errHandler.recoverInline(this);
	        }
	        else {
	        	this._errHandler.reportMatch(this);
	            this.consume();
	        }
	        this.state = 510;
	        this.match(sequenceParser.ASSIGN);
	        this.state = 512;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(((((_la - 13)) & ~0x1f) == 0 && ((1 << (_la - 13)) & 2266040321) !== 0) || ((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 65791) !== 0)) {
	            this.state = 511;
	            this.expr(0);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	declaration() {
	    let localctx = new DeclarationContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 88, sequenceParser.RULE_declaration);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 514;
	        this.type();
	        this.state = 515;
	        _la = this._input.LA(1);
	        if(!(_la===60 || _la===65)) {
	        this._errHandler.recoverInline(this);
	        }
	        else {
	        	this._errHandler.reportMatch(this);
	            this.consume();
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	tcf() {
	    let localctx = new TcfContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 90, sequenceParser.RULE_tcf);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 517;
	        this.tryBlock();
	        this.state = 521;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        while(_la===53) {
	            this.state = 518;
	            this.catchBlock();
	            this.state = 523;
	            this._errHandler.sync(this);
	            _la = this._input.LA(1);
	        }
	        this.state = 525;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===54) {
	            this.state = 524;
	            this.finallyBlock();
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	tryBlock() {
	    let localctx = new TryBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 92, sequenceParser.RULE_tryBlock);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 527;
	        this.match(sequenceParser.TRY);
	        this.state = 528;
	        this.braceBlock();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	catchBlock() {
	    let localctx = new CatchBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 94, sequenceParser.RULE_catchBlock);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 530;
	        this.match(sequenceParser.CATCH);
	        this.state = 532;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===33) {
	            this.state = 531;
	            this.invocation();
	        }

	        this.state = 534;
	        this.braceBlock();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	finallyBlock() {
	    let localctx = new FinallyBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 96, sequenceParser.RULE_finallyBlock);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 536;
	        this.match(sequenceParser.FINALLY);
	        this.state = 537;
	        this.braceBlock();
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	alt() {
	    let localctx = new AltContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 98, sequenceParser.RULE_alt);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 539;
	        this.ifBlock();
	        this.state = 543;
	        this._errHandler.sync(this);
	        var _alt = this._interp.adaptivePredict(this._input,86,this._ctx);
	        while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	            if(_alt===1) {
	                this.state = 540;
	                this.elseIfBlock(); 
	            }
	            this.state = 545;
	            this._errHandler.sync(this);
	            _alt = this._interp.adaptivePredict(this._input,86,this._ctx);
	        }

	        this.state = 547;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===41) {
	            this.state = 546;
	            this.elseBlock();
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	ifBlock() {
	    let localctx = new IfBlockContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 100, sequenceParser.RULE_ifBlock);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 549;
	        this.match(sequenceParser.IF);
	        this.state = 550;
	        this.parExpr();
	        this.state = 552;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,88,this._ctx);
	        if(la_===1) {
	            this.state = 551;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	elseIfBlock() {
	    let localctx = new ElseIfBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 102, sequenceParser.RULE_elseIfBlock);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 554;
	        this.match(sequenceParser.ELSE);
	        this.state = 555;
	        this.match(sequenceParser.IF);
	        this.state = 556;
	        this.parExpr();
	        this.state = 558;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,89,this._ctx);
	        if(la_===1) {
	            this.state = 557;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	elseBlock() {
	    let localctx = new ElseBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 104, sequenceParser.RULE_elseBlock);
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 560;
	        this.match(sequenceParser.ELSE);
	        this.state = 562;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,90,this._ctx);
	        if(la_===1) {
	            this.state = 561;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	braceBlock() {
	    let localctx = new BraceBlockContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 106, sequenceParser.RULE_braceBlock);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 564;
	        this.match(sequenceParser.OBRACE);
	        this.state = 566;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(((((_la - 13)) & ~0x1f) == 0 && ((1 << (_la - 13)) & 4013948929) !== 0) || ((((_la - 45)) & ~0x1f) == 0 && ((1 << (_la - 45)) & 2222952637) !== 0)) {
	            this.state = 565;
	            this.block();
	        }

	        this.state = 568;
	        this.match(sequenceParser.CBRACE);
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	loop() {
	    let localctx = new LoopContext$1(this, this._ctx, this.state);
	    this.enterRule(localctx, 108, sequenceParser.RULE_loop);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 570;
	        this.match(sequenceParser.WHILE);
	        this.state = 572;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===33) {
	            this.state = 571;
	            this.parExpr();
	        }

	        this.state = 575;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,93,this._ctx);
	        if(la_===1) {
	            this.state = 574;
	            this.braceBlock();

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}


	expr(_p) {
		if(_p===undefined) {
		    _p = 0;
		}
	    const _parentctx = this._ctx;
	    const _parentState = this.state;
	    let localctx = new ExprContext(this, this._ctx, _parentState);
	    let _prevctx = localctx;
	    const _startState = 110;
	    this.enterRecursionRule(localctx, 110, sequenceParser.RULE_expr, _p);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 597;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,95,this._ctx);
	        switch(la_) {
	        case 1:
	            localctx = new AtomExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;

	            this.state = 578;
	            this.atom();
	            break;

	        case 2:
	            localctx = new UnaryMinusExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 579;
	            this.match(sequenceParser.MINUS);
	            this.state = 580;
	            this.expr(13);
	            break;

	        case 3:
	            localctx = new NotExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 581;
	            this.match(sequenceParser.NOT);
	            this.state = 582;
	            this.expr(12);
	            break;

	        case 4:
	            localctx = new FuncExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 586;
	            this._errHandler.sync(this);
	            var la_ = this._interp.adaptivePredict(this._input,94,this._ctx);
	            if(la_===1) {
	                this.state = 583;
	                this.to();
	                this.state = 584;
	                this.match(sequenceParser.DOT);

	            }
	            this.state = 588;
	            this.func();
	            break;

	        case 5:
	            localctx = new CreationExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 589;
	            this.creation();
	            break;

	        case 6:
	            localctx = new ParenthesizedExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 590;
	            this.match(sequenceParser.OPAR);
	            this.state = 591;
	            this.expr(0);
	            this.state = 592;
	            this.match(sequenceParser.CPAR);
	            break;

	        case 7:
	            localctx = new AssignmentExprContext(this, localctx);
	            this._ctx = localctx;
	            _prevctx = localctx;
	            this.state = 594;
	            this.assignment();
	            this.state = 595;
	            this.expr(1);
	            break;

	        }
	        this._ctx.stop = this._input.LT(-1);
	        this.state = 622;
	        this._errHandler.sync(this);
	        var _alt = this._interp.adaptivePredict(this._input,97,this._ctx);
	        while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
	            if(_alt===1) {
	                if(this._parseListeners!==null) {
	                    this.triggerExitRuleEvent();
	                }
	                _prevctx = localctx;
	                this.state = 620;
	                this._errHandler.sync(this);
	                var la_ = this._interp.adaptivePredict(this._input,96,this._ctx);
	                switch(la_) {
	                case 1:
	                    localctx = new MultiplicationExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 599;
	                    if (!( this.precpred(this._ctx, 11))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 11)");
	                    }
	                    this.state = 600;
	                    localctx.op = this._input.LT(1);
	                    _la = this._input.LA(1);
	                    if(!((((_la) & ~0x1f) == 0 && ((1 << _la) & 234881024) !== 0))) {
	                        localctx.op = this._errHandler.recoverInline(this);
	                    }
	                    else {
	                    	this._errHandler.reportMatch(this);
	                        this.consume();
	                    }
	                    this.state = 601;
	                    this.expr(12);
	                    break;

	                case 2:
	                    localctx = new AdditiveExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 602;
	                    if (!( this.precpred(this._ctx, 10))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 10)");
	                    }
	                    this.state = 603;
	                    localctx.op = this._input.LT(1);
	                    _la = this._input.LA(1);
	                    if(!(_la===23 || _la===24)) {
	                        localctx.op = this._errHandler.recoverInline(this);
	                    }
	                    else {
	                    	this._errHandler.reportMatch(this);
	                        this.consume();
	                    }
	                    this.state = 604;
	                    this.expr(11);
	                    break;

	                case 3:
	                    localctx = new RelationalExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 605;
	                    if (!( this.precpred(this._ctx, 9))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 9)");
	                    }
	                    this.state = 606;
	                    localctx.op = this._input.LT(1);
	                    _la = this._input.LA(1);
	                    if(!((((_la) & ~0x1f) == 0 && ((1 << _la) & 7864320) !== 0))) {
	                        localctx.op = this._errHandler.recoverInline(this);
	                    }
	                    else {
	                    	this._errHandler.reportMatch(this);
	                        this.consume();
	                    }
	                    this.state = 607;
	                    this.expr(10);
	                    break;

	                case 4:
	                    localctx = new EqualityExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 608;
	                    if (!( this.precpred(this._ctx, 8))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 8)");
	                    }
	                    this.state = 609;
	                    localctx.op = this._input.LT(1);
	                    _la = this._input.LA(1);
	                    if(!(_la===17 || _la===18)) {
	                        localctx.op = this._errHandler.recoverInline(this);
	                    }
	                    else {
	                    	this._errHandler.reportMatch(this);
	                        this.consume();
	                    }
	                    this.state = 610;
	                    this.expr(9);
	                    break;

	                case 5:
	                    localctx = new AndExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 611;
	                    if (!( this.precpred(this._ctx, 7))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 7)");
	                    }
	                    this.state = 612;
	                    this.match(sequenceParser.AND);
	                    this.state = 613;
	                    this.expr(8);
	                    break;

	                case 6:
	                    localctx = new OrExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 614;
	                    if (!( this.precpred(this._ctx, 6))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 6)");
	                    }
	                    this.state = 615;
	                    this.match(sequenceParser.OR);
	                    this.state = 616;
	                    this.expr(7);
	                    break;

	                case 7:
	                    localctx = new PlusExprContext(this, new ExprContext(this, _parentctx, _parentState));
	                    this.pushNewRecursionContext(localctx, _startState, sequenceParser.RULE_expr);
	                    this.state = 617;
	                    if (!( this.precpred(this._ctx, 5))) {
	                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 5)");
	                    }
	                    this.state = 618;
	                    this.match(sequenceParser.PLUS);
	                    this.state = 619;
	                    this.expr(6);
	                    break;

	                } 
	            }
	            this.state = 624;
	            this._errHandler.sync(this);
	            _alt = this._interp.adaptivePredict(this._input,97,this._ctx);
	        }

	    } catch( error) {
	        if(error instanceof antlr4.error.RecognitionException) {
		        localctx.exception = error;
		        this._errHandler.reportError(this, error);
		        this._errHandler.recover(this, error);
		    } else {
		    	throw error;
		    }
	    } finally {
	        this.unrollRecursionContexts(_parentctx);
	    }
	    return localctx;
	}



	atom() {
	    let localctx = new AtomContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 112, sequenceParser.RULE_atom);
	    var _la = 0; // Token type
	    try {
	        this.state = 633;
	        this._errHandler.sync(this);
	        switch(this._input.LA(1)) {
	        case 61:
	        case 62:
	            localctx = new NumberAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 1);
	            this.state = 625;
	            _la = this._input.LA(1);
	            if(!(_la===61 || _la===62)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            break;
	        case 64:
	            localctx = new NumberUnitAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 2);
	            this.state = 626;
	            this.match(sequenceParser.NUMBER_UNIT);
	            break;
	        case 63:
	            localctx = new MoneyAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 3);
	            this.state = 627;
	            this.match(sequenceParser.MONEY);
	            break;
	        case 37:
	        case 38:
	            localctx = new BooleanAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 4);
	            this.state = 628;
	            _la = this._input.LA(1);
	            if(!(_la===37 || _la===38)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            break;
	        case 60:
	            localctx = new IdAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 5);
	            this.state = 629;
	            this.match(sequenceParser.ID);
	            break;
	        case 65:
	            localctx = new DigitLeadingNameAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 6);
	            this.state = 630;
	            this.match(sequenceParser.DIGIT_LEADING_NAME);
	            break;
	        case 66:
	        case 67:
	            localctx = new StringAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 7);
	            this.state = 631;
	            _la = this._input.LA(1);
	            if(!(_la===66 || _la===67)) {
	            this._errHandler.recoverInline(this);
	            }
	            else {
	            	this._errHandler.reportMatch(this);
	                this.consume();
	            }
	            break;
	        case 39:
	            localctx = new NilAtomContext(this, localctx);
	            this.enterOuterAlt(localctx, 8);
	            this.state = 632;
	            this.match(sequenceParser.NIL);
	            break;
	        default:
	            throw new antlr4.error.NoViableAltException(this);
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	parExpr() {
	    let localctx = new ParExprContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 114, sequenceParser.RULE_parExpr);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 635;
	        this.match(sequenceParser.OPAR);
	        this.state = 637;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,99,this._ctx);
	        if(la_===1) {
	            this.state = 636;
	            this.condition();

	        }
	        this.state = 640;
	        this._errHandler.sync(this);
	        _la = this._input.LA(1);
	        if(_la===34) {
	            this.state = 639;
	            this.match(sequenceParser.CPAR);
	        }

	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	condition() {
	    let localctx = new ConditionContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 116, sequenceParser.RULE_condition);
	    try {
	        this.state = 646;
	        this._errHandler.sync(this);
	        var la_ = this._interp.adaptivePredict(this._input,101,this._ctx);
	        switch(la_) {
	        case 1:
	            this.enterOuterAlt(localctx, 1);
	            this.state = 642;
	            this.atom();
	            break;

	        case 2:
	            this.enterOuterAlt(localctx, 2);
	            this.state = 643;
	            this.expr(0);
	            break;

	        case 3:
	            this.enterOuterAlt(localctx, 3);
	            this.state = 644;
	            this.inExpr();
	            break;

	        case 4:
	            this.enterOuterAlt(localctx, 4);
	            this.state = 645;
	            this.textExpr();
	            break;

	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	inExpr() {
	    let localctx = new InExprContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 118, sequenceParser.RULE_inExpr);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 648;
	        _la = this._input.LA(1);
	        if(!(_la===60 || _la===65)) {
	        this._errHandler.recoverInline(this);
	        }
	        else {
	        	this._errHandler.reportMatch(this);
	            this.consume();
	        }
	        this.state = 649;
	        this.match(sequenceParser.IN);
	        this.state = 650;
	        _la = this._input.LA(1);
	        if(!(_la===60 || _la===65)) {
	        this._errHandler.recoverInline(this);
	        }
	        else {
	        	this._errHandler.reportMatch(this);
	            this.consume();
	        }
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}



	textExpr() {
	    let localctx = new TextExprContext(this, this._ctx, this.state);
	    this.enterRule(localctx, 120, sequenceParser.RULE_textExpr);
	    var _la = 0; // Token type
	    try {
	        this.enterOuterAlt(localctx, 1);
	        this.state = 653; 
	        this._errHandler.sync(this);
	        var _alt = 1;
	        do {
	        	switch (_alt) {
	        	case 1:
	        		this.state = 652;
	        		_la = this._input.LA(1);
	        		if(!(((((_la - 60)) & ~0x1f) == 0 && ((1 << (_la - 60)) & 49) !== 0))) {
	        		this._errHandler.recoverInline(this);
	        		}
	        		else {
	        			this._errHandler.reportMatch(this);
	        		    this.consume();
	        		}
	        		break;
	        	default:
	        		throw new antlr4.error.NoViableAltException(this);
	        	}
	        	this.state = 655; 
	        	this._errHandler.sync(this);
	        	_alt = this._interp.adaptivePredict(this._input,102, this._ctx);
	        } while ( _alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER );
	    } catch (re) {
	    	if(re instanceof antlr4.error.RecognitionException) {
		        localctx.exception = re;
		        this._errHandler.reportError(this, re);
		        this._errHandler.recover(this, re);
		    } else {
		    	throw re;
		    }
	    } finally {
	        this.exitRule();
	    }
	    return localctx;
	}


}

sequenceParser.EOF = antlr4.Token.EOF;
sequenceParser.WS = 1;
sequenceParser.CONSTANT = 2;
sequenceParser.READONLY = 3;
sequenceParser.STATIC = 4;
sequenceParser.AWAIT = 5;
sequenceParser.TITLE = 6;
sequenceParser.COL = 7;
sequenceParser.SOPEN = 8;
sequenceParser.SCLOSE = 9;
sequenceParser.RETURN_ARROW = 10;
sequenceParser.ARROW = 11;
sequenceParser.COLOR = 12;
sequenceParser.LBRACKET = 13;
sequenceParser.RBRACKET = 14;
sequenceParser.OR = 15;
sequenceParser.AND = 16;
sequenceParser.EQ = 17;
sequenceParser.NEQ = 18;
sequenceParser.GT = 19;
sequenceParser.LT = 20;
sequenceParser.GTEQ = 21;
sequenceParser.LTEQ = 22;
sequenceParser.PLUS = 23;
sequenceParser.MINUS = 24;
sequenceParser.MULT = 25;
sequenceParser.DIV = 26;
sequenceParser.MOD = 27;
sequenceParser.POW = 28;
sequenceParser.NOT = 29;
sequenceParser.SCOL = 30;
sequenceParser.COMMA = 31;
sequenceParser.ASSIGN = 32;
sequenceParser.OPAR = 33;
sequenceParser.CPAR = 34;
sequenceParser.OBRACE = 35;
sequenceParser.CBRACE = 36;
sequenceParser.TRUE = 37;
sequenceParser.FALSE = 38;
sequenceParser.NIL = 39;
sequenceParser.IF = 40;
sequenceParser.ELSE = 41;
sequenceParser.WHILE = 42;
sequenceParser.RETURN = 43;
sequenceParser.NEW = 44;
sequenceParser.PAR = 45;
sequenceParser.GROUP = 46;
sequenceParser.OPT = 47;
sequenceParser.CRITICAL = 48;
sequenceParser.SECTION = 49;
sequenceParser.REF = 50;
sequenceParser.AS = 51;
sequenceParser.TRY = 52;
sequenceParser.CATCH = 53;
sequenceParser.FINALLY = 54;
sequenceParser.IN = 55;
sequenceParser.STARTER_LXR = 56;
sequenceParser.ANNOTATION_RET = 57;
sequenceParser.ANNOTATION = 58;
sequenceParser.DOT = 59;
sequenceParser.ID = 60;
sequenceParser.INT = 61;
sequenceParser.FLOAT = 62;
sequenceParser.MONEY = 63;
sequenceParser.NUMBER_UNIT = 64;
sequenceParser.DIGIT_LEADING_NAME = 65;
sequenceParser.CSTRING = 66;
sequenceParser.USTRING = 67;
sequenceParser.CR = 68;
sequenceParser.COMMENT = 69;
sequenceParser.OTHER = 70;
sequenceParser.DIVIDER = 71;
sequenceParser.EVENT_PAYLOAD_LXR = 72;
sequenceParser.EVENT_END = 73;
sequenceParser.TITLE_CONTENT = 74;
sequenceParser.TITLE_END = 75;
sequenceParser.EMOJI_SHORTCODE = 76;

sequenceParser.RULE_prog = 0;
sequenceParser.RULE_title = 1;
sequenceParser.RULE_head = 2;
sequenceParser.RULE_group = 3;
sequenceParser.RULE_starterExp = 4;
sequenceParser.RULE_starter = 5;
sequenceParser.RULE_participant = 6;
sequenceParser.RULE_stereotype = 7;
sequenceParser.RULE_label = 8;
sequenceParser.RULE_participantType = 9;
sequenceParser.RULE_name = 10;
sequenceParser.RULE_width = 11;
sequenceParser.RULE_emoji = 12;
sequenceParser.RULE_block = 13;
sequenceParser.RULE_ret = 14;
sequenceParser.RULE_returnAsyncMessage = 15;
sequenceParser.RULE_divider = 16;
sequenceParser.RULE_dividerNote = 17;
sequenceParser.RULE_stat = 18;
sequenceParser.RULE_par = 19;
sequenceParser.RULE_opt = 20;
sequenceParser.RULE_critical = 21;
sequenceParser.RULE_section = 22;
sequenceParser.RULE_creation = 23;
sequenceParser.RULE_ref = 24;
sequenceParser.RULE_creationBody = 25;
sequenceParser.RULE_message = 26;
sequenceParser.RULE_messageBody = 27;
sequenceParser.RULE_fromTo = 28;
sequenceParser.RULE_func = 29;
sequenceParser.RULE_from = 30;
sequenceParser.RULE_to = 31;
sequenceParser.RULE_signature = 32;
sequenceParser.RULE_invocation = 33;
sequenceParser.RULE_assignment = 34;
sequenceParser.RULE_asyncMessage = 35;
sequenceParser.RULE_content = 36;
sequenceParser.RULE_construct = 37;
sequenceParser.RULE_type = 38;
sequenceParser.RULE_assignee = 39;
sequenceParser.RULE_methodName = 40;
sequenceParser.RULE_parameters = 41;
sequenceParser.RULE_parameter = 42;
sequenceParser.RULE_namedParameter = 43;
sequenceParser.RULE_declaration = 44;
sequenceParser.RULE_tcf = 45;
sequenceParser.RULE_tryBlock = 46;
sequenceParser.RULE_catchBlock = 47;
sequenceParser.RULE_finallyBlock = 48;
sequenceParser.RULE_alt = 49;
sequenceParser.RULE_ifBlock = 50;
sequenceParser.RULE_elseIfBlock = 51;
sequenceParser.RULE_elseBlock = 52;
sequenceParser.RULE_braceBlock = 53;
sequenceParser.RULE_loop = 54;
sequenceParser.RULE_expr = 55;
sequenceParser.RULE_atom = 56;
sequenceParser.RULE_parExpr = 57;
sequenceParser.RULE_condition = 58;
sequenceParser.RULE_inExpr = 59;
sequenceParser.RULE_textExpr = 60;

let ProgContext$3 = class ProgContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_prog;
    }

	EOF() {
	    return this.getToken(sequenceParser.EOF, 0);
	};

	title() {
	    return this.getTypedRuleContext(TitleContext$1,0);
	};

	head() {
	    return this.getTypedRuleContext(HeadContext,0);
	};

	block() {
	    return this.getTypedRuleContext(BlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterProg(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitProg(this);
		}
	}


};



let TitleContext$1 = class TitleContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_title;
    }

	TITLE() {
	    return this.getToken(sequenceParser.TITLE, 0);
	};

	TITLE_CONTENT() {
	    return this.getToken(sequenceParser.TITLE_CONTENT, 0);
	};

	TITLE_END() {
	    return this.getToken(sequenceParser.TITLE_END, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterTitle(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitTitle(this);
		}
	}


};



class HeadContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_head;
    }

	group = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(GroupContext);
	    } else {
	        return this.getTypedRuleContext(GroupContext,i);
	    }
	};

	participant = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ParticipantContext);
	    } else {
	        return this.getTypedRuleContext(ParticipantContext,i);
	    }
	};

	starterExp() {
	    return this.getTypedRuleContext(StarterExpContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterHead(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitHead(this);
		}
	}


}



class GroupContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_group;
    }

	GROUP() {
	    return this.getToken(sequenceParser.GROUP, 0);
	};

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	OBRACE() {
	    return this.getToken(sequenceParser.OBRACE, 0);
	};

	participant = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ParticipantContext);
	    } else {
	        return this.getTypedRuleContext(ParticipantContext,i);
	    }
	};

	CBRACE() {
	    return this.getToken(sequenceParser.CBRACE, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterGroup(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitGroup(this);
		}
	}


}



class StarterExpContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_starterExp;
    }

	STARTER_LXR() {
	    return this.getToken(sequenceParser.STARTER_LXR, 0);
	};

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	starter() {
	    return this.getTypedRuleContext(StarterContext,0);
	};

	ANNOTATION() {
	    return this.getToken(sequenceParser.ANNOTATION, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterStarterExp(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitStarterExp(this);
		}
	}


}



class StarterContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_starter;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterStarter(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitStarter(this);
		}
	}


}



class ParticipantContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_participant;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	participantType() {
	    return this.getTypedRuleContext(ParticipantTypeContext,0);
	};

	stereotype() {
	    return this.getTypedRuleContext(StereotypeContext,0);
	};

	emoji() {
	    return this.getTypedRuleContext(EmojiContext,0);
	};

	width() {
	    return this.getTypedRuleContext(WidthContext,0);
	};

	label() {
	    return this.getTypedRuleContext(LabelContext,0);
	};

	COLOR() {
	    return this.getToken(sequenceParser.COLOR, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParticipant(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParticipant(this);
		}
	}


}



class StereotypeContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_stereotype;
    }

	SOPEN() {
	    return this.getToken(sequenceParser.SOPEN, 0);
	};

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	SCLOSE() {
	    return this.getToken(sequenceParser.SCLOSE, 0);
	};

	GT() {
	    return this.getToken(sequenceParser.GT, 0);
	};

	LT() {
	    return this.getToken(sequenceParser.LT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterStereotype(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitStereotype(this);
		}
	}


}



class LabelContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_label;
    }

	AS() {
	    return this.getToken(sequenceParser.AS, 0);
	};

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterLabel(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitLabel(this);
		}
	}


}



class ParticipantTypeContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_participantType;
    }

	ANNOTATION() {
	    return this.getToken(sequenceParser.ANNOTATION, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParticipantType(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParticipantType(this);
		}
	}


}



class NameContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_name;
    }

	ID() {
	    return this.getToken(sequenceParser.ID, 0);
	};

	DIGIT_LEADING_NAME() {
	    return this.getToken(sequenceParser.DIGIT_LEADING_NAME, 0);
	};

	CSTRING() {
	    return this.getToken(sequenceParser.CSTRING, 0);
	};

	USTRING() {
	    return this.getToken(sequenceParser.USTRING, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterName(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitName(this);
		}
	}


}



class WidthContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_width;
    }

	INT() {
	    return this.getToken(sequenceParser.INT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterWidth(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitWidth(this);
		}
	}


}



class EmojiContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_emoji;
    }

	LBRACKET() {
	    return this.getToken(sequenceParser.LBRACKET, 0);
	};

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	RBRACKET() {
	    return this.getToken(sequenceParser.RBRACKET, 0);
	};

	EMOJI_SHORTCODE() {
	    return this.getToken(sequenceParser.EMOJI_SHORTCODE, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterEmoji(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitEmoji(this);
		}
	}


}



class BlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_block;
    }

	stat = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(StatContext$3);
	    } else {
	        return this.getTypedRuleContext(StatContext$3,i);
	    }
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitBlock(this);
		}
	}


}



let RetContext$3 = class RetContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_ret;
    }

	RETURN() {
	    return this.getToken(sequenceParser.RETURN, 0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	SCOL() {
	    return this.getToken(sequenceParser.SCOL, 0);
	};

	ANNOTATION_RET() {
	    return this.getToken(sequenceParser.ANNOTATION_RET, 0);
	};

	asyncMessage() {
	    return this.getTypedRuleContext(AsyncMessageContext$3,0);
	};

	EVENT_END() {
	    return this.getToken(sequenceParser.EVENT_END, 0);
	};

	returnAsyncMessage() {
	    return this.getTypedRuleContext(ReturnAsyncMessageContext$2,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterRet(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitRet(this);
		}
	}


};



let ReturnAsyncMessageContext$2 = class ReturnAsyncMessageContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_returnAsyncMessage;
    }

	from() {
	    return this.getTypedRuleContext(FromContext,0);
	};

	RETURN_ARROW() {
	    return this.getToken(sequenceParser.RETURN_ARROW, 0);
	};

	to() {
	    return this.getTypedRuleContext(ToContext,0);
	};

	COL() {
	    return this.getToken(sequenceParser.COL, 0);
	};

	content() {
	    return this.getTypedRuleContext(ContentContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterReturnAsyncMessage(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitReturnAsyncMessage(this);
		}
	}


};



let DividerContext$1 = class DividerContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_divider;
    }

	dividerNote() {
	    return this.getTypedRuleContext(DividerNoteContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterDivider(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitDivider(this);
		}
	}


};



class DividerNoteContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_dividerNote;
    }

	DIVIDER() {
	    return this.getToken(sequenceParser.DIVIDER, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterDividerNote(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitDividerNote(this);
		}
	}


}



let StatContext$3 = class StatContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_stat;
    }

	alt() {
	    return this.getTypedRuleContext(AltContext,0);
	};

	par() {
	    return this.getTypedRuleContext(ParContext,0);
	};

	opt() {
	    return this.getTypedRuleContext(OptContext,0);
	};

	critical() {
	    return this.getTypedRuleContext(CriticalContext,0);
	};

	section() {
	    return this.getTypedRuleContext(SectionContext,0);
	};

	ref() {
	    return this.getTypedRuleContext(RefContext$1,0);
	};

	loop() {
	    return this.getTypedRuleContext(LoopContext$1,0);
	};

	creation() {
	    return this.getTypedRuleContext(CreationContext$8,0);
	};

	message() {
	    return this.getTypedRuleContext(MessageContext$8,0);
	};

	asyncMessage() {
	    return this.getTypedRuleContext(AsyncMessageContext$3,0);
	};

	EVENT_END() {
	    return this.getToken(sequenceParser.EVENT_END, 0);
	};

	ret() {
	    return this.getTypedRuleContext(RetContext$3,0);
	};

	divider() {
	    return this.getTypedRuleContext(DividerContext$1,0);
	};

	tcf() {
	    return this.getTypedRuleContext(TcfContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterStat(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitStat(this);
		}
	}


};



class ParContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_par;
    }

	PAR() {
	    return this.getToken(sequenceParser.PAR, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterPar(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitPar(this);
		}
	}


}



class OptContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_opt;
    }

	OPT() {
	    return this.getToken(sequenceParser.OPT, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterOpt(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitOpt(this);
		}
	}


}



class CriticalContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_critical;
    }

	CRITICAL() {
	    return this.getToken(sequenceParser.CRITICAL, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCritical(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCritical(this);
		}
	}


}



class SectionContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_section;
    }

	SECTION() {
	    return this.getToken(sequenceParser.SECTION, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	atom() {
	    return this.getTypedRuleContext(AtomContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterSection(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitSection(this);
		}
	}


}



let CreationContext$8 = class CreationContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_creation;
    }

	creationBody() {
	    return this.getTypedRuleContext(CreationBodyContext,0);
	};

	SCOL() {
	    return this.getToken(sequenceParser.SCOL, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCreation(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCreation(this);
		}
	}


};



let RefContext$1 = class RefContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_ref;
    }

	REF() {
	    return this.getToken(sequenceParser.REF, 0);
	};

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	name = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(NameContext);
	    } else {
	        return this.getTypedRuleContext(NameContext,i);
	    }
	};

	SCOL() {
	    return this.getToken(sequenceParser.SCOL, 0);
	};

	COMMA = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.COMMA);
	    } else {
	        return this.getToken(sequenceParser.COMMA, i);
	    }
	};


	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterRef(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitRef(this);
		}
	}


};



class CreationBodyContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_creationBody;
    }

	NEW() {
	    return this.getToken(sequenceParser.NEW, 0);
	};

	construct() {
	    return this.getTypedRuleContext(ConstructContext,0);
	};

	assignment() {
	    return this.getTypedRuleContext(AssignmentContext,0);
	};

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	parameters() {
	    return this.getTypedRuleContext(ParametersContext$1,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCreationBody(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCreationBody(this);
		}
	}


}



let MessageContext$8 = class MessageContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_message;
    }

	messageBody() {
	    return this.getTypedRuleContext(MessageBodyContext,0);
	};

	SCOL() {
	    return this.getToken(sequenceParser.SCOL, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterMessage(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitMessage(this);
		}
	}


};



class MessageBodyContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_messageBody;
    }

	assignment() {
	    return this.getTypedRuleContext(AssignmentContext,0);
	};

	fromTo() {
	    return this.getTypedRuleContext(FromToContext,0);
	};

	func() {
	    return this.getTypedRuleContext(FuncContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterMessageBody(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitMessageBody(this);
		}
	}


}



class FromToContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_fromTo;
    }

	to() {
	    return this.getTypedRuleContext(ToContext,0);
	};

	DOT() {
	    return this.getToken(sequenceParser.DOT, 0);
	};

	from() {
	    return this.getTypedRuleContext(FromContext,0);
	};

	ARROW() {
	    return this.getToken(sequenceParser.ARROW, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterFromTo(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitFromTo(this);
		}
	}


}



class FuncContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_func;
    }

	signature = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(SignatureContext);
	    } else {
	        return this.getTypedRuleContext(SignatureContext,i);
	    }
	};

	DOT = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.DOT);
	    } else {
	        return this.getToken(sequenceParser.DOT, i);
	    }
	};


	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterFunc(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitFunc(this);
		}
	}


}



class FromContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_from;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	emoji() {
	    return this.getTypedRuleContext(EmojiContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterFrom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitFrom(this);
		}
	}


}



class ToContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_to;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	emoji() {
	    return this.getTypedRuleContext(EmojiContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterTo(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitTo(this);
		}
	}


}



class SignatureContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_signature;
    }

	methodName() {
	    return this.getTypedRuleContext(MethodNameContext,0);
	};

	invocation() {
	    return this.getTypedRuleContext(InvocationContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterSignature(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitSignature(this);
		}
	}


}



class InvocationContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_invocation;
    }

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	parameters() {
	    return this.getTypedRuleContext(ParametersContext$1,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterInvocation(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitInvocation(this);
		}
	}


}



class AssignmentContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_assignment;
    }

	assignee() {
	    return this.getTypedRuleContext(AssigneeContext,0);
	};

	ASSIGN() {
	    return this.getToken(sequenceParser.ASSIGN, 0);
	};

	type() {
	    return this.getTypedRuleContext(TypeContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAssignment(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAssignment(this);
		}
	}


}



let AsyncMessageContext$3 = class AsyncMessageContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_asyncMessage;
    }

	to() {
	    return this.getTypedRuleContext(ToContext,0);
	};

	COL() {
	    return this.getToken(sequenceParser.COL, 0);
	};

	from() {
	    return this.getTypedRuleContext(FromContext,0);
	};

	ARROW() {
	    return this.getToken(sequenceParser.ARROW, 0);
	};

	content() {
	    return this.getTypedRuleContext(ContentContext,0);
	};

	MINUS() {
	    return this.getToken(sequenceParser.MINUS, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAsyncMessage(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAsyncMessage(this);
		}
	}


};



class ContentContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_content;
    }

	EVENT_PAYLOAD_LXR() {
	    return this.getToken(sequenceParser.EVENT_PAYLOAD_LXR, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterContent(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitContent(this);
		}
	}


}



class ConstructContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_construct;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterConstruct(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitConstruct(this);
		}
	}


}



class TypeContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_type;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterType(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitType(this);
		}
	}


}



class AssigneeContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_assignee;
    }

	atom() {
	    return this.getTypedRuleContext(AtomContext,0);
	};

	ID = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.ID);
	    } else {
	        return this.getToken(sequenceParser.ID, i);
	    }
	};


	DIGIT_LEADING_NAME = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.DIGIT_LEADING_NAME);
	    } else {
	        return this.getToken(sequenceParser.DIGIT_LEADING_NAME, i);
	    }
	};


	COMMA = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.COMMA);
	    } else {
	        return this.getToken(sequenceParser.COMMA, i);
	    }
	};


	CSTRING() {
	    return this.getToken(sequenceParser.CSTRING, 0);
	};

	USTRING() {
	    return this.getToken(sequenceParser.USTRING, 0);
	};

	NEW() {
	    return this.getToken(sequenceParser.NEW, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAssignee(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAssignee(this);
		}
	}


}



class MethodNameContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_methodName;
    }

	name() {
	    return this.getTypedRuleContext(NameContext,0);
	};

	emoji() {
	    return this.getTypedRuleContext(EmojiContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterMethodName(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitMethodName(this);
		}
	}


}



let ParametersContext$1 = class ParametersContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_parameters;
    }

	parameter = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ParameterContext);
	    } else {
	        return this.getTypedRuleContext(ParameterContext,i);
	    }
	};

	COMMA = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.COMMA);
	    } else {
	        return this.getToken(sequenceParser.COMMA, i);
	    }
	};


	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParameters(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParameters(this);
		}
	}


};



class ParameterContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_parameter;
    }

	namedParameter() {
	    return this.getTypedRuleContext(NamedParameterContext,0);
	};

	declaration() {
	    return this.getTypedRuleContext(DeclarationContext,0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParameter(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParameter(this);
		}
	}


}



class NamedParameterContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_namedParameter;
    }

	ASSIGN() {
	    return this.getToken(sequenceParser.ASSIGN, 0);
	};

	ID() {
	    return this.getToken(sequenceParser.ID, 0);
	};

	DIGIT_LEADING_NAME() {
	    return this.getToken(sequenceParser.DIGIT_LEADING_NAME, 0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterNamedParameter(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitNamedParameter(this);
		}
	}


}



class DeclarationContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_declaration;
    }

	type() {
	    return this.getTypedRuleContext(TypeContext,0);
	};

	ID() {
	    return this.getToken(sequenceParser.ID, 0);
	};

	DIGIT_LEADING_NAME() {
	    return this.getToken(sequenceParser.DIGIT_LEADING_NAME, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterDeclaration(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitDeclaration(this);
		}
	}


}



class TcfContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_tcf;
    }

	tryBlock() {
	    return this.getTypedRuleContext(TryBlockContext,0);
	};

	catchBlock = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(CatchBlockContext);
	    } else {
	        return this.getTypedRuleContext(CatchBlockContext,i);
	    }
	};

	finallyBlock() {
	    return this.getTypedRuleContext(FinallyBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterTcf(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitTcf(this);
		}
	}


}



class TryBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_tryBlock;
    }

	TRY() {
	    return this.getToken(sequenceParser.TRY, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterTryBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitTryBlock(this);
		}
	}


}



class CatchBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_catchBlock;
    }

	CATCH() {
	    return this.getToken(sequenceParser.CATCH, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	invocation() {
	    return this.getTypedRuleContext(InvocationContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCatchBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCatchBlock(this);
		}
	}


}



class FinallyBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_finallyBlock;
    }

	FINALLY() {
	    return this.getToken(sequenceParser.FINALLY, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterFinallyBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitFinallyBlock(this);
		}
	}


}



class AltContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_alt;
    }

	ifBlock() {
	    return this.getTypedRuleContext(IfBlockContext$1,0);
	};

	elseIfBlock = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ElseIfBlockContext);
	    } else {
	        return this.getTypedRuleContext(ElseIfBlockContext,i);
	    }
	};

	elseBlock() {
	    return this.getTypedRuleContext(ElseBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAlt(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAlt(this);
		}
	}


}



let IfBlockContext$1 = class IfBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_ifBlock;
    }

	IF() {
	    return this.getToken(sequenceParser.IF, 0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterIfBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitIfBlock(this);
		}
	}


};



class ElseIfBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_elseIfBlock;
    }

	ELSE() {
	    return this.getToken(sequenceParser.ELSE, 0);
	};

	IF() {
	    return this.getToken(sequenceParser.IF, 0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterElseIfBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitElseIfBlock(this);
		}
	}


}



class ElseBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_elseBlock;
    }

	ELSE() {
	    return this.getToken(sequenceParser.ELSE, 0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterElseBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitElseBlock(this);
		}
	}


}



class BraceBlockContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_braceBlock;
    }

	OBRACE() {
	    return this.getToken(sequenceParser.OBRACE, 0);
	};

	CBRACE() {
	    return this.getToken(sequenceParser.CBRACE, 0);
	};

	block() {
	    return this.getTypedRuleContext(BlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterBraceBlock(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitBraceBlock(this);
		}
	}


}



let LoopContext$1 = class LoopContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_loop;
    }

	WHILE() {
	    return this.getToken(sequenceParser.WHILE, 0);
	};

	parExpr() {
	    return this.getTypedRuleContext(ParExprContext,0);
	};

	braceBlock() {
	    return this.getTypedRuleContext(BraceBlockContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterLoop(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitLoop(this);
		}
	}


};



class ExprContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_expr;
    }


	 
		copyFrom(ctx) {
			super.copyFrom(ctx);
		}

}


class AssignmentExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	assignment() {
	    return this.getTypedRuleContext(AssignmentContext,0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAssignmentExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAssignmentExpr(this);
		}
	}


}

sequenceParser.AssignmentExprContext = AssignmentExprContext;

class FuncExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	func() {
	    return this.getTypedRuleContext(FuncContext,0);
	};

	to() {
	    return this.getTypedRuleContext(ToContext,0);
	};

	DOT() {
	    return this.getToken(sequenceParser.DOT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterFuncExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitFuncExpr(this);
		}
	}


}

sequenceParser.FuncExprContext = FuncExprContext;

class AtomExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	atom() {
	    return this.getTypedRuleContext(AtomContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAtomExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAtomExpr(this);
		}
	}


}

sequenceParser.AtomExprContext = AtomExprContext;

class OrExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	OR() {
	    return this.getToken(sequenceParser.OR, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterOrExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitOrExpr(this);
		}
	}


}

sequenceParser.OrExprContext = OrExprContext;

class AdditiveExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        this.op = null; // Token;
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	PLUS() {
	    return this.getToken(sequenceParser.PLUS, 0);
	};

	MINUS() {
	    return this.getToken(sequenceParser.MINUS, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAdditiveExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAdditiveExpr(this);
		}
	}


}

sequenceParser.AdditiveExprContext = AdditiveExprContext;

class RelationalExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        this.op = null; // Token;
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	LTEQ() {
	    return this.getToken(sequenceParser.LTEQ, 0);
	};

	GTEQ() {
	    return this.getToken(sequenceParser.GTEQ, 0);
	};

	LT() {
	    return this.getToken(sequenceParser.LT, 0);
	};

	GT() {
	    return this.getToken(sequenceParser.GT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterRelationalExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitRelationalExpr(this);
		}
	}


}

sequenceParser.RelationalExprContext = RelationalExprContext;

class PlusExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	PLUS() {
	    return this.getToken(sequenceParser.PLUS, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterPlusExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitPlusExpr(this);
		}
	}


}

sequenceParser.PlusExprContext = PlusExprContext;

class NotExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	NOT() {
	    return this.getToken(sequenceParser.NOT, 0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterNotExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitNotExpr(this);
		}
	}


}

sequenceParser.NotExprContext = NotExprContext;

class UnaryMinusExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	MINUS() {
	    return this.getToken(sequenceParser.MINUS, 0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterUnaryMinusExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitUnaryMinusExpr(this);
		}
	}


}

sequenceParser.UnaryMinusExprContext = UnaryMinusExprContext;

class CreationExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	creation() {
	    return this.getTypedRuleContext(CreationContext$8,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCreationExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCreationExpr(this);
		}
	}


}

sequenceParser.CreationExprContext = CreationExprContext;

class ParenthesizedExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParenthesizedExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParenthesizedExpr(this);
		}
	}


}

sequenceParser.ParenthesizedExprContext = ParenthesizedExprContext;

class MultiplicationExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        this.op = null; // Token;
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	MULT() {
	    return this.getToken(sequenceParser.MULT, 0);
	};

	DIV() {
	    return this.getToken(sequenceParser.DIV, 0);
	};

	MOD() {
	    return this.getToken(sequenceParser.MOD, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterMultiplicationExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitMultiplicationExpr(this);
		}
	}


}

sequenceParser.MultiplicationExprContext = MultiplicationExprContext;

class EqualityExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        this.op = null; // Token;
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	EQ() {
	    return this.getToken(sequenceParser.EQ, 0);
	};

	NEQ() {
	    return this.getToken(sequenceParser.NEQ, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterEqualityExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitEqualityExpr(this);
		}
	}


}

sequenceParser.EqualityExprContext = EqualityExprContext;

class AndExprContext extends ExprContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	expr = function(i) {
	    if(i===undefined) {
	        i = null;
	    }
	    if(i===null) {
	        return this.getTypedRuleContexts(ExprContext);
	    } else {
	        return this.getTypedRuleContext(ExprContext,i);
	    }
	};

	AND() {
	    return this.getToken(sequenceParser.AND, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterAndExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitAndExpr(this);
		}
	}


}

sequenceParser.AndExprContext = AndExprContext;

class AtomContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_atom;
    }


	 
		copyFrom(ctx) {
			super.copyFrom(ctx);
		}

}


class BooleanAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	TRUE() {
	    return this.getToken(sequenceParser.TRUE, 0);
	};

	FALSE() {
	    return this.getToken(sequenceParser.FALSE, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterBooleanAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitBooleanAtom(this);
		}
	}


}

sequenceParser.BooleanAtomContext = BooleanAtomContext;

class IdAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	ID() {
	    return this.getToken(sequenceParser.ID, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterIdAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitIdAtom(this);
		}
	}


}

sequenceParser.IdAtomContext = IdAtomContext;

class MoneyAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	MONEY() {
	    return this.getToken(sequenceParser.MONEY, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterMoneyAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitMoneyAtom(this);
		}
	}


}

sequenceParser.MoneyAtomContext = MoneyAtomContext;

class StringAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	CSTRING() {
	    return this.getToken(sequenceParser.CSTRING, 0);
	};

	USTRING() {
	    return this.getToken(sequenceParser.USTRING, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterStringAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitStringAtom(this);
		}
	}


}

sequenceParser.StringAtomContext = StringAtomContext;

class NilAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	NIL() {
	    return this.getToken(sequenceParser.NIL, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterNilAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitNilAtom(this);
		}
	}


}

sequenceParser.NilAtomContext = NilAtomContext;

class NumberAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	INT() {
	    return this.getToken(sequenceParser.INT, 0);
	};

	FLOAT() {
	    return this.getToken(sequenceParser.FLOAT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterNumberAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitNumberAtom(this);
		}
	}


}

sequenceParser.NumberAtomContext = NumberAtomContext;

class NumberUnitAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	NUMBER_UNIT() {
	    return this.getToken(sequenceParser.NUMBER_UNIT, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterNumberUnitAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitNumberUnitAtom(this);
		}
	}


}

sequenceParser.NumberUnitAtomContext = NumberUnitAtomContext;

class DigitLeadingNameAtomContext extends AtomContext {

    constructor(parser, ctx) {
        super(parser);
        super.copyFrom(ctx);
    }

	DIGIT_LEADING_NAME() {
	    return this.getToken(sequenceParser.DIGIT_LEADING_NAME, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterDigitLeadingNameAtom(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitDigitLeadingNameAtom(this);
		}
	}


}

sequenceParser.DigitLeadingNameAtomContext = DigitLeadingNameAtomContext;

class ParExprContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_parExpr;
    }

	OPAR() {
	    return this.getToken(sequenceParser.OPAR, 0);
	};

	condition() {
	    return this.getTypedRuleContext(ConditionContext,0);
	};

	CPAR() {
	    return this.getToken(sequenceParser.CPAR, 0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterParExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitParExpr(this);
		}
	}


}



class ConditionContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_condition;
    }

	atom() {
	    return this.getTypedRuleContext(AtomContext,0);
	};

	expr() {
	    return this.getTypedRuleContext(ExprContext,0);
	};

	inExpr() {
	    return this.getTypedRuleContext(InExprContext,0);
	};

	textExpr() {
	    return this.getTypedRuleContext(TextExprContext,0);
	};

	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterCondition(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitCondition(this);
		}
	}


}



class InExprContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_inExpr;
    }

	IN() {
	    return this.getToken(sequenceParser.IN, 0);
	};

	ID = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.ID);
	    } else {
	        return this.getToken(sequenceParser.ID, i);
	    }
	};


	DIGIT_LEADING_NAME = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.DIGIT_LEADING_NAME);
	    } else {
	        return this.getToken(sequenceParser.DIGIT_LEADING_NAME, i);
	    }
	};


	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterInExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitInExpr(this);
		}
	}


}



class TextExprContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = sequenceParser.RULE_textExpr;
    }

	ID = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.ID);
	    } else {
	        return this.getToken(sequenceParser.ID, i);
	    }
	};


	DIGIT_LEADING_NAME = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.DIGIT_LEADING_NAME);
	    } else {
	        return this.getToken(sequenceParser.DIGIT_LEADING_NAME, i);
	    }
	};


	NUMBER_UNIT = function(i) {
		if(i===undefined) {
			i = null;
		}
	    if(i===null) {
	        return this.getTokens(sequenceParser.NUMBER_UNIT);
	    } else {
	        return this.getToken(sequenceParser.NUMBER_UNIT, i);
	    }
	};


	enterRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.enterTextExpr(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof sequenceParserListener ) {
	        listener.exitTextExpr(this);
		}
	}


}




sequenceParser.ProgContext = ProgContext$3; 
sequenceParser.TitleContext = TitleContext$1; 
sequenceParser.HeadContext = HeadContext; 
sequenceParser.GroupContext = GroupContext; 
sequenceParser.StarterExpContext = StarterExpContext; 
sequenceParser.StarterContext = StarterContext; 
sequenceParser.ParticipantContext = ParticipantContext; 
sequenceParser.StereotypeContext = StereotypeContext; 
sequenceParser.LabelContext = LabelContext; 
sequenceParser.ParticipantTypeContext = ParticipantTypeContext; 
sequenceParser.NameContext = NameContext; 
sequenceParser.WidthContext = WidthContext; 
sequenceParser.EmojiContext = EmojiContext; 
sequenceParser.BlockContext = BlockContext; 
sequenceParser.RetContext = RetContext$3; 
sequenceParser.ReturnAsyncMessageContext = ReturnAsyncMessageContext$2; 
sequenceParser.DividerContext = DividerContext$1; 
sequenceParser.DividerNoteContext = DividerNoteContext; 
sequenceParser.StatContext = StatContext$3; 
sequenceParser.ParContext = ParContext; 
sequenceParser.OptContext = OptContext; 
sequenceParser.CriticalContext = CriticalContext; 
sequenceParser.SectionContext = SectionContext; 
sequenceParser.CreationContext = CreationContext$8; 
sequenceParser.RefContext = RefContext$1; 
sequenceParser.CreationBodyContext = CreationBodyContext; 
sequenceParser.MessageContext = MessageContext$8; 
sequenceParser.MessageBodyContext = MessageBodyContext; 
sequenceParser.FromToContext = FromToContext; 
sequenceParser.FuncContext = FuncContext; 
sequenceParser.FromContext = FromContext; 
sequenceParser.ToContext = ToContext; 
sequenceParser.SignatureContext = SignatureContext; 
sequenceParser.InvocationContext = InvocationContext; 
sequenceParser.AssignmentContext = AssignmentContext; 
sequenceParser.AsyncMessageContext = AsyncMessageContext$3; 
sequenceParser.ContentContext = ContentContext; 
sequenceParser.ConstructContext = ConstructContext; 
sequenceParser.TypeContext = TypeContext; 
sequenceParser.AssigneeContext = AssigneeContext; 
sequenceParser.MethodNameContext = MethodNameContext; 
sequenceParser.ParametersContext = ParametersContext$1; 
sequenceParser.ParameterContext = ParameterContext; 
sequenceParser.NamedParameterContext = NamedParameterContext; 
sequenceParser.DeclarationContext = DeclarationContext; 
sequenceParser.TcfContext = TcfContext; 
sequenceParser.TryBlockContext = TryBlockContext; 
sequenceParser.CatchBlockContext = CatchBlockContext; 
sequenceParser.FinallyBlockContext = FinallyBlockContext; 
sequenceParser.AltContext = AltContext; 
sequenceParser.IfBlockContext = IfBlockContext$1; 
sequenceParser.ElseIfBlockContext = ElseIfBlockContext; 
sequenceParser.ElseBlockContext = ElseBlockContext; 
sequenceParser.BraceBlockContext = BraceBlockContext; 
sequenceParser.LoopContext = LoopContext$1; 
sequenceParser.ExprContext = ExprContext; 
sequenceParser.AtomContext = AtomContext; 
sequenceParser.ParExprContext = ParExprContext; 
sequenceParser.ConditionContext = ConditionContext; 
sequenceParser.InExprContext = InExprContext; 
sequenceParser.TextExprContext = TextExprContext;

const blankParticipant = {
  name: "",
  color: void 0,
  comment: void 0,
  explicit: void 0,
  groupId: void 0,
  isStarter: void 0,
  label: void 0,
  stereotype: void 0,
  type: void 0,
  width: void 0,
  assignee: void 0,
  emoji: void 0,
  positions: /* @__PURE__ */ new Set(),
  assigneePositions: /* @__PURE__ */ new Set()
};
let Participant$1 = class Participant {
  name;
  stereotype;
  width;
  groupId;
  explicit;
  isStarter;
  label;
  type;
  color;
  comment;
  assignee;
  emoji;
  positions = /* @__PURE__ */ new Set();
  assigneePositions = /* @__PURE__ */ new Set();
  constructor(name, options) {
    this.name = name;
    this.mergeOptions(options);
  }
  mergeOptions(options) {
    const {
      stereotype,
      width,
      groupId,
      label,
      explicit,
      isStarter,
      type,
      color,
      comment,
      assignee,
      emoji
    } = options;
    this.stereotype ||= stereotype;
    this.width ||= width;
    this.groupId ||= groupId;
    this.explicit ||= explicit;
    this.isStarter ||= isStarter;
    this.label ||= label;
    this.type ||= type;
    this.color ||= color;
    this.comment ||= comment;
    this.assignee ||= assignee;
    this.emoji ||= emoji;
  }
  AddPosition(position) {
    this.positions.add(position);
  }
  ToValue() {
    return {
      name: this.name,
      stereotype: this.stereotype,
      width: this.width,
      groupId: this.groupId,
      explicit: this.explicit,
      isStarter: this.isStarter,
      label: this.label,
      type: this.type,
      color: this.color,
      comment: this.comment,
      assignee: this.assignee,
      emoji: this.emoji,
      positions: this.positions,
      assigneePositions: this.assigneePositions
    };
  }
};
let Participants$1 = class Participants {
  participants = /* @__PURE__ */ new Map();
  Add(name, options = {}) {
    if (!name) {
      throw new Error("Participant name is required");
    }
    let participant = this.Get(name);
    if (!participant) {
      participant = new Participant$1(name, options);
      this.participants.set(name, participant);
    } else {
      participant?.mergeOptions(options);
    }
    const { position, assigneePosition } = options;
    if (position) {
      participant.AddPosition(position);
    }
    if (assigneePosition) {
      participant.assigneePositions.add(assigneePosition);
    }
  }
  // Returns an array of participants that are deduced from messages
  // It does not include the Starter.
  ImplicitArray() {
    return this.Array().filter((p) => !this.Get(p.name)?.explicit);
  }
  // Items in entries are in the order of entry insertion:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
  Array() {
    return Array.from(this.participants.entries()).map((entry) => entry[1]);
  }
  Names() {
    return Array.from(this.participants.keys());
  }
  First() {
    return this.participants.values().next().value;
  }
  Get(name) {
    return this.participants.get(name);
  }
  Size() {
    return this.participants.size;
  }
  Starter() {
    for (const participant of this.participants.values()) {
      if (participant.isStarter) {
        return participant;
      }
    }
    return void 0;
  }
  GetPositions(name) {
    return this.participants.get(name)?.positions;
  }
  GetAssigneePositions(name) {
    return this.participants.get(name)?.assigneePositions;
  }
};

let participants = undefined;
let isBlind = false;
let groupId = undefined;
const ToCollector = new sequenceParserListener();

// Rules:
// 1. Later declaration win
// 2. Participant declaration overwrite cannot be overwritten by To or Starter
const onParticipant = function (ctx) {
  // if(!(ctx?.name())) return;
  if (isBlind) return;
  const type = ctx?.participantType()?.getFormattedText().replace("@", "");
  const participant =
    ctx?.name()?.getFormattedText() || "Missing `Participant`";
  const stereotype = ctx.stereotype()?.name()?.getFormattedText();
  const emoji = ctx.emoji?.()?.name?.()?.getFormattedText();
  const width =
    (ctx.width && ctx.width() && Number.parseInt(ctx.width().getText())) ||
    undefined;
  const labelCtx = ctx.label && ctx.label();
  const label = labelCtx?.name()?.getFormattedText();
  const explicit = true;
  const color = ctx.COLOR()?.getText();
  const comment = ctx.getComment();
  const nameCtx = ctx.name();
  let start, end;

  // When label is present, it means we edit label in diagram and update its code regardless of the occurrence of the participant name
  if (labelCtx) {
    const labelNameCtx = labelCtx.name();
    if (labelNameCtx) {
      start = labelNameCtx.start.start;
      end = labelNameCtx.stop.stop + 1;
    }
  } else if (nameCtx) {
    start = nameCtx.start.start;
    end = nameCtx.stop.stop + 1;
  }

  participants.Add(participant, {
    isStarter: false,
    type,
    stereotype,
    emoji,
    width,
    groupId,
    label,
    explicit,
    color,
    comment,
    position: [start, end],
  });
};
ToCollector.enterParticipant = onParticipant;

const onTo = function (ctx) {
  if (isBlind) return;
  let participant = ctx.name?.()?.getFormattedText() || ctx.getFormattedText();
  const emoji = ctx.emoji?.()?.name?.()?.getFormattedText();
  const participantInstance = participants.Get(participant);

  // Skip adding participant position if label is present
  if (participantInstance?.label) {
    participants.Add(participant, { isStarter: false, emoji });
  } else if (participantInstance?.assignee) {
    // If the participant has an assignee, calculate the position of the ctor and store it only.
    // Let's say the participant name is `"${assignee}:${type}"`, we need to get the position of ${type}
    // e.g. ret = new A() "ret:A".method()
    const start = ctx.start.start + participantInstance.assignee.length + 2;
    const position = [start, ctx.stop.stop];
    const assigneePosition = [
      ctx.start.start + 1,
      ctx.start.start + participantInstance.assignee.length + 1,
    ];
    participants.Add(participant, {
      isStarter: false,
      emoji,
      position: position,
      assigneePosition: assigneePosition,
    });
  } else {
    participants.Add(participant, {
      isStarter: false,
      emoji,
      position: [ctx.start.start, ctx.stop.stop + 1],
    });
  }
};

ToCollector.enterFrom = onTo;
ToCollector.enterTo = onTo;

ToCollector.enterStarter = function (ctx) {
  let participant = ctx.getFormattedText();
  participants.Add(participant, {
    isStarter: true,
    position: [ctx.start.start, ctx.stop.stop + 1],
  });
};

ToCollector.enterCreation = function (ctx) {
  if (isBlind) return;
  const participant = ctx.Owner();
  const ctor = ctx?.creationBody()?.construct();
  const participantInstance = participants.Get(participant);
  // Skip adding participant constructor position if label is present
  if (ctor && !participantInstance?.label) {
    const assignee = ctx.Assignee();
    const assigneePosition = ctx.AssigneePosition();
    participants.Add(participant, {
      isStarter: false,
      position: [ctor.start.start, ctor.stop.stop + 1],
      assignee: assignee,
      assigneePosition: assigneePosition,
    });
  } else {
    participants.Add(participant, {
      isStarter: false,
    });
  }
};

ToCollector.enterRef = function (ctx) {
  ctx.Participants().forEach((participant) => {
    participants.Add(participant.getText(), {
      isStarter: false,
      position: [participant.start.start, participant.stop.stop + 1],
    });
  });
};

ToCollector.enterParameters = function () {
  isBlind = true;
};

ToCollector.exitParameters = function () {
  isBlind = false;
};

ToCollector.enterCondition = function () {
  isBlind = true;
};

ToCollector.exitCondition = function () {
  isBlind = false;
};

ToCollector.enterGroup = function (ctx) {
  // group { A } => groupId = undefined
  // group group1 { A } => groupId = "group1"
  groupId = ctx.name()?.getFormattedText();
};

ToCollector.exitGroup = function () {
  groupId = undefined;
};

ToCollector.enterRet = function (ctx) {
  if (ctx.asyncMessage()) {
    // it will visit the asyncMessage later
    return;
  }
  const returnFrom = ctx.From();
  returnFrom && participants.Add(returnFrom);
  const returnTo = ctx.ReturnTo();
  returnTo && participants.Add(returnTo);
};

const walker$2 = antlr4.tree.ParseTreeWalker.DEFAULT;

// The walk is a pure function of the (immutable) parse tree and consumers only
// read the returned Participants, so results are cached per context node.
const participantsCache = new WeakMap();

ToCollector.getParticipants = function (context) {
  if (!context) return new Participants$1();
  const cached = participantsCache.get(context);
  if (cached) return cached;
  participants = new Participants$1();
  walker$2.walk(this, context);
  participantsCache.set(context, participants);
  return participants;
};

const walker$1 = antlr4.tree.ParseTreeWalker.DEFAULT;

let ChildFragmentDetector = new sequenceParserListener();

let cursor = 0;
let max = 0;

ChildFragmentDetector.enterTcf = function () {
  cursor++;
};
ChildFragmentDetector.enterOpt = function () {
  cursor++;
};
ChildFragmentDetector.enterPar = function () {
  cursor++;
};
ChildFragmentDetector.enterAlt = function () {
  cursor++;
};
ChildFragmentDetector.enterLoop = function () {
  cursor++;
};
ChildFragmentDetector.enterSection = function () {
  cursor++;
};
ChildFragmentDetector.enterCritical = function () {
  cursor++;
};

ChildFragmentDetector.exitTcf = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitOpt = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitPar = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitAlt = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitLoop = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitSection = function () {
  max = Math.max(max, cursor);
  cursor--;
};
ChildFragmentDetector.exitCritical = function () {
  max = Math.max(max, cursor);
  cursor--;
};

ChildFragmentDetector.depth = function (me) {
  return function (context) {
    cursor = 0;
    max = 0;
    context.children.map(function (child) {
      walker$1.walk(me, child);
    });
    return max;
  };
};

const seqParser$9 = sequenceParser;
const TitleContext = seqParser$9.TitleContext;
TitleContext.prototype.content = function () {
  if (this.children.length < 2) {
    return "";
  } else {
    return this.children[1].getText().trim();
  }
};

const seqParser$8 = sequenceParser;

const CreationContext$7 = seqParser$8.CreationContext;
CreationContext$7.prototype.Body = CreationContext$7.prototype.creationBody;
CreationContext$7.prototype.isCurrent = function (cursor) {
  return isCurrent.bind(this)(cursor);
};

const MessageContext$7 = seqParser$8.MessageContext;
MessageContext$7.prototype.Body = MessageContext$7.prototype.messageBody;
MessageContext$7.prototype.isCurrent = function (cursor) {
  return isCurrent.bind(this)(cursor);
};

function isCurrent(cursor) {
  try {
    if (cursor === null || cursor === undefined) return false;
    const start = this.start.start;
    const stop = this.Body().stop.stop + 1;

    return cursor >= start && cursor <= stop;
  } catch (e) {
    return false;
  }
}

/**
 * Owner is the receiver of the message.
 * For example, in `S -> A.m1 {B.m2 {C.m3}} D->E:m4`,
 *                       |     |     |         |
 * Owner of              m1    m2    m3        m4
 */


const seqParser$7 = sequenceParser;
const CreationContext$6 = seqParser$7.CreationContext;
const MessageContext$6 = seqParser$7.MessageContext;
const AsyncMessageContext$2 = seqParser$7.AsyncMessageContext;
const ReturnAsyncMessageContext$1 = seqParser$7.ReturnAsyncMessageContext;
const RetMessageContext = seqParser$7.RetContext;

CreationContext$6.prototype.Assignee = function () {
  return this.creationBody()?.assignment()?.assignee()?.getFormattedText();
};

CreationContext$6.prototype.AssigneePosition = function () {
  const assignee = this.creationBody()?.assignment()?.assignee();
  if (!assignee) {
    return undefined;
  }
  return [assignee.start.start, assignee.stop.stop + 1];
};

CreationContext$6.prototype.Constructor = function () {
  return this.creationBody()?.construct()?.getFormattedText();
};

CreationContext$6.prototype.To = function () {
  return this.Constructor();
};

CreationContext$6.prototype.Owner = function () {
  if (!this.Constructor()) {
    return "Missing Constructor";
  }
  const assignee = this.Assignee();
  const type = this.Constructor();
  return assignee ? `${assignee}:${type}` : type;
};

MessageContext$6.prototype.To = function () {
  const toCtx = this.messageBody()?.fromTo()?.to();
  return toCtx?.name?.()?.getFormattedText() || toCtx?.getFormattedText();
};

MessageContext$6.prototype.Owner = function () {
  return this.To() || getOwnerFromAncestor(this.parentCtx);
};

function getOwnerFromAncestor(ctx) {
  while (ctx) {
    if (ctx instanceof CreationContext$6 || ctx instanceof MessageContext$6) {
      return ctx.Owner();
    }
    ctx = ctx.parentCtx;
  }
  return undefined;
}

AsyncMessageContext$2.prototype.To = function () {
  const toCtx = this.to();
  return toCtx?.name?.()?.getFormattedText() || toCtx?.getFormattedText();
};

AsyncMessageContext$2.prototype.Owner = function () {
  return this.To() || getOwnerFromAncestor(this.parentCtx);
};

ReturnAsyncMessageContext$1.prototype.To = function () {
  const toCtx = this.to();
  return toCtx?.name?.()?.getFormattedText() || toCtx?.getFormattedText();
};

ReturnAsyncMessageContext$1.prototype.Owner = function () {
  return this.To() || getOwnerFromAncestor(this.parentCtx);
};

RetMessageContext.prototype.To = function () {
  return this.ReturnTo();
};

RetMessageContext.prototype.Owner = function () {
  return this.To() || getOwnerFromAncestor(this.parentCtx);
};

const ProgContext$2 = sequenceParser.ProgContext;

/**
 * When does Starter need to be treated differently?
 *
 * 0. "". A default starter CAN be rendered as otherwise the diagram is empty.
 *
 * 1. A.method
 * There is no starter indicated in the code at all. _STARTER_ is used.
 *
 * 2. A->B.method
 * There seems no need to even consider a starter and all messages have a provided sender.
 *
 * 3. if(x) { A.method }.
 * Similar to #1
 *
 * 4. if(x) { A->B.method }.
 * Similar to #2
 *
 * 5. @Starter(A).
 * Starter is clearly defined. It must be used anywhere a sender is not provided
 * and not inferrable.
 *
 * 6. A B.
 * Only the participants are defined. There is no need to consider a starter.
 *
 * From the above analysis, it is clear that whether we should consider a starter is base on
 * messages only. Thus, the following rules are established:
 *
 * For the ProgContext, if there is `@starter(x)` then Starter returns x, otherwise it returns undefined.
 * It is left to the LifelineLayer to determine whether a default starter is rendered based on the messages.
 *
 * The ToCollector should not be concerned with the default starter.
 *
 * _STARTER_ is of the renderer's concern. It is not a concern of the parser.
 */

ProgContext$2.prototype.Starter = function () {
  return this.head()?.starterExp()?.starter()?.getFormattedText();
};

const seqParser$6 = sequenceParser;
const RetContext$2 = seqParser$6.RetContext;
const ProgContext$1 = seqParser$6.ProgContext;
const MessageContext$5 = seqParser$6.MessageContext;
const CreationContext$5 = seqParser$6.CreationContext;

RetContext$2.prototype.Signature = function () {
  return (
    this.asyncMessage()?.content()?.getFormattedText() ||
    this.returnAsyncMessage()?.content()?.getFormattedText() ||
    this.expr()?.getFormattedText()
  );
};

RetContext$2.prototype.ReturnTo = function () {
  // Check asyncMessage 'to' first
  const asyncToCtx = this.asyncMessage()?.to() || this.returnAsyncMessage()?.to();
  const asyncTo = asyncToCtx?.name?.()?.getFormattedText() || asyncToCtx?.getFormattedText();
  if (asyncTo) {
    return asyncTo;
  }

  const stat = this.parentCtx;
  const block = stat.parentCtx;
  const blockParent = block.parentCtx;
  if (blockParent instanceof ProgContext$1) {
    return blockParent.Starter();
  } else {
    let ctx = blockParent;
    while (
      ctx &&
      !(ctx instanceof MessageContext$5) &&
      !(ctx instanceof CreationContext$5)
    ) {
      if (ctx instanceof ProgContext$1) {
        return ctx.Starter();
      }
      ctx = ctx.parentCtx;
    }
    if (ctx instanceof MessageContext$5) {
      return (
        ctx.messageBody()?.fromTo()?.from()?.name?.()?.getFormattedText() ||
        ctx.messageBody()?.fromTo()?.from()?.getFormattedText() ||
        ctx.ClosestAncestorStat().Origin()
      );
    }
    return ctx.ClosestAncestorStat().Origin();
  }
};

const seqParser$5 = sequenceParser;
const RefContext = seqParser$5.RefContext;
RefContext.prototype.Content = function() {
  return this.name()[0];
};
RefContext.prototype.Participants = function() {
  return this.name().slice(1) ?? [];
};

const ParserRuleContext = antlr4.ParserRuleContext;
const StatContext$2 = sequenceParser.StatContext;
const ProgContext = sequenceParser.ProgContext;
const MessageContext$4 = sequenceParser.MessageContext;
const CreationContext$4 = sequenceParser.CreationContext;

ParserRuleContext.prototype.Origin = function () {
  let ctx = this.parentCtx;
  while (ctx && !(ctx instanceof StatContext$2 || ctx instanceof ProgContext)) {
    ctx = this.parentCtx;
  }
  return ctx.Origin();
};
// Origin is essentially the 'from' of a message.
// For example, in `S -> A.m1 {B.m2 {C.m3}}`,
//                  |    |     |
// Origin of        m1   m2    m3
StatContext$2.prototype.Origin = function () {
  let ctx = this.parentCtx;
  while (ctx) {
    if (ctx instanceof ProgContext) {
      return ctx.Starter();
    }
    if (ctx instanceof MessageContext$4 || ctx instanceof CreationContext$4) {
      const receiver = ctx.Owner();
      if (receiver) {
        return receiver;
      }
    }
    ctx = ctx.parentCtx;
  }
  return undefined;
};

ProgContext.prototype.Origin = function () {
  return this.Starter();
};

const seqParser$4 = sequenceParser;
const DividerContext = seqParser$4.DividerContext;
DividerContext.prototype.Note = function() {
  const formattedText = this.dividerNote()?.getFormattedText().trim();
  if (!formattedText.startsWith("==")) {
    throw new Error("Divider note must start with ==");
  }
  return formattedText?.replace(/^=+|=+$/g, "");
};

function formatParameter(param) {
  if (param.namedParameter?.()) {
    const namedParam = param.namedParameter();
    if (namedParam) {
      const expr = namedParam.expr();
      const value = expr ? expr.getFormattedText() : "";
      return `${namedParam.ID().getText()}=${value}`;
    }
  }
  if (param.declaration?.()) {
    const decl = param.declaration();
    if (decl) {
      return `${decl.type().getText()} ${decl.ID().getText()}`;
    }
  }
  if (param.expr?.()) {
    return param.expr().getFormattedText();
  }
  return param.getFormattedText();
}
function formatParameters(params) {
  return params.map(formatParameter).join(",");
}
const MessageContext$3 = sequenceParser.MessageContext;
const ParametersContext = sequenceParser.ParametersContext;
const AsyncMessageContext$1 = sequenceParser.AsyncMessageContext;
const CreationContext$3 = sequenceParser.CreationContext;
const RetContext$1 = sequenceParser.RetContext;
MessageContext$3.prototype.SignatureText = function() {
  return this.messageBody()?.func()?.signature()?.map((s) => s?.getFormattedText()).join(".") ?? "";
};
AsyncMessageContext$1.prototype.SignatureText = function() {
  return this.content()?.getFormattedText() ?? "";
};
CreationContext$3.prototype.ParametersText = function() {
  const params = this.creationBody().parameters();
  return params?.parameter()?.length > 0 ? formatParameters(params.parameter()) : "";
};
CreationContext$3.prototype.SignatureText = function() {
  const text = this.ParametersText() || "create";
  return `«${text}»`;
};
CreationContext$3.prototype.isParamValid = function() {
  return (this.creationBody().parameters()?.parameter()?.length ?? 0) > 0;
};
RetContext$1.prototype.SignatureText = function() {
  return this.asyncMessage()?.content()?.getFormattedText() ?? this.returnAsyncMessage()?.content()?.getFormattedText() ?? this.expr()?.getFormattedText() ?? "";
};
sequenceParser.ReturnAsyncMessageContext.prototype.SignatureText = function() {
  return this.content()?.getFormattedText() ?? "";
};
ParametersContext.prototype.getFormattedText = function() {
  const params = this.parameter();
  if (!params || params.length === 0) {
    return "";
  }
  return formatParameters(params);
};

const seqParser$3 = sequenceParser;
const MessageContext$2 = seqParser$3.MessageContext;
const CreationContext$2 = seqParser$3.CreationContext;
class Assignment {
  assignee;
  type;
  labelPosition;
  assigneePosition;
  typePosition;
  constructor(assignee, type, assigneePosition, typePosition) {
    if (type && !assignee) {
      throw new Error("assignee must be defined if type is defined");
    }
    this.assignee = assignee || "";
    this.type = type || "";
    this.labelPosition = assigneePosition;
    this.assigneePosition = assigneePosition;
    this.typePosition = typePosition;
  }
  getText() {
    return [this.assignee, this.type].filter(Boolean).join(":");
  }
}
function extractAssignmentFromContext(assignmentContext) {
  if (!assignmentContext) {
    return void 0;
  }
  const assignee = assignmentContext?.assignee()?.getFormattedText();
  const type = assignmentContext?.type()?.getFormattedText();
  const assigneeCtx = assignmentContext?.assignee();
  const assigneePosition = assigneeCtx ? [assigneeCtx.start.start, assigneeCtx.stop.stop] : [-1, -1];
  const typeCtx = assignmentContext?.type();
  const typePosition = typeCtx ? [typeCtx.start.start, typeCtx.stop.stop] : [-1, -1];
  if (assignee) {
    return new Assignment(assignee, type, assigneePosition, typePosition);
  }
  return void 0;
}
MessageContext$2.prototype.Assignment = function() {
  return extractAssignmentFromContext(this.messageBody().assignment());
};
CreationContext$2.prototype.Assignment = function() {
  return extractAssignmentFromContext(this.creationBody()?.assignment());
};

const seqParser$2 = sequenceParser;
const MessageContext$1 = seqParser$2.MessageContext;
const CreationContext$1 = seqParser$2.CreationContext;
const IfBlockContext = seqParser$2.IfBlockContext;
const LoopContext = seqParser$2.LoopContext;
MessageContext$1.prototype.Statements = function() {
  return this.braceBlock()?.block()?.stat() || [];
};
CreationContext$1.prototype.Statements = function() {
  return this.braceBlock()?.block()?.stat() || [];
};
IfBlockContext.prototype.Statements = function() {
  return this.braceBlock()?.block()?.stat() || [];
};
LoopContext.prototype.Statements = function() {
  return this.braceBlock()?.block()?.stat() || [];
};

const seqParser$1 = sequenceParser;
const CreationContext = seqParser$1.CreationContext;
const StatContext$1 = seqParser$1.StatContext;
const MessageContext = seqParser$1.MessageContext;
const AsyncMessageContext = seqParser$1.AsyncMessageContext;
const ReturnAsyncMessageContext = seqParser$1.ReturnAsyncMessageContext;
const RetContext = seqParser$1.RetContext;
CreationContext.prototype.From = function() {
  if (this.parentCtx instanceof StatContext$1) {
    return this.ClosestAncestorStat().Origin();
  }
  return void 0;
};
MessageContext.prototype.ProvidedFrom = function() {
  const fromCtx = this.messageBody()?.fromTo()?.from();
  return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
};
MessageContext.prototype.From = function() {
  return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
};
AsyncMessageContext.prototype.ProvidedFrom = function() {
  const fromCtx = this.from();
  return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
};
AsyncMessageContext.prototype.From = function() {
  return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
};
ReturnAsyncMessageContext.prototype.ProvidedFrom = function() {
  const fromCtx = this.from();
  return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
};
ReturnAsyncMessageContext.prototype.From = function() {
  return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
};
RetContext.prototype.From = function() {
  return this.asyncMessage()?.From() || this.returnAsyncMessage()?.From() || this.ClosestAncestorStat().Origin();
};

const seqParser = sequenceParser;
const StatContext = seqParser.StatContext;
antlr4.ParserRuleContext.prototype.ClosestAncestorStat = function() {
  if (this instanceof StatContext) {
    return this;
  }
  let current = this.parentCtx;
  while (current && !(current instanceof StatContext)) {
    current = current.parentCtx;
  }
  if (current instanceof StatContext) {
    return current;
  }
  return void 0;
};
antlr4.ParserRuleContext.prototype.ClosestAncestorBlock = function() {
  const parentCtx = this.ClosestAncestorStat()?.parentCtx;
  if (parentCtx instanceof seqParser.BlockContext) {
    return parentCtx;
  }
  console.warn("Cannot find closest ancestor block for context:", this);
  return void 0;
};

antlr4.ParserRuleContext.prototype.getAncestors = function(predicate) {
  const ancestors = [];
  if (!predicate || predicate(this)) {
    ancestors.push(this);
  }
  let current = this.parentCtx;
  while (current) {
    if (!predicate || predicate(current)) {
      ancestors.push(current);
    }
    current = current.parentCtx;
  }
  return ancestors;
};

const formatText = (text) => text.replace(/[\n\r]/g, " ").replace(/\s+/g, " ").replace(/\s*([,;.])\s*/g, "$1").replace(/\s*(\()\s*|\s*(\))/g, "$1$2").replace(/\s+$/g, "").replace(/^"(.*)"$/, "$1");

const errors = [];
const errorDetails = [];
class SeqErrorListener extends antlr4.error.ErrorListener {
  syntaxError(recognizer, offendingSymbol, line, column, msg) {
    errors.push(`${offendingSymbol} line ${line}, col ${column}: ${msg}`);
    errorDetails.push({
      line,
      column,
      msg,
    });
  }
}

function createParser(code, { silent = false } = {}) {
  const chars = new antlr4.InputStream(code);
  const lexer = new sequenceLexer(chars);
  if (silent) {
    lexer.removeErrorListeners();
  }
  const tokens = new antlr4.CommonTokenStream(lexer);
  const parser = new sequenceParser(tokens);
  if (silent) {
    parser.removeErrorListeners();
  }
  return parser;
}

// Memoize error-free parse results so the same code is parsed once even when
// multiple render paths (store, SVG export, CLI) need the tree.
const rootContextCache = new Map();
const ROOT_CONTEXT_CACHE_MAX = 10;

function rootContext(code) {
  const cached = rootContextCache.get(code);
  if (cached) {
    return cached;
  }

  // Two-stage parsing: SLL prediction is an order of magnitude faster than
  // full LL and, when it succeeds, is guaranteed to produce the same parse
  // tree. BailErrorStrategy aborts on the first syntax error so invalid input
  // falls through to the full LL parse below, which keeps error recovery and
  // error reporting behavior unchanged.
  const sllParser = createParser(code, { silent: true });
  sllParser._interp.predictionMode = antlr4.atn.PredictionMode.SLL;
  sllParser._errHandler = new antlr4.error.BailErrorStrategy();
  try {
    const tree = sllParser.prog();
    rootContextCache.set(code, tree);
    if (rootContextCache.size > ROOT_CONTEXT_CACHE_MAX) {
      rootContextCache.delete(rootContextCache.keys().next().value);
    }
    return tree;
  } catch {
    // fall through to full LL parse
  }

  const parser = createParser(code);
  parser.addErrorListener(new SeqErrorListener());
  return parser._syntaxErrors ? null : parser.prog();
}

antlr4.ParserRuleContext.prototype.getFormattedText = function () {
  const code = this.parser.getTokenStream().getText(this.getSourceInterval());
  // remove extra quotes, spaces and new lines
  return formatText(code);
};

// Comment is where users have the most flexibility. The parser should make minimal assumptions about
// the content and the style including change of line, indentation, etc.
antlr4.ParserRuleContext.prototype.getComment = function () {
  let tokenIndex = this.start.tokenIndex;
  let channel = sequenceLexer.channelNames.indexOf("COMMENT_CHANNEL");
  if (this.constructor.name === "BraceBlockContext") {
    tokenIndex = this.stop.tokenIndex;
  }
  let hiddenTokensToLeft = this.parser
    .getTokenStream()
    .getHiddenTokensToLeft(tokenIndex, channel);
  return (
    hiddenTokensToLeft &&
    hiddenTokensToLeft
      .map((t) => t.text.substring(2)) // skip '//'
      .join("\n")
  );
};

sequenceParser.ProgContext;
const RootContext = rootContext;
sequenceParser.GroupContext;
sequenceParser.ParticipantContext;
const Participants = function (ctx) {
  const toCollector = ToCollector;
  return toCollector.getParticipants(ctx);
};

const Parser = {
  RootContext: rootContext,
  ProgContext: sequenceParser.ProgContext,
  GroupContext: sequenceParser.GroupContext,
  ParticipantContext: sequenceParser.ParticipantContext,
  Participants: function (ctx) {
    const toCollector = ToCollector;
    return toCollector.getParticipants(ctx);
  },
  Errors: errors,
  ErrorDetails: errorDetails,
  /**
   * @return {number} how many levels of embedded fragments
   */
  Depth: function (ctx) {
    const childFragmentDetector = ChildFragmentDetector;
    return childFragmentDetector.depth(childFragmentDetector)(ctx);
  },
};

const FRAGMENT_PADDING_X = 10;
const FRAGMENT_MIN_WIDTH = 100;
const MARGIN = 20;
const ARROW_HEAD_WIDTH = 10;
const OCCURRENCE_WIDTH = 15;
const OCCURRENCE_BAR_SIDE_WIDTH = (OCCURRENCE_WIDTH - 1) / 2;
const MIN_PARTICIPANT_WIDTH = 80;
const PARTICIPANT_ICON_WIDTH = 40;
const LIFELINE_WIDTH = 1;
const PARTICIPANT_TOP_SPACE_FOR_GROUP = 20;
const OCCURRENCE_EMPTY_HEIGHT = 24;

var TextType = /* @__PURE__ */ ((TextType2) => {
  TextType2[TextType2["MessageContent"] = 0] = "MessageContent";
  TextType2[TextType2["ParticipantName"] = 1] = "ParticipantName";
  return TextType2;
})(TextType || {});

var OwnableMessageType = /* @__PURE__ */ ((OwnableMessageType2) => {
  OwnableMessageType2[OwnableMessageType2["SyncMessage"] = 0] = "SyncMessage";
  OwnableMessageType2[OwnableMessageType2["AsyncMessage"] = 1] = "AsyncMessage";
  OwnableMessageType2[OwnableMessageType2["CreationMessage"] = 2] = "CreationMessage";
  OwnableMessageType2[OwnableMessageType2["ReturnMessage"] = 3] = "ReturnMessage";
  return OwnableMessageType2;
})(OwnableMessageType || {});

class MessageCollector extends sequenceParserListener {
  isBlind = false;
  ownableMessages = [];
  enterMessage = (ctx) => this._addOwnedMessage(OwnableMessageType.SyncMessage)(ctx);
  enterAsyncMessage = (ctx) => this._addOwnedMessage(OwnableMessageType.AsyncMessage)(ctx);
  enterCreation = (ctx) => this._addOwnedMessage(OwnableMessageType.CreationMessage)(ctx);
  enterReturnAsyncMessage = (ctx) => this._addOwnedMessage(OwnableMessageType.ReturnMessage)(ctx);
  enterRet = (ctx) => {
    if (ctx.asyncMessage() || ctx.returnAsyncMessage()) {
      return;
    }
    this._addOwnedMessage(OwnableMessageType.ReturnMessage)(ctx);
  };
  _addOwnedMessage = (type) => (ctx) => {
    if (this.isBlind) {
      return;
    }
    const from = ctx.From();
    const owner = ctx?.Owner();
    let signature = ctx?.SignatureText();
    if (from === owner && ctx.Assignment) {
      const assignment = ctx.Assignment();
      if (assignment) {
        signature = `${assignment.getText()} = ${signature}`;
      }
    }
    this.ownableMessages.push({
      from,
      signature,
      type,
      to: owner
    });
  };
  enterParameters() {
    this.isBlind = true;
  }
  exitParameters() {
    this.isBlind = false;
  }
  result() {
    return this.ownableMessages;
  }
}
const allMessagesCache = /* @__PURE__ */ new WeakMap();
function AllMessages(ctx) {
  if (!ctx) return [];
  const cached = allMessagesCache.get(ctx);
  if (cached) return cached;
  const walker = antlr4.tree.ParseTreeWalker.DEFAULT;
  const listener = new MessageCollector();
  walker.walk(listener, ctx);
  const result = listener.result();
  allMessagesCache.set(ctx, result);
  return result;
}

const _STARTER_ = "_STARTER_";
class Participant {
  name;
  left;
  label;
  type;
  stereotype;
  color;
  emoji;
  groupId;
  constructor(name, left, label, type, stereotype, color, groupId, emoji) {
    this.name = name;
    this.left = left;
    this.label = label;
    this.type = type;
    this.stereotype = stereotype;
    this.color = color;
    this.groupId = groupId;
    this.emoji = emoji;
  }
  getDisplayName() {
    return this.label || this.name;
  }
  hasIcon() {
    return this.type !== void 0;
  }
}
const orderedParticipantsCache = /* @__PURE__ */ new WeakMap();
function OrderedParticipants(rootContext) {
  if (!rootContext) return [];
  const cached = orderedParticipantsCache.get(rootContext);
  if (cached) return cached;
  const participants = ToCollector.getParticipants(rootContext);
  const participantEntries = Array.from(participants.participants.entries());
  const allMessages = AllMessages(rootContext);
  const emptyContext = allMessages.length === 0 && participantEntries.length === 0;
  const someMessagesMissFrom = allMessages.some((m) => !m.from);
  const needDefaultStarter = emptyContext || someMessagesMissFrom;
  if (needDefaultStarter) {
    participantEntries.unshift([
      _STARTER_,
      { ...blankParticipant, name: _STARTER_, isStarter: true }
    ]);
  }
  const result = participantEntries.map(
    (entry, index, entries) => {
      const participant = entry[1];
      const previousName = index > 0 ? entries[index - 1][1].name : "";
      return new Participant(
        participant.name,
        previousName,
        participant.label,
        participant.type,
        participant.stereotype,
        participant.color,
        participant.groupId,
        participant.emoji
      );
    }
  );
  orderedParticipantsCache.set(rootContext, result);
  return result;
}

const LEVELS = ["log", "trace", "debug", "info", "warn", "error"];
const LEVEL_WEIGHT = {
  trace: 10,
  debug: 20,
  log: 30,
  info: 30,
  warn: 40,
  error: 50
};
const THRESHOLD = LEVEL_WEIGHT.warn;
function consoleFn(level) {
  const fn = console[level];
  return typeof fn === "function" ? fn.bind(console) : console.log.bind(console);
}
function createLogger(prefix) {
  const logger = {};
  for (const level of LEVELS) {
    const fn = consoleFn(level);
    logger[level] = (...args) => {
      if (LEVEL_WEIGHT[level] >= THRESHOLD) {
        if (prefix) {
          fn(prefix[0], prefix[1], ...args);
        } else {
          fn(...args);
        }
      }
    };
  }
  logger.child = (opts) => createLogger(["%c" + (opts.name || ""), "color: #00f"]);
  return logger;
}
const rootLogger = createLogger();

function Dual(p, v) {
  return { position: p, velocity: v };
}
function dualPlus(x, y) {
  return Dual(x.position + y.position, x.velocity + y.velocity);
}
const epsilon = Math.sqrt(Number.EPSILON);
function dualLessThan(x, y) {
  const d = x.position - y.position;
  return d < -epsilon || Math.abs(d) <= epsilon && x.velocity < y.velocity;
}
function DeltaTracker() {
  return {
    delta: Infinity,
    dualLessThan: function(x, y) {
      const lessThan = dualLessThan(x, y);
      if (lessThan) {
        [x, y] = [y, x];
      }
      if (x.velocity < y.velocity) {
        this.delta = Math.min(
          this.delta,
          (x.position - y.position) / (y.velocity - x.velocity)
        );
      }
      return lessThan;
    }
  };
}
function graphFromMatrix(n, matrix) {
  const graph = Array();
  for (let j = 0; j < n; j++) {
    graph.push([]);
    for (let i = 0; i < j; i++) {
      if (matrix[i][j] > 0) {
        graph[j].push({ i, length: Dual(matrix[i][j], 0) });
      }
    }
  }
  return graph;
}
function longestPathTable(graph, gaps) {
  const tracker = DeltaTracker();
  let maximum = Dual(0, 0);
  const table = [];
  for (let j = 0; j < graph.length; j++) {
    let argument = null;
    if (j > 0) {
      maximum = dualPlus(maximum, gaps[j - 1]);
    }
    for (const edge of graph[j]) {
      const x = dualPlus(table[edge.i].maximum, edge.length);
      if (tracker.dualLessThan(maximum, x)) {
        argument = edge.i;
        maximum = x;
      }
    }
    table.push({ argument, maximum });
  }
  return [tracker.delta, table];
}
function freezeCriticalGaps(table, graph, gaps) {
  let j = table.length - 1;
  while (j > 0) {
    const argument = table[j].argument;
    if (argument !== null) {
      j = argument;
    } else {
      j--;
      gaps[j].velocity = 0;
    }
  }
}
function advanceGaps(gaps, delta) {
  for (let i = 0; i < gaps.length; i++) {
    gaps[i].position += gaps[i].velocity * delta;
  }
}
function positionsFromTable(table) {
  const positions = [];
  for (const entry of table) {
    positions.push(entry.maximum.position);
  }
  return positions;
}
function find_optimal(matrix) {
  const n = matrix.length;
  const graph = graphFromMatrix(n, matrix);
  const gaps = [];
  for (let j = 1; j < n; j++) {
    gaps.push(Dual(0, 1));
  }
  while (true) {
    const [delta, table] = longestPathTable(graph, gaps);
    if (delta == Infinity) {
      return positionsFromTable(table);
    }
    if (table[n - 1].maximum.velocity > 0) {
      freezeCriticalGaps(table, graph, gaps);
    } else {
      advanceGaps(gaps, delta);
    }
  }
}

class Coordinates {
  m = [];
  widthProvider;
  participantModels;
  ownableMessages;
  participantModelsByName = /* @__PURE__ */ new Map();
  participantIndexByName = /* @__PURE__ */ new Map();
  participantWidthCache = /* @__PURE__ */ new Map();
  // Solved positions for all participants; the solver runs once per instance.
  positionsCache = null;
  constructor(ctx, widthProvider) {
    this.participantModels = OrderedParticipants(ctx);
    this.ownableMessages = AllMessages(ctx);
    this.participantModels.forEach((p, i) => {
      this.participantModelsByName.set(p.name, p);
      this.participantIndexByName.set(p.name, i);
    });
    this.widthProvider = widthProvider;
    this.walkThrough();
  }
  orderedParticipantNames() {
    return this.participantModels.map((p) => p.name);
  }
  getPosition(participantName) {
    if (!participantName) return 0;
    const pIndex = this.participantIndexByName.get(participantName);
    if (pIndex === void 0) {
      console.warn(`Participant ${participantName} not found`);
      return 0;
    }
    if (!this.positionsCache) {
      this.positionsCache = find_optimal(this.m);
    }
    const leftGap = this.getParticipantGap(this.participantModels[0]);
    const position = leftGap + this.positionsCache[pIndex];
    rootLogger.debug(`Position of ${participantName} is ${position}`);
    return position;
  }
  walkThrough() {
    this.withParticipantGaps(this.participantModels);
    this.withMessageGaps(this.ownableMessages);
  }
  half(participantName) {
    const participant = this.getParticipantModel(participantName);
    return participant ? this._getParticipantWidth(participant) / 2 : 0;
  }
  left(participantName) {
    return this.getPosition(participantName) - this.half(participantName);
  }
  right(participantName) {
    return this.getPosition(participantName) + this.half(participantName);
  }
  getWidth() {
    const lastParticipant = this.participantModels[this.participantModels.length - 1].name;
    const calculatedWidth = this.getPosition(lastParticipant) + this.half(lastParticipant);
    return Math.max(calculatedWidth, 200);
  }
  distance(left, right) {
    return this.getPosition(right) - this.getPosition(left);
  }
  getMessageWidth(message) {
    const halfSelf = this.half(message.to);
    let messageWidth = this.widthProvider(
      message.signature,
      TextType.MessageContent
    );
    if (message.type === OwnableMessageType.CreationMessage) {
      messageWidth += halfSelf;
    }
    return messageWidth;
  }
  withMessageGaps(ownableMessages) {
    for (const message of ownableMessages) {
      const from = message.from || _STARTER_;
      const indexFrom = this.participantIndexByName.get(from) ?? -1;
      const indexTo = this.participantIndexByName.get(message.to) ?? -1;
      if (indexFrom === -1 || indexTo === -1) {
        console.warn(`Participant ${from} or ${message.to} not found`);
        continue;
      }
      const leftIndex = Math.min(indexFrom, indexTo);
      const rightIndex = Math.max(indexFrom, indexTo);
      try {
        const messageWidth = this.getMessageWidth(message);
        this.m[leftIndex][rightIndex] = Math.max(
          messageWidth + ARROW_HEAD_WIDTH + OCCURRENCE_WIDTH,
          this.m[leftIndex][rightIndex]
        );
      } catch {
        console.warn(
          `Could not set message gap between ${from} and ${message.to}`
        );
      }
    }
  }
  withParticipantGaps(participantModels) {
    this.m = participantModels.map((_, i) => {
      return participantModels.map((v, j) => {
        return j - i === 1 ? this.getParticipantGap(v) : 0;
      });
    });
  }
  getParticipantGap(p) {
    return this.half(p.left) + this.half(p.name);
  }
  getParticipantModel(name) {
    return this.participantModelsByName.get(name);
  }
  _getParticipantWidth(participant) {
    const cachedWidth = this.participantWidthCache.get(participant.name);
    if (cachedWidth != null) {
      return cachedWidth;
    }
    const hasIcon = participant.hasIcon();
    const iconWidth = hasIcon ? PARTICIPANT_ICON_WIDTH : 0;
    const emojiWidth = participant.emoji ? 24 : 0;
    const labelWidth = this.widthProvider(
      participant.getDisplayName(),
      TextType.ParticipantName
    );
    const participantWidth = Math.max(labelWidth + iconWidth + emojiWidth, MIN_PARTICIPANT_WIDTH) + MARGIN;
    this.participantWidthCache.set(participant.name, participantWidth);
    rootLogger.debug(
      `Width of ${participant.name} is ${participantWidth}; labelWidth: ${labelWidth}`
    );
    return participantWidth;
  }
}

const createStatementKey = (statement) => {
  if (!statement?.start || !statement?.stop) {
    return "";
  }
  return `${statement.start.start}-${statement.stop.stop}`;
};

class NodeVM {
  constructor(context, runtime) {
    this.context = context;
    this.runtime = runtime;
  }
  layoutBlock(blockContext, origin, startTop, parentKind) {
    if (!blockContext) {
      return startTop;
    }
    return new BlockVM(blockContext, this.runtime).layout(
      origin,
      startTop,
      parentKind
    );
  }
}

function getLocalParticipantNames(ctx) {
  if (!ctx) return [];
  return [ctx.Origin() || _STARTER_, ...Participants(ctx).Names()];
}

const cssColors = [
  "aliceblue",
  "antiquewhite",
  "aqua",
  "aquamarine",
  "azure",
  "beige",
  "bisque",
  "black",
  "blanchedalmond",
  "blue",
  "blueviolet",
  "brown",
  "burlywood",
  "cadetblue",
  "chartreuse",
  "chocolate",
  "coral",
  "cornflowerblue",
  "cornsilk",
  "crimson",
  "cyan",
  "darkblue",
  "darkcyan",
  "darkgoldenrod",
  "darkgray",
  "darkgreen",
  "darkgrey",
  "darkkhaki",
  "darkmagenta",
  "darkolivegreen",
  "darkorange",
  "darkorchid",
  "darkred",
  "darksalmon",
  "darkseagreen",
  "darkslateblue",
  "darkslategray",
  "darkslategrey",
  "darkturquoise",
  "darkviolet",
  "deeppink",
  "deepskyblue",
  "dimgray",
  "dimgrey",
  "dodgerblue",
  "firebrick",
  "floralwhite",
  "forestgreen",
  "fuchsia",
  "gainsboro",
  "ghostwhite",
  "gold",
  "goldenrod",
  "gray",
  "green",
  "greenyellow",
  "grey",
  "honeydew",
  "hotpink",
  "indianred",
  "indigo",
  "ivory",
  "khaki",
  "lavender",
  "lavenderblush",
  "lawngreen",
  "lemonchiffon",
  "lightblue",
  "lightcoral",
  "lightcyan",
  "lightgoldenrodyellow",
  "lightgray",
  "lightgreen",
  "lightgrey",
  "lightpink",
  "lightsalmon",
  "lightseagreen",
  "lightskyblue",
  "lightslategray",
  "lightslategrey",
  "lightsteelblue",
  "lightyellow",
  "lime",
  "limegreen",
  "linen",
  "magenta",
  "maroon",
  "mediumaquamarine",
  "mediumblue",
  "mediumorchid",
  "mediumpurple",
  "mediumseagreen",
  "mediumslateblue",
  "mediumspringgreen",
  "mediumturquoise",
  "mediumvioletred",
  "midnightblue",
  "mintcream",
  "mistyrose",
  "moccasin",
  "navajowhite",
  "navy",
  "oldlace",
  "olive",
  "olivedrab",
  "orange",
  "orangered",
  "orchid",
  "palegoldenrod",
  "palegreen",
  "paleturquoise",
  "palevioletred",
  "papayawhip",
  "peachpuff",
  "peru",
  "pink",
  "plum",
  "powderblue",
  "purple",
  "rebeccapurple",
  "red",
  "rosybrown",
  "royalblue",
  "saddlebrown",
  "salmon",
  "sandybrown",
  "seagreen",
  "seashell",
  "sienna",
  "silver",
  "skyblue",
  "slateblue",
  "slategray",
  "slategrey",
  "snow",
  "springgreen",
  "steelblue",
  "tan",
  "teal",
  "thistle",
  "tomato",
  "turquoise",
  "violet",
  "wheat",
  "white",
  "whitesmoke",
  "yellow",
  "yellowgreen"
];
const fontStyles = ["italic", "oblique"];
const fontWeights = ["bold", "bolder", "lighter"];
const textDecorations = ["underline", "overline", "line-through"];
const getStyle = (styles) => {
  const textStyle = {};
  const classNames = [];
  styles.forEach((value) => {
    switch (true) {
      case cssColors.includes(value):
        textStyle.color = value;
        break;
      case fontStyles.includes(value):
        textStyle.fontStyle = value;
        break;
      case fontWeights.includes(value):
        textStyle.fontWeight = value;
        break;
      case textDecorations.includes(value):
        textStyle.textDecoration = value;
        break;
      default:
        classNames.push(value);
    }
  });
  return { textStyle, classNames };
};

const BUILTIN_EMOJIS = {
  // Status/feedback
  check: "✅",
  x: "❌",
  warning: "⚠️",
  exclamation: "❗",
  question: "❓",
  bulb: "💡",
  eyes: "👀",
  // Actions
  rocket: "🚀",
  fire: "🔥",
  zap: "⚡",
  boom: "💥",
  sparkles: "✨",
  tada: "🎉",
  confetti_ball: "🎊",
  // Objects
  lock: "🔒",
  unlock: "🔓",
  key: "🔑",
  gear: "⚙️",
  hammer: "🔨",
  wrench: "🔧",
  package: "📦",
  email: "📧",
  link: "🔗",
  clipboard: "📋",
  bookmark: "🔖",
  // Communication
  speech_balloon: "💬",
  thought_balloon: "💭",
  bell: "🔔",
  megaphone: "📣",
  // Nature/weather
  cloud: "☁️",
  sun: "☀️",
  star: "⭐",
  globe: "🌐",
  // Arrows
  arrow_right: "➡️",
  arrow_left: "⬅️",
  arrow_up: "⬆️",
  arrow_down: "⬇️",
  // People
  wave: "👋",
  thumbsup: "👍",
  thumbsdown: "👎",
  // Tech / Architecture
  computer: "💻",
  iphone: "📱",
  robot: "🤖",
  bug: "🐛",
  database: "🗄️",
  server: "🖥️",
  api: "🔌",
  gateway: "🚪",
  queue: "📬",
  cache: "⚡",
  service: "⚙️",
  processor: "🔄",
  store: "🏪",
  worker: "👷",
  container: "📦",
  network: "🌐",
  // Data
  chart: "📊",
  chart_with_upwards_trend: "📈",
  chart_with_downwards_trend: "📉",
  // Containers
  inbox_tray: "📥",
  outbox_tray: "📤",
  file_folder: "📁",
  // Time
  hourglass: "⏳",
  clock: "🕐",
  stopwatch: "⏱️",
  // Symbols
  heavy_check_mark: "✔️",
  heavy_multiplication_x: "✖️",
  red: "🔴",
  red_circle: "🔴",
  green_circle: "🟢",
  blue_circle: "🔵",
  white_circle: "⚪",
  black_circle: "⚫",
  heart: "❤️",
  shield: "🛡️",
  // Food/common
  coffee: "☕",
  pizza: "🍕",
  // Transport
  car: "🚗",
  bus: "🚌",
  airplane: "✈️",
  ship: "🚢",
  // Database/infra
  floppy_disk: "💾",
  cd: "💿",
  satellite: "🛰️",
  factory: "🏭",
  hospital: "🏥",
  bank: "🏦",
  // Misc
  construction: "🚧",
  recycle: "♻️",
  receipt: "🧾",
  cart: "🛒",
  cylinder: "🪨",
  dollar: "💵"
};

let knownEmojis = new Set(Object.keys(BUILTIN_EMOJIS));
function isEmojiCandidate(name) {
  if (name.includes("-")) return false;
  return knownEmojis.has(name);
}
function resolveBracketContent(raw) {
  const result = {
    classNames: [],
    style: {},
    emojis: [],
    unicodes: []
  };
  const values = raw.split(",").map((s) => s.trim()).filter(Boolean);
  for (const value of values) {
    const colonMatch = value.match(/^:(.+):$/);
    if (colonMatch) {
      const name = colonMatch[1];
      result.classNames.push(name);
      result.emojis.push(name);
      continue;
    }
    result.classNames.push(value);
    const { textStyle } = getStyle([value]);
    if (Object.keys(textStyle).length > 0) {
      Object.assign(result.style, textStyle);
      continue;
    }
    if (isEmojiCandidate(value)) {
      result.emojis.push(value);
    }
  }
  return result;
}
function resolveEmojiInText(text) {
  return text.replace(/\[([^\]]+)\]/g, (match, content) => {
    const resolution = resolveBracketContent(content);
    if (resolution.emojis.length > 0) {
      return resolution.emojis.map((name) => getEmojiUnicode(name)).join("");
    }
    return match;
  });
}
function getEmojiUnicode(shortcode, cache) {
  return BUILTIN_EMOJIS[shortcode] || shortcode;
}

function parseLine(input) {
  const result = {
    "<>": /* @__PURE__ */ new Set(),
    "()": /* @__PURE__ */ new Set(),
    "[]": /* @__PURE__ */ new Set()
  };
  const pattern = /<([^>]*)>|\(([^)]*)\)|\[([^\]]*)\]|([^<>()[\]\s]+)/g;
  let match;
  let lastMatchIndex;
  while (match = pattern.exec(input)) {
    if (match[4]) {
      if (lastMatchIndex !== void 0) lastMatchIndex = match.index;
      break;
    }
    lastMatchIndex = match.index + match[0].length;
    if (match[1]) {
      match[1].split(",").forEach((s) => result["<>"].add(s.trim()));
    }
    if (match[2]) {
      match[2].split(",").forEach((s) => result["()"].add(s.trim()));
    }
    if (match[3]) {
      match[3].split(",").forEach((s) => result["[]"].add(s.trim()));
    }
  }
  return [
    Array.from(result["<>"]),
    Array.from(result["()"]),
    Array.from(result["[]"]),
    input.slice(lastMatchIndex)
  ];
}
class CommentClass {
  // define properties color and text
  text = "";
  /** @deprecated use commentStyle or messageStyle instead */
  classNames = [];
  /** @deprecated use commentClassNames or messageClassNames instead */
  textStyle = {};
  commentStyle = {};
  messageStyle = {};
  commentClassNames = [];
  messageClassNames = [];
  emojis = [];
  // Raw comment contains all spaces and newlines
  constructor(raw) {
    const lines = raw.trim().split("\n");
    const lastLine = lines[lines.length - 1];
    const [commentOnlyStyles, messageOnlyStyles, commonStyles, text] = parseLine(lastLine);
    const resolved = resolveBracketContent(commonStyles.join(", "));
    this.emojis = resolved.emojis;
    const emojiSet = new Set(this.emojis);
    const stylesForGetStyle = commonStyles.filter((s) => {
      if (/^:.+:$/.test(s)) return false;
      return !emojiSet.has(s);
    });
    const { textStyle: commentStyle, classNames: commentClassNames } = getStyle(commentOnlyStyles);
    const { textStyle: messageStyle, classNames: messageClassNames } = getStyle(messageOnlyStyles);
    const { textStyle: commonStyle, classNames: commonClassNames } = getStyle(stylesForGetStyle);
    const baseText = (lines.slice(0, lines.length - 1).join("\n") + "\n" + text).trim();
    const emojiPrefix = this.emojis.map((name) => getEmojiUnicode(name)).join("");
    this.text = emojiPrefix && baseText ? `${emojiPrefix} ${baseText}` : emojiPrefix || baseText;
    this.textStyle = { ...commonStyle, ...commentStyle, ...messageStyle };
    this.classNames = [
      ...commonClassNames,
      ...commentClassNames,
      ...messageClassNames
    ];
    this.commentStyle = { ...commonStyle, ...commentStyle };
    this.messageStyle = { ...commonStyle, ...messageStyle };
    this.commentClassNames = [...commonClassNames, ...commentClassNames];
    this.messageClassNames = [...commonClassNames, ...messageClassNames];
  }
}

const defaultTokensOptions = {
  gfm: true,
  breaks: true
};
class MarkdownMeasurer {
  measure(_text) {
    if (!_text || !_text.trim()) {
      return 0;
    }
    const commentObj = new CommentClass(_text);
    const tokens = marked.lexer(commentObj?.text ?? "", defaultTokensOptions);
    if (!tokens.length) {
      return 0;
    }
    const lines = _text.trim().split("\n");
    return lines.length * 20;
  }
}

class StatementVM extends NodeVM {
  get metrics() {
    return this.runtime.metrics;
  }
  measureComment(context = this.context) {
    if (!context?.getComment || !context.getComment()) return 0;
    return new MarkdownMeasurer().measure(context.getComment());
  }
  resolveFragmentOrigin(fallbackOrigin) {
    try {
      const participants = getLocalParticipantNames(this.context) || [];
      return participants[0] || fallbackOrigin;
    } catch (error) {
      console.warn("Failed to resolve fragment origin", error);
      return fallbackOrigin;
    }
  }
  findLeftParticipant(ctx, fallbackOrigin) {
    if (!ctx) return void 0;
    const local = getLocalParticipantNames(ctx) || [];
    const ordered = this.runtime.participants;
    return ordered.find((name) => local.includes(name)) || local[0] || fallbackOrigin || void 0;
  }
  measureOccurrence(context, top, participant, minHeight = 24, contentInset = 1) {
    const block = context?.braceBlock?.()?.block?.();
    if (!block) {
      return minHeight;
    }
    const offset = this.metrics.statementMarginY - contentInset;
    const blockStart = top - offset;
    const blockEnd = this.layoutBlock(
      block,
      participant || this.runtime.originParticipant,
      blockStart
    );
    const height = blockEnd - blockStart - offset;
    return Math.max(minHeight, height);
  }
  isRootLevelStatement(statCtx) {
    const block = statCtx?.parentCtx;
    return block === this.runtime.rootBlock;
  }
  isFirstStatement(statCtx) {
    const block = statCtx?.parentCtx;
    const statements = block?.stat?.() || [];
    return statements.length > 0 && statements[0] === statCtx;
  }
  altHasMultipleBranches(ctx) {
    if (typeof ctx?.alt !== "function") {
      return false;
    }
    const altContext = ctx.alt();
    if (!altContext) {
      return false;
    }
    const elseIfBlocks = altContext?.elseIfBlock?.() || [];
    const hasElse = Boolean(altContext?.elseBlock?.());
    return elseIfBlocks.length > 0 || hasElse;
  }
}

class AsyncMessageStatementVM extends StatementVM {
  constructor(statement, asyncMessage, runtime) {
    super(statement, runtime);
    this.asyncMessage = asyncMessage;
  }
  kind = "async";
  measure(top, origin) {
    const asyncContext = this.asyncMessage;
    const commentHeight = this.measureComment(asyncContext);
    const source = asyncContext?.From?.() || asyncContext?.ProvidedFrom?.() || asyncContext?.Origin?.() || origin;
    const target = asyncContext?.Owner?.() || asyncContext?.to?.()?.getFormattedText?.() || source;
    const isSelf = source === target;
    const messageHeight = isSelf ? 44 : 16;
    return {
      top,
      height: commentHeight + messageHeight,
      kind: this.kind
    };
  }
}

const CREATION_MESSAGE_HEIGHT = 40;
class CreationStatementVM extends StatementVM {
  constructor(statement, creation, runtime) {
    super(statement, runtime);
    this.creation = creation;
  }
  kind = "creation";
  measure(top, originParticipant) {
    const participant = this.creation?.Owner?.() || originParticipant;
    const commentHeight = this.measureComment(this.creation);
    if (participant) {
      this.runtime.updateCreationTop(participant, top + commentHeight);
    }
    let cursor = top + commentHeight + CREATION_MESSAGE_HEIGHT;
    const block = this.creation?.braceBlock?.()?.block?.();
    if (block) {
      const fragmentOrigin = this.findLeftParticipant(this.creation, originParticipant) || originParticipant;
      cursor = this.layoutBlock(block, fragmentOrigin, cursor, this.kind);
      cursor += 2;
    } else {
      cursor += 22;
    }
    const assignment = this.creation?.Assignment?.();
    if (assignment) {
      rootLogger.info(`creation::assignment::${participant}`);
      cursor += 12;
    }
    const height = cursor - top;
    return {
      top,
      height,
      kind: this.kind
    };
  }
}

class DividerStatementVM extends StatementVM {
  kind = "divider";
  measure(top) {
    return { top, height: 40, kind: this.kind };
  }
}

class EmptyStatementVM extends StatementVM {
  kind = "empty";
  measure(top) {
    return { top, height: 0, kind: this.kind };
  }
}

class FragmentVM extends StatementVM {
  beginFragment(context, top) {
    const commentHeight = this.measureComment(context);
    const headerHeight = this.metrics.fragmentHeaderHeight;
    return {
      cursor: top + commentHeight + headerHeight,
      commentHeight,
      headerHeight
    };
  }
  finalizeFragment(top, cursor) {
    cursor += this.metrics.fragmentPaddingBottom;
    return {
      top,
      height: cursor - top
    };
  }
}

class FragmentAltVM extends FragmentVM {
  constructor(statement, alt, runtime) {
    super(statement, runtime);
    this.alt = alt;
  }
  kind = "alt";
  measure(top, origin) {
    const leftParticipant = this.findLeftParticipant(this.alt, origin) || origin;
    const commentHeight = this.measureComment(this.alt);
    let cursor = top + 1 + this.metrics.fragmentHeaderHeight + commentHeight;
    const ifBlock = this.alt?.ifBlock?.();
    if (ifBlock) {
      cursor += 20;
      cursor = this.layoutBlock(
        ifBlock.braceBlock()?.block(),
        leftParticipant,
        cursor
      );
    }
    this.alt?.elseIfBlock?.()?.forEach((block) => {
      cursor += 20;
      cursor += 8;
      cursor += 1;
      cursor = this.layoutBlock(
        block?.braceBlock?.()?.block?.(),
        leftParticipant,
        cursor
      );
    });
    const elseBlock = this.alt?.elseBlock?.()?.braceBlock?.()?.block?.();
    if (elseBlock) {
      cursor += 20;
      cursor += 8;
      cursor += 1;
      cursor = this.layoutBlock(elseBlock, leftParticipant, cursor);
    }
    cursor += this.metrics.fragmentPaddingBottom + 1;
    return {
      top,
      height: cursor - top,
      kind: this.kind
    };
  }
}

class FragmentSingleBlockVM extends FragmentVM {
  constructor(statement, fragment, runtime) {
    super(statement, runtime);
    this.fragment = fragment;
  }
  measure(top, origin) {
    const commentHeight = this.measureComment(this.fragment);
    let cursor = top + 1 + this.metrics.fragmentHeaderHeight + commentHeight;
    const hasCondition = Boolean(this.fragment?.parExpr?.()?.condition?.());
    if (hasCondition) cursor += 20;
    const block = this.fragment?.braceBlock?.()?.block?.();
    if (block) {
      const fragmentOrigin = this.findLeftParticipant(this.fragment, origin) || origin;
      cursor = this.layoutBlock(block, fragmentOrigin, cursor, this.kind);
    }
    cursor += this.metrics.fragmentPaddingBottom + 1;
    return {
      top,
      height: cursor - top,
      kind: this.kind
    };
  }
}

class FragmentCriticalVM extends FragmentSingleBlockVM {
  kind = "critical";
}

class FragmentLoopVM extends FragmentSingleBlockVM {
  kind = "loop";
}

class FragmentOptVM extends FragmentSingleBlockVM {
  kind = "opt";
}

class FragmentParVM extends FragmentSingleBlockVM {
  kind = "par";
}

class FragmentRefVM extends FragmentVM {
  kind = "ref";
  measure(top) {
    const context = this.context?.ref?.() || this.context;
    const commentHeight = this.measureComment(context);
    const headerHeight = this.metrics.fragmentHeaderHeight;
    const height = commentHeight + headerHeight + this.metrics.fragmentPaddingBottom;
    return { top, height, kind: this.kind };
  }
}

class FragmentSectionVM extends FragmentSingleBlockVM {
  kind = "section";
}

class FragmentTryCatchVM extends FragmentVM {
  constructor(statement, tcf, runtime) {
    super(statement, runtime);
    this.tcf = tcf;
  }
  kind = "tcf";
  measure(top, origin) {
    const leftParticipant = this.findLeftParticipant(this.tcf, origin) || origin;
    const commentHeight = this.measureComment(this.tcf);
    let cursor = top + 1 + this.metrics.fragmentHeaderHeight + commentHeight;
    const tryBlock = this.tcf?.tryBlock?.()?.braceBlock?.()?.block?.();
    if (tryBlock) {
      cursor = this.layoutBlock(tryBlock, leftParticipant, cursor);
    }
    const catchBlocks = this.tcf?.catchBlock?.() || [];
    catchBlocks.forEach((catchBlock) => {
      cursor += 20;
      cursor += 8;
      cursor += 1;
      const block = catchBlock?.braceBlock?.()?.block?.();
      cursor = this.layoutBlock(block, leftParticipant, cursor);
    });
    const finallyBlock = this.tcf?.finallyBlock?.()?.braceBlock?.()?.block?.();
    if (finallyBlock) {
      cursor += 20;
      cursor += 8;
      cursor += 1;
      cursor = this.layoutBlock(finallyBlock, leftParticipant, cursor);
    }
    cursor += this.metrics.fragmentPaddingBottom + 1;
    return {
      top,
      height: cursor - top,
      kind: this.kind
    };
  }
}

class ReturnStatementVM extends StatementVM {
  kind = "return";
  returnContext;
  constructor(statement, runtime) {
    super(statement, runtime);
    this.returnContext = statement?.ret?.();
  }
  measure(top) {
    const context = this.returnContext || this.context;
    const commentHeight = this.measureComment(context);
    let cursor = top + commentHeight;
    const ret = this.returnContext;
    const asyncMessage = ret?.asyncMessage?.();
    const source = asyncMessage?.From?.() || ret?.From?.() || _STARTER_;
    const target = asyncMessage?.to?.()?.getFormattedText?.() || ret?.ReturnTo?.() || _STARTER_;
    const isSelf = source === target;
    const messageHeight = isSelf ? 20 : 0;
    cursor += messageHeight;
    if (!isSelf) {
      const block = this.context?.parentCtx;
      const siblings = block?.stat?.() || [];
      const isLast = siblings[siblings.length - 1] === this.context;
      const isInsideOccurrence = (() => {
        let ctx = block?.parentCtx;
        while (ctx) {
          if (typeof ctx.messageBody === "function" || typeof ctx.creationBody === "function") {
            return true;
          }
          ctx = ctx.parentCtx;
        }
        return false;
      })();
      if (!isLast || !isInsideOccurrence) {
        cursor += 16;
      }
    }
    const height = cursor - top;
    return { top, height, kind: this.kind };
  }
}

class SyncMessageStatementVM extends StatementVM {
  constructor(statement, message, runtime) {
    super(statement, runtime);
    this.message = message;
  }
  kind = "sync";
  measure(top, origin) {
    const commentHeight = this.measureComment(this.message);
    let cursor = top + commentHeight;
    const source = this.message.From?.() || _STARTER_;
    const target = this.message.Owner?.() || _STARTER_;
    const block = this.message.braceBlock?.()?.block?.();
    const assignee = this.message.Assignment?.();
    const isSelf = source === target;
    const messageHeight = isSelf ? 30 : 16;
    cursor += messageHeight;
    if (block) {
      const fragmentOrigin = this.findLeftParticipant(this.message, origin) || origin;
      cursor = this.layoutBlock(block, fragmentOrigin, cursor, this.kind);
      cursor += 2;
    } else {
      cursor += 22;
    }
    if (assignee && !isSelf) {
      cursor += 12;
    }
    const height = cursor - top;
    return { top, height, kind: this.kind };
  }
}

const createStatementVM = (statement, runtime) => {
  const creation = statement.creation?.();
  if (creation) {
    return new CreationStatementVM(statement, creation, runtime);
  }
  const message = statement.message?.();
  if (message) {
    return new SyncMessageStatementVM(statement, message, runtime);
  }
  const asyncMessage = statement.asyncMessage?.();
  if (asyncMessage) {
    return new AsyncMessageStatementVM(statement, asyncMessage, runtime);
  }
  if (statement.ret?.()) {
    return new ReturnStatementVM(statement, runtime);
  }
  if (statement.divider?.()) {
    return new DividerStatementVM(statement, runtime);
  }
  const loop = statement.loop?.();
  if (loop) {
    return new FragmentLoopVM(statement, loop, runtime);
  }
  const opt = statement.opt?.();
  if (opt) {
    return new FragmentOptVM(statement, opt, runtime);
  }
  const par = statement.par?.();
  if (par) {
    return new FragmentParVM(statement, par, runtime);
  }
  const section = statement.section?.();
  if (section) {
    return new FragmentSectionVM(statement, section, runtime);
  }
  const critical = statement.critical?.();
  if (critical) {
    return new FragmentCriticalVM(statement, critical, runtime);
  }
  const tcf = statement.tcf?.();
  if (tcf) {
    return new FragmentTryCatchVM(statement, tcf, runtime);
  }
  const alt = statement.alt?.();
  if (alt) {
    return new FragmentAltVM(statement, alt, runtime);
  }
  if (statement.ref?.()) {
    return new FragmentRefVM(statement, runtime);
  }
  return new EmptyStatementVM(statement, runtime);
};

class BlockVM extends NodeVM {
  statements;
  constructor(context, runtime) {
    super(context, runtime);
    this.statements = context?.stat?.() || [];
  }
  layout(originParticipant, startTop, parentKind) {
    if (!this.statements.length) return startTop;
    const metrics = this.runtime.metrics;
    let cursor = startTop + metrics.statementMarginY;
    this.statements.forEach((statement, index) => {
      if (parentKind === "par" && index !== 0) cursor += 1;
      const statementVM = createStatementVM(statement, this.runtime);
      const coordinate = statementVM.measure(cursor, originParticipant);
      this.runtime.recordCoordinate(statement, coordinate);
      cursor = coordinate.top + coordinate.height + metrics.statementMarginY;
    });
    return cursor;
  }
}

const SPACING_UNIT = 4;
const tw = (value) => value * SPACING_UNIT;
const DEFAULT_LAYOUT_METRICS = {
  statementMarginY: tw(4),
  // .statement-container .my-4
  fragmentHeaderHeight: 25,
  // .fragment .leading-4 => line-height: 1rem
  fragmentPaddingBottom: 10
  // .zenuml .fragment =>padding-bottom: 10px
};

class VerticalCoordinates {
  statementMap = /* @__PURE__ */ new Map();
  creationTops = /* @__PURE__ */ new Map();
  totalHeight;
  constructor(rootContext) {
    const rootBlock = rootContext?.block?.() ?? rootContext;
    const participants = OrderedParticipants(rootContext).map((p) => p.name);
    const messages = AllMessages(rootContext);
    const originParticipant = messages.length === 0 ? _STARTER_ : messages[0].from || _STARTER_;
    const runtime = {
      metrics: DEFAULT_LAYOUT_METRICS,
      rootBlock,
      participants,
      originParticipant,
      recordCoordinate: (statement, coordinate) => {
        const key = createStatementKey(statement);
        this.statementMap.set(key, coordinate);
      },
      updateCreationTop: (participant, top) => {
        const paddingTop = top - 8;
        rootLogger.info(`[VerticalCoordinates] updateCreationTop participant="${participant}" raw=${top} paddingTop=${paddingTop}`);
        this.creationTops.set(participant, paddingTop);
      }
    };
    const rootBlockVM = new BlockVM(rootBlock, runtime);
    this.totalHeight = rootBlockVM.layout(originParticipant, 56);
  }
  getCreationTop(participant) {
    return this.creationTops.get(participant);
  }
  getStatementCoordinate(key) {
    return this.statementMap.get(key);
  }
  getStatementCoordinateFor(statement) {
    return this.statementMap.get(createStatementKey(statement));
  }
  entries() {
    return Array.from(this.statementMap.entries());
  }
  getTotalHeight() {
    return this.totalHeight;
  }
}

let dic = {};
const persistDic = {};
const getCache = (key) => {
  if (key != null) {
    const cacheValue = dic[key] ?? persistDic[key];
    return cacheValue !== void 0 ? cacheValue : null;
  }
  return null;
};
const setCache = (key, value, persist = false) => {
  dic[key] = value;
  if (persist) {
    persistDic[key] = value;
  }
};

const FONT_FAMILY = "Helvetica, Verdana, serif";
const FONT_SIZE_PARTICIPANT = "16px";
const FONT_SIZE_FRAGMENT = "14px";
function getFontSpec() {
  return `${FONT_SIZE_PARTICIPANT} ${FONT_FAMILY}`;
}
let canvasCtx = null;
function setCanvasContext(ctx) {
  canvasCtx = ctx;
}
function getCanvasContext() {
  if (canvasCtx) return canvasCtx;
  try {
    if (typeof OffscreenCanvas !== "undefined") {
      canvasCtx = new OffscreenCanvas(1, 1).getContext("2d");
      rootLogger.debug("[ZenUML] WidthProviderOnCanvas: using OffscreenCanvas");
    } else if (typeof document !== "undefined") {
      canvasCtx = document.createElement("canvas").getContext("2d");
      rootLogger.debug("[ZenUML] WidthProviderOnCanvas: using <canvas> element");
    } else {
      rootLogger.debug("[ZenUML] WidthProviderOnCanvas: no canvas available, using character estimate fallback");
    }
  } catch {
    rootLogger.debug("[ZenUML] WidthProviderOnCanvas: canvas creation failed, using character estimate fallback");
  }
  return canvasCtx;
}
function WidthProviderOnCanvas(text, type) {
  const measured = text.trim();
  const cacheKey = `WidthProviderOnCanvas_${measured}_${type}`;
  const cacheValue = getCache(cacheKey);
  if (cacheValue != null) {
    return cacheValue;
  }
  const ctx = getCanvasContext();
  if (!ctx) {
    const width2 = Math.ceil(measured.length * 16 * 0.6);
    setCache(cacheKey, width2, true);
    return width2;
  }
  ctx.font = getFontSpec();
  const width = Math.round(ctx.measureText(measured).width);
  setCache(cacheKey, width, true);
  return width;
}
const EMOJI_PATTERN = /[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{FE00}-\u{FE0F}\u{200D}]/u;
function measureWithSvg(text, fontSize) {
  if (typeof document === "undefined") return null;
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  svg.setAttribute("style", "position:absolute;left:-9999px;top:-9999px");
  const textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
  textEl.setAttribute("font-family", FONT_FAMILY);
  textEl.setAttribute("font-size", fontSize);
  textEl.textContent = text;
  svg.appendChild(textEl);
  document.body.appendChild(svg);
  const width = textEl.getBBox().width;
  document.body.removeChild(svg);
  return width;
}
function measureTextWithFont(text, fontSize) {
  const measured = text.trim();
  if (!measured) return 0;
  const hasEmoji = EMOJI_PATTERN.test(measured);
  const cacheKey = hasEmoji ? `measureTextWithFont_svg_${fontSize}_${measured}` : `measureTextWithFont_${fontSize}_${measured}`;
  const cacheValue = getCache(cacheKey);
  if (cacheValue != null) {
    return cacheValue;
  }
  if (hasEmoji) {
    const svgWidth = measureWithSvg(measured, fontSize);
    if (svgWidth != null) {
      setCache(cacheKey, svgWidth, true);
      return svgWidth;
    }
  }
  const ctx = getCanvasContext();
  if (!ctx) {
    const px = Number.parseFloat(fontSize) || 14;
    const width2 = Math.ceil(measured.length * px * 0.6);
    setCache(cacheKey, width2, true);
    return width2;
  }
  ctx.font = `${fontSize} ${FONT_FAMILY}`;
  const width = ctx.measureText(measured).width;
  setCache(cacheKey, width, true);
  return width;
}
function measureSvgFragmentLabelWidth(text) {
  return measureTextWithFont(text, FONT_SIZE_FRAGMENT);
}
function measureSvgParticipantLabelWidth(text) {
  return measureTextWithFont(text, FONT_SIZE_PARTICIPANT);
}

const walker = antlr4.tree.ParseTreeWalker.DEFAULT;
class FrameBuilder extends sequenceParserListener {
  _orderedParticipants;
  frameRoot = null;
  parents = [];
  constructor(orderedParticipants) {
    super();
    this._orderedParticipants = orderedParticipants;
  }
  getLeft(ctx) {
    const localParticipants = getLocalParticipantNames(ctx);
    return this._orderedParticipants.find((p) => localParticipants.includes(p)) || "";
  }
  getRight(ctx) {
    return this._orderedParticipants.slice().reverse().find((p) => getLocalParticipantNames(ctx).includes(p)) || "";
  }
  enterFragment(ctx, type) {
    const frame = {
      type,
      left: this.getLeft(ctx),
      right: this.getRight(ctx),
      children: []
    };
    if (!this.frameRoot) {
      this.frameRoot = frame;
    }
    if (this.parents.length > 0) {
      this.parents[this.parents.length - 1].children?.push(frame);
    }
    this.parents.push(frame);
  }
  exitFragment() {
    this.parents.pop();
  }
  enterTcf(ctx) {
    this.enterFragment(ctx, "tcf");
  }
  enterOpt(ctx) {
    this.enterFragment(ctx, "opt");
  }
  enterPar(ctx) {
    this.enterFragment(ctx, "par");
  }
  enterAlt(ctx) {
    this.enterFragment(ctx, "alt");
  }
  enterLoop(ctx) {
    this.enterFragment(ctx, "loop");
  }
  enterSection(ctx) {
    this.enterFragment(ctx, "section");
  }
  enterCritical(ctx) {
    this.enterFragment(ctx, "critical");
  }
  enterRef(ctx) {
    this.enterFragment(ctx, "ref");
  }
  exitTcf() {
    this.exitFragment();
  }
  exitOpt() {
    this.exitFragment();
  }
  exitPar() {
    this.exitFragment();
  }
  exitAlt() {
    this.exitFragment();
  }
  exitLoop() {
    this.exitFragment();
  }
  exitSection() {
    this.exitFragment();
  }
  exitCritical() {
    this.exitFragment();
  }
  exitRef() {
    this.exitFragment();
  }
  getFrame(context) {
    if (!context) return null;
    context.children.map((child) => {
      walker.walk(this, child);
    });
    return this.frameRoot;
  }
}

function longestPath(frame, pathType) {
  if (!frame.children || frame.children.length === 0) {
    return 1;
  }
  let maxDepth = 0;
  for (const child of frame.children) {
    if (pathType === "LEFT" /* LEFT */ && child.left !== frame.left || pathType === "RIGHT" /* RIGHT */ && child.right !== frame.right) {
      continue;
    }
    maxDepth = Math.max(maxDepth, longestPath(child, pathType));
  }
  return maxDepth + 1;
}
function FrameBorder(frame) {
  if (!frame) {
    return { left: 0, right: 0 };
  }
  return {
    type: frame.type,
    left: FRAGMENT_PADDING_X * longestPath(frame, "LEFT" /* LEFT */),
    right: FRAGMENT_PADDING_X * longestPath(frame, "RIGHT" /* RIGHT */)
  };
}

const PARTICIPANT_TOP_SPACE = PARTICIPANT_TOP_SPACE_FOR_GROUP + 8;
const PARTICIPANT_BOX_PADDING = 16;
const PARTICIPANT_BOX_PADDING_ASSIGNEE = 16;
const PARTICIPANT_ICON_ROW_WIDTH = 28;
const PARTICIPANT_EMOJI_WIDTH = 20;
const PARTICIPANT_VISUAL_HEIGHT = 40;
const PARTICIPANT_MAX_WIDTH = 250;
function snapX$1(x) {
  return x;
}
function cssToSvgStyle(css) {
  const result = {};
  let hasKeys = false;
  for (const [key, value] of Object.entries(css)) {
    if (value == null) continue;
    hasKeys = true;
    if (key === "color") {
      result["fill"] = String(value);
    } else {
      const svgKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
      result[svgKey] = String(value);
    }
  }
  return hasKeys ? result : void 0;
}

function buildParticipants(models, coordinates, verticalCoordinates, measureText) {
  return models.map((m) => {
    const centerX = snapX$1(coordinates.getPosition(m.name));
    const halfWidth = coordinates.half(m.name);
    const isAssignee = m.name.includes(":") && m.getDisplayName() === m.name;
    let width;
    let measuredTextWidth;
    let measuredStereotypeWidth;
    if (measureText && m.name !== _STARTER_) {
      const textWidth = measureSvgParticipantLabelWidth(m.getDisplayName());
      measuredTextWidth = textWidth;
      const padding = isAssignee ? PARTICIPANT_BOX_PADDING_ASSIGNEE : PARTICIPANT_BOX_PADDING;
      const iconWidth = m.hasIcon() ? PARTICIPANT_ICON_ROW_WIDTH : 0;
      const emojiWidth = m.emoji ? PARTICIPANT_EMOJI_WIDTH : 0;
      const STEREOTYPE_BOX_OVERHEAD = 8;
      if (m.stereotype) {
        measuredStereotypeWidth = measureSvgParticipantLabelWidth(`«${m.stereotype}»`);
      }
      const stereotypeBoxWidth = measuredStereotypeWidth != null ? measuredStereotypeWidth + STEREOTYPE_BOX_OVERHEAD : 0;
      width = Math.min(Math.max(textWidth + padding + iconWidth + emojiWidth, stereotypeBoxWidth, MIN_PARTICIPANT_WIDTH), PARTICIPANT_MAX_WIDTH);
    } else {
      width = Math.min(halfWidth * 2 - MARGIN, PARTICIPANT_MAX_WIDTH);
    }
    if (m.name === _STARTER_) width = Math.min(width, 80);
    const creationTop = verticalCoordinates.getCreationTop(m.name);
    const isStarter = m.name === _STARTER_;
    const y = creationTop != null ? Math.max(PARTICIPANT_TOP_SPACE, creationTop + 8) : PARTICIPANT_TOP_SPACE;
    return {
      name: m.name,
      label: m.getDisplayName(),
      x: centerX,
      y,
      width,
      height: PARTICIPANT_VISUAL_HEIGHT,
      isStarter,
      showBottom: creationTop == null && !isStarter,
      labelWidth: measuredTextWidth,
      type: m.type,
      stereotype: m.stereotype,
      stereotypeWidth: measuredStereotypeWidth,
      color: m.color,
      emoji: m.emoji,
      groupId: m.groupId
    };
  });
}
function buildLifelines(participants, diagramHeight) {
  return participants.map((p) => ({
    participantName: p.name,
    x: p.x,
    // align with occurrence bar center (same as participant center)
    topY: p.y + p.height,
    // starts at bottom of participant box (visible part)
    bottomY: diagramHeight,
    dashed: true
  }));
}
function buildGroups(participants, diagramHeight) {
  const GROUP_OUTLINE_MARGIN = -2;
  const groupMap = /* @__PURE__ */ new Map();
  for (const p of participants) {
    if (p.groupId != null) {
      const existing = groupMap.get(p.groupId);
      if (existing) {
        existing.push(p);
      } else {
        groupMap.set(p.groupId, [p]);
      }
    }
  }
  const groups = [];
  for (const [groupId, members] of groupMap) {
    if (members.length === 0) continue;
    let minLeft = Infinity;
    let maxRight = -Infinity;
    let minY = Infinity;
    for (const m of members) {
      const left = m.x - m.width / 2;
      const right = m.x + m.width / 2;
      if (left < minLeft) minLeft = left;
      if (right > maxRight) maxRight = right;
      if (m.y < minY) minY = m.y;
    }
    const x = minLeft + GROUP_OUTLINE_MARGIN;
    const width = maxRight - minLeft - 2 * GROUP_OUTLINE_MARGIN;
    const y = minY - 20 + 1.5;
    const height = Math.max(0, diagramHeight - y + 13);
    groups.push({
      name: String(groupId),
      x,
      y,
      width,
      height
    });
  }
  return groups;
}

function snapX(x) {
  return x;
}
const COMMENT_FONT_ASCENT = 15;
function buildFragmentGeometry(info, coord, coordinates, verticalCoordinates, allParticipants, measureText, commentHeight = 0, commentText, commentStyle, commentYBase) {
  const statNode = info.statNode;
  if (!statNode) return null;
  const fragmentCtx = findFragmentContext(statNode);
  if (!fragmentCtx) {
    return {
      fragment: {
        kind: info.fragmentKind,
        label: info.fragmentLabel || "",
        labelWidth: info.fragmentLabel ? measureSvgFragmentLabelWidth(resolveEmojiInText(info.fragmentLabel)) : void 0,
        x: 0,
        y: coord.top,
        width: coordinates.getWidth(),
        height: coord.height,
        headerY: coord.top + 1 + commentHeight,
        sections: [],
        number: info.number,
        depth: info.depth
      },
      comment: commentText && commentYBase != null ? {
        x: 1,
        y: commentYBase + 1 + COMMENT_FONT_ASCENT,
        text: commentText,
        style: commentStyle,
        fragmentComment: true
      } : void 0
    };
  }
  const localNames = getDeepParticipantNames(fragmentCtx, info.fragmentSections);
  const leftParticipant = allParticipants.find((p) => localNames.includes(p)) || "";
  const rightParticipant = allParticipants.slice().reverse().find((p) => localNames.includes(p)) || "";
  const frameBuilder = new FrameBuilder(allParticipants);
  const frame = frameBuilder.getFrame(statNode);
  const fragBorder = FrameBorder(frame);
  let fragWidth;
  let fragX;
  if (leftParticipant && rightParticipant) {
    const participantWidth = coordinates.distance(leftParticipant, rightParticipant) + coordinates.half(leftParticipant) + coordinates.half(rightParticipant);
    const selfMessages = AllMessages(statNode).filter((m) => m.from === m.to);
    const extraWidths = selfMessages.map(
      (m) => coordinates.getMessageWidth(m) - coordinates.distance(m.from || _STARTER_, rightParticipant) - coordinates.half(rightParticipant)
    );
    const extraWidth = Math.max(0, ...extraWidths);
    fragWidth = Math.max(participantWidth, FRAGMENT_MIN_WIDTH) + fragBorder.left + fragBorder.right + extraWidth;
    fragX = snapX(coordinates.getPosition(leftParticipant)) - coordinates.half(leftParticipant);
  } else {
    fragWidth = Math.max(FRAGMENT_MIN_WIDTH, coordinates.getWidth());
    fragX = 0;
  }
  const sections = [];
  if (info.fragmentSections && info.fragmentSections.length > 1) {
    let sectionY = coord.top;
    for (let i = 0; i < info.fragmentSections.length; i++) {
      const section = info.fragmentSections[i];
      if (i > 0) {
        const sectionBlock = section.blockNode;
        if (sectionBlock) {
          const innerStats = sectionBlock.stat?.() || [];
          if (innerStats.length > 0) {
            const firstStatKey = createStatementKeyFromStat(innerStats[0]);
            if (firstStatKey) {
              const innerCoord = verticalCoordinates.getStatementCoordinate(firstStatKey);
              if (innerCoord) {
                sectionY = innerCoord.top - 20 - 8 - 8 - 1;
              }
            }
          }
        }
      }
      const sectionHeight = i < info.fragmentSections.length - 1 ? 0 : coord.top + coord.height - sectionY;
      sections.push({
        label: section.label,
        y: sectionY,
        height: sectionHeight,
        labelWidth: section.label ? measureSvgFragmentLabelWidth(resolveEmojiInText(section.label)) : void 0,
        innerLabel: /^\[\s*.*\s*\]$/.test(section.label) ? section.label.slice(1, -1).trim() : void 0,
        innerLabelWidth: /^\[\s*.*\s*\]$/.test(section.label) ? measureSvgFragmentLabelWidth(resolveEmojiInText(section.label.slice(1, -1).trim())) : void 0,
        keyword: (() => {
          const spaceIdx = section.label.indexOf(" ");
          if (spaceIdx > 0 && !section.label.startsWith("finally") && !section.label.startsWith("[")) {
            return section.label.substring(0, spaceIdx);
          }
          return void 0;
        })(),
        keywordWidth: (() => {
          const spaceIdx = section.label.indexOf(" ");
          if (spaceIdx > 0 && !section.label.startsWith("finally") && !section.label.startsWith("[")) {
            return measureSvgFragmentLabelWidth(section.label.substring(0, spaceIdx));
          }
          return void 0;
        })(),
        detail: (() => {
          const spaceIdx = section.label.indexOf(" ");
          if (spaceIdx > 0 && !section.label.startsWith("finally") && !section.label.startsWith("[")) {
            return section.label.substring(spaceIdx + 1);
          }
          return void 0;
        })(),
        detailWidth: (() => {
          const spaceIdx = section.label.indexOf(" ");
          if (spaceIdx > 0 && !section.label.startsWith("finally") && !section.label.startsWith("[")) {
            return measureSvgFragmentLabelWidth(section.label.substring(spaceIdx + 1));
          }
          return void 0;
        })()
      });
    }
  }
  if (info.fragmentKind === "par" && sections.length === 0) {
    const parBlock = info.fragmentSections?.[0]?.blockNode;
    const innerStats = parBlock?.stat?.() || [];
    if (innerStats.length > 1) {
      sections.push({ label: "", y: coord.top, height: 0 });
      for (let i = 1; i < innerStats.length; i++) {
        const statKey = createStatementKeyFromStat(innerStats[i]);
        if (!statKey) continue;
        const innerCoord = verticalCoordinates.getStatementCoordinate(statKey);
        if (!innerCoord) continue;
        const dividerY = innerCoord.top - 1;
        sections.push({
          label: "",
          y: dividerY,
          height: 0,
          contentInsetLeft: fragBorder.left + coordinates.half(leftParticipant)
        });
      }
    }
  }
  let fragmentComment;
  if (commentText && commentYBase != null) {
    fragmentComment = {
      x: fragX + 1,
      y: commentYBase + 1 + COMMENT_FONT_ASCENT,
      text: commentText,
      style: commentStyle,
      fragmentComment: true
    };
  }
  return {
    fragment: {
      kind: info.fragmentKind,
      label: info.fragmentLabel || "",
      labelWidth: info.fragmentLabel ? measureSvgFragmentLabelWidth(resolveEmojiInText(info.fragmentLabel)) : void 0,
      x: fragX,
      y: coord.top,
      width: fragWidth,
      height: coord.height,
      headerY: coord.top + 1 + commentHeight,
      sections,
      number: info.number,
      depth: info.depth
    },
    comment: fragmentComment
  };
}
function findFragmentContext(stat) {
  for (const kind of ["loop", "opt", "par", "critical", "section"]) {
    const frag = stat[kind]?.();
    if (frag) return frag;
  }
  const alt = stat.alt?.();
  if (alt) return alt;
  const tcf = stat.tcf?.();
  if (tcf) return tcf;
  const ref = stat.ref?.();
  if (ref) return ref;
  return null;
}
function createStatementKeyFromStat(statement) {
  if (!statement?.start || !statement?.stop) return "";
  return `${statement.start.start}-${statement.stop.stop}`;
}
function getDeepParticipantNames(fragmentCtx, sections) {
  const names = new Set(getLocalParticipantNames(fragmentCtx));
  if (sections) {
    for (const section of sections) {
      if (!section.blockNode) continue;
      const innerNames = Participants(section.blockNode).Names();
      for (const n of innerNames) names.add(n);
    }
  }
  return [...names];
}

function walkStatements(rootContext) {
  const block = rootContext?.block?.();
  if (!block) return [];
  return walkBlock(block, _STARTER_, /* @__PURE__ */ new Map(), "", 0, null, 0);
}
function normalizeLabel(label) {
  return label.trim();
}
function walkBlock(block, currentOrigin, activeOccurrences, parentNumber, depth, parentBlockKind, indexOffset) {
  const statements = block?.stat?.() || [];
  const results = [];
  let index = 0;
  for (const stat of statements) {
    const key = createStatementKey(stat);
    if (!key) continue;
    index++;
    const ordinal = indexOffset + index;
    const number = parentNumber ? `${parentNumber}.${ordinal}` : String(ordinal);
    const comment = stat.getComment?.() || "";
    const message = stat.message?.();
    if (message) {
      const from = message.From?.() || currentOrigin;
      const to = message.Owner?.() || _STARTER_;
      const label = normalizeLabel(message.SignatureText?.() || "");
      const nestedBlock = message.braceBlock?.()?.block?.();
      results.push({ key, kind: "sync", from, to, label, isSelf: from === to, hasBlock: !!nestedBlock, comment, statNode: stat, senderOccurrenceDepth: activeOccurrences.get(from) || 0, targetHasOccurrence: activeOccurrences.has(to), targetOccurrenceDepth: activeOccurrences.get(to) || 0, number, depth, parentBlockKind });
      if (nestedBlock) {
        const innerOccs = new Map(activeOccurrences);
        innerOccs.set(to, (innerOccs.get(to) || 0) + 1);
        results.push(...walkBlock(nestedBlock, to, innerOccs, number, depth + 1, "sync", 0));
      }
      continue;
    }
    const asyncMsg = stat.asyncMessage?.();
    if (asyncMsg) {
      const from = asyncMsg.From?.() || asyncMsg.ProvidedFrom?.() || asyncMsg.Origin?.() || currentOrigin;
      const to = asyncMsg.Owner?.() || asyncMsg.to?.()?.getFormattedText?.() || from;
      const label = normalizeLabel(asyncMsg.content?.()?.getText?.() || asyncMsg.SignatureText?.() || "");
      results.push({ key, kind: "async", from, to, label, isSelf: from === to, hasBlock: false, comment, senderOccurrenceDepth: activeOccurrences.get(from) || 0, targetHasOccurrence: activeOccurrences.has(to), number, depth });
      continue;
    }
    const creation = stat.creation?.();
    if (creation) {
      const from = creation.From?.() || currentOrigin;
      const to = creation.Owner?.() || "";
      const label = normalizeLabel(creation.SignatureText?.() || "«create»");
      const creationBlock = creation.braceBlock?.()?.block?.();
      results.push({ key, kind: "creation", from, to, label, isSelf: false, hasBlock: !!creationBlock, comment, statNode: stat, senderOccurrenceDepth: activeOccurrences.get(from) || 0, targetHasOccurrence: activeOccurrences.has(to), number, depth, parentBlockKind });
      if (creationBlock) {
        const innerOccs = new Map(activeOccurrences);
        innerOccs.set(to, (innerOccs.get(to) || 0) + 1);
        results.push(...walkBlock(creationBlock, to || currentOrigin, innerOccs, number, depth + 1, "creation", 0));
      }
      continue;
    }
    const ret = stat.ret?.();
    if (ret) {
      const label = normalizeLabel(ret.SignatureText?.() || "");
      const asyncMessage = ret?.asyncMessage?.();
      const from = asyncMessage?.From?.() || ret?.From?.() || currentOrigin;
      const to = asyncMessage?.to?.()?.getFormattedText?.() || ret?.ReturnTo?.() || _STARTER_;
      results.push({ key, kind: "return", from, to, label, isSelf: from === to, hasBlock: false, comment, senderOccurrenceDepth: activeOccurrences.get(from) || 0, targetOccurrenceDepth: activeOccurrences.get(to) || 0, number, depth, parentBlockKind });
      continue;
    }
    const divider = stat.divider?.();
    if (divider) {
      const label = normalizeLabel(divider.getFormattedText?.() || divider.getText?.() || "");
      results.push({ key, kind: "divider", from: "", to: "", label, isSelf: false, hasBlock: false, senderOccurrenceDepth: 0, number, depth });
      continue;
    }
    const fragmentInfo = extractFragmentInfo(stat);
    results.push({
      key,
      kind: "fragment",
      from: currentOrigin,
      to: "",
      label: fragmentInfo.label,
      isSelf: false,
      hasBlock: false,
      fragmentKind: fragmentInfo.fragmentKind,
      fragmentLabel: fragmentInfo.label,
      fragmentSections: fragmentInfo.sections,
      comment,
      statNode: stat,
      senderOccurrenceDepth: activeOccurrences.get(currentOrigin) || 0,
      number,
      depth
    });
    walkFragmentBlocks(stat, currentOrigin, results, activeOccurrences, number, depth);
  }
  return results;
}
function extractFragmentInfo(stat) {
  for (const kind of ["loop", "opt", "par", "critical", "section"]) {
    const frag = stat[kind]?.();
    if (frag) {
      const condition = frag.parExpr?.()?.condition?.();
      const label = condition?.getFormattedText?.() || "";
      return {
        fragmentKind: kind,
        label,
        sections: [{ label, blockNode: frag.braceBlock?.()?.block?.() }]
      };
    }
  }
  const alt = stat.alt?.();
  if (alt) {
    const sections = [];
    const ifBlock = alt.ifBlock?.();
    if (ifBlock) {
      sections.push({ label: "Alt", blockNode: ifBlock.braceBlock?.()?.block?.() });
    }
    for (const elseIf of alt.elseIfBlock?.() || []) {
      const condition = elseIf.parExpr?.()?.condition?.();
      const label = condition?.getFormattedText?.() || "";
      sections.push({ label: `[ ${label} ]`, blockNode: elseIf.braceBlock?.()?.block?.() });
    }
    const elseBlock = alt.elseBlock?.();
    if (elseBlock) {
      sections.push({ label: "[else]", blockNode: elseBlock.braceBlock?.()?.block?.() });
    }
    const ifCondition = alt.ifBlock?.()?.parExpr?.()?.condition?.();
    const firstLabel = ifCondition?.getFormattedText?.() || "";
    return { fragmentKind: "alt", label: firstLabel, sections };
  }
  const tcf = stat.tcf?.();
  if (tcf) {
    const sections = [];
    const tryBlock = tcf.tryBlock?.();
    if (tryBlock) {
      sections.push({ label: "Try", blockNode: tryBlock.braceBlock?.()?.block?.() });
    }
    for (const catchBlock of tcf.catchBlock?.() || []) {
      const exception = catchBlock.invocation?.()?.parameters?.()?.getFormattedText?.() || "";
      sections.push({ label: `catch ${exception}`, blockNode: catchBlock.braceBlock?.()?.block?.() });
    }
    const finallyBlock = tcf.finallyBlock?.();
    if (finallyBlock) {
      sections.push({ label: "finally", blockNode: finallyBlock.braceBlock?.()?.block?.() });
    }
    return { fragmentKind: "tcf", label: "", sections };
  }
  const ref = stat.ref?.();
  if (ref) {
    const label = ref.getFormattedText?.() || "";
    return { fragmentKind: "ref", label, sections: [] };
  }
  return { fragmentKind: "loop", label: "", sections: [] };
}
function blockLength(block) {
  return (block?.stat?.() || []).filter((stat) => !!createStatementKey(stat)).length;
}
function walkFragmentBlocks(stat, origin, results, activeOccurrences, parentNumber, depth) {
  for (const kind of ["loop", "opt", "par", "critical", "section"]) {
    const frag = stat[kind]?.();
    if (frag) {
      const block = frag.braceBlock?.()?.block?.();
      if (block) results.push(...walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, 0));
      return;
    }
  }
  const alt = stat.alt?.();
  if (alt) {
    const ifBlock = alt.ifBlock?.();
    let sectionOffset = 0;
    if (ifBlock) {
      const block = ifBlock.braceBlock?.()?.block?.();
      if (block) {
        results.push(...walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset));
        sectionOffset += blockLength(block);
      }
    }
    for (const elseIf of alt.elseIfBlock?.() || []) {
      const block = elseIf.braceBlock?.()?.block?.();
      if (block) {
        const sectionStmts = walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset);
        if (sectionStmts.length > 0) sectionStmts[0].sectionReset = true;
        results.push(...sectionStmts);
        sectionOffset += blockLength(block);
      }
    }
    const elseBlock = alt.elseBlock?.();
    if (elseBlock) {
      const block = elseBlock.braceBlock?.()?.block?.();
      if (block) {
        const sectionStmts = walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset);
        if (sectionStmts.length > 0) sectionStmts[0].sectionReset = true;
        results.push(...sectionStmts);
      }
    }
    return;
  }
  const tcf = stat.tcf?.();
  if (tcf) {
    const tryBlock = tcf.tryBlock?.();
    let sectionOffset = 0;
    if (tryBlock) {
      const block = tryBlock.braceBlock?.()?.block?.();
      if (block) {
        results.push(...walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset));
        sectionOffset += blockLength(block);
      }
    }
    for (const catchBlock of tcf.catchBlock?.() || []) {
      const block = catchBlock.braceBlock?.()?.block?.();
      if (block) {
        const sectionStmts = walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset);
        if (sectionStmts.length > 0) sectionStmts[0].sectionReset = true;
        results.push(...sectionStmts);
        sectionOffset += blockLength(block);
      }
    }
    const finallyBlock = tcf.finallyBlock?.();
    if (finallyBlock) {
      const block = finallyBlock.braceBlock?.()?.block?.();
      if (block) {
        const sectionStmts = walkBlock(block, origin, activeOccurrences, parentNumber, depth + 1, null, sectionOffset);
        if (sectionStmts.length > 0) sectionStmts[0].sectionReset = true;
        results.push(...sectionStmts);
      }
    }
    return;
  }
}

function computeReturnDebt(statements, verticalCoordinates, returnHeight) {
  const result = /* @__PURE__ */ new Map();
  const debtByDepth = [0];
  const directDebtByDepth = [0];
  let maxDepth = 0;
  const blockOwnerKeys = [null];
  const blockOwnerKinds = [null];
  const hasNonReturnChild = [false];
  const nbAssignShift = [0];
  const blockHasAssignment = [false];
  for (const info of statements) {
    const depth = info.depth;
    while (maxDepth > depth) {
      const closedDebt = debtByDepth[maxDepth] || 0;
      const ownerKey = blockOwnerKeys[maxDepth];
      const ownerKind = blockOwnerKinds[maxDepth];
      const directDebt = directDebtByDepth[maxDepth] || 0;
      const nestedDebt = closedDebt - directDebt;
      const directShift = Math.max(directDebt - returnHeight, 0);
      const occInnerDebt = nestedDebt + directShift;
      if (ownerKey && occInnerDebt > 0) {
        result.set(`inner:${ownerKey}`, occInnerDebt);
      }
      const hasMixed = hasNonReturnChild[maxDepth] || false;
      if (ownerKey && hasMixed) {
        result.set(`mixed:${ownerKey}`, 1);
      }
      const hasAssign = blockHasAssignment[maxDepth] || false;
      debtByDepth.pop();
      directDebtByDepth.pop();
      blockOwnerKeys.pop();
      blockOwnerKinds.pop();
      hasNonReturnChild.pop();
      blockHasAssignment.pop();
      nbAssignShift.pop();
      maxDepth--;
      if (ownerKey && ownerKind === "sync") {
        debtByDepth[maxDepth] += occInnerDebt;
        if (hasAssign) {
          debtByDepth[maxDepth] += 4;
        }
      }
    }
    while (maxDepth < depth) {
      maxDepth++;
      debtByDepth.push(0);
      directDebtByDepth.push(0);
      blockOwnerKeys.push(null);
      blockOwnerKinds.push(null);
      hasNonReturnChild.push(false);
      blockHasAssignment.push(false);
      nbAssignShift.push(0);
    }
    if (info.sectionReset && depth < debtByDepth.length) {
      debtByDepth[depth] = 0;
      directDebtByDepth[depth] = 0;
    }
    let totalDebt = 0;
    for (let d = 0; d <= depth; d++) {
      totalDebt += (debtByDepth[d] || 0) + (nbAssignShift[d] || 0);
    }
    result.set(info.key, totalDebt);
    if (info.kind === "return" && !info.isSelf) {
      const returnCoord = verticalCoordinates.getStatementCoordinate(info.key);
      const engineAllocatesHeight = returnCoord && returnCoord.height > 0;
      if (!engineAllocatesHeight) {
        const isFirstAtDepth = (directDebtByDepth[depth] || 0) === 0;
        debtByDepth[depth] += returnHeight;
        directDebtByDepth[depth] += returnHeight;
        if (isFirstAtDepth && totalDebt !== 0 && info.parentBlockKind === "sync") {
          nbAssignShift[depth] = (nbAssignShift[depth] || 0) + 1;
        }
      }
    } else if (info.kind !== "return") {
      if (depth < hasNonReturnChild.length) {
        hasNonReturnChild[depth] = true;
      }
    }
    if ((info.kind === "sync" || info.kind === "creation") && info.hasBlock) {
      const msgCtx = info.statNode?.message?.();
      const hasAssign = !!msgCtx?.Assignment?.()?.assignee && !info.isSelf;
      if (depth + 1 > maxDepth) {
        maxDepth = depth + 1;
        debtByDepth.push(0);
        directDebtByDepth.push(0);
        blockOwnerKeys.push(info.key);
        blockOwnerKinds.push(info.kind);
        hasNonReturnChild.push(false);
        blockHasAssignment.push(hasAssign);
      } else {
        blockOwnerKeys[depth + 1] = info.key;
        blockOwnerKinds[depth + 1] = info.kind;
        debtByDepth[depth + 1] = 0;
        directDebtByDepth[depth + 1] = 0;
        hasNonReturnChild[depth + 1] = false;
        blockHasAssignment[depth + 1] = hasAssign;
      }
    }
  }
  while (maxDepth > 0) {
    const closedDebt = debtByDepth[maxDepth] || 0;
    const ownerKey = blockOwnerKeys[maxDepth];
    const ownerKind = blockOwnerKinds[maxDepth];
    const directDebtEnd = directDebtByDepth[maxDepth] || 0;
    const nestedDebtEnd = closedDebt - directDebtEnd;
    const directShiftEnd = Math.max(directDebtEnd - returnHeight, 0);
    const occInnerDebtEnd = nestedDebtEnd + directShiftEnd;
    if (ownerKey && occInnerDebtEnd > 0) {
      result.set(`inner:${ownerKey}`, occInnerDebtEnd);
    }
    const hasMixedEnd = hasNonReturnChild[maxDepth] || false;
    if (ownerKey && hasMixedEnd) {
      result.set(`mixed:${ownerKey}`, 1);
    }
    const hasAssignEnd = blockHasAssignment[maxDepth] || false;
    debtByDepth.pop();
    directDebtByDepth.pop();
    blockOwnerKeys.pop();
    blockOwnerKinds.pop();
    hasNonReturnChild.pop();
    blockHasAssignment.pop();
    maxDepth--;
    if (ownerKey && ownerKind === "sync") {
      debtByDepth[maxDepth] += occInnerDebtEnd;
      if (hasAssignEnd) {
        debtByDepth[maxDepth] += 4;
      }
    }
  }
  result.set("__totalDebt__", debtByDepth[0] || 0);
  return result;
}

function buildMessages(rootContext, coordinates, verticalCoordinates, participants, measureText) {
  const statements = walkStatements(rootContext);
  const messages = [];
  const selfCalls = [];
  const occurrences = [];
  const creations = [];
  const fragments = [];
  const returns = [];
  const dividers = [];
  const comments = [];
  let maxReturnBottom = 0;
  const diagramWidth = coordinates.getWidth();
  const allParticipants = coordinates.orderedParticipantNames();
  const blockChildCount = /* @__PURE__ */ new Map();
  for (const s of statements) {
    if (s.number) {
      const lastDot = s.number.lastIndexOf(".");
      const parent = lastDot >= 0 ? s.number.substring(0, lastDot) : "";
      const ordinal = parseInt(s.number.substring(lastDot + 1), 10);
      const prev = blockChildCount.get(parent) || 0;
      if (ordinal > prev) blockChildCount.set(parent, ordinal);
    }
  }
  const RETURN_VISUAL_HEIGHT = 16;
  const adjustMap = computeReturnDebt(statements, verticalCoordinates, RETURN_VISUAL_HEIGHT);
  for (const info of statements) {
    const coord = verticalCoordinates.getStatementCoordinate(info.key);
    if (!coord) continue;
    const adjust = adjustMap.get(info.key) || 0;
    let commentObj;
    if (info.comment) {
      commentObj = new CommentClass(info.comment);
    }
    if (commentObj?.text && info.kind !== "fragment") {
      let commentParticipant = info.from;
      if (info.kind === "creation" && info.from && info.to) {
        const fX = coordinates.getPosition(info.from);
        const tX = coordinates.getPosition(info.to);
        if (fX > tX) commentParticipant = info.to;
      }
      const commentX = commentParticipant ? snapX$1(coordinates.getPosition(commentParticipant)) : 10;
      const COMMENT_FONT_ASCENT = 15;
      const commentXOffset = info.senderOccurrenceDepth >= 1 ? OCCURRENCE_BAR_SIDE_WIDTH + 1 : 1;
      const codeSpanPadding = commentObj.text.trimStart().startsWith("`") ? 2 : 0;
      comments.push({
        x: commentX + commentXOffset + codeSpanPadding,
        y: coord.top + adjust + COMMENT_FONT_ASCENT,
        text: commentObj.text,
        style: cssToSvgStyle(commentObj.commentStyle)
      });
    }
    const messageStyle = commentObj ? cssToSvgStyle(commentObj.messageStyle) : void 0;
    if (info.kind === "sync" || info.kind === "async") {
      let fromX = snapX$1(coordinates.getPosition(info.from));
      const toX = snapX$1(coordinates.getPosition(info.to));
      const messageHeight = info.isSelf ? 30 : 16;
      const msgCommentHeight = commentObj?.text ? (info.comment?.trim().split("\n").length || 0) * 20 : 0;
      const messageY = coord.top + adjust + msgCommentHeight + messageHeight - 0.5;
      if (info.senderOccurrenceDepth >= 1 && !info.isSelf) {
        const depth = info.senderOccurrenceDepth;
        const occOffset = depth * OCCURRENCE_BAR_SIDE_WIDTH;
        const isLTR = fromX < toX;
        fromX = isLTR ? fromX + occOffset : fromX - OCCURRENCE_BAR_SIDE_WIDTH + (depth - 1) * OCCURRENCE_BAR_SIDE_WIDTH;
      }
      const targetDepth = info.targetOccurrenceDepth || (info.targetHasOccurrence ? 1 : 0);
      const nestingOffset = targetDepth * OCCURRENCE_BAR_SIDE_WIDTH;
      if (info.isSelf) {
        const isAsync = info.kind === "async";
        const selfYOffset = 0;
        const selfWidth = isAsync ? 28 : OCCURRENCE_WIDTH;
        const selfHeight = isAsync ? 44 : messageHeight;
        const selfX = info.senderOccurrenceDepth >= 1 ? fromX + OCCURRENCE_BAR_SIDE_WIDTH + (info.senderOccurrenceDepth - 1) * OCCURRENCE_BAR_SIDE_WIDTH : fromX;
        selfCalls.push({
          x: selfX,
          y: coord.top + selfYOffset + msgCommentHeight,
          width: selfWidth,
          height: selfHeight,
          label: info.label,
          arrowStyle: isAsync ? "open" : "solid",
          number: info.number,
          style: messageStyle
        });
      } else {
        const isLTR = fromX < toX;
        const syncOffset = info.kind === "sync" && !info.isSelf;
        const asyncTargetOcc = info.kind === "async" && !info.isSelf && targetDepth > 0;
        const arrowToX = syncOffset ? isLTR ? toX - OCCURRENCE_BAR_SIDE_WIDTH + nestingOffset : toX + OCCURRENCE_BAR_SIDE_WIDTH + nestingOffset : asyncTargetOcc ? isLTR ? toX - nestingOffset : toX + nestingOffset : toX;
        messages.push({
          fromX,
          toX: arrowToX,
          y: messageY,
          label: info.label,
          arrowStyle: info.kind === "async" ? "open" : "solid",
          isSelf: false,
          isReverse: arrowToX < fromX,
          number: info.number,
          style: messageStyle
        });
      }
      if (info.kind === "sync") {
        const occX = toX - OCCURRENCE_BAR_SIDE_WIDTH;
        const occY = messageY - 1.5;
        let occHeight = coord.height - messageHeight - msgCommentHeight + 2;
        const innerDebtKey = `inner:${info.key}`;
        const innerDebt = adjustMap.get(innerDebtKey) || 0;
        if (innerDebt > 0) {
          occHeight += innerDebt;
        }
        const messageCtx = info.statNode?.message?.();
        const assignment = messageCtx?.Assignment?.();
        if (assignment?.assignee && !info.isSelf && info.hasBlock) {
          occHeight += 4;
        }
        const returnArrowY = occY + occHeight - 2;
        if (occHeight > 0) {
          occurrences.push({
            x: occX,
            y: occY,
            width: OCCURRENCE_WIDTH,
            height: occHeight,
            participantName: info.to
          });
          if (assignment?.assignee && !info.isSelf) {
            const isLTR = fromX < toX;
            const retFromX = isLTR ? toX - OCCURRENCE_BAR_SIDE_WIDTH + nestingOffset + 1 : toX + OCCURRENCE_BAR_SIDE_WIDTH + nestingOffset + 1;
            let senderX = fromX;
            if (info.senderOccurrenceDepth === 0) {
              senderX += isLTR ? LIFELINE_WIDTH + 1 : LIFELINE_WIDTH;
            } else if (isLTR) {
              senderX += 2;
            }
            const assignReturnNumber = info.number ? `${info.number}.${(blockChildCount.get(info.number) || 0) + 1}` : void 0;
            returns.push({
              fromX: retFromX,
              toX: senderX,
              y: returnArrowY,
              label: assignment.assignee,
              isReverse: fromX < toX,
              isSelf: false,
              number: assignReturnNumber
            });
            maxReturnBottom = Math.max(maxReturnBottom, returnArrowY + 46);
          }
        }
      }
      continue;
    }
    if (info.kind === "creation") {
      const CREATION_MSG_HEIGHT = 40;
      let fromX = snapX$1(coordinates.getPosition(info.from));
      const toX = snapX$1(coordinates.getPosition(info.to));
      if (info.senderOccurrenceDepth >= 1) {
        const occOffset = OCCURRENCE_BAR_SIDE_WIDTH + (info.senderOccurrenceDepth - 1) * OCCURRENCE_BAR_SIDE_WIDTH;
        const isLTR = fromX < toX;
        fromX = isLTR ? fromX + occOffset : fromX - occOffset;
      }
      const targetParticipant = participants.find((p) => p.name === info.to);
      const messageY = targetParticipant ? targetParticipant.y + PARTICIPANT_VISUAL_HEIGHT / 2 : coord.top + CREATION_MSG_HEIGHT / 2;
      if (targetParticipant) {
        creations.push({
          participant: targetParticipant,
          message: {
            fromX,
            toX,
            y: messageY,
            label: info.label,
            // already «guillemet-wrapped» from SignatureText()
            arrowStyle: "open",
            isSelf: false,
            isReverse: toX < fromX,
            number: info.number,
            style: messageStyle
          }
        });
      }
      const occX = toX - OCCURRENCE_BAR_SIDE_WIDTH;
      const occY = targetParticipant ? targetParticipant.y + PARTICIPANT_VISUAL_HEIGHT - 2 : coord.top + CREATION_MSG_HEIGHT - 2;
      const occHeight = Math.max(
        coord.top + coord.height - occY,
        OCCURRENCE_EMPTY_HEIGHT
      );
      if (occHeight > 0) {
        occurrences.push({
          x: occX,
          y: occY,
          width: OCCURRENCE_WIDTH,
          height: occHeight,
          participantName: info.to
        });
        const creationCtx = info.statNode?.creation?.();
        const creationAssign = creationCtx?.Assignment?.();
        if (creationAssign?.assignee) {
          const occBottom = occY + occHeight - 2;
          const rawFromX = snapX$1(coordinates.getPosition(info.from));
          const isLTR = rawFromX < toX;
          const occHalf = OCCURRENCE_BAR_SIDE_WIDTH;
          const senderNest = Math.max(info.senderOccurrenceDepth - 1, 0) * OCCURRENCE_BAR_SIDE_WIDTH;
          const senderRetX = info.senderOccurrenceDepth >= 1 ? rawFromX + senderNest + (isLTR ? occHalf + 2 : -occHalf) : rawFromX;
          const createdRetX = isLTR ? toX - occHalf + 1 : toX + occHalf + 1;
          returns.push({
            fromX: createdRetX,
            toX: senderRetX,
            y: occBottom,
            label: creationAssign.assignee,
            isReverse: createdRetX > senderRetX,
            isSelf: false,
            number: info.number ? `${info.number}.${(blockChildCount.get(info.number) || 0) + 1}` : void 0
          });
          maxReturnBottom = Math.max(maxReturnBottom, occBottom + 46);
        }
      }
      continue;
    }
    if (info.kind === "fragment" && info.fragmentKind) {
      const adjustedCoord = { top: coord.top + adjust, height: coord.height };
      const fragmentCommentHeight = commentObj?.text ? (info.comment?.trim().split("\n").length || 0) * 20 : 0;
      const fragmentResult = buildFragmentGeometry(
        info,
        adjustedCoord,
        coordinates,
        verticalCoordinates,
        allParticipants,
        measureText,
        fragmentCommentHeight,
        commentObj?.text,
        commentObj?.commentStyle ? cssToSvgStyle(commentObj.commentStyle) : void 0,
        coord.top + adjust
      );
      if (fragmentResult) {
        fragments.push(fragmentResult.fragment);
        if (fragmentResult.comment) {
          comments.push(fragmentResult.comment);
        }
      }
      continue;
    }
    if (info.kind === "return") {
      const rawFromX = snapX$1(coordinates.getPosition(info.from));
      const rawToX = snapX$1(coordinates.getPosition(info.to));
      const isReverse = rawToX < rawFromX;
      const fromLayers = info.senderOccurrenceDepth;
      let fromX;
      if (isReverse) {
        fromX = fromLayers === 0 ? rawFromX : (fromLayers <= 1 ? rawFromX : rawFromX + OCCURRENCE_BAR_SIDE_WIDTH * (fromLayers - 1)) - OCCURRENCE_BAR_SIDE_WIDTH;
      } else {
        fromX = rawFromX + OCCURRENCE_BAR_SIDE_WIDTH * fromLayers + 1;
      }
      const toLayers = info.targetOccurrenceDepth || 0;
      let toX;
      if (isReverse) {
        toX = rawToX + OCCURRENCE_BAR_SIDE_WIDTH * toLayers;
      } else {
        toX = toLayers === 0 ? rawToX : (toLayers <= 1 ? rawToX : rawToX + OCCURRENCE_BAR_SIDE_WIDTH * (toLayers - 1)) - OCCURRENCE_BAR_SIDE_WIDTH;
      }
      if (isReverse) {
        toX += LIFELINE_WIDTH;
      }
      const returnOffset = coord.height === 0 ? 16.5 : 15.5;
      const returnY = coord.top + adjust + returnOffset;
      returns.push({
        fromX,
        toX,
        y: returnY,
        label: info.label,
        isReverse,
        isSelf: info.isSelf,
        number: info.number
      });
      const returnBottomPad = coord.height === 0 ? 45.5 : 44.5;
      maxReturnBottom = Math.max(maxReturnBottom, returnY + returnBottomPad);
      continue;
    }
    if (info.kind === "divider") {
      const cleanLabel = info.label.replace(/^=+\s*|\s*=+$/g, "").trim();
      dividers.push({
        y: coord.top + adjust + coord.height / 2,
        width: diagramWidth,
        label: info.label,
        labelWidth: measureSvgFragmentLabelWidth(resolveEmojiInText(cleanLabel))
      });
      continue;
    }
  }
  const MIN_RETURN_GAP = 16;
  returns.sort((a, b) => a.y - b.y);
  for (let i = 1; i < returns.length; i++) {
    if (returns[i].y - returns[i - 1].y < MIN_RETURN_GAP) {
      returns[i] = { ...returns[i], y: returns[i - 1].y + MIN_RETURN_GAP };
    }
  }
  for (let i = 0; i < occurrences.length; i++) {
    const inner = occurrences[i];
    let depth = 0;
    for (let j = 0; j < occurrences.length; j++) {
      if (i === j) continue;
      const outer = occurrences[j];
      if (outer.participantName === inner.participantName && outer.y <= inner.y && outer.y + outer.height >= inner.y + inner.height) {
        depth++;
      }
    }
    if (depth > 0) {
      occurrences[i] = { ...inner, x: inner.x + depth * OCCURRENCE_BAR_SIDE_WIDTH };
    }
  }
  const totalReturnDebt = adjustMap.get("__totalDebt__") || 0;
  return { messages, selfCalls, occurrences, creations, fragments, returns, dividers, comments, totalReturnDebt, maxReturnBottom };
}

function buildGeometry(input) {
  const { rootContext, coordinates, verticalCoordinates, title, measureText } = input;
  const participantModels = OrderedParticipants(rootContext);
  const totalHeight = verticalCoordinates.getTotalHeight();
  const allParticipantNames = coordinates.orderedParticipantNames();
  const frameBuilder = new FrameBuilder(allParticipantNames);
  const frame = frameBuilder.getFrame(rootContext);
  const frameBorder = FrameBorder(frame);
  const participants = buildParticipants(
    participantModels,
    coordinates,
    verticalCoordinates,
    measureText
  );
  const buildResult = buildMessages(
    rootContext,
    coordinates,
    verticalCoordinates,
    participants,
    measureText
  );
  const { messages, selfCalls, occurrences, creations, fragments, returns, dividers, comments } = buildResult;
  let maxOccBottom = 0;
  let maxOtherY = 0;
  for (const o of occurrences) maxOccBottom = Math.max(maxOccBottom, o.y + o.height);
  for (const m of messages) maxOtherY = Math.max(maxOtherY, m.y);
  for (const s of selfCalls) maxOtherY = Math.max(maxOtherY, s.y + s.height);
  for (const c of creations) maxOtherY = Math.max(maxOtherY, c.message.y + PARTICIPANT_VISUAL_HEIGHT);
  for (const f of fragments) maxOtherY = Math.max(maxOtherY, f.y + f.height);
  for (const d of dividers) maxOtherY = Math.max(maxOtherY, d.y);
  const diagramHeight = Math.max(
    totalHeight + 28,
    maxOccBottom + 13,
    maxOtherY + 13,
    buildResult.maxReturnBottom
  );
  const lifelineBottom = diagramHeight + PARTICIPANT_VISUAL_HEIGHT - 28;
  const lifelines = buildLifelines(
    participants,
    lifelineBottom
  );
  const localParticipants = getLocalParticipantNames(rootContext);
  const orderedNames = coordinates.orderedParticipantNames();
  const leftParticipant = orderedNames.find((p) => localParticipants.includes(p)) || "";
  const rightParticipant = orderedNames.slice().reverse().find((p) => localParticipants.includes(p)) || "";
  const participantWidth = coordinates.distance(leftParticipant, rightParticipant) + coordinates.half(leftParticipant) + coordinates.half(rightParticipant);
  const selfMessages = AllMessages(rootContext).filter((m) => m.from === m.to);
  const extraWidths = selfMessages.map(
    (m) => coordinates.getMessageWidth(m) - coordinates.distance(m.from || _STARTER_, rightParticipant) - coordinates.half(rightParticipant)
  );
  const extraWidthDueToSelfMessage = Math.max(0, ...extraWidths);
  let diagramWidth = Math.max(participantWidth, FRAGMENT_MIN_WIDTH) + extraWidthDueToSelfMessage;
  if (measureText) {
    const LABEL_PAD = 10;
    for (const msg of messages) {
      const labelW = measureText(msg.label, TextType.MessageContent);
      const midX = (msg.fromX + msg.toX) / 2;
      const rightExtent = midX + labelW / 2 + LABEL_PAD;
      if (rightExtent > diagramWidth) diagramWidth = rightExtent;
    }
    for (const ret of returns) {
      const labelW = measureText(ret.label, TextType.MessageContent);
      const midX = (ret.fromX + ret.toX) / 2;
      const rightExtent = midX + labelW / 2 + LABEL_PAD;
      if (rightExtent > diagramWidth) diagramWidth = rightExtent;
    }
    for (const cr of creations) {
      const labelW = measureText(cr.message.label, TextType.MessageContent);
      const midX = (cr.message.fromX + cr.message.toX) / 2;
      const rightExtent = midX + labelW / 2 + LABEL_PAD;
      if (rightExtent > diagramWidth) diagramWidth = rightExtent;
    }
  }
  for (const f of fragments) {
    f.x -= frameBorder.left;
  }
  for (const c of comments) {
    if (c.fragmentComment) {
      c.x -= frameBorder.left;
    }
  }
  const nestDepths = /* @__PURE__ */ new Map();
  for (const inner of fragments) {
    let nestDepth = 0;
    for (const outer of fragments) {
      if (outer === inner) continue;
      if (outer.x <= inner.x && outer.y <= inner.y && outer.x + outer.width >= inner.x + inner.width && outer.y + outer.height >= inner.y + inner.height) {
        nestDepth++;
      }
    }
    nestDepths.set(inner, nestDepth);
    inner.x += nestDepth * FRAGMENT_PADDING_X;
  }
  const contentRightEdge = diagramWidth + frameBorder.right;
  for (const f of fragments) {
    const nd = nestDepths.get(f) || 0;
    const targetRight = contentRightEdge - nd * FRAGMENT_PADDING_X;
    const currentRight = f.x + f.width;
    if (currentRight >= targetRight - 20 && currentRight < targetRight) {
      f.width = targetRight - f.x;
    }
  }
  const groups = buildGroups(participants, diagramHeight);
  return {
    width: diagramWidth,
    height: diagramHeight,
    frameBorderLeft: frameBorder.left,
    frameBorderRight: frameBorder.right,
    title,
    participants,
    lifelines,
    messages,
    selfCalls,
    occurrences,
    creations,
    fragments,
    dividers,
    returns,
    comments,
    groups
  };
}

const ActorSvg = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n  <g>\n    <path d=\"M15.5489 4.19771C15.5489 5.18773 15.1485 6.13721 14.4358 6.83726C13.7231 7.53731 12.7565 7.93058 11.7486 7.93058C10.7407 7.93058 9.77403 7.53731 9.06133 6.83726C8.34863 6.13721 7.94824 5.18773 7.94824 4.19771C7.94824 3.20768 8.34863 2.25822 9.06133 1.55818C9.77403 0.858126 10.7407 0.464844 11.7486 0.464844C12.7565 0.464844 13.7231 0.858126 14.4358 1.55818C15.1485 2.25822 15.5489 3.20768 15.5489 4.19771Z\" stroke=\"currentColor\"/>\n    <path d=\"M6.54883 11.2152L17.2025 11.2073M11.7471 8.06641V19.5806V8.06641ZM11.7471 19.4385L6.79789 23.5738L11.7471 19.4385ZM11.7551 19.4385L17.1864 23.3055L11.7551 19.4385Z\" stroke=\"currentColor\"/>\n  </g>\n</svg>\n";

const BoundarySvg = "<svg width=\"101\" height=\"78\" viewBox=\"0 0 101 78\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t<path d=\"M96.3563 39.4479C96.3563 48.4904 92.6755 57.1625 86.1237 63.5566C79.5718 69.9506 70.6856 73.5427 61.4199 73.5427C52.1541 73.5427 43.2679 69.9506 36.7161 63.5566C30.1642 57.1625 26.4834 48.4904 26.4834 39.4479C26.4834 30.147 30.1642 21.2271 36.7161 14.6504C43.2679 8.07366 52.1541 4.37891 61.4199 4.37891C70.6856 4.37891 79.5718 8.07366 86.1237 14.6504C92.6755 21.2271 96.3563 30.147 96.3563 39.4479V39.4479Z\" stroke=\"currentColor\" stroke-width=\"4\"/>\n\t<path d=\"M27.3611 39.4482H3.93945\" stroke=\"currentColor\" stroke-width=\"4\"/>\n\t<path d=\"M4.91504 4.37891V74.5168\" stroke=\"currentColor\" stroke-width=\"4\"/>\n</svg>\n";

const ControlSvg = "<svg width=\"77\" height=\"86\" viewBox=\"0 0 77 86\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t<g>\n\t\t<path d=\"M74.0149 46.8888C74.0149 51.5755 73.0918 56.2163 71.2983 60.5463C69.5048 64.8762 66.876 68.8105 63.562 72.1245C60.248 75.4385 56.3137 78.0673 51.9838 79.8608C47.6538 81.6543 43.013 82.5774 38.3263 82.5774C33.6396 82.5774 28.9988 81.6543 24.6689 79.8608C20.3389 78.0673 16.4046 75.4385 13.0907 72.1245C9.77666 68.8105 7.14785 64.8762 5.35433 60.5463C3.56081 56.2163 2.6377 51.5755 2.6377 46.8888C2.6377 42.2021 3.56081 37.5613 5.35433 33.2314C7.14785 28.9014 9.77666 24.9671 13.0907 21.6532C16.4046 18.3392 20.3389 15.7104 24.6689 13.9168C28.9988 12.1233 33.6396 11.2002 38.3263 11.2002C43.013 11.2002 47.6538 12.1233 51.9838 13.9168C56.3137 15.7104 60.248 18.3392 63.562 21.6532C66.876 24.9671 69.5048 28.9014 71.2983 33.2314C73.0918 37.5613 74.0149 42.2021 74.0149 46.8888V46.8888Z\" stroke=\"currentColor\" stroke-width=\"4.98203\"/>\n\t\t<path d=\"M47.5352 2.30371L37.5352 11.5001L47.5352 20.6966\" stroke=\"currentColor\" stroke-width=\"6\"/>\n\t</g>\n</svg>\n";

const DatabaseSvg = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n  <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.258 0.001L12.514 0.005L12.769 0.01L13.022 0.018L13.273 0.028L13.522 0.04L13.769 0.055L14.015 0.071L14.257 0.09L14.498 0.11L14.737 0.133L14.973 0.157L15.206 0.184L15.437 0.212L15.666 0.243L15.891 0.275L16.114 0.309L16.334 0.345L16.551 0.383L16.765 0.423L16.976 0.464L17.184 0.507L17.389 0.552L17.59 0.598L17.788 0.646L17.982 0.696L18.173 0.747L18.36 0.8L18.543 0.854L18.723 0.91L18.898 0.967L19.07 1.026L19.238 1.086L19.401 1.147L19.561 1.21L19.716 1.274L19.866 1.34L19.94 1.373L20.013 1.406L20.084 1.44L20.154 1.474L20.223 1.509L20.291 1.544L20.358 1.579L20.424 1.614L20.488 1.65L20.552 1.686L20.614 1.722L20.674 1.758L20.734 1.795L20.792 1.832L20.85 1.869L20.905 1.907L20.96 1.945L21.013 1.983L21.065 2.021L21.116 2.06L21.166 2.099L21.214 2.138L21.261 2.177L21.306 2.217L21.35 2.257L21.393 2.297L21.434 2.337L21.474 2.378L21.513 2.419L21.55 2.46L21.586 2.501L21.62 2.542L21.653 2.584L21.685 2.626L21.715 2.668L21.744 2.71L21.771 2.752L21.797 2.795L21.821 2.838L21.844 2.881L21.865 2.924L21.885 2.967L21.903 3.011L21.92 3.054L21.935 3.098L21.948 3.142L21.96 3.186L21.971 3.231L21.98 3.275L21.987 3.32L21.993 3.365L21.997 3.41L21.999 3.455L22 3.5V20.5L21.999 20.545L21.997 20.59L21.993 20.635L21.987 20.68L21.98 20.725L21.971 20.769L21.96 20.814L21.948 20.858L21.935 20.902L21.92 20.946L21.903 20.989L21.885 21.033L21.865 21.076L21.844 21.119L21.821 21.162L21.797 21.205L21.771 21.248L21.744 21.29L21.715 21.332L21.685 21.374L21.653 21.416L21.62 21.458L21.586 21.499L21.55 21.54L21.513 21.581L21.474 21.622L21.434 21.663L21.393 21.703L21.35 21.743L21.306 21.783L21.261 21.823L21.214 21.862L21.166 21.901L21.116 21.94L21.065 21.979L21.013 22.017L20.96 22.055L20.905 22.093L20.85 22.131L20.792 22.168L20.734 22.205L20.674 22.242L20.614 22.278L20.552 22.314L20.488 22.35L20.424 22.386L20.358 22.421L20.291 22.456L20.223 22.491L20.154 22.526L20.084 22.56L20.013 22.594L19.94 22.627L19.866 22.66L19.716 22.726L19.561 22.79L19.401 22.853L19.238 22.914L19.07 22.974L18.898 23.033L18.723 23.09L18.543 23.146L18.36 23.2L18.173 23.253L17.982 23.304L17.788 23.354L17.59 23.402L17.389 23.448L17.184 23.493L16.976 23.536L16.765 23.577L16.551 23.617L16.334 23.655L16.114 23.691L15.891 23.725L15.666 23.757L15.437 23.788L15.206 23.816L14.973 23.843L14.737 23.867L14.498 23.89L14.257 23.91L14.015 23.929L13.769 23.945L13.522 23.96L13.273 23.972L13.022 23.982L12.769 23.99L12.514 23.995L12.258 23.999L12 24L11.742 23.999L11.486 23.995L11.231 23.99L10.978 23.982L10.727 23.972L10.478 23.96L10.231 23.945L9.986 23.929L9.743 23.91L9.502 23.89L9.264 23.867L9.028 23.843L8.794 23.816L8.563 23.788L8.335 23.757L8.109 23.725L7.886 23.691L7.666 23.655L7.449 23.617L7.235 23.577L7.024 23.536L6.816 23.493L6.612 23.448L6.411 23.402L6.213 23.354L6.018 23.304L5.828 23.253L5.641 23.2L5.457 23.146L5.278 23.09L5.102 23.033L4.93 22.974L4.763 22.914L4.599 22.853L4.44 22.79L4.285 22.726L4.134 22.66L4.06 22.627L3.988 22.594L3.916 22.56L3.846 22.526L3.777 22.491L3.709 22.456L3.642 22.421L3.576 22.386L3.512 22.35L3.449 22.314L3.387 22.278L3.326 22.242L3.266 22.205L3.208 22.168L3.151 22.131L3.095 22.093L3.04 22.055L2.987 22.017L2.935 21.979L2.884 21.94L2.835 21.901L2.786 21.862L2.74 21.823L2.694 21.783L2.65 21.743L2.607 21.703L2.566 21.663L2.526 21.622L2.487 21.581L2.45 21.54L2.414 21.499L2.38 21.458L2.347 21.416L2.315 21.374L2.285 21.332L2.256 21.29L2.229 21.248L2.203 21.205L2.179 21.162L2.156 21.119L2.135 21.076L2.115 21.033L2.097 20.989L2.08 20.946L2.065 20.902L2.052 20.858L2.04 20.814L2.029 20.769L2.02 20.725L2.013 20.68L2.007 20.635L2.003 20.59L2.001 20.545L2 20.5V3.5L2.001 3.455L2.003 3.41L2.007 3.365L2.013 3.32L2.02 3.275L2.029 3.231L2.04 3.186L2.052 3.142L2.065 3.098L2.08 3.054L2.097 3.011L2.115 2.967L2.135 2.924L2.156 2.881L2.179 2.838L2.203 2.795L2.229 2.752L2.256 2.71L2.285 2.668L2.315 2.626L2.347 2.584L2.38 2.542L2.414 2.501L2.45 2.46L2.487 2.419L2.526 2.378L2.566 2.337L2.607 2.297L2.65 2.257L2.694 2.217L2.74 2.177L2.786 2.138L2.835 2.099L2.884 2.06L2.935 2.021L2.987 1.983L3.04 1.945L3.095 1.907L3.151 1.869L3.208 1.832L3.266 1.795L3.326 1.758L3.387 1.722L3.449 1.686L3.512 1.65L3.576 1.614L3.642 1.579L3.709 1.544L3.777 1.509L3.846 1.474L3.916 1.44L3.988 1.406L4.06 1.373L4.134 1.34L4.285 1.274L4.44 1.21L4.599 1.147L4.763 1.086L4.93 1.026L5.102 0.967L5.278 0.91L5.457 0.854L5.641 0.8L5.828 0.747L6.018 0.696L6.213 0.646L6.411 0.598L6.612 0.552L6.816 0.507L7.024 0.464L7.235 0.423L7.449 0.383L7.666 0.345L7.886 0.309L8.109 0.275L8.335 0.243L8.563 0.212L8.794 0.184L9.028 0.157L9.264 0.133L9.502 0.11L9.743 0.09L9.986 0.071L10.231 0.055L10.478 0.04L10.727 0.028L10.978 0.018L11.231 0.01L11.486 0.005L11.742 0.001L12 0L12.258 0.001V0.001ZM3 20.5V20.51L3.001 20.531L3.004 20.552L3.008 20.574L3.013 20.595L3.019 20.617L3.026 20.639L3.035 20.662L3.045 20.684L3.056 20.707L3.068 20.73L3.081 20.753L3.096 20.776L3.112 20.8L3.129 20.823L3.147 20.847L3.166 20.871L3.187 20.895L3.209 20.92L3.232 20.944L3.256 20.969L3.308 21.018L3.364 21.068L3.425 21.119L3.491 21.17L3.561 21.221L3.636 21.272L3.715 21.324L3.799 21.376L3.887 21.428L3.979 21.48L4.076 21.532L4.178 21.583L4.283 21.635L4.393 21.687L4.507 21.738L4.626 21.789L4.749 21.84L4.876 21.89L5.007 21.94L5.142 21.99L5.281 22.038L5.425 22.087L5.572 22.134L5.724 22.181L5.879 22.228L6.039 22.273L6.202 22.318L6.369 22.361L6.54 22.404L6.716 22.445L6.894 22.486L7.077 22.525L7.264 22.564L7.454 22.601L7.648 22.636L7.845 22.671L8.047 22.704L8.251 22.735L8.46 22.765L8.672 22.794L8.888 22.821L9.107 22.846L9.329 22.87L9.555 22.891L9.785 22.911L10.018 22.929L10.254 22.945L10.494 22.96L10.737 22.972L10.983 22.982L11.232 22.99L11.485 22.995L11.741 22.999L12 23L12.26 22.999L12.517 22.995L12.771 22.99L13.021 22.982L13.268 22.971L13.512 22.959L13.753 22.945L13.99 22.929L14.223 22.911L14.454 22.89L14.68 22.869L14.904 22.845L15.124 22.819L15.34 22.792L15.552 22.764L15.762 22.733L15.967 22.702L16.169 22.668L16.367 22.634L16.561 22.598L16.752 22.561L16.939 22.522L17.122 22.482L17.301 22.442L17.476 22.4L17.648 22.357L17.816 22.313L17.979 22.268L18.139 22.222L18.294 22.176L18.446 22.129L18.594 22.081L18.737 22.032L18.876 21.983L19.012 21.933L19.143 21.883L19.269 21.833L19.392 21.782L19.51 21.73L19.624 21.679L19.734 21.627L19.84 21.575L19.941 21.523L20.037 21.471L20.129 21.419L20.217 21.366L20.3 21.315L20.379 21.263L20.453 21.211L20.523 21.16L20.588 21.109L20.648 21.058L20.704 21.008L20.755 20.958L20.778 20.934L20.801 20.909L20.822 20.885L20.842 20.861L20.861 20.837L20.879 20.813L20.896 20.789L20.911 20.766L20.925 20.742L20.938 20.719L20.95 20.696L20.96 20.673L20.97 20.651L20.978 20.629L20.984 20.607L20.99 20.585L20.994 20.563L20.998 20.542L20.999 20.521L21 20.5V16.373L20.923 16.428L20.843 16.481L20.76 16.535L20.675 16.588L20.588 16.64L20.498 16.692L20.405 16.743L20.31 16.793L20.213 16.843L20.113 16.892L20.011 16.941L19.906 16.989L19.8 17.036L19.691 17.083L19.58 17.129L19.466 17.174L19.351 17.219L19.233 17.263L19.113 17.306L18.991 17.348L18.867 17.39L18.741 17.431L18.613 17.471L18.483 17.511L18.351 17.549L18.217 17.587L18.082 17.624L17.944 17.661L17.805 17.696L17.663 17.731L17.52 17.765L17.376 17.798L17.229 17.83L17.081 17.861L16.931 17.891L16.78 17.921L16.627 17.95L16.473 17.977L16.317 18.004L16.159 18.03L16 18.055L15.839 18.079L15.677 18.102L15.514 18.124L15.349 18.145L15.183 18.165L15.016 18.184L14.847 18.202L14.678 18.219L14.507 18.235L14.334 18.25L14.161 18.264L13.986 18.277L13.811 18.289L13.634 18.3L13.456 18.31L13.277 18.318L13.098 18.326L12.917 18.332L12.735 18.337L12.553 18.341L12.369 18.344L12.185 18.346H11.815L11.631 18.344L11.447 18.341L11.265 18.337L11.083 18.332L10.902 18.326L10.723 18.318L10.544 18.31L10.366 18.3L10.19 18.289L10.014 18.277L9.839 18.264L9.666 18.25L9.494 18.235L9.323 18.219L9.153 18.202L8.984 18.184L8.817 18.165L8.651 18.145L8.486 18.124L8.323 18.102L8.161 18.079L8 18.055L7.841 18.03L7.684 18.004L7.528 17.977L7.373 17.95L7.22 17.921L7.069 17.891L6.919 17.861L6.771 17.83L6.625 17.798L6.48 17.765L6.337 17.731L6.196 17.696L6.056 17.661L5.919 17.624L5.783 17.587L5.649 17.549L5.517 17.511L5.387 17.471L5.259 17.431L5.133 17.39L5.009 17.348L4.887 17.306L4.767 17.262L4.65 17.219L4.534 17.174L4.421 17.129L4.309 17.083L4.2 17.036L4.094 16.989L3.989 16.941L3.887 16.892L3.787 16.843L3.69 16.793L3.595 16.743L3.502 16.691L3.412 16.64L3.325 16.588L3.24 16.535L3.157 16.481L3.077 16.427L3 16.373V20.5V20.5ZM3 14.846V14.857L3.001 14.878L3.004 14.899L3.008 14.92L3.013 14.942L3.019 14.964L3.026 14.986L3.035 15.008L3.045 15.03L3.056 15.053L3.068 15.076L3.081 15.099L3.096 15.123L3.112 15.146L3.129 15.17L3.147 15.194L3.166 15.218L3.187 15.242L3.209 15.266L3.232 15.291L3.256 15.315L3.308 15.365L3.364 15.415L3.425 15.465L3.491 15.516L3.561 15.567L3.636 15.619L3.715 15.67L3.799 15.722L3.887 15.774L3.979 15.826L4.076 15.878L4.178 15.93L4.283 15.982L4.393 16.033L4.507 16.084L4.626 16.136L4.749 16.186L4.876 16.237L5.007 16.287L5.142 16.336L5.281 16.385L5.425 16.433L5.572 16.481L5.724 16.528L5.879 16.574L6.039 16.619L6.202 16.664L6.369 16.708L6.54 16.75L6.716 16.792L6.894 16.832L7.077 16.872L7.264 16.91L7.454 16.947L7.648 16.983L7.845 17.017L8.047 17.05L8.251 17.082L8.46 17.112L8.672 17.14L8.888 17.167L9.107 17.192L9.329 17.216L9.555 17.238L9.785 17.258L10.018 17.276L10.254 17.292L10.494 17.306L10.737 17.318L10.983 17.328L11.232 17.336L11.485 17.342L11.741 17.345L12 17.346L12.26 17.345L12.517 17.342L12.771 17.336L13.021 17.328L13.268 17.318L13.512 17.306L13.753 17.291L13.99 17.275L14.223 17.257L14.454 17.237L14.68 17.215L14.904 17.191L15.124 17.166L15.34 17.139L15.552 17.11L15.762 17.08L15.967 17.048L16.169 17.015L16.367 16.98L16.561 16.944L16.752 16.907L16.939 16.868L17.122 16.829L17.301 16.788L17.476 16.746L17.648 16.703L17.816 16.659L17.979 16.614L18.139 16.569L18.294 16.522L18.446 16.475L18.594 16.427L18.737 16.379L18.876 16.329L19.012 16.28L19.143 16.23L19.269 16.179L19.392 16.128L19.51 16.077L19.624 16.025L19.734 15.973L19.84 15.921L19.941 15.869L20.037 15.817L20.129 15.765L20.217 15.713L20.3 15.661L20.379 15.609L20.453 15.558L20.523 15.506L20.588 15.455L20.648 15.405L20.704 15.354L20.755 15.305L20.778 15.28L20.801 15.256L20.822 15.231L20.842 15.207L20.861 15.183L20.879 15.159L20.896 15.135L20.911 15.112L20.925 15.089L20.938 15.065L20.95 15.043L20.96 15.02L20.97 14.997L20.978 14.975L20.984 14.953L20.99 14.931L20.994 14.91L20.998 14.888L20.999 14.867L21 14.846V10.707L20.923 10.761L20.843 10.815L20.76 10.869L20.675 10.921L20.588 10.974L20.498 11.025L20.405 11.076L20.31 11.127L20.213 11.177L20.113 11.226L20.011 11.275L19.906 11.323L19.8 11.37L19.691 11.417L19.58 11.463L19.466 11.508L19.351 11.552L19.233 11.596L19.113 11.64L18.991 11.682L18.867 11.724L18.741 11.765L18.613 11.805L18.483 11.844L18.351 11.883L18.217 11.921L18.082 11.958L17.944 11.994L17.805 12.03L17.663 12.065L17.52 12.098L17.376 12.131L17.229 12.164L17.081 12.195L16.931 12.225L16.78 12.255L16.627 12.283L16.473 12.311L16.317 12.338L16.159 12.364L16 12.389L15.839 12.413L15.677 12.436L15.514 12.458L15.349 12.479L15.183 12.499L15.016 12.518L14.847 12.536L14.678 12.553L14.507 12.569L14.334 12.584L14.161 12.598L13.986 12.611L13.811 12.623L13.634 12.634L13.456 12.643L13.277 12.652L13.098 12.659L12.917 12.666L12.735 12.671L12.553 12.675L12.369 12.678L12.185 12.68H11.815L11.631 12.678L11.447 12.675L11.265 12.671L11.083 12.666L10.902 12.659L10.723 12.652L10.544 12.643L10.366 12.634L10.19 12.623L10.014 12.611L9.839 12.598L9.666 12.584L9.494 12.569L9.323 12.553L9.153 12.536L8.984 12.518L8.817 12.499L8.651 12.479L8.486 12.458L8.323 12.436L8.161 12.413L8 12.389L7.841 12.364L7.684 12.338L7.528 12.311L7.373 12.283L7.22 12.255L7.069 12.225L6.919 12.195L6.771 12.164L6.625 12.131L6.48 12.098L6.337 12.065L6.196 12.03L6.056 11.994L5.919 11.958L5.783 11.921L5.649 11.883L5.517 11.844L5.387 11.805L5.259 11.765L5.133 11.724L5.009 11.682L4.887 11.639L4.767 11.596L4.65 11.552L4.534 11.508L4.421 11.462L4.309 11.416L4.2 11.37L4.094 11.323L3.989 11.275L3.887 11.226L3.787 11.177L3.69 11.127L3.595 11.076L3.502 11.025L3.412 10.974L3.325 10.921L3.24 10.869L3.157 10.815L3.077 10.761L3 10.707V14.846V14.846ZM3 9.18V9.191L3.001 9.211L3.004 9.233L3.008 9.254L3.013 9.276L3.019 9.297L3.026 9.319L3.035 9.342L3.045 9.364L3.056 9.387L3.068 9.41L3.081 9.433L3.096 9.456L3.112 9.48L3.129 9.504L3.147 9.527L3.166 9.551L3.187 9.576L3.209 9.6L3.232 9.624L3.256 9.649L3.308 9.699L3.364 9.749L3.425 9.799L3.491 9.85L3.561 9.901L3.636 9.953L3.715 10.004L3.799 10.056L3.887 10.108L3.979 10.16L4.076 10.212L4.178 10.264L4.283 10.315L4.393 10.367L4.507 10.418L4.626 10.469L4.749 10.52L4.876 10.57L5.007 10.62L5.142 10.67L5.281 10.719L5.425 10.767L5.572 10.815L5.724 10.862L5.879 10.908L6.039 10.953L6.202 10.998L6.369 11.041L6.54 11.084L6.716 11.126L6.894 11.166L7.077 11.206L7.264 11.244L7.454 11.281L7.648 11.317L7.845 11.351L8.047 11.384L8.251 11.416L8.46 11.446L8.672 11.474L8.888 11.501L9.107 11.526L9.329 11.55L9.555 11.571L9.785 11.591L10.018 11.609L10.254 11.626L10.494 11.64L10.737 11.652L10.983 11.662L11.232 11.67L11.485 11.676L11.741 11.679L12 11.68L12.26 11.679L12.517 11.676L12.771 11.67L13.021 11.662L13.268 11.652L13.512 11.639L13.753 11.625L13.99 11.609L14.223 11.591L14.454 11.571L14.68 11.549L14.904 11.525L15.124 11.5L15.34 11.473L15.552 11.444L15.762 11.414L15.967 11.382L16.169 11.349L16.367 11.314L16.561 11.278L16.752 11.241L16.939 11.202L17.122 11.163L17.301 11.122L17.476 11.08L17.648 11.037L17.816 10.993L17.979 10.948L18.139 10.903L18.294 10.856L18.446 10.809L18.594 10.761L18.737 10.712L18.876 10.663L19.012 10.614L19.143 10.563L19.269 10.513L19.392 10.462L19.51 10.41L19.624 10.359L19.734 10.307L19.84 10.255L19.941 10.203L20.037 10.151L20.129 10.099L20.217 10.047L20.3 9.995L20.379 9.943L20.453 9.891L20.523 9.84L20.588 9.789L20.648 9.738L20.704 9.688L20.755 9.639L20.778 9.614L20.801 9.589L20.822 9.565L20.842 9.541L20.861 9.517L20.879 9.493L20.896 9.469L20.911 9.446L20.925 9.422L20.938 9.399L20.95 9.376L20.96 9.354L20.97 9.331L20.978 9.309L20.984 9.287L20.99 9.265L20.994 9.243L20.998 9.222L20.999 9.201L21 9.18V5.027L20.923 5.081L20.843 5.135L20.76 5.188L20.675 5.241L20.588 5.294L20.498 5.345L20.405 5.396L20.31 5.447L20.213 5.497L20.113 5.546L20.011 5.594L19.906 5.642L19.8 5.69L19.691 5.736L19.58 5.782L19.466 5.828L19.351 5.872L19.233 5.916L19.113 5.959L18.991 6.002L18.867 6.044L18.741 6.085L18.613 6.125L18.483 6.164L18.351 6.203L18.217 6.241L18.082 6.278L17.944 6.314L17.805 6.35L17.663 6.384L17.52 6.418L17.376 6.451L17.229 6.483L17.081 6.515L16.931 6.545L16.78 6.575L16.627 6.603L16.473 6.631L16.317 6.658L16.159 6.684L16 6.708L15.839 6.732L15.677 6.755L15.514 6.778L15.349 6.799L15.183 6.819L15.016 6.838L14.847 6.856L14.678 6.873L14.507 6.889L14.334 6.904L14.161 6.918L13.986 6.931L13.811 6.943L13.634 6.953L13.456 6.963L13.277 6.972L13.098 6.979L12.917 6.985L12.735 6.991L12.553 6.995L12.369 6.998L12.185 6.999L12 7L11.815 6.999L11.631 6.998L11.447 6.995L11.265 6.991L11.083 6.985L10.902 6.979L10.723 6.972L10.544 6.963L10.366 6.953L10.19 6.943L10.014 6.931L9.839 6.918L9.666 6.904L9.494 6.889L9.323 6.873L9.153 6.856L8.984 6.838L8.817 6.819L8.651 6.799L8.486 6.778L8.323 6.755L8.161 6.732L8 6.708L7.841 6.684L7.684 6.658L7.528 6.631L7.373 6.603L7.22 6.575L7.069 6.545L6.919 6.515L6.771 6.483L6.625 6.451L6.48 6.418L6.337 6.384L6.196 6.35L6.056 6.314L5.919 6.278L5.783 6.241L5.649 6.203L5.517 6.164L5.387 6.125L5.259 6.084L5.133 6.043L5.009 6.002L4.887 5.959L4.767 5.916L4.65 5.872L4.534 5.828L4.421 5.782L4.309 5.736L4.2 5.69L4.094 5.642L3.989 5.594L3.887 5.546L3.787 5.496L3.69 5.447L3.595 5.396L3.502 5.345L3.412 5.293L3.325 5.241L3.24 5.188L3.157 5.135L3.077 5.081L3 5.027V9.18V9.18ZM11.74 1.001L11.483 1.005L11.229 1.01L10.979 1.018L10.732 1.029L10.488 1.041L10.247 1.055L10.01 1.071L9.777 1.089L9.546 1.11L9.32 1.132L9.096 1.155L8.876 1.181L8.66 1.208L8.448 1.236L8.238 1.267L8.033 1.299L7.831 1.332L7.633 1.366L7.439 1.402L7.248 1.44L7.061 1.478L6.878 1.518L6.699 1.559L6.524 1.601L6.352 1.644L6.184 1.687L6.021 1.732L5.861 1.778L5.706 1.824L5.554 1.872L5.406 1.92L5.263 1.968L5.124 2.017L4.988 2.067L4.857 2.117L4.731 2.168L4.608 2.219L4.49 2.27L4.376 2.322L4.266 2.374L4.16 2.426L4.059 2.478L3.963 2.53L3.871 2.582L3.783 2.634L3.7 2.686L3.621 2.738L3.547 2.789L3.477 2.841L3.412 2.892L3.352 2.942L3.296 2.992L3.245 3.042L3.222 3.067L3.199 3.091L3.178 3.115L3.158 3.14L3.139 3.164L3.121 3.188L3.104 3.211L3.089 3.235L3.075 3.258L3.062 3.281L3.05 3.304L3.04 3.327L3.03 3.349L3.022 3.371L3.016 3.394L3.01 3.415L3.006 3.437L3.002 3.458L3.001 3.479L3 3.5L3.001 3.521L3.002 3.542L3.006 3.563L3.01 3.585L3.016 3.606L3.022 3.629L3.03 3.651L3.04 3.673L3.05 3.696L3.062 3.719L3.075 3.742L3.089 3.765L3.104 3.789L3.121 3.812L3.139 3.836L3.158 3.86L3.178 3.885L3.199 3.909L3.222 3.933L3.245 3.958L3.296 4.008L3.352 4.058L3.412 4.108L3.477 4.159L3.547 4.211L3.621 4.262L3.7 4.314L3.783 4.366L3.871 4.418L3.963 4.47L4.059 4.522L4.16 4.574L4.266 4.626L4.376 4.678L4.49 4.73L4.608 4.781L4.731 4.832L4.857 4.883L4.988 4.933L5.124 4.983L5.263 5.032L5.406 5.08L5.554 5.128L5.706 5.176L5.861 5.222L6.021 5.268L6.184 5.313L6.352 5.356L6.524 5.399L6.699 5.441L6.878 5.482L7.061 5.522L7.248 5.56L7.439 5.598L7.633 5.634L7.831 5.668L8.033 5.701L8.238 5.733L8.448 5.764L8.66 5.792L8.876 5.819L9.096 5.845L9.32 5.868L9.546 5.89L9.777 5.911L10.01 5.929L10.247 5.945L10.488 5.959L10.732 5.971L10.979 5.982L11.229 5.99L11.483 5.995L11.74 5.999L12 6L12.26 5.999L12.517 5.995L12.771 5.99L13.021 5.982L13.268 5.971L13.512 5.959L13.753 5.945L13.99 5.929L14.223 5.911L14.454 5.89L14.68 5.868L14.904 5.845L15.124 5.819L15.34 5.792L15.552 5.764L15.762 5.733L15.967 5.701L16.169 5.668L16.367 5.634L16.561 5.598L16.752 5.56L16.939 5.522L17.122 5.482L17.301 5.441L17.476 5.399L17.648 5.356L17.816 5.313L17.979 5.268L18.139 5.222L18.294 5.176L18.446 5.128L18.594 5.08L18.737 5.032L18.876 4.983L19.012 4.933L19.143 4.883L19.269 4.832L19.392 4.781L19.51 4.73L19.624 4.678L19.734 4.626L19.84 4.574L19.941 4.522L20.037 4.47L20.129 4.418L20.217 4.366L20.3 4.314L20.379 4.262L20.453 4.211L20.523 4.159L20.588 4.108L20.648 4.058L20.704 4.008L20.755 3.958L20.778 3.933L20.801 3.909L20.822 3.885L20.842 3.86L20.861 3.836L20.879 3.812L20.896 3.789L20.911 3.765L20.925 3.742L20.938 3.719L20.95 3.696L20.96 3.673L20.97 3.651L20.978 3.629L20.984 3.606L20.99 3.585L20.994 3.563L20.998 3.542L20.999 3.521L21 3.5L20.999 3.479L20.998 3.458L20.994 3.437L20.99 3.415L20.984 3.394L20.978 3.371L20.97 3.349L20.96 3.327L20.95 3.304L20.938 3.281L20.925 3.258L20.911 3.235L20.896 3.211L20.879 3.188L20.861 3.164L20.842 3.14L20.822 3.115L20.801 3.091L20.778 3.067L20.755 3.042L20.704 2.992L20.648 2.942L20.588 2.892L20.523 2.841L20.453 2.789L20.379 2.738L20.3 2.686L20.217 2.634L20.129 2.582L20.037 2.53L19.941 2.478L19.84 2.426L19.734 2.374L19.624 2.322L19.51 2.27L19.392 2.219L19.269 2.168L19.143 2.117L19.012 2.067L18.876 2.017L18.737 1.968L18.594 1.92L18.446 1.872L18.294 1.824L18.139 1.778L17.979 1.732L17.816 1.687L17.648 1.644L17.476 1.601L17.301 1.559L17.122 1.518L16.939 1.478L16.752 1.44L16.561 1.402L16.367 1.366L16.169 1.332L15.967 1.299L15.762 1.267L15.552 1.236L15.34 1.208L15.124 1.181L14.904 1.155L14.68 1.132L14.454 1.11L14.223 1.089L13.99 1.071L13.753 1.055L13.512 1.041L13.268 1.029L13.021 1.018L12.771 1.01L12.517 1.005L12.26 1.001L12 1L11.74 1.001V1.001Z\" fill=\"currentColor\"/>\n</svg>\n";

const EntitySvg = "<svg width=\"77\" height=\"80\" viewBox=\"0 0 77 80\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t<g>\n\t\t<path d=\"M74.0149 38.8888C74.0149 43.5755 73.0918 48.2163 71.2983 52.5463C69.5048 56.8762 66.876 60.8105 63.562 64.1245C60.248 67.4385 56.3137 70.0673 51.9838 71.8608C47.6538 73.6543 43.013 74.5774 38.3263 74.5774C33.6396 74.5774 28.9988 73.6543 24.6689 71.8608C20.3389 70.0673 16.4046 67.4385 13.0907 64.1245C9.77666 60.8105 7.14785 56.8762 5.35433 52.5463C3.56081 48.2163 2.6377 43.5755 2.6377 38.8888C2.6377 34.2021 3.56081 29.5613 5.35433 25.2314C7.14785 20.9014 9.77666 16.9671 13.0907 13.6532C16.4046 10.3392 20.3389 7.71035 24.6689 5.91683C28.9988 4.12331 33.6396 3.2002 38.3263 3.2002C43.013 3.2002 47.6538 4.12331 51.9838 5.91683C56.3137 7.71035 60.248 10.3392 63.562 13.6532C66.876 16.9671 69.5048 20.9014 71.2983 25.2314C73.0918 29.5613 74.0149 34.2021 74.0149 38.8888V38.8888Z\" stroke=\"currentColor\" stroke-width=\"4.98203\"/>\n\t\t<path d=\"M2.69922 75.4727L75.6992 75.5154\" stroke=\"currentColor\" stroke-width=\"4\"/>\n\t</g>\n</svg>\n";

const Ec2Svg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"48px\" viewBox=\"0 0 48 48\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <title>Icon-Resource/Compute/Res_Amazon-EC2_Instance_48</title>\n    <g id=\"Icon-Resource/Compute/Res_Amazon-EC2_Instance_48\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path d=\"M9,39 L39,39 L39,9 L9,9 L9,39 Z M46,13 L46,11 L41,11 L41,8 C41,7.448 40.552,7 40,7 L37,7 L37,2 L35,2 L35,7 L31,7 L31,2 L29,2 L29,7 L25,7 L25,2 L23,2 L23,7 L19,7 L19,2 L17,2 L17,7 L13,7 L13,2 L11,2 L11,7 L8,7 C7.447,7 7,7.448 7,8 L7,11 L2,11 L2,13 L7,13 L7,17 L2,17 L2,19 L7,19 L7,23 L2,23 L2,25 L7,25 L7,29 L2,29 L2,31 L7,31 L7,35 L2,35 L2,37 L7,37 L7,40 C7,40.553 7.447,41 8,41 L11,41 L11,46 L13,46 L13,41 L17,41 L17,46 L19,46 L19,41 L23,41 L23,46 L25,46 L25,41 L29,41 L29,46 L31,46 L31,41 L35,41 L35,46 L37,46 L37,41 L40,41 C40.552,41 41,40.553 41,40 L41,37 L46,37 L46,35 L41,35 L41,31 L46,31 L46,29 L41,29 L41,25 L46,25 L46,23 L41,23 L41,19 L46,19 L46,17 L41,17 L41,13 L46,13 Z\" id=\"Amazon-EC2-Instance_Resource-Icon_light-bg\" fill=\"#ED7100\"></path>\n    </g>\n</svg>\n";

const IamSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"48px\" viewBox=\"0 0 48 48\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <title>Icon-Resource/Security-Identity-and-Compliance/Res_AWS-Identity-Access-Management_IAM-Access-Analyzer_48</title>\n    <g id=\"Icon-Resource/Security-Identity-and-Compliance/Res_AWS-Identity-Access-Management_IAM-Access-Analyzer_48\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path d=\"M15,25.001 L19,25.001 L19,23.001 L15,23.001 L15,25.001 Z M4,27.001 L11,27.001 L11,20.001 L4,20.001 L4,27.001 Z M12,29.001 L3,29.001 C2.448,29.001 2,28.553 2,28.001 L2,19.001 C2,18.448 2.448,18.001 3,18.001 L12,18.001 C12.552,18.001 13,18.448 13,19.001 L13,28.001 C13,28.553 12.552,29.001 12,29.001 L12,29.001 Z M43.2,27.001 L40,21.891 L36.8,27.001 L43.2,27.001 Z M45.87,28.481 C45.696,28.799 45.362,28.998 45,29.0010017 L35,29.0010017 C34.448,29.002 33.999,28.555 33.9979861,28.003 C33.997,27.815 34.05,27.631 34.149,27.471 L39.149,19.471 C39.44,19.001 40.058,18.857 40.526,19.148 C40.658,19.229 40.769,19.34 40.851,19.471 L45.851,27.471 C46.038,27.779 46.046,28.165 45.87,28.481 L45.87,28.481 Z M43,41.001 C43,39.344 41.657,38.001 40,38.001 C38.343,38.001 37,39.344 37,41.001 C37,42.658 38.343,44.001 40,44.001 C41.657,44.001 43,42.658 43,41.001 L43,41.001 Z M45,41.001 C45.003,43.762 42.767,46.003 40.005,46.0060018 C37.625,46.008 35.573,44.333 35.101,42.001 L7,42.001 C6.448,42.001 6,41.553 6,41.001 L6,31.001 L8,31.001 L8,40.001 L35.101,40.001 C35.649,37.295 38.288,35.546 40.995,36.096 C43.327,36.569 45.003,38.621 45,41.001 L45,41.001 Z M22,25.001 L26,25.001 L26,23.001 L22,23.001 L22,25.001 Z M37,7.001 C37,8.658 38.343,10.001 40,10.001 C41.657,10.001 43,8.658 43,7.001 C43,5.344 41.657,4.001 40,4.001 C38.343,4.001 37,5.344 37,7.001 L37,7.001 Z M8,16.001 L6,16.001 L6,7.001 C6,6.448 6.448,6.001 7,6.001 L35.101,6.001 C35.652,3.295 38.294,1.55 40.999,2.102 C43.704,2.654 45.45,5.295 44.897,8.001 C44.346,10.706 41.704,12.452 38.999,11.9 C37.035,11.499 35.501,9.965 35.101,8.001 L8,8.001 L8,16.001 Z M29,25.001 L33,25.001 L33,23.001 L29,23.001 L29,25.001 Z\" id=\"AWS-Identity-and-Access-Management_AWS-IAM-Access-Analyzer_Resource-Icon_light-bg\" fill=\"#DD344C\"></path>\n    </g>\n</svg>";

const LambdaSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"48px\" viewBox=\"0 0 48 48\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <title>Icon-Resource/Compute/Res_AWS-Lambda_Lambda-Function_48</title>\n    <g id=\"Icon-Resource/Compute/Res_AWS-Lambda_Lambda-Function_48\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path d=\"M24,44 C12.972,44 4,35.028 4,24 C4,12.972 12.972,4 24,4 C35.028,4 44,12.972 44,24 C44,35.028 35.028,44 24,44 L24,44 Z M24,2 C11.869,2 2,11.869 2,24 C2,36.131 11.869,46 24,46 C36.131,46 46,36.131 46,24 C46,11.869 36.131,2 24,2 L24,2 Z M17.231,35.25 L11.876,35.25 L18.221,21.959 L20.902,27.492 L17.231,35.25 Z M19.114,19.215 C18.946,18.87 18.597,18.651 18.214,18.651 L18.211,18.651 C17.826,18.652 17.477,18.874 17.312,19.221 L9.389,35.819 C9.24,36.129 9.262,36.493 9.445,36.783 C9.628,37.074 9.947,37.25 10.291,37.25 L17.864,37.25 C18.251,37.25 18.603,37.027 18.769,36.678 L22.915,27.915 C23.044,27.642 23.043,27.323 22.911,27.051 L19.114,19.215 Z M36.125,35.25 L30.673,35.25 L20.761,13.953 C20.597,13.601 20.243,13.375 19.854,13.375 L16.251,13.375 L16.255,9.25 L23.475,9.25 L33.339,30.545 C33.503,30.898 33.856,31.125 34.246,31.125 L36.125,31.125 L36.125,35.25 Z M37.125,29.125 L34.885,29.125 L25.021,7.83 C24.856,7.477 24.503,7.25 24.113,7.25 L15.256,7.25 C14.704,7.25 14.257,7.697 14.256,8.249 L14.25,14.374 C14.25,14.64 14.355,14.894 14.543,15.082 C14.73,15.27 14.984,15.375 15.25,15.375 L19.217,15.375 L29.129,36.672 C29.293,37.024 29.646,37.25 30.035,37.25 L37.125,37.25 C37.678,37.25 38.125,36.803 38.125,36.25 L38.125,30.125 C38.125,29.572 37.678,29.125 37.125,29.125 L37.125,29.125 Z\" id=\"Amazon-Lambda-Lambda-Function_Resource-Icon_light-bg\" fill=\"#ED7100\"></path>\n    </g>\n</svg>\n";

const SnsSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"48px\" viewBox=\"0 0 48 48\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <title>Icon-Resource/Application-Integration/Res_Amazon-Simple-Notification-Service_Topic_48</title>\n    <g id=\"Icon-Resource/Application-Integration/Res_Amazon-Simple-Notification-Service_Topic_48\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path d=\"M44,38.5 L46,38.5 L46,36.5 L44,36.5 L44,38.5 Z M46,33 L46,34.5 L44,34.5 L44,34 L43.5,34 L43.5,32 L45,32 C45.553,32 46,32.447 46,33 L46,33 Z M13.5,34 L16.5,34 L16.5,32 L13.5,32 L13.5,34 Z M37.5,34 L40.5,34 L40.5,32 L37.5,32 L37.5,34 Z M19.5,34 L22.5,34 L22.5,32 L19.5,32 L19.5,34 Z M7.5,34 L10.5,34 L10.5,32 L7.5,32 L7.5,34 Z M31.5,34 L34.5,34 L34.5,32 L31.5,32 L31.5,34 Z M25.5,34 L28.5,34 L28.5,32 L25.5,32 L25.5,34 Z M3,32 L4.5,32 L4.5,34 L4,34 L4,34.5 L2,34.5 L2,33 C2,32.447 2.447,32 3,32 L3,32 Z M2,38.5 L4,38.5 L4,36.5 L2,36.5 L2,38.5 Z M4,41 L4.5,41 L4.5,43 L3,43 C2.447,43 2,42.553 2,42 L2,40.5 L4,40.5 L4,41 Z M19.5,43 L22.5,43 L22.5,41 L19.5,41 L19.5,43 Z M31.5,43 L34.5,43 L34.5,41 L31.5,41 L31.5,43 Z M37.5,43 L40.5,43 L40.5,41 L37.5,41 L37.5,43 Z M7.5,43 L10.5,43 L10.5,41 L7.5,41 L7.5,43 Z M25.5,43 L28.5,43 L28.5,41 L25.5,41 L25.5,43 Z M13.5,43 L16.5,43 L16.5,41 L13.5,41 L13.5,43 Z M44,40.5 L46,40.5 L46,42 C46,42.553 45.553,43 45,43 L43.5,43 L43.5,41 L44,41 L44,40.5 Z M44,25.5 L46,25.5 L46,23.5 L44,23.5 L44,25.5 Z M46,20 L46,21.5 L44,21.5 L44,21 L43.5,21 L43.5,19 L45,19 C45.553,19 46,19.447 46,20 L46,20 Z M31.5,21 L34.5,21 L34.5,19 L31.5,19 L31.5,21 Z M7.5,21 L10.5,21 L10.5,19 L7.5,19 L7.5,21 Z M37.5,21 L40.5,21 L40.5,19 L37.5,19 L37.5,21 Z M13.5,21 L16.5,21 L16.5,19 L13.5,19 L13.5,21 Z M19.5,21 L22.5,21 L22.5,19 L19.5,19 L19.5,21 Z M25.5,21 L28.5,21 L28.5,19 L25.5,19 L25.5,21 Z M3,19 L4.5,19 L4.5,21 L4,21 L4,21.5 L2,21.5 L2,20 C2,19.447 2.447,19 3,19 L3,19 Z M2,25.5 L4,25.5 L4,23.5 L2,23.5 L2,25.5 Z M4,28 L4.5,28 L4.5,30 L3,30 C2.447,30 2,29.553 2,29 L2,27.5 L4,27.5 L4,28 Z M19.5,30 L22.5,30 L22.5,28 L19.5,28 L19.5,30 Z M31.5,30 L34.5,30 L34.5,28 L31.5,28 L31.5,30 Z M7.5,30 L10.5,30 L10.5,28 L7.5,28 L7.5,30 Z M13.5,30 L16.5,30 L16.5,28 L13.5,28 L13.5,30 Z M37.5,30 L40.5,30 L40.5,28 L37.5,28 L37.5,30 Z M25.5,30 L28.5,30 L28.5,28 L25.5,28 L25.5,30 Z M44,27.5 L46,27.5 L46,29 C46,29.553 45.553,30 45,30 L43.5,30 L43.5,28 L44,28 L44,27.5 Z M4,15 L44,15 L44,7 L4,7 L4,15 Z M45,5 L3,5 C2.447,5 2,5.447 2,6 L2,16 C2,16.553 2.447,17 3,17 L45,17 C45.553,17 46,16.553 46,16 L46,6 C46,5.447 45.553,5 45,5 L45,5 Z\" id=\"Amazon-Simple-Notification-Service_Topic_Resource-Icon_light-bg\" fill=\"#E7157B\"></path>\n    </g>\n</svg>";

const SqsSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"48px\" height=\"48px\" viewBox=\"0 0 48 48\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n    <title>Icon-Resource/Application-Integration/Res_Amazon-Simple-Queue-Service_Queue_48</title>\n    <g id=\"Icon-Resource/Application-Integration/Res_Amazon-Simple-Queue-Service_Queue_48\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path d=\"M37.449,22.261 L37.449,26.221 L35.026,24.207 L37.449,22.261 Z M37.81,29.121 C37.993,29.273 38.22,29.352 38.449,29.352 C38.594,29.352 38.738,29.321 38.874,29.257 C39.224,29.092 39.449,28.74 39.449,28.352 L39.449,20.176 C39.449,19.791 39.228,19.441 38.882,19.275 C38.535,19.108 38.123,19.156 37.823,19.397 L32.819,23.414 C32.585,23.602 32.448,23.885 32.4449503,24.185 C32.442,24.486 32.575,24.771 32.806,24.963 L37.81,29.121 Z M10.527,22.307 L12.951,24.322 L10.527,26.267 L10.527,22.307 Z M9.095,29.253 C9.232,29.32 9.38,29.352 9.527,29.352 C9.751,29.352 9.972,29.277 10.153,29.132 L15.158,25.115 C15.392,24.927 15.529,24.644 15.5320497,24.344 C15.535,24.043 15.402,23.758 15.171,23.566 L10.166,19.407 C9.868,19.16 9.453,19.107 9.102,19.271 C8.752,19.436 8.527,19.788 8.527,20.176 L8.527,28.352 C8.527,28.737 8.748,29.087 9.095,29.253 L9.095,29.253 Z M28.368,34.027 L30.368,34.027 L30.368,14.747 L28.368,14.747 L28.368,34.027 Z M23.121,34.027 L25.121,34.027 L25.121,14.747 L23.121,14.747 L23.121,34.027 Z M17.711,34.027 L19.711,34.027 L19.711,14.747 L17.711,14.747 L17.711,34.027 Z M3.999,35.773 L43.977,35.773 L43.977,13.001 L3.999,13.001 L3.999,35.773 Z M44.977,11 L3,11 C2.447,11 2,11.448 2,12 L2,36.773 C2,37.325 2.447,37.773 3,37.773 L44.977,37.773 C45.53,37.773 45.977,37.325 45.977,36.773 L45.977,12 C45.977,11.448 45.53,11 44.977,11 L44.977,11 Z\" id=\"Amazon-Simple-Notification-Service_Queue\" fill=\"#E7157B\"></path>\n    </g>\n</svg>";

const AzureFunctionSvg = "<svg id=\"a2c88306-fa03-4e5b-b192-401f0b77808b\" xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\"><defs><linearGradient id=\"b403aca7-f387-4434-96b4-ae157edc835f\" x1=\"-175.993\" y1=\"-343.723\" x2=\"-175.993\" y2=\"-359.232\" gradientTransform=\"translate(212.573 370.548) scale(1.156 1.029)\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0\" stop-color=\"#fea11b\" /><stop offset=\"0.284\" stop-color=\"#fea51a\" /><stop offset=\"0.547\" stop-color=\"#feb018\" /><stop offset=\"0.8\" stop-color=\"#ffc314\" /><stop offset=\"1\" stop-color=\"#ffd70f\" /></linearGradient></defs><title>Icon-compute-29</title><g><path d=\"M2.37,7.475H3.2a.267.267,0,0,1,.267.267v6.148a.533.533,0,0,1-.533.533H2.1a0,0,0,0,1,0,0V7.741a.267.267,0,0,1,.267-.267Z\" transform=\"translate(12.507 16.705) rotate(134.919)\" fill=\"#50e6ff\" /><path d=\"M2.325,3.6h.833a.267.267,0,0,1,.267.267v6.583a0,0,0,0,1,0,0H2.591a.533.533,0,0,1-.533-.533V3.865A.267.267,0,0,1,2.325,3.6Z\" transform=\"translate(5.759 0.114) rotate(44.919)\" fill=\"#1490df\" /></g><g><path d=\"M14.53,7.475h.833a.533.533,0,0,1,.533.533v6.148a.267.267,0,0,1-.267.267H14.8a.267.267,0,0,1-.267-.267V7.475a0,0,0,0,1,0,0Z\" transform=\"translate(12.223 -7.555) rotate(45.081)\" fill=\"#50e6ff\" /><path d=\"M15.108,3.6h.833a0,0,0,0,1,0,0v6.583a.267.267,0,0,1-.267.267h-.833a.267.267,0,0,1-.267-.267V4.131a.533.533,0,0,1,.533-.533Z\" transform=\"translate(31.022 1.222) rotate(135.081)\" fill=\"#1490df\" /></g><path d=\"M8.459,9.9H4.87a.193.193,0,0,1-.2-.181.166.166,0,0,1,.018-.075L8.991,1.13a.206.206,0,0,1,.186-.106h4.245a.193.193,0,0,1,.2.181.165.165,0,0,1-.035.1L8.534,7.966h4.928a.193.193,0,0,1,.2.181.176.176,0,0,1-.052.122L5.421,16.788c-.077.046-.624.5-.356-.189h0Z\" fill=\"url(#b403aca7-f387-4434-96b4-ae157edc835f)\" /></svg>";

const PRESENTATION_ATTRIBUTES = /* @__PURE__ */ new Set([
  "fill",
  "fill-rule",
  "fill-opacity",
  "stroke",
  "stroke-width",
  "stroke-linecap",
  "stroke-linejoin",
  "stroke-miterlimit",
  "stroke-opacity",
  "clip-rule",
  "opacity",
  "color",
  "style",
  "preserveAspectRatio"
]);
function parseRawSvg(raw) {
  const outer = raw.match(/<svg\b([^>]*)>/i)?.[1];
  const viewBox = raw.match(/viewBox="([^"]+)"/i)?.[1];
  const inner = raw.match(/<svg\b[^>]*>([\s\S]*?)<\/svg>/i)?.[1]?.trim();
  if (!outer || !viewBox || !inner) {
    throw new Error("Invalid raw SVG asset");
  }
  const attributes = Array.from(
    outer.matchAll(/([:\w-]+)="([^"]*)"/g),
    ([, name, value]) => ({ name, value })
  ).filter(({ name }) => PRESENTATION_ATTRIBUTES.has(name)).map(({ name, value }) => `${name}="${value}"`).join(" ");
  return { viewBox, attributes, content: inner };
}
const ICONS = {
  actor: parseRawSvg(ActorSvg),
  database: parseRawSvg(DatabaseSvg),
  ec2: parseRawSvg(Ec2Svg),
  lambda: parseRawSvg(LambdaSvg),
  azurefunction: parseRawSvg(AzureFunctionSvg),
  sqs: parseRawSvg(SqsSvg),
  sns: parseRawSvg(SnsSvg),
  iam: parseRawSvg(IamSvg),
  boundary: parseRawSvg(BoundarySvg),
  control: parseRawSvg(ControlSvg),
  entity: parseRawSvg(EntitySvg)
};
function getIcon(type) {
  if (!type) return void 0;
  const key = type.toLowerCase();
  return ICONS[key];
}

function esc(s) {
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
}
function styleToAttr(style) {
  return Object.entries(style).map(([k, v]) => `${esc(k)}: ${esc(v)}`).join("; ");
}

const STROKE_WIDTH$1 = 2;
const HALF_STROKE$1 = STROKE_WIDTH$1 / 2;
const ICON_SIZE = 24;
const ICON_MARGIN_RIGHT = 4;
const ICON_PAINT_OFFSET_X = 4;
const LABEL_PAD_LEFT = 8;
const LABEL_HORIZONTAL_PADDING = 16;
const STEREOTYPE_VERTICAL_OFFSET = 8;
const STEREOTYPE_FONT_SIZE = 16;
const BOUNDARY_ICON_VERTICAL_TWEAK = 2.75;
const PARTICIPANT_TEXT_FILL = "#222";
function renderParticipant(p) {
  if (p.isStarter) return renderStarterParticipant(p);
  const rx = 3;
  const x = p.x - p.width / 2 + HALF_STROKE$1;
  const rectY = p.y + HALF_STROKE$1;
  const rectW = p.width - STROKE_WIDTH$1;
  const rectH = p.height - STROKE_WIDTH$1;
  const EMOJI_FONT_ATTRS = `font-family="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji','Twemoji Mozilla',sans-serif"`;
  const icon = getIcon(p.type);
  let iconSvg = "";
  let emojiIconSvg = "";
  let textX = p.x;
  let textAnchor = "middle";
  const textY = p.y + p.height / 2 - 0.25;
  const labelY = p.stereotype ? textY + STEREOTYPE_VERTICAL_OFFSET : textY;
  if (icon) {
    const textWidth = p.labelWidth ?? 0;
    const emojiExtra = p.emoji ? PARTICIPANT_EMOJI_WIDTH : 0;
    const groupWidth = ICON_SIZE + ICON_MARGIN_RIGHT + LABEL_HORIZONTAL_PADDING + textWidth + emojiExtra;
    const groupX = p.x - groupWidth / 2;
    const iconX = groupX + ICON_PAINT_OFFSET_X;
    const iconType = p.type?.toLowerCase();
    const iconY = p.y + (p.height - ICON_SIZE) / 2 + (iconType === "boundary" ? BOUNDARY_ICON_VERTICAL_TWEAK : 0);
    if (p.emoji) {
      const emojiTextX = iconX + ICON_SIZE + ICON_MARGIN_RIGHT;
      textX = emojiTextX + PARTICIPANT_EMOJI_WIDTH + 4;
      emojiIconSvg = `<text x="${emojiTextX}" y="${labelY}" dominant-baseline="central" ${EMOJI_FONT_ATTRS} class="participant-emoji">${esc(getEmojiUnicode(p.emoji))}</text>`;
    } else {
      textX = groupX + ICON_SIZE + ICON_MARGIN_RIGHT + LABEL_PAD_LEFT;
    }
    textAnchor = "start";
    const [, , vbW, vbH] = (icon.viewBox || "0 0 24 24").split(" ").map(Number);
    const scale = ICON_SIZE / Math.max(vbW, vbH);
    const iconAttrs = icon.attributes ? ` ${icon.attributes}` : "";
    iconSvg = `<g class="participant-icon" transform="translate(${iconX}, ${iconY}) scale(${scale})"${iconAttrs}>
    ${icon.content}
  </g>`;
  } else if (p.emoji) {
    const textWidth = p.labelWidth ?? 0;
    const groupWidth = PARTICIPANT_EMOJI_WIDTH + 8 + textWidth;
    const innerColWidth = Math.max(groupWidth, p.stereotypeWidth ?? 0);
    const groupX = p.x - innerColWidth / 2;
    const emojiTextX = groupX;
    textX = groupX + PARTICIPANT_EMOJI_WIDTH + 4;
    textAnchor = "start";
    emojiIconSvg = `<text x="${emojiTextX}" y="${labelY}" dominant-baseline="central" ${EMOJI_FONT_ATTRS} class="participant-emoji">${esc(getEmojiUnicode(p.emoji))}</text>`;
  }
  let stereotypeSvg = "";
  if (p.stereotype) {
    const stereoX = icon && p.labelWidth != null ? textX + p.labelWidth / 2 : p.x;
    const stereoAnchor = "middle";
    const stereoY = textY - STEREOTYPE_VERTICAL_OFFSET;
    stereotypeSvg = `<text x="${stereoX}" y="${stereoY}" text-anchor="${stereoAnchor}" dominant-baseline="central" class="stereotype-label" font-size="${STEREOTYPE_FONT_SIZE}"${participantTextStyle()}>${esc("«" + p.stereotype + "»")}</text>`;
  }
  const useTextLength = p.labelWidth != null && p.name.includes(":");
  const textLengthAttr = useTextLength ? ` textLength="${p.labelWidth}" lengthAdjust="spacing"` : "";
  const { fillStyle, textStyle } = colorAttrs(p.color);
  const emojiTspan = "";
  return `<g class="participant" data-participant="${esc(p.name)}">
  <rect x="${x}" y="${rectY}" width="${rectW}" height="${rectH}" rx="${rx}" class="participant-box"${fillStyle}/>
  ${iconSvg}
  ${emojiIconSvg}
  ${stereotypeSvg}
  <text x="${textX}" y="${labelY}" text-anchor="${textAnchor}" dominant-baseline="central" class="participant-label"${textLengthAttr}${textStyle}>${emojiTspan}${esc(p.label)}</text>
</g>`;
}
function renderStarterParticipant(p) {
  const icon = getIcon("actor");
  if (!icon) {
    return "";
  }
  const rx = 3;
  const boxX = p.x - p.width / 2 + HALF_STROKE$1;
  const rectY = p.y + HALF_STROKE$1;
  const rectW = p.width - STROKE_WIDTH$1;
  const rectH = p.height - STROKE_WIDTH$1;
  const iconX = p.x - ICON_SIZE / 2 - 2;
  const iconY = p.y + (p.height - ICON_SIZE) / 2;
  const [, , vbW, vbH] = (icon.viewBox || "0 0 24 24").split(" ").map(Number);
  const scale = ICON_SIZE / Math.max(vbW, vbH);
  const iconAttrs = icon.attributes ? ` ${icon.attributes}` : "";
  return `<g class="participant participant-starter" data-participant="${esc(p.name)}">
  <rect x="${boxX}" y="${rectY}" width="${rectW}" height="${rectH}" rx="${rx}" class="participant-box"/>
  <g class="participant-icon" transform="translate(${iconX}, ${iconY}) scale(${scale})"${iconAttrs}>
    ${icon.content}
  </g>
</g>`;
}
function normalizeHexColor(color) {
  const c = color.startsWith("#") ? color : `#${color}`;
  return c;
}
function colorAttrs(color) {
  if (!color) {
    return { fillStyle: "", textStyle: "" };
  }
  const hex = normalizeHexColor(color);
  return {
    fillStyle: ` style="fill:${hex};"`,
    textStyle: participantTextStyle()
  };
}
function participantTextStyle() {
  return ` style="fill:${PARTICIPANT_TEXT_FILL};"`;
}

function renderLifeline(l) {
  const x = l.x + 0.5;
  return `<line x1="${x}" y1="${l.topY}" x2="${x}" y2="${l.bottomY}" class="lifeline" stroke-dasharray="${l.dashed ? "5,5" : "none"}" stroke-dashoffset="${l.dashed ? "5" : "0"}" shape-rendering="crispEdges"/>`;
}

function renderMessage(m) {
  const isLTR = m.fromX < m.toX;
  const fromX = isLTR ? m.fromX + 1 : m.fromX;
  const toX = isLTR ? m.toX : m.toX + 1;
  const direction = Math.sign(m.toX - m.fromX);
  const labelX = (m.fromX + m.toX) / 2 - direction * 3.5 + 0.5;
  const labelY = m.y - 3.5;
  const dashAttr = m.arrowStyle === "dashed" ? ' stroke-dasharray="6,4"' : "";
  const styleAttr = m.style ? ` style="${styleToAttr(m.style)}"` : "";
  const numberX = Math.min(fromX, toX) - 4;
  const numberSvg = m.number ? `<text x="${numberX}" y="${labelY}" text-anchor="end" class="seq-number">${esc(m.number)}</text>` : "";
  const lineY = m.y - 0.5;
  return `<g class="message">
  <line x1="${fromX}" y1="${lineY}" x2="${toX}" y2="${lineY}" class="message-line"${dashAttr}/>
  ${renderArrowHead(toX, lineY, m.isReverse, m.arrowStyle)}
  <text x="${labelX}" y="${labelY}" text-anchor="middle" class="message-label"${styleAttr}>${esc(resolveEmojiInText(m.label))}</text>
  ${numberSvg}
</g>`;
}
function renderSelfCall(s) {
  const x1 = s.x;
  const isAsync = s.arrowStyle === "open";
  const labelX = x1 + 6;
  const labelY = s.y + (isAsync ? 15 : 12);
  const numberY = s.y + 12;
  const numberSvg = s.number ? `<text x="${x1 - 3}" y="${numberY}" text-anchor="end" class="seq-number">${esc(s.number)}</text>` : "";
  const svgX = x1 + 1;
  const svgY = s.y + (isAsync ? 20 : 14);
  const pathEnd = isAsync ? "L1,15" : "L14,15";
  const arrowTx = isAsync ? 0 : 7;
  const arrowFill = isAsync ? "none" : "#000";
  const arrowPath = isAsync ? "M1 1.25 L6.15 4.5 L1 7.75" : "M1 1.25 L6.15 4.5 L1 7.75 Z";
  return `<g class="message self-call">
  <svg x="${svgX}" y="${svgY}" width="30" height="24">
    <path d="M0,2 L26,2 Q28,2 28,4 L28,13 Q28,15 26,15 ${pathEnd}" fill="none" stroke="#000" stroke-width="2"/>
    <g transform="translate(${arrowTx}, 10)">
      <svg height="10" width="7" viewBox="0 0 7 9">
        <g transform="scale(-1, 1) translate(-7, 0)">
          <path d="${arrowPath}" stroke="#000" stroke-linecap="round" fill="${arrowFill}" stroke-width="2"/>
        </g>
      </svg>
    </g>
  </svg>
  <text x="${labelX}" y="${labelY}" text-anchor="start" class="message-label"${s.style ? ` style="${styleToAttr(s.style)}"` : ""}>${esc(resolveEmojiInText(s.label.trim()))}</text>
  ${numberSvg}
</g>`;
}
function renderArrowHead(tipX, tipY, pointsLeft, style) {
  const isFilled = style !== "open" && style !== "dashed";
  const pathD = isFilled ? "M1 1.25 L6.15 4.5 L1 7.75 Z" : "M1 1.25 L6.15 4.5 L1 7.75";
  const fillAttr = isFilled ? "#000" : "none";
  const svgX = pointsLeft ? tipX : tipX - 7;
  const svgY = tipY - 5;
  const rtlTransform = pointsLeft ? ' transform="scale(-1, 1) translate(-7, 0)"' : "";
  return `<svg x="${svgX}" y="${svgY}" width="7" height="10" viewBox="0 0 7 9" overflow="visible" class="arrow-head${isFilled ? "" : " arrow-open"}">
    <g${rtlTransform}>
      <path d="${pathD}" stroke="#000" stroke-linecap="round" stroke-width="2" fill="${fillAttr}"/>
    </g>
  </svg>`;
}

function renderOccurrence(o) {
  const strokeHalf = 1;
  const rx = o.x + strokeHalf;
  return `<rect x="${rx}" y="${o.y + strokeHalf}" width="${o.width - strokeHalf * 2}" height="${o.height - strokeHalf * 2}" rx="1" class="occurrence" data-participant="${esc(o.participantName)}"/>`;
}

const HEADER_HEIGHT = 25;
const BRACKET_WIDTH = 3.89;
const TEXT_PAD_X = 4;
const STROKE_WIDTH = 1;
const HALF_STROKE = STROKE_WIDTH / 2;
function renderFragment(f) {
  const parts = [];
  parts.push(
    `<rect x="${f.x + HALF_STROKE}" y="${f.y + HALF_STROKE}" width="${f.width - STROKE_WIDTH}" height="${f.height - STROKE_WIDTH}" rx="4" class="fragment-border"/>`
  );
  const headerX = f.x + 1;
  const headerY = f.headerY;
  const headerW = f.width - 2;
  parts.push(
    `<rect x="${headerX}" y="${headerY}" width="${headerW}" height="${HEADER_HEIGHT}" class="fragment-header"/>`
  );
  const iconX = headerX + 4;
  const iconY = headerY;
  parts.push(getFragmentIcon(f.kind, iconX, iconY));
  const kindLabel = getKindLabel(f.kind);
  const labelX = headerX + 26;
  parts.push(
    `<text x="${labelX}" y="${headerY + HEADER_HEIGHT / 2 - 0.5}" dominant-baseline="central" class="fragment-label">${esc(kindLabel)}</text>`
  );
  if (f.number) {
    parts.push(
      `<text x="${f.x - 3}" y="${headerY + HEADER_HEIGHT / 2 - 4.5}" text-anchor="end" dominant-baseline="central" class="seq-number">${esc(f.number)}</text>`
    );
  }
  if (f.label) {
    const condY = headerY + HEADER_HEIGHT + 15;
    parts.push(renderBracketedLabel(headerX, condY, f.label, f.labelWidth, "fragment-condition"));
  }
  if (f.sections.length > 1) {
    for (let i = 1; i < f.sections.length; i++) {
      const section = f.sections[i];
      const lineY = section.y;
      const separatorY = lineY + HALF_STROKE;
      const sepX1 = f.x + 1 + (section.contentInsetLeft ?? 0);
      const sepX2 = f.x + f.width - 1;
      parts.push(
        `<line x1="${sepX1}" y1="${separatorY}" x2="${sepX2}" y2="${separatorY}" class="fragment-separator"/>`
      );
      if (section.label) {
        const labelY = lineY + 16;
        const isFinally = section.label.startsWith("finally");
        const isBracketed = !!section.innerLabel && section.label !== "[else]";
        if (isBracketed) {
          const labelX2 = f.x + 1;
          parts.push(
            renderBracketedLabel(labelX2, labelY, section.innerLabel, section.innerLabelWidth, "fragment-section-label")
          );
          continue;
        }
        const spaceIdx = section.label.indexOf(" ");
        if (spaceIdx > 0 && !isFinally) {
          const keyword = section.keyword || section.label.substring(0, spaceIdx);
          const condition = section.detail || section.label.substring(spaceIdx + 1);
          const keywordWidth = section.keywordWidth ?? keyword.length * 7;
          const keywordX = f.x + 5;
          const conditionX = keywordX + keywordWidth + TEXT_PAD_X * 2;
          const bgWidth = (section.keywordWidth ?? keyword.length * 7) + (section.detailWidth ?? condition.length * 7) + TEXT_PAD_X * 4;
          parts.push(
            `<g opacity="0.65"><rect x="${keywordX - TEXT_PAD_X}" y="${lineY + 1}" width="${bgWidth}" height="20" fill="#fff"/><text x="${keywordX}" y="${labelY}" class="fragment-section-label" fill="#222">${esc(keyword)}</text><text x="${conditionX}" y="${labelY}" class="fragment-section-label" fill="#222">${esc(condition)}</text></g>`
          );
        } else {
          const finallyX = f.x + 5;
          const finallyY = labelY;
          if (section.label === "[else]") {
            parts.push(
              `<text x="${finallyX}" y="${finallyY}" class="fragment-section-label">${esc(section.label)}</text>`
            );
            continue;
          }
          const bgWidth = (section.labelWidth ?? section.label.length * 7) + TEXT_PAD_X * 2;
          const bgY = lineY + 1;
          const bgHeight = 20;
          parts.push(
            `<g opacity="0.65"><rect x="${finallyX - TEXT_PAD_X}" y="${bgY}" width="${bgWidth}" height="${bgHeight}" fill="#fff"/><text x="${finallyX}" y="${finallyY}" class="fragment-section-label">${esc(section.label)}</text></g>`
          );
        }
      }
    }
  }
  return `<g class="fragment fragment-${f.kind}">
  ${parts.join("\n  ")}
</g>`;
}
function renderBracketedLabel(x, y, innerText, innerWidth, cls = "fragment-condition") {
  const measuredInnerWidth = innerWidth ?? innerText.length * 7;
  const innerX = x + BRACKET_WIDTH + TEXT_PAD_X;
  const closeX = innerX + measuredInnerWidth + TEXT_PAD_X;
  return `<g><text x="${x}" y="${y}" class="${cls}">[</text><text x="${innerX}" y="${y}" class="${cls}" opacity="0.65">${esc(resolveEmojiInText(innerText))}</text><text x="${closeX}" y="${y}" class="${cls}">]</text></g>`;
}
function getKindLabel(kind) {
  switch (kind) {
    case "alt":
      return "Alt";
    case "loop":
      return "Loop";
    case "opt":
      return "Opt";
    case "par":
      return "Par";
    case "critical":
      return "Critical";
    case "section":
      return "Section";
    case "tcf":
      return "Try";
    case "ref":
      return "Ref";
    default:
      return kind.charAt(0).toUpperCase() + kind.slice(1);
  }
}
function getFragmentIcon(kind, x, y) {
  const w = 20;
  const h = 24;
  switch (kind) {
    case "loop":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 1024 1024" fill="#000" stroke="none">
      <path d="M960 101.84l-896.002.002c-35.344 0-64 28.656-64 64v576c0 35.36 28.656 64 64 64h160c20.496 0 32-26.32 32-31.984v-.016c0-5.824-10.88-32.416-32-32.416h-120.96c-21.376 0-38.72-17.344-38.72-38.72V206.002c0-21.391 17.328-38.72 38.72-38.72l818.272-1.007c21.376 0 38.72 17.328 38.72 38.72V702.69c0 21.376-17.344 38.72-38.72 38.72H518.142l75.984-68.912c9.344-8.944 12.369-23.408 3.025-32.336l-5.472-8.064c-9.376-8.945-24.496-8.945-33.84 0L428.111 750.53c-.192.16-.368.224-.528.368l-8.48 8.096c-4.672 4.431-7.008 10.335-6.976 16.223-.032 5.904 2.288 11.777 6.977 16.288l8.48 8.096c.16.16.368.192.528.336L555.84 915.44c9.344 8.944 24.464 8.944 33.84 0l5.472-8.065c9.344-8.944 6.32-23.44-3.025-32.368l-77.135-69.168H960c35.343 0 64-28.64 64-64v-576c0-35.344-28.657-64-64-64z"/>
    </svg>`;
    case "opt":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 24 24" fill="none">
      <circle cx="12" cy="12" r="7" stroke="#000" stroke-width="1.5" stroke-dasharray="3 2" stroke-linecap="round"/>
    </svg>`;
    case "par":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 24 24" fill="none">
      <path d="M5 10H19" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
      <path d="M5 14H19" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>`;
    case "critical":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 24 24" fill="none">
      <path d="M12 5L19 12L12 19L5 12L12 5Z" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
      <path d="M12 9V13" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
      <path d="M12 15V15.5" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>`;
    case "tcf":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 76 76" fill="#000" stroke="none">
      <path d="M 26,22.0001L 27,21.9998L 27,27L 26.0001,27.0003C 23.2386,27.0003 21.0001,29.2389 21.0001,32.0003L 21,46.0002C 21,48.7616 23.2386,51.0002 25.9999,51.0002L 27,51.0002L 27,47L 33.75,53.5L 27,60L 27,56L 26,56C 20.4771,56 16,51.5229 16,46L 16,32.0001C 16,26.4773 20.4771,22.0001 26,22.0001 Z M 33,27L 59,27L 59,32L 33,32L 33,27 Z M 36,35L 59,35L 59,40L 36,40L 36,35 Z M 33,43L 59,43L 59,48L 33,48L 33,43 Z"/>
    </svg>`;
    case "ref":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 24 24" fill="none">
      <path d="M10 6H18C19.1046 6 20 6.89543 20 8V16C20 17.1046 19.1046 18 18 18H10" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
      <path d="M10 6L6 12L10 18" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>`;
    case "section":
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 15 15" fill="#000" stroke="none">
      <path fill-rule="evenodd" clip-rule="evenodd" d="M2 1.5C2 1.77614 1.77614 2 1.5 2C1.22386 2 1 1.77614 1 1.5C1 1.22386 1.22386 1 1.5 1C1.77614 1 2 1.22386 2 1.5ZM2 5L2 10H13V5H2ZM2 4C1.44772 4 1 4.44772 1 5V10C1 10.5523 1.44772 11 2 11H13C13.5523 11 14 10.5523 14 10V5C14 4.44772 13.5523 4 13 4H2ZM1.5 14C1.77614 14 2 13.7761 2 13.5C2 13.2239 1.77614 13 1.5 13C1.22386 13 1 13.2239 1 13.5C1 13.7761 1.22386 14 1.5 14ZM4 1.5C4 1.77614 3.77614 2 3.5 2C3.22386 2 3 1.77614 3 1.5C3 1.22386 3.22386 1 3.5 1C3.77614 1 4 1.22386 4 1.5ZM3.5 14C3.77614 14 4 13.7761 4 13.5C4 13.2239 3.77614 13 3.5 13C3.22386 13 3 13.2239 3 13.5C3 13.7761 3.22386 14 3.5 14ZM6 1.5C6 1.77614 5.77614 2 5.5 2C5.22386 2 5 1.77614 5 1.5C5 1.22386 5.22386 1 5.5 1C5.77614 1 6 1.22386 6 1.5ZM5.5 14C5.77614 14 6 13.7761 6 13.5C6 13.2239 5.77614 13 5.5 13C5.22386 13 5 13.2239 5 13.5C5 13.7761 5.22386 14 5.5 14ZM8 1.5C8 1.77614 7.77614 2 7.5 2C7.22386 2 7 1.77614 7 1.5C7 1.22386 7.22386 1 7.5 1C7.77614 1 8 1.22386 8 1.5ZM7.5 14C7.77614 14 8 13.7761 8 13.5C8 13.2239 7.77614 13 7.5 13C7.22386 13 7 13.2239 7 13.5C7 13.7761 7.22386 14 7.5 14ZM10 1.5C10 1.77614 9.77614 2 9.5 2C9.22386 2 9 1.77614 9 1.5C9 1.22386 9.22386 1 9.5 1C9.77614 1 10 1.22386 10 1.5ZM9.5 14C9.77614 14 10 13.7761 10 13.5C10 13.2239 9.77614 13 9.5 13C9.22386 13 9 13.2239 9 13.5C9 13.7761 9.22386 14 9.5 14ZM12 1.5C12 1.77614 11.7761 2 11.5 2C11.2239 2 11 1.77614 11 1.5C11 1.22386 11.2239 1 11.5 1C11.7761 1 12 1.22386 12 1.5ZM11.5 14C11.7761 14 12 13.7761 12 13.5C12 13.2239 11.7761 13 11.5 13C11.2239 13 11 13.2239 11 13.5C11 13.7761 11.2239 14 11.5 14ZM14 1.5C14 1.77614 13.7761 2 13.5 2C13.2239 2 13 1.77614 13 1.5C13 1.22386 13.2239 1 13.5 1C13.7761 1 14 1.22386 14 1.5ZM13.5 14C13.7761 14 14 13.7761 14 13.5C14 13.2239 13.7761 13 13.5 13C13.2239 13 13 13.2239 13 13.5C13 13.7761 13.2239 14 13.5 14Z"/>
    </svg>`;
    case "alt":
    default:
      return `<svg x="${x}" y="${y}" width="${w}" height="${h}" viewBox="0 0 24 24" fill="none">
      <path d="M12 8L20 12L12 16L4 12L12 8Z" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>`;
  }
}

function renderCreation(c) {
  const m = c.message;
  const p = c.participant;
  const isRTL = m.toX < m.fromX;
  const adjustedToX = isRTL ? p.x + p.width / 2 : p.x - p.width / 2;
  const fromX = isRTL ? m.fromX : m.fromX + 1;
  const toX = isRTL ? adjustedToX : adjustedToX;
  const labelX = fromX + (toX - fromX) / 2 + (isRTL ? 3.5 : -3);
  const labelY = m.y - 3;
  const styleAttr = m.style ? ` style="${styleToAttr(m.style)}"` : "";
  const numberX = Math.min(fromX, toX) - 4;
  const numberSvg = m.number ? `<text x="${numberX}" y="${labelY}" text-anchor="end" class="seq-number">${esc(m.number)}</text>` : "";
  const labelContent = renderGuillemets(m.label, styleAttr);
  return `<g class="creation">
  <line x1="${fromX}" y1="${m.y}" x2="${toX}" y2="${m.y}" class="message-line" stroke-dasharray="6,4"/>
  ${renderOpenArrow(toX, m.y, isRTL)}
  <text x="${labelX}" y="${labelY}" text-anchor="middle" class="message-label">${labelContent}</text>
  ${numberSvg}
</g>`;
}
function renderGuillemets(label, styleAttr) {
  const match = label.match(/^«(.+)»$/);
  if (match) {
    const inner = match[1];
    if (inner === "create") {
      return `<tspan${styleAttr}>${esc(label)}</tspan>`;
    }
    return `<tspan${styleAttr}>${esc("«")}</tspan><tspan dx="4"${styleAttr}>${esc(inner)}</tspan><tspan dx="4"${styleAttr}>${esc("»")}</tspan>`;
  }
  return `<tspan${styleAttr}>${esc(label)}</tspan>`;
}
function renderOpenArrow(tipX, tipY, pointsLeft) {
  const w = 5.15;
  const halfH = 3.25;
  const dir = pointsLeft ? 1 : -1;
  const x1 = tipX + dir * w;
  const y1 = tipY - halfH;
  const y2 = tipY + halfH;
  return `<polyline points="${x1},${y1} ${tipX},${tipY} ${x1},${y2}" fill="none" stroke-linecap="round" class="arrow-head arrow-open"/>`;
}

function renderReturn(r) {
  if (r.isSelf) {
    return renderSelfReturn(r);
  }
  const minX = Math.min(r.fromX, r.toX);
  const ARROW_PADDING_HALF = 3.5;
  const labelX = minX + Math.abs(r.toX - r.fromX) / 2 + (r.isReverse ? ARROW_PADDING_HALF : -ARROW_PADDING_HALF);
  const lineY = Math.floor(r.y);
  const labelY = lineY - 3;
  const arrowTipX = r.toX;
  const w = 5.15;
  const halfH = 3.25;
  const dir = r.isReverse ? -1 : 1;
  const ax1 = arrowTipX - dir * w;
  const ay1 = lineY - halfH;
  const ay2 = lineY + halfH;
  const numberX = Math.min(r.fromX, r.toX) - 4;
  const numberSvg = r.number ? `<text x="${numberX}" y="${labelY}" text-anchor="end" class="seq-number">${esc(r.number)}</text>` : "";
  return `<g class="return">
  <line x1="${r.fromX}" y1="${lineY}" x2="${r.toX}" y2="${lineY}" class="return-line"/>
  <polyline points="${ax1},${ay1} ${arrowTipX},${lineY} ${ax1},${ay2}" fill="none" stroke-linecap="round" class="return-arrow"/>
  <text x="${labelX}" y="${labelY}" text-anchor="middle" class="return-label">${esc(resolveEmojiInText(r.label))}</text>
  ${numberSvg}
</g>`;
}
function renderSelfReturn(r) {
  const iconSize = 12;
  const iconMargin = 4;
  const iconX = r.fromX + iconMargin;
  const iconY = r.y - 12;
  const labelX = iconX + iconSize + iconMargin;
  const labelY = r.y - 1;
  return `<g class="return return-self">
  <g transform="translate(${iconX},${iconY}) scale(${iconSize / 512})">
    <path d="M256 0C114.84 0 0 114.84 0 256s114.84 256 256 256 256-114.84 256-256S397.16 0 256 0Zm0 469.33c-117.63 0-213.33-95.7-213.33-213.33S138.37 42.67 256 42.67 469.33 138.37 469.33 256 373.63 469.33 256 469.33Z" class="return-icon"/>
    <path d="M288 192h-87.16l27.58-27.58a21.33 21.33 0 1 0-30.17-30.17l-64 64a21.33 21.33 0 0 0 0 30.17l64 64a21.33 21.33 0 0 0 30.17-30.17l-27.58-27.58H288a53.33 53.33 0 0 1 0 106.67h-32a21.33 21.33 0 0 0 0 42.66h32a96 96 0 0 0 0-192Z" class="return-icon"/>
  </g>
  <text x="${labelX}" y="${labelY}" text-anchor="start" class="return-label">${esc(resolveEmojiInText(r.label))}</text>
</g>`;
}

const PAD_X = 8;
const BOX_HEIGHT = 28;
function renderDivider(d) {
  const rawLabel = d.label.replace(/^=+\s*|\s*=+$/g, "").trim();
  const label = resolveEmojiInText(rawLabel);
  const centerX = d.width / 2;
  const textWidth = d.labelWidth ?? label.length * 8;
  const borderWidth = 1;
  const totalWidth = textWidth + PAD_X * 2 + borderWidth * 2;
  const innerWidth = totalWidth - borderWidth;
  const innerHeight = BOX_HEIGHT - borderWidth;
  const boxX = centerX - innerWidth / 2;
  const boxY = d.y - innerHeight / 2;
  const outerLeft = boxX - borderWidth / 2;
  const outerRight = boxX + innerWidth + borderWidth / 2;
  const textY = d.y;
  return `<g class="divider">
  <line x1="0" y1="${d.y}" x2="${outerLeft}" y2="${d.y}" class="divider-line"/>
  <line x1="${outerRight}" y1="${d.y}" x2="${d.width}" y2="${d.y}" class="divider-line"/>
  <rect x="${boxX}" y="${boxY}" width="${innerWidth}" height="${innerHeight}" rx="2" class="divider-bg"/>
  <text x="${centerX}" y="${textY}" text-anchor="middle" dominant-baseline="central" class="divider-label">${esc(label)}</text>
</g>`;
}

function markdownToSvgLines(text) {
  const tokens = marked.lexer(text, { gfm: true, breaks: true });
  return collectLines(tokens);
}
function collectLines(tokens) {
  const lines = [[]];
  const pushFragment = (fragment) => {
    if (fragment) {
      lines[lines.length - 1].push(fragment);
    }
  };
  const pushLineBreak = () => {
    lines.push([]);
  };
  const walkTokens = (tokenList) => {
    tokenList.forEach((token, index) => {
      walkToken(token);
      if (index < tokenList.length - 1 && (token.type === "paragraph" || token.type === "code")) {
        pushLineBreak();
      }
    });
  };
  const walkToken = (token) => {
    switch (token.type) {
      case "paragraph":
        walkTokens(token.tokens || []);
        return;
      case "code": {
        const codeLines = token.text.split("\n");
        codeLines.forEach((line, index) => {
          if (index > 0) {
            pushLineBreak();
          }
          pushFragment(`<tspan font-family="monospace">${esc(line)}</tspan>`);
        });
        return;
      }
      case "codespan":
        pushFragment(esc(token.text));
        return;
      case "strong":
        pushFragment(`<tspan font-weight="bold">${collectLines(token.tokens || []).join("")}</tspan>`);
        return;
      case "em":
        pushFragment(`<tspan font-style="italic">${collectLines(token.tokens || []).join("")}</tspan>`);
        return;
      case "text":
        if ("tokens" in token && token.tokens) {
          walkTokens(token.tokens);
          return;
        }
        pushFragment(esc(token.raw));
        return;
      case "br":
        pushLineBreak();
        return;
      case "space":
        return;
      default:
        pushFragment(esc(token.raw || ""));
    }
  };
  walkTokens(tokens);
  return lines.map((line) => line.join(""));
}
function renderComment(c) {
  const styleAttr = c.style ? ` style="${styleToAttr(c.style)}"` : "";
  const lines = markdownToSvgLines(c.text);
  const tspans = lines.map(
    (line, index) => index === 0 ? `<tspan x="${c.x}" y="${c.y}">${line || " "}</tspan>` : `<tspan x="${c.x}" dy="20">${line || " "}</tspan>`
  ).join("");
  return `<text class="comment-text"${styleAttr}>${tspans}</text>`;
}

function renderGroup(g) {
  const titleBarHeight = 18;
  const sw = 1;
  const sw2 = sw / 2;
  const rectX = g.x - sw2;
  const rectY = g.y - sw - 1;
  const rectW = g.width + sw;
  const rectH = g.height + sw + 0.5;
  const titleY = g.y + titleBarHeight / 2 + 1;
  const titleText = g.name ? esc(g.name) : "";
  const tbX = g.x + sw2;
  const tbY = rectY + sw2;
  const tbWidth = g.width - sw;
  const tbHeight = titleBarHeight + 1 + sw2;
  return `<g class="participant-group">
  <rect x="${rectX}" y="${rectY}" width="${rectW}" height="${rectH}" class="group-outline" stroke-width="${sw}" stroke-dasharray="4 3"/>
  ${titleText ? `<rect x="${tbX}" y="${tbY}" width="${tbWidth}" height="${tbHeight}" class="group-title-bg"/>` : ""}
  ${titleText ? `<text x="${g.x + g.width / 2}" y="${titleY}" text-anchor="middle" dominant-baseline="middle" class="group-title-text">${titleText}</text>` : ""}
</g>`;
}

const FRAME_HEADER_HEIGHT = 28;
const FRAME_BORDER_RADIUS = 4;
const DEFAULT_THEME_STYLES = `
  .frame-border-outer { fill: #666; }
  .frame-border-inner { fill: #ffffff; }
  .frame-header-bg { fill: #ffffff; }
  .frame-header-line { stroke: #666; stroke-width: 1; shape-rendering: crispEdges; }
  .frame-title { font-family: Helvetica, Verdana, serif; font-size: 16px; font-weight: 600; fill: #222; }
  .participant-box { fill: #ffffff; stroke: #666; stroke-width: 2; }
  .participant-label { font-family: Helvetica, Verdana, serif; font-size: 16px; fill: #222; }
  .participant-icon { color: #222; }
  .participant-icon [fill="currentColor"]:not([stroke]) { stroke: #666; stroke-width: 1; }
  .lifeline { stroke: #666; stroke-width: 1; }
  .message-line { stroke: #000; stroke-width: 2; shape-rendering: crispEdges; }
  .message-label { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #222; }
  .arrow-head { fill: #000; stroke: #000; stroke-width: 2; }
  .arrow-open { fill: none; }
  .occurrence { fill: #dedede; stroke: #666; stroke-width: 2; shape-rendering: crispEdges; }
  .fragment-border { fill: none; stroke: #666; stroke-width: 1; shape-rendering: crispEdges; }
  .fragment-header { fill: #dedede; fill-opacity: 0.498; stroke: none; shape-rendering: crispEdges; }
  .fragment-label { font-family: Helvetica, Verdana, serif; font-size: 14px; font-weight: 600; fill: #000; }
  .fragment-condition { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #000; }
  .fragment-separator { stroke: #e5e7eb; stroke-width: 1; shape-rendering: crispEdges; }
  .fragment-section-label { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #000; }
  .return-line { stroke: #000; stroke-width: 2; stroke-dasharray: 6,4; shape-rendering: crispEdges; }
  .return-arrow { stroke: #000; stroke-width: 2; fill: none; }
  .return-label { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #222; }
  .return-icon { fill: #222; }
  .divider-line { stroke: #aaaa33; stroke-width: 1; }
  .divider-bg { fill: #fff5ad; stroke: #aaaa33; stroke-width: 1; }
  .divider-label { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #333; }
  .comment-text { font-family: Helvetica, Verdana, serif; font-size: 14px; fill: #333; opacity: 0.5; }
  .seq-number { font-family: Helvetica, Verdana, serif; font-size: 12px; font-weight: 100; fill: #6b7280; }
  .group-outline { fill: none; stroke: #666; }
  .group-title-bg { fill: #ffffff; stroke: none; }
  .group-title-text { font-family: Helvetica, Verdana, serif; font-size: 13px; font-weight: 400; fill: #222; }
`;
function renderToSvg(code, options) {
  const rootContext = RootContext(code);
  if (!rootContext) {
    return { svg: "<svg></svg>", innerSvg: "", width: 0, height: 0, viewBox: "0 0 0 0", geometry: void 0 };
  }
  const coordinates = new Coordinates(rootContext, WidthProviderOnCanvas);
  const verticalCoordinates = new VerticalCoordinates(rootContext);
  const titleContext = rootContext.title?.();
  const rawTitle = titleContext && typeof titleContext.content === "function" ? titleContext.content() : void 0;
  const title = rawTitle ? resolveEmojiInText(rawTitle) : void 0;
  const geometry = buildGeometry({
    rootContext,
    coordinates,
    verticalCoordinates,
    title,
    measureText: WidthProviderOnCanvas
  });
  return { ...composeSvg(geometry), geometry };
}
function composeSvg(g, options) {
  const padding = 10;
  const headerH = FRAME_HEADER_HEIGHT;
  const contentLeftMargin = 1 + padding + g.frameBorderLeft;
  const viewWidth = g.width + contentLeftMargin + padding + g.frameBorderRight + 1;
  const viewHeight = g.height + padding * 2 + headerH - 1;
  const parts = [];
  for (const grp of g.groups) {
    parts.push(renderGroup(grp));
  }
  for (const l of g.lifelines) {
    parts.push(renderLifeline(l));
  }
  const creationNames = new Set(g.creations.map((c) => c.participant.name));
  for (const p of g.participants) {
    if (!creationNames.has(p.name)) {
      parts.push(renderParticipant(p));
    }
  }
  for (const o of g.occurrences) {
    parts.push(renderOccurrence(o));
  }
  for (const p of g.participants) {
    if (creationNames.has(p.name)) {
      parts.push(renderParticipant(p));
    }
  }
  for (const m of g.messages) {
    parts.push(renderMessage(m));
  }
  for (const s of g.selfCalls) {
    parts.push(renderSelfCall(s));
  }
  for (const c of g.creations) {
    parts.push(renderCreation(c));
  }
  for (const r2 of g.returns) {
    parts.push(renderReturn(r2));
  }
  for (const f of g.fragments) {
    parts.push(renderFragment(f));
  }
  for (const d of g.dividers) {
    parts.push(renderDivider(d));
  }
  for (const c of g.comments) {
    parts.push(renderComment(c));
  }
  const r = FRAME_BORDER_RADIUS;
  const frameSvg = [
    `<rect class="frame-border-outer" x="0" y="0" width="${viewWidth}" height="${viewHeight}" rx="${r}" fill="#666"/>`,
    `<rect class="frame-border-inner" x="1" y="1" width="${viewWidth - 2}" height="${viewHeight - 2}" rx="${Math.max(0, r - 1)}" fill="#fff"/>`
  ].join("\n");
  const contentPaddingTop = 6;
  const headerLineY = headerH + contentPaddingTop;
  const headerLineDrawY = headerLineY - 0.5;
  const headerLineSvg = `<line class="frame-header-line" x1="1" y1="${headerLineDrawY}" x2="${viewWidth - 1}" y2="${headerLineDrawY}"/>`;
  const titleSvg = g.title ? `<text x="5" y="${headerLineDrawY / 2}" dominant-baseline="central" class="frame-title">${escXml(g.title)}</text>` : "";
  const viewBox = `0 0 ${viewWidth} ${viewHeight}`;
  const defs = `<defs>
  <style>${DEFAULT_THEME_STYLES}</style>
</defs>`;
  const frame = `${frameSvg}
${headerLineSvg}
${titleSvg}`;
  const content = `<g transform="translate(${contentLeftMargin}, ${headerLineY})">
${parts.join("\n")}
</g>`;
  const innerSvg = `${defs}
${frame}
${content}`;
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewWidth}" height="${viewHeight}" viewBox="${viewBox}">
${innerSvg}
</svg>`;
  return { svg, innerSvg, width: viewWidth, height: viewHeight, viewBox };
}
function escXml(s) {
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
}

function readVersion() {
  const pkgPath = resolve(import.meta.dir, "../../package.json");
  try {
    const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
    return pkg.version ?? "unknown";
  } catch {
    return "unknown";
  }
}
function printHelp() {
  const help = `
Usage: zenuml [options]

Render ZenUML DSL text to SVG or PNG.

Rendering:
  -i, --input <file>           Input file (use "-" for stdin; repeatable)
  -o, --output <file>          Output file (use "-" for stdout; default: <input>.svg)
  -e, --outputFormat <format>  Output format: "svg" (default) or "png"
  -s, --scale <factor>         Pixel scale factor for PNG (default: 2; ignored for SVG)
  -t, --theme <name>           Theme name passed to renderer (e.g. "theme-default")
  -c, --configFile <file>      JSON config file with { theme, scale, outputFormat }
  --md                         Markdown mode: render zenuml code blocks and produce output Markdown

Validation:
  --check                      Validate syntax without rendering (exit 0 if valid, 1 if errors)
  --parse                      Parse input and output AST as JSON (exit 0 if valid, 1 if errors)
  --json                       Machine-readable JSON output for --check mode

Batch & Watch:
  -w, --watch                  Watch input files and re-render on change (incompatible with --check, --parse, stdin)

General:
  -q, --quiet                  Suppress non-error output
  -h, --help                   Show this help message
  -V, --version                Show version number

Config file values are overridden by CLI flags.
Rendering flags (-o, -e, -t, -s) are silently ignored in --check and --parse modes.

Examples:
  zenuml -i diagram.zenuml
  zenuml -i diagram.zenuml -o output.svg
  zenuml -i diagram.zenuml -o output.png
  zenuml -i diagram.zenuml -e png -s 3
  zenuml -i diagram.zenuml -c config.json
  cat diagram.zenuml | zenuml -i - -o -
  zenuml --check -i file1.zenuml -i file2.zenuml
  zenuml --check --json -i file1.zenuml -i file2.zenuml
  zenuml --parse -i diagram.zenuml
  zenuml -i readme.md --md
  zenuml -i readme.md --md -e png

PNG output requires the optional Playwright runtime and a Chromium browser:
  npm install playwright-core
  npx playwright-core install chromium

To use an existing Chrome/Chromium binary:
  ZENUML_CHROMIUM_PATH=/path/to/chrome zenuml -i diagram.zenuml -o output.png
`.trimStart();
  process.stdout.write(help);
}
function extractZenumlBlocks(md) {
  const results = [];
  const fencePattern = /^(`{3,})zenuml([^\n]*)\n([\s\S]*?)\n?\1\s*$/gm;
  let match;
  let blockIndex = 0;
  while ((match = fencePattern.exec(md)) !== null) {
    const raw = match[0];
    const infoExtra = match[2];
    const code = match[3];
    const title = infoExtra.trim();
    const empty = code.trim().length === 0;
    results.push({ index: blockIndex++, code, title, raw, empty });
  }
  return results;
}
function isGlobPattern(s) {
  return /[*?[]/.test(s);
}
function expandInputs(inputs) {
  const result = [];
  for (const input of inputs) {
    if (input === "-" || !isGlobPattern(input)) {
      result.push(input);
      continue;
    }
    const glob = new Bun.Glob(input);
    const matches = [];
    for (const match of glob.scanSync({
      cwd: process.cwd(),
      onlyFiles: true
    })) {
      matches.push(match);
    }
    if (matches.length === 0) {
      throw new Error(`Glob pattern "${input}" matched no files`);
    }
    matches.sort();
    result.push(...matches);
  }
  return result;
}
function isDirectory(p) {
  try {
    return statSync(p).isDirectory();
  } catch {
    return false;
  }
}
function parseArgs(argv) {
  const args = {
    inputs: [],
    check: false,
    parse: false,
    json: false,
    quiet: false,
    help: false,
    version: false,
    md: false,
    watch: false
  };
  let i = 0;
  while (i < argv.length) {
    const arg = argv[i];
    switch (arg) {
      case "-i":
      case "--input":
        i++;
        args.inputs.push(argv[i]);
        break;
      case "-o":
      case "--output":
        i++;
        args.output = argv[i];
        break;
      case "-e":
      case "--outputFormat":
        i++;
        args.outputFormat = argv[i];
        break;
      case "-s":
      case "--scale":
        i++;
        args.scale = Number(argv[i]);
        break;
      case "-t":
      case "--theme":
        i++;
        args.theme = argv[i];
        break;
      case "-c":
      case "--configFile":
        i++;
        args.configFile = argv[i];
        break;
      case "--md":
        args.md = true;
        break;
      case "--check":
        args.check = true;
        break;
      case "--parse":
        args.parse = true;
        break;
      case "--json":
        args.json = true;
        break;
      case "-q":
      case "--quiet":
        args.quiet = true;
        break;
      case "-h":
      case "--help":
        args.help = true;
        break;
      case "-V":
      case "--version":
        args.version = true;
        break;
      case "-w":
      case "--watch":
        args.watch = true;
        break;
      default:
        process.stderr.write(
          `Unknown option: ${arg}
Run "zenuml --help" for usage.
`
        );
        process.exit(1);
    }
    i++;
  }
  return args;
}
function loadConfigFile(filePath) {
  const resolved = resolve(filePath);
  let raw;
  try {
    raw = readFileSync(resolved, "utf-8");
  } catch {
    process.stderr.write(`Error: Cannot read config file: ${resolved}
`);
    process.exit(1);
  }
  try {
    return JSON.parse(raw);
  } catch {
    process.stderr.write(`Error: Invalid JSON in config file: ${resolved}
`);
    process.exit(1);
  }
}
let _browser = null;
function pngRuntimeHelp(detail) {
  return [
    detail,
    "",
    "PNG output requires Playwright's Chromium runtime.",
    "Install it with:",
    "  npm install playwright-core",
    "  npx playwright-core install chromium",
    "",
    "Or point ZenUML at an existing Chrome/Chromium binary:",
    "  ZENUML_CHROMIUM_PATH=/path/to/chrome zenuml -i diagram.zenuml -o diagram.png"
  ].join("\n");
}
async function getPlaywrightBrowser() {
  if (_browser) return _browser;
  let playwright;
  try {
    playwright = await import('playwright-core');
  } catch (error) {
    throw new Error(
      pngRuntimeHelp(
        `Cannot load optional dependency "playwright-core": ${error instanceof Error ? error.message : String(error)}`
      )
    );
  }
  const executablePath = process.env["ZENUML_CHROMIUM_PATH"];
  try {
    _browser = await playwright.chromium.launch(
      executablePath ? { executablePath } : void 0
    );
    return _browser;
  } catch (error) {
    throw new Error(
      pngRuntimeHelp(
        `Cannot launch Chromium${executablePath ? ` at ${executablePath}` : ""}: ${error instanceof Error ? error.message : String(error)}`
      )
    );
  }
}
async function closeBrowser() {
  if (_browser) {
    await _browser.close();
    _browser = null;
  }
}
async function rasterizeToPng(svgString, svgWidth, svgHeight, scale) {
  const browser = await getPlaywrightBrowser();
  const page = await browser.newPage({
    viewport: {
      width: Math.ceil(svgWidth),
      height: Math.ceil(svgHeight)
    },
    deviceScaleFactor: scale
  });
  try {
    const html = `<!DOCTYPE html>
<html><head><style>
  html, body { margin: 0; padding: 0; background: white; overflow: hidden; }
  svg { display: block; width: ${svgWidth}px; height: ${svgHeight}px; }
</style></head><body>${svgString}</body></html>`;
    await page.setContent(html, { waitUntil: "load" });
    const png = await page.screenshot({ type: "png" });
    return Buffer.from(png);
  } finally {
    await page.close();
  }
}
function getRuleNames(ctx) {
  return ctx?.parser?.ruleNames;
}
function isFacadeNode(node) {
  return !!node && node.symbol === void 0 && !node.parser && !!node._doc && typeof node.constructor?.name === "string" && node.constructor.name.endsWith("Context");
}
function facadeRuleName(className) {
  const base = className.endsWith("Context") ? className.slice(0, -"Context".length) : className;
  return base.charAt(0).toLowerCase() + base.slice(1);
}
function serializeFacadeNode(node) {
  const result = {
    type: "rule",
    ruleName: facadeRuleName(node.constructor.name)
  };
  const ruleChildren = node.children ?? [];
  const childSpans = ruleChildren.map((c) => ({
    c,
    start: c.start?.start ?? null,
    end: c.stop?.stop ?? null
    // inclusive
  }));
  const items = [];
  for (const cs of childSpans) {
    if (cs.start !== null) {
      items.push({ off: cs.start, node: serializeParseTree(cs.c) });
    }
  }
  const nodeStart = node.start?.start;
  const nodeStop = node.stop?.stop;
  if (nodeStart !== void 0 && nodeStop !== null && nodeStop !== void 0) {
    for (const leaf of node._doc.leaves) {
      if (leaf.offset < nodeStart) continue;
      if (leaf.offset > nodeStop) break;
      if (leaf.hidden) continue;
      const covered = childSpans.some(
        (cs) => cs.start !== null && cs.end !== null && leaf.offset >= cs.start && leaf.offset <= cs.end
      );
      if (covered) continue;
      items.push({
        off: leaf.offset,
        node: { type: "terminal", text: leaf.text }
      });
    }
  }
  items.sort((a, b) => a.off - b.off);
  if (items.length > 0) {
    result.children = items.map((it) => it.node);
  }
  return result;
}
function serializeParseTree(node) {
  if (!node) return { type: "null" };
  if (node.symbol !== void 0) {
    return {
      type: "terminal",
      text: node.getText()
    };
  }
  if (isFacadeNode(node)) {
    return serializeFacadeNode(node);
  }
  const ruleNames = getRuleNames(node);
  const ruleName = ruleNames && node.ruleIndex !== void 0 ? ruleNames[node.ruleIndex] : void 0;
  const result = {
    type: "rule"
  };
  if (ruleName) {
    result.ruleName = ruleName;
  }
  const children = node.children;
  if (children && children.length > 0) {
    result.children = children.map((child) => serializeParseTree(child));
  }
  return result;
}
async function readCode(input) {
  if (input === "-") {
    return readStdin();
  }
  const inputPath = resolve(input);
  try {
    return readFileSync(inputPath, "utf-8");
  } catch {
    throw new Error(`Cannot read input file: ${inputPath}`);
  }
}
async function checkOne(input) {
  const fileName = input === "-" ? "<stdin>" : input;
  let code;
  try {
    code = await readCode(input);
  } catch (err) {
    return {
      file: fileName,
      pass: false,
      errors: [{ line: 0, column: 0, msg: err.message }]
    };
  }
  Parser.Errors.length = 0;
  Parser.ErrorDetails.length = 0;
  Parser.RootContext(code);
  const errors = Parser.ErrorDetails.map((e) => ({
    line: e.line,
    column: e.column,
    msg: e.msg
  }));
  return {
    file: fileName,
    pass: errors.length === 0,
    errors
  };
}
async function main() {
  if (!globalThis.OffscreenCanvas && typeof document === "undefined") {
    try {
      const { createCanvas } = await import('@napi-rs/canvas');
      setCanvasContext(createCanvas(1, 1).getContext("2d"));
    } catch {
    }
  }
  const rawArgs = process.argv.slice(2);
  const args = parseArgs(rawArgs);
  if (args.help) {
    printHelp();
    process.exit(0);
  }
  if (args.version) {
    process.stdout.write(readVersion() + "\n");
    process.exit(0);
  }
  if (args.inputs.length === 0) {
    process.stderr.write("Error: -i/--input is required. Use -h for help.\n");
    process.exit(1);
  }
  let expandedInputs;
  try {
    expandedInputs = expandInputs(args.inputs);
  } catch (err) {
    process.stderr.write(`Error: ${err.message}
`);
    process.exit(1);
  }
  if (args.watch) {
    if (args.check) {
      process.stderr.write("Error: --watch is incompatible with --check.\n");
      process.exit(1);
    }
    if (args.parse) {
      process.stderr.write("Error: --watch is incompatible with --parse.\n");
      process.exit(1);
    }
    if (expandedInputs.includes("-")) {
      process.stderr.write(
        "Error: --watch is incompatible with stdin input.\n"
      );
      process.exit(1);
    }
  }
  if (args.check) {
    const results = [];
    for (const input of expandedInputs) {
      results.push(await checkOne(input));
    }
    if (args.json) {
      process.stdout.write(JSON.stringify(results, null, 2) + "\n");
    } else {
      for (const r of results) {
        if (!r.pass) {
          if (expandedInputs.length > 1) {
            process.stderr.write(`${r.file}:
`);
          }
          for (const e of r.errors) {
            const prefix = expandedInputs.length > 1 ? "  " : "";
            process.stderr.write(
              `${prefix}line ${e.line}, col ${e.column}: ${e.msg}
`
            );
          }
        }
      }
    }
    const anyFailed = results.some((r) => !r.pass);
    process.exit(anyFailed ? 1 : 0);
  }
  if (args.parse) {
    if (expandedInputs.length > 1) {
      process.stderr.write(
        "Error: --parse supports only a single input file.\n"
      );
      process.exit(1);
    }
    const input = expandedInputs[0];
    let code;
    try {
      code = await readCode(input);
    } catch (err) {
      process.stderr.write(`Error: ${err.message}
`);
      process.exit(1);
    }
    Parser.Errors.length = 0;
    Parser.ErrorDetails.length = 0;
    const tree = Parser.RootContext(code);
    if (Parser.ErrorDetails.length > 0) {
      for (const e of Parser.ErrorDetails) {
        process.stderr.write(`line ${e.line}, col ${e.column}: ${e.msg}
`);
      }
      process.exit(1);
    }
    const ast = serializeParseTree(tree);
    process.stdout.write(JSON.stringify(ast, null, 2) + "\n");
    process.exit(0);
  }
  const isMdMode = args.md || expandedInputs.some((f) => f !== "-" && /\.(?:md|markdown)$/i.test(f));
  if (isMdMode) {
    if (expandedInputs.length > 1) {
      process.stderr.write(
        "Error: --md mode supports only a single input file.\n"
      );
      process.exit(1);
    }
    const inputArg = expandedInputs[0];
    if (args.md && inputArg !== "-") {
      const ext = extname(inputArg).toLowerCase();
      if (ext !== ".md" && ext !== ".markdown") {
        process.stderr.write(
          `Error: --md flag requires a .md or .markdown input file, got: ${inputArg}
`
        );
        process.exit(1);
      }
    }
    let mdContent;
    try {
      mdContent = await readCode(inputArg);
    } catch (err) {
      process.stderr.write(`Error: ${err.message}
`);
      process.exit(1);
    }
    const effectiveFormat = args.outputFormat ?? "svg";
    if (effectiveFormat !== "svg" && effectiveFormat !== "png") {
      process.stderr.write(
        `Error: Unsupported output format: "${effectiveFormat}". Use "svg" or "png".
`
      );
      process.exit(1);
    }
    let imageDir;
    let mdOutputPath;
    if (args.output && args.output !== "-") {
      const resolvedOutput = resolve(args.output);
      imageDir = dirname(resolvedOutput);
      mdOutputPath = resolvedOutput;
    } else if (args.output === "-") {
      if (inputArg !== "-") {
        imageDir = dirname(resolve(inputArg));
      } else {
        imageDir = process.cwd();
      }
      mdOutputPath = "-";
    } else {
      if (inputArg !== "-") {
        const resolvedInput = resolve(inputArg);
        const inputDir = dirname(resolvedInput);
        const ext = extname(inputArg);
        const stem = basename(inputArg, ext);
        imageDir = inputDir;
        mdOutputPath = join(inputDir, `${stem}-rendered.md`);
      } else {
        imageDir = process.cwd();
        mdOutputPath = "-";
      }
    }
    let imageStem;
    if (inputArg !== "-") {
      const ext = extname(inputArg);
      imageStem = basename(inputArg, ext);
    } else if (mdOutputPath !== "-") {
      const ext = extname(mdOutputPath);
      imageStem = basename(mdOutputPath, ext);
    } else {
      imageStem = "diagram";
    }
    const blocks = extractZenumlBlocks(mdContent);
    const effectiveScale = args.scale ?? 2;
    const effectiveTheme = args.theme;
    const renderOptions = {};
    if (effectiveTheme) {
      renderOptions.theme = effectiveTheme;
    }
    const imageFiles = /* @__PURE__ */ new Map();
    for (const block of blocks) {
      if (block.empty) continue;
      const imageFilename = `${imageStem}-zenuml-${block.index}.${effectiveFormat}`;
      const imageFilePath = join(imageDir, imageFilename);
      let svg;
      let svgWidth;
      let svgHeight;
      try {
        const result = renderToSvg(block.code, renderOptions);
        svg = result.svg;
        svgWidth = result.width;
        svgHeight = result.height;
      } catch (err) {
        process.stderr.write(
          `Error: Failed to render zenuml block ${block.index}: ${err.message}
`
        );
        process.exit(1);
      }
      mkdirSync(imageDir, { recursive: true });
      if (effectiveFormat === "png") {
        const pngBuffer = await rasterizeToPng(
          svg,
          svgWidth,
          svgHeight,
          effectiveScale
        );
        writeFileSync(imageFilePath, pngBuffer);
      } else {
        writeFileSync(imageFilePath, svg, "utf-8");
      }
      if (!args.quiet) {
        process.stderr.write(`Wrote ${imageFilePath}
`);
      }
      imageFiles.set(block.index, imageFilename);
    }
    let outputMd = mdContent;
    const sortedBlocks = [...blocks].reverse();
    for (const block of sortedBlocks) {
      const altText = block.title || `diagram ${block.index + 1}`;
      if (block.empty) {
        outputMd = outputMd.replace(block.raw, "");
      } else {
        const imageFilename = imageFiles.get(block.index);
        const replacement = `![${altText}](${imageFilename})`;
        outputMd = outputMd.replace(block.raw, replacement);
      }
    }
    if (mdOutputPath === "-") {
      process.stdout.write(outputMd);
    } else {
      mkdirSync(dirname(mdOutputPath), { recursive: true });
      writeFileSync(mdOutputPath, outputMd, "utf-8");
      if (!args.quiet) {
        process.stderr.write(`Wrote ${mdOutputPath}
`);
      }
    }
    process.exit(0);
  }
  let configScale;
  let configTheme;
  let configOutputFormat;
  if (args.configFile) {
    const cfg = loadConfigFile(args.configFile);
    if (typeof cfg.scale === "number") configScale = cfg.scale;
    if (typeof cfg.theme === "string") configTheme = cfg.theme;
    if (typeof cfg.outputFormat === "string")
      configOutputFormat = cfg.outputFormat;
  }
  const multipleInputs = expandedInputs.length > 1;
  if (multipleInputs && args.output && args.output !== "-" && !isDirectory(resolve(args.output))) {
    process.stderr.write(
      "Error: -o must be a directory when multiple input files are provided.\n"
    );
    process.exit(1);
  }
  if (args.watch) {
    const renderForWatch = async (inputArg) => {
      await renderOneFile(inputArg, args, {
        configScale,
        configTheme,
        configOutputFormat});
    };
    const renderMdForWatch = async (inputArg) => {
      let mdContent;
      try {
        mdContent = readFileSync(resolve(inputArg), "utf-8");
      } catch {
        throw new Error(`Cannot read input file: ${resolve(inputArg)}`);
      }
      const effectiveFormat = args.outputFormat ?? "svg";
      if (effectiveFormat !== "svg" && effectiveFormat !== "png") {
        throw new Error(
          `Unsupported output format: "${effectiveFormat}". Use "svg" or "png".`
        );
      }
      let mdOutputPath;
      let imageDir;
      if (args.output && args.output !== "-") {
        const resolvedOutput = resolve(args.output);
        imageDir = dirname(resolvedOutput);
        mdOutputPath = resolvedOutput;
      } else if (args.output === "-") {
        imageDir = dirname(resolve(inputArg));
        mdOutputPath = "-";
      } else {
        const resolvedInput = resolve(inputArg);
        const inputDir = dirname(resolvedInput);
        const ext2 = extname(inputArg);
        const stem = basename(inputArg, ext2);
        imageDir = inputDir;
        mdOutputPath = join(inputDir, `${stem}-rendered.md`);
      }
      const ext = extname(inputArg);
      const imageStem = basename(inputArg, ext);
      const blocks = extractZenumlBlocks(mdContent);
      const effectiveScale = args.scale ?? configScale ?? 2;
      const imageFiles = /* @__PURE__ */ new Map();
      for (const block of blocks) {
        if (block.empty) continue;
        const imageFilename = `${imageStem}-zenuml-${block.index}.${effectiveFormat}`;
        const imageFilePath = join(imageDir, imageFilename);
        const result = renderToSvg(block.code);
        const { svg, width: svgWidth, height: svgHeight } = result;
        mkdirSync(imageDir, { recursive: true });
        if (effectiveFormat === "png") {
          const pngBuffer = await rasterizeToPng(
            svg,
            svgWidth,
            svgHeight,
            effectiveScale
          );
          writeFileSync(imageFilePath, pngBuffer);
        } else {
          writeFileSync(imageFilePath, svg, "utf-8");
        }
        imageFiles.set(block.index, imageFilename);
      }
      let outputMd = mdContent;
      const sortedBlocks = [...blocks].reverse();
      for (const block of sortedBlocks) {
        const altText = block.title || `diagram ${block.index + 1}`;
        if (block.empty) {
          outputMd = outputMd.replace(block.raw, "");
        } else {
          const imageFilename = imageFiles.get(block.index);
          const replacement = `![${altText}](${imageFilename})`;
          outputMd = outputMd.replace(block.raw, replacement);
        }
      }
      if (mdOutputPath === "-") {
        process.stdout.write(outputMd);
      } else {
        mkdirSync(dirname(mdOutputPath), { recursive: true });
        writeFileSync(mdOutputPath, outputMd, "utf-8");
      }
    };
    const hasMdInputs = expandedInputs.some(
      (f) => /\.(?:md|markdown)$/i.test(f)
    );
    const renderMdFnForWatch = hasMdInputs ? renderMdForWatch : void 0;
    const watchHandle = await startWatchMode(
      expandedInputs,
      renderForWatch,
      void 0,
      void 0,
      void 0,
      renderMdFnForWatch
    );
    process.on("SIGINT", () => {
      watchHandle.shutdown();
      process.exit(0);
    });
    await new Promise(() => {
    });
    return;
  }
  let rendered = 0;
  let errors = 0;
  for (const inputArg of expandedInputs) {
    if (!args.quiet) {
      const displayName = inputArg === "-" ? "<stdin>" : inputArg;
      process.stderr.write(`Rendering ${displayName}...
`);
    }
    try {
      await renderOneFile(inputArg, args, {
        configScale,
        configTheme,
        configOutputFormat,
        multipleInputs
      });
      rendered++;
    } catch (err) {
      errors++;
      process.stderr.write(`Error: ${inputArg}: ${err.message}
`);
    }
  }
  if (!args.quiet && expandedInputs.length > 1) {
    process.stderr.write(`Rendered ${rendered} files (${errors} errors)
`);
  }
  if (errors > 0) {
    process.exit(1);
  }
}
async function renderOneFile(inputArg, args, config) {
  const outputPath = resolveOutput(inputArg, args.output, ".svg");
  const autoFormatFromExt = outputPath !== "-" && extname(outputPath).toLowerCase() === ".png" ? "png" : void 0;
  const effectiveFormat = args.outputFormat ?? config.configOutputFormat ?? autoFormatFromExt ?? "svg";
  if (effectiveFormat !== "svg" && effectiveFormat !== "png") {
    throw new Error(
      `Unsupported output format: "${effectiveFormat}". Use "svg" or "png".`
    );
  }
  const effectiveScale = args.scale ?? config.configScale ?? 2;
  const effectiveTheme = args.theme ?? config.configTheme;
  let code;
  if (inputArg === "-") {
    code = await readStdin();
  } else {
    const inputPath = resolve(inputArg);
    try {
      code = readFileSync(inputPath, "utf-8");
    } catch {
      throw new Error(`Cannot read input file: ${inputPath}`);
    }
  }
  const renderOptions = {};
  if (effectiveTheme) {
    renderOptions.theme = effectiveTheme;
  }
  let svg;
  let svgWidth;
  let svgHeight;
  try {
    const result = renderToSvg(code, renderOptions);
    svg = result.svg;
    svgWidth = result.width;
    svgHeight = result.height;
  } catch (err) {
    throw new Error(`Failed to render diagram: ${err.message}`);
  }
  let finalOutputPath = outputPath;
  if (effectiveFormat === "png" && finalOutputPath !== "-") {
    if (!args.output || isDirectory(resolve(args.output))) {
      const ext = extname(finalOutputPath);
      finalOutputPath = finalOutputPath.slice(0, -ext.length) + ".png";
    }
  }
  if (finalOutputPath !== "-") {
    const dir = dirname(finalOutputPath);
    mkdirSync(dir, { recursive: true });
  }
  if (effectiveFormat === "png") {
    const pngBuffer = await rasterizeToPng(
      svg,
      svgWidth,
      svgHeight,
      effectiveScale
    );
    if (finalOutputPath === "-") {
      process.stdout.write(pngBuffer);
    } else {
      try {
        writeFileSync(finalOutputPath, pngBuffer);
        if (!args.quiet) {
          process.stderr.write(`Wrote ${finalOutputPath}
`);
        }
      } catch {
        throw new Error(`Cannot write output file: ${finalOutputPath}`);
      }
    }
  } else {
    if (finalOutputPath === "-") {
      process.stdout.write(svg);
    } else {
      try {
        writeFileSync(finalOutputPath, svg, "utf-8");
        if (!args.quiet) {
          process.stderr.write(`Wrote ${finalOutputPath}
`);
        }
      } catch {
        throw new Error(`Cannot write output file: ${finalOutputPath}`);
      }
    }
  }
}
function resolveOutput(input, output, defaultExt = ".svg") {
  if (output !== void 0) {
    if (output === "-") return "-";
    const resolvedOutput = resolve(output);
    if (isDirectory(resolvedOutput)) {
      if (input === "-") return "-";
      const ext2 = extname(input);
      const base2 = basename(input, ext2);
      return join(resolvedOutput, `${base2}${defaultExt}`);
    }
    return resolvedOutput;
  }
  if (input === "-") return "-";
  const ext = extname(input);
  const base = basename(input, ext);
  const dir = dirname(resolve(input));
  return join(dir, `${base}${defaultExt}`);
}
async function readStdin() {
  const chunks = [];
  for await (const chunk of Bun.stdin.stream()) {
    chunks.push(chunk);
  }
  return Buffer.concat(chunks).toString("utf-8");
}
function watchTimestamp() {
  const now = /* @__PURE__ */ new Date();
  const hh = String(now.getHours()).padStart(2, "0");
  const mm = String(now.getMinutes()).padStart(2, "0");
  const ss = String(now.getSeconds()).padStart(2, "0");
  return `[${hh}:${mm}:${ss}]`;
}
async function startWatchMode(inputs, renderFn, watchFn, log, delayMs, renderMdFn) {
  const logFn = log ?? ((msg) => process.stderr.write(msg + "\n"));
  const delay = delayMs ?? 100;
  const watchFactory = watchFn ?? ((path, handler) => {
    const watcher = watch(path, () => handler());
    return { close: () => watcher.close() };
  });
  function pickRender(p) {
    if (renderMdFn && /\.(?:md|markdown)$/i.test(p)) {
      return renderMdFn;
    }
    return renderFn;
  }
  for (const input of inputs) {
    const rf = pickRender(input);
    const ts = watchTimestamp();
    try {
      await rf(input);
      logFn(`${ts} Rendered ${input} -> done`);
    } catch (err) {
      logFn(`${ts} Error: ${input}: ${err.message}`);
    }
  }
  const handles = [];
  const timers = /* @__PURE__ */ new Map();
  for (const input of inputs) {
    const rf = pickRender(input);
    const handle = watchFactory(input, () => {
      const existing = timers.get(input);
      if (existing !== void 0) clearTimeout(existing);
      const t = setTimeout(async () => {
        timers.delete(input);
        const ts = watchTimestamp();
        try {
          await rf(input);
          logFn(`${ts} Rendered ${input} -> done`);
        } catch (err) {
          logFn(`${ts} Error: ${input}: ${err.message}`);
        }
      }, delay);
      timers.set(input, t);
    });
    handles.push(handle);
  }
  function shutdown() {
    for (const t of timers.values()) {
      clearTimeout(t);
    }
    timers.clear();
    for (const h of handles) {
      h.close();
    }
  }
  return { shutdown };
}
if (import.meta.main) {
  main().finally(() => closeBrowser());
}

export { extractZenumlBlocks, startWatchMode };
//# sourceMappingURL=zenuml.mjs.map
